@oomol-lab/open-flow 0.1.0-beta.89 → 0.1.0-beta.90

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.
Files changed (33) hide show
  1. package/README.md +29 -0
  2. package/dist/browser/{FlowCanvas-SqPUBqze.js → FlowCanvas-C4iuvVKB.js} +2 -2
  3. package/dist/browser/{exportPng-CLZKdNzR.js → exportPng-DMsB9ku_.js} +4 -4
  4. package/dist/browser/{flowChanges-CnOOPJJR.js → flowChanges-SKYJBr6X.js} +12 -11
  5. package/dist/browser/{flowWorkspace-d9Ef-aRK.js → flowWorkspace-4UHRaHcz.js} +10 -7
  6. package/dist/browser/{markdownContent-D0BBrFcF.js → markdownContent-B75ojl0E.js} +1 -1
  7. package/dist/browser/preview.css +14 -5
  8. package/dist/browser/preview.d.ts +4 -1
  9. package/dist/browser/preview.js +397 -95
  10. package/dist/browser/workbench-contract.d.ts +3 -0
  11. package/dist/browser/workbench.css +14 -5
  12. package/dist/browser/workbench.js +12 -9
  13. package/dist/browser/{wrapLayout-BB_qwy3k.js → wrapLayout-DU5HG1qH.js} +371 -71
  14. package/dist/command/index.js +13 -13
  15. package/dist/common/cache.d.ts +7 -0
  16. package/dist/common/catalogCache.d.ts +3 -7
  17. package/dist/common/control-api-conformance.js +10 -9
  18. package/dist/common/control-api.d.ts +3 -1
  19. package/dist/common/control-api.js +10 -9
  20. package/dist/common/mcp.js +10 -9
  21. package/dist/common/provider-icons.d.ts +35 -0
  22. package/dist/common/provider-icons.js +134 -0
  23. package/dist/render/browser/runtime.css +14 -5
  24. package/dist/render/browser/runtime.js +667 -365
  25. package/dist/render/common/png.d.ts +7 -0
  26. package/dist/render/node/index.d.ts +10 -2
  27. package/dist/render/node/index.js +1284 -37
  28. package/dist/render/node/licenses.md +24 -0
  29. package/package.json +5 -1
  30. package/src/base/common/cache.ts +8 -0
  31. package/src/connector/common/providerIconCache.ts +191 -0
  32. package/src/control/common/api.ts +10 -3
  33. package/src/control/common/catalogCache.ts +19 -11
@@ -2,6 +2,183 @@ import { createRequire } from "node:module";
2
2
  import { Buffer } from "node:buffer";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { dirname, join } from "node:path";
5
+ //#region src/connector/common/providerIconCache.ts
6
+ var defaultMaxAgeMs = 864e5;
7
+ var dataUrl = (entry) => `data:${entry.contentType};base64,${entry.body}`;
8
+ function decodeRecord(value) {
9
+ if (value == null || typeof value !== "object") return;
10
+ const v = value;
11
+ if (v.formatVersion !== 1 || typeof v.sourceUrl !== "string" || !(v.spriteVersion === null || typeof v.spriteVersion === "string") || typeof v.contentType !== "string" || !/^image\/[\w.+-]+$/i.test(v.contentType) || typeof v.body !== "string" || !v.body || v.body.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(v.body) || !(v.etag === null || typeof v.etag === "string") || !Number.isFinite(v.validatedAt) || v.validatedAt < 0 || !(v.maxAgeMs === null || Number.isFinite(v.maxAgeMs) && v.maxAgeMs >= 0)) return;
12
+ return v;
13
+ }
14
+ function encodeBytes(bytes) {
15
+ let text = "";
16
+ for (let index = 0; index < bytes.length; index += 8192) text += String.fromCharCode(...bytes.subarray(index, index + 8192));
17
+ return btoa(text);
18
+ }
19
+ function freshness(response, immutable, previous) {
20
+ const control = response.headers.get("cache-control") ?? "";
21
+ if (/\bno-cache\b/i.test(control)) return 0;
22
+ if (immutable) return null;
23
+ const maxAge = /(?:^|,)\s*max-age\s*=\s*"?(\d+)/i.exec(control);
24
+ if (maxAge) return Math.max(0, Number(maxAge[1]) * 1e3 - (Number(response.headers.get("age")) || 0) * 1e3);
25
+ const expires = Date.parse(response.headers.get("expires") ?? "");
26
+ if (Number.isFinite(expires)) return Math.max(0, expires - Date.parse(response.headers.get("date") ?? (/* @__PURE__ */ new Date()).toUTCString()));
27
+ return previous?.maxAgeMs ?? defaultMaxAgeMs;
28
+ }
29
+ /** Complete image responses in bounded, identity-checked slots; no catalog entities live here. */
30
+ var ProviderIconCache = class {
31
+ #memory = /* @__PURE__ */ new Map();
32
+ #pending = /* @__PURE__ */ new Map();
33
+ #targets = /* @__PURE__ */ new Map();
34
+ #writes = /* @__PURE__ */ new Map();
35
+ constructor(options) {
36
+ this.options = options;
37
+ if (!options.scope.trim()) throw new TypeError("Provider icon cache scope must be nonempty.");
38
+ }
39
+ get(request, options = {}) {
40
+ if (request.url.startsWith("data:image/")) return Promise.resolve(request.url);
41
+ let protocol;
42
+ try {
43
+ protocol = new URL(request.url).protocol;
44
+ } catch (error) {
45
+ return Promise.reject(error);
46
+ }
47
+ if (!["http:", "https:"].includes(protocol)) return Promise.reject(/* @__PURE__ */ new TypeError("Unsupported Provider icon URL."));
48
+ const slot = JSON.stringify([
49
+ "open-flow:provider-icons",
50
+ 1,
51
+ this.options.scope,
52
+ request.kind,
53
+ request.kind === "sprite" ? request.theme : request.providerId
54
+ ]);
55
+ const version = request.kind === "sprite" ? request.version : null;
56
+ const identity = JSON.stringify([request.url, version]);
57
+ const offline = options.allowNetwork === false || this.options.mode === "offline";
58
+ const key = JSON.stringify([
59
+ slot,
60
+ identity,
61
+ offline
62
+ ]);
63
+ const pending = this.#pending.get(key);
64
+ if (pending) return pending;
65
+ if (!offline) this.#targets.set(slot, identity);
66
+ const promise = this.#load(slot, identity, request.url, version, offline).finally(() => this.#pending.delete(key));
67
+ this.#pending.set(key, promise);
68
+ return promise;
69
+ }
70
+ async #read(slot, url, version) {
71
+ const memory = this.#memory.get(slot);
72
+ if (this.#memory.has(slot) && (!memory || memory.sourceUrl === url && memory.spriteVersion === version)) return memory;
73
+ if (!this.options.delegate) return this.#memory.get(slot);
74
+ try {
75
+ const stored = await this.options.delegate.get(slot);
76
+ if (stored === void 0) return this.#memory.get(slot);
77
+ const entry = decodeRecord(stored);
78
+ if (entry) {
79
+ this.#memory.set(slot, entry);
80
+ return entry;
81
+ }
82
+ this.#memory.delete(slot);
83
+ await this.options.delegate.delete(slot);
84
+ } catch {
85
+ return this.#memory.get(slot);
86
+ }
87
+ }
88
+ async #store(slot, identity, entry) {
89
+ const operation = (this.#writes.get(slot) ?? Promise.resolve()).then(async () => {
90
+ if (this.#targets.get(slot) !== identity) return;
91
+ this.#memory.set(slot, entry);
92
+ if (!this.options.delegate) return;
93
+ try {
94
+ if (entry) await this.options.delegate.set(slot, { ...entry });
95
+ else await this.options.delegate.delete(slot);
96
+ } catch {}
97
+ });
98
+ this.#writes.set(slot, operation);
99
+ try {
100
+ await operation;
101
+ } finally {
102
+ if (this.#writes.get(slot) === operation) this.#writes.delete(slot);
103
+ }
104
+ }
105
+ async #load(slot, identity, url, version, offline) {
106
+ const stored = await this.#read(slot, url, version);
107
+ const cached = stored?.sourceUrl === url && stored.spriteVersion === version ? stored : void 0;
108
+ const age = cached == null ? Infinity : Date.now() - cached.validatedAt;
109
+ if (cached && (offline || this.options.mode !== "refresh" && age >= 0 && (cached.maxAgeMs === null || age < cached.maxAgeMs))) return dataUrl(cached);
110
+ if (offline) throw new Error(`Provider icon is not cached: ${url}`);
111
+ const response = await (this.options.fetch ?? globalThis.fetch)(url, {
112
+ credentials: "omit",
113
+ referrerPolicy: "no-referrer",
114
+ signal: AbortSignal.timeout(15e3),
115
+ headers: cached?.etag ? { "if-none-match": cached.etag } : {}
116
+ });
117
+ if (response.status !== 304 && !response.ok) throw new Error(`Could not load Provider icon: ${response.status}`);
118
+ if (response.status === 304 && !cached) throw new Error("Provider icon returned 304 without a cached image.");
119
+ const contentType = response.status === 304 ? cached.contentType : response.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase();
120
+ if (!contentType || !/^image\/[\w.+-]+$/i.test(contentType)) throw new Error("Provider icon response is not an image.");
121
+ const body = response.status === 304 ? cached.body : encodeBytes(new Uint8Array(await response.arrayBuffer()));
122
+ if (!body) throw new Error("Provider icon response is empty.");
123
+ const entry = {
124
+ formatVersion: 1,
125
+ sourceUrl: url,
126
+ spriteVersion: version,
127
+ contentType,
128
+ body,
129
+ etag: response.headers.get("etag") ?? (response.status === 304 ? cached.etag : null),
130
+ validatedAt: Date.now(),
131
+ maxAgeMs: freshness(response, version !== null, response.status === 304 ? cached : void 0)
132
+ };
133
+ await this.#store(slot, identity, /\bno-store\b/i.test(response.headers.get("cache-control") ?? "") ? void 0 : entry);
134
+ return dataUrl(entry);
135
+ }
136
+ };
137
+ //#endregion
138
+ //#region src/flow/common/connectionUsage.ts
139
+ function connectionUsage(document) {
140
+ const uses = [];
141
+ for (const [nodeId, node] of Object.entries(document.graph.nodes)) {
142
+ const task = node.kind == "task" && "executor" in node.task ? node.task : void 0;
143
+ const name = node.name ?? task?.name ?? nodeId;
144
+ const add = (kind, actionId, connectionId) => {
145
+ uses.push({
146
+ kind,
147
+ providerId: actionId.split(".")[0],
148
+ actionId,
149
+ connectionId,
150
+ nodeId,
151
+ name
152
+ });
153
+ };
154
+ if (node.kind == "poll" || node.kind == "integration") uses.push({
155
+ kind: "trigger",
156
+ triggerId: node.definition.key,
157
+ providerId: node.definition.provider,
158
+ connectionId: node.connectionId,
159
+ nodeId,
160
+ name
161
+ });
162
+ if (task?.executor.kind == "connector") add("connector", task.executor.action, task.executor.connectionId);
163
+ if (task?.executor.kind == "connector-proxy") uses.push({
164
+ kind: "connector-proxy",
165
+ providerId: task.executor.providerId,
166
+ connectionId: task.executor.connectionId,
167
+ nodeId,
168
+ name
169
+ });
170
+ if (node.kind == "task" && "moduleId" in node.task) {
171
+ for (const capability of node.task.capabilities ?? []) if ("mode" in capability && capability.mode == "independent") for (const action of capability.actions) add("code", action.action, action.connectionId);
172
+ }
173
+ if (task?.executor.kind == "agent") {
174
+ for (const tool of task.executor.tools) if (tool.kind != "workflow") add("agent", tool.action, tool.connectionId);
175
+ const notification = task.executor.notification;
176
+ if (notification != null) add("notification", notification.action, notification.connectionId);
177
+ }
178
+ }
179
+ return uses;
180
+ }
181
+ //#endregion
5
182
  //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
6
183
  var has = Object.prototype.hasOwnProperty;
7
184
  function dequal(foo, bar) {
@@ -1050,12 +1227,12 @@ var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][
1050
1227
  function anchor(source) {
1051
1228
  return new RegExp(`^${source}$`);
1052
1229
  }
1053
- var date = /*@__PURE__*/ anchor(dateSource);
1230
+ var date$1 = /*@__PURE__*/ anchor(dateSource);
1054
1231
  function timeSource(args) {
1055
1232
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
1056
1233
  return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
1057
1234
  }
1058
- function time(args) {
1235
+ function time$1(args) {
1059
1236
  return new RegExp(`^${timeSource(args)}$`);
1060
1237
  }
1061
1238
  function datetime$1(args) {
@@ -1713,11 +1890,11 @@ var $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def)
1713
1890
  $ZodStringFormat.init(inst, def);
1714
1891
  });
1715
1892
  var $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1716
- def.pattern ?? (def.pattern = date);
1893
+ def.pattern ?? (def.pattern = date$1);
1717
1894
  $ZodStringFormat.init(inst, def);
1718
1895
  });
1719
1896
  var $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
1720
- def.pattern ?? (def.pattern = time(def));
1897
+ def.pattern ?? (def.pattern = time$1(def));
1721
1898
  $ZodStringFormat.init(inst, def);
1722
1899
  });
1723
1900
  var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
@@ -5732,6 +5909,132 @@ function datetime(params) {
5732
5909
  return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
5733
5910
  }
5734
5911
  //#endregion
5912
+ //#region src/flow/common/requestParameters.ts
5913
+ var requestParameterSchema = strictObject({
5914
+ mode: _enum(["fields", "object"]).default("fields"),
5915
+ names: array(string()).default([])
5916
+ });
5917
+ var connectorProxyExecutorSchema = strictObject({
5918
+ providerId: string().min(1),
5919
+ connectionId: string().optional(),
5920
+ method: _enum([
5921
+ "GET",
5922
+ "POST",
5923
+ "PUT",
5924
+ "PATCH",
5925
+ "DELETE"
5926
+ ]).default("GET"),
5927
+ query: requestParameterSchema.default({
5928
+ mode: "fields",
5929
+ names: []
5930
+ }),
5931
+ headers: requestParameterSchema.default({
5932
+ mode: "fields",
5933
+ names: []
5934
+ }),
5935
+ bodyFormat: _enum(["none", "json"]).default("none")
5936
+ }).extend({ kind: literal("connector-proxy") });
5937
+ //#endregion
5938
+ //#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/format.js
5939
+ var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
5940
+ var DAYS = [
5941
+ 0,
5942
+ 31,
5943
+ 28,
5944
+ 31,
5945
+ 30,
5946
+ 31,
5947
+ 30,
5948
+ 31,
5949
+ 31,
5950
+ 30,
5951
+ 31,
5952
+ 30,
5953
+ 31
5954
+ ];
5955
+ var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
5956
+ var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
5957
+ var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
5958
+ var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
5959
+ var URL_ = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
5960
+ var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
5961
+ var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
5962
+ var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
5963
+ var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
5964
+ var EMAIL = (input) => {
5965
+ if (input[0] === "\"") return false;
5966
+ const [name, host, ...rest] = input.split("@");
5967
+ if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253) return false;
5968
+ if (name[0] === "." || name.endsWith(".") || name.includes("..")) return false;
5969
+ if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name)) return false;
5970
+ return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
5971
+ };
5972
+ var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
5973
+ var IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
5974
+ var DURATION = (input) => input.length > 1 && input.length < 80 && (/^P\d+([.,]\d+)?W$/.test(input) || /^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) && /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input));
5975
+ function bind(r) {
5976
+ return r.test.bind(r);
5977
+ }
5978
+ var format = {
5979
+ date,
5980
+ time: time.bind(void 0, false),
5981
+ "date-time": date_time,
5982
+ duration: DURATION,
5983
+ uri,
5984
+ "uri-reference": bind(URIREF),
5985
+ "uri-template": bind(URITEMPLATE),
5986
+ url: bind(URL_),
5987
+ email: EMAIL,
5988
+ hostname: bind(HOSTNAME),
5989
+ ipv4: bind(IPV4),
5990
+ ipv6: bind(IPV6),
5991
+ regex,
5992
+ uuid: bind(UUID),
5993
+ "json-pointer": bind(JSON_POINTER),
5994
+ "json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
5995
+ "relative-json-pointer": bind(RELATIVE_JSON_POINTER)
5996
+ };
5997
+ function isLeapYear(year) {
5998
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
5999
+ }
6000
+ function date(str) {
6001
+ const matches = str.match(DATE);
6002
+ if (!matches) return false;
6003
+ const year = +matches[1];
6004
+ const month = +matches[2];
6005
+ const day = +matches[3];
6006
+ return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
6007
+ }
6008
+ function time(full, str) {
6009
+ const matches = str.match(TIME);
6010
+ if (!matches) return false;
6011
+ const hour = +matches[1];
6012
+ const minute = +matches[2];
6013
+ const second = +matches[3];
6014
+ const timeZone = !!matches[5];
6015
+ return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
6016
+ }
6017
+ var DATE_TIME_SEPARATOR = /t|\s/i;
6018
+ function date_time(str) {
6019
+ const dateTime = str.split(DATE_TIME_SEPARATOR);
6020
+ return dateTime.length == 2 && date(dateTime[0]) && time(true, dateTime[1]);
6021
+ }
6022
+ var NOT_URI_FRAGMENT = /\/|:/;
6023
+ var URI_PATTERN = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
6024
+ function uri(str) {
6025
+ return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
6026
+ }
6027
+ var Z_ANCHOR = /[^\\]\\Z/;
6028
+ function regex(str) {
6029
+ if (Z_ANCHOR.test(str)) return false;
6030
+ try {
6031
+ new RegExp(str, "u");
6032
+ return true;
6033
+ } catch (e) {
6034
+ return false;
6035
+ }
6036
+ }
6037
+ //#endregion
5735
6038
  //#region src/json-schema-subset/utils.ts
5736
6039
  var nextId = 0;
5737
6040
  function createId() {
@@ -8488,32 +8791,6 @@ function createSchemaComparer() {
8488
8791
  }
8489
8792
  createSchemaComparer();
8490
8793
  //#endregion
8491
- //#region src/flow/common/requestParameters.ts
8492
- var requestParameterSchema = strictObject({
8493
- mode: _enum(["fields", "object"]).default("fields"),
8494
- names: array(string()).default([])
8495
- });
8496
- var connectorProxyExecutorSchema = strictObject({
8497
- providerId: string().min(1),
8498
- connectionId: string().optional(),
8499
- method: _enum([
8500
- "GET",
8501
- "POST",
8502
- "PUT",
8503
- "PATCH",
8504
- "DELETE"
8505
- ]).default("GET"),
8506
- query: requestParameterSchema.default({
8507
- mode: "fields",
8508
- names: []
8509
- }),
8510
- headers: requestParameterSchema.default({
8511
- mode: "fields",
8512
- names: []
8513
- }),
8514
- bodyFormat: _enum(["none", "json"]).default("none")
8515
- }).extend({ kind: literal("connector-proxy") });
8516
- //#endregion
8517
8794
  //#region src/decision/common/decision.ts
8518
8795
  function isDecisionExecutor(executor) {
8519
8796
  return executor.kind === "decision";
@@ -8607,12 +8884,6 @@ function answerSchema(question) {
8607
8884
  };
8608
8885
  }
8609
8886
  //#endregion
8610
- //#region src/http/common/authBindings.ts
8611
- /** Never allow credentials to enter a Revision as literal inputs of an OpenAPI or HTTP request node. */
8612
- function assertHttpAuthBindings(inputs) {
8613
- for (const [handle, mapping] of Object.entries(inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("HTTP authentication accepts deployment variables and upstream outputs only.");
8614
- }
8615
- //#endregion
8616
8887
  //#region src/http/common/hosts.ts
8617
8888
  /** Hosts of a Code `http` Capability: lowercase DNS names or IPv4 addresses; `*.example.com` matches subdomains only. */
8618
8889
  var httpHostPattern = /^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
@@ -8722,6 +8993,12 @@ object({
8722
8993
  const encoder = new TextEncoder();
8723
8994
  return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
8724
8995
  }, "State values exceed the 1 MiB read limit.");
8996
+ //#endregion
8997
+ //#region src/http/common/authBindings.ts
8998
+ /** Never allow credentials to enter a Revision as literal inputs of an OpenAPI or HTTP request node. */
8999
+ function assertHttpAuthBindings(inputs) {
9000
+ for (const [handle, mapping] of Object.entries(inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("HTTP authentication accepts deployment variables and upstream outputs only.");
9001
+ }
8725
9002
  function checkJsonDepth(value, depth = 0) {
8726
9003
  if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
8727
9004
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
@@ -9486,6 +9763,130 @@ function assertDocumentHttpAuthBindings(content) {
9486
9763
  for (const graphNode of Object.values(content.graph.nodes)) if (graphNode.kind == "task" && "executor" in graphNode.task && ["openapi", "http-request"].includes(graphNode.task.executor.kind)) assertHttpAuthBindings(graphNode.inputs);
9487
9764
  }
9488
9765
  //#endregion
9766
+ //#region src/runtime/common/engineContract.ts
9767
+ /** v11 adds Provider API requests through Connector Proxy. */
9768
+ var currentEngineContract = "open-flow-engine/v11";
9769
+ /** The published v8 Node compatibility contract, retained for existing Publications and Runs. */
9770
+ var nodejsEngineContract = "open-flow-engine/v8/nodejs-compat-v1";
9771
+ var platformSource = (contract) => `export const engineContract = ${JSON.stringify(contract)}
9772
+ export function identity(value) { return value }
9773
+ `;
9774
+ platformSource("open-flow-engine/v8"), new Set([
9775
+ "assert",
9776
+ "assert/strict",
9777
+ "buffer",
9778
+ "console",
9779
+ "constants",
9780
+ "crypto",
9781
+ "events",
9782
+ "fs",
9783
+ "fs/promises",
9784
+ "os",
9785
+ "path",
9786
+ "path/posix",
9787
+ "process",
9788
+ "punycode",
9789
+ "querystring",
9790
+ "stream",
9791
+ "stream/promises",
9792
+ "stream/web",
9793
+ "string_decoder",
9794
+ "timers",
9795
+ "timers/promises",
9796
+ "url",
9797
+ "util",
9798
+ "zlib"
9799
+ ].flatMap((name) => [name, `node:${name}`])), platformSource(nodejsEngineContract), platformSource("open-flow-engine/v9"), platformSource("open-flow-engine/v10"), platformSource(currentEngineContract);
9800
+ //#endregion
9801
+ //#region src/flow/common/agent.ts
9802
+ var schema = lazy(() => union([boolean(), strictObject({
9803
+ type: union([_enum([
9804
+ "array",
9805
+ "boolean",
9806
+ "integer",
9807
+ "null",
9808
+ "number",
9809
+ "object",
9810
+ "string"
9811
+ ]), array(_enum([
9812
+ "array",
9813
+ "boolean",
9814
+ "integer",
9815
+ "null",
9816
+ "number",
9817
+ "object",
9818
+ "string"
9819
+ ])).min(1)]).optional(),
9820
+ const: json$1().optional(),
9821
+ allOf: array(schema).min(1).optional(),
9822
+ anyOf: array(schema).min(1).optional(),
9823
+ oneOf: array(schema).min(1).optional(),
9824
+ not: schema.optional(),
9825
+ if: schema.optional(),
9826
+ then: schema.optional(),
9827
+ else: schema.optional(),
9828
+ $ref: string().optional(),
9829
+ $schema: _enum([
9830
+ "http://json-schema.org/draft-07/schema#",
9831
+ "https://json-schema.org/draft-07/schema",
9832
+ "https://json-schema.org/draft/2019-09/schema",
9833
+ "https://json-schema.org/draft/2020-12/schema"
9834
+ ]).optional(),
9835
+ $defs: record$1(string(), schema).optional(),
9836
+ definitions: record$1(string(), schema).optional(),
9837
+ pattern: string().refine((value) => {
9838
+ try {
9839
+ return new RegExp(value, "u").source.length > 0;
9840
+ } catch {
9841
+ return false;
9842
+ }
9843
+ }, "Invalid regular expression.").optional(),
9844
+ format: string().refine((value) => Object.hasOwn(format, value), "Unsupported string format.").optional(),
9845
+ multipleOf: number().positive().optional(),
9846
+ uniqueItems: boolean().optional(),
9847
+ contains: schema.optional(),
9848
+ minContains: number().int().nonnegative().optional(),
9849
+ maxContains: number().int().nonnegative().optional(),
9850
+ minProperties: number().int().nonnegative().optional(),
9851
+ maxProperties: number().int().nonnegative().optional(),
9852
+ propertyNames: schema.optional(),
9853
+ patternProperties: record$1(string().refine((value) => {
9854
+ try {
9855
+ return new RegExp(value, "u").source.length > 0;
9856
+ } catch {
9857
+ return false;
9858
+ }
9859
+ }, "Invalid regular expression."), schema).optional(),
9860
+ dependentRequired: record$1(string(), array(string())).optional(),
9861
+ dependentSchemas: record$1(string(), schema).optional(),
9862
+ dependencies: record$1(string(), union([schema, array(string())])).optional(),
9863
+ prefixItems: array(schema).optional(),
9864
+ additionalItems: schema.optional(),
9865
+ unevaluatedItems: schema.optional(),
9866
+ unevaluatedProperties: schema.optional(),
9867
+ description: string().optional(),
9868
+ title: string().optional(),
9869
+ default: json$1().optional(),
9870
+ examples: array(json$1()).optional(),
9871
+ readOnly: boolean().optional(),
9872
+ writeOnly: boolean().optional(),
9873
+ deprecated: boolean().optional(),
9874
+ $comment: string().optional(),
9875
+ enum: array(json$1()).min(1).optional(),
9876
+ properties: record$1(string(), schema).optional(),
9877
+ required: array(string()).optional(),
9878
+ additionalProperties: schema.optional(),
9879
+ items: union([schema, array(schema)]).optional(),
9880
+ minItems: number().int().nonnegative().optional(),
9881
+ maxItems: number().int().nonnegative().optional(),
9882
+ minLength: number().int().nonnegative().optional(),
9883
+ maxLength: number().int().nonnegative().optional(),
9884
+ minimum: number().optional(),
9885
+ maximum: number().optional(),
9886
+ exclusiveMinimum: number().optional(),
9887
+ exclusiveMaximum: number().optional()
9888
+ }).transform(({ title: _title, default: _default, examples: _examples, readOnly: _readOnly, writeOnly: _writeOnly, deprecated: _deprecated, $comment: _comment, ...value }) => value)]));
9889
+ //#endregion
9489
9890
  //#region src/flow/common/workflowFile.ts
9490
9891
  var envelope = strictObject({
9491
9892
  kind: literal("open-flow-workflow"),
@@ -9506,6 +9907,844 @@ function decodeWorkflowFile(value) {
9506
9907
  };
9507
9908
  }
9508
9909
  //#endregion
9910
+ //#region src/flow/common/workflowBundle.ts
9911
+ var entries = array(strictObject({
9912
+ flowId: string().min(1),
9913
+ file: unknown()
9914
+ })).min(1);
9915
+ strictObject({
9916
+ kind: literal("open-flow-workflow-bundle"),
9917
+ version: literal(1),
9918
+ entryFlowId: string().min(1),
9919
+ workflows: entries
9920
+ });
9921
+ strictObject({
9922
+ version: literal(1),
9923
+ entryFlowId: string().min(1),
9924
+ workflows: entries,
9925
+ unavailableFlowIds: array(string().min(1))
9926
+ });
9927
+ new TextEncoder();
9928
+ //#endregion
9929
+ //#region ../../node_modules/.bun/@babel+parser@8.0.4/node_modules/@babel/parser/lib/index.js
9930
+ var Position = class {
9931
+ constructor(line, col, index) {
9932
+ this.line = void 0;
9933
+ this.column = void 0;
9934
+ if (index !== void 0) this.index = void 0;
9935
+ this.line = line;
9936
+ this.column = col;
9937
+ if (index !== void 0) this.index = index;
9938
+ }
9939
+ };
9940
+ var SourceLocation = class {
9941
+ start;
9942
+ end;
9943
+ filename;
9944
+ identifierName;
9945
+ constructor(start, end) {
9946
+ this.start = start;
9947
+ this.end = end;
9948
+ }
9949
+ };
9950
+ var code = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
9951
+ var ModuleErrors = {
9952
+ ImportMetaOutsideModule: {
9953
+ message: `import.meta may appear only with 'sourceType: "module"'`,
9954
+ code
9955
+ },
9956
+ ImportOutsideModule: {
9957
+ message: `'import' and 'export' may appear only with 'sourceType: "module"'`,
9958
+ code
9959
+ }
9960
+ };
9961
+ var NodeDescriptions = {
9962
+ ArrayPattern: "array destructuring pattern",
9963
+ AssignmentExpression: "assignment expression",
9964
+ AssignmentPattern: "assignment expression",
9965
+ ArrowFunctionExpression: "arrow function expression",
9966
+ ConditionalExpression: "conditional expression",
9967
+ CatchClause: "catch clause",
9968
+ ForOfStatement: "for-of statement",
9969
+ ForInStatement: "for-in statement",
9970
+ ForStatement: "for-loop",
9971
+ FormalParameters: "function parameter list",
9972
+ Identifier: "identifier",
9973
+ ImportSpecifier: "import specifier",
9974
+ ImportDefaultSpecifier: "import default specifier",
9975
+ ImportNamespaceSpecifier: "import namespace specifier",
9976
+ ObjectPattern: "object destructuring pattern",
9977
+ ParenthesizedExpression: "parenthesized expression",
9978
+ RestElement: "rest element",
9979
+ UpdateExpression: {
9980
+ true: "prefix operation",
9981
+ false: "postfix operation"
9982
+ },
9983
+ VariableDeclarator: "variable declaration",
9984
+ YieldExpression: "yield expression"
9985
+ };
9986
+ var toNodeDescription = (node) => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
9987
+ var StandardErrors = {
9988
+ AccessorIsGenerator: ({ kind }) => `A ${kind}ter cannot be a generator.`,
9989
+ ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
9990
+ AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.",
9991
+ AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
9992
+ AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
9993
+ AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
9994
+ AwaitUsingNotInAsyncContext: "'await using' is only allowed within async functions and at the top levels of modules.",
9995
+ AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
9996
+ BadGetterArity: "A 'get' accessor must not have any formal parameters.",
9997
+ BadSetterArity: "A 'set' accessor must have exactly one formal parameter.",
9998
+ BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.",
9999
+ ConstructorClassField: "Classes may not have a field named 'constructor'.",
10000
+ ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
10001
+ ConstructorIsAccessor: "Class constructor may not be an accessor.",
10002
+ ConstructorIsAsync: "Constructor can't be an async function.",
10003
+ ConstructorIsGenerator: "Constructor can't be a generator.",
10004
+ DeclarationMissingInitializer: ({ kind }) => `Missing initializer in ${kind} declaration.`,
10005
+ DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",
10006
+ DecoratorsBeforeAfterExport: "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",
10007
+ DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
10008
+ DecoratorSemicolon: "Decorators must not be followed by a semicolon.",
10009
+ DecoratorStaticBlock: "Decorators can't be used with a static block.",
10010
+ DeferImportRequiresNamespace: "Only `import defer * as x from \"./module\"` is valid.",
10011
+ DeletePrivateField: "Deleting a private field is not allowed.",
10012
+ DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
10013
+ DuplicateConstructor: "Duplicate constructor in the same class.",
10014
+ DuplicateDefaultExport: "Only one default export allowed per module.",
10015
+ DuplicateExport: ({ exportName }) => `\`${exportName}\` has already been exported. Exported identifiers must be unique.`,
10016
+ DuplicateProto: "Redefinition of __proto__ property.",
10017
+ DuplicateRegExpFlags: "Duplicate regular expression flag.",
10018
+ ElementAfterRest: "Rest element must be last element.",
10019
+ EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
10020
+ ExportBindingIsString: ({ localName, exportName }) => `A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`,
10021
+ ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
10022
+ ForInOfLoopInitializer: ({ type }) => `'${type === "ForInStatement" ? "for-in" : "for-of"}' loop variable declaration may not have an initializer.`,
10023
+ ForInUsing: "For-in loop may not start with 'using' declaration.",
10024
+ ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
10025
+ ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.",
10026
+ GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.",
10027
+ IllegalBreakContinue: ({ type }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`,
10028
+ IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
10029
+ IllegalReturn: "'return' outside of function.",
10030
+ ImportBindingIsString: ({ importName }) => `A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${importName}" as foo }\`?`,
10031
+ ImportCallArity: ({ phase }) => `\`import${phase ? `.${phase}` : ""}()\` requires exactly one or two arguments.`,
10032
+ ImportCallNotNewExpression: ({ phase }) => `Cannot use new with import${phase ? `.${phase}` : ""}().`,
10033
+ ImportCallSpreadArgument: ({ phase }) => `\`...\` is not allowed in \`import${phase ? `.${phase}` : ""}()\`.`,
10034
+ IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
10035
+ InvalidBigIntLiteral: "Invalid BigIntLiteral.",
10036
+ InvalidCodePoint: "Code point out of bounds.",
10037
+ InvalidCoverDiscardElement: "'void' must be followed by an expression when not used in a binding position.",
10038
+ InvalidCoverInitializedName: "Invalid shorthand property initializer.",
10039
+ InvalidDigit: ({ radix }) => `Expected number in radix ${radix}.`,
10040
+ InvalidEscapeSequence: "Bad character escape sequence.",
10041
+ InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.",
10042
+ InvalidEscapedReservedWord: ({ reservedWord }) => `Escape sequence in keyword ${reservedWord}.`,
10043
+ InvalidIdentifier: ({ identifierName }) => `Invalid identifier ${identifierName}.`,
10044
+ InvalidLhs: ({ ancestor }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
10045
+ InvalidLhsBinding: ({ ancestor }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
10046
+ InvalidLhsOptionalChaining: ({ ancestor }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,
10047
+ InvalidNumber: "Invalid number.",
10048
+ InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
10049
+ InvalidOrUnexpectedToken: ({ unexpected }) => `Unexpected character '${unexpected}'.`,
10050
+ InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
10051
+ InvalidPrivateFieldResolution: ({ identifierName }) => `Private name #${identifierName} is not defined.`,
10052
+ InvalidPropertyBindingPattern: "Binding member expression.",
10053
+ InvalidRestAssignmentPattern: "Invalid rest operator's argument.",
10054
+ LabelRedeclaration: ({ labelName }) => `Label '${labelName}' is already declared.`,
10055
+ LetInLexicalBinding: "'let' is disallowed as a lexically bound name.",
10056
+ LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
10057
+ MalformedRegExpFlags: "Invalid regular expression flag.",
10058
+ MissingClassName: "A class name is required.",
10059
+ MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
10060
+ MissingSemicolon: "Missing semicolon.",
10061
+ MissingPlugin: ({ missingPlugin }) => `This experimental syntax requires enabling the parser plugin: ${missingPlugin.map((name) => JSON.stringify(name)).join(", ")}.`,
10062
+ MissingOneOfPlugins: ({ missingPlugin }) => `This experimental syntax requires enabling one of the following parser plugin(s): ${missingPlugin.map((name) => JSON.stringify(name)).join(", ")}.`,
10063
+ MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.",
10064
+ MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.",
10065
+ ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.",
10066
+ ModuleAttributesWithDuplicateKeys: ({ key }) => `Duplicate key "${key}" is not allowed in module attributes.`,
10067
+ ModuleExportNameHasLoneSurrogate: ({ surrogateCharCode }) => `An export name cannot include a lone surrogate, found '\\u${surrogateCharCode.toString(16)}'.`,
10068
+ ModuleExportUndefined: ({ localName }) => `Export '${localName}' is not defined.`,
10069
+ MultipleDefaultsInSwitch: "Multiple default clauses.",
10070
+ NewlineAfterThrow: "Illegal newline after throw.",
10071
+ NoCatchOrFinally: "Missing catch or finally clause.",
10072
+ NumberIdentifier: "Identifier directly after number.",
10073
+ NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",
10074
+ ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.",
10075
+ OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.",
10076
+ OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.",
10077
+ OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.",
10078
+ ParamDupe: "Argument name clash.",
10079
+ PatternHasAccessor: "Object pattern can't contain getter or setter.",
10080
+ PatternHasMethod: "Object pattern can't contain methods.",
10081
+ PrivateInExpectedIn: ({ identifierName }) => `Private names are only allowed in property accesses (\`obj.#${identifierName}\`) or in \`in\` expressions (\`#${identifierName} in obj\`).`,
10082
+ PrivateNameRedeclaration: ({ identifierName }) => `Duplicate private name #${identifierName}.`,
10083
+ RestTrailingComma: "Unexpected trailing comma after rest element.",
10084
+ SloppyFunction: "In non-strict mode code, functions can only be declared at top level or inside a block.",
10085
+ SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",
10086
+ SourcePhaseImportRequiresDefault: "Only `import source x from \"./module\"` is valid.",
10087
+ StaticPrototype: "Classes may not have static property named prototype.",
10088
+ SuperCallNotNewExpression: "Cannot use new with super(...).",
10089
+ SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
10090
+ SuperPrivateField: "Private fields can't be accessed on super.",
10091
+ TrailingDecorator: "Decorators must be attached to a class element.",
10092
+ UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.",
10093
+ UnexpectedDigitAfterHash: "Unexpected digit after hash token.",
10094
+ UnexpectedImportExport: "'import' and 'export' may only appear at the top level.",
10095
+ UnexpectedKeyword: ({ keyword }) => `Unexpected keyword '${keyword}'.`,
10096
+ UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.",
10097
+ UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
10098
+ UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
10099
+ UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
10100
+ UnexpectedPrivateField: "Unexpected private name.",
10101
+ UnexpectedReservedWord: ({ reservedWord }) => `Unexpected reserved word '${reservedWord}'.`,
10102
+ UnexpectedSuper: "'super' is only allowed in object methods and classes.",
10103
+ UnexpectedToken: ({ expected, unexpected }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
10104
+ UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
10105
+ UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
10106
+ UnexpectedVoidPattern: "Unexpected void binding.",
10107
+ UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
10108
+ UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
10109
+ UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
10110
+ UnsupportedMetaProperty: ({ target, onlyValidPropertyName }) => `The only valid meta property for ${target} is ${target}.${onlyValidPropertyName}.`,
10111
+ UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.",
10112
+ UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.",
10113
+ UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",
10114
+ UnterminatedComment: "Unterminated comment.",
10115
+ UnterminatedRegExp: "Unterminated regular expression.",
10116
+ UnterminatedString: "Unterminated string constant.",
10117
+ UnterminatedTemplate: "Unterminated template.",
10118
+ UsingDeclarationExport: "Using declaration cannot be exported.",
10119
+ UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
10120
+ VarRedeclaration: ({ identifierName }) => `Identifier '${identifierName}' has already been declared.`,
10121
+ VoidPatternCatchClauseParam: "A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",
10122
+ VoidPatternInitializer: "A void binding may not have an initializer.",
10123
+ YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
10124
+ YieldInParameter: "Yield expression is not allowed in formal parameters.",
10125
+ YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
10126
+ ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
10127
+ };
10128
+ var StrictModeErrors = {
10129
+ StrictDelete: "Deleting local variable in strict mode.",
10130
+ StrictEvalArguments: ({ referenceName }) => `Assigning to '${referenceName}' in strict mode.`,
10131
+ StrictEvalArgumentsBinding: ({ bindingName }) => `Binding '${bindingName}' in strict mode.`,
10132
+ StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.",
10133
+ StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
10134
+ StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
10135
+ StrictWith: "'with' in strict mode."
10136
+ };
10137
+ var ParseExpressionErrors = {
10138
+ ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.",
10139
+ ParseExpressionExpectsEOF: ({ unexpected }) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(unexpected)}\`.`
10140
+ };
10141
+ var PipelineOperatorErrors = {
10142
+ PipeTopicRequiresHackPipes: "Topic references are only supported when using the `\"proposal\": \"hack\"` version of the pipeline proposal.",
10143
+ PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
10144
+ PipeTopicUnconfiguredToken: ({ token }) => `Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${token}" }.`,
10145
+ PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
10146
+ PipeUnparenthesizedBody: ({ type }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({ type })}; please wrap it in parentheses.`,
10147
+ PipelineUnparenthesized: "Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses."
10148
+ };
10149
+ var FunctionBindErrors = {
10150
+ UnsupportedBind: "Binding should be performed on object property.",
10151
+ UnsupportedBindRHS: "The right-hand side of binding can not be super or import."
10152
+ };
10153
+ function defineHidden(obj, key, value) {
10154
+ Object.defineProperty(obj, key, {
10155
+ enumerable: false,
10156
+ configurable: true,
10157
+ value
10158
+ });
10159
+ }
10160
+ function toParseErrorConstructor({ toMessage, code, reasonCode, syntaxPlugin }) {
10161
+ const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
10162
+ return function constructor(loc, pos, details) {
10163
+ const error = /* @__PURE__ */ new SyntaxError();
10164
+ error.code = code;
10165
+ error.reasonCode = reasonCode;
10166
+ error.loc = loc;
10167
+ error.pos = pos;
10168
+ error.syntaxPlugin = syntaxPlugin;
10169
+ if (hasMissingPlugin) error.missingPlugin = details.missingPlugin;
10170
+ defineHidden(error, "clone", function clone(overrides = {}) {
10171
+ const { line, column, index = pos } = overrides.loc ?? loc;
10172
+ return constructor(new Position(line, column), index, {
10173
+ ...details,
10174
+ ...overrides.details
10175
+ });
10176
+ });
10177
+ defineHidden(error, "details", details);
10178
+ Object.defineProperty(error, "message", {
10179
+ configurable: true,
10180
+ get() {
10181
+ const message = `${toMessage(details)} (${loc.line}:${loc.column})`;
10182
+ this.message = message;
10183
+ return message;
10184
+ },
10185
+ set(value) {
10186
+ Object.defineProperty(this, "message", {
10187
+ value,
10188
+ writable: true
10189
+ });
10190
+ }
10191
+ });
10192
+ return error;
10193
+ };
10194
+ }
10195
+ function ParseErrorEnum(argument, syntaxPlugin) {
10196
+ if (Array.isArray(argument)) return (parseErrorTemplates) => ParseErrorEnum(parseErrorTemplates, argument[0]);
10197
+ const ParseErrorConstructors = {};
10198
+ for (const reasonCode of Object.keys(argument)) {
10199
+ const template = argument[reasonCode];
10200
+ const { message, ...rest } = typeof template === "string" ? { message: () => template } : typeof template === "function" ? { message: template } : template;
10201
+ ParseErrorConstructors[reasonCode] = toParseErrorConstructor({
10202
+ code: "BABEL_PARSER_SYNTAX_ERROR",
10203
+ reasonCode,
10204
+ toMessage: typeof message === "string" ? () => message : message,
10205
+ ...syntaxPlugin ? { syntaxPlugin } : {},
10206
+ ...rest
10207
+ });
10208
+ }
10209
+ return ParseErrorConstructors;
10210
+ }
10211
+ ({
10212
+ ...ParseErrorEnum(ModuleErrors),
10213
+ ...ParseErrorEnum(StandardErrors),
10214
+ ...ParseErrorEnum(StrictModeErrors),
10215
+ ...ParseErrorEnum(ParseExpressionErrors),
10216
+ ...ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors),
10217
+ ...ParseErrorEnum`functionBind`(FunctionBindErrors)
10218
+ });
10219
+ var beforeExpr = true;
10220
+ var startsExpr = true;
10221
+ var isLoop = true;
10222
+ var isAssign = true;
10223
+ var prefix = true;
10224
+ var postfix = true;
10225
+ var ExportedTokenType = class {
10226
+ label;
10227
+ keyword;
10228
+ beforeExpr;
10229
+ startsExpr;
10230
+ rightAssociative;
10231
+ isLoop;
10232
+ isAssign;
10233
+ prefix;
10234
+ postfix;
10235
+ binop;
10236
+ constructor(label, conf = {}) {
10237
+ this.label = label;
10238
+ this.keyword = conf.keyword;
10239
+ this.beforeExpr = !!conf.beforeExpr;
10240
+ this.startsExpr = !!conf.startsExpr;
10241
+ this.rightAssociative = !!conf.rightAssociative;
10242
+ this.isLoop = !!conf.isLoop;
10243
+ this.isAssign = !!conf.isAssign;
10244
+ this.prefix = !!conf.prefix;
10245
+ this.postfix = !!conf.postfix;
10246
+ this.binop = conf.binop != null ? conf.binop : null;
10247
+ }
10248
+ };
10249
+ var keywords$1 = /* @__PURE__ */ new Map();
10250
+ function createKeyword(name, options = {}) {
10251
+ options.keyword = name;
10252
+ const token = createToken(name, options);
10253
+ keywords$1.set(name, token);
10254
+ return token;
10255
+ }
10256
+ function createBinop(name, binop) {
10257
+ return createToken(name, {
10258
+ beforeExpr,
10259
+ binop
10260
+ });
10261
+ }
10262
+ var tokenTypeCounter = -1;
10263
+ var tokenTypes = [];
10264
+ var tokenLabels = [];
10265
+ var tokenBinops = [];
10266
+ var tokenBeforeExprs = [];
10267
+ var tokenStartsExprs = [];
10268
+ var tokenPrefixes = [];
10269
+ function createToken(name, options = {}) {
10270
+ ++tokenTypeCounter;
10271
+ tokenLabels.push(name);
10272
+ tokenBinops.push(options.binop ?? -1);
10273
+ tokenBeforeExprs.push(options.beforeExpr ?? false);
10274
+ tokenStartsExprs.push(options.startsExpr ?? false);
10275
+ tokenPrefixes.push(options.prefix ?? false);
10276
+ tokenTypes.push(new ExportedTokenType(name, options));
10277
+ return tokenTypeCounter;
10278
+ }
10279
+ function createKeywordLike(name, options = {}) {
10280
+ ++tokenTypeCounter;
10281
+ keywords$1.set(name, tokenTypeCounter);
10282
+ tokenLabels.push(name);
10283
+ tokenBinops.push(options.binop ?? -1);
10284
+ tokenBeforeExprs.push(options.beforeExpr ?? false);
10285
+ tokenStartsExprs.push(options.startsExpr ?? false);
10286
+ tokenPrefixes.push(options.prefix ?? false);
10287
+ tokenTypes.push(new ExportedTokenType("name", options));
10288
+ return tokenTypeCounter;
10289
+ }
10290
+ var tt = {
10291
+ bracketL: createToken("[", {
10292
+ beforeExpr,
10293
+ startsExpr
10294
+ }),
10295
+ bracketR: createToken("]"),
10296
+ braceL: createToken("{", {
10297
+ beforeExpr,
10298
+ startsExpr
10299
+ }),
10300
+ braceBarL: createToken("{|", {
10301
+ beforeExpr,
10302
+ startsExpr
10303
+ }),
10304
+ braceR: createToken("}"),
10305
+ braceBarR: createToken("|}"),
10306
+ parenL: createToken("(", {
10307
+ beforeExpr,
10308
+ startsExpr
10309
+ }),
10310
+ parenR: createToken(")"),
10311
+ comma: createToken(",", { beforeExpr }),
10312
+ semi: createToken(";", { beforeExpr }),
10313
+ colon: createToken(":", { beforeExpr }),
10314
+ doubleColon: createToken("::", { beforeExpr }),
10315
+ dot: createToken("."),
10316
+ question: createToken("?", { beforeExpr }),
10317
+ questionDot: createToken("?."),
10318
+ arrow: createToken("=>", { beforeExpr }),
10319
+ template: createToken("template"),
10320
+ ellipsis: createToken("...", { beforeExpr }),
10321
+ backQuote: createToken("`", { startsExpr }),
10322
+ dollarBraceL: createToken("${", {
10323
+ beforeExpr,
10324
+ startsExpr
10325
+ }),
10326
+ templateTail: createToken("...`", { startsExpr }),
10327
+ templateNonTail: createToken("...${", {
10328
+ beforeExpr,
10329
+ startsExpr
10330
+ }),
10331
+ at: createToken("@"),
10332
+ hash: createToken("#", { startsExpr }),
10333
+ interpreterDirective: createToken("#!..."),
10334
+ eq: createToken("=", {
10335
+ beforeExpr,
10336
+ isAssign
10337
+ }),
10338
+ assign: createToken("_=", {
10339
+ beforeExpr,
10340
+ isAssign
10341
+ }),
10342
+ slashAssign: createToken("_=", {
10343
+ beforeExpr,
10344
+ isAssign
10345
+ }),
10346
+ xorAssign: createToken("_=", {
10347
+ beforeExpr,
10348
+ isAssign
10349
+ }),
10350
+ moduloAssign: createToken("_=", {
10351
+ beforeExpr,
10352
+ isAssign
10353
+ }),
10354
+ incDec: createToken("++/--", {
10355
+ prefix,
10356
+ postfix,
10357
+ startsExpr
10358
+ }),
10359
+ bang: createToken("!", {
10360
+ beforeExpr,
10361
+ prefix,
10362
+ startsExpr
10363
+ }),
10364
+ tilde: createToken("~", {
10365
+ beforeExpr,
10366
+ prefix,
10367
+ startsExpr
10368
+ }),
10369
+ doubleCaret: createToken("^^", { startsExpr }),
10370
+ doubleAt: createToken("@@", { startsExpr }),
10371
+ pipeline: createBinop("|>", 0),
10372
+ nullishCoalescing: createBinop("??", 1),
10373
+ logicalOR: createBinop("||", 1),
10374
+ logicalAND: createBinop("&&", 2),
10375
+ bitwiseOR: createBinop("|", 3),
10376
+ bitwiseXOR: createBinop("^", 4),
10377
+ bitwiseAND: createBinop("&", 5),
10378
+ equality: createBinop("==/!=/===/!==", 6),
10379
+ lt: createBinop("</>/<=/>=", 7),
10380
+ gt: createBinop("</>/<=/>=", 7),
10381
+ relational: createBinop("</>/<=/>=", 7),
10382
+ bitShift: createBinop("<</>>/>>>", 8),
10383
+ bitShiftL: createBinop("<</>>/>>>", 8),
10384
+ bitShiftR: createBinop("<</>>/>>>", 8),
10385
+ plusMin: createToken("+/-", {
10386
+ beforeExpr,
10387
+ binop: 9,
10388
+ prefix,
10389
+ startsExpr
10390
+ }),
10391
+ modulo: createToken("%", {
10392
+ binop: 10,
10393
+ startsExpr
10394
+ }),
10395
+ star: createToken("*", { binop: 10 }),
10396
+ slash: createBinop("/", 10),
10397
+ exponent: createToken("**", {
10398
+ beforeExpr,
10399
+ binop: 11,
10400
+ rightAssociative: true
10401
+ }),
10402
+ _in: createKeyword("in", {
10403
+ beforeExpr,
10404
+ binop: 7
10405
+ }),
10406
+ _instanceof: createKeyword("instanceof", {
10407
+ beforeExpr,
10408
+ binop: 7
10409
+ }),
10410
+ _break: createKeyword("break"),
10411
+ _case: createKeyword("case", { beforeExpr }),
10412
+ _catch: createKeyword("catch"),
10413
+ _continue: createKeyword("continue"),
10414
+ _debugger: createKeyword("debugger"),
10415
+ _default: createKeyword("default", { beforeExpr }),
10416
+ _else: createKeyword("else", { beforeExpr }),
10417
+ _finally: createKeyword("finally"),
10418
+ _function: createKeyword("function", { startsExpr }),
10419
+ _if: createKeyword("if"),
10420
+ _return: createKeyword("return", { beforeExpr }),
10421
+ _switch: createKeyword("switch"),
10422
+ _throw: createKeyword("throw", {
10423
+ beforeExpr,
10424
+ prefix,
10425
+ startsExpr
10426
+ }),
10427
+ _try: createKeyword("try"),
10428
+ _var: createKeyword("var"),
10429
+ _const: createKeyword("const"),
10430
+ _with: createKeyword("with"),
10431
+ _new: createKeyword("new", {
10432
+ beforeExpr,
10433
+ startsExpr
10434
+ }),
10435
+ _this: createKeyword("this", { startsExpr }),
10436
+ _super: createKeyword("super", { startsExpr }),
10437
+ _class: createKeyword("class", { startsExpr }),
10438
+ _extends: createKeyword("extends", { beforeExpr }),
10439
+ _export: createKeyword("export"),
10440
+ _import: createKeyword("import", { startsExpr }),
10441
+ _null: createKeyword("null", { startsExpr }),
10442
+ _true: createKeyword("true", { startsExpr }),
10443
+ _false: createKeyword("false", { startsExpr }),
10444
+ _typeof: createKeyword("typeof", {
10445
+ beforeExpr,
10446
+ prefix,
10447
+ startsExpr
10448
+ }),
10449
+ _void: createKeyword("void", {
10450
+ beforeExpr,
10451
+ prefix,
10452
+ startsExpr
10453
+ }),
10454
+ _delete: createKeyword("delete", {
10455
+ beforeExpr,
10456
+ prefix,
10457
+ startsExpr
10458
+ }),
10459
+ _do: createKeyword("do", {
10460
+ isLoop,
10461
+ beforeExpr
10462
+ }),
10463
+ _for: createKeyword("for", { isLoop }),
10464
+ _while: createKeyword("while", { isLoop }),
10465
+ _as: createKeywordLike("as", { startsExpr }),
10466
+ _assert: createKeywordLike("assert", { startsExpr }),
10467
+ _async: createKeywordLike("async", { startsExpr }),
10468
+ _await: createKeywordLike("await", { startsExpr }),
10469
+ _defer: createKeywordLike("defer", { startsExpr }),
10470
+ _from: createKeywordLike("from", { startsExpr }),
10471
+ _get: createKeywordLike("get", { startsExpr }),
10472
+ _let: createKeywordLike("let", { startsExpr }),
10473
+ _meta: createKeywordLike("meta", { startsExpr }),
10474
+ _of: createKeywordLike("of", { startsExpr }),
10475
+ _sent: createKeywordLike("sent", { startsExpr }),
10476
+ _set: createKeywordLike("set", { startsExpr }),
10477
+ _source: createKeywordLike("source", { startsExpr }),
10478
+ _static: createKeywordLike("static", { startsExpr }),
10479
+ _using: createKeywordLike("using", { startsExpr }),
10480
+ _yield: createKeywordLike("yield", { startsExpr }),
10481
+ _asserts: createKeywordLike("asserts", { startsExpr }),
10482
+ _checks: createKeywordLike("checks", { startsExpr }),
10483
+ _exports: createKeywordLike("exports", { startsExpr }),
10484
+ _global: createKeywordLike("global", { startsExpr }),
10485
+ _implements: createKeywordLike("implements", { startsExpr }),
10486
+ _intrinsic: createKeywordLike("intrinsic", { startsExpr }),
10487
+ _infer: createKeywordLike("infer", { startsExpr }),
10488
+ _is: createKeywordLike("is", { startsExpr }),
10489
+ _mixins: createKeywordLike("mixins", { startsExpr }),
10490
+ _proto: createKeywordLike("proto", { startsExpr }),
10491
+ _require: createKeywordLike("require", { startsExpr }),
10492
+ _satisfies: createKeywordLike("satisfies", { startsExpr }),
10493
+ _keyof: createKeywordLike("keyof", { startsExpr }),
10494
+ _readonly: createKeywordLike("readonly", { startsExpr }),
10495
+ _unique: createKeywordLike("unique", { startsExpr }),
10496
+ _abstract: createKeywordLike("abstract", { startsExpr }),
10497
+ _declare: createKeywordLike("declare", { startsExpr }),
10498
+ _enum: createKeywordLike("enum", { startsExpr }),
10499
+ _module: createKeywordLike("module", { startsExpr }),
10500
+ _namespace: createKeywordLike("namespace", { startsExpr }),
10501
+ _interface: createKeywordLike("interface", { startsExpr }),
10502
+ _type: createKeywordLike("type", { startsExpr }),
10503
+ _opaque: createKeywordLike("opaque", { startsExpr }),
10504
+ name: createToken("name", { startsExpr }),
10505
+ placeholder: createToken("%%", { startsExpr }),
10506
+ string: createToken("string", { startsExpr }),
10507
+ num: createToken("num", { startsExpr }),
10508
+ bigint: createToken("bigint", { startsExpr }),
10509
+ regexp: createToken("regexp", { startsExpr }),
10510
+ privateName: createToken("#name", { startsExpr }),
10511
+ eof: createToken("eof"),
10512
+ jsxName: createToken("jsxName"),
10513
+ jsxText: createToken("jsxText", { beforeExpr }),
10514
+ jsxTagStart: createToken("jsxTagStart", { startsExpr }),
10515
+ jsxTagEnd: createToken("jsxTagEnd")
10516
+ };
10517
+ function getExportedToken(token) {
10518
+ return tokenTypes[token];
10519
+ }
10520
+ var TokContext = class {
10521
+ constructor(token, preserveSpace) {
10522
+ this.token = token;
10523
+ this.preserveSpace = !!preserveSpace;
10524
+ }
10525
+ token;
10526
+ preserveSpace;
10527
+ };
10528
+ new TokContext("{"), new TokContext("<tag"), new TokContext("</tag"), new TokContext("<tag>...</tag>", true);
10529
+ var reservedWords = {
10530
+ keyword: [
10531
+ "break",
10532
+ "case",
10533
+ "catch",
10534
+ "continue",
10535
+ "debugger",
10536
+ "default",
10537
+ "do",
10538
+ "else",
10539
+ "finally",
10540
+ "for",
10541
+ "function",
10542
+ "if",
10543
+ "return",
10544
+ "switch",
10545
+ "throw",
10546
+ "try",
10547
+ "var",
10548
+ "const",
10549
+ "while",
10550
+ "with",
10551
+ "new",
10552
+ "this",
10553
+ "super",
10554
+ "class",
10555
+ "extends",
10556
+ "export",
10557
+ "import",
10558
+ "null",
10559
+ "true",
10560
+ "false",
10561
+ "in",
10562
+ "instanceof",
10563
+ "typeof",
10564
+ "void",
10565
+ "delete"
10566
+ ],
10567
+ strict: [
10568
+ "implements",
10569
+ "interface",
10570
+ "let",
10571
+ "package",
10572
+ "private",
10573
+ "protected",
10574
+ "public",
10575
+ "static",
10576
+ "yield"
10577
+ ],
10578
+ strictBind: ["eval", "arguments"]
10579
+ };
10580
+ new Set(reservedWords.keyword);
10581
+ new Set(reservedWords.strict);
10582
+ new Set(reservedWords.strictBind);
10583
+ ParseErrorEnum`flow`({
10584
+ AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
10585
+ AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
10586
+ AssignReservedType: ({ reservedType }) => `Cannot overwrite reserved type ${reservedType}.`,
10587
+ DeclareClassElement: "The `declare` modifier can only appear on class fields.",
10588
+ DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
10589
+ DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.",
10590
+ EnumBooleanMemberNotInitialized: ({ memberName, enumName }) => `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` or \`${memberName} = false,\` in enum \`${enumName}\`.`,
10591
+ EnumDuplicateMemberName: ({ memberName, enumName }) => `Enum member names need to be unique, but the name \`${memberName}\` has already been used before in enum \`${enumName}\`.`,
10592
+ EnumInconsistentMemberValues: ({ enumName }) => `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,
10593
+ EnumInvalidExplicitType: ({ invalidEnumType, enumName }) => `Enum type \`${invalidEnumType}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
10594
+ EnumInvalidExplicitTypeUnknownSupplied: ({ enumName }) => `Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
10595
+ EnumInvalidMemberInitializerPrimaryType: ({ enumName, memberName, explicitType }) => `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of \`${memberName}\` needs to be a ${explicitType} literal.`,
10596
+ EnumInvalidMemberInitializerSymbolType: ({ enumName, memberName }) => `Symbol enum members cannot be initialized. Use \`${memberName},\` in enum \`${enumName}\`.`,
10597
+ EnumInvalidMemberInitializerUnknownType: ({ enumName, memberName }) => `The enum member initializer for \`${memberName}\` needs to be a literal (either a boolean, number, or string) in enum \`${enumName}\`.`,
10598
+ EnumInvalidMemberName: ({ enumName, memberName, suggestion }) => `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`,
10599
+ EnumNumberMemberNotInitialized: ({ enumName, memberName }) => `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`,
10600
+ EnumStringMemberInconsistentlyInitialized: ({ enumName }) => `String enum members need to consistently either all use initializers, or use no initializers, in enum \`${enumName}\`.`,
10601
+ GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
10602
+ ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",
10603
+ InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.",
10604
+ InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.",
10605
+ InexactVariance: "Explicit inexact syntax cannot have variance.",
10606
+ InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.",
10607
+ MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
10608
+ NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.",
10609
+ NestedFlowComment: "Cannot have a flow comment inside another flow comment.",
10610
+ PatternIsOptional: { message: "A binding pattern parameter cannot be optional in an implementation signature." },
10611
+ SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
10612
+ SpreadVariance: "Spread properties cannot have variance.",
10613
+ ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
10614
+ ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
10615
+ ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
10616
+ ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
10617
+ ThisParamNoDefault: "The `this` parameter may not have a default value.",
10618
+ TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
10619
+ TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.",
10620
+ UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.",
10621
+ UnexpectedReservedType: ({ reservedType }) => `Unexpected reserved type ${reservedType}.`,
10622
+ UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.",
10623
+ UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
10624
+ UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.",
10625
+ UnexpectedSubtractionOperand: "Unexpected token, expected \"number\" or \"bigint\".",
10626
+ UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.",
10627
+ UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",
10628
+ UnsupportedDeclareExportKind: ({ unsupportedExportKind, suggestion }) => `\`declare export ${unsupportedExportKind}\` is not supported. Use \`${suggestion}\` instead.`,
10629
+ UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
10630
+ UnterminatedFlowComment: "Unterminated flow-comment."
10631
+ });
10632
+ new RegExp(/\r\n|[\r\n\u2028\u2029]/.source, "g");
10633
+ ParseErrorEnum`jsx`({
10634
+ AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
10635
+ MissingClosingTagElement: ({ openingTagName }) => `Expected corresponding JSX closing tag for <${openingTagName}>.`,
10636
+ MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
10637
+ UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
10638
+ UnexpectedToken: ({ unexpected, HTMLEntity }) => `Unexpected token \`${unexpected}\`. Did you mean \`${HTMLEntity}\` or \`{'${unexpected}'}\`?`,
10639
+ UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.",
10640
+ UnterminatedJsxContent: "Unterminated JSX contents.",
10641
+ UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
10642
+ });
10643
+ var Node = class {
10644
+ constructor(optionFlags, filename, pos, loc) {
10645
+ this.start = pos;
10646
+ this.end = 0;
10647
+ if (loc !== void 0) this.loc = new SourceLocation(loc);
10648
+ if (optionFlags & 128) this.range = [pos, 0];
10649
+ if (loc !== void 0 && filename) this.loc.filename = filename;
10650
+ }
10651
+ type = "";
10652
+ };
10653
+ Node.prototype;
10654
+ ParseErrorEnum`typescript`({
10655
+ AbstractMethodHasImplementation: ({ methodName }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`,
10656
+ AbstractPropertyHasInitializer: ({ propertyName }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
10657
+ AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
10658
+ AccessorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
10659
+ AccessorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
10660
+ ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
10661
+ ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
10662
+ ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
10663
+ ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
10664
+ DeclaratorDefiniteAssertionRequiresTypeAnnotation: "Declarations with definite assignment assertions must also have type annotations.",
10665
+ DeclaratorDefiniteAssertionWithInitializer: "Declarations with initializers cannot also have definite assignment assertions.",
10666
+ DeclareAccessor: ({ kind }) => `'declare' is not allowed in ${kind}ters.`,
10667
+ DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
10668
+ DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
10669
+ DecoratorAbstractMethod: ({ kind }) => `Decorators can't be used with ${kind.startsWith("a") ? "an" : "a"} ${kind}.`,
10670
+ DuplicateAccessibilityModifier: ({ modifier }) => `Accessibility modifier already seen: '${modifier}'.`,
10671
+ DuplicateModifier: ({ modifier }) => `Duplicate modifier: '${modifier}'.`,
10672
+ EmptyHeritageClauseType: ({ token }) => `'${token}' list cannot be empty.`,
10673
+ EmptyNamespaceName: "Namespace must be given a name.",
10674
+ EmptyTypeArguments: "Type argument list cannot be empty.",
10675
+ EmptyTypeParameters: "Type parameter list cannot be empty.",
10676
+ ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
10677
+ ExportAssignmentInTSNamespace: "An export assignment cannot be used in a namespace.",
10678
+ ExportInTSNamespace: "Export declarations are not permitted in a namespace.",
10679
+ ImportAliasHasImportType: "An import alias can not use 'import type'.",
10680
+ ImportInTSNamespace: "Import declarations in a namespace cannot reference a module.",
10681
+ IncompatibleModifiers: ({ modifiers }) => `'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`,
10682
+ IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
10683
+ IndexSignatureHasAccessibility: ({ modifier }) => `Index signatures cannot have an accessibility modifier ('${modifier}').`,
10684
+ IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
10685
+ IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
10686
+ IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
10687
+ InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
10688
+ InlineModuleDeclarationMustUseString: "`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.",
10689
+ InvalidHeritageClauseType: ({ token }) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`,
10690
+ InvalidModifierOnAwaitUsingDeclaration: (modifier) => `'${modifier}' modifier cannot appear on an await using declaration.`,
10691
+ InvalidModifierOnTypeMember: ({ modifier }) => `'${modifier}' modifier cannot appear on a type member.`,
10692
+ InvalidModifierOnTypeParameter: ({ modifier }) => `'${modifier}' modifier cannot appear on a type parameter.`,
10693
+ InvalidModifierOnTypeParameterPositions: ({ modifier }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
10694
+ InvalidModifierOnUsingDeclaration: (modifier) => `'${modifier}' modifier cannot appear on a using declaration.`,
10695
+ InvalidModifiersOrder: ({ orderedModifiers }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
10696
+ InvalidNamespaceName: (value) => `Namespace name cannot be '${value}'.`,
10697
+ InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
10698
+ InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
10699
+ MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
10700
+ NamespaceExportInTSNamespace: "Global module exports may only appear at top level.",
10701
+ NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
10702
+ NonClassMethodPropertyHasAbstractModifier: "'abstract' modifier can only appear on a class, method, or property declaration.",
10703
+ OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
10704
+ OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
10705
+ PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
10706
+ PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
10707
+ PrivateElementHasAccessibility: ({ modifier }) => `Private elements cannot have an accessibility modifier ('${modifier}').`,
10708
+ ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
10709
+ ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
10710
+ ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
10711
+ SetAccessorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
10712
+ SetAccessorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
10713
+ SetAccessorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
10714
+ SingleTypeParameterWithoutTrailingComma: ({ typeParameterName }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
10715
+ StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
10716
+ TupleOptionalAfterType: "A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",
10717
+ TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
10718
+ TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
10719
+ TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
10720
+ TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
10721
+ UnexpectedParameterInitializer: "A parameter initializer is only allowed in a function or constructor implementation.",
10722
+ UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
10723
+ UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
10724
+ UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
10725
+ UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
10726
+ UnexpectedTypeDeclaration: (type) => `'${type}' declarations can only be declared inside a block.`,
10727
+ UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
10728
+ UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
10729
+ UnsupportedSignatureParameterKind: ({ type }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`,
10730
+ UsingDeclarationInAmbientContext: (kind) => `'${kind}' declarations are not allowed in ambient contexts.`
10731
+ });
10732
+ ParseErrorEnum`placeholders`({
10733
+ ClassNameIsRequired: "A class name is required.",
10734
+ UnexpectedSpace: "Unexpected space in placeholder."
10735
+ });
10736
+ function generateExportedTokenTypes(internalTokenTypes) {
10737
+ const tokenTypes = {};
10738
+ for (const typeName of Object.keys(internalTokenTypes)) tokenTypes[typeName] = getExportedToken(internalTokenTypes[typeName]);
10739
+ return tokenTypes;
10740
+ }
10741
+ generateExportedTokenTypes(tt);
10742
+ //#endregion
10743
+ //#region src/flow/common/semantics.ts
10744
+ function codeActions(flow) {
10745
+ return Object.values(flow.graph.nodes).flatMap((node) => node.kind == "task" && "moduleId" in node.task ? (node.task.capabilities ?? []).filter((item) => item.kind == "connector") : []);
10746
+ }
10747
+ //#endregion
9509
10748
  //#region src/render/common/png.ts
9510
10749
  var flowPngAspectRatios = [
9511
10750
  "auto",
@@ -9523,10 +10762,16 @@ function getFlowPngAspectRatio(value) {
9523
10762
  }
9524
10763
  //#endregion
9525
10764
  //#region src/render/node/index.ts
10765
+ var defaultIconCache = new ProviderIconCache({ scope: "node-renderer" });
9526
10766
  /** Render a workflow file without launching or closing the caller's browser. */
9527
10767
  async function flowToPng(browser, workflow, options = {}) {
9528
10768
  const file = decodeWorkflowFile(workflow);
9529
10769
  getFlowPngAspectRatio(options.aspectRatio);
10770
+ const { client, iconCache = defaultIconCache, ...renderOptions } = options;
10771
+ let providers;
10772
+ if (client && (connectionUsage(file.content.document).length > 0 || codeActions(file.content.document).length > 0)) try {
10773
+ providers = await client.listConnectorProviders(void 0, void 0, options.language ?? "en", { cacheOnly: options.allowNetwork === false });
10774
+ } catch {}
9530
10775
  const packageRoot = dirname(createRequire(import.meta.url).resolve("@oomol-lab/open-flow/package.json"));
9531
10776
  const [script, style] = await Promise.all([readFile(join(packageRoot, "dist/render/browser/runtime.js"), "utf8"), readFile(join(packageRoot, "dist/render/browser/runtime.css"), "utf8")]);
9532
10777
  const context = await browser.newContext({
@@ -9537,12 +10782,14 @@ async function flowToPng(browser, workflow, options = {}) {
9537
10782
  try {
9538
10783
  if (options.allowNetwork === false) await context.route("**/*", (route) => route.abort());
9539
10784
  const page = await context.newPage();
10785
+ await page.exposeFunction("OpenFlowProviderIcon", (request) => iconCache.get(request, { allowNetwork: options.allowNetwork }));
9540
10786
  await page.setContent("<!doctype html><html><head><meta charset=\"utf-8\"></head><body></body></html>");
9541
10787
  await page.addStyleTag({ content: style });
9542
10788
  await page.addScriptTag({ content: script });
9543
10789
  const result = await page.evaluate((serialized) => globalThis.OpenFlowRenderer.render(JSON.parse(serialized)), JSON.stringify({
9544
10790
  workflow: file,
9545
- options
10791
+ options: renderOptions,
10792
+ ...providers == null ? {} : { providers }
9546
10793
  }));
9547
10794
  return {
9548
10795
  buffer: Buffer.from(result.dataUrl.slice(result.dataUrl.indexOf(",") + 1), "base64"),