eve 0.70.0 → 0.70.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/dist/src/channel/adapter.js +1 -1
- package/dist/src/channel/channel-operations.js +1 -1
- package/dist/src/channel/resolve-text.d.ts +8 -0
- package/dist/src/channel/resolve-text.js +2 -1
- package/dist/src/cli/banner.d.ts +2 -2
- package/dist/src/cli/banner.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.d.ts +7 -7
- package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +4 -3
- package/dist/src/cli/dev/tui/runner.js +2 -2
- package/dist/src/cli/dev/tui/task-activity.d.ts +0 -17
- package/dist/src/cli/dev/tui/task-activity.js +1 -1
- package/dist/src/cli/dev/tui/task-records.d.ts +17 -0
- package/dist/src/cli/dev/tui/task-records.js +1 -0
- package/dist/src/cli/dev/tui/terminal-renderer.js +2 -2
- package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +7 -1
- package/dist/src/cli/dev/tui/test/mock-terminal.js +4 -3
- package/dist/src/cli/dev/tui/theme.d.ts +1 -1
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.d.ts +15 -2
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/dev/tui/transcript-parts.d.ts +10 -2
- package/dist/src/cli/dev/tui/transcript-parts.js +2 -2
- package/dist/src/cli/dev/tui/transcript.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +8 -8
- package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +15 -0
- package/dist/src/compiled/@workflow/core/runtime/dynamic-workflow.d.ts +182 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/quickjs-assets.generated.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +2 -30
- package/dist/src/compiled/@workflow/core/runtime/quickjs-log-view.d.ts +27 -4
- package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +55 -3
- package/dist/src/compiled/@workflow/core/runtime/quickjs-snapshot-codec.d.ts +74 -0
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +44 -0
- package/dist/src/compiled/@workflow/core/runtime.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +4 -4
- package/dist/src/compiled/@workflow/core/schemas.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +27 -2
- package/dist/src/compiled/@workflow/core/serialization/hardened.d.ts +8 -0
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +1 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +48 -0
- package/dist/src/compiled/@workflow/core/serialization.js +1 -1
- package/dist/src/compiled/@workflow/core/set-error-stack.d.ts +12 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +47 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/events.d.ts +10 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +2 -0
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +127 -0
- package/dist/src/compiled/@workflow/world/queue.d.ts +6 -0
- package/dist/src/compiled/@workflow/world/runs.d.ts +9 -2
- package/dist/src/compiled/@workflow/world/snapshots.d.ts +60 -0
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +19 -17
- package/dist/src/compiled/_chunks/node/undici-B61sz6UT.js +95 -0
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-D721NpZv.js → attribute-changes-VaTKT4K8.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-B7NC1c9-.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{functions-DpZiBxgQ.js → functions-CKkqf9V6.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/helpers-CP9TjeO8.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{logger-D4GJNTk4.js → logger-oqfblE3p.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/resume-hook-yq-NAdBu.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DYKeqbob.js +32 -0
- package/dist/src/compiled/_chunks/workflow/serialization-APSKphN5.js +3 -0
- package/dist/src/compiled/_chunks/workflow/signal-exit-iIdjQcCK.js +95 -0
- package/dist/src/compiled/_chunks/workflow/sleep-Ba8SExMt.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-BhlnqoHM.js → token-BKeK6DmC.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/token-Cv2GYj9A.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-util-DaeRTzDa.js → token-util-CddTZ_ef.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{wait-until-3_1djUuL.js → wait-until-Dc9s3yyP.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{wrapper-CzrF_dmI.js → wrapper-Dq4OeGmJ.js} +4 -4
- package/dist/src/compiled/{gray-matter → js-yaml}/LICENSE +2 -2
- package/dist/src/compiled/js-yaml/index.d.ts +12 -0
- package/dist/src/compiled/js-yaml/index.js +34 -0
- package/dist/src/compiled/shadcn-registry/index.js +4 -4
- package/dist/src/context/serialize.d.ts +5 -1
- package/dist/src/context/serialize.js +1 -1
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/extension-specifier.d.ts +1 -0
- package/dist/src/discover/extension-specifier.js +1 -1
- package/dist/src/discover/extensions.d.ts +1 -1
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/discover/project-source.d.ts +5 -0
- package/dist/src/discover/project-source.js +1 -1
- package/dist/src/evals/loaders/yaml.js +1 -1
- package/dist/src/evals/session.d.ts +1 -0
- package/dist/src/evals/session.js +1 -1
- package/dist/src/evals/types.d.ts +6 -0
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/legacy-remote-agent/protocol.d.ts +8 -0
- package/dist/src/execution/legacy-remote-agent/protocol.js +1 -1
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
- package/dist/src/execution/proxied-deliver-step.d.ts +11 -0
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/sandbox/read-file.d.ts +8 -1
- package/dist/src/execution/sandbox/read-file.js +3 -3
- package/dist/src/execution/session/active-turn.d.ts +4 -1
- package/dist/src/execution/session/active-turn.js +1 -1
- package/dist/src/execution/session/checkpoint-migrations.d.ts +23 -0
- package/dist/src/execution/session/checkpoint-migrations.js +1 -0
- package/dist/src/execution/session/entry-input.d.ts +23 -5
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/finalization.js +1 -1
- package/dist/src/execution/session/handoff-steps.d.ts +24 -5
- package/dist/src/execution/session/handoff-steps.js +1 -1
- package/dist/src/execution/session/handoff.d.ts +40 -16
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/pending-turn-state.d.ts +2 -0
- package/dist/src/execution/session/pending-turn-state.js +1 -1
- package/dist/src/execution/session/program.d.ts +16 -3
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/turn-step-result.js +1 -1
- package/dist/src/execution/session/turn-step-types.d.ts +13 -1
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/session/turn.d.ts +14 -2
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +4 -4
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/harness/attachment-staging.d.ts +27 -7
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/compaction-prompt.js +2 -2
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/token-estimate.d.ts +5 -3
- package/dist/src/harness/token-estimate.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/attachments/media-metadata.d.ts +25 -0
- package/dist/src/internal/attachments/media-metadata.js +1 -0
- package/dist/src/internal/attachments/sandbox-refs.d.ts +12 -7
- package/dist/src/internal/attachments/sandbox-refs.js +1 -1
- package/dist/src/internal/authored-module-loader.js +1 -1
- package/dist/src/internal/bundler/extension-mount-plugin.d.ts +4 -0
- package/dist/src/internal/bundler/extension-mount-plugin.js +1 -1
- package/dist/src/internal/bundler/extension-scope-plugin.js +2 -2
- package/dist/src/internal/helpers/frontmatter.d.ts +24 -0
- package/dist/src/internal/helpers/frontmatter.js +1 -0
- package/dist/src/internal/helpers/markdown.js +1 -3
- package/dist/src/internal/input-text.d.ts +12 -0
- package/dist/src/internal/input-text.js +1 -0
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/nitro-bundler-config.js +1 -1
- package/dist/src/internal/node-esm-compat-banner.js +1 -1
- package/dist/src/internal/workflow/vercel-world-defaults.d.ts +1 -1
- package/dist/src/internal/workflow/vercel-world-defaults.js +1 -1
- package/dist/src/public/channels/chat-sdk/input-actions.d.ts +8 -2
- package/dist/src/public/channels/chat-sdk/input-actions.js +4 -1
- package/dist/src/public/channels/github/defaults.js +2 -3
- package/dist/src/public/channels/linear/hitl.js +2 -3
- package/dist/src/public/channels/slack/action-status.d.ts +10 -5
- package/dist/src/public/channels/slack/action-status.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +3 -3
- package/dist/src/public/channels/slack/limits.d.ts +1 -1
- package/dist/src/public/channels/slack/limits.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +11 -9
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/slack/task-card.js +1 -1
- package/dist/src/public/channels/slack/thread-status.d.ts +33 -0
- package/dist/src/public/channels/slack/thread-status.js +1 -0
- package/dist/src/public/channels/twilio/defaults.js +4 -2
- package/dist/src/public/definitions/state.d.ts +2 -0
- package/dist/src/public/definitions/state.js +1 -1
- package/dist/src/runtime/connections/openapi-spec.d.ts +1 -4
- package/dist/src/runtime/connections/openapi-spec.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/create/web-template.d.ts +4 -4
- package/dist/src/setup/scaffold/create/web-template.js +33 -26
- package/dist/src/subagents/callback-route.js +1 -1
- package/dist/src/subagents/hitl-proxy.d.ts +2 -2
- package/dist/src/subagents/hitl-proxy.js +1 -1
- package/dist/src/subagents/parent-notification.d.ts +7 -7
- package/dist/src/subagents/parent-notification.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/read-file.d.ts +7 -0
- package/dist/src/tools/provided/read-file.js +2 -2
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/docs/agent-config.md +2 -2
- package/docs/channels/chat-sdk.mdx +1 -1
- package/docs/channels/slack.mdx +21 -15
- package/docs/channels/twilio.mdx +1 -1
- package/docs/concepts/built-in-tools.md +1 -1
- package/docs/concepts/default-harness.md +4 -0
- package/docs/concepts/execution-model-and-durability.mdx +9 -1
- package/docs/concepts/sessions-runs-and-streaming.md +3 -3
- package/docs/evals/cases.mdx +1 -0
- package/docs/extensions.md +6 -3
- package/docs/guides/dev-tui.md +5 -3
- package/docs/guides/dynamic-capabilities.md +1 -1
- package/docs/sandbox/index.mdx +11 -0
- package/docs/tools/overview.mdx +4 -2
- package/package.json +8 -8
- package/dist/src/compiled/_chunks/node/undici-h5GH4RBM.js +0 -95
- package/dist/src/compiled/_chunks/workflow/debug-log-CVPstO1D.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-BUFGAKRb.js +0 -1
- package/dist/src/compiled/_chunks/workflow/frames-Dr9fHWdo.js +0 -3
- package/dist/src/compiled/_chunks/workflow/helpers-DkKxg_yn.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-uTW-jBYz.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-5DmiMN9b.js +0 -1
- package/dist/src/compiled/_chunks/workflow/serialization-CNIYl1D3.js +0 -3
- package/dist/src/compiled/_chunks/workflow/signal-exit-DZKTacNU.js +0 -95
- package/dist/src/compiled/_chunks/workflow/sleep-DFKgN7UG.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-1wSBbi5N.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-util-Cm4Ec1Bg.js +0 -1
- package/dist/src/compiled/_chunks/workflow/ws-transport--rYOVIaf.js +0 -1
- package/dist/src/compiled/gray-matter/index.d.ts +0 -62
- package/dist/src/compiled/gray-matter/index.js +0 -48
- package/dist/src/internal/helpers/gray-matter.d.ts +0 -25
- package/dist/src/internal/helpers/gray-matter.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import{_t as e,a as t,at as n,ht as r,i,ot as a,pt as o,st as s}from"./dist-B7NC1c9-.js";import{$n as c,Bt as l,Cn as u,Gt as d,Jn as f,Ln as p,Qt as ee,S as te,Sn as ne,Un as re,Ut as ie,Wt as ae,Xn as oe,Xt as se,Yt as ce,Zt as le,_ as ue,er as de,n as fe,nr as pe,on as me,or as m,rr as he,sn as ge,tr as _e,xn as ve,y as ye,yn as be}from"./logger-oqfblE3p.js";import{A as h,C as g,D as xe,E as _,M as v,O as y,T as Se,_ as b,c as Ce,f as x,g as we,j as Te,k as S,m as Ee,r as De,t as Oe,u as ke,y as Ae}from"./dist-CaNNONeg.js";import{A as je,C as Me,F as Ne,K as Pe,P as Fe,c as Ie,et as Le,o as C,p as Re,q as ze,tt as Be,w as Ve,z as He}from"./serialization-APSKphN5.js";import{A as Ue,G as We,Q as Ge,d as Ke,l as qe}from"./helpers-CP9TjeO8.js";import{t as Je}from"./attribute-changes-VaTKT4K8.js";import{i as Ye,n as Xe,r as w,t as Ze}from"./wait-until-Dc9s3yyP.js";var Qe=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],$e=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],et=`·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,tt=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,nt={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},rt=`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`,it={5:rt,"5module":rt+` export import`,6:rt+` const class extends export import super`},at=/^in(stanceof)?$/,ot=RegExp(`[`+tt+`]`),st=RegExp(`[`+tt+et+`]`);function ct(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function T(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ot.test(String.fromCharCode(e)):t!==!1&&ct(e,$e)}function E(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&st.test(String.fromCharCode(e)):t===!1?!1:ct(e,$e)||ct(e,Qe)}var D=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function O(e,t){return new D(e,{beforeExpr:!0,binop:t})}var k={beforeExpr:!0},A={startsExpr:!0},lt={};function j(e,t){return t===void 0&&(t={}),t.keyword=e,lt[e]=new D(e,t)}var M={num:new D(`num`,A),regexp:new D(`regexp`,A),string:new D(`string`,A),name:new D(`name`,A),privateId:new D(`privateId`,A),eof:new D(`eof`),bracketL:new D(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new D(`]`),braceL:new D(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new D(`}`),parenL:new D(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new D(`)`),comma:new D(`,`,k),semi:new D(`;`,k),colon:new D(`:`,k),dot:new D(`.`),question:new D(`?`,k),questionDot:new D(`?.`),arrow:new D(`=>`,k),template:new D(`template`),invalidTemplate:new D(`invalidTemplate`),ellipsis:new D(`...`,k),backQuote:new D("`",A),dollarBraceL:new D("${",{beforeExpr:!0,startsExpr:!0}),eq:new D(`=`,{beforeExpr:!0,isAssign:!0}),assign:new D(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new D(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new D(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:O(`||`,1),logicalAND:O(`&&`,2),bitwiseOR:O(`|`,3),bitwiseXOR:O(`^`,4),bitwiseAND:O(`&`,5),equality:O(`==/!=/===/!==`,6),relational:O(`</>/<=/>=`,7),bitShift:O(`<</>>/>>>`,8),plusMin:new D(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:O(`%`,10),star:O(`*`,10),slash:O(`/`,10),starstar:new D(`**`,{beforeExpr:!0}),coalesce:O(`??`,1),_break:j(`break`),_case:j(`case`,k),_catch:j(`catch`),_continue:j(`continue`),_debugger:j(`debugger`),_default:j(`default`,k),_do:j(`do`,{isLoop:!0,beforeExpr:!0}),_else:j(`else`,k),_finally:j(`finally`),_for:j(`for`,{isLoop:!0}),_function:j(`function`,A),_if:j(`if`),_return:j(`return`,k),_switch:j(`switch`),_throw:j(`throw`,k),_try:j(`try`),_var:j(`var`),_const:j(`const`),_while:j(`while`,{isLoop:!0}),_with:j(`with`),_new:j(`new`,{beforeExpr:!0,startsExpr:!0}),_this:j(`this`,A),_super:j(`super`,A),_class:j(`class`,A),_extends:j(`extends`,k),_export:j(`export`),_import:j(`import`,A),_null:j(`null`,A),_true:j(`true`,A),_false:j(`false`,A),_in:j(`in`,{beforeExpr:!0,binop:7}),_instanceof:j(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:j(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:j(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:j(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},N=/\r\n?|\n|\u2028|\u2029/,ut=new RegExp(N.source,`g`);function dt(e){return e===10||e===13||e===8232||e===8233}function ft(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(dt(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var pt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,P=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,mt=Object.prototype,ht=mt.hasOwnProperty,gt=mt.toString,_t=Object.hasOwn||(function(e,t){return ht.call(e,t)}),vt=Array.isArray||(function(e){return gt.call(e)===`[object Array]`}),yt=Object.create(null);function F(e){return yt[e]||(yt[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function I(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var bt=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,xt=function(e,t){this.line=e,this.column=t};xt.prototype.offset=function(e){return new xt(this.line,this.column+e)};var St=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function Ct(e,t){for(var n=1,r=0;;){var i=ft(e,r,t);if(i<0)return new xt(n,t-r);++n,r=i}}var wt={ecmaVersion:null,sourceType:`script`,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Tt=!1;function Et(e){var t={};for(var n in wt)t[n]=e&&_t(e,n)?e[n]:wt[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Tt&&typeof console==`object`&&console.warn&&(Tt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
2
|
+
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),vt(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return vt(t.onComment)&&(t.onComment=Dt(t,t.onComment)),t}function Dt(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new St(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var Ot=1,kt=2,At=4,jt=8,Mt=16,Nt=32,Pt=64,Ft=128,L=256,It=512,Lt=Ot|kt|L;function Rt(e,t){return kt|(e?At:0)|(t?jt:0)}var zt=0,Bt=1,R=2,Vt=3,Ht=4,Ut=5,z=function(e,t,n){this.options=e=Et(e),this.sourceFile=e.sourceFile,this.keywords=F(it[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=nt[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=F(r);var i=(r?r+` `:``)+nt.strict;this.reservedWordsStrict=F(i),this.reservedWordsStrictBind=F(i+` `+nt.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
|
|
3
|
+
`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(N).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=M.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||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(Ot),this.regexpState=null,this.privateNameStack=[]},B={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};z.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},B.inFunction.get=function(){return(this.currentVarScope().flags&kt)>0},B.inGenerator.get=function(){return(this.currentVarScope().flags&jt)>0},B.inAsync.get=function(){return(this.currentVarScope().flags&At)>0},B.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(L|It))return!1;if(t&kt)return(t&At)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},B.allowSuper.get=function(){return(this.currentThisScope().flags&Pt)>0||this.options.allowSuperOutsideMethod},B.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ft)>0},B.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},B.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(L|It)||t&kt&&!(t&Mt))return!0}return!1},B.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&L)>0},z.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},z.parse=function(e,t){return new this(t,e).parse()},z.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},z.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(z.prototype,B);var V=z.prototype,Wt=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;V.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){P.lastIndex=e,e+=P.exec(this.input)[0].length;var t=Wt.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){P.lastIndex=e+t[0].length;var n=P.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||N.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,P.lastIndex=e,e+=P.exec(this.input)[0].length,this.input[e]===`;`&&e++}},V.eat=function(e){return this.type===e&&(this.next(),!0)},V.isContextual=function(e){return this.type===M.name&&this.value===e&&!this.containsEsc},V.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},V.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},V.canInsertSemicolon=function(){return this.type===M.eof||this.type===M.braceR||N.test(this.input.slice(this.lastTokEnd,this.start))},V.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},V.semicolon=function(){!this.eat(M.semi)&&!this.insertSemicolon()&&this.unexpected()},V.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},V.expect=function(e){this.eat(e)||this.unexpected()},V.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var Gt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};V.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},V.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},V.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},V.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var H=z.prototype;H.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==M.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,`Program`)};var Kt={kind:`loop`},qt={kind:`switch`};H.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;P.lastIndex=this.pos;var t=P.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(T(r,!0)){for(var i=n+1;E(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!at.test(a))return!0}return!1},H.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;P.lastIndex=this.pos;var e=P.exec(this.input),t=this.pos+e[0].length,n;return!N.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(E(n=this.input.charCodeAt(t+8))||n>55295&&n<56320))},H.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;P.lastIndex=this.pos;var n=P.exec(this.input),r=this.pos+n[0].length;if(N.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||E(a=this.input.charCodeAt(i))||a>55295&&a<56320)return!1;P.lastIndex=i;var o=P.exec(this.input);if(o&&N.test(this.input.slice(i,i+o[0].length)))return!1}if(t){var s=r+2,c;if(this.input.slice(r,s)===`of`&&(s===this.input.length||!E(c=this.input.charCodeAt(s))&&!(c>55295&&c<56320)))return!1}var l=this.input.charCodeAt(r);return T(l,!0)||l===92},H.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},H.isUsing=function(e){return this.isUsingKeyword(!1,e)},H.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=M._var,a=`let`),r){case M._break:case M._continue:return this.parseBreakContinueStatement(i,r.keyword);case M._debugger:return this.parseDebuggerStatement(i);case M._do:return this.parseDoStatement(i);case M._for:return this.parseForStatement(i);case M._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case M._class:return e&&this.unexpected(),this.parseClass(i,!0);case M._if:return this.parseIfStatement(i);case M._return:return this.parseReturnStatement(i);case M._switch:return this.parseSwitchStatement(i);case M._throw:return this.parseThrowStatement(i);case M._try:return this.parseTryStatement(i);case M._const:case M._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case M._while:return this.parseWhileStatement(i);case M._with:return this.parseWithStatement(i);case M.braceL:return this.parseBlock(!0,i);case M.semi:return this.parseEmptyStatement(i);case M._export:case M._import:if(this.options.ecmaVersion>10&&r===M._import){P.lastIndex=this.pos;var o=P.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===M._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return t&&this.options.sourceType===`script`&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===M.name&&d.type===`Identifier`&&this.eat(M.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},H.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(M.semi)||this.insertSemicolon()?e.label=null:this.type===M.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},H.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},H.parseDoStatement=function(e){return this.next(),this.labels.push(Kt),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(M._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(M.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},H.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(Kt),this.enterScope(0),this.expect(M.parenL),this.type===M.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===M._var||this.type===M._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&this.next(),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new Gt,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===M._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===M._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},H.parseForAfterInit=function(e,t,n){return(this.type===M._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===M._in?n>-1&&this.unexpected(n):e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},H.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Yt|(n?0:Xt),!1,t)},H.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(M._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},H.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,`'return' outside of function`),this.next(),this.eat(M.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},H.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(M.braceL),this.labels.push(qt),this.enterScope(0);for(var t,n=!1;this.type!==M.braceR;)if(this.type===M._case||this.type===M._default){var r=this.type===M._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(M.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},H.parseThrowStatement=function(e){return this.next(),N.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var Jt=[];H.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?Nt:0),this.checkLValPattern(e,t?Ht:R),this.expect(M.parenR),e},H.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===M._catch){var t=this.startNode();this.next(),this.eat(M.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(M._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},H.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},H.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Kt),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},H.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},H.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},H.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===M._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},H.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},H.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(M.braceL),e&&this.enterScope(0);this.type!==M.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},H.parseFor=function(e,t){return e.init=t,this.expect(M.semi),e.test=this.type===M.semi?null:this.parseExpression(),this.expect(M.semi),e.update=this.type===M.parenR?null:this.parseExpression(),this.expect(M.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},H.parseForIn=function(e,t){var n=this.type===M._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(M.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},H.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(M.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===M._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==M._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==M._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(M.comma))break}return e},H.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?Bt:R,!1)};var Yt=1,Xt=2,Zt=4;H.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===M.star&&t&Xt&&this.unexpected(),e.generator=this.eat(M.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Yt&&(e.id=t&Zt&&this.type!==M.name?null:this.parseIdent(),e.id&&!(t&Xt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Bt:R:Vt));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Rt(e.async,e.generator)),t&Yt||(e.id=this.type===M.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&Yt?`FunctionDeclaration`:`FunctionExpression`)},H.parseFunctionParams=function(e){this.expect(M.parenL),e.params=this.parseBindingList(M.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},H.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(M.braceL);this.type!==M.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&Qt(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},H.parseClassElement=function(e){if(this.eat(M.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(M.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===M.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===M.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(M.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===M.parenL||o!==`method`||i||a){var l=!n.static&&$t(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},H.isClassElementNameStart=function(){return this.type===M.name||this.type===M.privateId||this.type===M.num||this.type===M.string||this.type===M.bracketL||this.type.keyword},H.parseClassElementName=function(e){this.type===M.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},H.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&$t(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},H.parseClassField=function(e){return $t(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&$t(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(M.eq)?(this.enterScope(It|Pt),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},H.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(L|Pt);this.type!==M.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},H.parseClassId=function(e,t){this.type===M.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,R,!1)):(t===!0&&this.unexpected(),e.id=null)},H.parseClassSuper=function(e){e.superClass=this.eat(M._extends)?this.parseExprSubscripts(null,!1):null},H.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},H.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];_t(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function Qt(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function $t(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}H.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==M.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},H.parseExport=function(e,t){if(this.next(),this.eat(M.star))return this.parseExportAllDeclaration(e,t);if(this.eat(M._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==M.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},H.parseExportDeclaration=function(e){return this.parseStatement(null)},H.parseExportDefaultDeclaration=function(){var e;if(this.type===M._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Yt|Zt,!1,e)}if(this.type===M._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},H.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),_t(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},H.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},H.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},H.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},H.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},H.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(M.braceL);!this.eat(M.braceR);){if(n)n=!1;else if(this.expect(M.comma),this.afterTrailingComma(M.braceR))break;t.push(this.parseExportSpecifier(e))}return t},H.parseImport=function(e){return this.next(),this.type===M.string?(e.specifiers=Jt,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===M.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},H.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,R),this.finishNode(e,`ImportSpecifier`)},H.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,R),this.finishNode(e,`ImportDefaultSpecifier`)},H.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,R),this.finishNode(e,`ImportNamespaceSpecifier`)},H.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===M.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(M.comma)))return e;if(this.type===M.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(M.braceL);!this.eat(M.braceR);){if(t)t=!1;else if(this.expect(M.comma),this.afterTrailingComma(M.braceR))break;e.push(this.parseImportSpecifier())}return e},H.parseWithClause=function(){var e=[];if(!this.eat(M._with))return e;this.expect(M.braceL);for(var t={},n=!0;!this.eat(M.braceR);){if(n)n=!1;else if(this.expect(M.comma),this.afterTrailingComma(M.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;_t(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},H.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===M.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(M.colon),this.type!==M.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},H.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===M.string){var e=this.parseLiteral(this.value);return bt.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},H.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},H.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var U=z.prototype;U.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},U.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},U.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},U.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==M.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},U.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case M.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(M.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case M.braceL:return this.parseObj(!0)}return this.parseIdent()},U.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(M.comma),t&&this.type===M.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===M.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===M.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},U.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},U.parseBindingListItem=function(e){return e},U.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(M.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},U.checkLValSimple=function(e,t,n){t===void 0&&(t=zt);var r=t!==zt;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===R&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(_t(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Ut&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},U.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=zt),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},U.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=zt),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var W=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},G={b_stat:new W(`{`,!1),b_expr:new W(`{`,!0),b_tmpl:new W("${",!1),p_stat:new W(`(`,!1),p_expr:new W(`(`,!0),q_tmpl:new W("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new W(`function`,!1),f_expr:new W(`function`,!0),f_expr_gen:new W(`function`,!0,!1,null,!0),f_gen:new W(`function`,!1,!1,null,!0)},en=z.prototype;en.initialContext=function(){return[G.b_stat]},en.curContext=function(){return this.context[this.context.length-1]},en.braceIsBlock=function(e){var t=this.curContext();return t===G.f_expr||t===G.f_stat?!0:e===M.colon&&(t===G.b_stat||t===G.b_expr)?!t.isExpr:e===M._return||e===M.name&&this.exprAllowed?N.test(this.input.slice(this.lastTokEnd,this.start)):e===M._else||e===M.semi||e===M.eof||e===M.parenR||e===M.arrow?!0:e===M.braceL?t===G.b_stat:e===M._var||e===M._const||e===M.name?!1:!this.exprAllowed},en.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},en.updateContext=function(e){var t,n=this.type;n.keyword&&e===M.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},en.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},M.parenR.updateContext=M.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===G.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},M.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?G.b_stat:G.b_expr),this.exprAllowed=!0},M.dollarBraceL.updateContext=function(){this.context.push(G.b_tmpl),this.exprAllowed=!0},M.parenL.updateContext=function(e){var t=e===M._if||e===M._for||e===M._with||e===M._while;this.context.push(t?G.p_stat:G.p_expr),this.exprAllowed=!0},M.incDec.updateContext=function(){},M._function.updateContext=M._class.updateContext=function(e){e.beforeExpr&&e!==M._else&&(e!==M.semi||this.curContext()===G.p_stat)&&!(e===M._return&&N.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==M.colon&&e!==M.braceL||this.curContext()!==G.b_stat)?this.context.push(G.f_expr):this.context.push(G.f_stat),this.exprAllowed=!1},M.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},M.backQuote.updateContext=function(){this.curContext()===G.q_tmpl?this.context.pop():this.context.push(G.q_tmpl),this.exprAllowed=!1},M.star.updateContext=function(e){if(e===M._function){var t=this.context.length-1;this.context[t]===G.f_expr?this.context[t]=G.f_expr_gen:this.context[t]=G.f_gen}this.exprAllowed=!0},M.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==M.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var K=z.prototype;K.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},K.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===M.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(M.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,`SequenceExpression`)}return i},K.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Gt,r=!0);var s=this.start,c=this.startLoc;(this.type===M.parenL||this.type===M.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===M.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===M.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},K.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(M.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(M.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},K.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},K.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==M._in)&&a>r){var o=this.type===M.logicalOR||this.type===M.logicalAND,s=this.type===M.coalesce;s&&(a=M.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===M.coalesce||s&&(this.type===M.logicalOR||this.type===M.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},K.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},K.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===M.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&tn(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&nn(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===M.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==M._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&this.eat(M.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function tn(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&tn(e.expression)}function nn(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&nn(e.expression)||e.type===`ParenthesizedExpression`&&nn(e.expression)}K.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},K.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},K.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(M.arrow)},K.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},K.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(M.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(M.bracketL);if(l||c&&this.type!==M.parenL&&this.type!==M.backQuote||this.eat(M.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(M.bracketR)):u.property=this.type===M.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(M.parenL)){var d=new Gt,f=this.yieldPos,p=this.awaitPos,ee=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var te=this.parseExprList(M.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=ee,this.parseSubscriptAsyncArrow(t,n,te,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=ee||this.awaitIdentPos;var ne=this.startNodeAt(t,n);ne.callee=e,ne.arguments=te,s&&(ne.optional=c),e=this.finishNode(ne,`CallExpression`)}else if(this.type===M.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var re=this.startNodeAt(t,n);re.tag=e,re.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(re,`TaggedTemplateExpression`)}return e},K.parseExprAtom=function(e,t,n){this.type===M.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case M._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===M.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==M.dot&&this.type!==M.bracketL&&this.type!==M.parenL&&this.unexpected(),this.finishNode(r,`Super`);case M._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case M.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(M._function))return this.overrideContext(G.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(M.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===M.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(M.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case M.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case M.num:case M.string:return this.parseLiteral(this.value);case M._null:case M._true:case M._false:return r=this.startNode(),r.value=this.type===M._null?null:this.type===M._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case M.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case M.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(M.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case M.braceL:return this.overrideContext(G.b_expr),this.parseObj(!1,e);case M._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case M._class:return this.parseClass(this.startNode(),!1);case M._new:return this.parseNew();case M.backQuote:return this.parseTemplate();case M._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},K.parseExprAtomDefault=function(){this.unexpected()},K.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===M.parenL&&!e)return this.parseDynamicImport(t);if(this.type===M.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},K.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(M.parenR)?e.options=null:(this.expect(M.comma),this.afterTrailingComma(M.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(M.parenR)||(this.expect(M.comma),this.afterTrailingComma(M.parenR)||this.unexpected())));else if(!this.eat(M.parenR)){var t=this.start;this.eat(M.comma)&&this.eat(M.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},K.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},K.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},K.parseParenExpression=function(){this.expect(M.parenL);var e=this.parseExpression();return this.expect(M.parenR),e},K.shouldParseArrow=function(e){return!this.canInsertSemicolon()},K.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new Gt,f=this.yieldPos,p=this.awaitPos,ee;for(this.yieldPos=0,this.awaitPos=0;this.type!==M.parenR;){if(l?l=!1:this.expect(M.comma),a&&this.afterTrailingComma(M.parenR,!0)){u=!0;break}if(this.type===M.ellipsis){ee=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===M.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var te=this.lastTokEnd,ne=this.lastTokEndLoc;if(this.expect(M.parenR),e&&this.shouldParseArrow(c)&&this.eat(M.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),ee&&this.unexpected(ee),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,te,ne)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var re=this.startNodeAt(n,r);return re.expression=i,this.finishNode(re,`ParenthesizedExpression`)}return i},K.parseParenItem=function(e){return e},K.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var rn=[];K.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===M.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.arguments=this.eat(M.parenL)?this.parseExprList(M.parenR,this.options.ecmaVersion>=8,!1):rn,this.finishNode(e,`NewExpression`)},K.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===M.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
|
|
4
|
+
`),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
5
|
+
`),cooked:this.value},this.next(),n.tail=this.type===M.backQuote,this.finishNode(n,`TemplateElement`)},K.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===M.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(M.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(M.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},K.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===M.name||this.type===M.num||this.type===M.string||this.type===M.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===M.star)&&!N.test(this.input.slice(this.lastTokEnd,this.start))},K.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(M.braceR);){if(r)r=!1;else if(this.expect(M.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(M.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},K.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(M.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===M.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===M.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(M.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(M.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},K.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},K.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===M.colon&&this.unexpected(),this.eat(M.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===M.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==M.comma&&this.type!==M.braceR&&this.type!==M.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===M.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},K.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(M.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(M.bracketR),e.key;e.computed=!1}return e.key=this.type===M.num||this.type===M.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},K.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},K.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Rt(t,r.generator)|Pt|(n?Ft:0)),this.expect(M.parenL),r.params=this.parseBindingList(M.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},K.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Rt(n,!1)|Mt),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},K.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==M.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Ut),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},K.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},K.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,Bt,t?null:n)}},K.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(M.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===M.comma?o=null:this.type===M.ellipsis?(o=this.parseSpread(r),r&&this.type===M.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},K.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&Lt)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},K.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},K.parseIdentNode=function(){var e=this.startNode();return this.type===M.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=M.name):this.unexpected(),e},K.parsePrivateIdent=function(){var e=this.startNode();return this.type===M.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},K.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===M.semi||this.canInsertSemicolon()||this.type!==M.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(M.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},K.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var an=z.prototype;an.raise=function(e,t){var n=Ct(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},an.raiseRecoverable=an.raise,an.curPosition=function(){if(this.options.locations)return new xt(this.curLine,this.pos-this.lineStart)};var q=z.prototype,on=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};q.enterScope=function(e){this.scopeStack.push(new on(e))},q.exitScope=function(){this.scopeStack.pop()},q.treatFunctionsAsVarInScope=function(e){return e.flags&kt||!this.inModule&&e.flags&Ot},q.declareName=function(e,t,n){var r=!1;if(t===R){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Ot&&delete this.undefinedExports[e]}else if(t===Ht)this.currentScope().lexical.push(e);else if(t===Vt){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&Nt&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&Ot&&delete this.undefinedExports[e],s.flags&Lt)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},q.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},q.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},q.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Lt|It|L))return t}},q.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Lt|It|L)&&!(t.flags&Mt))return t}};var sn=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new St(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},cn=z.prototype;cn.startNode=function(){return new sn(this,this.start,this.startLoc)},cn.startNodeAt=function(e,t){return new sn(this,e,t)};function ln(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}cn.finishNode=function(e,t){return ln.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},cn.finishNodeAt=function(e,t,n,r){return ln.call(this,e,t,n,r)},cn.copyNode=function(e){var t=new sn(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var un=`Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz`,dn=`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`,fn=dn+` Extended_Pictographic`,pn=fn,mn=pn+` EBase EComp EMod EPres ExtPict`,hn=mn,gn={9:dn,10:fn,11:pn,12:mn,13:hn,14:hn},_n={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},vn=`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`,yn=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,bn=yn+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,xn=bn+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,Sn=xn+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,Cn=Sn+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,wn={9:yn,10:bn,11:xn,12:Sn,13:Cn,14:Cn+` `+un},Tn={};function En(e){var t=Tn[e]={binary:F(gn[e]+` `+vn),binaryOfStrings:F(_n[e]),nonBinary:{General_Category:F(vn),Script:F(wn[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Dn=0,On=[9,10,11,12,13,14];Dn<On.length;Dn+=1){var kn=On[Dn];En(kn)}var J=z.prototype,An=function(e,t){this.parent=e,this.base=t||this};An.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},An.prototype.sibling=function(){return new An(this.parent,this.base)};var Y=function(e){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=Tn[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};Y.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Y.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Y.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Y.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Y.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Y.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Y.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Y.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Y.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},J.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function jn(e){for(var t in e)return!0;return!1}J.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&jn(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},J.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},J.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new An(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},J.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},J.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},J.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},J.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},J.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},J.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},J.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},J.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},J.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},J.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},J.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&Mn(n);)t+=I(n),e.advance();return t};function Mn(e){return e===105||e===109||e===115}J.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},J.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},J.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Nn(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Nn(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}J.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!Nn(n);)e.advance();return e.pos!==t},J.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124&&(e.advance(),!0)},J.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n){if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`)}t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},J.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},J.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=I(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=I(e.lastIntValue);return!0}return!1},J.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Pn(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Pn(e){return T(e,!0)||e===36||e===95}J.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Fn(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Fn(e){return E(e,!0)||e===36||e===95||e===8204||e===8205}J.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},J.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},J.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},J.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},J.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},J.regexp_eatZero=function(e){return e.current()===48&&!Gn(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},J.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},J.regexp_eatControlLetter=function(e){var t=e.current();return In(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function In(e){return e>=65&&e<=90||e>=97&&e<=122}J.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Ln(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function Ln(e){return e>=0&&e<=1114111}J.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)&&(e.lastIntValue=t,e.advance(),!0)},J.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Rn=0,X=1,Z=2;J.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(zn(t))return e.lastIntValue=-1,e.advance(),X;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Z&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return Rn};function zn(e){return e===100||e===68||e===115||e===83||e===119||e===87}J.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),X}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Rn},J.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){_t(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},J.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return X;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Z;e.raise(`Invalid property name`)},J.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;Bn(t=e.current());)e.lastStringValue+=I(t),e.advance();return e.lastStringValue!==``};function Bn(e){return In(e)||e===95}J.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;Vn(t=e.current());)e.lastStringValue+=I(t),e.advance();return e.lastStringValue!==``};function Vn(e){return Bn(e)||Gn(e)}J.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},J.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Z&&e.raise(`Negated character class may contain strings`),!0}return!1},J.regexp_classContents=function(e){return e.current()===93?X:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),X)},J.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},J.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||Jn(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},J.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},J.regexp_classSetExpression=function(e){var t=X,n;if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e)){n===Z&&(t=Z);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Z&&(t=X);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`)}for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Z&&(t=Z)}},J.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},J.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?X:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},J.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Z&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},J.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},J.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Z&&(t=Z);return t},J.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?X:Z},J.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&Hn(n)||Un(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function Hn(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Un(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}J.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return Wn(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Wn(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}J.regexp_eatClassControlLetter=function(e){var t=e.current();return Gn(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},J.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},J.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Gn(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function Gn(e){return e>=48&&e<=57}J.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Kn(n=e.current());)e.lastIntValue=16*e.lastIntValue+qn(n),e.advance();return e.pos!==t};function Kn(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function qn(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}J.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;e.lastIntValue=t<=3&&this.regexp_eatOctalDigit(e)?t*64+n*8+e.lastIntValue:t*8+n}else e.lastIntValue=t;return!0}return!1},J.regexp_eatOctalDigit=function(e){var t=e.current();return Jn(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Jn(e){return e>=48&&e<=55}J.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!Kn(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+qn(i),e.advance()}return!0};var Yn=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new St(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},Q=z.prototype;Q.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new Yn(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Q.getToken=function(){return this.next(),new Yn(this)},typeof Symbol<`u`&&(Q[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===M.eof,value:t}}}}),Q.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(M.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},Q.readToken=function(e){return T(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},Q.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},Q.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=ft(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},Q.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!dt(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},Q.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&pt.test(String.fromCharCode(e)))++this.pos;else break loop}}},Q.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},Q.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(M.ellipsis)):(++this.pos,this.finishToken(M.dot))},Q.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(M.assign,2):this.finishOp(M.slash,1)},Q.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?M.star:M.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=M.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(M.assign,n+1):this.finishOp(r,n)},Q.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(M.assign,3):this.finishOp(e===124?M.logicalOR:M.logicalAND,2):t===61?this.finishOp(M.assign,2):this.finishOp(e===124?M.bitwiseOR:M.bitwiseAND,1)},Q.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(M.assign,2):this.finishOp(M.bitwiseXOR,1)},Q.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||N.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(M.incDec,2):t===61?this.finishOp(M.assign,2):this.finishOp(M.plusMin,1)},Q.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(M.assign,n+1):this.finishOp(M.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(M.relational,n))},Q.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(M.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(M.arrow)):this.finishOp(e===61?M.eq:M.prefix,1)},Q.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(M.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(M.assign,3):this.finishOp(M.coalesce,2)}return this.finishOp(M.question,1)},Q.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),T(t,!0)||t===92))return this.finishToken(M.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+I(t)+`'`)},Q.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(M.parenL);case 41:return++this.pos,this.finishToken(M.parenR);case 59:return++this.pos,this.finishToken(M.semi);case 44:return++this.pos,this.finishToken(M.comma);case 91:return++this.pos,this.finishToken(M.bracketL);case 93:return++this.pos,this.finishToken(M.bracketR);case 123:return++this.pos,this.finishToken(M.braceL);case 125:return++this.pos,this.finishToken(M.braceR);case 58:return++this.pos,this.finishToken(M.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(M.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(M.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+I(e)+`'`)},Q.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},Q.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(N.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Y(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(M.regexp,{pattern:i,flags:o,value:c})},Q.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function Xn(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function Zn(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}Q.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=Zn(this.input.slice(t,this.pos)),++this.pos):T(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(M.num,n)},Q.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=Zn(this.input.slice(t,this.pos));return++this.pos,T(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(M.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),T(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=Xn(this.input.slice(t,this.pos),n);return this.finishToken(M.num,a)},Q.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},Q.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(dt(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(M.string,t)};var Qn={};Q.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Qn)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},Q.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Qn;this.raise(e,t)},Q.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===M.template||this.type===M.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(M.dollarBraceL)):(++this.pos,this.finishToken(M.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(M.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(dt(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
6
|
+
`;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},Q.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(M.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
|
|
7
|
+
`&&++this.pos;case`
|
|
8
|
+
`:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},Q.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
|
|
9
|
+
`;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return I(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return dt(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},Q.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},Q.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(E(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?T:E)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=I(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},Q.readWord=function(){var e=this.readWord1(),t=M.name;return this.keywords.test(e)&&(t=lt[e]),this.finishToken(t,e)},z.acorn={Parser:z,version:`8.15.0`,defaultOptions:wt,Position:xt,SourceLocation:St,getLineInfo:Ct,Node:sn,TokenType:D,tokTypes:M,keywordTypes:lt,TokContext:W,tokContexts:G,isIdentifierChar:E,isIdentifierStart:T,Token:Yn,isNewLine:dt,lineBreak:N,lineBreakG:ut,nonASCIIwhitespace:pt};function $n(e,t){return z.parse(e,t)}function $(e,t){return Object.assign(new h(e,t),{fatal:!0})}function er(e){return $(e instanceof Error?e.message:String(e),{cause:e})}const tr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,nr=/^[a-zA-Z_][a-zA-Z0-9_]*$/,rr=/^[ \t]*(?:import(?:\s+[\w$]|\s*(?:[*{(]|['"]))|export(?:\s+(?:async\s+)?(?:function|const|let|var|class|default)\b|\s*[{*]))/m;function ir(e,t){if(!tr.test(t))throw $(`Invalid dynamic workflow ${e} ${JSON.stringify(t)}. Use a valid JavaScript identifier: letters, digits, "_" and "$", not starting with a digit.`)}function ar(e){return Array.isArray(e)?`[${e.map(ar).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>`${JSON.stringify(e)}:${ar(t)}`).join(`,`)}}`:JSON.stringify(e)}async function or(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(t)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}const sr=2024;function cr(e,t){try{return $n(e,{ecmaVersion:sr,sourceType:`script`})}catch(e){throw $(`Dynamic workflow source is not valid JavaScript: ${e instanceof Error?e.message:String(e)}. The source is evaluated as-is, so it cannot contain TypeScript syntax or module declarations. If the error is at an \`await\`, declare the function as \`async function ${t}(...)\`.`)}}function lr(e){try{$n(e,{ecmaVersion:sr,sourceType:`script`})}catch(e){throw $(`Generated dynamic workflow code is not valid JavaScript: ${e instanceof Error?e.message:String(e)}.`)}}function ur(e,t){let n=new TextEncoder().encode(e).byteLength;if(n>131072)throw $(`Dynamic workflow source is ${n} bytes, over the 131072-byte limit.`);if(rr.test(e))throw $("Dynamic workflow source cannot use `import` or `export`. Reach registered steps through the injected `steps` object instead.");let r=cr(e,t),i=dr(r,t).body.body[0];if(i?.type!==`ExpressionStatement`||i.directive!==`use workflow`)throw $(`Dynamic workflow function ${JSON.stringify(t)} must open with a "use workflow" directive.`);if(fr(r,`use step`))throw $('Dynamic workflow source cannot declare "use step" functions. Register the step with the deployment and expose it through `experimental_dynamic.steps` instead.')}function dr(e,t){let n=`Dynamic workflow source must declare \`async function ${t}(...)\` at top level`,r=e.body.filter(e=>e.type===`FunctionDeclaration`&&e.id.name===t),[i]=r,a=``;if(r.length>1?a=` exactly once, but declares \`function ${t}\` ${r.length} times`:i?.generator?a=`, but \`${t}\` is a generator function`:i&&!i.async&&(a=`, but \`${t}\` is not async`),!i||a)throw $(`${n}${a}.`);return i}function fr(e,t){let n=[e];for(;n.length>0;){let e=n.pop();if(e.directive===t)return!0;for(let t of pr(e))n.push(t)}return!1}function pr(e){let t=[];for(let n of Object.values(e))for(let e of Array.isArray(n)?n:[n])e&&typeof e==`object`&&`type`in e&&t.push(e);return t}function mr(e,t){let n=t&&typeof t==`object`||typeof t==`function`?t.stepId:void 0;if(typeof n!=`string`||n.length===0)throw $(`Dynamic workflow step ${JSON.stringify(e)} must be an imported step function or an object with a non-empty \`stepId\`.`);return n}function hr(e){return`workflow//dynamic/${e.sourceHash.slice(0,32)}//${e.exportName}`}async function gr(e,t){let n=t.exportName??`workflow`;if(n.length>64)throw $(`Dynamic workflow exportName is ${n.length} characters, over the 64-character limit. It becomes part of the workflow id and queue name.`);if(ir(`exportName`,n),!nr.test(n))throw $(`Invalid dynamic workflow exportName ${JSON.stringify(n)}. Use letters, digits, and "_", not starting with a digit; "$" cannot appear in workflow queue names.`);if(ur(e,n),!t.steps||Object.keys(t.steps).length===0)throw $("Dynamic workflow options must expose at least one registered step through `experimental_dynamic.steps`.");let r=Object.entries(t.steps).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>(ir(`step alias`,e),[e,mr(e,t)])),i=Object.fromEntries(r),a=await or(`${e}\n${ar(i)}`),o=hr({sourceHash:a,exportName:n}),s=`const __dynamicGlobalThis = globalThis;
|
|
10
|
+
__dynamicGlobalThis.__private_workflows ??= new Map();
|
|
11
|
+
const __dynamicUseStep = __dynamicGlobalThis[Symbol.for("WORKFLOW_USE_STEP")];
|
|
12
|
+
if (typeof __dynamicUseStep !== "function") {
|
|
13
|
+
throw new Error("Dynamic workflows require a workflow VM that provides WORKFLOW_USE_STEP.");
|
|
14
|
+
}
|
|
15
|
+
const __dynamicSteps = Object.freeze({
|
|
16
|
+
${r.map(([e,t])=>` [${JSON.stringify(e)}]: __dynamicUseStep(${JSON.stringify(t)})`).join(`,
|
|
17
|
+
`)}
|
|
18
|
+
});
|
|
19
|
+
const __dynamicSleep = __dynamicGlobalThis[Symbol.for("WORKFLOW_SLEEP")];
|
|
20
|
+
const __dynamicCreateHook = __dynamicGlobalThis[Symbol.for("WORKFLOW_CREATE_HOOK")];
|
|
21
|
+
const __dynamicWorkflow = ((steps, sleep, createHook) => (() => {
|
|
22
|
+
${e}
|
|
23
|
+
return ${n};
|
|
24
|
+
})())(__dynamicSteps, __dynamicSleep, __dynamicCreateHook);
|
|
25
|
+
Object.defineProperty(__dynamicWorkflow, "workflowId", {
|
|
26
|
+
value: ${JSON.stringify(o)},
|
|
27
|
+
writable: false,
|
|
28
|
+
enumerable: false,
|
|
29
|
+
configurable: false
|
|
30
|
+
});
|
|
31
|
+
__dynamicGlobalThis.__private_workflows.set(${JSON.stringify(o)}, __dynamicWorkflow);
|
|
32
|
+
`;return lr(s),{workflowName:o,workflowCode:s,metadata:{version:1,sourceHash:a,exportName:n,steps:i}}}function _r(e){if(!e||typeof e!=`object`)return;let t=e.dynamicWorkflow;if(!t||typeof t!=`object`)return;let n=t;if(n.version===1&&typeof n.exportName==`string`&&typeof n.sourceHash==`string`)return{version:1,sourceHash:n.sourceHash,exportName:n.exportName,steps:n.steps&&typeof n.steps==`object`?n.steps:{}}}const vr=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,v.WORLD_CONTRACT_ERROR]),yr=new Set([`TRANSPORT`,`TIMEOUT`,v.STREAM_ERROR]),br=[h.is,we.is,Se.is,Ee.is];function xr(e){if(!Te.is(e)||e.status!==void 0)return!1;let t=`cause`in e?e.cause:void 0;return e.code!==void 0&&vr.has(e.code)||e.message.startsWith(`Failed to parse response body for `)||e.message.startsWith(`Schema validation failed for `)||typeof t==`object`&&!!t&&`name`in t&&t.name===`ZodError`}function Sr(e){return Ae.is(e)?!0:b.is(e)?e.status===void 0||e.status>=500:Te.is(e)?e.status!==void 0&&e.status>=500||e.code!==void 0&&yr.has(e.code):!1}function Cr(e){if(ke.is(e))return v.REPLAY_DIVERGENCE;if(Oe.is(e))return v.CORRUPTED_EVENT_LOG;if(Ce.is(e))return v.MAX_EVENTS_EXCEEDED;if(g.is(e))return v.DEPLOYMENT_MISMATCH;if(b.is(e))return v.STREAM_ERROR;if(xr(e)||Sr(e))return v.WORLD_CONTRACT_ERROR;for(let t of br)if(t(e))return v.RUNTIME_ERROR;return v.USER_ERROR}const wr=[`node`,`quickjs`];function Tr(e=process.env){let t=e.WORKFLOW_VM;if(t!==void 0&&t!==``){if(wr.includes(t))return t;throw new h(`Invalid WORKFLOW_VM value: "${t}". Expected one of: ${wr.join(`, `)}.`)}}function Er(e){let t=e.executionContext?.workflowVm;if(t!==void 0){if(!wr.includes(t))throw new h(`Invalid executionContext.workflowVm value: "${t}". Expected one of: ${wr.join(`, `)}.`);return t===`quickjs`}return Tr()===`quickjs`}function Dr(e=process.env){let t=e.WORKFLOW_SNAPSHOT_THRESHOLD;if(t===void 0||t===``)return;let n=/^\d+$/.test(t)?Number(t):NaN;if(!Number.isSafeInteger(n))throw new h(`Invalid WORKFLOW_SNAPSHOT_THRESHOLD value: "${t}". Expected a non-negative integer (0 disables snapshotting).`);return n}function Or(e,t){let n,r;return typeof e?.specVersion==`number`&&Number.isInteger(e.specVersion)&&e.specVersion>=1?(n=e.specVersion,r=`probe`):e?.format===`json`?(n=3,r=`probe-malformed`):e?.healthy?(n=2,r=`probe-unversioned`):(n=6,r=e?`probe-miss`:`no-probe-channel`),{specVersion:Math.min(n,t),source:r}}const kr=o();function Ar(){let e=ze.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[s]:e.rootRunId??t,[n]:t}}const jr=e(`@workflow/core//latestNoOpWarning`,1,()=>({warned:!1})),Mr=e(`@workflow/core//crossDeploymentProbeMissWarning`,1,()=>({warned:!1})),Nr=e(`@workflow/core//crossDeploymentProbeCache`,1,()=>new WeakMap);async function Pr(e,t){let n=Nr.get(e);n||(n=new Map,Nr.set(e,n));let r=`${t.namespace??``}\0${t.deploymentId}`,i=Date.now(),a=n.get(r);if(a?.probe!==void 0&&i-a.at<6e5)return{probe:a.probe,cached:!0};let o=a!==void 0&&a.probe===void 0&&i-a.at<6e4,s=await Ke(e,{deploymentId:t.deploymentId,runId:t.runId,timeout:o?2e3:1e4,namespace:t.namespace}).catch(()=>void 0),c=s?.format!==void 0;if(n.delete(r),n.set(r,{at:!c&&o?a.at:Date.now(),probe:c?{...s,encryptionPublicKey:void 0}:void 0}),n.size>256){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return{probe:s,cached:!1}}function Fr(){if(!We())throw $(`Dynamic workflows are disabled on this deployment, so no run was created. Set ${Ue}=1 on the deployment to enable them.`)}async function Ir(e,n,r){"use step";return await Xe(async()=>{let o=[],s=r??{};Array.isArray(n)?o=n:typeof n==`object`&&n&&(s=n);let p,g;if(typeof e==`string`){let t=s.experimental_dynamic;if(!t)throw $("'start' was given workflow source but no `experimental_dynamic` options. Pass `{ experimental_dynamic: { steps } }` to declare which registered steps the source may call.");let n=await gr(e,t);Fr(),g=n.workflowName,p={code:n.workflowCode,metadata:n.metadata}}else g=e?.workflowId;if(!g)throw new h(`'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.`,{slug:`start-invalid-workflow-function`});let xe=qe(g,s.namespace),_=`workflow.start ${m(g)}`;return ye(_,async e=>{e?.setAttributes({...me(g),...ge(`start`)}),e?.setAttributes({...l(o.length)});let n=s.world??await _e();pe(n);let r,m;if(s.deploymentId===void 0||s.deploymentId===`latest`){let e=await n.getDeploymentId();r=e,m=s.deploymentId??e,m===`latest`&&(n.resolveLatestDeploymentId?m=await n.resolveLatestDeploymentId():(jr.warned||(jr.warned=!0,fe.warn(`deploymentId: 'latest' has no effect in this world and was ignored. It is only supported by worlds with atomic deployments, such as Vercel. The run will target the current deployment.`,{currentDeploymentId:r})),m=e))}else{m=s.deploymentId;try{r=await n.getDeploymentId()}catch(e){fe.debug(`Current deployment is unavailable; starting as a cross-deployment run`,{deploymentId:m,error:String(e)})}}let ye=m!==r;if(p&&ye){let e=`Dynamic workflows can only start on the current deployment. This start targets ${JSON.stringify(m)} from ${r===void 0?`an unknown current deployment`:JSON.stringify(r)}, so no run was created.`;throw r===void 0?new h(e):$(e)}let _=`wrun_${n.createRunId?n.createRunId(s):kr()}`;if(p&&!n.capabilities?.dynamicWorkflowCode)throw $("Dynamic workflows require a World that declares `capabilities.dynamicWorkflowCode`. This World does not, so no run was created.");let v,y,Se,b,Ce,x;if(!ye)v=!0,y=!0,Se=1,Ce=n.specVersion,x=`same-deployment`;else if(typeof n.streams?.get!=`function`)v=!1,y=!1,Se=void 0,{specVersion:Ce,source:x}=Or(void 0,n.specVersion);else{let{probe:t,cached:r}=await Pr(n,{deploymentId:m,runId:_,namespace:s.namespace});b=t?.encryptionPublicKey;let i=Ye(t?.workflowCoreVersion);v=i.framedByteStreams,y=i.supportedFormats.has(f.GZIP),Se=t?.hookResumeInputVersion,{specVersion:Ce,source:x}=Or(t,n.specVersion),e?.setAttributes({...ie(r),...!r&&t?.latencyMs!==void 0?d(t.latencyMs):{},...!r&&t?.error?ae(t.error):{}}),x===`probe-miss`&&s.specVersion===void 0&&!Mr.warned&&(Mr.warned=!0,fe.warn(`The target deployment did not answer the capability probe, so the run was stamped with a fallback spec version instead of the target's own. A target on an older major version may not be able to execute it.`,{deploymentId:m,specVersion:Ce,error:t?.error}))}let we=[],Te=await ue(),S=s.specVersion??Ce;s.specVersion!==void 0&&(x=`explicit`),e?.setAttributes({...ve(S),...ne(x)});let Ee=e=>new h(ye&&s.specVersion===void 0?`${e} spec version 4 or later, but the target deployment (${m}) runs spec version ${S}.`:`${e} a World that supports spec version 4 or later.`),Oe=t(S),ke=s.allowReservedAttributes===!0,Ae;if(s.attributes&&Object.keys(s.attributes).length>0){if(S<4)throw Ee(`Initial workflow attributes require`);for(let[e,t]of Object.entries(s.attributes))if(typeof t!=`string`)throw new h(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=Je(s.attributes,{allowReservedAttributes:ke});Ae=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let je;if(s.experimental_retention!==void 0&&s.experimental_retention!=="default"){if(s.experimental_retention!==0)throw new h(`start({ experimental_retention }) must be 0 or 'default'; received ${JSON.stringify(s.experimental_retention)}.`);if(S<4)throw Ee(`start({ experimental_retention }) requires`);je={[a]:`0`}}let Me=S>=4?Ar():void 0,Ne=Me||je?{...Me,...Ae,...je}:Ae,Pe=Ne?{attributes:Ne,...ke||Me!=null||je!=null?{allowReservedAttributes:!0}:{}}:{};if(s.replayedFromRunId!==void 0&&!i.safeParse(s.replayedFromRunId).success)throw new h(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(s.replayedFromRunId).slice(0,64))}.`);let Fe=c(b),Le,C;if(Fe)Le=re(Fe),C=b;else{let e=await n.getEncryptionKeyForRun?.(_,{...s,deploymentId:m});Le=e?await he(e):void 0,C=e?oe((await de(e)).publicKey):void 0}let ze=Tr(),Be=Dr(),Ve={traceCarrier:Te,workflowCoreVersion:Ge,features:{encryption:!!Le},...Se===void 0?{}:{hookResumeInputVersion:Se},...ze?{workflowVm:ze}:{},...Be===void 0?{}:{snapshotThreshold:Be},...s.replayedFromRunId?{replayedFromRunId:s.replayedFromRunId}:{},...p?{dynamicWorkflow:p.metadata}:{}};if(p)try{n.validateRunExecutionContext?.(Ve)}catch(e){throw er(e)}let He=y&&S>=5,Ue=await Re(o,_,Le,we,globalThis,Oe,v,He),We,Ke;if(p){let t=await Ie(p.code,Le,He);t.byteLength>24576&&n.uploadDynamicWorkflowCode?Ke=await n.uploadDynamicWorkflowCode(_,{workflowName:g,code:t}):We=t,e?.setAttributes({...ce(!0),...ee(p.metadata.sourceHash),...se(t.byteLength),...le(Ke?`ref`:`inline`)})}let qe=p?{...We?{dynamicWorkflowCode:We}:{},...Ke?{dynamicWorkflowCodeRef:Ke}:{}}:{},Xe=n.getEnvironment?.(),w=n.events.create(_,{eventType:`run_created`,specVersion:S,eventData:{deploymentId:m,workflowName:g,input:Ue,executionContext:Ve,...C?{encryptionPublicKey:C}:{},...Pe,...qe}},{v1Compat:Oe});if(p){let{run:e}=await w;if(e.dynamicWorkflowCode===void 0)throw new h(`Workflow run ${_} was created, but this deployment's Workflow backend did not store its dynamic workflow code, so the run can never be replayed. It was not queued, so it will not execute. Dynamic workflows require a backend with encrypted dynamic-source storage; upgrade it, or start a workflow function from the build-time manifest instead.`)}let[Qe,$e]=await Promise.allSettled([w,n.queue(xe,{runId:_,traceCarrier:Te,...S>=3?{runInput:{input:Ue,deploymentId:m,workflowName:g,specVersion:S,executionContext:Ve,...C?{encryptionPublicKey:C}:{},...Xe===void 0?{}:{environment:Xe},...Pe,...qe}}:{}},{deploymentId:m,specVersion:S,...s.region===void 0?{}:{region:s.region}})]);if($e.status===`rejected`)throw $e.reason;let et=!1;if(Qe.status===`rejected`){let e=Qe.reason;if(!De.is(e)){if(Sr(e))et=!0,fe.warn(`Run creation event failed, but the run was accepted via the queue. The run_created event will be re-tried async by the runtime.`,{workflowRunId:_,error:e.message});else throw e}}else{let e=Qe.value;if(!Oe&&e.run.runId!==_)throw new h(`Server returned different runId than requested: expected ${_}, got ${e.run.runId}`)}return Ze(Promise.all(we),e=>{fe.warn(`Background flush of workflow argument streams failed`,{workflowRunId:_,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...be(_),...te(m),...Qe.status===`fulfilled`?u(Qe.value.run.status):{}}),new Zr(_,{resilientStart:et})})})}const Lr=e=>Array.isArray(e)?e:[e];async function Rr(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`});if(_r(r.executionContext))throw new h(`Run ${t} is a dynamic workflow run; re-running it is not supported. Start it again from its source with start(source, args, { experimental_dynamic }).`);let i=await e.getEncryptionKeyForRun?.(r),a=i?await p(i):void 0,o=Lr(await Fe(r.input,t,a,globalThis)),s=n.deploymentId??r.deploymentId,c=n.specVersion??(s===r.deploymentId?r.specVersion??1:void 0);return(await Ir({workflowId:r.workflowName},o,{deploymentId:s,world:e,specVersion:c,replayedFromRunId:t,namespace:n.namespace})).runId}catch(e){throw Error(`Failed to recreate run from ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function zr(e,n,r){try{let i=await e.runs.get(n,{resolveData:`none`}),a=w(i.specVersion,1),o=t(a),s={eventType:`run_cancelled`,specVersion:a,...r?.cancelReason===void 0?{}:{eventData:{cancelReason:r.cancelReason}}};await e.events.create(n,s,{v1Compat:o})}catch(e){throw Error(`Failed to cancel run ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Br(e,t,n){if(t.length===0)throw Error(`cancelRuns requires at least one run ID.`);if(t.length>500)throw Error(`cancelRuns accepts at most 500 run IDs (received ${t.length}).`);if(new Set(t).size!==t.length)throw Error(`cancelRuns requires unique run IDs (duplicates found).`);if(e.runs.cancelMany)return e.runs.cancelMany({runIds:t,...n?.cancelReason===void 0?{}:{cancelReason:n.cancelReason}});let r=Array(t.length),i=0,a=async()=>{for(;;){let a=i++;if(a>=t.length)return;let o=t[a];try{await zr(e,o,n),r[a]={runId:o,outcome:`cancelled`}}catch{r[a]={runId:o,outcome:`failed`,code:`internal_error`,retryable:!0}}}},o=Math.min(20,t.length);await Promise.all(Array.from({length:o},()=>a()));let s={requested:t.length,cancelled:0,alreadyCancelled:0,notCancellable:0,notFound:0,failed:0};for(let e of r)switch(e.outcome){case`cancelled`:s.cancelled++;break;case`already_cancelled`:s.alreadyCancelled++;break;case`not_cancellable`:s.notCancellable++;break;case`not_found`:s.notFound++;break;case`failed`:s.failed++}return{summary:s,results:r}}async function Vr(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(qe(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:w(r.specVersion,1)})}catch(e){throw Error(`Failed to re-enqueue run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Hr(e,n,r){try{let i=await e.runs.get(n,{resolveData:`none`}),a=t(i.specVersion),o=[],s=null;do{let t=await e.events.list({runId:n,pagination:{sortOrder:`asc`,...s?{cursor:s}:{}},resolveData:`none`});o.push(...t.data),s=t.hasMore?t.cursor:null}while(s);let c=o.filter(e=>e.eventType===`wait_created`),l=new Set(o.filter(e=>e.eventType===`wait_completed`).map(e=>e.correlationId)),u=c.filter(e=>!l.has(e.correlationId));if(r?.correlationIds&&r.correlationIds.length>0){let e=new Set(r.correlationIds);u=u.filter(t=>t.correlationId&&e.has(t.correlationId))}let d=[],f=0;for(let t of u){if(!t.correlationId)continue;let r=a?{eventType:`wait_completed`,correlationId:t.correlationId}:{eventType:`wait_completed`,correlationId:t.correlationId,specVersion:w(i.specVersion),eventData:{resumeAt:t.eventData.resumeAt}};try{await e.events.create(n,r,{v1Compat:a}),f++}catch(e){De.is(e)?f++:d.push(e instanceof Error?e:Error(String(e)))}}if(f>0&&await e.queue(qe(i.workflowName,r?.namespace),{runId:n},{deploymentId:i.deploymentId,specVersion:w(i.specVersion,1)}),d.length>0)throw AggregateError(d,`Failed to complete ${d.length}/${u.length} pending wait(s) for run ${n}`);return{stoppedCount:f}}catch(e){throw e instanceof AggregateError?e:Error(`Failed to wake up run ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Ur(e,t,n,r){try{return await e.streams.get(t,n,r?.startIndex)}catch(e){throw b.is(e)?e:new b(`Failed to read stream ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Wr(e,t){try{return await e.streams.list(t)}catch(e){throw b.is(e)?e:new b(`Failed to list streams for run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}const Gr=new Set([`completed`,`failed`]),Kr=[1e3,3e3,6e3];function qr(){return r(`WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS`,1e3,{integer:!0,min:1})}function Jr(){return r(`WORKFLOW_RETURN_VALUE_WAIT_MS`,5e4,{integer:!0,min:1})}function Yr(){return r(`WORKFLOW_RETURN_VALUE_MAX_LONG_POLLS`,10,{integer:!0,min:1})}function Xr(){let e=process.env.WORKFLOW_RETURN_VALUE_LONG_POLL;return e===void 0||e===``||e!==`0`&&e.toLowerCase()!==`false`}var Zr=class e{static[Be](e){return{runId:e.runId,resilientStart:e.#r}}static[Le](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=_e(),this.#e}#n=null;#r=!1;constructor(e,t){this.runId=e,this.#r=t?.resilientStart??!1}#i(e){return this.#n||=(async()=>{let t=await this.#t,n=e??await t.runs.get(this.runId),r=await t.getEncryptionKeyForRun?.(n);return r?await p(r):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return Hr(await this.#t,this.runId,e)}async cancel(e){"use step";let t=await this.#t,n=await t.runs.get(this.runId,{resolveData:`none`});await t.events.create(this.runId,{eventType:`run_cancelled`,specVersion:w(n.specVersion),...e?.cancelReason===void 0?{}:{eventData:{cancelReason:e.cancelReason}}})}get exists(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(()=>!0).catch(e=>{if(S.is(e))return!1;throw e}))}get status(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(e=>e.status))}get returnValue(){"use step";return this.#c()}get workflowName(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(e=>e.workflowName))}get createdAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(e=>e.createdAt))}get startedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(e=>e.startedAt))}get completedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(e=>e.completedAt))}get readable(){return this.getReadable()}getReadable(e={}){"use step";let{ops:t=[],global:n=globalThis,startIndex:r,namespace:i}=e,a=Pe(this.runId,i),o=this.#a(),s=Ve(n,t,this.runId,a,r,o),c=this.#t,l=this.runId;return Object.assign(s,{getTailIndex:async()=>(await(await c).streams.getInfo(l,a)).tailIndex})}get writable(){return this.getWritable()}getWritable(e={}){"use step";let{ops:t=[],global:n=globalThis,namespace:r}=e,i=Pe(this.runId,r),a,o,s=()=>(a??=this.#o().then(async e=>{let t={key:await Me(this.runId,e.deploymentId,e.encryptionPublicKey),deploymentId:e.deploymentId,encryptionPublicKey:e.encryptionPublicKey};return He(o,t),t}),a);return o=C({global:n,ops:t,runId:this.runId,name:i,key:()=>s().then(({key:e})=>e)}),o}async#o(){let e=await this.#t,t=this.#r?Kr.length:0,n=0;for(;;)try{return await e.runs.get(this.runId,{resolveData:`none`})}catch(e){if(!S.is(e)||n>=t)throw e;let r=Kr[n];n++,await new Promise(e=>setTimeout(e,r))}}async#s(e){let t=e.expiredAt;if(t!=null&&t<=new Date)throw new x(`Run "${this.runId}" ${e.status===`completed`?`completed`:`is ${e.status}`}, but its data expired at ${t.toISOString()} and is no longer readable.`,this.runId,e.status,t);if(e.status===`completed`){let t=await this.#i(e);return await Ne(e.output,this.runId,t)}if(e.status===`cancelled`)throw new _(this.runId);if(e.status===`failed`){let t=await this.#i(e),n;try{n=await je(e.error,this.runId,t)}catch{n=Error(`Failed to hydrate workflow run error`)}throw new xe(this.runId,n,{errorCode:e.errorCode})}throw new y(this.runId,e.status)}async#c(){let e=await this.#t,t=0,n=this.#r?Kr.length:0,r=Xr()?e.runs.waitForTerminalStatus?.bind(e.runs):void 0,i=0,a=Yr();for(;;){let o=Date.now();try{let t=r&&i<a;t&&i++;let n=t?await r(this.runId,{timeoutMs:Jr(),resolveData:`none`}):await e.runs.get(this.runId,{resolveData:`none`});if(n.status===`cancelled`)throw new _(this.runId);if(Gr.has(n.status)){let t=await e.runs.get(this.runId,{resolveData:`all`});return await this.#s(t)}throw new y(this.runId,n.status)}catch(e){if(y.is(e)){let e=qr()-(Date.now()-o);e>0&&await new Promise(t=>setTimeout(t,e));continue}if(S.is(e)&&t<n){let e=Kr[t];t++,await new Promise(t=>setTimeout(t,e));continue}throw e}}}};function Qr(e){return new Zr(e)}export{Wr as a,Vr as c,Er as d,Cr as f,_r as g,hr as h,Br as i,Hr as l,xr as m,Qr as n,Ur as o,Sr as p,zr as r,Rr as s,Zr as t,Ir as u};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{Q as e,_t as t,ht as n,pt as r,tt as i}from"./dist-B7NC1c9-.js";import{$n as a,Bn as o,Fn as s,Gn as c,In as l,Jn as u,Qn as d,Rn as f,Un as p,Vn as m,Wn as h,Xn as g,Zn as ee,ct as _,d as v,dt as te,ft as ne,h as y,ht as re,l as b,lt as ie,mt as ae,n as oe,pt as se,qn as x,rr as ce,t as S,tr as le,ut as ue,zn as de}from"./logger-oqfblE3p.js";import{A as C,F as fe,_ as pe,a as me,d as he,h as w,i as ge,m as _e,o as ve,u as ye,v as be}from"./dist-CaNNONeg.js";import{i as xe,r as Se}from"./global-DKbOgrts.js";import{awaitEarlierDeliveries as Ce,getStepFunction as we,registerDeliveryBarrier as Te}from"../../@workflow/core/private.js";import{types as T}from"node:util";import{AsyncLocalStorage as Ee}from"node:async_hooks";const De=2**32-1,Oe=De-1;var E=class extends Error{constructor(e,t,n,r){super(e),this.name=`DevalueError`,this.path=t.join(``),this.value=n,this.root=r}};const ke=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Ae(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getPrototypeOf(t)===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===ke}function je(e){return Object.prototype.toString.call(e).slice(8,-1)}function Me(e){switch(e){case`"`:return`\\"`;case`<`:return`\\u003C`;case`\\`:return`\\\\`;case`
|
|
2
|
+
`:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;case`\b`:return`\\b`;case`\f`:return`\\f`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return e<` `?`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`:``}}function D(e){let t=``,n=0,r=e.length;for(let i=0;i<r;i+=1){let r=e[i],a=Me(r);a&&(t+=e.slice(n,i)+a,n=i+1)}return`"${n===0?e:t+e.slice(n)}"`}function Ne(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)}const Pe=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function Fe(e){return Pe.test(e)?`.`+e:`[`+JSON.stringify(e)+`]`}function Ie(e){return!(!Number.isInteger(e)||e<0||e>Oe)}function Le(e){return!(!Number.isInteger(e)||e<0||e>De)}function Re(e){if(e.length===0||e.length>1&&e.charCodeAt(0)===48)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return Ie(+e)}function ze(e){for(var t=e.length-1;t>=0&&!Re(e[t]);t--);return t+1}function Be(e){let t=Object.keys(e);return t.length=ze(t),t}function Ve(e){return new Uint8Array(e).toBase64()}function He(e){return Uint8Array.fromBase64(e).buffer}function Ue(e){return Buffer.from(e).toString(`base64`)}function We(e){return Uint8Array.from(Buffer.from(e,`base64`)).buffer}function Ge(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r){let i=t.subarray(e,e+r);n+=String.fromCharCode.apply(null,i)}return btoa(n)}function Ke(e){let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer}const qe=typeof Uint8Array.fromBase64==`function`,Je=typeof process==`object`&&process.versions?.node!==void 0,Ye=qe?Ve:Je?Ue:Ge,Xe=qe?He:Je?We:Ke;function Ze(e,t){if(!t)return e;let n={};for(let r of Object.keys(e))n[r]=t[r]??e[r];return n}const Qe=Object.freeze({kind:`not-plain`}),$e=Object.freeze({kind:`symbol-keys`}),et=Object.freeze({identify:e=>e,typeOf:e=>e===null?`null`:typeof e,toPrimitive:e=>e,tagOf:e=>je(e),isThenable:e=>typeof e.then==`function`,toPromise:e=>Promise.resolve(e),unbox:e=>e.valueOf(),toISOString:e=>isNaN(e.getDate())?``:e.toISOString(),toStringValue:e=>e.toString(),regExpInfo:e=>({source:e.source,flags:e.flags}),valuesOf:e=>e,entriesOf:e=>e,viewInfo:e=>({buffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength,length:e.length,bufferByteLength:e.buffer.byteLength}),toArrayBuffer:e=>e,lengthOf:e=>e.length,hasOwn:(e,t)=>Object.hasOwn(e,t),indicesOf:e=>Be(e),shapeOf:e=>Ae(e)?Ne(e).length>0?$e:{kind:Object.getPrototypeOf(e)===null?`null-proto`:`plain`,keys:Object.keys(e)}:Qe,get:(e,t)=>e[t]}),tt=Object.freeze({fromPrimitive:e=>e,fromISOString:e=>new Date(e),fromStringValue:(e,t)=>e===`URL`?new URL(t):e===`URLSearchParams`?new URLSearchParams(t):Temporal[e.slice(9)].from(t),fromArrayBuffer:e=>e,fromRegExpInfo:(e,t)=>new RegExp(e,t),fromViewInfo:(e,t,n,r)=>{let i=globalThis[e];return n===void 0?new i(t):new i(t,n,r)},box:e=>Object(e),createArray:e=>Array(e),createSparseArray:e=>{let t=[];return t[Oe]=void 0,delete t[Oe],t.length=e,t},createObject:()=>({}),createNullPrototypeObject:()=>Object.create(null),createSet:()=>new Set,createMap:()=>new Map,set:(e,t,n)=>{e[t]=n},addValue:(e,t)=>{e.add(t)},addEntry:(e,t,n)=>{e.set(t,n)}});function nt(e,t,n){return rt(JSON.parse(e),t,n)}function rt(e,t,n){let r=Ze(tt,n?.operations);if(typeof e==`number`)return s(e,!0);if(!Array.isArray(e)||e.length===0)throw Error(`Invalid input`);let i=e,a=Array(i.length),o=null;function s(e,n=!1){if(e===-1)return r.fromPrimitive(void 0);if(e===-3)return r.fromPrimitive(NaN);if(e===-4)return r.fromPrimitive(1/0);if(e===-5)return r.fromPrimitive(-1/0);if(e===-6)return r.fromPrimitive(-0);if(n||typeof e!=`number`)throw Error(`Invalid input`);if(e in a)return a[e];if(e>=i.length)throw Error(`Invalid input`);let c=i[e];if(!c||typeof c!=`object`)a[e]=r.fromPrimitive(c);else if(Array.isArray(c)){if(typeof c[0]==`string`){let n=c[0],l=t&&Object.hasOwn(t,n)?t[n]:void 0;if(l){let t=c[1];if(typeof t!=`number`&&(t=i.push(c[1])-1),Object.hasOwn(a,t))return a[e]=l(a[t]);if(o??=new Set,o.has(t))throw Error(`Invalid circular reference`);return o.add(t),a[e]=l(s(t)),o.delete(t),a[e]}switch(n){case`Date`:a[e]=r.fromISOString(c[1]);break;case`Set`:let t=r.createSet();a[e]=t;for(let e=1;e<c.length;e+=1)r.addValue(t,s(c[e]));break;case`Map`:let o=r.createMap();a[e]=o;for(let e=1;e<c.length;e+=2)r.addEntry(o,s(c[e]),s(c[e+1]));break;case`RegExp`:a[e]=r.fromRegExpInfo(c[1],c[2]);break;case`Object`:{let t=c[1];if(typeof i[t]==`object`&&i[t][0]!==`BigInt`)throw Error(`Invalid input`);a[e]=r.box(s(t));break}case`BigInt`:a[e]=r.fromPrimitive(BigInt(c[1]));break;case`null`:let l=r.createNullPrototypeObject();a[e]=l;for(let e=1;e<c.length;e+=2){if(c[e]===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");r.set(l,c[e],s(c[e+1]))}break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:case`DataView`:{if(i[c[1]][0]!==`ArrayBuffer`)throw Error(`Invalid data`);let t=s(c[1]);a[e]=r.fromViewInfo(n,t,c[2],c[3]);break}case`ArrayBuffer`:{let t=c[1];if(typeof t!=`string`)throw Error(`Invalid ArrayBuffer encoding`);a[e]=r.fromArrayBuffer(Xe(t));break}case`URL`:case`URLSearchParams`:case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:a[e]=r.fromStringValue(n,c[1]);break;default:throw Error(`Unknown type ${n}`)}}else if(c[0]===-7){let t=c[1];if(!Le(t))throw Error(`Invalid input`);let n=r.createSparseArray(t);a[e]=n;for(let e=2;e<c.length;e+=2){let i=c[e];if(!Ie(i)||i>=t)throw Error(`Invalid input`);r.set(n,i,s(c[e+1]))}}else{let t=r.createArray(c.length);a[e]=t;for(let e=0;e<c.length;e+=1){let n=c[e];n!==-2&&r.set(t,e,s(n))}}}else{let t=r.createObject();a[e]=t;for(let e of Object.keys(c)){if(e===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");r.set(t,e,s(c[e]))}}return a[e]}return s(0)}function O(e,t,n){let r=it(!1,e,t,n);return typeof r==`string`?r:`[${r.join(`,`)}]`}function it(e,t,n,r){let i=Ze(et,r?.operations),a=[],o=new Map,s=[];if(n)for(let e of Object.getOwnPropertyNames(n))s.push({key:e,fn:n[e]});let c=[],l=0;function u(n,r){let d=i.typeOf(n);if(d===`undefined`)return-1;let f;if(d===`number`){if(f=i.toPrimitive(n),Number.isNaN(f))return-3;if(f===1/0)return-4;if(f===-1/0)return-5;if(f===0&&1/f<0)return-6}let p=i.identify(n);if(o.has(p))return o.get(p);r??=l++,o.set(p,r);for(let{key:e,fn:t}of s){let i=t(n);if(i)return a[r]=`["${e}",${u(i)}]`,r}if(d===`function`)throw new E(`Cannot stringify a function`,c,n,t);if(d===`symbol`)throw new E(`Cannot stringify a Symbol primitive`,c,n,t);let m=``;if(d!==`object`)m=at(d===`number`?f:i.toPrimitive(n));else if(i.isThenable(n)){if(!e)throw new E(`Cannot stringify a Promise or thenable — use stringifyAsync instead`,c,n,t);m=i.toPromise(n).then(e=>{let t=u(e,r);t<0&&(a[r]=t)})}else{let e=i.tagOf(n);switch(e){case`Number`:case`String`:case`Boolean`:case`BigInt`:m=`["Object",${u(i.unbox(n))}]`;break;case`Date`:m=`["Date","${i.toISOString(n)}"]`;break;case`URL`:m=`["URL",${D(i.toStringValue(n))}]`;break;case`URLSearchParams`:m=`["URLSearchParams",${D(i.toStringValue(n))}]`;break;case`RegExp`:let{source:r,flags:a}=i.regExpInfo(n);m=a?`["RegExp",${D(r)},"${a}"]`:`["RegExp",${D(r)}]`;break;case`Array`:{let e=!1,t=i.lengthOf(n);m=`[`;for(let r=0;r<t;r+=1)if(r>0&&(m+=`,`),i.hasOwn(n,r))c.push(`[${r}]`),m+=u(i.get(n,r)),c.pop();else if(e)m+=-2;else{let r=i.indicesOf(n),a=r.length,o=String(t).length;if((t-a)*3>4+o+a*(o+1)){m=`[-7,`+t;for(let e=0;e<r.length;e++){let t=r[e];c.push(`[${t}]`),m+=`,`+t+`,`+u(i.get(n,t)),c.pop()}break}e=!0,m+=-2}m+=`]`;break}case`Set`:m=`["Set"`;for(let e of i.valuesOf(n))m+=`,${u(e)}`;m+=`]`;break;case`Map`:m=`["Map"`;for(let[e,t]of i.entriesOf(n)){let n=i.typeOf(e),r=n!==`object`&&n!==`function`&&n!==`symbol`;c.push(`.get(${r?at(i.toPrimitive(e)):`...`})`),m+=`,${u(e)},${u(t)}`,c.pop()}m+=`]`;break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:{let t=i.viewInfo(n);m=`["`+e+`",`+u(t.buffer),t.byteLength!==t.bufferByteLength&&(m+=`,${t.byteOffset},${t.length}`),m+=`]`;break}case`DataView`:{let t=i.viewInfo(n);m=`["`+e+`",`+u(t.buffer),t.byteLength!==t.bufferByteLength&&(m+=`,${t.byteOffset},${t.byteLength}`),m+=`]`;break}case`ArrayBuffer`:m=`["ArrayBuffer","${Ye(i.toArrayBuffer(n))}"]`;break;case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:m=`["${e}",${D(i.toStringValue(n))}]`;break;default:{let e=i.shapeOf(n);if(e.kind===`not-plain`)throw new E(`Cannot stringify arbitrary non-POJOs`,c,n,t);if(e.kind===`symbol-keys`)throw new E(`Cannot stringify POJOs with symbolic keys`,c,n,t);if(e.kind===`null-proto`){m=`["null"`;for(let r of e.keys){if(r===`__proto__`)throw new E(`Cannot stringify objects with __proto__ keys`,c,n,t);c.push(Fe(r)),m+=`,${D(r)},${u(i.get(n,r))}`,c.pop()}m+=`]`}else{m=`{`;let r=!1;for(let a of e.keys){if(a===`__proto__`)throw new E(`Cannot stringify objects with __proto__ keys`,c,n,t);r&&(m+=`,`),r=!0,c.push(Fe(a)),m+=`${D(a)}:${u(i.get(n,a))}`,c.pop()}m+=`}`}}}}return a[r]=m,r}let d=u(t);return d<0?`${d}`:a}function at(e){let t=typeof e;return t===`string`?D(e):e===void 0?`-1`:e===0&&1/e<0?`-6`:t===`bigint`?`["BigInt","${e}"]`:String(e)}const ot=Symbol.for(`WORKFLOW_USE_STEP`),st=Symbol.for(`WORKFLOW_SET_ATTRIBUTES`),ct=Symbol.for(`WORKFLOW_CREATE_HOOK`),lt=Symbol.for(`WORKFLOW_SLEEP`),ut=Symbol.for(`WORKFLOW_GET_STREAM_ID`),dt=Symbol.for(`WORKFLOW_STABLE_ULID`),k=Symbol.for(`WORKFLOW_STREAM_NAME`),ft=Symbol.for(`WORKFLOW_STREAM_TYPE`),pt=Symbol.for(`WORKFLOW_STREAM_FRAMING`),A=Symbol.for(`WORKFLOW_STREAM_SERVER_RUN_ID`),j=Symbol.for(`WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID`),M=Symbol.for(`WORKFLOW_STREAM_SERVER_PUBLIC_KEY`),mt=Symbol.for(`WORKFLOW_STREAM_DRAIN`),ht=Symbol.for(`BODY_INIT`),gt=Symbol.for(`WEBHOOK_RESPONSE_WRITABLE`),_t=Symbol.for(`workflow-class-registry`),N=Symbol.for(`WORKFLOW_ABORT_STREAM_NAME`),P=Symbol.for(`WORKFLOW_ABORT_HOOK_TOKEN`),vt=Symbol.for(`WORKFLOW_ABORT_LISTENER_ATTACHED`),yt=Symbol.for(`WORKFLOW_ABORT_READER_CANCEL`),bt=()=>n(`WORKFLOW_STREAM_MAX_INFLIGHT_CHUNKS`,1e3,{integer:!0,min:1}),xt=()=>n(`WORKFLOW_STREAM_MAX_CHUNKS_PER_BATCH`,1e3,{integer:!0,min:1}),St=()=>n(`WORKFLOW_STREAM_MAX_BYTES_PER_BATCH`,1048576,{integer:!0,min:1}),Ct=()=>n(`WORKFLOW_STREAM_MAX_BUFFERED_BYTES`,8388608,{integer:!0,min:1}),wt=()=>n(`WORKFLOW_LOCK_POLL_INTERVAL_MS`,10,{integer:!0,min:1});function F(){let e={...xe(),pendingOps:0,producedFrames:0,acceptedFrames:0,frameWaiters:[],doneResolved:!1,streamEnded:!1};return e.promise.catch(()=>{}),e}function Tt(e){if(e.locked)return!1;let t;try{t=e.getWriter()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function Et(e){if(e.locked)return!1;let t;try{t=e.getReader()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function Dt(e){let t=e.drainBarrier;if(!t){e.resolve();return}t().then(()=>e.resolve(),t=>e.reject(t))}function Ot(e){e.producedFrames++}async function kt(e){let t=async t=>{throw await e.drainBarrier?.().catch(()=>{}),t},n=e.producedFrames;if(e.acceptedFrames<n){if(e.pipeError!==void 0)return t(e.pipeError);try{await new Promise((t,r)=>{e.frameWaiters.push({target:n,resolve:t,reject:r})})}catch(e){return t(e)}}if(e.pipeError!==void 0)return t(e.pipeError);await e.drainBarrier?.()}function At(e,t,n=WritableStream){let r=e.getWriter(),i=Symbol(`workflow-stream-release-checkpoint`),a,o=new n({start(e){a=e},async write(e){e!==i&&(Ot(t),await r.write(e))},async close(){t.userWritableClosing=!0;try{await r.close()}finally{r.releaseLock()}},async abort(e){try{await r.abort(e)}finally{r.releaseLock()}}});r.closed.catch(e=>{a.error(e)});let s;return t.settleReleasedWrites=()=>{if(t.releaseSettlementArmed=!0,s)return s;if(o.locked)return Promise.resolve(!1);if(t.userWritableClosing)return s=t.promise.then(()=>!0),s;let e;try{e=o.getWriter()}catch{return Promise.resolve(!1)}return s=(async()=>{try{try{await e.write(i)}catch(e){try{return await t.promise,!0}catch(t){throw t??e}}return await kt(t),t.doneResolved||(t.doneResolved=!0,t.resolve()),!0}catch(e){throw t.doneResolved||(t.doneResolved=!0,t.reject(e)),e}finally{e.releaseLock()}})(),s},o}function jt(e,t){if(t.writablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.writablePollingInterval=void 0;return}if(t.settleReleasedWrites){(!t.deferReleaseSettlement||t.releaseSettlementArmed)&&!e.locked&&(clearInterval(n),t.writablePollingInterval=void 0,t.settleReleasedWrites().catch(()=>{}));return}Tt(e)&&t.pendingOps===0&&(t.doneResolved=!0,clearInterval(n),t.writablePollingInterval=void 0,Dt(t))},wt());t.writablePollingInterval=n}function Mt(e,t){if(t.readablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.readablePollingInterval=void 0;return}Et(e)&&t.pendingOps===0&&(t.doneResolved=!0,clearInterval(n),t.readablePollingInterval=void 0,Dt(t))},wt());t.readablePollingInterval=n}function Nt(e,t,n){let r=t[mt];return typeof r==`function`&&(n.drainBarrier=r),Pt(e,t,n)}async function Pt(e,t,n){let r=e.getReader(),i=t.getWriter(),a;try{for(;;){if(n.streamEnded)return;let e=await Promise.race([r.read(),i.closed.then(()=>{throw new C(`Writable stream closed prematurely`)})]);if(n.streamEnded)return;if(e.done){n.streamEnded=!0,await i.close(),n.doneResolved||(n.doneResolved=!0,n.resolve());return}n.pendingOps++;try{await i.write(e.value),n.acceptedFrames++;let t=n.frameWaiters.filter(e=>e.target<=n.acceptedFrames);n.frameWaiters=n.frameWaiters.filter(e=>e.target>n.acceptedFrames);for(let e of t)e.resolve()}finally{n.pendingOps--}}}catch(e){n.streamEnded=!0,n.pipeError=e,a=e;let t=n.frameWaiters;n.frameWaiters=[];for(let n of t)n.reject(e);throw n.drainBarrier&&await n.drainBarrier().catch(()=>{}),n.doneResolved||(n.doneResolved=!0,n.reject(e)),e}finally{r.cancel(a).catch(()=>{}),r.releaseLock(),i.releaseLock()}}let I=null,Ft=null;function It(e,t){let n=I,r=Ft;I=e??null,Ft=e?new WeakSet:null;try{return t()}finally{I=n,Ft=r}}const Lt=t(`@workflow/core//useStepClosures.fns`,1,()=>({fns:new WeakSet}));function Rt(e){return Lt.fns.add(e),e}function zt(e){return typeof e==`function`&&Lt.fns.has(e)}function L(e,t){if(!I||(I.totalExecutions=(I.totalExecutions??I.executions.length)+1,I.executions.length>=5))return;let n={kind:e};t!==void 0&&(n.detail=t),I.executions.push(n)}function R(e){I&&Ft&&(Ft.has(e)||(Ft.add(e),L(`proxy`)))}const z=Function.prototype.bind.bind(Function.prototype.call);function B(e,t){let n=Object.getOwnPropertyDescriptor(e,t)?.get;if(!n)throw Error(`Missing intrinsic getter: ${String(t)}`);return z(n)}const Bt=z(Date.prototype.getDate),Vt=z(Date.prototype.getTime),Ht=z(Date.prototype.toISOString),Ut=B(RegExp.prototype,`source`),Wt=B(RegExp.prototype,`flags`),Gt=B(ArrayBuffer.prototype,`byteLength`),Kt=z(Map.prototype.entries),qt=z(Set.prototype.values),Jt=z(Number.prototype.valueOf),Yt=z(String.prototype.valueOf),Xt=z(Boolean.prototype.valueOf),Zt=z(BigInt.prototype.valueOf),Qt=Object.getPrototypeOf(Uint8Array.prototype),$t=B(Qt,Symbol.toStringTag),en=B(Qt,`buffer`),tn=B(Qt,`byteOffset`),nn=B(Qt,`byteLength`),rn=B(Qt,`length`),an=B(DataView.prototype,`buffer`),on=B(DataView.prototype,`byteOffset`),sn=B(DataView.prototype,`byteLength`),cn=B(SharedArrayBuffer.prototype,`byteLength`),ln=z(Headers.prototype[Symbol.iterator]),un=B(URL.prototype,`href`),dn=z(URLSearchParams.prototype.toString),{isProxy:V}=T,fn=z(Function.prototype.toString);function pn(e){if(V(e))return!1;let t=Object.getOwnPropertyDescriptor(e,`name`)?.value;return typeof t==`string`&&t.startsWith(`bound `)?!1:fn(e).endsWith(`{ [native code] }`)||Reflect.getPrototypeOf(e)===Function.prototype}function H(e,t){if(e===null||typeof e!=`object`&&typeof e!=`function`)return;if(V(e))return R(e),e[t];let n=e;for(;n!==null;){if(V(n))return R(n),e[t];let r=Object.getOwnPropertyDescriptor(n,t);if(r)return`value`in r?r.value:r.get?(pn(r.get)||L(`getter`,String(t)),r.get.call(e)):void 0;n=Reflect.getPrototypeOf(n)}}function mn(e,t){if(e===null||typeof e!=`object`&&typeof e!=`function`)return!1;if(V(e))return R(e),t in e;let n=e;for(;n!==null;){if(V(n))return R(n),t in e;if(Object.getOwnPropertyDescriptor(n,t))return!0;n=Reflect.getPrototypeOf(n)}return!1}function U(e,t){if(!t||typeof e!=`object`||!e)return!1;V(e)&&R(e);let n=Reflect.getPrototypeOf(e);for(;n!==null;){if(n===t)return!0;V(n)&&R(n),n=Reflect.getPrototypeOf(n)}return!1}function hn(e){return V(e)?(R(e),e.href):un(e)}function gn(e){return V(e)?(R(e),String(e)):dn(e)}function _n(e){if(V(e))return R(e),Array.from(e);try{return[...ln(e)]}catch(t){if(!(t instanceof TypeError))throw t;return L(`method`,`Headers[Symbol.iterator]`),Array.from(e)}}function vn(e){return[...Kt(e)]}function yn(e){return[...qt(e)]}function bn(e){return T.isDataView(e)?{buffer:an(e),byteOffset:on(e),byteLength:sn(e)}:{buffer:en(e),byteOffset:tn(e),byteLength:nn(e)}}const xn=new Set([`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Float16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`]),Sn=new Set([`Date`,`RegExp`,`Map`,`Set`,`Array`,`DataView`,`ArrayBuffer`,`SharedArrayBuffer`,`Number`,`String`,`Boolean`,`BigInt`,`URL`,`URLSearchParams`,...xn]);function Cn(e){if(T.isDate(e))return`Date`;if(T.isRegExp(e))return`RegExp`;if(T.isMap(e))return`Map`;if(T.isSet(e))return`Set`;if(Array.isArray(e))return`Array`;if(T.isTypedArray(e)){let t=$t(e);return t!==void 0&&xn.has(t)?t:void 0}if(T.isDataView(e))return`DataView`;if(T.isArrayBuffer(e))return`ArrayBuffer`;if(T.isSharedArrayBuffer(e))return`SharedArrayBuffer`;if(T.isNumberObject(e))return`Number`;if(T.isStringObject(e))return`String`;if(T.isBooleanObject(e))return`Boolean`;if(T.isBigIntObject(e))return`BigInt`;if(U(e,URL.prototype))return`URL`;if(U(e,URLSearchParams.prototype))return`URLSearchParams`}function wn(e){let t=H(e,Symbol.toStringTag);return typeof t==`string`?t:void 0}const Tn={tagOf:e=>{if(V(e))return R(e),et.tagOf(e);let t=Cn(e);if(t!==void 0)return t;let n=wn(e);return n===void 0||Sn.has(n)?`Object`:n},isThenable:e=>T.isPromise(e)?!0:typeof H(e,`then`)==`function`,unbox:e=>T.isNumberObject(e)?Jt(e):T.isStringObject(e)?Yt(e):T.isBooleanObject(e)?Xt(e):Zt(e),toISOString:e=>Number.isNaN(Bt(e))?``:Ht(e),toStringValue:e=>U(e,URL.prototype)?hn(e):U(e,URLSearchParams.prototype)?gn(e):(L(`method`,`toString (${wn(e)??`unknown`})`),e.toString()),regExpInfo:e=>({source:Ut(e),flags:Wt(e)}),valuesOf:e=>yn(e),entriesOf:e=>vn(e),viewInfo:e=>{let t=bn(e);return{...t,length:T.isDataView(e)?0:rn(e),bufferByteLength:T.isSharedArrayBuffer(t.buffer)?cn(t.buffer):Gt(t.buffer)}},shapeOf:e=>(V(e)&&R(e),et.shapeOf(e)),get:(e,t)=>H(e,t)},En=Symbol.for(`workflow-serialize`),Dn=Symbol.for(`workflow-deserialize`);function On(e=globalThis){let t=e,n=t[_t];return n||(n=new Map,t[_t]=n),n}const kn=`class//workflow//Run`;function An(e,t,n=globalThis){On(n).set(e,t)}function jn(e,t){return On(t).get(e)}function Mn(){return{Class:e=>{if(typeof e!=`function`)return!1;let t=H(e,`classId`);return typeof t==`string`&&{classId:t}},Instance:e=>{if(typeof e!=`object`||!e)return!1;let t=H(e,`constructor`);if(!t||typeof t!=`function`)return!1;let n=H(t,En);if(typeof n!=`function`)return!1;let r=H(t,`classId`);if(typeof r!=`string`)throw Error(`Class "${String(H(t,`name`))}" with ${String(En)} must have a static "classId" property.`);return L(`method`,`[WORKFLOW_SERIALIZE] (${r})`),{classId:r,data:n.call(t,e)}}}}function Nn(e=globalThis){return{Class:t=>{let n=t.classId,r=jn(n,e);if(!r)throw Error(`Class "${n}" not found. Make sure the class is registered with registerSerializationClass.`);return r},Instance:t=>{let n=t.classId,r=t.data,i=jn(n,e);if(!i)throw Error(`Class "${n}" not found. Make sure the class is registered with registerSerializationClass.`);let a=i[Dn];if(typeof a!=`function`)throw Error(`Class "${n}" does not have a static ${String(Dn)} method.`);return a.call(i,r)}}}function Pn(e,t,n){if(n===0)return`.`;let r=new Uint8Array(e,t,n);return Buffer.from(r).toString(`base64`)}function W(e){let t=bn(e);return Pn(t.buffer,t.byteOffset,t.byteLength)}function G(e,t){let n=e===`.`?``:e,r=Buffer.from(n,`base64`),i=new t.ArrayBuffer(r.length);return new t.Uint8Array(i).set(r),i}function Fn(e){return JSON.parse(e)}function In(e){let t=Object.getOwnPropertyDescriptor(e,`stack`);return t&&`value`in t?t.value:(L(`getter`,`stack`),t?.get?t.get.call(e):H(e,`stack`))}function Ln(e){if(!T.isNativeError(e))return!1;let t={message:H(e,`message`),stack:In(e)};return mn(e,`cause`)&&(t.cause=H(e,`cause`)),t}function K(e,t){return!T.isNativeError(t)||H(t,`name`)!==e?!1:Ln(t)}function q(e){return t=>K(e,t)||!1}function Rn(e,t){return n=>{let r=n,i=`cause`in r?{cause:r.cause}:void 0,a=e[t],o=new a(r.message,i);return r.stack!==void 0&&(o.stack=r.stack),o}}function zn(e=globalThis){return{ArrayBuffer:e=>T.isArrayBuffer(e)&&Pn(e,0,Gt(e)),BigInt:e=>typeof e==`bigint`&&String(e),BigInt64Array:e=>T.isBigInt64Array(e)&&W(e),BigUint64Array:e=>T.isBigUint64Array(e)&&W(e),DataViewBytes:e=>T.isDataView(e)&&W(e),Date:e=>T.isDate(e)?Number.isNaN(Bt(e))?`.`:Ht(e):!1,DOMException:e=>{if(typeof e!=`object`||!e)return!1;let t=H(e,`constructor`);if(!t||H(t,`name`)!==`DOMException`)return!1;let n={message:H(e,`message`),name:H(e,`name`),stack:In(e)};return mn(e,`cause`)&&(n.cause=H(e,`cause`)),n},EvalError:q(`EvalError`),FatalError:q(`FatalError`),HookConflictError:e=>{let t=K(`HookConflictError`,e);if(!t)return!1;let n={...t,token:H(e,`token`)},r=H(e,`conflictingRunId`);return r!==void 0&&(n.conflictingRunId=r),n},HookForceClaimedError:e=>{let t=K(`HookForceClaimedError`,e);if(!t)return!1;let n={...t,token:H(e,`token`),claimedByRunId:H(e,`claimedByRunId`)},r=H(e,`claimedByHookId`);return r!==void 0&&(n.claimedByHookId=r),n},RangeError:q(`RangeError`),ReferenceError:q(`ReferenceError`),RetryableError:e=>{let t=K(`RetryableError`,e);if(!t)return!1;let n=H(e,`retryAfter`),r;if(T.isDate(n)){let e=Vt(n);r=Number.isNaN(e)?Date.now()+1e3:e}else if(n&&typeof n==`object`){let e=H(n,`getTime`);if(typeof e==`function`){L(`method`,`getTime`);let t=e.call(n);r=Number.isNaN(t)?Date.now()+1e3:t}else r=Date.now()+1e3}else if(typeof n==`string`||typeof n==`number`){let e=new Date(n).getTime();r=Number.isNaN(e)?Date.now()+1e3:e}else r=Date.now()+1e3;return{...t,retryAfter:r}},RuntimeDecryptionError:e=>{let t=K(`RuntimeDecryptionError`,e);if(!t)return!1;let n={...t},r=H(e,`context`);return r!==void 0&&(n.context=r),n},StreamError:e=>{let t=K(`StreamError`,e);if(!t)return!1;let n={...t},r=H(e,`status`),i=H(e,`url`);return typeof r==`number`&&(n.status=r),typeof i==`string`&&(n.url=i),n},SyntaxError:q(`SyntaxError`),TypeError:q(`TypeError`),URIError:q(`URIError`),AggregateError:e=>{let t=K(`AggregateError`,e);return t?{...t,errors:H(e,`errors`)}:!1},Error:e=>{if(!T.isNativeError(e))return!1;let t={name:H(e,`name`),message:H(e,`message`),stack:In(e)};return mn(e,`cause`)&&(t.cause=H(e,`cause`)),t},Float32Array:e=>T.isFloat32Array(e)&&W(e),Float64Array:e=>T.isFloat64Array(e)&&W(e),Headers:e=>U(e,Headers.prototype)&&_n(e),Int8Array:e=>T.isInt8Array(e)&&W(e),Int16Array:e=>T.isInt16Array(e)&&W(e),Int32Array:e=>T.isInt32Array(e)&&W(e),Map:e=>T.isMap(e)&&vn(e),RegExp:e=>T.isRegExp(e)&&{source:Ut(e),flags:Wt(e)},Set:e=>T.isSet(e)&&yn(e),URL:e=>U(e,URL.prototype)&&hn(e),WorkflowFunction:e=>{if(typeof e!=`function`)return!1;let t=H(e,`workflowId`);return typeof t==`string`&&{workflowId:t}},URLSearchParams:e=>{if(!U(e,URLSearchParams.prototype))return!1;let t=gn(e);return t===``?`.`:t},Uint8Array:e=>T.isUint8Array(e)&&W(e),Uint8ClampedArray:e=>T.isUint8ClampedArray(e)&&W(e),Uint16Array:e=>T.isUint16Array(e)&&W(e),Uint32Array:e=>T.isUint32Array(e)&&W(e)}}function Bn(e=globalThis){return{ArrayBuffer:t=>G(t,e),BigInt:t=>e.BigInt(t),BigInt64Array:t=>new e.BigInt64Array(G(t,e)),BigUint64Array:t=>new e.BigUint64Array(G(t,e)),DataViewBytes:t=>new e.DataView(G(t,e)),Date:t=>new e.Date(t),DOMException:t=>{let n=new e.DOMException(t.message,t.name);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},EvalError:Rn(e,`EvalError`),FatalError:t=>{let n=new(e[Symbol.for(`@workflow/errors//FatalError`)]??ge)(t.message);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},HookConflictError:t=>{let n=new(e[Symbol.for(`@workflow/errors//HookConflictError`)]??me)(t.token,t.conflictingRunId);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},HookForceClaimedError:t=>{let n=new(e[Symbol.for(`@workflow/errors//HookForceClaimedError`)]??ve)(t.token,t.claimedByRunId,t.claimedByHookId);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},RangeError:Rn(e,`RangeError`),ReferenceError:Rn(e,`ReferenceError`),RetryableError:t=>{let n=new(e[Symbol.for(`@workflow/errors//RetryableError`)]??he)(t.message,{retryAfter:new e.Date(t.retryAfter)});return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},RuntimeDecryptionError:t=>{let n=e[Symbol.for(`@workflow/errors//RuntimeDecryptionError`)]??_e,r={};`cause`in t&&(r.cause=t.cause),t.context!==void 0&&(r.context=t.context);let i=new n(t.message,r);return t.stack!==void 0&&(i.stack=t.stack),i},StreamError:t=>{let n=new(e[Symbol.for(`@workflow/errors//StreamError`)]??pe)(t.message,{...`cause`in t?{cause:t.cause}:{},status:t.status,url:t.url});return t.stack!==void 0&&(n.stack=t.stack),n},SyntaxError:Rn(e,`SyntaxError`),TypeError:Rn(e,`TypeError`),URIError:Rn(e,`URIError`),AggregateError:t=>{let n=`cause`in t?{cause:t.cause}:void 0,r=new e.AggregateError(t.errors,t.message,n);return t.stack!==void 0&&(r.stack=t.stack),r},Error:t=>{let n=`cause`in t?{cause:t.cause}:void 0,r=new e.Error(t.message,n);return r.name=t.name,t.stack!==void 0&&(r.stack=t.stack),r},Float32Array:t=>new e.Float32Array(G(t,e)),Float64Array:t=>new e.Float64Array(G(t,e)),Headers:t=>new e.Headers(t),Int8Array:t=>new e.Int8Array(G(t,e)),Int16Array:t=>new e.Int16Array(G(t,e)),Int32Array:t=>new e.Int32Array(G(t,e)),Map:t=>new e.Map(t),RegExp:t=>new e.RegExp(t.source,t.flags),Set:t=>new e.Set(t),URL:t=>new e.URL(t),WorkflowFunction:e=>Object.assign(()=>{throw Error(`Workflow functions cannot be called directly. Use start() to invoke them.`)},{workflowId:e.workflowId}),URLSearchParams:t=>new e.URLSearchParams(t===`.`?``:t),Uint8Array:t=>new e.Uint8Array(G(t,e)),Uint8ClampedArray:t=>new e.Uint8ClampedArray(G(t,e)),Uint16Array:t=>new e.Uint16Array(G(t,e)),Uint32Array:t=>new e.Uint32Array(G(t,e))}}function Vn(){return{StepFunction:e=>{if(typeof e!=`function`)return!1;let t=H(e,`stepId`);if(typeof t!=`string`)return!1;let n=H(e,`__closureVarsFn`),r;typeof n==`function`&&(zt(n)||L(`method`,`__closureVarsFn`),r=n());let i=mn(e,`__boundThis`),a=i?H(e,`__boundThis`):void 0,o=H(e,`__boundArgs`),s={stepId:t};return r!==void 0&&(s.closureVars=r),i&&(s.boundThis=a),Array.isArray(o)&&o.length>0&&(s.boundArgs=o),s}}}function Hn(e=globalThis){let t=e[Symbol.for(`WORKFLOW_USE_STEP`)];return{StepFunction:e=>{let n=e.stepId,r=e.closureVars;if(!t)throw Error(`WORKFLOW_USE_STEP not found on global object. Step functions cannot be deserialized outside workflow context.`);let i=r?t(n,()=>r):t(n);if(`boundThis`in e){let t=Array.isArray(e.boundArgs)?e.boundArgs:[];return i.bind(e.boundThis,...t)}return i}}}const Un=new TextEncoder,Wn=new TextDecoder,Gn=1e5,Kn={operations:{createSparseArray(e){if(e>Gn)throw RangeError(`Sparse array length ${e} exceeds the maximum of ${Gn}`);return tt.createSparseArray(e)}}};function qn(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...Mn(),...Vn(),...zn(t)};break;case`step`:r={...Mn(),...zn(t)};break;case`client`:r={...Mn(),...zn(t)}}return n?{...r,...n}:r}function Jn(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...Nn(t),...Hn(t),...Bn(t)};break;case`step`:r={...Nn(t),...Bn(t)};break;case`client`:r={...Nn(t),...Bn(t),StepFunction:()=>{throw Error(`Step functions cannot be deserialized in client context.`)}}}return n?{...r,...n}:r}const J={formatPrefix:u.DEVALUE_V1,serialize(e,t,n){let r=qn(t,n?.global,n?.extraReducers),i=It(n?.guestCodeStats,()=>O(e,r,{operations:Tn}));return Un.encode(i)},deserialize(e,t,n){let r=Jn(t,n?.global,n?.extraRevivers);return nt(Wn.decode(e),r,Kn)},deserializeLegacy(e,t,n){return rt(e,Jn(t,n?.global,n?.extraRevivers),Kn)}};function Yn(){try{return typeof process<`u`&&process.env?.WORKFLOW_DISABLE_COMPRESSION===`1`}catch{return!1}}function Xn(){try{let e=process.env?.WORKFLOW_COMPRESSION_CODEC;return e===`gzip`||e===`zstd`?e:void 0}catch{return}}function Zn(){try{return globalThis.process?.getBuiltinModule?.(`node:zlib`)}catch{return}}function Qn(){let e=Zn();return typeof e?.zstdCompressSync==`function`&&typeof e?.zstdDecompressSync==`function`}function $n(){return typeof CompressionStream==`function`&&typeof DecompressionStream==`function`}async function er(e,t,n){let r=t.writable.getWriter(),i=r.write(e).then(()=>r.close());i.catch(()=>{});let a=[],o=0,s=t.readable.getReader();for(;;){let{done:e,value:t}=await s.read();if(e)break;if(a.push(t),o+=t.length,n!==void 0&&o>n)throw await s.cancel().catch(()=>{}),new rr(n)}await i;let c=new Uint8Array(o),l=0;for(let e of a)c.set(e,l),l+=e.length;return c}async function tr(e){return er(e,new CompressionStream(`gzip`))}async function nr(e,t){return er(e,new DecompressionStream(`gzip`),t)}var rr=class extends Error{maxOutputBytes;constructor(e){super(`Decompressed payload exceeds ${e} bytes`),this.maxOutputBytes=e,this.name=`DecompressedSizeLimitError`}};function ir(e){let t=e?.constants?.ZSTD_c_compressionLevel;return t===void 0?void 0:{params:{[t]:3}}}function ar(e){let t=Zn();return new Uint8Array(t.zstdCompressSync(e,ir(t)))}function or(e){let t=Zn();return typeof t?.zstdCompress==`function`?new Promise((n,r)=>{t.zstdCompress(e,ir(t),(e,t)=>{e?r(e):n(new Uint8Array(t))})}):Promise.resolve(ar(e))}function sr(e,t){let n=Zn();if(!n?.zstdDecompressSync)throw Error(`Compressed (zstd) workflow data encountered but node:zlib zstd support is not available in this runtime (requires Node.js 22.15+). In the browser, register a zstd decoder via registerZstdDecoder (serialization-format.ts).`);if(t===void 0)return new Uint8Array(n.zstdDecompressSync(e));try{return new Uint8Array(n.zstdDecompressSync(e,{maxOutputLength:t}))}catch(e){throw e?.code===`ERR_BUFFER_TOO_LARGE`?new rr(t):e}}function Y(e,t,n,r){e&&(e.recorded=!0,e.compressed=t!==`none`,e.codec=t,e.uncompressedBytes=n,e.storedBytes=r)}function cr(){return Xn()===`gzip`?$n()?`gzip`:`none`:Qn()?`zstd`:$n()?`gzip`:`none`}async function lr(e,t,n,r){if(!(e instanceof Uint8Array))return e;if(!t||e.length<1024||Yn())return Y(n,`none`,e.length,e.length),e;let i=cr();if(i===`none`)return Y(n,`none`,e.length,e.length),e;let a=i===`zstd`?r?.preferAsync?await or(e):ar(e):await tr(e),o=i===`zstd`?u.ZSTD:u.GZIP,s=4+a.length;return s>=e.length*.95?(Y(n,`none`,e.length,e.length),e):(Y(n,i,e.length,s),c(o,a))}async function ur(e,t,n){if(!(e instanceof Uint8Array))return e;let r=x(e);if(r===u.ZSTD){let{payload:r}=h(e),i=sr(r,n?.maxOutputBytes);return Y(t,`zstd`,i.length,e.length),i}if(r===u.GZIP){if(!$n())throw Error(`Compressed (gzip) workflow data encountered but DecompressionStream is not available in this runtime. Node.js 18+, browsers, and edge runtimes all support it.`);let{payload:r}=h(e),i=await nr(r,n?.maxOutputBytes);return Y(t,`gzip`,i.length,e.length),i}return Y(t,`none`,e.length,e.length),e}function dr(e){if(_e.is(e))throw e}function X(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof E&&t.path&&(r+=` at path "${t.path}"`);let i=`Ensure you're ${n} workflow serializable types. Check the serialization docs to see what's serializable: https://workflow-sdk.dev/docs/foundations/serialization`;return t instanceof E&&t.value!==void 0&&oe.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function fr(e,t,n){try{let r=J.serialize(e,`client`,n),i=await lr(c(u.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats);return f(i,t)}catch(e){dr(e);let{message:t,hint:n}=X(`client value`,e);throw new w(t,{hint:n,cause:e})}}async function pr(e,t,n){let r=await ur(await l(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(J.deserializeLegacy)return J.deserializeLegacy(r,`client`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=h(r);if(i===u.DEVALUE_V1)return J.deserialize(a,`client`,n);throw Error(`Unsupported serialization format: ${i}`)}async function mr(e,t,n){try{let r=J.serialize(e,`step`,n),i=await lr(c(u.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats);return f(i,t)}catch(e){dr(e);let{message:t,hint:n}=X(`step value`,e);throw new w(t,{hint:n,cause:e})}}async function hr(e,t,n){let r=await ur(await l(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(J.deserializeLegacy)return J.deserializeLegacy(r,`step`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=h(r);if(i===u.DEVALUE_V1)return J.deserialize(a,`step`,n);throw Error(`Unsupported serialization format: ${i}`)}function gr(e,t){if(!(e instanceof Uint8Array)){if(J.deserializeLegacy)return J.deserializeLegacy(e,`workflow`,t);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:n,payload:r}=h(e);if(n===u.DEVALUE_V1)return J.deserialize(r,`workflow`,t);throw Error(`Unsupported serialization format: ${n}`)}const _r=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),vr=(()=>{let e=globalThis;return e[_r]??=new Ee,e[_r]})();function yr(e,t,n){if(e===0&&t===0&&n===0)return null;let r=[];e>0&&r.push(`${e} ${fe(`step`,`steps`,e)}`),t>0&&r.push(`${t} ${fe(`hook`,`hooks`,t)}`),n>0&&r.push(`${n} ${fe(`timer`,`timers`,n)}`);let i=[];e>0&&i.push(`steps are completed`),t>0&&i.push(`hooks are received`),n>0&&i.push(`timers have elapsed`);let a=i.join(` and `);return`${r.join(` and `)} to be enqueued\n Workflow will suspend and resume when ${a}`}function br(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function xr(e){return`strm_${e}_system_abort`}function Sr(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return xr(e.slice(5))}const Cr=()=>n(`WORKFLOW_DEFERRED_CHECK_DELAY_MS`,100,{integer:!0,min:10}),wr=new Set([`hook_received`,`hook_conflict`,`wait_completed`,`attr_set`,`run_cancelled`]),Tr=new Set([`wait_completed`]);function Er(e,t){return`${e}:${t}`}const Dr=new Set([`run_completed`,`run_failed`,`run_cancelled`]);var Z;(function(e){e[e.Consumed=0]=`Consumed`,e[e.NotConsumed=1]=`NotConsumed`,e[e.Finished=2]=`Finished`})(Z||={});var Or=class{eventIndex;events;callbacks=[];parked=[];resolved=new Set;seenEventClasses=new Map;onConsumedEvent;onUnconsumedEvent;onDuplicateEvent;getPromiseQueue;isDeliveryIdle;pendingUnconsumedCheck=null;pendingUnconsumedTimeout=null;unconsumedCheckVersion=0;lastConsumed;constructor(e,t){this.events=[...e],this.eventIndex=0,this.onConsumedEvent=t.onConsumedEvent,this.onUnconsumedEvent=t.onUnconsumedEvent,this.onDuplicateEvent=t.onDuplicateEvent,this.getPromiseQueue=t.getPromiseQueue,this.isDeliveryIdle=t.isDeliveryIdle}get strandedEvent(){return this.parked[0]?.event}get parkedSummary(){let e=this.parked[0]?.event;if(e)return{count:this.parked.length,eventId:e.eventId,eventType:e.eventType}}describe(){return{index:this.eventIndex,length:this.events.length,parked:this.parked.length,lastConsumedEventId:this.lastConsumed?.eventId}}append(e){for(let t of e)this.events.push(t);process.nextTick(this.consume)}subscribe(e){this.callbacks.push(e),this.pendingUnconsumedCheck!==null&&(this.unconsumedCheckVersion++,this.pendingUnconsumedCheck=null,this.pendingUnconsumedTimeout!==null&&(clearTimeout(this.pendingUnconsumedTimeout),this.pendingUnconsumedTimeout=null)),process.nextTick(this.consume)}notifyConsumedEvent(e){if(this.onConsumedEvent)try{this.onConsumedEvent(e)}catch(e){S.error(`onConsumedEvent callback threw an error`,{error:e})}}consume=()=>{for(;;){this.drainParked();let e=this.events[this.eventIndex]??null;if(e!==null&&i(e)){this.skipSealedNoop(e);continue}let t=this.offer(e);if(t&&this.eventIndex++,e===null){t||this.handleEndOfLog();return}if(!t){let t=this.firstEventTypeOfClass(e);if(t!==void 0){this.skipDuplicateEvent(e,t);continue}this.scheduleUnconsumedCheck(e,!0);return}}};offer(e){for(let t=0;t<this.callbacks.length;t++){let n=this.callbacks[t],r=Z.NotConsumed;try{r=n(e)}catch(e){S.error(`EventConsumer callback threw an error`,{error:e})}if(r===Z.Consumed||r===Z.Finished)return e!==null&&(e.correlationId&&Tr.has(e.eventType)&&this.resolved.add(Er(e.eventType,e.correlationId)),this.recordEventClass(e),this.lastConsumed=e,this.notifyConsumedEvent(e)),r===Z.Finished&&this.callbacks.splice(t,1),!0}return!1}drainParked(){let e=this.parked.length>0;for(;e;){e=!1,this.dropParkedDuplicates();for(let t=0;t<this.parked.length;t++){let n=this.parked[t],r=this.eventIndex;this.eventIndex=n.index;let i;try{i=this.offer(n.event)}finally{this.eventIndex=r}if(i){this.parked.splice(t,1),e=this.parked.length>0;break}}}}dropParkedDuplicates(){for(let e=this.parked.length-1;e>=0;e--){let t=this.parked[e].event,n=this.firstEventTypeOfClass(t);if(n!==void 0){this.parked.splice(e,1),S.debug(`Releasing a parked event that repeats a class already in the log`,{eventId:t.eventId,eventType:t.eventType,firstEventType:n,correlationId:t.correlationId});try{this.onDuplicateEvent?.(t,n)}catch(e){S.error(`onDuplicateEvent callback threw an error`,{error:e})}}}}park(e){return!wr.has(e.eventType)||e.correlationId&&this.resolved.has(Er(e.eventType,e.correlationId))?!1:(this.parked.push({event:e,index:this.eventIndex}),this.eventIndex++,S.debug(`Parked an unclaimed event for later delivery`,{eventId:e.eventId,eventType:e.eventType,correlationId:e.correlationId,parked:this.parked.length}),!0)}eventClassKey(t){let n=e(t);return n===void 0?void 0:`${n.eventClass}:${n.entity}`}recordEventClass(e){let t=this.eventClassKey(e);t!==void 0&&!this.seenEventClasses.has(t)&&this.seenEventClasses.set(t,e.eventType)}firstEventTypeOfClass(e){let t=this.eventClassKey(e);return t===void 0?void 0:this.seenEventClasses.get(t)}skipSealedNoop(e){this.eventIndex++,S.debug(`Skipping sealed-log noop event`,{eventId:e.eventId})}skipDuplicateEvent(e,t){this.eventIndex++,S.debug(`Skipping event that repeats a class already in the log`,{eventId:e.eventId,eventType:e.eventType,firstEventType:t,correlationId:e.correlationId});try{this.onDuplicateEvent?.(e,t)}catch(e){S.error(`onDuplicateEvent callback threw an error`,{error:e})}}handleEndOfLog(){if(this.parked.length===0)return;let e=this.events.at(-1);if(!e||!Dr.has(e.eventType)){S.debug(`Reached the end of the log still holding events`,{eventId:this.parked[0].event.eventId,eventType:this.parked[0].event.eventType,correlationId:this.parked[0].event.correlationId,parked:this.parked.length});return}this.scheduleUnconsumedCheck(this.parked[0].event,!1)}scheduleUnconsumedCheck(e,t){let n=++this.unconsumedCheckVersion;this.pendingUnconsumedCheck=this.getPromiseQueue().then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.getPromiseQueue()).then(()=>{this.whenDeliveryIdle(n,()=>{this.pendingUnconsumedTimeout=setTimeout(()=>{this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===n&&(this.pendingUnconsumedCheck=null,this.resolveUnconsumedEvent(e,t))},Cr())})})}resolveUnconsumedEvent(e,t){if(t){if(this.events[this.eventIndex]!==e)return;if(this.park(e)){this.consume();return}}this.onUnconsumedEvent(e)}whenDeliveryIdle(e,t){let n=()=>{if(this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===e){if(this.isDeliveryIdle()){t();return}this.getPromiseQueue().then(()=>{this.unconsumedCheckVersion===e&&(this.pendingUnconsumedTimeout=setTimeout(n,0))})}};n()}},kr=class{aborted=!1;reason=void 0;[N];[P];#e=[];#t=null;get onabort(){return this.#t}set onabort(e){this.#t=e,e&&this.aborted&&e.call(this)}constructor(e,t){this[N]=e,this[P]=t}_setAborted(e){if(!this.aborted){this.aborted=!0,this.reason=e,this.#t&&this.#t.call(this);for(let e of this.#e)e();this.#e=[]}}addEventListener(e,t){if(e===`abort`){if(this.aborted){t();return}this.#e.push(t)}}removeEventListener(e,t){e===`abort`&&(this.#e=this.#e.filter(e=>e!==t))}throwIfAborted(){if(this.aborted)throw this.reason??new DOMException(`The operation was aborted.`,`AbortError`)}};function Ar(e){return class{signal;[N];[P];constructor(){let t=e.generateUlid(),n=xr(t),r=`abrt_${t}`;this[N]=n,this[P]=r,this.signal=new kr(n,r);let i=`hook_${e.generateUlid()}`;e.invocationsQueue.set(i,{type:`hook`,correlationId:i,token:r,isWebhook:!1,isSystem:!0}),e.eventsConsumer.subscribe(t=>{if(!t||t.correlationId!==i)return Z.NotConsumed;let n=`eventData`in t&&t.eventData&&`token`in t.eventData?t.eventData.token:void 0;if(typeof n==`string`&&n!==this[P])return e.promiseQueue=e.promiseQueue.then(()=>{e.onWorkflowError(new ye(`Replay divergence: abort hook event ${t.eventType} for ${i} belongs to token "${n}", but the current abort hook expects "${this[P]}"`,{eventId:t.eventId}))}),Z.Finished;if(t.eventType===`hook_created`){let t=e.invocationsQueue.get(i);return t&&t.type===`hook`&&(t.hasCreatedEvent=!0),Z.Consumed}if(t.eventType===`hook_received`){let n=t.eventData?.payload,r=e.eventsConsumer.eventIndex,a=Te(e,r,`hook`,{deliveredAt:+t.createdAt}),o=Ce(e,r,`hook`);return e.pendingDeliveries++,e.promiseQueue=e.promiseQueue.then(async()=>{let r;try{if(n!==void 0)try{let i=await e.replayPayloadCache.prepareEventPayload(t.eventId,`payload`,n),a=await Vi(n,e.runId,e.encryptionKey,e.globalThis,{},i);a&&typeof a==`object`&&`reason`in a&&(r=a.reason)}catch{}}finally{e.pendingDeliveries--}o.then(()=>{a.markDelivered(),this.signal._setAborted(r)})}),e.invocationsQueue.delete(i),Z.Consumed}return t.eventType===`hook_disposed`?(e.invocationsQueue.delete(i),Z.Finished):Z.NotConsumed})}abort(t){if(!this.signal.aborted){this.signal._setAborted(t);for(let[,n]of e.invocationsQueue)if(n.type===`hook`&&n.token===this[P]){n.abortRequested=!0,n.abortReason=t;break}}}}}function jr(){return{abort(e){let t=new kr(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new kr(``,``),n=Array.from(e);for(let e of n)if(e.aborted)return t._setAborted(e.reason),t;let r=[],i=()=>{for(let{signal:e,listener:t}of r)e.removeEventListener&&e.removeEventListener(`abort`,t);r.length=0};for(let e of n){if(!e.addEventListener)continue;let n=()=>{t.aborted||(t._setAborted(e.reason),i())};r.push({signal:e,listener:n}),e.addEventListener(`abort`,n)}return t},timeout(){throw Error(`AbortSignal.timeout() is not supported in workflow functions. Use sleep() with an AbortController instead. See: /docs/errors/abort-signal-timeout-in-workflow`)}}}const Mr=r();function Nr(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function Q(e){return dr(e),e instanceof w&&e.cause!==void 0||e instanceof C&&e.cause!==void 0?e.cause:e}async function $(e,t){if(e.recorded)try{let n=await b();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...se(t),...ie(e.compressed??!1),..._(e.codec??`none`),...re(r),...ae(i),...e.compressed&&r>0?ue(1-i/r):{}})}catch{}}async function Pr(e){let t=e.totalExecutions??e.executions.length;if(t!==0)try{let n=await b();if(!n)return;let r=[...new Set(e.executions.map(e=>e.detail?`${e.kind} (${e.detail})`:e.kind))];n.setAttributes({...ne(t),...te(r)})}catch{}}function Fr(e,t){let n=new TextEncoder,r={resolved:!1,key:void 0},i;return new TransformStream({async transform(a,s){try{r.resolved||(r.key=await m(t),r.resolved=!0,o(r.key)&&(i=d(r.key.recipientPublicKey,r.key.aad)));let l=O(a,e),p=n.encode(l),h=c(u.DEVALUE_V1,p);i?h=c(u.SEALED,await i.seal(h)):r.key&&(h=await f(h,r.key));let g=new Uint8Array(4+h.length);new DataView(g.buffer).setUint32(0,h.length,!1),g.set(h,4),s.enqueue(g)}catch(e){if(_e.is(e)){s.error(e);return}let{message:t,hint:n}=X(`stream chunk`,e);s.error(new w(t,{hint:n,cause:e}))}}})}function Ir(e,t){let n=new TextDecoder,r=new Uint8Array,i={resolved:!1,key:void 0},a;function o(e){let t=new Uint8Array(r.length+e.length);t.set(r,0),t.set(e,r.length),r=t}async function c(o){for(i.resolved||(i.key=await m(t),i.resolved=!0,de(i.key)&&(a=ee(i.key.keyPair,i.key.aad)));r.length>=4;){let t=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,!1);if(r.length<4+t)break;let c=r.slice(4,4+t);r=r.slice(4+t);let{format:d,payload:f}=h(c);if(d===u.ENCRYPTED||d===u.SEALED){let e=d===u.SEALED;if(!(e?de(i.key):s(i.key)!==void 0)){o.error(new _e(e?`Sealed stream data encountered but no run keypair is available. Opening a sealed frame requires the run's own encryption key material.`:`Encrypted stream data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.`,{context:{operation:`decrypt`,byteLength:f.byteLength,formatPrefix:e?`encp`:`encr`}}));return}let t;try{t=e?await a.open(h(c).payload):await l(c,i.key)}catch(e){throw _e.is(e)&&e.context&&(e.context.formatPrefix=d),e}({format:d,payload:f}=h(t))}if(d===u.DEVALUE_V1){let t=n.decode(f);o.enqueue(nt(t,e))}}}return new TransformStream({async transform(t,i){if(r.length===0&&t.length>=4){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0,!1);if(e>0&&e<1e8){o(t),await c(i);return}}else if(r.length>0){o(t),await c(i);return}let a=n.decode(t).split(`
|
|
3
|
+
`);for(let t of a)t.length>0&&i.enqueue(nt(t,e))},async flush(e){r.length>0&&await c(e)}})}const Lr=1e8;function Rr(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>Lr){t.error(new C(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${Lr}). Split the data into smaller chunks before writing.`,{slug:`serialization-failed`}));return}let n=new Uint8Array(4+e.length);new DataView(n.buffer).setUint32(0,e.length,!1),n.set(e,4),t.enqueue(n)}})}function zr(){let e=new Uint8Array;function t(t){let n=new Uint8Array(e.length+t.length);n.set(e,0),n.set(t,e.length),e=n}return new TransformStream({transform(n,r){for(n.length>0&&t(n);e.length>=4;){let t=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!1);if(t>Lr){r.error(new C(`Byte-stream frame length ${t} exceeds maximum (${Lr}). This usually means a non-framed byte stream is being read as framed.`,{slug:`serialization-failed`}));return}let n=4+t;if(e.length<n)break;r.enqueue(e.slice(4,n)),e=e.slice(n)}},flush(t){e.length>0&&t.error(new C(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function Br(e,t,n,r,i){(async()=>{await y(`workflow.stream.read`,e,{kind:await v(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`read`,"workflow.stream.read.ttfc_ms":Date.now()-e,...typeof i==`number`?{"workflow.stream.read.connect_ms":i}:{},...typeof r==`number`?{"workflow.stream.start_index":r}:{}}})})()}function Vr(e,t,n,r){(async()=>{await y(`workflow.stream.read.resolve_key`,e,{kind:await v(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.read.key_succeeded":r}})})()}function Hr(e,t,n,r,i,a){(async()=>{await y(`workflow.stream.read.complete`,e,{kind:await v(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`read_complete`,"workflow.stream.read.total_ms":Date.now()-e,"workflow.stream.read.chunks":r,"workflow.stream.read.bytes":i,...typeof a==`number`?{"workflow.stream.read.reconnects":a}:{}}})})()}var Ur=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new C(`"name" is required, got "${t}"`);let r,i=!1,a,o=0,s=0;super({type:`bytes`,pull:async c=>{let l=this.#e;if(!l){r===void 0&&(r=Date.now());let i=await le(),o=Date.now(),s=await i.streams.get(e,t,n);a=Date.now()-o,l=this.#e=s.getReader()}if(!l){c.error(Error(`Failed to get reader`));return}let u=await l.read();u.done?(this.#e=void 0,r!==void 0&&Hr(r,e,t,o,s),c.close()):(!i&&u.value.byteLength>0&&r!==void 0&&(i=!0,Br(r,e,t,n,a)),o+=1,s+=u.value.byteLength,c.enqueue(u.value))},cancel:async e=>{this.#e&&=(await this.#e.cancel(e).catch(()=>{}),void 0)}})}};const Wr=50,Gr=()=>n(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),Kr=1e3,qr=()=>n(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,Kr,{integer:!0,min:1});function Jr(e,t,n,r=async()=>void 0){let i=n===void 0||n>=0,a=n??0,o=0,s=0,c=0,l,u=!1,d,f=new Uint8Array,p,m,h=!1,g=0,ee=0,_=!1;function v(){if(_)return;_=!0;let n=Date.now();r().then(r=>{r&&Vr(n,e,t,!0)},()=>Vr(n,e,t,!1))}async function te(){if(u)return!1;let r=await le();if(u)return!1;let s=i?a+o:n,c=Date.now(),f=await r.streams.get(e,t,s);return u?(await f.cancel(d).catch(()=>{}),!1):(m===void 0&&(m=Date.now()-c),l=f.getReader(),!0)}async function ne(){try{let n=await(await le()).streams.getInfo(e,t);return n.done&&a+o>n.tailIndex}catch{return!0}}async function y(){if(u||(l&&=(await l.cancel().catch(()=>{}),void 0),u))return!1;a+=o,o=0,f=new Uint8Array;let e=Gr(),n=qr();for(;;){if(s++,c++,s>e)throw new pe(`Stream "${t}" exceeded maximum reconnection attempts (${e})`);if(c>n)throw new pe(`Stream "${t}" exceeded maximum total reconnection attempts (${n})`);try{return!!await te()}catch(e){if(u)return!1;if(be.is(e))throw e}}}return new ReadableStream({pull:async r=>{if(!u)for(p===void 0&&(p=Date.now()),v();;){if(!l)try{if(!await te())return}catch(e){if(u)return;r.error(e);return}let a;try{a=await l.read()}catch(e){if(u)return;if(!i){r.error(e);return}try{if(!await y())return}catch(e){r.error(e);return}continue}if(u)return;if(a.done||!a.value){l=void 0;let n=!i||await ne();if(u)return;if(!n){try{if(!await y())return}catch(e){r.error(e);return}continue}p!==void 0&&Hr(p,e,t,g,ee,c),r.close();return}let d=a.value;if(d.length>0){let e=new Uint8Array(f.length+d.length);e.set(f,0),e.set(d,f.length),f=e}let _=!1;for(;f.length>=4;){let i=4+new DataView(f.buffer,f.byteOffset,f.byteLength).getUint32(0,!1);if(f.length<i)break;r.enqueue(f.slice(0,i)),f=f.slice(i),o++,g++,ee+=i,!h&&p!==void 0&&(h=!0,Br(p,e,t,n,m)),_=!0}if(_){s=0;return}}},cancel:async e=>{u=!0,d=e;let t=l;l=void 0,t&&await t.cancel(e).catch(e=>{console.warn(`Error closing ReadableStream reader:`,e)})}})}const Yr=()=>{let e=n(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,NaN,{integer:!0});return Number.isNaN(e)?void 0:e};function Xr(e,t,n,r,i,a,o){(async()=>{await y(`workflow.stream.flush`,e,{kind:await v(`CLIENT`),attributes:{"workflow.run.id":n,"workflow.stream.name":r,"workflow.stream.operation":`flush`,"workflow.stream.flush.buffer_dwell_ms":t-e,"workflow.stream.flush.chunks":i,"workflow.stream.flush.bytes":a,"workflow.stream.write.chunk_rtt":o}})})()}function Zr(e,t,n){(async()=>{await y(`workflow.stream.close`,e,{kind:await v(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`close`,"workflow.stream.close.rpc_ms":Date.now()-e}})})()}var Qr=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new C(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new C(`"name" is required, got "${t}"`);let r=le(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},o=`wrtr_${Mr()}`,s=a().then(async()=>(await r).streams.createWriteSession?.(e,t,{writerId:o})),c=0,l=[],u=0,d=0,f=0,p=null,m=null,h,g=Yr(),ee=null,_=xt(),v=St(),te=bt(),ne=Ct(),y,re=[],b=[],ie=e=>{let t=[...re,...b];re=[],b=[];for(let n of t)n.reject(e)},ae=()=>{let e=0,t=0;for(let n of l){if(e>=_||e>0&&t+n.byteLength>v)break;e++,t+=n.byteLength}let n=l.slice(0,e);return l=l.slice(e),u-=t,{group:n,bytes:t}},oe=async(n,i,o)=>{await a();let l=await r,u=await s,d=Date.now();if(u)await u.write(c,n);else if(typeof l.streams.writeMulti==`function`&&n.length>1)await l.streams.writeMulti(e,t,n);else for(let r of n)await l.streams.write(e,t,r);c+=n.length,o!==void 0&&Xr(o,d,e,t,n.length,i,Date.now()-d)},se=async()=>{for(;l.length>0;){p&&=(clearTimeout(p),null);let e=y,t=Date.now(),{group:n,bytes:r}=ae();d=n.length,f=r,y=l.length>0?t:void 0;try{await oe(n,r,e),d=0,f=0}catch(t){throw l=n.concat(l),u+=r,d=0,f=0,y=e!==void 0&&y!==void 0?Math.min(e,y):e??y,t}let i=re;re=[];for(let e of i)e.resolve()}},x=()=>{m||h!==void 0||l.length===0||(m=se().then(()=>{if(m=null,l.length>0){x();return}let e=b;b=[];for(let t of e)t.resolve()},e=>{m=null,h??=e,ie(h)}))},ce=()=>{if(!(p||m)){if(g===void 0){ee??=Promise.resolve(r).then(e=>{g=e.streamFlushIntervalMs??0},()=>{g=0}).then(()=>{l.length>0&&ce()});return}if(g<=0){x();return}p=setTimeout(()=>{p=null,x()},g)}},S=async()=>{for(;;){if(h!==void 0)throw h;if(l.length===0&&!m)return;x(),await new Promise((e,t)=>{b.push({resolve:e,reject:t})})}};super({async write(e){if(h!==void 0)throw h;for(y===void 0&&(y=Date.now()),l.push(e),u+=e.byteLength,l.length>=_||u>=v?x():ce();h===void 0&&(l.length+d>=te||u+f>=ne);)x(),await new Promise((e,t)=>{re.push({resolve:e,reject:t})});if(h!==void 0)throw h},async close(){await S(),await a();let n=await r,i=await s,o=Date.now();i?await i.close():await n.streams.close(e,t),Zr(o,e,t)},async abort(e){try{await S()}catch{}p&&=(clearTimeout(p),null),l=[],u=0,h??=e??Error(`Stream aborted`),ie(h),await(await s.catch(()=>void 0))?.dispose?.()}}),Object.defineProperty(this,mt,{value:S,enumerable:!1,writable:!1})}};function $r(e=globalThis){let t=Se(()=>ii(e,`Request`)),n=Se(()=>ii(e,`Response`));return{...Mn(),...Vn(),...zn(e),Request:e=>{if(!U(e,t.value))return!1;let n={method:H(e,`method`),url:H(e,`url`),headers:H(e,`headers`),body:H(e,`body`),duplex:H(e,`duplex`)},r=H(e,gt);r&&(n.responseWritable=r);let i=H(e,`signal`);return i&&(H(i,`aborted`)||H(i,N))&&(n.signal=i),n},Response:e=>U(e,n.value)?{type:H(e,`type`),url:H(e,`url`),status:H(e,`status`),statusText:H(e,`statusText`),headers:H(e,`headers`),body:H(e,`body`),redirected:H(e,`redirected`)}:!1}}function ei(e,t,n,r,i,a){let o=t[N],s=t[P];if(!o){let e=(n[dt]||Mr)();o=xr(e),s=`abrt_${e}`,t[N]=o,t[P]=s,t.signal&&(t.signal[N]=o,t.signal[P]=s)}return ni(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function ti(e,t){let n=t[N]??t.signal?.[N],r=t[P]??t.signal?.[P];if(!n)throw Error(`AbortController/AbortSignal stream name is not set`);return{streamName:n,hookToken:r,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function ni(e,t,n,r,i){e.aborted||e[vt]||(e[vt]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await m(r),a=await Mi({aborted:!0,reason:e.reason},n,i),o=new Qr(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function ri(e=globalThis,t,n,r,i=!1,a,o=t){return{...$r(e),ReadableStream:s=>{if(!(s instanceof e.ReadableStream))return!1;if(s.locked)throw new w(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let c=`strm_${(e[dt]||Mr)()}`,l=Nr(s),u=new Qr(n,c,a);l===`bytes`?i?t.push(s.pipeThrough(Rr()).pipeTo(u)):t.push(s.pipeTo(u)):t.push(s.pipeThrough(Fr(ri(e,t,n,r,i,a,o),r)).pipeTo(u));let d={name:c};return l&&(d.type=l),l===`bytes`&&i&&(d.framing=`framed-v1`),d},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let r=t[k],i=t[A];if(typeof r==`string`&&typeof i==`string`){let e={name:r,runId:i},n=t[M];typeof n==`string`&&(e.encryptionPublicKey=n);let a=t[j];return typeof a==`string`&&(e.deploymentId=a),e}let a=`strm_${(e[dt]||Mr)()}`,s=new Ur(n,a);return o.push(s.pipeTo(t)),{name:a}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:ei(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:ei(i,i,e,t,n,r)}}function ii(e,t){let n=H(e,t)??H(globalThis,t);if(typeof n==`function`)return H(n,`prototype`)}function ai(e=globalThis){let t=Se(()=>ii(e,`ReadableStream`)),n=Se(()=>ii(e,`WritableStream`)),r=Se(()=>ii(e,`AbortController`)),i=Se(()=>ii(e,`AbortSignal`));return{...$r(e),ReadableStream:e=>{if(!U(e,t.value))return!1;let n=H(e,ht);if(n!==void 0)return{bodyInit:n};let r=H(e,k);if(!r)throw new C("ReadableStream `name` is not set");let i={name:r},a=H(e,ft);a&&(i.type=a);let o=H(e,pt);return o&&(i.framing=o),i},WritableStream:e=>{if(!U(e,n.value))return!1;let t=H(e,k);if(!t)throw new C("WritableStream `name` is not set");let r={name:t},i=H(e,A);typeof i==`string`&&(r.runId=i);let a=H(e,j);typeof a==`string`&&(r.deploymentId=a);let o=H(e,M);return typeof o==`string`&&(r.encryptionPublicKey=o),r},AbortController:e=>{if(typeof e!=`object`||!e)return!1;let t=e,n=H(e,N),i=U(e,r.value);if(n===void 0&&!i){let t=H(e,`signal`);if(typeof t!=`object`||!t||H(t,N)===void 0)return!1}let a=H(e,`signal`);return a?ti(a,t):!1},AbortSignal:e=>{if(typeof e!=`object`||!e)return!1;let t=H(e,N)!==void 0,n=U(e,i.value);return!t&&!n?!1:ti(e,e)}}}function oi(e=globalThis,t,n,r,i=!1,a,o=t){return{...$r(e),ReadableStream:s=>{if(!(s instanceof e.ReadableStream))return!1;if(s.locked)throw new w(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let c=s[k],l=s[ft],u=s[pt];if(!c){c=`strm_${(e[dt]||Mr)()}`,l=Nr(s),u=l===`bytes`&&i?`framed-v1`:u;let d=new Qr(n,c,a);l===`bytes`?u===`framed-v1`?t.push(s.pipeThrough(Rr()).pipeTo(d)):t.push(s.pipeTo(d)):t.push(s.pipeThrough(Fr(oi(e,t,n,r,i,a,o),r)).pipeTo(d))}let d={name:c};return l&&(d.type=l),u&&(d.framing=u),d},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let i=t[k],a=t[A];i||(i=`strm_${(e[dt]||Mr)()}`,o.push(new Ur(n,i).pipeThrough(Ir(Si(e,o,n,r),r)).pipeTo(t)));let s={name:i};typeof a==`string`&&(s.runId=a);let c=t[M];typeof c==`string`&&(s.encryptionPublicKey=c);let l=t[j];return typeof l==`string`&&(s.deploymentId=l),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:ei(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:ei(i,i,e,t,n,r)}}function si(...e){let t=new WeakSet;function n(e){let t=e[yt];t&&!t.signal.aborted&&t.abort()}function r(e){if(typeof e==`object`&&e&&!t.has(e)){if(t.add(e),e instanceof AbortController){n(e),n(e.signal);return}if(e instanceof AbortSignal){n(e);return}if(Array.isArray(e)){for(let t of e)r(t);return}if(e instanceof Map){for(let t of e.values())r(t);return}if(e instanceof Set){for(let t of e)r(t);return}if(typeof Request<`u`&&e instanceof Request){r(e.signal);return}for(let t of Object.values(e))r(t)}}for(let t of e)r(t)}function ci(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new Ur(t,n).getReader(),a=await Promise.race([r.read(),new Promise(e=>{if(i.signal.aborted){e({value:void 0,done:!0});return}i.signal.addEventListener(`abort`,()=>e({value:void 0,done:!0}),{once:!0})})]);if(a.value&&!a.done){try{r.releaseLock()}catch{}try{let n=vr.getStore(),r=await Ni(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function li(e,t,n){let r=e,i=e.signal;r[N]=t.streamName,r[P]=t.hookToken,i[N]=t.streamName,i[P]=t.hookToken,n&&(r[yt]=n,i[yt]=n)}function ui(e,t){let n=e,r=t;n[N]!==void 0&&(r[N]=n[N]),n[P]!==void 0&&(r[P]=n[P]),n[yt]!==void 0&&(r[yt]=n[yt])}function di(e,t,n){let r=new AbortController;e.aborted?(li(r,e),r.abort(e.reason)):e.streamName?li(r,e,ci(r,n,e.streamName,t)):li(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=vr.getStore();if(n&&(n.ops.push((async()=>{try{let r=await Mi({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new Qr(n.workflowMetadata.workflowRunId,e.streamName).getWriter();await i.write(r),await i.close()}catch{}})()),e.hookToken)){let r=(async()=>{try{let{resumeHook:n}=await import(`./resume-hook-yq-NAdBu.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function fi(e,t,n){let r=new AbortController;return e.aborted?(li(r,e),r.abort(e.reason)):e.streamName?li(r,e,ci(r,n,e.streamName,t)):li(r,e),r.signal}function pi(e=globalThis){return{...Nn(e),...Bn(e)}}async function mi(e,t,n){let r=a(n);if(r)return p(r);let i=await le();if(!i.getEncryptionKeyForRun)return;let o=t?await i.getEncryptionKeyForRun(e,{deploymentId:t}):await i.getEncryptionKeyForRun(await i.runs.get(e));return o?await ce(o,[`encrypt`]):void 0}function hi(e,t,n){let r;return()=>(r??=mi(e,t,n),r)}function gi(e,{deploymentId:t,encryptionPublicKey:n}){typeof t==`string`&&Object.defineProperty(e,j,{value:t,writable:!1}),typeof n==`string`&&Object.defineProperty(e,M,{value:n,writable:!1})}function _i({global:e,ops:t,runId:n,name:r,key:i,deploymentId:a,encryptionPublicKey:o,runReadyBarrier:s}){let c=Fr(ri(e,t,n,i),i),l=new Qr(n,r,s),u=F();return t.push(u.promise),Nt(c.readable,l,u).catch(()=>{}),jt(c.writable,u),Object.defineProperty(c.writable,k,{value:r,writable:!1}),Object.defineProperty(c.writable,A,{value:n,writable:!1}),gi(c.writable,{deploymentId:a,encryptionPublicKey:o}),c.writable}function vi(e,t,n,r,i,a){return yi(o=>bi(e,t,n,a,{onReadableState:o}).ReadableStream({name:r,startIndex:i}))}function yi(e,t){let n,r,i=!1,a;return a=new ReadableStream({async pull(o){try{n||(n=e(e=>{r=e}).getReader(),r&&!i&&(i=!0,t?t(r):Mt(a,r)));let s=await n.read();s.done?o.close():o.enqueue(s.value)}catch(e){o.error(e)}},async cancel(e){await n?.cancel(e).catch(()=>{})}},{highWaterMark:0}),a}function bi(e=globalThis,t,n,r,i){function a(a,o=i?.onReadableState){if(a.type===`bytes`){let r=new Ur(n,a.name,a.startIndex),i=F();t.push(i.promise);let{readable:s,writable:c}=a.framing===`framed-v1`?zr():new e.TransformStream;return Nt(r,c,i).catch(()=>{}),o?o(i):Mt(s,i),s}let s,c=()=>(s??=m(r),s),l=Jr(n,a.name,a.startIndex,c),u=Ir(bi(e,t,n,c,{lazyStreams:i?.lazyStreams,liveAbortSignals:i?.liveAbortSignals}),c),d=F();return t.push(d.promise),Nt(l,u.writable,d).catch(()=>{}),o?o(d):Mt(u.readable,d),u.readable}function o(e){let t=new AbortController;return e.aborted&&t.abort(e.reason),t}return{...pi(e),StepFunction:()=>{throw new w(`Step functions cannot be deserialized in client context. Step functions should not be returned from workflows.`,{hint:`A step function reference reached the client. Return a serializable value (e.g. the step result) instead of the step itself.`})},WorkflowFunction:e=>Object.assign(()=>{throw new w(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(n.signal=t.signal);let r=new e.Request(t.url,n);return t.signal&&ui(t.signal,r.signal),r},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:t=>{if(`bodyInit`in t){let n=t.bodyInit;return new e.Response(n).body}return i?.lazyStreams?yi(e=>a(t,e),i.onReadableState):a(t)},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:hi(a,i.deploymentId,i.encryptionPublicKey);return _i({global:e,ops:t,runId:a,name:i.name,key:o,deploymentId:i.deploymentId,encryptionPublicKey:i.encryptionPublicKey})},AbortController:e=>i?.liveAbortSignals===!1?o(e):di(e,t,n),AbortSignal:e=>i?.liveAbortSignals===!1?o(e).signal:fi(e,t,n)}}function xi(e=globalThis){return{...pi(e),...Hn(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[gt]=n,delete t.responseWritable,t.respondWith=()=>{throw new w("`respondWith()` must be called from within a step function.",{hint:'Move the `respondWith(...)` call inside a `"use step"` function — it cannot be invoked from a workflow context.'})}),t},WorkflowFunction:e=>Object.assign(()=>{throw new w(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Response:t=>(Object.setPrototypeOf(t,e.Response.prototype),t),ReadableStream:t=>`bodyInit`in t?Object.create(e.ReadableStream.prototype,{[ht]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[k]:{value:t.name,writable:!1},[ft]:{value:t.type,writable:!1},[pt]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[k]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[A]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[j]={value:t.deploymentId,writable:!1}),typeof t.encryptionPublicKey==`string`&&(n[M]={value:t.encryptionPublicKey,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new kr(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[N]:e.streamName,[P]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new kr(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function Si(e=globalThis,t,n,r,i,a){return{...pi(e),StepFunction:e=>{let t=e.stepId,n=e.closureVars,r=`boundThis`in e,i=r?e.boundThis:void 0,a=Array.isArray(e.boundArgs)?e.boundArgs:[],o=we(t);if(!o)throw new w(`Step function "${t}" not found. Make sure the step function is registered.`,{hint:`Make sure the step file is included in your build (i.e. it is listed in the workflow manifest), and that the SWC plugin is configured for the file.`});if(!n&&!r&&a.length===0)return o;let s=function(...e){let t=r?i:this,s=a.length>0?[...a,...e]:e;if(n){let e=vr.getStore();if(!e)throw new C(`Cannot call step function with closure variables outside step context`);let r={...e,closureVars:n};return vr.run(r,()=>o.apply(t,s))}return o.apply(t,s)};return Object.defineProperty(s,"name",{value:o.name}),Object.defineProperty(s,"stepId",{value:t,writable:!1,enumerable:!1,configurable:!1}),o.maxRetries!==void 0&&(s.maxRetries=o.maxRetries),s},WorkflowFunction:e=>Object.assign(()=>{throw new w(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n=t.responseWritable,r={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(r.signal=t.signal);let i=new e.Request(t.url,r);return t.signal&&ui(t.signal,i.signal),n&&(i.respondWith=async e=>{let t=n.getWriter();await t.write(e),await t.close()}),i},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:a=>{if(`bodyInit`in a){let t=a.bodyInit;return new e.Response(t).body}let o=new Ur(n,a.name);if(a.type===`bytes`){let n=F();t.push(n.promise);let{readable:r,writable:i}=a.framing===`framed-v1`?zr():new e.TransformStream;return Nt(o,i,n).catch(()=>{}),Mt(r,n),r}{let a=Ir(Si(e,t,n,r,i),r),s=F();return t.push(s.promise),Nt(o,a.writable,s).catch(()=>{}),Mt(a.readable,s),a.readable}},WritableStream:o=>{let s=typeof o.runId==`string`?o.runId:n,c=typeof o.deploymentId==`string`?o.deploymentId:s===n?i:void 0,l=s===n?r:hi(s,c,o.encryptionPublicKey),u=Fr(oi(e,t,s,l),l),d=new Qr(s,o.name),f=F();f.deferReleaseSettlement=a!==void 0,a?.push(f),t.push(f.promise),Nt(u.readable,d,f).catch(()=>{});let p=At(u.writable,f,e.WritableStream);return jt(p,f),Object.defineProperty(p,k,{value:o.name,writable:!1}),Object.defineProperty(p,A,{value:s,writable:!1}),c&&Object.defineProperty(p,j,{value:c,writable:!1}),typeof o.encryptionPublicKey!=`string`&&s===n&&de(r)&&Object.defineProperty(p,M,{value:g(r.keyPair.publicKey),writable:!1}),typeof o.encryptionPublicKey==`string`&&Object.defineProperty(p,M,{value:o.encryptionPublicKey,writable:!1}),p},AbortController:e=>di(e,t,n),AbortSignal:e=>fi(e,t,n)}}async function Ci(e,t){return await f(e,t)}async function wi(e,t){return l(e,t)}const Ti=async(e,t)=>{let n={},r=await ur(await l(e,t),n);return await $(n,`deserialize`),{data:r}};function Ei(e,t=globalThis,n={}){return gr(e.data,{global:t,extraRevivers:{...Wi(xi(t)),...n}})}function Di(e,t=globalThis,n={}){let{data:r}=e;if(!(r instanceof Uint8Array))return rt(r,{...xi(t),...n});let{format:i,payload:a}=h(r);if(i===u.DEVALUE_V1)return nt(new TextDecoder().decode(a),{...xi(t),...n});throw Error(`Unsupported serialization format: ${i}`)}async function Oi(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c=r){if(a)return Fn(O(e,ri(i,r,t,n,o,void 0,c)));try{let a={},l=await fr(e,n,{global:i,extraReducers:Ui(ri(i,r,t,n,o,void 0,c)),compression:s,compressionStats:a});return await $(a,`serialize`),l}catch(e){let t=Q(e),{message:n,hint:r}=X(`workflow arguments`,t);throw new w(n,{hint:r,cause:t})}}async function ki(e,t,n,r=globalThis,i={},a){return Ei(a??await Ti(e,n),r,i)}async function Ai(e,t,n,r=globalThis,i=!1,a=!1,o){if(i)return Fn(O(e,ai(r)));try{let t={},i=o??{executions:[]},s=await mr(e,n,{global:r,extraReducers:Ui(ai(r)),compression:a,compressionStats:t,guestCodeStats:i});return await $(t,`serialize`),await Pr(i),s}catch(e){let t=Q(e),{message:n,hint:r}=X(`workflow return value`,t);throw new w(n,{hint:r,cause:t})}}async function ji(e,t,n,r=[],i=globalThis,a={}){let o={},s=await pr(e,n,{global:i,extraRevivers:{...Wi(bi(i,r,t,n)),...a},compressionStats:o});return await $(o,`deserialize`),s}async function Mi(e,t,n,r=globalThis,i=!1,a=!1,o){if(i)return Fn(O(e,ai(r)));try{let t={},i=o??{executions:[]},s=await mr(e,n,{global:r,extraReducers:Ui(ai(r)),compression:a,compressionStats:t,guestCodeStats:i});return await $(t,`serialize`),await Pr(i),s}catch(e){let t=Q(e),{message:n,hint:r}=X(`step arguments`,t);throw new w(n,{hint:r,cause:t})}}async function Ni(e,t,n,r=[],i=globalThis,a={},o,s){let c={},l=await hr(e,n,{global:i,extraRevivers:{...Wi(Si(i,r,t,n,o,s)),...a},compressionStats:c});return await $(c,`deserialize`),l}async function Pi(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c,l=r){if(a)return Fn(O(e,oi(i,r,t,n,o,c,l)));try{let a={},u=await mr(e,n,{global:i,extraReducers:Ui(oi(i,r,t,n,o,c,l)),compression:s,compressionStats:a});return await $(a,`serialize`),u}catch(e){let t=Q(e),{message:n,hint:r}=X(`step return value`,t);throw new w(n,{hint:r,cause:t})}}async function Fi(e,t,n,r=[],i=globalThis,a=!1){try{let o=O(e,oi(i,r,t,n)),s=new TextEncoder().encode(o),l=c(u.DEVALUE_V1,s),d={},f=await Ci(await lr(l,a,d),n);return await $(d,`serialize`),f}catch(e){let t=Q(e),{message:n,hint:r}=X(`step error`,t);throw new w(n,{hint:r,cause:t})}}async function Ii(e,t,n,r=globalThis,i={},a){return Di(a??await Ti(e,n),r,i)}async function Li(e,t,n=!1){try{let r=new TextEncoder().encode(O(e)),i=c(u.DEVALUE_V1,r),a={},o=await Ci(await lr(i,n,a),t);return await $(a,`serialize`),o}catch(e){let t=Q(e),{message:n,hint:r}=X(`dynamic workflow code`,t);throw new w(n,{hint:r,cause:t})}}async function Ri(e,t,n={}){if(t!==void 0||n.encryptionRequired===!0){let t=x(e);if(t!==u.ENCRYPTED)throw new w(`Dynamic workflow code must be encrypted with the run's key ("${u.ENCRYPTED}"), but the stored payload is ${t?`"${t}"`:`not a recognized format`}.`)}let r={},i=await ur(await l(e,t),r);if(await $(r,`deserialize`),!(i instanceof Uint8Array))throw new w(`Dynamic workflow code did not decode to binary data.`);let{format:a,payload:o}=h(i);if(a!==u.DEVALUE_V1)throw new w(`Unsupported serialization format for dynamic workflow code: ${a}`);let s;try{s=nt(new TextDecoder().decode(o))}catch(e){throw new w(`Dynamic workflow code payload is not valid devalue.`,{cause:e})}if(typeof s!=`string`)throw new w(`Dynamic workflow code decoded to ${typeof s}, expected a string.`);return s}async function zi(e,t,n,r=globalThis,i=!1){try{let t=O(e,ai(r)),a=new TextEncoder().encode(t),o=c(u.DEVALUE_V1,a),s={},l=await Ci(await lr(o,i,s),n);return await $(s,`serialize`),l}catch(e){let t=Q(e),{message:n,hint:r}=X(`run error`,t);throw new w(n,{hint:r,cause:t})}}async function Bi(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await ur(await l(e,n),s);if(await $(s,`deserialize`),!(c instanceof Uint8Array))return rt(c,{...bi(i,r,t,n,o),...a});let{format:d,payload:f}=h(c);if(d===u.DEVALUE_V1)return nt(new TextDecoder().decode(f),{...bi(i,r,t,n,o),...a});throw Error(`Unsupported serialization format: ${d}`)}async function Vi(e,t,n,r=globalThis,i={},a){return Ei(a??await Ti(e,n),r,i)}const Hi=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function Ui(e){let t={};for(let n of Hi)n in e&&(t[n]=e[n]);return t}function Wi(e){let t={};for(let n of Hi)n in e&&(t[n]=e[n]);return t}export{jn as $,Bi as A,jr as B,mi as C,ai as D,Nr as E,ji as F,Sr as G,Z as H,wi as I,X as J,br as K,Ci as L,Ii as M,Vi as N,xi as O,ki as P,An as Q,Ti as R,bi as S,Fr as T,Or as U,Ar as V,yr as W,ur as X,lr as Y,kn as Z,Rr as _,lt as _t,si as a,jt as at,Ir as b,Li as c,dt as ct,Fi as d,M as dt,Dn as et,Pi as f,A as ft,Di as g,st as gt,Ei as h,ut as ht,Qr as i,Nt as it,Ni as j,Ri as k,zi as l,k as lt,Ai as m,ct as mt,Kr as n,Rt as nt,_i as o,At as ot,Oi as p,gt as pt,vr as q,Ur as r,F as rt,Jr as s,ht as st,Wr as t,En as tt,Mi as u,j as ut,zr as v,ot as vt,vi as w,ri as x,pi as y,gi as z};
|