@mastra/server 1.80.0 → 1.81.0-alpha.0

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 (86) hide show
  1. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +51 -12
  2. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +144 -42
  3. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-v6/dist/index.d.ts +53 -14
  4. package/dist/{agent-builder-DXhQCXod.cjs → agent-builder-DIEX-as5.cjs} +2 -2
  5. package/dist/{agent-builder-DXhQCXod.cjs.map → agent-builder-DIEX-as5.cjs.map} +1 -1
  6. package/dist/{agent-builder-CrmZ77IU.js → agent-builder-XhBB0Svr.js} +2 -2
  7. package/dist/{agent-builder-CrmZ77IU.js.map → agent-builder-XhBB0Svr.js.map} +1 -1
  8. package/dist/{api-schema-manifest-JUFooPZG.js → api-schema-manifest-BVPhF1ZS.js} +2 -2
  9. package/dist/{api-schema-manifest-JUFooPZG.js.map → api-schema-manifest-BVPhF1ZS.js.map} +1 -1
  10. package/dist/{api-schema-manifest-CwFjht0V.cjs → api-schema-manifest-BWId44SV.cjs} +2 -2
  11. package/dist/{api-schema-manifest-CwFjht0V.cjs.map → api-schema-manifest-BWId44SV.cjs.map} +1 -1
  12. package/dist/{dist-qgP3izdE.cjs → dist-BK1fCE4z.cjs} +1 -1
  13. package/dist/{dist-DK9HHAgo.js → dist-BLjE21MA.js} +2143 -2025
  14. package/dist/dist-BLjE21MA.js.map +1 -0
  15. package/dist/{dist-DXDt4qI1.cjs → dist-OpNBTIST.cjs} +2191 -2031
  16. package/dist/dist-OpNBTIST.cjs.map +1 -0
  17. package/dist/dist-_M1jEPcL.js +1 -0
  18. package/dist/docs/SKILL.md +1 -1
  19. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  20. package/dist/docs/references/reference-observability-tracing-advanced-queries.md +33 -16
  21. package/dist/{memory-DQXCDswv.js → memory-BTR95ujT.js} +3 -3
  22. package/dist/{memory-DQXCDswv.js.map → memory-BTR95ujT.js.map} +1 -1
  23. package/dist/{memory-DpKQ1Quf.cjs → memory-Buhi6kZ-.cjs} +3 -3
  24. package/dist/{memory-DpKQ1Quf.cjs.map → memory-Buhi6kZ-.cjs.map} +1 -1
  25. package/dist/{observability-65rZOqJk.js → observability-BgIU0otL.js} +2 -2
  26. package/dist/{observability-65rZOqJk.js.map → observability-BgIU0otL.js.map} +1 -1
  27. package/dist/{observability-CFKSxaff.cjs → observability-DHuljMXO.cjs} +2 -2
  28. package/dist/{observability-CFKSxaff.cjs.map → observability-DHuljMXO.cjs.map} +1 -1
  29. package/dist/{observability-new-endpoints-CDeHfFNP.cjs → observability-new-endpoints-CaTskbSh.cjs} +12 -3
  30. package/dist/observability-new-endpoints-CaTskbSh.cjs.map +1 -0
  31. package/dist/{observability-new-endpoints-B6MRJ5Rb.js → observability-new-endpoints-CsUP8y2j.js} +13 -4
  32. package/dist/observability-new-endpoints-CsUP8y2j.js.map +1 -0
  33. package/dist/{probe-image-size-DqKTuApZ.cjs → probe-image-size-BIZUe8Bp.cjs} +50 -678
  34. package/dist/probe-image-size-BIZUe8Bp.cjs.map +1 -0
  35. package/dist/{probe-image-size-BLtXo-AD.js → probe-image-size-BqH96zcz.js} +50 -678
  36. package/dist/probe-image-size-BqH96zcz.js.map +1 -0
  37. package/dist/{routes-CbwRkg8_.cjs → routes-By3cLbPV.cjs} +5 -5
  38. package/dist/{routes-CbwRkg8_.cjs.map → routes-By3cLbPV.cjs.map} +1 -1
  39. package/dist/{routes-M2U8U4Jl.js → routes-CBrxFxzL.js} +5 -5
  40. package/dist/{routes-M2U8U4Jl.js.map → routes-CBrxFxzL.js.map} +1 -1
  41. package/dist/server/handlers/agent-builder.cjs +1 -1
  42. package/dist/server/handlers/agent-builder.js +1 -1
  43. package/dist/server/handlers/memory.cjs +1 -1
  44. package/dist/server/handlers/memory.js +1 -1
  45. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  46. package/dist/server/handlers/observability-new-endpoints.d.ts +36 -4
  47. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  48. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  49. package/dist/server/handlers/observability-shared.cjs +27 -0
  50. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  51. package/dist/server/handlers/observability-shared.d.ts +10 -0
  52. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  53. package/dist/server/handlers/observability-shared.js +24 -1
  54. package/dist/server/handlers/observability-shared.js.map +1 -1
  55. package/dist/server/handlers/observability.cjs +2 -2
  56. package/dist/server/handlers/observability.js +2 -2
  57. package/dist/server/handlers/system.cjs +2 -2
  58. package/dist/server/handlers/system.d.ts +4 -0
  59. package/dist/server/handlers/system.d.ts.map +1 -1
  60. package/dist/server/handlers/system.js +2 -2
  61. package/dist/server/handlers.cjs +3 -3
  62. package/dist/server/handlers.js +3 -3
  63. package/dist/server/schemas/index.cjs +1 -1
  64. package/dist/server/schemas/index.js +1 -1
  65. package/dist/server/schemas/system.d.ts +4 -0
  66. package/dist/server/schemas/system.d.ts.map +1 -1
  67. package/dist/server/server-adapter/index.cjs +1 -1
  68. package/dist/server/server-adapter/index.js +1 -1
  69. package/dist/server/server-adapter/routes/observability.d.ts +18 -2
  70. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  71. package/dist/server/server-adapter/routes/system.d.ts +4 -0
  72. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  73. package/dist/{system-DGfJlOxK.cjs → system-BxHpBJiq.cjs} +3 -1
  74. package/dist/system-BxHpBJiq.cjs.map +1 -0
  75. package/dist/{system-B8L_G4oo.js → system-CxwzIMsy.js} +3 -1
  76. package/dist/system-CxwzIMsy.js.map +1 -0
  77. package/package.json +6 -6
  78. package/dist/dist-C_xVj979.js +0 -1
  79. package/dist/dist-DK9HHAgo.js.map +0 -1
  80. package/dist/dist-DXDt4qI1.cjs.map +0 -1
  81. package/dist/observability-new-endpoints-B6MRJ5Rb.js.map +0 -1
  82. package/dist/observability-new-endpoints-CDeHfFNP.cjs.map +0 -1
  83. package/dist/probe-image-size-BLtXo-AD.js.map +0 -1
  84. package/dist/probe-image-size-DqKTuApZ.cjs.map +0 -1
  85. package/dist/system-B8L_G4oo.js.map +0 -1
  86. package/dist/system-DGfJlOxK.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { i as __require, o as __toESM$1, t as __commonJSMin$1 } from "./rolldown-runtime-CQI-hT2b.js";
1
+ import { o as __toESM$1, t as __commonJSMin$1 } from "./rolldown-runtime-CQI-hT2b.js";
2
2
  import { n as standardSchemaToJSONSchema, r as toStandardSchema$5, t as isStandardSchemaWithJSON$1 } from "./schema-Bf12g7KC-DBc4NSds.js";
3
3
  import "./utils-YEuwVEc2.js";
4
4
  import { _ as InvalidPromptError, a as createEventSourceResponseHandler$3, b as TooManyEmbeddingValuesForCallError, c as generateId, d as parseProviderOptions$1, f as postFormDataToApi, g as APICallError$4, h as withoutTrailingSlash$3, i as createBinaryResponseHandler, l as isParsableJson, n as convertBase64ToUint8Array$1, o as createJsonErrorResponseHandler$3, p as postJsonToApi$3, r as convertUint8ArrayToBase64$2, s as createJsonResponseHandler$3, t as combineHeaders$3, u as loadApiKey, v as InvalidResponseDataError$1, x as UnsupportedFunctionalityError$1 } from "./dist-CNjm6d2Q.js";
@@ -18,6 +18,7 @@ import { MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY, RequestContext } from "@m
18
18
  import { generateEmptyFromSchema } from "@mastra/core/utils";
19
19
  import { InMemoryStore, MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH, MAX_KNOWLEDGE_RECORD_TEXT_LENGTH, canonicalizeKnowledgeScope, createKnowledgeNodeCursor, expandKnowledgeScope, isKnowledgeScopeVisible, knowledgeScopeKey, knowledgeVisibleScopeKeys } from "@mastra/core/storage";
20
20
  import { coreFeatures } from "@mastra/core/features";
21
+ import * as coreObservability from "@mastra/core/observability";
21
22
  import { EntityType, SpanType, createObservabilityContext, getOrCreateSpan } from "@mastra/core/observability";
22
23
  import { MessageHistory, TokenLimiterProcessor } from "@mastra/core/processors";
23
24
  import { createStep, createWorkflow } from "@mastra/core/workflows";
@@ -30,756 +31,39 @@ import { channel, tracingChannel } from "diagnostics_channel";
30
31
  import { AsyncLocalStorage, AsyncResource } from "async_hooks";
31
32
  import { exec, execFile, spawn } from "child_process";
32
33
  import { copyFile, mkdir, mkdtemp, readFile, readdir, rm, stat, writeFile } from "fs/promises";
33
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ms/2.0.0/a65cc302695e9dde36bdbab59e67a07f313b77a4e7b89957a7bf17f930a58070/node_modules/ms/index.js
34
- var require_ms = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
35
- /**
36
- * Helpers.
37
- */
38
- var s = 1e3;
39
- var m = s * 60;
40
- var h = m * 60;
41
- var d = h * 24;
42
- var y = d * 365.25;
43
- /**
44
- * Parse or format the given `val`.
45
- *
46
- * Options:
47
- *
48
- * - `long` verbose formatting [false]
49
- *
50
- * @param {String|Number} val
51
- * @param {Object} [options]
52
- * @throws {Error} throw an error if val is not a non-empty string or a number
53
- * @return {String|Number}
54
- * @api public
55
- */
56
- module.exports = function(val, options) {
57
- options = options || {};
58
- var type = typeof val;
59
- if (type === "string" && val.length > 0) return parse(val);
60
- else if (type === "number" && isNaN(val) === false) return options.long ? fmtLong(val) : fmtShort(val);
61
- throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
34
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/common/utils.js
35
+ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports) => {
36
+ exports.NEED_MORE = 0;
37
+ exports.DONE = 1;
38
+ exports.FAIL = 2;
39
+ exports.sliceEq = function(src, start, dest) {
40
+ for (var i = start, j = 0; j < dest.length;) if (src[i++] !== dest[j++]) return false;
41
+ return true;
62
42
  };
63
- /**
64
- * Parse the given `str` and return milliseconds.
65
- *
66
- * @param {String} str
67
- * @return {Number}
68
- * @api private
69
- */
70
- function parse(str) {
71
- str = String(str);
72
- if (str.length > 100) return;
73
- var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
74
- if (!match) return;
75
- var n = parseFloat(match[1]);
76
- switch ((match[2] || "ms").toLowerCase()) {
77
- case "years":
78
- case "year":
79
- case "yrs":
80
- case "yr":
81
- case "y": return n * y;
82
- case "days":
83
- case "day":
84
- case "d": return n * d;
85
- case "hours":
86
- case "hour":
87
- case "hrs":
88
- case "hr":
89
- case "h": return n * h;
90
- case "minutes":
91
- case "minute":
92
- case "mins":
93
- case "min":
94
- case "m": return n * m;
95
- case "seconds":
96
- case "second":
97
- case "secs":
98
- case "sec":
99
- case "s": return n * s;
100
- case "milliseconds":
101
- case "millisecond":
102
- case "msecs":
103
- case "msec":
104
- case "ms": return n;
105
- default: return;
106
- }
107
- }
108
- /**
109
- * Short format for `ms`.
110
- *
111
- * @param {Number} ms
112
- * @return {String}
113
- * @api private
114
- */
115
- function fmtShort(ms) {
116
- if (ms >= d) return Math.round(ms / d) + "d";
117
- if (ms >= h) return Math.round(ms / h) + "h";
118
- if (ms >= m) return Math.round(ms / m) + "m";
119
- if (ms >= s) return Math.round(ms / s) + "s";
120
- return ms + "ms";
121
- }
122
- /**
123
- * Long format for `ms`.
124
- *
125
- * @param {Number} ms
126
- * @return {String}
127
- * @api private
128
- */
129
- function fmtLong(ms) {
130
- return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms";
131
- }
132
- /**
133
- * Pluralization helper.
134
- */
135
- function plural(ms, n, name) {
136
- if (ms < n) return;
137
- if (ms < n * 1.5) return Math.floor(ms / n) + " " + name;
138
- return Math.ceil(ms / n) + " " + name + "s";
139
- }
140
- }));
141
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/debug.js
142
- var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
143
- /**
144
- * This is the common logic for both the Node.js and web browser
145
- * implementations of `debug()`.
146
- *
147
- * Expose `debug()` as the module.
148
- */
149
- exports = module.exports = createDebug.debug = createDebug["default"] = createDebug;
150
- exports.coerce = coerce;
151
- exports.disable = disable;
152
- exports.enable = enable;
153
- exports.enabled = enabled;
154
- exports.humanize = require_ms();
155
- /**
156
- * The currently active debug mode names, and names to skip.
157
- */
158
- exports.names = [];
159
- exports.skips = [];
160
- /**
161
- * Map of special "%n" handling functions, for the debug "format" argument.
162
- *
163
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
164
- */
165
- exports.formatters = {};
166
- /**
167
- * Previous log timestamp.
168
- */
169
- var prevTime;
170
- /**
171
- * Select a color.
172
- * @param {String} namespace
173
- * @return {Number}
174
- * @api private
175
- */
176
- function selectColor(namespace) {
177
- var hash = 0, i;
178
- for (i in namespace) {
179
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
180
- hash |= 0;
181
- }
182
- return exports.colors[Math.abs(hash) % exports.colors.length];
183
- }
184
- /**
185
- * Create a debugger with the given `namespace`.
186
- *
187
- * @param {String} namespace
188
- * @return {Function}
189
- * @api public
190
- */
191
- function createDebug(namespace) {
192
- function debug() {
193
- if (!debug.enabled) return;
194
- var self = debug;
195
- var curr = +/* @__PURE__ */ new Date();
196
- self.diff = curr - (prevTime || curr);
197
- self.prev = prevTime;
198
- self.curr = curr;
199
- prevTime = curr;
200
- var args = new Array(arguments.length);
201
- for (var i = 0; i < args.length; i++) args[i] = arguments[i];
202
- args[0] = exports.coerce(args[0]);
203
- if ("string" !== typeof args[0]) args.unshift("%O");
204
- var index = 0;
205
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
206
- if (match === "%%") return match;
207
- index++;
208
- var formatter = exports.formatters[format];
209
- if ("function" === typeof formatter) {
210
- var val = args[index];
211
- match = formatter.call(self, val);
212
- args.splice(index, 1);
213
- index--;
214
- }
215
- return match;
216
- });
217
- exports.formatArgs.call(self, args);
218
- (debug.log || exports.log || console.log.bind(console)).apply(self, args);
219
- }
220
- debug.namespace = namespace;
221
- debug.enabled = exports.enabled(namespace);
222
- debug.useColors = exports.useColors();
223
- debug.color = selectColor(namespace);
224
- if ("function" === typeof exports.init) exports.init(debug);
225
- return debug;
226
- }
227
- /**
228
- * Enables a debug mode by namespaces. This can include modes
229
- * separated by a colon and wildcards.
230
- *
231
- * @param {String} namespaces
232
- * @api public
233
- */
234
- function enable(namespaces) {
235
- exports.save(namespaces);
236
- exports.names = [];
237
- exports.skips = [];
238
- var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
239
- var len = split.length;
240
- for (var i = 0; i < len; i++) {
241
- if (!split[i]) continue;
242
- namespaces = split[i].replace(/\*/g, ".*?");
243
- if (namespaces[0] === "-") exports.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
244
- else exports.names.push(new RegExp("^" + namespaces + "$"));
245
- }
246
- }
247
- /**
248
- * Disable debug output.
249
- *
250
- * @api public
251
- */
252
- function disable() {
253
- exports.enable("");
254
- }
255
- /**
256
- * Returns true if the given mode name is enabled, false otherwise.
257
- *
258
- * @param {String} name
259
- * @return {Boolean}
260
- * @api public
261
- */
262
- function enabled(name) {
263
- var i = 0, len = exports.skips.length;
264
- for (; i < len; i++) if (exports.skips[i].test(name)) return false;
265
- for (i = 0, len = exports.names.length; i < len; i++) if (exports.names[i].test(name)) return true;
266
- return false;
267
- }
268
- /**
269
- * Coerce `val`.
270
- *
271
- * @param {Mixed} val
272
- * @return {Mixed}
273
- * @api private
274
- */
275
- function coerce(val) {
276
- if (val instanceof Error) return val.stack || val.message;
277
- return val;
278
- }
279
- }));
280
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/browser.js
281
- var require_browser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
282
- /**
283
- * This is the web browser implementation of `debug()`.
284
- *
285
- * Expose `debug()` as the module.
286
- */
287
- exports = module.exports = require_debug();
288
- exports.log = log;
289
- exports.formatArgs = formatArgs;
290
- exports.save = save;
291
- exports.load = load;
292
- exports.useColors = useColors;
293
- exports.storage = "undefined" != typeof chrome && "undefined" != typeof chrome.storage ? chrome.storage.local : localstorage();
294
- /**
295
- * Colors.
296
- */
297
- exports.colors = [
298
- "lightseagreen",
299
- "forestgreen",
300
- "goldenrod",
301
- "dodgerblue",
302
- "darkorchid",
303
- "crimson"
304
- ];
305
- /**
306
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
307
- * and the Firebug extension (any Firefox version) are known
308
- * to support "%c" CSS customizations.
309
- *
310
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
311
- */
312
- function useColors() {
313
- if (typeof window !== "undefined" && window.process && window.process.type === "renderer") return true;
314
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
315
- }
316
- /**
317
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
318
- */
319
- exports.formatters.j = function(v) {
320
- try {
321
- return JSON.stringify(v);
322
- } catch (err) {
323
- return "[UnexpectedJSONParseError]: " + err.message;
43
+ exports.str2arr = function(str, format) {
44
+ var arr = [];
45
+ var i = 0;
46
+ if (format && format === "hex") while (i < str.length) {
47
+ arr.push(parseInt(str.slice(i, i + 2), 16));
48
+ i += 2;
324
49
  }
50
+ else for (; i < str.length; i++) arr.push(str.charCodeAt(i) & 255);
51
+ return arr;
325
52
  };
326
- /**
327
- * Colorize log arguments if enabled.
328
- *
329
- * @api public
330
- */
331
- function formatArgs(args) {
332
- var useColors = this.useColors;
333
- args[0] = (useColors ? "%c" : "") + this.namespace + (useColors ? " %c" : " ") + args[0] + (useColors ? "%c " : " ") + "+" + exports.humanize(this.diff);
334
- if (!useColors) return;
335
- var c = "color: " + this.color;
336
- args.splice(1, 0, c, "color: inherit");
337
- var index = 0;
338
- var lastC = 0;
339
- args[0].replace(/%[a-zA-Z%]/g, function(match) {
340
- if ("%%" === match) return;
341
- index++;
342
- if ("%c" === match) lastC = index;
343
- });
344
- args.splice(lastC, 0, c);
345
- }
346
- /**
347
- * Invokes `console.log()` when available.
348
- * No-op when `console.log` is not a "function".
349
- *
350
- * @api public
351
- */
352
- function log() {
353
- return "object" === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments);
354
- }
355
- /**
356
- * Save `namespaces`.
357
- *
358
- * @param {String} namespaces
359
- * @api private
360
- */
361
- function save(namespaces) {
362
- try {
363
- if (null == namespaces) exports.storage.removeItem("debug");
364
- else exports.storage.debug = namespaces;
365
- } catch (e) {}
366
- }
367
- /**
368
- * Load `namespaces`.
369
- *
370
- * @return {String} returns the previously persisted debug modes
371
- * @api private
372
- */
373
- function load() {
374
- var r;
375
- try {
376
- r = exports.storage.debug;
377
- } catch (e) {}
378
- if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
379
- return r;
380
- }
381
- /**
382
- * Enable namespaces listed in `localStorage.debug` initially.
383
- */
384
- exports.enable(load());
385
- /**
386
- * Localstorage attempts to return the localstorage.
387
- *
388
- * This is necessary because safari throws
389
- * when a user disables cookies/localstorage
390
- * and you attempt to access it.
391
- *
392
- * @return {LocalStorage}
393
- * @api private
394
- */
395
- function localstorage() {
396
- try {
397
- return window.localStorage;
398
- } catch (e) {}
399
- }
400
- }));
401
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/node.js
402
- var require_node = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
403
- /**
404
- * Module dependencies.
405
- */
406
- var tty = __require("tty");
407
- var util = __require("util");
408
- /**
409
- * This is the Node.js implementation of `debug()`.
410
- *
411
- * Expose `debug()` as the module.
412
- */
413
- exports = module.exports = require_debug();
414
- exports.init = init;
415
- exports.log = log;
416
- exports.formatArgs = formatArgs;
417
- exports.save = save;
418
- exports.load = load;
419
- exports.useColors = useColors;
420
- /**
421
- * Colors.
422
- */
423
- exports.colors = [
424
- 6,
425
- 2,
426
- 3,
427
- 4,
428
- 5,
429
- 1
430
- ];
431
- /**
432
- * Build up the default `inspectOpts` object from the environment variables.
433
- *
434
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
435
- */
436
- exports.inspectOpts = Object.keys(process.env).filter(function(key) {
437
- return /^debug_/i.test(key);
438
- }).reduce(function(obj, key) {
439
- var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) {
440
- return k.toUpperCase();
441
- });
442
- var val = process.env[key];
443
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
444
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
445
- else if (val === "null") val = null;
446
- else val = Number(val);
447
- obj[prop] = val;
448
- return obj;
449
- }, {});
450
- /**
451
- * The file descriptor to write the `debug()` calls to.
452
- * Set the `DEBUG_FD` env variable to override with another value. i.e.:
453
- *
454
- * $ DEBUG_FD=3 node script.js 3>debug.log
455
- */
456
- var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
457
- if (1 !== fd && 2 !== fd) util.deprecate(function() {}, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();
458
- var stream = 1 === fd ? process.stdout : 2 === fd ? process.stderr : createWritableStdioStream(fd);
459
- /**
460
- * Is stdout a TTY? Colored output is enabled when `true`.
461
- */
462
- function useColors() {
463
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(fd);
464
- }
465
- /**
466
- * Map %o to `util.inspect()`, all on a single line.
467
- */
468
- exports.formatters.o = function(v) {
469
- this.inspectOpts.colors = this.useColors;
470
- return util.inspect(v, this.inspectOpts).split("\n").map(function(str) {
471
- return str.trim();
472
- }).join(" ");
473
- };
474
- /**
475
- * Map %o to `util.inspect()`, allowing multiple lines if needed.
476
- */
477
- exports.formatters.O = function(v) {
478
- this.inspectOpts.colors = this.useColors;
479
- return util.inspect(v, this.inspectOpts);
480
- };
481
- /**
482
- * Adds ANSI color escape codes if enabled.
483
- *
484
- * @api public
485
- */
486
- function formatArgs(args) {
487
- var name = this.namespace;
488
- if (this.useColors) {
489
- var c = this.color;
490
- var prefix = " \x1B[3" + c + ";1m" + name + " \x1B[0m";
491
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
492
- args.push("\x1B[3" + c + "m+" + exports.humanize(this.diff) + "\x1B[0m");
493
- } else args[0] = (/* @__PURE__ */ new Date()).toUTCString() + " " + name + " " + args[0];
494
- }
495
- /**
496
- * Invokes `util.format()` with the specified arguments and writes to `stream`.
497
- */
498
- function log() {
499
- return stream.write(util.format.apply(util, arguments) + "\n");
500
- }
501
- /**
502
- * Save `namespaces`.
503
- *
504
- * @param {String} namespaces
505
- * @api private
506
- */
507
- function save(namespaces) {
508
- if (null == namespaces) delete process.env.DEBUG;
509
- else process.env.DEBUG = namespaces;
510
- }
511
- /**
512
- * Load `namespaces`.
513
- *
514
- * @return {String} returns the previously persisted debug modes
515
- * @api private
516
- */
517
- function load() {
518
- return process.env.DEBUG;
519
- }
520
- /**
521
- * Copied from `node/src/node.js`.
522
- *
523
- * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
524
- * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
525
- */
526
- function createWritableStdioStream(fd) {
527
- var stream;
528
- switch (process.binding("tty_wrap").guessHandleType(fd)) {
529
- case "TTY":
530
- stream = new tty.WriteStream(fd);
531
- stream._type = "tty";
532
- if (stream._handle && stream._handle.unref) stream._handle.unref();
533
- break;
534
- case "FILE":
535
- stream = new (__require("fs")).SyncWriteStream(fd, { autoClose: false });
536
- stream._type = "fs";
537
- break;
538
- case "PIPE":
539
- case "TCP":
540
- stream = new (__require("net")).Socket({
541
- fd,
542
- readable: false,
543
- writable: true
544
- });
545
- stream.readable = false;
546
- stream.read = null;
547
- stream._type = "pipe";
548
- if (stream._handle && stream._handle.unref) stream._handle.unref();
549
- break;
550
- default: throw new Error("Implement me. Unknown stream file type!");
551
- }
552
- stream.fd = fd;
553
- stream._isStdio = true;
554
- return stream;
555
- }
556
- /**
557
- * Init logic for `debug` instances.
558
- *
559
- * Create a new `inspectOpts` object in case `useColors` is set
560
- * differently for a particular `debug` instance.
561
- */
562
- function init(debug) {
563
- debug.inspectOpts = {};
564
- var keys = Object.keys(exports.inspectOpts);
565
- for (var i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
566
- }
567
- /**
568
- * Enable namespaces listed in `process.env.DEBUG` initially.
569
- */
570
- exports.enable(load());
571
- }));
572
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/debug/2.6.9/801652e4785c84886fe45a314148ed1497034cb567c175a44cafefed7bfe99be/node_modules/debug/src/index.js
573
- var require_src = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
574
- /**
575
- * Detect Electron renderer process, which is node, but we should
576
- * treat as a browser.
577
- */
578
- if (typeof process !== "undefined" && process.type === "renderer") module.exports = require_browser();
579
- else module.exports = require_node();
580
- }));
581
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/stream-parser/0.3.1/05001837beb9bed7e5025720d2f11fc3082c627fc85fbc1354f5c8b6191938d4/node_modules/stream-parser/index.js
582
- var require_stream_parser = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
583
- /**
584
- * Module dependencies.
585
- */
586
- var assert = __require("assert");
587
- var debug = require_src()("stream-parser");
588
- /**
589
- * Module exports.
590
- */
591
- module.exports = Parser;
592
- /**
593
- * Parser states.
594
- */
595
- var INIT = -1;
596
- var BUFFERING = 0;
597
- var SKIPPING = 1;
598
- var PASSTHROUGH = 2;
599
- /**
600
- * The `Parser` stream mixin works with either `Writable` or `Transform` stream
601
- * instances/subclasses. Provides a convenient generic "parsing" API:
602
- *
603
- * _bytes(n, cb) - buffers "n" bytes and then calls "cb" with the "chunk"
604
- * _skipBytes(n, cb) - skips "n" bytes and then calls "cb" when done
605
- *
606
- * If you extend a `Transform` stream, then the `_passthrough()` function is also
607
- * added:
608
- *
609
- * _passthrough(n, cb) - passes through "n" bytes untouched and then calls "cb"
610
- *
611
- * @param {Stream} stream Transform or Writable stream instance to extend
612
- * @api public
613
- */
614
- function Parser(stream) {
615
- var isTransform = stream && "function" == typeof stream._transform;
616
- var isWritable = stream && "function" == typeof stream._write;
617
- if (!isTransform && !isWritable) throw new Error("must pass a Writable or Transform stream in");
618
- debug("extending Parser into stream");
619
- stream._bytes = _bytes;
620
- stream._skipBytes = _skipBytes;
621
- if (isTransform) stream._passthrough = _passthrough;
622
- if (isTransform) stream._transform = transform;
623
- else stream._write = write;
624
- }
625
- function init(stream) {
626
- debug("initializing parser stream");
627
- stream._parserBytesLeft = 0;
628
- stream._parserBuffers = [];
629
- stream._parserBuffered = 0;
630
- stream._parserState = INIT;
631
- stream._parserCallback = null;
632
- if ("function" == typeof stream.push) stream._parserOutput = stream.push.bind(stream);
633
- stream._parserInit = true;
634
- }
635
- /**
636
- * Buffers `n` bytes and then invokes `fn` once that amount has been collected.
637
- *
638
- * @param {Number} n the number of bytes to buffer
639
- * @param {Function} fn callback function to invoke when `n` bytes are buffered
640
- * @api public
641
- */
642
- function _bytes(n, fn) {
643
- assert(!this._parserCallback, "there is already a \"callback\" set!");
644
- assert(isFinite(n) && n > 0, "can only buffer a finite number of bytes > 0, got \"" + n + "\"");
645
- if (!this._parserInit) init(this);
646
- debug("buffering %o bytes", n);
647
- this._parserBytesLeft = n;
648
- this._parserCallback = fn;
649
- this._parserState = BUFFERING;
650
- }
651
- /**
652
- * Skips over the next `n` bytes, then invokes `fn` once that amount has
653
- * been discarded.
654
- *
655
- * @param {Number} n the number of bytes to discard
656
- * @param {Function} fn callback function to invoke when `n` bytes have been skipped
657
- * @api public
658
- */
659
- function _skipBytes(n, fn) {
660
- assert(!this._parserCallback, "there is already a \"callback\" set!");
661
- assert(n > 0, "can only skip > 0 bytes, got \"" + n + "\"");
662
- if (!this._parserInit) init(this);
663
- debug("skipping %o bytes", n);
664
- this._parserBytesLeft = n;
665
- this._parserCallback = fn;
666
- this._parserState = SKIPPING;
667
- }
668
- /**
669
- * Passes through `n` bytes to the readable side of this stream untouched,
670
- * then invokes `fn` once that amount has been passed through.
671
- *
672
- * @param {Number} n the number of bytes to pass through
673
- * @param {Function} fn callback function to invoke when `n` bytes have passed through
674
- * @api public
675
- */
676
- function _passthrough(n, fn) {
677
- assert(!this._parserCallback, "There is already a \"callback\" set!");
678
- assert(n > 0, "can only pass through > 0 bytes, got \"" + n + "\"");
679
- if (!this._parserInit) init(this);
680
- debug("passing through %o bytes", n);
681
- this._parserBytesLeft = n;
682
- this._parserCallback = fn;
683
- this._parserState = PASSTHROUGH;
684
- }
685
- /**
686
- * The `_write()` callback function implementation.
687
- *
688
- * @api private
689
- */
690
- function write(chunk, encoding, fn) {
691
- if (!this._parserInit) init(this);
692
- debug("write(%o bytes)", chunk.length);
693
- if ("function" == typeof encoding) fn = encoding;
694
- data(this, chunk, null, fn);
695
- }
696
- /**
697
- * The `_transform()` callback function implementation.
698
- *
699
- * @api private
700
- */
701
- function transform(chunk, output, fn) {
702
- if (!this._parserInit) init(this);
703
- debug("transform(%o bytes)", chunk.length);
704
- if ("function" != typeof output) output = this._parserOutput;
705
- data(this, chunk, output, fn);
706
- }
707
- /**
708
- * The internal buffering/passthrough logic...
709
- *
710
- * This `_data` function get's "trampolined" to prevent stack overflows for tight
711
- * loops. This technique requires us to return a "thunk" function for any
712
- * synchronous action. Async stuff breaks the trampoline, but that's ok since it's
713
- * working with a new stack at that point anyway.
714
- *
715
- * @api private
716
- */
717
- function _data(stream, chunk, output, fn) {
718
- if (stream._parserBytesLeft <= 0) return fn(/* @__PURE__ */ new Error("got data but not currently parsing anything"));
719
- if (chunk.length <= stream._parserBytesLeft) return function() {
720
- return process(stream, chunk, output, fn);
721
- };
722
- else return function() {
723
- var b = chunk.slice(0, stream._parserBytesLeft);
724
- return process(stream, b, output, function(err) {
725
- if (err) return fn(err);
726
- if (chunk.length > b.length) return function() {
727
- return _data(stream, chunk.slice(b.length), output, fn);
728
- };
729
- });
730
- };
731
- }
732
- /**
733
- * The internal `process` function gets called by the `data` function when
734
- * something "interesting" happens. This function takes care of buffering the
735
- * bytes when buffering, passing through the bytes when doing that, and invoking
736
- * the user callback when the number of bytes has been reached.
737
- *
738
- * @api private
739
- */
740
- function process(stream, chunk, output, fn) {
741
- stream._parserBytesLeft -= chunk.length;
742
- debug("%o bytes left for stream piece", stream._parserBytesLeft);
743
- if (stream._parserState === BUFFERING) {
744
- stream._parserBuffers.push(chunk);
745
- stream._parserBuffered += chunk.length;
746
- } else if (stream._parserState === PASSTHROUGH) output(chunk);
747
- if (0 === stream._parserBytesLeft) {
748
- var cb = stream._parserCallback;
749
- if (cb && stream._parserState === BUFFERING && stream._parserBuffers.length > 1) chunk = Buffer.concat(stream._parserBuffers, stream._parserBuffered);
750
- if (stream._parserState !== BUFFERING) chunk = null;
751
- stream._parserCallback = null;
752
- stream._parserBuffered = 0;
753
- stream._parserState = INIT;
754
- stream._parserBuffers.splice(0);
755
- if (cb) {
756
- var args = [];
757
- if (chunk) args.push(chunk);
758
- if (output) args.push(output);
759
- var async = cb.length > args.length;
760
- if (async) args.push(trampoline(fn));
761
- var rtn = cb.apply(stream, args);
762
- if (!async || fn === rtn) return fn;
763
- }
764
- } else return fn;
765
- }
766
- var data = trampoline(_data);
767
- /**
768
- * Generic thunk-based "trampoline" helper function.
769
- *
770
- * @param {Function} input function
771
- * @return {Function} "trampolined" function
772
- * @api private
773
- */
774
- function trampoline(fn) {
775
- return function() {
776
- var result = fn.apply(this, arguments);
777
- while ("function" == typeof result) result = result();
778
- return result;
779
- };
53
+ function ProbeError(message, code, statusCode) {
54
+ Error.call(this);
55
+ if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
56
+ else this.stack = (/* @__PURE__ */ new Error()).stack || "";
57
+ this.name = this.constructor.name;
58
+ this.message = message;
59
+ if (code) this.code = code;
60
+ if (statusCode) this.statusCode = statusCode;
780
61
  }
62
+ ProbeError.prototype = Object.create(Error.prototype);
63
+ ProbeError.prototype.constructor = ProbeError;
64
+ exports.ProbeError = ProbeError;
781
65
  }));
782
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/common/read_le_be.js
66
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/common/read_le_be.js
783
67
  var require_read_le_be = /* @__PURE__ */ __commonJSMin$1(((exports) => {
784
68
  exports.readUInt16LE = function(data, offset) {
785
69
  return data[offset] | data[offset + 1] << 8;
@@ -806,229 +90,73 @@ var require_read_le_be = /* @__PURE__ */ __commonJSMin$1(((exports) => {
806
90
  return exports.readUInt32BE(data, offset) | 0;
807
91
  };
808
92
  }));
809
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/common/index.js
810
- var require_common = /* @__PURE__ */ __commonJSMin$1(((exports) => {
811
- var Transform = __require("stream").Transform;
812
- var streamParser = require_stream_parser();
813
- var readLeBe = require_read_le_be();
814
- function ParserStream() {
815
- Transform.call(this, { readableObjectMode: true });
816
- }
817
- ParserStream.prototype = Object.create(Transform.prototype);
818
- ParserStream.prototype.constructor = ParserStream;
819
- streamParser(ParserStream.prototype);
820
- exports.ParserStream = ParserStream;
821
- exports.sliceEq = function(src, start, dest) {
822
- for (var i = start, j = 0; j < dest.length;) if (src[i++] !== dest[j++]) return false;
823
- return true;
824
- };
825
- exports.str2arr = function(str, format) {
826
- var arr = [];
827
- var i = 0;
828
- if (format && format === "hex") while (i < str.length) {
829
- arr.push(parseInt(str.slice(i, i + 2), 16));
830
- i += 2;
831
- }
832
- else for (; i < str.length; i++) arr.push(str.charCodeAt(i) & 255);
833
- return arr;
834
- };
835
- function ProbeError(message, code, statusCode) {
836
- Error.call(this);
837
- if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
838
- else this.stack = (/* @__PURE__ */ new Error()).stack || "";
839
- this.name = this.constructor.name;
840
- this.message = message;
841
- if (code) this.code = code;
842
- if (statusCode) this.statusCode = statusCode;
843
- }
844
- ProbeError.prototype = Object.create(Error.prototype);
845
- ProbeError.prototype.constructor = ProbeError;
846
- exports.ProbeError = ProbeError;
847
- exports.readUInt16LE = readLeBe.readUInt16LE;
848
- exports.readUInt16BE = readLeBe.readUInt16BE;
849
- exports.readInt16LE = readLeBe.readInt16LE;
850
- exports.readInt16BE = readLeBe.readInt16BE;
851
- exports.readUInt32LE = readLeBe.readUInt32LE;
852
- exports.readUInt32BE = readLeBe.readUInt32BE;
853
- exports.readInt32LE = readLeBe.readInt32LE;
854
- exports.readInt32BE = readLeBe.readInt32BE;
855
- }));
856
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/miaf_utils.js
857
- var require_miaf_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
858
- var readUInt16BE = require_common().readUInt16BE;
859
- var readUInt32BE = require_common().readUInt32BE;
860
- function unbox(data, offset) {
861
- if (data.length < 4 + offset) return null;
862
- var size = readUInt32BE(data, offset);
863
- if (data.length < size + offset || size < 8) return null;
864
- return {
865
- boxtype: String.fromCharCode.apply(null, data.slice(offset + 4, offset + 8)),
866
- data: data.slice(offset + 8, offset + size),
867
- end: offset + size
868
- };
869
- }
870
- module.exports.unbox = unbox;
871
- function scan_ipco(data, sandbox) {
872
- var offset = 0;
873
- for (;;) {
874
- var box = unbox(data, offset);
875
- if (!box) break;
876
- switch (box.boxtype) {
877
- case "ispe":
878
- sandbox.sizes.push({
879
- width: readUInt32BE(box.data, 4),
880
- height: readUInt32BE(box.data, 8)
881
- });
882
- break;
883
- case "irot":
884
- sandbox.transforms.push({
885
- type: "irot",
886
- value: box.data[0] & 3
887
- });
93
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/common/miaf_ftyp_parser.js
94
+ var require_miaf_ftyp_parser = /* @__PURE__ */ __commonJSMin$1(((exports) => {
95
+ var NEED_MORE = require_utils().NEED_MORE;
96
+ var DONE = require_utils().DONE;
97
+ var FAIL = require_utils().FAIL;
98
+ var S_MAJOR_BRAND = 0;
99
+ var S_MINOR_VERSION = 1;
100
+ var S_COMPATIBLE_BRAND = 2;
101
+ function MiafFtypParser(ftyp_size) {
102
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(4);
103
+ this.buffered_bytes = 0;
104
+ this.bytes_left = ftyp_size;
105
+ this.state = S_MAJOR_BRAND;
106
+ this.status = Number.isSafeInteger(ftyp_size) && ftyp_size >= 8 && ftyp_size % 4 === 0 ? NEED_MORE : FAIL;
107
+ this.major_brand = "";
108
+ this.compatible_brands = Object.create(null);
109
+ }
110
+ MiafFtypParser.prototype.push = function(chunk) {
111
+ if (this.status !== NEED_MORE) return;
112
+ var chunk_offset = 0;
113
+ while (this.bytes_left > 0 && chunk_offset < chunk.length) {
114
+ var read_buffer = chunk;
115
+ var read_offset = chunk_offset;
116
+ if (this.buffered_bytes > 0 || chunk.length - chunk_offset < 4) {
117
+ var bytes_to_copy = Math.min(4 - this.buffered_bytes, chunk.length - chunk_offset);
118
+ for (var i = 0; i < bytes_to_copy; i++) this.partial_buffer[this.buffered_bytes++] = chunk[chunk_offset++];
119
+ this.bytes_left -= bytes_to_copy;
120
+ if (this.buffered_bytes < 4) return;
121
+ read_buffer = this.partial_buffer;
122
+ read_offset = 0;
123
+ this.buffered_bytes = 0;
124
+ } else {
125
+ chunk_offset += 4;
126
+ this.bytes_left -= 4;
127
+ }
128
+ var brand = String.fromCharCode(read_buffer[read_offset], read_buffer[read_offset + 1], read_buffer[read_offset + 2], read_buffer[read_offset + 3]);
129
+ switch (this.state) {
130
+ case S_MAJOR_BRAND:
131
+ this.major_brand = brand;
132
+ this.state = S_MINOR_VERSION;
888
133
  break;
889
- case "imir": sandbox.transforms.push({
890
- type: "imir",
891
- value: box.data[0] & 1
892
- });
893
- }
894
- offset = box.end;
895
- }
896
- }
897
- function readUIntBE(data, offset, size) {
898
- var result = 0;
899
- for (var i = 0; i < size; i++) result = result * 256 + (data[offset + i] || 0);
900
- return result;
901
- }
902
- function scan_iloc(data, sandbox) {
903
- var offset_size = data[4] >> 4 & 15;
904
- var length_size = data[4] & 15;
905
- var base_offset_size = data[5] >> 4 & 15;
906
- var item_count = readUInt16BE(data, 6);
907
- var offset = 8;
908
- for (var i = 0; i < item_count; i++) {
909
- var item_ID = readUInt16BE(data, offset);
910
- offset += 2;
911
- var data_reference_index = readUInt16BE(data, offset);
912
- offset += 2;
913
- var base_offset = readUIntBE(data, offset, base_offset_size);
914
- offset += base_offset_size;
915
- var extent_count = readUInt16BE(data, offset);
916
- offset += 2;
917
- if (data_reference_index === 0 && extent_count === 1) {
918
- var first_extent_offset = readUIntBE(data, offset, offset_size);
919
- var first_extent_length = readUIntBE(data, offset + offset_size, length_size);
920
- sandbox.item_loc[item_ID] = {
921
- length: first_extent_length,
922
- offset: first_extent_offset + base_offset
923
- };
134
+ case S_MINOR_VERSION:
135
+ this.state = S_COMPATIBLE_BRAND;
136
+ continue;
924
137
  }
925
- offset += extent_count * (offset_size + length_size);
926
- }
927
- }
928
- function scan_iinf(data, sandbox) {
929
- var item_count = readUInt16BE(data, 4);
930
- var offset = 6;
931
- for (var i = 0; i < item_count; i++) {
932
- var box = unbox(data, offset);
933
- if (!box) break;
934
- if (box.boxtype === "infe") {
935
- var item_id = readUInt16BE(box.data, 4);
936
- var item_name = "";
937
- for (var pos = 8; pos < box.data.length && box.data[pos]; pos++) item_name += String.fromCharCode(box.data[pos]);
938
- sandbox.item_inf[item_name] = item_id;
138
+ switch (brand) {
139
+ case "mif1":
140
+ case "msf1":
141
+ case "miaf":
142
+ case "avif":
143
+ case "avis":
144
+ case "heic":
145
+ case "heix":
146
+ case "hevc":
147
+ case "hevx":
148
+ case "heis": this.compatible_brands[brand] = true;
939
149
  }
940
- offset = box.end;
941
- }
942
- }
943
- function scan_iprp(data, sandbox) {
944
- var offset = 0;
945
- for (;;) {
946
- var box = unbox(data, offset);
947
- if (!box) break;
948
- if (box.boxtype === "ipco") scan_ipco(box.data, sandbox);
949
- offset = box.end;
950
- }
951
- }
952
- function scan_meta(data, sandbox) {
953
- var offset = 4;
954
- for (;;) {
955
- var box = unbox(data, offset);
956
- if (!box) break;
957
- if (box.boxtype === "iprp") scan_iprp(box.data, sandbox);
958
- if (box.boxtype === "iloc") scan_iloc(box.data, sandbox);
959
- if (box.boxtype === "iinf") scan_iinf(box.data, sandbox);
960
- offset = box.end;
961
150
  }
962
- }
963
- function getMaxSize(sizes) {
964
- var maxWidthSize = sizes.reduce(function(a, b) {
965
- return a.width > b.width || a.width === b.width && a.height > b.height ? a : b;
966
- });
967
- var maxHeightSize = sizes.reduce(function(a, b) {
968
- return a.height > b.height || a.height === b.height && a.width > b.width ? a : b;
969
- });
970
- var maxSize;
971
- if (maxWidthSize.width > maxHeightSize.height || maxWidthSize.width === maxHeightSize.height && maxWidthSize.height > maxHeightSize.width) maxSize = maxWidthSize;
972
- else maxSize = maxHeightSize;
973
- return maxSize;
974
- }
975
- module.exports.readSizeFromMeta = function(data) {
976
- var sandbox = {
977
- sizes: [],
978
- transforms: [],
979
- item_inf: {},
980
- item_loc: {}
981
- };
982
- scan_meta(data, sandbox);
983
- if (!sandbox.sizes.length) return;
984
- var maxSize = getMaxSize(sandbox.sizes);
985
- var orientation = 1;
986
- sandbox.transforms.forEach(function(transform) {
987
- var rotate_ccw = {
988
- 1: 6,
989
- 2: 5,
990
- 3: 8,
991
- 4: 7,
992
- 5: 4,
993
- 6: 3,
994
- 7: 2,
995
- 8: 1
996
- };
997
- var mirror_vert = {
998
- 1: 4,
999
- 2: 3,
1000
- 3: 2,
1001
- 4: 1,
1002
- 5: 6,
1003
- 6: 5,
1004
- 7: 8,
1005
- 8: 7
1006
- };
1007
- if (transform.type === "imir") {
1008
- if (transform.value === 0) orientation = mirror_vert[orientation];
1009
- else {
1010
- orientation = mirror_vert[orientation];
1011
- orientation = rotate_ccw[orientation];
1012
- orientation = rotate_ccw[orientation];
1013
- }
1014
- }
1015
- if (transform.type === "irot") for (var i = 0; i < transform.value; i++) orientation = rotate_ccw[orientation];
1016
- });
1017
- var exif_location = null;
1018
- if (sandbox.item_inf.Exif) exif_location = sandbox.item_loc[sandbox.item_inf.Exif];
1019
- return {
1020
- width: maxSize.width,
1021
- height: maxSize.height,
1022
- orientation: sandbox.transforms.length ? orientation : null,
1023
- variants: sandbox.sizes,
1024
- exif_location
1025
- };
151
+ if (this.bytes_left === 0) this.status = DONE;
152
+ };
153
+ MiafFtypParser.prototype.getStatus = function() {
154
+ return this.status;
1026
155
  };
1027
- module.exports.getMimeType = function(data) {
1028
- var brand = String.fromCharCode.apply(null, data.slice(0, 4));
1029
- var compat = {};
1030
- compat[brand] = true;
1031
- for (var i = 8; i < data.length; i += 4) compat[String.fromCharCode.apply(null, data.slice(i, i + 4))] = true;
156
+ MiafFtypParser.prototype.getResult = function() {
157
+ if (this.status !== DONE) return;
158
+ var brand = this.major_brand;
159
+ var compat = this.compatible_brands;
1032
160
  if (!compat.mif1 && !compat.msf1 && !compat.miaf) return;
1033
161
  if (brand === "avif" || brand === "avis" || brand === "avio") return {
1034
162
  type: "avif",
@@ -1061,184 +189,1208 @@ var require_miaf_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1061
189
  mime: "image/avif"
1062
190
  };
1063
191
  };
192
+ exports.Parser = MiafFtypParser;
1064
193
  }));
1065
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/exif_utils.js
1066
- var require_exif_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1067
- function error(message, code) {
1068
- var err = new Error(message);
1069
- err.code = code;
1070
- return err;
1071
- }
1072
- function utf8_decode(str) {
1073
- try {
1074
- return decodeURIComponent(escape(str));
1075
- } catch (_) {
1076
- return str;
1077
- }
1078
- }
1079
- function ExifParser(jpeg_bin, exif_start, exif_end) {
1080
- this.input = jpeg_bin.subarray(exif_start, exif_end);
1081
- this.start = exif_start;
1082
- var sig = String.fromCharCode.apply(null, this.input.subarray(0, 4));
1083
- if (sig !== "II*\0" && sig !== "MM\0*") throw error("invalid TIFF signature", "EBADDATA");
1084
- this.big_endian = sig[0] === "M";
1085
- }
1086
- ExifParser.prototype.each = function(on_entry) {
1087
- this.aborted = false;
1088
- var offset = this.read_uint32(4);
1089
- this.ifds_to_read = [{
1090
- id: 0,
1091
- offset
194
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/common/miaf_meta_parser.js
195
+ var require_miaf_meta_parser = /* @__PURE__ */ __commonJSMin$1(((exports) => {
196
+ var NEED_MORE = require_utils().NEED_MORE;
197
+ var DONE = require_utils().DONE;
198
+ var FAIL = require_utils().FAIL;
199
+ var readUInt16BE = require_read_le_be().readUInt16BE;
200
+ var readUInt32BE = require_read_le_be().readUInt32BE;
201
+ var MAX_VARIANTS = 100;
202
+ var MAX_ILOC_ITEMS = 1e3;
203
+ var S_META_HEADER = 0;
204
+ var S_BOX_HEADER = 1;
205
+ var S_ISPE = 2;
206
+ var S_IROT = 3;
207
+ var S_IMIR = 4;
208
+ var S_IINF_HEADER = 5;
209
+ var S_INFE = 6;
210
+ var S_ILOC_HEADER = 7;
211
+ var S_ILOC_ITEM = 8;
212
+ var S_ILOC_EXTENT = 9;
213
+ var ROTATE_CCW = [
214
+ 0,
215
+ 6,
216
+ 5,
217
+ 8,
218
+ 7,
219
+ 4,
220
+ 3,
221
+ 2,
222
+ 1
223
+ ];
224
+ var MIRROR_VERT = [
225
+ 0,
226
+ 4,
227
+ 3,
228
+ 2,
229
+ 1,
230
+ 6,
231
+ 5,
232
+ 8,
233
+ 7
234
+ ];
235
+ function readUIntBE(data, offset, size) {
236
+ var value = 0;
237
+ for (var i = 0; i < size; i++) value = value * 256 + data[offset + i];
238
+ return value;
239
+ }
240
+ function MiafMetaParser(meta_size) {
241
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(30);
242
+ this.buffered_bytes = 0;
243
+ this.bytes_to_skip = 0;
244
+ this.position = 0;
245
+ this.box_end = meta_size;
246
+ this.containers = [{
247
+ type: "meta",
248
+ end: meta_size
1092
249
  }];
1093
- while (this.ifds_to_read.length > 0 && !this.aborted) {
1094
- var i = this.ifds_to_read.shift();
1095
- if (!i.offset) continue;
1096
- this.scan_ifd(i.id, i.offset, on_entry);
1097
- }
1098
- };
1099
- ExifParser.prototype.read_uint16 = function(offset) {
1100
- var d = this.input;
1101
- if (offset + 2 > d.length) throw error("unexpected EOF", "EBADDATA");
1102
- return this.big_endian ? d[offset] * 256 + d[offset + 1] : d[offset] + d[offset + 1] * 256;
1103
- };
1104
- ExifParser.prototype.read_uint32 = function(offset) {
1105
- var d = this.input;
1106
- if (offset + 4 > d.length) throw error("unexpected EOF", "EBADDATA");
1107
- return this.big_endian ? d[offset] * 16777216 + d[offset + 1] * 65536 + d[offset + 2] * 256 + d[offset + 3] : d[offset] + d[offset + 1] * 256 + d[offset + 2] * 65536 + d[offset + 3] * 16777216;
1108
- };
1109
- ExifParser.prototype.is_subifd_link = function(ifd, tag) {
1110
- return ifd === 0 && tag === 34665 || ifd === 0 && tag === 34853 || ifd === 34665 && tag === 40965;
1111
- };
1112
- ExifParser.prototype.exif_format_length = function(format) {
1113
- switch (format) {
1114
- case 1:
1115
- case 2:
1116
- case 6:
1117
- case 7: return 1;
1118
- case 3:
1119
- case 8: return 2;
1120
- case 4:
1121
- case 9:
1122
- case 11: return 4;
1123
- case 5:
1124
- case 10:
1125
- case 12: return 8;
1126
- default: return 0;
1127
- }
1128
- };
1129
- ExifParser.prototype.exif_format_read = function(format, offset) {
1130
- var v;
1131
- switch (format) {
1132
- case 1:
1133
- case 2:
1134
- v = this.input[offset];
1135
- return v;
1136
- case 6:
1137
- v = this.input[offset];
1138
- return v | (v & 128) * 33554430;
1139
- case 3:
1140
- v = this.read_uint16(offset);
1141
- return v;
1142
- case 8:
1143
- v = this.read_uint16(offset);
1144
- return v | (v & 32768) * 131070;
1145
- case 4:
1146
- v = this.read_uint32(offset);
1147
- return v;
1148
- case 9:
1149
- v = this.read_uint32(offset);
1150
- return v | 0;
1151
- case 5:
1152
- case 10:
1153
- case 11:
1154
- case 12: return null;
1155
- case 7: return null;
1156
- default: return null;
1157
- }
1158
- };
1159
- ExifParser.prototype.scan_ifd = function(ifd_no, offset, on_entry) {
1160
- var entry_count = this.read_uint16(offset);
1161
- offset += 2;
1162
- for (var i = 0; i < entry_count; i++) {
1163
- var tag = this.read_uint16(offset);
1164
- var format = this.read_uint16(offset + 2);
1165
- var count = this.read_uint32(offset + 4);
1166
- var comp_length = this.exif_format_length(format);
1167
- var data_length = count * comp_length;
1168
- var data_offset = data_length <= 4 ? offset + 8 : this.read_uint32(offset + 8);
1169
- var is_subifd_link = false;
1170
- if (data_offset + data_length > this.input.length) throw error("unexpected EOF", "EBADDATA");
1171
- var value = [];
1172
- var comp_offset = data_offset;
1173
- for (var j = 0; j < count; j++, comp_offset += comp_length) {
1174
- var item = this.exif_format_read(format, comp_offset);
1175
- if (item === null) {
1176
- value = null;
1177
- break;
1178
- }
1179
- value.push(item);
1180
- }
1181
- if (Array.isArray(value) && format === 2) {
1182
- value = utf8_decode(String.fromCharCode.apply(null, value));
1183
- if (value && value[value.length - 1] === "\0") value = value.slice(0, -1);
250
+ this.state = S_META_HEADER;
251
+ this.read_size = 4;
252
+ this.status = Number.isSafeInteger(meta_size) && meta_size >= 4 ? NEED_MORE : FAIL;
253
+ this.variants = [];
254
+ this.orientation = null;
255
+ this.exif_item_id = 0;
256
+ this.item_locations = {};
257
+ this.iloc_item_count = 0;
258
+ this.items_left = 0;
259
+ this.item_id = 0;
260
+ this.base_offset = 0;
261
+ this.offset_size = 0;
262
+ this.length_size = 0;
263
+ this.base_offset_size = 0;
264
+ }
265
+ MiafMetaParser.prototype.push = function(chunk) {
266
+ var chunk_offset = 0;
267
+ while (this.status === NEED_MORE) {
268
+ if (this.bytes_to_skip > 0) {
269
+ if (chunk_offset === chunk.length) return;
270
+ var bytes_skipped = Math.min(this.bytes_to_skip, chunk.length - chunk_offset);
271
+ this.bytes_to_skip -= bytes_skipped;
272
+ this.position += bytes_skipped;
273
+ chunk_offset += bytes_skipped;
274
+ continue;
1184
275
  }
1185
- if (this.is_subifd_link(ifd_no, tag)) {
1186
- if (Array.isArray(value) && Number.isInteger(value[0]) && value[0] > 0) {
1187
- this.ifds_to_read.push({
1188
- id: tag,
1189
- offset: value[0]
1190
- });
1191
- is_subifd_link = true;
276
+ if (this.state === S_BOX_HEADER && this.buffered_bytes === 0) {
277
+ var container = this.containers[this.containers.length - 1];
278
+ if (this.position === container.end || container.entries_left === 0) {
279
+ this.bytes_to_skip = container.end - this.position;
280
+ this.containers.pop();
281
+ if (this.containers.length === 0) this.status = DONE;
282
+ continue;
1192
283
  }
284
+ this.box_end = container.end;
1193
285
  }
1194
- if (on_entry({
1195
- is_big_endian: this.big_endian,
1196
- ifd: ifd_no,
1197
- tag,
1198
- format,
1199
- count,
1200
- entry_offset: offset + this.start,
1201
- data_length,
1202
- data_offset: data_offset + this.start,
1203
- value,
1204
- is_subifd_link
1205
- }) === false) {
1206
- this.aborted = true;
286
+ if (this.read_size - this.buffered_bytes > this.box_end - this.position) {
287
+ this.status = FAIL;
1207
288
  return;
1208
289
  }
1209
- offset += 12;
290
+ if (chunk_offset === chunk.length && this.read_size > 0) return;
291
+ var read_buffer = chunk;
292
+ var read_offset = chunk_offset;
293
+ var read_size = this.read_size;
294
+ if (this.buffered_bytes > 0 || chunk.length - chunk_offset < read_size) {
295
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length - chunk_offset);
296
+ for (var i = 0; i < bytes_to_copy; i++) this.partial_buffer[this.buffered_bytes++] = chunk[chunk_offset++];
297
+ this.position += bytes_to_copy;
298
+ if (this.buffered_bytes < read_size) return;
299
+ read_buffer = this.partial_buffer;
300
+ read_offset = 0;
301
+ this.buffered_bytes = 0;
302
+ } else {
303
+ chunk_offset += read_size;
304
+ this.position += read_size;
305
+ }
306
+ switch (this.state) {
307
+ case S_META_HEADER:
308
+ this.state = S_BOX_HEADER;
309
+ this.read_size = 8;
310
+ continue;
311
+ case S_BOX_HEADER:
312
+ var box_size = readUInt32BE(read_buffer, read_offset);
313
+ var box_type = String.fromCharCode(read_buffer[read_offset + 4], read_buffer[read_offset + 5], read_buffer[read_offset + 6], read_buffer[read_offset + 7]);
314
+ var parent = this.containers[this.containers.length - 1];
315
+ if (box_size < 8 || box_size - 8 > parent.end - this.position) {
316
+ this.status = FAIL;
317
+ return;
318
+ }
319
+ this.box_end = this.position + box_size - 8;
320
+ if (parent.type === "iinf") parent.entries_left--;
321
+ switch (parent.type + "/" + box_type) {
322
+ case "meta/iprp":
323
+ case "iprp/ipco":
324
+ this.containers.push({
325
+ type: box_type,
326
+ end: this.box_end
327
+ });
328
+ continue;
329
+ case "ipco/ispe":
330
+ this.state = S_ISPE;
331
+ this.read_size = 12;
332
+ continue;
333
+ case "ipco/irot":
334
+ this.state = S_IROT;
335
+ this.read_size = 1;
336
+ continue;
337
+ case "ipco/imir":
338
+ this.state = S_IMIR;
339
+ this.read_size = 1;
340
+ continue;
341
+ case "meta/iinf":
342
+ this.state = S_IINF_HEADER;
343
+ this.read_size = 6;
344
+ continue;
345
+ case "iinf/infe":
346
+ this.state = S_INFE;
347
+ this.read_size = Math.min(13, box_size - 8);
348
+ continue;
349
+ case "meta/iloc":
350
+ this.state = S_ILOC_HEADER;
351
+ this.read_size = 8;
352
+ continue;
353
+ }
354
+ break;
355
+ case S_ISPE:
356
+ if (this.variants.length >= MAX_VARIANTS) {
357
+ this.status = FAIL;
358
+ return;
359
+ }
360
+ this.variants.push({
361
+ width: readUInt32BE(read_buffer, read_offset + 4),
362
+ height: readUInt32BE(read_buffer, read_offset + 8)
363
+ });
364
+ break;
365
+ case S_IROT:
366
+ this.orientation = this.orientation || 1;
367
+ var turns = read_buffer[read_offset] & 3;
368
+ for (var turn = 0; turn < turns; turn++) this.orientation = ROTATE_CCW[this.orientation];
369
+ break;
370
+ case S_IMIR:
371
+ this.orientation = MIRROR_VERT[this.orientation || 1];
372
+ if (read_buffer[read_offset] & 1) this.orientation = ROTATE_CCW[ROTATE_CCW[this.orientation]];
373
+ break;
374
+ case S_IINF_HEADER:
375
+ this.containers.push({
376
+ type: "iinf",
377
+ end: this.box_end,
378
+ entries_left: readUInt16BE(read_buffer, read_offset + 4)
379
+ });
380
+ this.state = S_BOX_HEADER;
381
+ this.read_size = 8;
382
+ continue;
383
+ case S_INFE:
384
+ if (read_size >= 12 && read_buffer[read_offset + 8] === 69 && read_buffer[read_offset + 9] === 120 && read_buffer[read_offset + 10] === 105 && read_buffer[read_offset + 11] === 102 && (read_size === 12 || read_buffer[read_offset + 12] === 0)) this.exif_item_id = readUInt16BE(read_buffer, read_offset + 4);
385
+ break;
386
+ case S_ILOC_HEADER:
387
+ this.offset_size = read_buffer[read_offset + 4] >> 4;
388
+ this.length_size = read_buffer[read_offset + 4] & 15;
389
+ this.base_offset_size = read_buffer[read_offset + 5] >> 4;
390
+ this.items_left = readUInt16BE(read_buffer, read_offset + 6);
391
+ this.iloc_item_count += this.items_left;
392
+ if (this.iloc_item_count > MAX_ILOC_ITEMS) {
393
+ this.status = FAIL;
394
+ return;
395
+ }
396
+ if (this.items_left > 0) {
397
+ this.state = S_ILOC_ITEM;
398
+ this.read_size = 6 + this.base_offset_size;
399
+ continue;
400
+ }
401
+ break;
402
+ case S_ILOC_ITEM:
403
+ this.item_id = readUInt16BE(read_buffer, read_offset);
404
+ var data_reference_index = readUInt16BE(read_buffer, read_offset + 2);
405
+ this.base_offset = readUIntBE(read_buffer, read_offset + 4, this.base_offset_size);
406
+ var extent_count = readUInt16BE(read_buffer, read_offset + 4 + this.base_offset_size);
407
+ var extent_bytes = extent_count * (this.offset_size + this.length_size);
408
+ this.items_left--;
409
+ if (extent_bytes > this.box_end - this.position) {
410
+ this.status = FAIL;
411
+ return;
412
+ }
413
+ if (data_reference_index === 0 && extent_count === 1) {
414
+ this.state = S_ILOC_EXTENT;
415
+ this.read_size = this.offset_size + this.length_size;
416
+ continue;
417
+ }
418
+ if (this.items_left > 0) {
419
+ this.bytes_to_skip = extent_bytes;
420
+ continue;
421
+ }
422
+ break;
423
+ case S_ILOC_EXTENT:
424
+ this.item_locations[this.item_id] = {
425
+ offset: this.base_offset + readUIntBE(read_buffer, read_offset, this.offset_size),
426
+ length: readUIntBE(read_buffer, read_offset + this.offset_size, this.length_size)
427
+ };
428
+ if (this.items_left > 0) {
429
+ this.state = S_ILOC_ITEM;
430
+ this.read_size = 6 + this.base_offset_size;
431
+ continue;
432
+ }
433
+ }
434
+ this.bytes_to_skip = this.box_end - this.position;
435
+ this.state = S_BOX_HEADER;
436
+ this.read_size = 8;
1210
437
  }
1211
- if (ifd_no === 0) this.ifds_to_read.push({
1212
- id: 1,
1213
- offset: this.read_uint32(offset)
438
+ };
439
+ MiafMetaParser.prototype.getStatus = function() {
440
+ return this.status;
441
+ };
442
+ MiafMetaParser.prototype.getResult = function() {
443
+ if (this.status !== DONE || this.variants.length === 0) return;
444
+ var maxWidthSize = this.variants.reduce(function(a, b) {
445
+ return a.width > b.width || a.width === b.width && a.height > b.height ? a : b;
1214
446
  });
447
+ var maxHeightSize = this.variants.reduce(function(a, b) {
448
+ return a.height > b.height || a.height === b.height && a.width > b.width ? a : b;
449
+ });
450
+ var maxSize = maxHeightSize;
451
+ if (maxWidthSize.width > maxHeightSize.height || maxWidthSize.width === maxHeightSize.height && maxWidthSize.height > maxHeightSize.width) maxSize = maxWidthSize;
452
+ return {
453
+ width: maxSize.width,
454
+ height: maxSize.height,
455
+ orientation: this.orientation,
456
+ variants: this.variants,
457
+ exif_location: this.exif_item_id ? this.item_locations[this.exif_item_id] : null
458
+ };
1215
459
  };
1216
- module.exports.ExifParser = ExifParser;
1217
- module.exports.get_orientation = function(data) {
1218
- var orientation = 0;
1219
- try {
1220
- new ExifParser(data, 0, data.length).each(function(entry) {
1221
- if (entry.ifd === 0 && entry.tag === 274 && Array.isArray(entry.value)) {
1222
- orientation = entry.value[0];
1223
- return false;
460
+ exports.Parser = MiafMetaParser;
461
+ }));
462
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/common/exif_orientation_parser.js
463
+ var require_exif_orientation_parser = /* @__PURE__ */ __commonJSMin$1(((exports) => {
464
+ var NEED_MORE = require_utils().NEED_MORE;
465
+ var DONE = require_utils().DONE;
466
+ var FAIL = require_utils().FAIL;
467
+ var readLeBe = require_read_le_be();
468
+ var S_TIFF_HEADER = 0;
469
+ var S_IFD_ENTRY_COUNT = 1;
470
+ var S_IFD_ENTRY = 2;
471
+ function readUInt16(data, offset, big_endian) {
472
+ return big_endian ? readLeBe.readUInt16BE(data, offset) : readLeBe.readUInt16LE(data, offset);
473
+ }
474
+ function readUInt32(data, offset, big_endian) {
475
+ return big_endian ? readLeBe.readUInt32BE(data, offset) : readLeBe.readUInt32LE(data, offset);
476
+ }
477
+ function ExifOrientationParser() {
478
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(12);
479
+ this.buffered_bytes = 0;
480
+ this.bytes_to_skip = 0;
481
+ this.entries_left = 0;
482
+ this.state = S_TIFF_HEADER;
483
+ this.status = NEED_MORE;
484
+ this.orientation = 0;
485
+ this.big_endian = false;
486
+ }
487
+ ExifOrientationParser.prototype.push = function(chunk) {
488
+ var chunk_offset = 0;
489
+ while (this.status === NEED_MORE && chunk_offset < chunk.length) {
490
+ if (this.bytes_to_skip > 0) {
491
+ var bytes_skipped = Math.min(this.bytes_to_skip, chunk.length - chunk_offset);
492
+ this.bytes_to_skip -= bytes_skipped;
493
+ chunk_offset += bytes_skipped;
494
+ continue;
495
+ }
496
+ var read_size = this.state === S_TIFF_HEADER ? 8 : this.state === S_IFD_ENTRY_COUNT ? 2 : 12;
497
+ var read_buffer = chunk;
498
+ var read_offset = chunk_offset;
499
+ if (this.buffered_bytes > 0 || chunk.length - chunk_offset < read_size) {
500
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length - chunk_offset);
501
+ for (var i = 0; i < bytes_to_copy; i++) this.partial_buffer[this.buffered_bytes++] = chunk[chunk_offset++];
502
+ if (this.buffered_bytes < read_size) return;
503
+ read_buffer = this.partial_buffer;
504
+ read_offset = 0;
505
+ this.buffered_bytes = 0;
506
+ } else chunk_offset += read_size;
507
+ switch (this.state) {
508
+ case S_TIFF_HEADER:
509
+ if (read_buffer[read_offset] === 73 && read_buffer[read_offset + 1] === 73 && read_buffer[read_offset + 2] === 42 && read_buffer[read_offset + 3] === 0) this.big_endian = false;
510
+ else if (read_buffer[read_offset] === 77 && read_buffer[read_offset + 1] === 77 && read_buffer[read_offset + 2] === 0 && read_buffer[read_offset + 3] === 42) this.big_endian = true;
511
+ else {
512
+ this.status = FAIL;
513
+ return;
514
+ }
515
+ var ifd0_offset = readUInt32(read_buffer, read_offset + 4, this.big_endian);
516
+ if (ifd0_offset === 0) this.status = DONE;
517
+ else if (ifd0_offset < 8) this.status = FAIL;
518
+ else {
519
+ this.bytes_to_skip = ifd0_offset - 8;
520
+ this.state = S_IFD_ENTRY_COUNT;
521
+ }
522
+ break;
523
+ case S_IFD_ENTRY_COUNT:
524
+ this.entries_left = readUInt16(read_buffer, read_offset, this.big_endian);
525
+ this.state = S_IFD_ENTRY;
526
+ if (this.entries_left === 0) this.status = DONE;
527
+ break;
528
+ case S_IFD_ENTRY:
529
+ if (readUInt16(read_buffer, read_offset, this.big_endian) === 274 && readUInt16(read_buffer, read_offset + 2, this.big_endian) === 3 && readUInt32(read_buffer, read_offset + 4, this.big_endian) === 1) {
530
+ var orientation = readUInt16(read_buffer, read_offset + 8, this.big_endian);
531
+ if (orientation >= 1 && orientation <= 8) {
532
+ this.orientation = orientation;
533
+ this.status = DONE;
534
+ }
535
+ }
536
+ this.entries_left--;
537
+ if (this.entries_left === 0) this.status = DONE;
538
+ }
539
+ }
540
+ };
541
+ ExifOrientationParser.prototype.getStatus = function() {
542
+ return this.status;
543
+ };
544
+ exports.Parser = ExifOrientationParser;
545
+ }));
546
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/avif.js
547
+ var require_avif = /* @__PURE__ */ __commonJSMin$1(((exports) => {
548
+ var NEED_MORE = require_utils().NEED_MORE;
549
+ var DONE = require_utils().DONE;
550
+ var FAIL = require_utils().FAIL;
551
+ var readUInt32BE = require_read_le_be().readUInt32BE;
552
+ var miafFtyp = require_miaf_ftyp_parser();
553
+ var miafMeta = require_miaf_meta_parser();
554
+ var exifOrientation = require_exif_orientation_parser();
555
+ var S_BOX_HEADER = 0;
556
+ var S_FTYP = 1;
557
+ var S_META = 2;
558
+ var S_EXIF_OFFSET = 3;
559
+ var S_EXIF_DATA = 4;
560
+ function MiafParser() {
561
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(8);
562
+ this.buffered_bytes = 0;
563
+ this.bytes_to_skip = 0;
564
+ this.bytes_left = 0;
565
+ this.position = 0;
566
+ this.state = S_BOX_HEADER;
567
+ this.status = NEED_MORE;
568
+ this.data_parser = null;
569
+ this.file_type = null;
570
+ this.result = void 0;
571
+ }
572
+ MiafParser.prototype.push = function(chunk) {
573
+ var chunk_offset = 0;
574
+ while (this.status === NEED_MORE && chunk_offset < chunk.length) {
575
+ if (this.bytes_to_skip > 0) {
576
+ var bytes_skipped = Math.min(this.bytes_to_skip, chunk.length - chunk_offset);
577
+ this.bytes_to_skip -= bytes_skipped;
578
+ this.position += bytes_skipped;
579
+ chunk_offset += bytes_skipped;
580
+ continue;
581
+ }
582
+ if (this.state === S_FTYP || this.state === S_META || this.state === S_EXIF_DATA) {
583
+ var bytes_to_read = Math.min(this.bytes_left, chunk.length - chunk_offset);
584
+ this.data_parser.push(chunk.subarray(chunk_offset, chunk_offset + bytes_to_read));
585
+ this.bytes_left -= bytes_to_read;
586
+ this.position += bytes_to_read;
587
+ chunk_offset += bytes_to_read;
588
+ if (this.data_parser.getStatus() === NEED_MORE && this.bytes_left > 0) continue;
589
+ switch (this.state) {
590
+ case S_FTYP:
591
+ this.file_type = this.data_parser.getResult();
592
+ this.data_parser = null;
593
+ if (!this.file_type) {
594
+ this.status = FAIL;
595
+ return;
596
+ }
597
+ this.state = S_BOX_HEADER;
598
+ break;
599
+ case S_META:
600
+ var image = this.data_parser.getResult();
601
+ this.data_parser = null;
602
+ if (!image) {
603
+ this.status = FAIL;
604
+ return;
605
+ }
606
+ this.result = {
607
+ width: image.width,
608
+ height: image.height,
609
+ type: this.file_type.type,
610
+ mime: this.file_type.mime,
611
+ wUnits: "px",
612
+ hUnits: "px"
613
+ };
614
+ if (image.variants.length > 1) this.result.variants = image.variants;
615
+ if (image.orientation) this.result.orientation = image.orientation;
616
+ var location = image.exif_location;
617
+ if (!location || !Number.isSafeInteger(location.offset) || !Number.isSafeInteger(location.length) || !Number.isSafeInteger(location.offset + location.length) || location.offset <= this.position || location.length < 4) {
618
+ this.status = DONE;
619
+ return;
620
+ }
621
+ this.bytes_to_skip = location.offset - this.position;
622
+ this.bytes_left = location.length;
623
+ this.state = S_EXIF_OFFSET;
624
+ break;
625
+ case S_EXIF_DATA:
626
+ if (this.data_parser.orientation > 0) this.result.orientation = this.data_parser.orientation;
627
+ this.data_parser = null;
628
+ this.status = DONE;
1224
629
  }
1225
- });
1226
- return orientation;
1227
- } catch (err) {
1228
- return -1;
630
+ continue;
631
+ }
632
+ var read_size = this.state === S_EXIF_OFFSET ? 4 : 8;
633
+ var read_buffer = chunk;
634
+ var read_offset = chunk_offset;
635
+ if (this.buffered_bytes > 0 || chunk.length - chunk_offset < read_size) {
636
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length - chunk_offset);
637
+ for (var i = 0; i < bytes_to_copy; i++) this.partial_buffer[this.buffered_bytes++] = chunk[chunk_offset++];
638
+ this.position += bytes_to_copy;
639
+ if (this.buffered_bytes < read_size) return;
640
+ read_buffer = this.partial_buffer;
641
+ read_offset = 0;
642
+ this.buffered_bytes = 0;
643
+ } else {
644
+ chunk_offset += read_size;
645
+ this.position += read_size;
646
+ }
647
+ switch (this.state) {
648
+ case S_BOX_HEADER:
649
+ var box_size = readUInt32BE(read_buffer, read_offset);
650
+ var box_type = String.fromCharCode(read_buffer[read_offset + 4], read_buffer[read_offset + 5], read_buffer[read_offset + 6], read_buffer[read_offset + 7]);
651
+ if (box_size < 8 || !Number.isSafeInteger(this.position + box_size - 8) || box_type === "mdat") {
652
+ this.status = FAIL;
653
+ return;
654
+ }
655
+ this.bytes_left = box_size - 8;
656
+ if (!this.file_type) {
657
+ if (box_type !== "ftyp") {
658
+ this.status = FAIL;
659
+ return;
660
+ }
661
+ this.data_parser = new miafFtyp.Parser(this.bytes_left);
662
+ this.state = S_FTYP;
663
+ } else if (box_type === "meta" && this.bytes_left > 0) {
664
+ this.data_parser = new miafMeta.Parser(this.bytes_left);
665
+ this.state = S_META;
666
+ } else {
667
+ this.bytes_to_skip = this.bytes_left;
668
+ continue;
669
+ }
670
+ if (this.data_parser.getStatus() !== NEED_MORE) this.status = FAIL;
671
+ break;
672
+ case S_EXIF_OFFSET:
673
+ var tiff_offset = readUInt32BE(read_buffer, read_offset);
674
+ this.bytes_left -= 4;
675
+ if (tiff_offset >= this.bytes_left) {
676
+ this.status = DONE;
677
+ return;
678
+ }
679
+ this.bytes_to_skip = tiff_offset;
680
+ this.bytes_left -= tiff_offset;
681
+ this.data_parser = new exifOrientation.Parser();
682
+ this.state = S_EXIF_DATA;
683
+ }
684
+ }
685
+ };
686
+ MiafParser.prototype.getStatus = function() {
687
+ return this.status;
688
+ };
689
+ MiafParser.prototype.getResult = function() {
690
+ return this.result;
691
+ };
692
+ exports.Parser = MiafParser;
693
+ }));
694
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/bmp.js
695
+ var require_bmp = /* @__PURE__ */ __commonJSMin$1(((exports) => {
696
+ var NEED_MORE = require_utils().NEED_MORE;
697
+ var DONE = require_utils().DONE;
698
+ var FAIL = require_utils().FAIL;
699
+ var str2arr = require_utils().str2arr;
700
+ var sliceEq = require_utils().sliceEq;
701
+ var readInt16LE = require_read_le_be().readInt16LE;
702
+ var readInt32LE = require_read_le_be().readInt32LE;
703
+ var readUInt32LE = require_read_le_be().readUInt32LE;
704
+ var SIG_BM = str2arr("BM");
705
+ function BmpParser() {
706
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(26);
707
+ this.buffered_bytes = 0;
708
+ this.status = NEED_MORE;
709
+ this.result = void 0;
710
+ }
711
+ BmpParser.prototype.push = function(chunk) {
712
+ if (this.status !== NEED_MORE) return;
713
+ var data = chunk;
714
+ var read_size = this.partial_buffer.length;
715
+ if (this.buffered_bytes > 0 || chunk.length < read_size) {
716
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length);
717
+ this.partial_buffer.set(chunk.subarray(0, bytes_to_copy), this.buffered_bytes);
718
+ this.buffered_bytes += bytes_to_copy;
719
+ if (this.buffered_bytes < read_size) return;
720
+ data = this.partial_buffer;
721
+ }
722
+ if (!sliceEq(data, 0, SIG_BM)) {
723
+ this.status = FAIL;
724
+ return;
725
+ }
726
+ var height;
727
+ var width;
728
+ var header_size = readUInt32LE(data, 14);
729
+ if (header_size === 12) {
730
+ width = readInt16LE(data, 18);
731
+ height = readInt16LE(data, 20);
732
+ } else if (header_size > 12) {
733
+ width = readInt32LE(data, 18);
734
+ height = readInt32LE(data, 22);
735
+ } else {
736
+ this.status = FAIL;
737
+ return;
738
+ }
739
+ this.result = {
740
+ width,
741
+ height: Math.abs(height),
742
+ type: "bmp",
743
+ mime: "image/bmp",
744
+ wUnits: "px",
745
+ hUnits: "px"
746
+ };
747
+ this.status = DONE;
748
+ };
749
+ BmpParser.prototype.getStatus = function() {
750
+ return this.status;
751
+ };
752
+ BmpParser.prototype.getResult = function() {
753
+ return this.result;
754
+ };
755
+ exports.Parser = BmpParser;
756
+ }));
757
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/gif.js
758
+ var require_gif = /* @__PURE__ */ __commonJSMin$1(((exports) => {
759
+ var NEED_MORE = require_utils().NEED_MORE;
760
+ var DONE = require_utils().DONE;
761
+ var FAIL = require_utils().FAIL;
762
+ var str2arr = require_utils().str2arr;
763
+ var sliceEq = require_utils().sliceEq;
764
+ var readUInt16LE = require_read_le_be().readUInt16LE;
765
+ var SIG_GIF87a = str2arr("GIF87a");
766
+ var SIG_GIF89a = str2arr("GIF89a");
767
+ function GifParser() {
768
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(10);
769
+ this.buffered_bytes = 0;
770
+ this.status = NEED_MORE;
771
+ this.result = void 0;
772
+ }
773
+ GifParser.prototype.push = function(chunk) {
774
+ if (this.status !== NEED_MORE) return;
775
+ var data = chunk;
776
+ var read_size = this.partial_buffer.length;
777
+ if (this.buffered_bytes > 0 || chunk.length < read_size) {
778
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length);
779
+ this.partial_buffer.set(chunk.subarray(0, bytes_to_copy), this.buffered_bytes);
780
+ this.buffered_bytes += bytes_to_copy;
781
+ if (this.buffered_bytes < read_size) return;
782
+ data = this.partial_buffer;
783
+ }
784
+ if (!sliceEq(data, 0, SIG_GIF87a) && !sliceEq(data, 0, SIG_GIF89a)) {
785
+ this.status = FAIL;
786
+ return;
787
+ }
788
+ this.result = {
789
+ width: readUInt16LE(data, 6),
790
+ height: readUInt16LE(data, 8),
791
+ type: "gif",
792
+ mime: "image/gif",
793
+ wUnits: "px",
794
+ hUnits: "px"
795
+ };
796
+ this.status = DONE;
797
+ };
798
+ GifParser.prototype.getStatus = function() {
799
+ return this.status;
800
+ };
801
+ GifParser.prototype.getResult = function() {
802
+ return this.result;
803
+ };
804
+ exports.Parser = GifParser;
805
+ }));
806
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/ico.js
807
+ var require_ico = /* @__PURE__ */ __commonJSMin$1(((exports) => {
808
+ var NEED_MORE = require_utils().NEED_MORE;
809
+ var DONE = require_utils().DONE;
810
+ var FAIL = require_utils().FAIL;
811
+ var readUInt16LE = require_read_le_be().readUInt16LE;
812
+ var S_HEADER = 0;
813
+ var S_INDEX_ENTRY = 1;
814
+ var TYPE_ICO = 1;
815
+ var INDEX_ENTRY_SIZE = 16;
816
+ function IcoParser() {
817
+ this.partial_buffer = new Uint8Array(INDEX_ENTRY_SIZE);
818
+ this.buffered_bytes = 0;
819
+ this.entries_left = 0;
820
+ this.variants = [];
821
+ this.max_size = {
822
+ width: 0,
823
+ height: 0
824
+ };
825
+ this.state = S_HEADER;
826
+ this.status = NEED_MORE;
827
+ this.result = void 0;
828
+ }
829
+ IcoParser.prototype.push = function(chunk) {
830
+ var chunk_offset = 0;
831
+ while (this.status === NEED_MORE && chunk_offset < chunk.length) {
832
+ var read_size = this.state === S_HEADER ? 6 : INDEX_ENTRY_SIZE;
833
+ var read_buffer = chunk;
834
+ var read_offset = chunk_offset;
835
+ if (this.buffered_bytes > 0 || chunk.length - chunk_offset < read_size) {
836
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length - chunk_offset);
837
+ this.partial_buffer.set(chunk.subarray(chunk_offset, chunk_offset + bytes_to_copy), this.buffered_bytes);
838
+ this.buffered_bytes += bytes_to_copy;
839
+ chunk_offset += bytes_to_copy;
840
+ if (this.buffered_bytes < read_size) return;
841
+ read_buffer = this.partial_buffer;
842
+ read_offset = 0;
843
+ this.buffered_bytes = 0;
844
+ } else chunk_offset += read_size;
845
+ switch (this.state) {
846
+ case S_HEADER:
847
+ var reserved = readUInt16LE(read_buffer, read_offset);
848
+ var type = readUInt16LE(read_buffer, read_offset + 2);
849
+ this.entries_left = readUInt16LE(read_buffer, read_offset + 4);
850
+ if (reserved !== 0 || type !== TYPE_ICO || this.entries_left === 0) {
851
+ this.status = FAIL;
852
+ return;
853
+ }
854
+ this.state = S_INDEX_ENTRY;
855
+ break;
856
+ case S_INDEX_ENTRY:
857
+ var width = read_buffer[read_offset] || 256;
858
+ var height = read_buffer[read_offset + 1] || 256;
859
+ var size = {
860
+ width,
861
+ height
862
+ };
863
+ this.variants.push(size);
864
+ if (width > this.max_size.width || height > this.max_size.height) this.max_size = size;
865
+ this.entries_left--;
866
+ if (this.entries_left === 0) {
867
+ this.result = {
868
+ width: this.max_size.width,
869
+ height: this.max_size.height,
870
+ variants: this.variants,
871
+ type: "ico",
872
+ mime: "image/x-icon",
873
+ wUnits: "px",
874
+ hUnits: "px"
875
+ };
876
+ this.status = DONE;
877
+ }
878
+ }
879
+ }
880
+ };
881
+ IcoParser.prototype.getStatus = function() {
882
+ return this.status;
883
+ };
884
+ IcoParser.prototype.getResult = function() {
885
+ return this.result;
886
+ };
887
+ exports.Parser = IcoParser;
888
+ }));
889
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/jpeg.js
890
+ var require_jpeg = /* @__PURE__ */ __commonJSMin$1(((exports) => {
891
+ var NEED_MORE = require_utils().NEED_MORE;
892
+ var DONE = require_utils().DONE;
893
+ var FAIL = require_utils().FAIL;
894
+ var readUInt16BE = require_read_le_be().readUInt16BE;
895
+ var str2arr = require_utils().str2arr;
896
+ var sliceEq = require_utils().sliceEq;
897
+ var exifOrientation = require_exif_orientation_parser();
898
+ var SIG_JPEG = str2arr("ÿØÿ");
899
+ var SIG_EXIF = str2arr("Exif\0\0");
900
+ var S_SIGNATURE = 0;
901
+ var S_MARKER_START = 1;
902
+ var S_MARKER_CODE = 2;
903
+ var S_SEGMENT_LENGTH = 3;
904
+ var S_EXIF_SIGNATURE = 4;
905
+ var S_EXIF_DATA = 5;
906
+ var S_SOF = 6;
907
+ function JpegParser() {
908
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(6);
909
+ this.buffered_bytes = 0;
910
+ this.bytes_to_skip = 0;
911
+ this.segment_bytes_left = 0;
912
+ this.marker_code = 0;
913
+ this.orientation = 0;
914
+ this.orientation_parser = null;
915
+ this.state = S_SIGNATURE;
916
+ this.read_size = 3;
917
+ this.status = NEED_MORE;
918
+ this.result = void 0;
919
+ }
920
+ JpegParser.prototype.push = function(chunk) {
921
+ var chunk_offset = 0;
922
+ while (this.status === NEED_MORE && chunk_offset < chunk.length) {
923
+ if (this.bytes_to_skip > 0) {
924
+ var bytes_skipped = Math.min(this.bytes_to_skip, chunk.length - chunk_offset);
925
+ this.bytes_to_skip -= bytes_skipped;
926
+ chunk_offset += bytes_skipped;
927
+ continue;
928
+ }
929
+ if (this.state === S_EXIF_DATA) {
930
+ var bytes_to_read = Math.min(this.segment_bytes_left, chunk.length - chunk_offset);
931
+ this.orientation_parser.push(chunk.subarray(chunk_offset, chunk_offset + bytes_to_read));
932
+ this.segment_bytes_left -= bytes_to_read;
933
+ chunk_offset += bytes_to_read;
934
+ if (this.orientation_parser.getStatus() === NEED_MORE && this.segment_bytes_left > 0) continue;
935
+ this.orientation = this.orientation_parser.orientation;
936
+ this.orientation_parser = null;
937
+ this.bytes_to_skip = this.segment_bytes_left;
938
+ this.state = S_MARKER_START;
939
+ this.read_size = 1;
940
+ continue;
941
+ }
942
+ var read_buffer = chunk;
943
+ var read_offset = chunk_offset;
944
+ if (this.buffered_bytes > 0 || chunk.length - chunk_offset < this.read_size) {
945
+ var bytes_to_copy = Math.min(this.read_size - this.buffered_bytes, chunk.length - chunk_offset);
946
+ this.partial_buffer.set(chunk.subarray(chunk_offset, chunk_offset + bytes_to_copy), this.buffered_bytes);
947
+ this.buffered_bytes += bytes_to_copy;
948
+ chunk_offset += bytes_to_copy;
949
+ if (this.buffered_bytes < this.read_size) return;
950
+ read_buffer = this.partial_buffer;
951
+ read_offset = 0;
952
+ this.buffered_bytes = 0;
953
+ } else chunk_offset += this.read_size;
954
+ switch (this.state) {
955
+ case S_SIGNATURE:
956
+ if (!sliceEq(read_buffer, read_offset, SIG_JPEG)) {
957
+ this.status = FAIL;
958
+ return;
959
+ }
960
+ this.state = S_MARKER_CODE;
961
+ this.read_size = 1;
962
+ break;
963
+ case S_MARKER_START:
964
+ if (read_buffer[read_offset] === 255) this.state = S_MARKER_CODE;
965
+ break;
966
+ case S_MARKER_CODE:
967
+ var code = read_buffer[read_offset];
968
+ if (code === 255) break;
969
+ if (code === 217 || code === 218) {
970
+ this.status = FAIL;
971
+ return;
972
+ }
973
+ if (code >= 208 && code <= 216 || code === 1) {
974
+ this.state = S_MARKER_START;
975
+ break;
976
+ }
977
+ if (code < 192 || code > 254) {
978
+ this.status = FAIL;
979
+ return;
980
+ }
981
+ this.marker_code = code;
982
+ this.state = S_SEGMENT_LENGTH;
983
+ this.read_size = 2;
984
+ break;
985
+ case S_SEGMENT_LENGTH:
986
+ this.segment_bytes_left = readUInt16BE(read_buffer, read_offset) - 2;
987
+ if (this.segment_bytes_left < 0) {
988
+ this.status = FAIL;
989
+ return;
990
+ }
991
+ if (this.marker_code === 225 && this.segment_bytes_left >= 10) {
992
+ this.state = S_EXIF_SIGNATURE;
993
+ this.read_size = 6;
994
+ } else if (this.segment_bytes_left >= 5 && this.marker_code >= 192 && this.marker_code <= 207 && this.marker_code !== 196 && this.marker_code !== 200 && this.marker_code !== 204) {
995
+ this.state = S_SOF;
996
+ this.read_size = 5;
997
+ } else {
998
+ this.bytes_to_skip = this.segment_bytes_left;
999
+ this.state = S_MARKER_START;
1000
+ this.read_size = 1;
1001
+ }
1002
+ break;
1003
+ case S_EXIF_SIGNATURE:
1004
+ this.segment_bytes_left -= 6;
1005
+ if (sliceEq(read_buffer, read_offset, SIG_EXIF)) {
1006
+ this.orientation_parser = new exifOrientation.Parser();
1007
+ this.state = S_EXIF_DATA;
1008
+ } else {
1009
+ this.bytes_to_skip = this.segment_bytes_left;
1010
+ this.state = S_MARKER_START;
1011
+ this.read_size = 1;
1012
+ }
1013
+ break;
1014
+ case S_SOF:
1015
+ this.result = {
1016
+ width: readUInt16BE(read_buffer, read_offset + 3),
1017
+ height: readUInt16BE(read_buffer, read_offset + 1),
1018
+ type: "jpg",
1019
+ mime: "image/jpeg",
1020
+ wUnits: "px",
1021
+ hUnits: "px"
1022
+ };
1023
+ if (this.orientation > 0) this.result.orientation = this.orientation;
1024
+ this.status = DONE;
1025
+ }
1229
1026
  }
1230
1027
  };
1028
+ JpegParser.prototype.getStatus = function() {
1029
+ return this.status;
1030
+ };
1031
+ JpegParser.prototype.getResult = function() {
1032
+ return this.result;
1033
+ };
1034
+ exports.Parser = JpegParser;
1231
1035
  }));
1232
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/common/svg_header.js
1233
- var require_svg_header = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1036
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/png.js
1037
+ var require_png = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1038
+ var NEED_MORE = require_utils().NEED_MORE;
1039
+ var DONE = require_utils().DONE;
1040
+ var FAIL = require_utils().FAIL;
1041
+ var str2arr = require_utils().str2arr;
1042
+ var sliceEq = require_utils().sliceEq;
1043
+ var readUInt32BE = require_read_le_be().readUInt32BE;
1044
+ var SIG_PNG = str2arr("‰PNG\r\n\n");
1045
+ var SIG_IHDR = str2arr("IHDR");
1046
+ function PngParser() {
1047
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(24);
1048
+ this.buffered_bytes = 0;
1049
+ this.status = NEED_MORE;
1050
+ this.result = void 0;
1051
+ }
1052
+ PngParser.prototype.push = function(chunk) {
1053
+ if (this.status !== NEED_MORE) return;
1054
+ var data = chunk;
1055
+ var read_size = this.partial_buffer.length;
1056
+ if (this.buffered_bytes > 0 || chunk.length < read_size) {
1057
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length);
1058
+ this.partial_buffer.set(chunk.subarray(0, bytes_to_copy), this.buffered_bytes);
1059
+ this.buffered_bytes += bytes_to_copy;
1060
+ if (this.buffered_bytes < read_size) return;
1061
+ data = this.partial_buffer;
1062
+ }
1063
+ if (!sliceEq(data, 0, SIG_PNG)) {
1064
+ this.status = FAIL;
1065
+ return;
1066
+ }
1067
+ if (!sliceEq(data, 12, SIG_IHDR)) {
1068
+ this.status = FAIL;
1069
+ return;
1070
+ }
1071
+ this.result = {
1072
+ width: readUInt32BE(data, 16),
1073
+ height: readUInt32BE(data, 20),
1074
+ type: "png",
1075
+ mime: "image/png",
1076
+ wUnits: "px",
1077
+ hUnits: "px"
1078
+ };
1079
+ this.status = DONE;
1080
+ };
1081
+ PngParser.prototype.getStatus = function() {
1082
+ return this.status;
1083
+ };
1084
+ PngParser.prototype.getResult = function() {
1085
+ return this.result;
1086
+ };
1087
+ exports.Parser = PngParser;
1088
+ }));
1089
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/psd.js
1090
+ var require_psd = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1091
+ var NEED_MORE = require_utils().NEED_MORE;
1092
+ var DONE = require_utils().DONE;
1093
+ var FAIL = require_utils().FAIL;
1094
+ var str2arr = require_utils().str2arr;
1095
+ var sliceEq = require_utils().sliceEq;
1096
+ var readUInt32BE = require_read_le_be().readUInt32BE;
1097
+ var SIG_8BPS = str2arr("8BPS\0");
1098
+ function PsdParser() {
1099
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(22);
1100
+ this.buffered_bytes = 0;
1101
+ this.status = NEED_MORE;
1102
+ this.result = void 0;
1103
+ }
1104
+ PsdParser.prototype.push = function(chunk) {
1105
+ if (this.status !== NEED_MORE) return;
1106
+ var data = chunk;
1107
+ var read_size = this.partial_buffer.length;
1108
+ if (this.buffered_bytes > 0 || chunk.length < read_size) {
1109
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length);
1110
+ this.partial_buffer.set(chunk.subarray(0, bytes_to_copy), this.buffered_bytes);
1111
+ this.buffered_bytes += bytes_to_copy;
1112
+ if (this.buffered_bytes < read_size) return;
1113
+ data = this.partial_buffer;
1114
+ }
1115
+ if (!sliceEq(data, 0, SIG_8BPS)) {
1116
+ this.status = FAIL;
1117
+ return;
1118
+ }
1119
+ this.result = {
1120
+ width: readUInt32BE(data, 18),
1121
+ height: readUInt32BE(data, 14),
1122
+ type: "psd",
1123
+ mime: "image/vnd.adobe.photoshop",
1124
+ wUnits: "px",
1125
+ hUnits: "px"
1126
+ };
1127
+ this.status = DONE;
1128
+ };
1129
+ PsdParser.prototype.getStatus = function() {
1130
+ return this.status;
1131
+ };
1132
+ PsdParser.prototype.getResult = function() {
1133
+ return this.result;
1134
+ };
1135
+ exports.Parser = PsdParser;
1136
+ }));
1137
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/svg.js
1138
+ var require_svg = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1139
+ var NEED_MORE = require_utils().NEED_MORE;
1140
+ var DONE = require_utils().DONE;
1141
+ var FAIL = require_utils().FAIL;
1234
1142
  exports.MAX_DATA_LENGTH = 10240;
1235
- var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
1236
- var unquoted = "[^\"'=<>`\\x00-\\x20]+";
1237
- var attr_value = "(?:" + unquoted + "|'[^']*'|\"[^\"]*\")";
1238
- var attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)";
1239
- var PROLOG_RE = /* @__PURE__ */ new RegExp("^(?:\\s+|<[?][\\s\\S]*?[?]>|<!--(?:[^-]|-[^-]|--[^>])*-->|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|<![A-Za-z][^[>]*(?:\\[[\\s\\S]*?\\][^>]*)?>)*");
1240
- var ROOT_RE = new RegExp("^<(" + attr_name + ")(" + attribute + "*)\\s*/?>");
1241
- var ATTR_RE = new RegExp("\\s+(" + attr_name + ")(?:\\s*=\\s*(?:(" + unquoted + ")|'([^']*)'|\"([^\"]*)\"))?", "g");
1143
+ var S_TOP = 0;
1144
+ var S_BOM1 = 1;
1145
+ var S_BOM2 = 2;
1146
+ var S_TOP_LT = 3;
1147
+ var S_TOP_LT_BANG = 4;
1148
+ var S_TOP_LT_BANG_DASH = 5;
1149
+ var S_PI = 6;
1150
+ var S_PI_END = 7;
1151
+ var S_COMMENT = 8;
1152
+ var S_COMMENT_DASH = 9;
1153
+ var S_COMMENT_DASH2 = 10;
1154
+ var S_DOCTYPE = 11;
1155
+ var S_SUBSET = 12;
1156
+ var S_SUBSET_LT = 13;
1157
+ var S_SUBSET_LT_BANG = 14;
1158
+ var S_SUBSET_LT_BANG_DASH = 15;
1159
+ var S_DECL = 16;
1160
+ var S_DQUOTE = 17;
1161
+ var S_SQUOTE = 18;
1162
+ var S_TAG_NAME = 19;
1163
+ var S_TAG = 20;
1164
+ var S_TAG_SLASH = 21;
1165
+ var S_ATTR_NAME = 22;
1166
+ var S_ATTR_EQ = 23;
1167
+ var S_ATTR_VALUE = 24;
1168
+ var S_VALUE_DQUOTE = 25;
1169
+ var S_VALUE_SQUOTE = 26;
1170
+ var S_VALUE_UNQUOTED = 27;
1171
+ var S_VALUE_END = 28;
1172
+ function isSpace(c) {
1173
+ return c === 32 || c === 9 || c === 10 || c === 13;
1174
+ }
1175
+ function isLetter(c) {
1176
+ return c >= 65 && c <= 90 || c >= 97 && c <= 122;
1177
+ }
1178
+ function isNameStart(c) {
1179
+ return isLetter(c) || c === 95 || c === 58;
1180
+ }
1181
+ function isNameChar(c) {
1182
+ return isNameStart(c) || c >= 48 && c <= 57 || c === 46 || c === 45;
1183
+ }
1184
+ function isUnquoted(c) {
1185
+ return c > 32 && c !== 34 && c !== 39 && c !== 61 && c !== 60 && c !== 62 && c !== 96;
1186
+ }
1187
+ function toStr(buf, start, end) {
1188
+ var str = "";
1189
+ for (var i = start; i < end; i++) str += String.fromCharCode(buf[i]);
1190
+ return str;
1191
+ }
1192
+ function SvgHeaderParser() {
1193
+ this.buf = new Uint8Array(exports.MAX_DATA_LENGTH);
1194
+ this.len = 0;
1195
+ this.pos = 0;
1196
+ this.start = 0;
1197
+ this.state = S_TOP;
1198
+ this.state_stack = [];
1199
+ this.status = NEED_MORE;
1200
+ this.attrName = "";
1201
+ this.attrs = Object.create(null);
1202
+ }
1203
+ SvgHeaderParser.prototype.push = function(data) {
1204
+ var buf = this.buf;
1205
+ var state = this.state;
1206
+ var state_stack = this.state_stack;
1207
+ var len = this.len;
1208
+ var pos = this.pos;
1209
+ var bytes_to_copy = Math.min(data.length, buf.length - len);
1210
+ var c, name;
1211
+ for (var i = 0; i < bytes_to_copy; i++) buf[len + i] = data[i];
1212
+ len += bytes_to_copy;
1213
+ this.len = len;
1214
+ while (this.status === NEED_MORE && pos < len) {
1215
+ c = buf[pos];
1216
+ switch (state) {
1217
+ case S_TOP:
1218
+ if (c === 60) {
1219
+ state_stack.push(state);
1220
+ state = S_TOP_LT;
1221
+ } else if (c === 239 && pos === 0) {
1222
+ state_stack.push(state);
1223
+ state = S_BOM1;
1224
+ } else if (!isSpace(c)) this.status = FAIL;
1225
+ break;
1226
+ case S_BOM1:
1227
+ if (c === 187) state = S_BOM2;
1228
+ else this.status = FAIL;
1229
+ break;
1230
+ case S_BOM2:
1231
+ if (c === 191) state = state_stack.pop();
1232
+ else this.status = FAIL;
1233
+ break;
1234
+ case S_TOP_LT:
1235
+ if (c === 63) state = S_PI;
1236
+ else if (c === 33) state = S_TOP_LT_BANG;
1237
+ else if (isNameStart(c)) {
1238
+ state = S_TAG_NAME;
1239
+ this.start = pos;
1240
+ } else this.status = FAIL;
1241
+ break;
1242
+ case S_TOP_LT_BANG:
1243
+ if (c === 45) state = S_TOP_LT_BANG_DASH;
1244
+ else if (isLetter(c)) state = S_DOCTYPE;
1245
+ else this.status = FAIL;
1246
+ break;
1247
+ case S_TOP_LT_BANG_DASH:
1248
+ if (c === 45) state = S_COMMENT;
1249
+ else this.status = FAIL;
1250
+ break;
1251
+ case S_PI:
1252
+ if (c === 63) state = S_PI_END;
1253
+ break;
1254
+ case S_PI_END:
1255
+ if (c === 62) state = state_stack.pop();
1256
+ else if (c !== 63) state = S_PI;
1257
+ break;
1258
+ case S_COMMENT:
1259
+ if (c === 45) state = S_COMMENT_DASH;
1260
+ break;
1261
+ case S_COMMENT_DASH:
1262
+ state = c === 45 ? S_COMMENT_DASH2 : S_COMMENT;
1263
+ break;
1264
+ case S_COMMENT_DASH2:
1265
+ if (c === 62) state = state_stack.pop();
1266
+ else if (c !== 45) state = S_COMMENT;
1267
+ break;
1268
+ case S_DOCTYPE:
1269
+ if (c === 34) {
1270
+ state_stack.push(state);
1271
+ state = S_DQUOTE;
1272
+ } else if (c === 39) {
1273
+ state_stack.push(state);
1274
+ state = S_SQUOTE;
1275
+ } else if (c === 91) {
1276
+ state_stack.push(state);
1277
+ state = S_SUBSET;
1278
+ } else if (c === 62) state = state_stack.pop();
1279
+ break;
1280
+ case S_SUBSET:
1281
+ if (c === 93) state = state_stack.pop();
1282
+ else if (c === 60) {
1283
+ state_stack.push(state);
1284
+ state = S_SUBSET_LT;
1285
+ }
1286
+ break;
1287
+ case S_SUBSET_LT:
1288
+ if (c === 63) state = S_PI;
1289
+ else if (c === 33) state = S_SUBSET_LT_BANG;
1290
+ else this.status = FAIL;
1291
+ break;
1292
+ case S_SUBSET_LT_BANG:
1293
+ if (c === 45) state = S_SUBSET_LT_BANG_DASH;
1294
+ else if (isLetter(c)) state = S_DECL;
1295
+ else this.status = FAIL;
1296
+ break;
1297
+ case S_SUBSET_LT_BANG_DASH:
1298
+ if (c === 45) state = S_COMMENT;
1299
+ else this.status = FAIL;
1300
+ break;
1301
+ case S_DECL:
1302
+ if (c === 34) {
1303
+ state_stack.push(state);
1304
+ state = S_DQUOTE;
1305
+ } else if (c === 39) {
1306
+ state_stack.push(state);
1307
+ state = S_SQUOTE;
1308
+ } else if (c === 62) state = state_stack.pop();
1309
+ break;
1310
+ case S_DQUOTE:
1311
+ if (c === 34) state = state_stack.pop();
1312
+ break;
1313
+ case S_SQUOTE:
1314
+ if (c === 39) state = state_stack.pop();
1315
+ break;
1316
+ case S_TAG_NAME:
1317
+ if (isNameChar(c)) break;
1318
+ name = toStr(buf, this.start, pos);
1319
+ if (name !== "svg" && name.slice(-4) !== ":svg") {
1320
+ this.status = FAIL;
1321
+ break;
1322
+ }
1323
+ state = S_TAG;
1324
+ continue;
1325
+ case S_TAG:
1326
+ if (c === 62) this.status = DONE;
1327
+ else if (c === 47) state = S_TAG_SLASH;
1328
+ else if (isNameStart(c)) {
1329
+ state = S_ATTR_NAME;
1330
+ this.start = pos;
1331
+ } else if (!isSpace(c)) this.status = FAIL;
1332
+ break;
1333
+ case S_TAG_SLASH:
1334
+ this.status = c === 62 ? DONE : FAIL;
1335
+ break;
1336
+ case S_ATTR_NAME:
1337
+ if (isNameChar(c)) break;
1338
+ this.attrName = toStr(buf, this.start, pos);
1339
+ state = S_ATTR_EQ;
1340
+ continue;
1341
+ case S_ATTR_EQ:
1342
+ if (isSpace(c)) break;
1343
+ if (c === 61) {
1344
+ state = S_ATTR_VALUE;
1345
+ break;
1346
+ }
1347
+ this.attrs[this.attrName] = "";
1348
+ state = S_TAG;
1349
+ continue;
1350
+ case S_ATTR_VALUE:
1351
+ if (c === 34) {
1352
+ state = S_VALUE_DQUOTE;
1353
+ this.start = pos + 1;
1354
+ } else if (c === 39) {
1355
+ state = S_VALUE_SQUOTE;
1356
+ this.start = pos + 1;
1357
+ } else if (isUnquoted(c)) {
1358
+ state = S_VALUE_UNQUOTED;
1359
+ this.start = pos;
1360
+ } else if (!isSpace(c)) this.status = FAIL;
1361
+ break;
1362
+ case S_VALUE_DQUOTE:
1363
+ if (c !== 34) break;
1364
+ this.attrs[this.attrName] = toStr(buf, this.start, pos);
1365
+ state = S_VALUE_END;
1366
+ break;
1367
+ case S_VALUE_SQUOTE:
1368
+ if (c !== 39) break;
1369
+ this.attrs[this.attrName] = toStr(buf, this.start, pos);
1370
+ state = S_VALUE_END;
1371
+ break;
1372
+ case S_VALUE_END:
1373
+ if (isSpace(c) || c === 62 || c === 47) {
1374
+ state = S_TAG;
1375
+ continue;
1376
+ }
1377
+ this.status = FAIL;
1378
+ break;
1379
+ case S_VALUE_UNQUOTED:
1380
+ if (isUnquoted(c)) break;
1381
+ this.attrs[this.attrName] = toStr(buf, this.start, pos);
1382
+ state = S_TAG;
1383
+ continue;
1384
+ }
1385
+ pos++;
1386
+ }
1387
+ this.pos = pos;
1388
+ this.state = state;
1389
+ if (this.status === NEED_MORE && len === buf.length) this.status = FAIL;
1390
+ };
1391
+ SvgHeaderParser.prototype.getStatus = function() {
1392
+ return this.status;
1393
+ };
1242
1394
  var SVG_UNITS_RE = /in$|mm$|cm$|pt$|pc$|px$|em$|ex$/;
1243
1395
  function isFinitePositive(val) {
1244
1396
  return typeof val === "number" && isFinite(val) && val > 0;
@@ -1247,21 +1399,14 @@ var require_svg_header = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1247
1399
  var m = str.slice(-2).match(SVG_UNITS_RE);
1248
1400
  return m === null ? "px" : m[0];
1249
1401
  }
1250
- exports.parse = function(str) {
1251
- var prolog = str.match(PROLOG_RE)[0];
1252
- var root = ROOT_RE.exec(prolog.length ? str.slice(prolog.length) : str);
1253
- if (!root) return;
1254
- var tag = root[1];
1255
- if (tag !== "svg" && tag.slice(-4) !== ":svg") return;
1256
- var attrs = {};
1257
- var m;
1258
- ATTR_RE.lastIndex = 0;
1259
- while ((m = ATTR_RE.exec(root[2])) !== null) attrs[m[1]] = m[2] !== void 0 ? m[2] : m[3] !== void 0 ? m[3] : m[4];
1260
- var wAttr = attrs.width;
1261
- var hAttr = attrs.height;
1262
- var vbAttr = attrs.viewBox || attrs.viewbox;
1263
- if (wAttr && wAttr.indexOf("%") !== -1) wAttr = void 0;
1264
- if (hAttr && hAttr.indexOf("%") !== -1) hAttr = void 0;
1402
+ SvgHeaderParser.prototype.getResult = function() {
1403
+ if (this.status !== DONE) return;
1404
+ var attrs = this.attrs;
1405
+ var wAttr = attrs.width || "";
1406
+ var hAttr = attrs.height || "";
1407
+ var vbAttr = attrs.viewBox || attrs.viewbox || "";
1408
+ if (wAttr.indexOf("%") !== -1) wAttr = "";
1409
+ if (hAttr.indexOf("%") !== -1) hAttr = "";
1265
1410
  var width = parseFloat(wAttr);
1266
1411
  var height = parseFloat(hAttr);
1267
1412
  if (wAttr && hAttr) {
@@ -1275,7 +1420,7 @@ var require_svg_header = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1275
1420
  hUnits: units(hAttr)
1276
1421
  };
1277
1422
  }
1278
- var parts = (vbAttr || "").trim().split(/[\s,]+/);
1423
+ var parts = vbAttr.trim().split(/[\s,]+/);
1279
1424
  var vbWidth = parseFloat(parts[2]);
1280
1425
  var vbHeight = parseFloat(parts[3]);
1281
1426
  if (!isFinitePositive(vbWidth) || !isFinitePositive(vbHeight)) return;
@@ -1312,299 +1457,130 @@ var require_svg_header = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1312
1457
  hUnits: units(parts[3])
1313
1458
  };
1314
1459
  };
1460
+ exports.Parser = SvgHeaderParser;
1315
1461
  }));
1316
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/avif.js
1317
- var require_avif = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1318
- var str2arr = require_common().str2arr;
1319
- var sliceEq = require_common().sliceEq;
1320
- var readUInt32BE = require_common().readUInt32BE;
1321
- var miaf = require_miaf_utils();
1322
- var exif = require_exif_utils();
1323
- var SIG_FTYP = str2arr("ftyp");
1324
- module.exports = function(data) {
1325
- if (!sliceEq(data, 4, SIG_FTYP)) return;
1326
- var firstBox = miaf.unbox(data, 0);
1327
- if (!firstBox) return;
1328
- var fileType = miaf.getMimeType(firstBox.data);
1329
- if (!fileType) return;
1330
- var meta;
1331
- var offset = firstBox.end;
1332
- for (;;) {
1333
- var box = miaf.unbox(data, offset);
1334
- if (!box) break;
1335
- offset = box.end;
1336
- if (box.boxtype === "mdat") return;
1337
- if (box.boxtype === "meta") {
1338
- meta = box.data;
1339
- break;
1462
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/tiff.js
1463
+ var require_tiff = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1464
+ var NEED_MORE = require_utils().NEED_MORE;
1465
+ var DONE = require_utils().DONE;
1466
+ var FAIL = require_utils().FAIL;
1467
+ var str2arr = require_utils().str2arr;
1468
+ var sliceEq = require_utils().sliceEq;
1469
+ var readLeBe = require_read_le_be();
1470
+ var SIG_LE = str2arr("II*\0");
1471
+ var SIG_BE = str2arr("MM\0*");
1472
+ var S_HEADER = 0;
1473
+ var S_IFD_ENTRY_COUNT = 1;
1474
+ var S_IFD_ENTRY = 2;
1475
+ function readUInt16(data, offset, big_endian) {
1476
+ return big_endian ? readLeBe.readUInt16BE(data, offset) : readLeBe.readUInt16LE(data, offset);
1477
+ }
1478
+ function readUInt32(data, offset, big_endian) {
1479
+ return big_endian ? readLeBe.readUInt32BE(data, offset) : readLeBe.readUInt32LE(data, offset);
1480
+ }
1481
+ function readIFDValue(data, offset, big_endian) {
1482
+ var type = readUInt16(data, offset + 2, big_endian);
1483
+ if (readUInt32(data, offset + 4, big_endian) !== 1 || type !== 3 && type !== 4) return null;
1484
+ return type === 3 ? readUInt16(data, offset + 8, big_endian) : readUInt32(data, offset + 8, big_endian);
1485
+ }
1486
+ function TiffParser() {
1487
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(12);
1488
+ this.buffered_bytes = 0;
1489
+ this.bytes_to_skip = 0;
1490
+ this.entries_left = 0;
1491
+ this.big_endian = false;
1492
+ this.width = 0;
1493
+ this.height = 0;
1494
+ this.state = S_HEADER;
1495
+ this.status = NEED_MORE;
1496
+ this.result = void 0;
1497
+ }
1498
+ TiffParser.prototype.push = function(chunk) {
1499
+ var chunk_offset = 0;
1500
+ while (this.status === NEED_MORE && chunk_offset < chunk.length) {
1501
+ if (this.bytes_to_skip > 0) {
1502
+ var bytes_skipped = Math.min(this.bytes_to_skip, chunk.length - chunk_offset);
1503
+ this.bytes_to_skip -= bytes_skipped;
1504
+ chunk_offset += bytes_skipped;
1505
+ continue;
1340
1506
  }
1341
- }
1342
- if (!meta) return;
1343
- var imgSize = miaf.readSizeFromMeta(meta);
1344
- if (!imgSize) return;
1345
- var result = {
1346
- width: imgSize.width,
1347
- height: imgSize.height,
1348
- type: fileType.type,
1349
- mime: fileType.mime,
1350
- wUnits: "px",
1351
- hUnits: "px"
1352
- };
1353
- if (imgSize.variants.length > 1) result.variants = imgSize.variants;
1354
- if (imgSize.orientation) result.orientation = imgSize.orientation;
1355
- if (imgSize.exif_location && imgSize.exif_location.offset + imgSize.exif_location.length <= data.length) {
1356
- var sig_offset = readUInt32BE(data, imgSize.exif_location.offset);
1357
- var exif_data = data.slice(imgSize.exif_location.offset + sig_offset + 4, imgSize.exif_location.offset + imgSize.exif_location.length);
1358
- var orientation = exif.get_orientation(exif_data);
1359
- if (orientation > 0) result.orientation = orientation;
1360
- }
1361
- return result;
1362
- };
1363
- }));
1364
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/bmp.js
1365
- var require_bmp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1366
- var str2arr = require_common().str2arr;
1367
- var sliceEq = require_common().sliceEq;
1368
- var readInt16LE = require_common().readInt16LE;
1369
- var readInt32LE = require_common().readInt32LE;
1370
- var readUInt32LE = require_common().readUInt32LE;
1371
- var SIG_BM = str2arr("BM");
1372
- module.exports = function(data) {
1373
- if (data.length < 26) return;
1374
- if (!sliceEq(data, 0, SIG_BM)) return;
1375
- var h;
1376
- var w;
1377
- var headerSize = readUInt32LE(data, 14);
1378
- if (headerSize === 12) {
1379
- w = readInt16LE(data, 18);
1380
- h = readInt16LE(data, 20);
1381
- } else if (headerSize > 12) {
1382
- w = readInt32LE(data, 18);
1383
- h = readInt32LE(data, 22);
1384
- } else return;
1385
- return {
1386
- width: w,
1387
- height: Math.abs(h),
1388
- type: "bmp",
1389
- mime: "image/bmp",
1390
- wUnits: "px",
1391
- hUnits: "px"
1392
- };
1393
- };
1394
- }));
1395
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/gif.js
1396
- var require_gif = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1397
- var str2arr = require_common().str2arr;
1398
- var sliceEq = require_common().sliceEq;
1399
- var readUInt16LE = require_common().readUInt16LE;
1400
- var SIG_GIF87a = str2arr("GIF87a");
1401
- var SIG_GIF89a = str2arr("GIF89a");
1402
- module.exports = function(data) {
1403
- if (data.length < 10) return;
1404
- if (!sliceEq(data, 0, SIG_GIF87a) && !sliceEq(data, 0, SIG_GIF89a)) return;
1405
- return {
1406
- width: readUInt16LE(data, 6),
1407
- height: readUInt16LE(data, 8),
1408
- type: "gif",
1409
- mime: "image/gif",
1410
- wUnits: "px",
1411
- hUnits: "px"
1412
- };
1413
- };
1414
- }));
1415
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/ico.js
1416
- var require_ico = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1417
- var readUInt16LE = require_common().readUInt16LE;
1418
- var HEADER = 0;
1419
- var TYPE_ICO = 1;
1420
- var INDEX_SIZE = 16;
1421
- module.exports = function(data) {
1422
- var header = readUInt16LE(data, 0);
1423
- var type = readUInt16LE(data, 2);
1424
- var numImages = readUInt16LE(data, 4);
1425
- if (header !== HEADER || type !== TYPE_ICO || !numImages) return;
1426
- if (data.length < 6 + numImages * INDEX_SIZE) return;
1427
- var variants = [];
1428
- var maxSize = {
1429
- width: 0,
1430
- height: 0
1431
- };
1432
- for (var i = 0; i < numImages; i++) {
1433
- var width = data[6 + INDEX_SIZE * i] || 256;
1434
- var height = data[6 + INDEX_SIZE * i + 1] || 256;
1435
- var size = {
1436
- width,
1437
- height
1438
- };
1439
- variants.push(size);
1440
- if (width > maxSize.width || height > maxSize.height) maxSize = size;
1441
- }
1442
- return {
1443
- width: maxSize.width,
1444
- height: maxSize.height,
1445
- variants,
1446
- type: "ico",
1447
- mime: "image/x-icon",
1448
- wUnits: "px",
1449
- hUnits: "px"
1450
- };
1451
- };
1452
- }));
1453
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/jpeg.js
1454
- var require_jpeg = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1455
- var readUInt16BE = require_common().readUInt16BE;
1456
- var str2arr = require_common().str2arr;
1457
- var sliceEq = require_common().sliceEq;
1458
- var exif = require_exif_utils();
1459
- var SIG_EXIF = str2arr("Exif\0\0");
1460
- module.exports = function(data) {
1461
- if (data.length < 2) return;
1462
- if (data[0] !== 255 || data[1] !== 216 || data[2] !== 255) return;
1463
- var offset = 2;
1464
- for (;;) {
1465
- for (;;) {
1466
- if (data.length - offset < 2) return;
1467
- if (data[offset++] === 255) break;
1468
- }
1469
- var code = data[offset++];
1470
- var length;
1471
- while (code === 255) code = data[offset++];
1472
- if (code >= 208 && code <= 217 || code === 1) length = 0;
1473
- else if (code >= 192 && code <= 254) {
1474
- if (data.length - offset < 2) return;
1475
- length = readUInt16BE(data, offset) - 2;
1476
- offset += 2;
1477
- } else return;
1478
- if (code === 217 || code === 218) return;
1479
- var orientation;
1480
- if (code === 225 && length >= 10 && sliceEq(data, offset, SIG_EXIF)) orientation = exif.get_orientation(data.slice(offset + 6, offset + length));
1481
- if (length >= 5 && code >= 192 && code <= 207 && code !== 196 && code !== 200 && code !== 204) {
1482
- if (data.length - offset < length) return;
1483
- var result = {
1484
- width: readUInt16BE(data, offset + 3),
1485
- height: readUInt16BE(data, offset + 1),
1486
- type: "jpg",
1487
- mime: "image/jpeg",
1488
- wUnits: "px",
1489
- hUnits: "px"
1490
- };
1491
- if (orientation > 0) result.orientation = orientation;
1492
- return result;
1507
+ var read_size = this.state === S_HEADER ? 8 : this.state === S_IFD_ENTRY_COUNT ? 2 : 12;
1508
+ var read_buffer = chunk;
1509
+ var read_offset = chunk_offset;
1510
+ if (this.buffered_bytes > 0 || chunk.length - chunk_offset < read_size) {
1511
+ var bytes_to_copy = Math.min(read_size - this.buffered_bytes, chunk.length - chunk_offset);
1512
+ this.partial_buffer.set(chunk.subarray(chunk_offset, chunk_offset + bytes_to_copy), this.buffered_bytes);
1513
+ this.buffered_bytes += bytes_to_copy;
1514
+ chunk_offset += bytes_to_copy;
1515
+ if (this.buffered_bytes < read_size) return;
1516
+ read_buffer = this.partial_buffer;
1517
+ read_offset = 0;
1518
+ this.buffered_bytes = 0;
1519
+ } else chunk_offset += read_size;
1520
+ switch (this.state) {
1521
+ case S_HEADER:
1522
+ if (!sliceEq(read_buffer, read_offset, SIG_LE) && !sliceEq(read_buffer, read_offset, SIG_BE)) {
1523
+ this.status = FAIL;
1524
+ return;
1525
+ }
1526
+ this.big_endian = read_buffer[read_offset] === 77;
1527
+ var ifd_offset = readUInt32(read_buffer, read_offset + 4, this.big_endian);
1528
+ if (ifd_offset < 8) {
1529
+ this.status = FAIL;
1530
+ return;
1531
+ }
1532
+ this.bytes_to_skip = ifd_offset - 8;
1533
+ this.state = S_IFD_ENTRY_COUNT;
1534
+ break;
1535
+ case S_IFD_ENTRY_COUNT:
1536
+ this.entries_left = readUInt16(read_buffer, read_offset, this.big_endian);
1537
+ if (this.entries_left === 0) {
1538
+ this.status = FAIL;
1539
+ return;
1540
+ }
1541
+ this.state = S_IFD_ENTRY;
1542
+ break;
1543
+ case S_IFD_ENTRY:
1544
+ var tag = readUInt16(read_buffer, read_offset, this.big_endian);
1545
+ if (tag === 256) this.width = readIFDValue(read_buffer, read_offset, this.big_endian);
1546
+ else if (tag === 257) this.height = readIFDValue(read_buffer, read_offset, this.big_endian);
1547
+ this.entries_left--;
1548
+ if (this.entries_left === 0) {
1549
+ if (!this.width || !this.height) {
1550
+ this.status = FAIL;
1551
+ return;
1552
+ }
1553
+ this.result = {
1554
+ width: this.width,
1555
+ height: this.height,
1556
+ type: "tiff",
1557
+ mime: "image/tiff",
1558
+ wUnits: "px",
1559
+ hUnits: "px"
1560
+ };
1561
+ this.status = DONE;
1562
+ }
1493
1563
  }
1494
- offset += length;
1495
1564
  }
1496
1565
  };
1497
- }));
1498
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/png.js
1499
- var require_png = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1500
- var str2arr = require_common().str2arr;
1501
- var sliceEq = require_common().sliceEq;
1502
- var readUInt32BE = require_common().readUInt32BE;
1503
- var SIG_PNG = str2arr("‰PNG\r\n\n");
1504
- var SIG_IHDR = str2arr("IHDR");
1505
- module.exports = function(data) {
1506
- if (data.length < 24) return;
1507
- if (!sliceEq(data, 0, SIG_PNG)) return;
1508
- if (!sliceEq(data, 12, SIG_IHDR)) return;
1509
- return {
1510
- width: readUInt32BE(data, 16),
1511
- height: readUInt32BE(data, 20),
1512
- type: "png",
1513
- mime: "image/png",
1514
- wUnits: "px",
1515
- hUnits: "px"
1516
- };
1517
- };
1518
- }));
1519
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/psd.js
1520
- var require_psd = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1521
- var str2arr = require_common().str2arr;
1522
- var sliceEq = require_common().sliceEq;
1523
- var readUInt32BE = require_common().readUInt32BE;
1524
- var SIG_8BPS = str2arr("8BPS\0");
1525
- module.exports = function(data) {
1526
- if (data.length < 22) return;
1527
- if (!sliceEq(data, 0, SIG_8BPS)) return;
1528
- return {
1529
- width: readUInt32BE(data, 18),
1530
- height: readUInt32BE(data, 14),
1531
- type: "psd",
1532
- mime: "image/vnd.adobe.photoshop",
1533
- wUnits: "px",
1534
- hUnits: "px"
1535
- };
1566
+ TiffParser.prototype.getStatus = function() {
1567
+ return this.status;
1536
1568
  };
1537
- }));
1538
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/svg.js
1539
- var require_svg = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1540
- var parseSvgHeader = require_svg_header().parse;
1541
- var MAX_DATA_LENGTH = require_svg_header().MAX_DATA_LENGTH;
1542
- module.exports = function(data) {
1543
- var start = 0;
1544
- if (data[0] === 239 && data[1] === 187 && data[2] === 191) start = 3;
1545
- var str = "";
1546
- var max = Math.min(data.length, start + MAX_DATA_LENGTH);
1547
- for (var i = start; i < max; i++) str += String.fromCharCode(data[i]);
1548
- return parseSvgHeader(str);
1569
+ TiffParser.prototype.getResult = function() {
1570
+ return this.result;
1549
1571
  };
1572
+ exports.Parser = TiffParser;
1550
1573
  }));
1551
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/tiff.js
1552
- var require_tiff = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1553
- var str2arr = require_common().str2arr;
1554
- var sliceEq = require_common().sliceEq;
1555
- var readUInt16LE = require_common().readUInt16LE;
1556
- var readUInt16BE = require_common().readUInt16BE;
1557
- var readUInt32LE = require_common().readUInt32LE;
1558
- var readUInt32BE = require_common().readUInt32BE;
1559
- var SIG_1 = str2arr("II*\0");
1560
- var SIG_2 = str2arr("MM\0*");
1561
- function readUInt16(buffer, offset, is_big_endian) {
1562
- return is_big_endian ? readUInt16BE(buffer, offset) : readUInt16LE(buffer, offset);
1563
- }
1564
- function readUInt32(buffer, offset, is_big_endian) {
1565
- return is_big_endian ? readUInt32BE(buffer, offset) : readUInt32LE(buffer, offset);
1566
- }
1567
- function readIFDValue(data, data_offset, is_big_endian) {
1568
- var type = readUInt16(data, data_offset + 2, is_big_endian);
1569
- if (readUInt32(data, data_offset + 4, is_big_endian) !== 1 || type !== 3 && type !== 4) return null;
1570
- if (type === 3) return readUInt16(data, data_offset + 8, is_big_endian);
1571
- return readUInt32(data, data_offset + 8, is_big_endian);
1572
- }
1573
- module.exports = function(data) {
1574
- if (data.length < 8) return;
1575
- if (!sliceEq(data, 0, SIG_1) && !sliceEq(data, 0, SIG_2)) return;
1576
- var is_big_endian = data[0] === 77;
1577
- var count = readUInt32(data, 4, is_big_endian) - 8;
1578
- if (count < 0) return;
1579
- var offset = count + 8;
1580
- if (data.length - offset < 2) return;
1581
- var ifd_size = readUInt16(data, offset + 0, is_big_endian) * 12;
1582
- if (ifd_size <= 0) return;
1583
- offset += 2;
1584
- if (data.length - offset < ifd_size) return;
1585
- var i = 0, width, height, tag;
1586
- for (; i < ifd_size; i += 12) {
1587
- tag = readUInt16(data, offset + i, is_big_endian);
1588
- if (tag === 256) width = readIFDValue(data, offset + i, is_big_endian);
1589
- else if (tag === 257) height = readIFDValue(data, offset + i, is_big_endian);
1590
- }
1591
- if (width && height) return {
1592
- width,
1593
- height,
1594
- type: "tiff",
1595
- mime: "image/tiff",
1596
- wUnits: "px",
1597
- hUnits: "px"
1598
- };
1599
- };
1600
- }));
1601
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parse_sync/webp.js
1602
- var require_webp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1603
- var str2arr = require_common().str2arr;
1604
- var sliceEq = require_common().sliceEq;
1605
- var readUInt16LE = require_common().readUInt16LE;
1606
- var readUInt32LE = require_common().readUInt32LE;
1607
- var exif = require_exif_utils();
1574
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/formats/webp.js
1575
+ var require_webp = /* @__PURE__ */ __commonJSMin$1(((exports) => {
1576
+ var NEED_MORE = require_utils().NEED_MORE;
1577
+ var DONE = require_utils().DONE;
1578
+ var FAIL = require_utils().FAIL;
1579
+ var str2arr = require_utils().str2arr;
1580
+ var sliceEq = require_utils().sliceEq;
1581
+ var readUInt16LE = require_read_le_be().readUInt16LE;
1582
+ var readUInt32LE = require_read_le_be().readUInt32LE;
1583
+ var exifOrientation = require_exif_orientation_parser();
1608
1584
  var SIG_RIFF = str2arr("RIFF");
1609
1585
  var SIG_WEBP = str2arr("WEBP");
1610
1586
  function parseVP8(data, offset) {
@@ -1640,51 +1616,147 @@ var require_webp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1640
1616
  hUnits: "px"
1641
1617
  };
1642
1618
  }
1643
- module.exports = function(data) {
1644
- if (data.length < 16) return;
1645
- if (!sliceEq(data, 0, SIG_RIFF) || !sliceEq(data, 8, SIG_WEBP)) return;
1646
- var offset = 12;
1647
- var result = null;
1648
- var exif_orientation = 0;
1649
- var fileLength = readUInt32LE(data, 4) + 8;
1650
- if (fileLength > data.length) return;
1651
- while (offset + 8 < fileLength) {
1652
- if (data[offset] === 0) {
1653
- offset++;
1619
+ var S_RIFF_HEADER = 0;
1620
+ var S_CHUNK_HEADER = 1;
1621
+ var S_VP8 = 2;
1622
+ var S_VP8L = 3;
1623
+ var S_VP8X = 4;
1624
+ var S_EXIF_DATA = 5;
1625
+ function WebpParser() {
1626
+ this.partial_buffer = /* @__PURE__ */ new Uint8Array(12);
1627
+ this.buffered_bytes = 0;
1628
+ this.bytes_to_skip = 0;
1629
+ this.chunk_bytes_left = 0;
1630
+ this.position = 0;
1631
+ this.file_end = 0;
1632
+ this.orientation_parser = null;
1633
+ this.state = S_RIFF_HEADER;
1634
+ this.read_size = 12;
1635
+ this.status = NEED_MORE;
1636
+ this.result = void 0;
1637
+ }
1638
+ WebpParser.prototype.push = function(chunk) {
1639
+ var chunk_offset = 0;
1640
+ while (this.status === NEED_MORE) {
1641
+ if (this.bytes_to_skip > 0) {
1642
+ if (chunk_offset === chunk.length) return;
1643
+ var bytes_skipped = Math.min(this.bytes_to_skip, chunk.length - chunk_offset);
1644
+ this.bytes_to_skip -= bytes_skipped;
1645
+ this.position += bytes_skipped;
1646
+ chunk_offset += bytes_skipped;
1654
1647
  continue;
1655
1648
  }
1656
- var header = String.fromCharCode.apply(null, data.slice(offset, offset + 4));
1657
- var length = readUInt32LE(data, offset + 4);
1658
- if (header === "VP8 " && length >= 10) result = result || parseVP8(data, offset + 8);
1659
- else if (header === "VP8L" && length >= 5) result = result || parseVP8L(data, offset + 8);
1660
- else if (header === "VP8X" && length >= 10) result = result || parseVP8X(data, offset + 8);
1661
- else if (header === "EXIF") {
1662
- exif_orientation = exif.get_orientation(data.slice(offset + 8, offset + 8 + length));
1663
- offset = Infinity;
1649
+ if (this.state === S_CHUNK_HEADER && this.buffered_bytes === 0) {
1650
+ while (chunk_offset < chunk.length && chunk[chunk_offset] === 0 && this.position + 8 < this.file_end) {
1651
+ chunk_offset++;
1652
+ this.position++;
1653
+ }
1654
+ if (this.position + 8 >= this.file_end) {
1655
+ this.status = this.result ? DONE : FAIL;
1656
+ return;
1657
+ }
1658
+ }
1659
+ if (chunk_offset === chunk.length) return;
1660
+ if (this.state === S_EXIF_DATA) {
1661
+ var bytes_to_read = Math.min(this.chunk_bytes_left, chunk.length - chunk_offset);
1662
+ this.orientation_parser.push(chunk.subarray(chunk_offset, chunk_offset + bytes_to_read));
1663
+ this.chunk_bytes_left -= bytes_to_read;
1664
+ this.position += bytes_to_read;
1665
+ chunk_offset += bytes_to_read;
1666
+ if (this.orientation_parser.getStatus() === NEED_MORE && this.chunk_bytes_left > 0) continue;
1667
+ if (this.result && this.orientation_parser.orientation > 0) this.result.orientation = this.orientation_parser.orientation;
1668
+ this.orientation_parser = null;
1669
+ this.status = this.result ? DONE : FAIL;
1670
+ return;
1671
+ }
1672
+ var read_buffer = chunk;
1673
+ var read_offset = chunk_offset;
1674
+ if (this.buffered_bytes > 0 || chunk.length - chunk_offset < this.read_size) {
1675
+ var bytes_to_copy = Math.min(this.read_size - this.buffered_bytes, chunk.length - chunk_offset);
1676
+ this.partial_buffer.set(chunk.subarray(chunk_offset, chunk_offset + bytes_to_copy), this.buffered_bytes);
1677
+ this.buffered_bytes += bytes_to_copy;
1678
+ this.position += bytes_to_copy;
1679
+ chunk_offset += bytes_to_copy;
1680
+ if (this.buffered_bytes < this.read_size) return;
1681
+ read_buffer = this.partial_buffer;
1682
+ read_offset = 0;
1683
+ this.buffered_bytes = 0;
1684
+ } else {
1685
+ chunk_offset += this.read_size;
1686
+ this.position += this.read_size;
1687
+ }
1688
+ switch (this.state) {
1689
+ case S_RIFF_HEADER:
1690
+ if (!sliceEq(read_buffer, read_offset, SIG_RIFF) || !sliceEq(read_buffer, read_offset + 8, SIG_WEBP)) {
1691
+ this.status = FAIL;
1692
+ return;
1693
+ }
1694
+ this.file_end = readUInt32LE(read_buffer, read_offset + 4) + 8;
1695
+ this.state = S_CHUNK_HEADER;
1696
+ this.read_size = 8;
1697
+ continue;
1698
+ case S_CHUNK_HEADER:
1699
+ var type = String.fromCharCode(read_buffer[read_offset], read_buffer[read_offset + 1], read_buffer[read_offset + 2], read_buffer[read_offset + 3]);
1700
+ this.chunk_bytes_left = readUInt32LE(read_buffer, read_offset + 4);
1701
+ if (type === "VP8 " && this.chunk_bytes_left >= 10) {
1702
+ this.state = S_VP8;
1703
+ this.read_size = 10;
1704
+ } else if (type === "VP8L" && this.chunk_bytes_left >= 5) {
1705
+ this.state = S_VP8L;
1706
+ this.read_size = 5;
1707
+ } else if (type === "VP8X" && this.chunk_bytes_left >= 10) {
1708
+ this.state = S_VP8X;
1709
+ this.read_size = 10;
1710
+ } else if (type === "EXIF" && this.chunk_bytes_left >= 4) {
1711
+ this.orientation_parser = new exifOrientation.Parser();
1712
+ this.state = S_EXIF_DATA;
1713
+ } else this.bytes_to_skip = this.chunk_bytes_left;
1714
+ continue;
1715
+ case S_VP8:
1716
+ this.result = this.result || parseVP8(read_buffer, read_offset);
1717
+ break;
1718
+ case S_VP8L:
1719
+ this.result = this.result || parseVP8L(read_buffer, read_offset);
1720
+ break;
1721
+ case S_VP8X: this.result = this.result || parseVP8X(read_buffer, read_offset);
1664
1722
  }
1665
- offset += 8 + length;
1723
+ this.bytes_to_skip = this.chunk_bytes_left - this.read_size;
1724
+ this.state = S_CHUNK_HEADER;
1725
+ this.read_size = 8;
1666
1726
  }
1667
- if (!result) return;
1668
- if (exif_orientation > 0) result.orientation = exif_orientation;
1669
- return result;
1670
1727
  };
1728
+ WebpParser.prototype.getStatus = function() {
1729
+ return this.status;
1730
+ };
1731
+ WebpParser.prototype.getResult = function() {
1732
+ if (this.status === DONE) return this.result;
1733
+ };
1734
+ exports.Parser = WebpParser;
1671
1735
  }));
1672
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/lib/parsers_sync.js
1736
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/lib/parsers_sync.js
1673
1737
  var require_parsers_sync = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1738
+ function wrapParser(Parser) {
1739
+ return function(data) {
1740
+ var parser = new Parser();
1741
+ if (Array.isArray(data)) data = new Uint8Array(data);
1742
+ parser.push(data);
1743
+ return parser.getResult();
1744
+ };
1745
+ }
1674
1746
  module.exports = {
1675
- avif: require_avif(),
1676
- bmp: require_bmp(),
1677
- gif: require_gif(),
1678
- ico: require_ico(),
1679
- jpeg: require_jpeg(),
1680
- png: require_png(),
1681
- psd: require_psd(),
1682
- svg: require_svg(),
1683
- tiff: require_tiff(),
1684
- webp: require_webp()
1747
+ avif: wrapParser(require_avif().Parser),
1748
+ bmp: wrapParser(require_bmp().Parser),
1749
+ gif: wrapParser(require_gif().Parser),
1750
+ ico: wrapParser(require_ico().Parser),
1751
+ jpeg: wrapParser(require_jpeg().Parser),
1752
+ png: wrapParser(require_png().Parser),
1753
+ psd: wrapParser(require_psd().Parser),
1754
+ svg: wrapParser(require_svg().Parser),
1755
+ tiff: wrapParser(require_tiff().Parser),
1756
+ webp: wrapParser(require_webp().Parser)
1685
1757
  };
1686
1758
  }));
1687
- // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.4.0/f69b9b4fcba47e3caec204c2c2fb06128584c44c9c217acf2bb0f3ce5286d00b/node_modules/probe-image-size/sync.js
1759
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/probe-image-size/7.5.0/48b233d456459b962cf37bbd06a4253dee16b693cf4ae8fcea86928b192810e1/node_modules/probe-image-size/sync.js
1688
1760
  var require_sync = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1689
1761
  var parsers = require_parsers_sync();
1690
1762
  function probeBuffer(buffer) {
@@ -8582,7 +8654,7 @@ function splitLines(text) {
8582
8654
  else result.push(result.pop().slice(0, -1));
8583
8655
  return result;
8584
8656
  }
8585
- // ../memory/dist/src-CLQXrKvR.js
8657
+ // ../memory/dist/src-tZXqilfm.js
8586
8658
  var __defProp$3 = Object.defineProperty;
8587
8659
  var __exportAll = (all, no_symbols) => {
8588
8660
  let target = {};
@@ -10717,7 +10789,7 @@ function logProxy$2(funcName, namespace, args) {
10717
10789
  * of the levels are defined to match the original values from the initial LogLevel to avoid
10718
10790
  * compatibility/migration issues for any implementation that assume the numeric ordering.
10719
10791
  */
10720
- var DiagLogLevel$2;
10792
+ var DiagLogLevel$1;
10721
10793
  (function(DiagLogLevel) {
10722
10794
  /** Diagnostic Logging level setting to disable all logging (except and forced logs) */
10723
10795
  DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
@@ -10736,10 +10808,10 @@ var DiagLogLevel$2;
10736
10808
  DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
10737
10809
  /** Used to set the logging level to include all logging */
10738
10810
  DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
10739
- })(DiagLogLevel$2 || (DiagLogLevel$2 = {}));
10811
+ })(DiagLogLevel$1 || (DiagLogLevel$1 = {}));
10740
10812
  function createLogLevelDiagLogger$2(maxLevel, logger) {
10741
- if (maxLevel < DiagLogLevel$2.NONE) maxLevel = DiagLogLevel$2.NONE;
10742
- else if (maxLevel > DiagLogLevel$2.ALL) maxLevel = DiagLogLevel$2.ALL;
10813
+ if (maxLevel < DiagLogLevel$1.NONE) maxLevel = DiagLogLevel$1.NONE;
10814
+ else if (maxLevel > DiagLogLevel$1.ALL) maxLevel = DiagLogLevel$1.ALL;
10743
10815
  logger = logger || {};
10744
10816
  function _filterFunc(funcName, theLevel) {
10745
10817
  var theFunc = logger[funcName];
@@ -10747,11 +10819,11 @@ function createLogLevelDiagLogger$2(maxLevel, logger) {
10747
10819
  return function() {};
10748
10820
  }
10749
10821
  return {
10750
- error: _filterFunc("error", DiagLogLevel$2.ERROR),
10751
- warn: _filterFunc("warn", DiagLogLevel$2.WARN),
10752
- info: _filterFunc("info", DiagLogLevel$2.INFO),
10753
- debug: _filterFunc("debug", DiagLogLevel$2.DEBUG),
10754
- verbose: _filterFunc("verbose", DiagLogLevel$2.VERBOSE)
10822
+ error: _filterFunc("error", DiagLogLevel$1.ERROR),
10823
+ warn: _filterFunc("warn", DiagLogLevel$1.WARN),
10824
+ info: _filterFunc("info", DiagLogLevel$1.INFO),
10825
+ debug: _filterFunc("debug", DiagLogLevel$1.DEBUG),
10826
+ verbose: _filterFunc("verbose", DiagLogLevel$1.VERBOSE)
10755
10827
  };
10756
10828
  }
10757
10829
  var __read$2$1 = function(o, n) {
@@ -10803,7 +10875,7 @@ var DiagAPI$2 = function() {
10803
10875
  var self = this;
10804
10876
  var setLogger = function(logger, optionsOrLogLevel) {
10805
10877
  var _a, _b, _c;
10806
- if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel$2.INFO };
10878
+ if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel$1.INFO };
10807
10879
  if (logger === self) {
10808
10880
  var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
10809
10881
  self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
@@ -10811,7 +10883,7 @@ var DiagAPI$2 = function() {
10811
10883
  }
10812
10884
  if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
10813
10885
  var oldLogger = getGlobal$2("diag");
10814
- var newLogger = createLogLevelDiagLogger$2((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$2.INFO, logger);
10886
+ var newLogger = createLogLevelDiagLogger$2((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$1.INFO, logger);
10815
10887
  if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
10816
10888
  var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
10817
10889
  oldLogger.warn("Current logger will be overwritten from " + stack);
@@ -11006,17 +11078,17 @@ var ContextAPI$2 = function() {
11006
11078
  };
11007
11079
  return ContextAPI;
11008
11080
  }();
11009
- var TraceFlags$2;
11081
+ var TraceFlags$1;
11010
11082
  (function(TraceFlags) {
11011
11083
  /** Represents no flag set. */
11012
11084
  TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
11013
11085
  /** Bit to represent whether trace is sampled in trace flags. */
11014
11086
  TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
11015
- })(TraceFlags$2 || (TraceFlags$2 = {}));
11087
+ })(TraceFlags$1 || (TraceFlags$1 = {}));
11016
11088
  var INVALID_SPAN_CONTEXT$2 = {
11017
11089
  traceId: "00000000000000000000000000000000",
11018
11090
  spanId: "0000000000000000",
11019
- traceFlags: TraceFlags$2.NONE
11091
+ traceFlags: TraceFlags$1.NONE
11020
11092
  };
11021
11093
  /**
11022
11094
  * The NonRecordingSpan is the default {@link Span} that is used when no Span
@@ -15207,7 +15279,7 @@ async function getVercelRequestId$2() {
15207
15279
  var _a10;
15208
15280
  return (_a10 = getContext$2().headers) == null ? void 0 : _a10["x-vercel-id"];
15209
15281
  }
15210
- var VERSION$7 = "2.0.172";
15282
+ var VERSION$7 = "2.0.173";
15211
15283
  var AI_GATEWAY_PROTOCOL_VERSION$2 = "0.0.1";
15212
15284
  function createGatewayProvider$1(options = {}) {
15213
15285
  var _a10, _b10;
@@ -15551,7 +15623,7 @@ function logProxy$1(funcName, namespace, args) {
15551
15623
  * of the levels are defined to match the original values from the initial LogLevel to avoid
15552
15624
  * compatibility/migration issues for any implementation that assume the numeric ordering.
15553
15625
  */
15554
- var DiagLogLevel$1;
15626
+ var DiagLogLevel$2;
15555
15627
  (function(DiagLogLevel) {
15556
15628
  /** Diagnostic Logging level setting to disable all logging (except and forced logs) */
15557
15629
  DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
@@ -15570,10 +15642,10 @@ var DiagLogLevel$1;
15570
15642
  DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
15571
15643
  /** Used to set the logging level to include all logging */
15572
15644
  DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
15573
- })(DiagLogLevel$1 || (DiagLogLevel$1 = {}));
15645
+ })(DiagLogLevel$2 || (DiagLogLevel$2 = {}));
15574
15646
  function createLogLevelDiagLogger$1(maxLevel, logger) {
15575
- if (maxLevel < DiagLogLevel$1.NONE) maxLevel = DiagLogLevel$1.NONE;
15576
- else if (maxLevel > DiagLogLevel$1.ALL) maxLevel = DiagLogLevel$1.ALL;
15647
+ if (maxLevel < DiagLogLevel$2.NONE) maxLevel = DiagLogLevel$2.NONE;
15648
+ else if (maxLevel > DiagLogLevel$2.ALL) maxLevel = DiagLogLevel$2.ALL;
15577
15649
  logger = logger || {};
15578
15650
  function _filterFunc(funcName, theLevel) {
15579
15651
  var theFunc = logger[funcName];
@@ -15581,11 +15653,11 @@ function createLogLevelDiagLogger$1(maxLevel, logger) {
15581
15653
  return function() {};
15582
15654
  }
15583
15655
  return {
15584
- error: _filterFunc("error", DiagLogLevel$1.ERROR),
15585
- warn: _filterFunc("warn", DiagLogLevel$1.WARN),
15586
- info: _filterFunc("info", DiagLogLevel$1.INFO),
15587
- debug: _filterFunc("debug", DiagLogLevel$1.DEBUG),
15588
- verbose: _filterFunc("verbose", DiagLogLevel$1.VERBOSE)
15656
+ error: _filterFunc("error", DiagLogLevel$2.ERROR),
15657
+ warn: _filterFunc("warn", DiagLogLevel$2.WARN),
15658
+ info: _filterFunc("info", DiagLogLevel$2.INFO),
15659
+ debug: _filterFunc("debug", DiagLogLevel$2.DEBUG),
15660
+ verbose: _filterFunc("verbose", DiagLogLevel$2.VERBOSE)
15589
15661
  };
15590
15662
  }
15591
15663
  var __read$2$2 = function(o, n) {
@@ -15637,7 +15709,7 @@ var DiagAPI$1 = function() {
15637
15709
  var self = this;
15638
15710
  var setLogger = function(logger, optionsOrLogLevel) {
15639
15711
  var _a, _b, _c;
15640
- if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel$1.INFO };
15712
+ if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel$2.INFO };
15641
15713
  if (logger === self) {
15642
15714
  var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
15643
15715
  self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
@@ -15645,7 +15717,7 @@ var DiagAPI$1 = function() {
15645
15717
  }
15646
15718
  if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
15647
15719
  var oldLogger = getGlobal$1("diag");
15648
- var newLogger = createLogLevelDiagLogger$1((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$1.INFO, logger);
15720
+ var newLogger = createLogLevelDiagLogger$1((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$2.INFO, logger);
15649
15721
  if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
15650
15722
  var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
15651
15723
  oldLogger.warn("Current logger will be overwritten from " + stack);
@@ -15840,17 +15912,17 @@ var ContextAPI$1 = function() {
15840
15912
  };
15841
15913
  return ContextAPI;
15842
15914
  }();
15843
- var TraceFlags$1;
15915
+ var TraceFlags$2;
15844
15916
  (function(TraceFlags) {
15845
15917
  /** Represents no flag set. */
15846
15918
  TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
15847
15919
  /** Bit to represent whether trace is sampled in trace flags. */
15848
15920
  TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
15849
- })(TraceFlags$1 || (TraceFlags$1 = {}));
15921
+ })(TraceFlags$2 || (TraceFlags$2 = {}));
15850
15922
  var INVALID_SPAN_CONTEXT$1 = {
15851
15923
  traceId: "00000000000000000000000000000000",
15852
15924
  spanId: "0000000000000000",
15853
- traceFlags: TraceFlags$1.NONE
15925
+ traceFlags: TraceFlags$2.NONE
15854
15926
  };
15855
15927
  /**
15856
15928
  * The NonRecordingSpan is the default {@link Span} that is used when no Span
@@ -16241,7 +16313,7 @@ function getGlobalProvider$2() {
16241
16313
  var _a17;
16242
16314
  return (_a17 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a17 : gateway$2;
16243
16315
  }
16244
- var VERSION$6 = "5.0.281";
16316
+ var VERSION$6 = "5.0.282";
16245
16317
  var dataContentSchema$1 = z.union([
16246
16318
  z.string(),
16247
16319
  z.instanceof(Uint8Array),
@@ -21397,7 +21469,7 @@ async function getVercelRequestId$1() {
21397
21469
  var _a11;
21398
21470
  return (_a11 = getContext$1().headers) == null ? void 0 : _a11["x-vercel-id"];
21399
21471
  }
21400
- var VERSION$4 = "3.0.221";
21472
+ var VERSION$4 = "3.0.223";
21401
21473
  var AI_GATEWAY_PROTOCOL_VERSION$1 = "0.0.1";
21402
21474
  function createGatewayProvider(options = {}) {
21403
21475
  var _a11, _b11;
@@ -21600,7 +21672,7 @@ async function getGatewayAuthToken$1(options) {
21600
21672
  authMethod: "oidc"
21601
21673
  };
21602
21674
  }
21603
- const VERSION$1$1 = "1.9.1";
21675
+ const VERSION$1$1 = "1.10.0";
21604
21676
  const re$3 = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
21605
21677
  /**
21606
21678
  * Create a function to test an API version to see if it is compatible with the provided ownVersion.
@@ -21680,15 +21752,23 @@ const isCompatible$3 = _makeCompatibilityCheck$3(VERSION$1$1);
21680
21752
  const major$3 = VERSION$1$1.split(".")[0];
21681
21753
  const GLOBAL_OPENTELEMETRY_API_KEY$3 = Symbol.for(`opentelemetry.js.api.${major$3}`);
21682
21754
  const _global$3 = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
21755
+ function _makeGlobalApi() {
21756
+ return Object.defineProperty({}, "version", {
21757
+ value: VERSION$1$1,
21758
+ enumerable: true,
21759
+ writable: false,
21760
+ configurable: false
21761
+ });
21762
+ }
21683
21763
  function registerGlobal$3(type, instance, diag, allowOverride = false) {
21684
- var _a;
21685
- const api = _global$3[GLOBAL_OPENTELEMETRY_API_KEY$3] = (_a = _global$3[GLOBAL_OPENTELEMETRY_API_KEY$3]) !== null && _a !== void 0 ? _a : { version: VERSION$1$1 };
21764
+ var _global$GLOBAL_OPENTE;
21765
+ const api = _global$3[GLOBAL_OPENTELEMETRY_API_KEY$3] = (_global$GLOBAL_OPENTE = _global$3[GLOBAL_OPENTELEMETRY_API_KEY$3]) !== null && _global$GLOBAL_OPENTE !== void 0 ? _global$GLOBAL_OPENTE : _makeGlobalApi();
21686
21766
  if (!allowOverride && api[type]) {
21687
21767
  const err = /* @__PURE__ */ new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
21688
21768
  diag.error(err.stack || err.message);
21689
21769
  return false;
21690
21770
  }
21691
- if (api.version !== "1.9.1") {
21771
+ if (api.version !== "1.10.0") {
21692
21772
  const err = /* @__PURE__ */ new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION$1$1}`);
21693
21773
  diag.error(err.stack || err.message);
21694
21774
  return false;
@@ -21697,11 +21777,15 @@ function registerGlobal$3(type, instance, diag, allowOverride = false) {
21697
21777
  diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION$1$1}.`);
21698
21778
  return true;
21699
21779
  }
21780
+ let _compatibleGlobalApi;
21700
21781
  function getGlobal$3(type) {
21701
- var _a, _b;
21702
- const globalVersion = (_a = _global$3[GLOBAL_OPENTELEMETRY_API_KEY$3]) === null || _a === void 0 ? void 0 : _a.version;
21703
- if (!globalVersion || !isCompatible$3(globalVersion)) return;
21704
- return (_b = _global$3[GLOBAL_OPENTELEMETRY_API_KEY$3]) === null || _b === void 0 ? void 0 : _b[type];
21782
+ const api = _global$3[GLOBAL_OPENTELEMETRY_API_KEY$3];
21783
+ if (api == null) return;
21784
+ if (api !== _compatibleGlobalApi) {
21785
+ if (!api.version || !isCompatible$3(api.version)) return;
21786
+ _compatibleGlobalApi = api;
21787
+ }
21788
+ return api[type];
21705
21789
  }
21706
21790
  function unregisterGlobal$3(type, diag) {
21707
21791
  diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION$1$1}.`);
@@ -21742,34 +21826,9 @@ function logProxy$3(funcName, namespace, args) {
21742
21826
  if (!logger) return;
21743
21827
  return logger[funcName](namespace, ...args);
21744
21828
  }
21745
- /**
21746
- * Defines the available internal logging levels for the diagnostic logger, the numeric values
21747
- * of the levels are defined to match the original values from the initial LogLevel to avoid
21748
- * compatibility/migration issues for any implementation that assume the numeric ordering.
21749
- */
21750
- var DiagLogLevel$3;
21751
- (function(DiagLogLevel) {
21752
- /** Diagnostic Logging level setting to disable all logging (except and forced logs) */
21753
- DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
21754
- /** Identifies an error scenario */
21755
- DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR";
21756
- /** Identifies a warning scenario */
21757
- DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN";
21758
- /** General informational log message */
21759
- DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO";
21760
- /** General debug log message */
21761
- DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG";
21762
- /**
21763
- * Detailed trace level logging should only be used for development, should only be set
21764
- * in a development environment.
21765
- */
21766
- DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
21767
- /** Used to set the logging level to include all logging */
21768
- DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
21769
- })(DiagLogLevel$3 || (DiagLogLevel$3 = {}));
21770
21829
  function createLogLevelDiagLogger$3(maxLevel, logger) {
21771
- if (maxLevel < DiagLogLevel$3.NONE) maxLevel = DiagLogLevel$3.NONE;
21772
- else if (maxLevel > DiagLogLevel$3.ALL) maxLevel = DiagLogLevel$3.ALL;
21830
+ if (maxLevel < 0) maxLevel = 0;
21831
+ else if (maxLevel > 9999) maxLevel = 9999;
21773
21832
  logger = logger || {};
21774
21833
  function _filterFunc(funcName, theLevel) {
21775
21834
  const theFunc = logger[funcName];
@@ -21777,11 +21836,11 @@ function createLogLevelDiagLogger$3(maxLevel, logger) {
21777
21836
  return function() {};
21778
21837
  }
21779
21838
  return {
21780
- error: _filterFunc("error", DiagLogLevel$3.ERROR),
21781
- warn: _filterFunc("warn", DiagLogLevel$3.WARN),
21782
- info: _filterFunc("info", DiagLogLevel$3.INFO),
21783
- debug: _filterFunc("debug", DiagLogLevel$3.DEBUG),
21784
- verbose: _filterFunc("verbose", DiagLogLevel$3.VERBOSE)
21839
+ error: _filterFunc("error", 30),
21840
+ warn: _filterFunc("warn", 50),
21841
+ info: _filterFunc("info", 60),
21842
+ debug: _filterFunc("debug", 70),
21843
+ verbose: _filterFunc("verbose", 80)
21785
21844
  };
21786
21845
  }
21787
21846
  const API_NAME$2$2 = "diag";
@@ -21810,18 +21869,20 @@ var DiagAPI$3 = class DiagAPI {
21810
21869
  };
21811
21870
  }
21812
21871
  const self = this;
21813
- const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel$3.INFO }) => {
21814
- var _a, _b, _c;
21872
+ const setLogger = (logger, optionsOrLogLevel = { logLevel: 60 }) => {
21873
+ var _optionsOrLogLevel$lo;
21815
21874
  if (logger === self) {
21875
+ var _err$stack;
21816
21876
  const err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
21817
- self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
21877
+ self.error((_err$stack = err.stack) !== null && _err$stack !== void 0 ? _err$stack : err.message);
21818
21878
  return false;
21819
21879
  }
21820
21880
  if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
21821
21881
  const oldLogger = getGlobal$3("diag");
21822
- const newLogger = createLogLevelDiagLogger$3((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$3.INFO, logger);
21882
+ const newLogger = createLogLevelDiagLogger$3((_optionsOrLogLevel$lo = optionsOrLogLevel.logLevel) !== null && _optionsOrLogLevel$lo !== void 0 ? _optionsOrLogLevel$lo : 60, logger);
21823
21883
  if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
21824
- const stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
21884
+ var _Error$stack;
21885
+ const stack = (_Error$stack = (/* @__PURE__ */ new Error()).stack) !== null && _Error$stack !== void 0 ? _Error$stack : "<failed to generate stacktrace>";
21825
21886
  oldLogger.warn(`Current logger will be overwritten from ${stack}`);
21826
21887
  newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
21827
21888
  }
@@ -21876,98 +21937,13 @@ const ROOT_CONTEXT$3 = new class BaseContext {
21876
21937
  };
21877
21938
  }
21878
21939
  }();
21879
- var NoopContextManager$3 = class {
21880
- active() {
21881
- return ROOT_CONTEXT$3;
21882
- }
21883
- with(_context, fn, thisArg, ...args) {
21884
- return fn.call(thisArg, ...args);
21885
- }
21886
- bind(_context, target) {
21887
- return target;
21888
- }
21889
- enable() {
21890
- return this;
21891
- }
21892
- disable() {
21893
- return this;
21894
- }
21895
- };
21896
- const API_NAME$1$2 = "context";
21897
- const NOOP_CONTEXT_MANAGER$3 = new NoopContextManager$3();
21898
- /**
21899
- * Singleton object which represents the entry point to the OpenTelemetry Context API
21900
- *
21901
- * @since 1.0.0
21902
- */
21903
- var ContextAPI$3 = class ContextAPI {
21904
- /** Empty private constructor prevents end users from constructing a new instance of the API */
21905
- constructor() {}
21906
- /** Get the singleton instance of the Context API */
21907
- static getInstance() {
21908
- if (!this._instance) this._instance = new ContextAPI();
21909
- return this._instance;
21910
- }
21911
- /**
21912
- * Set the current context manager.
21913
- *
21914
- * @returns true if the context manager was successfully registered, else false
21915
- */
21916
- setGlobalContextManager(contextManager) {
21917
- return registerGlobal$3(API_NAME$1$2, contextManager, DiagAPI$3.instance());
21918
- }
21919
- /**
21920
- * Get the currently active context
21921
- */
21922
- active() {
21923
- return this._getContextManager().active();
21924
- }
21925
- /**
21926
- * Execute a function with an active context
21927
- *
21928
- * @param context context to be active during function execution
21929
- * @param fn function to execute in a context
21930
- * @param thisArg optional receiver to be used for calling fn
21931
- * @param args optional arguments forwarded to fn
21932
- */
21933
- with(context, fn, thisArg, ...args) {
21934
- return this._getContextManager().with(context, fn, thisArg, ...args);
21935
- }
21936
- /**
21937
- * Bind a context to a target function or event emitter
21938
- *
21939
- * @param context context to bind to the event emitter or function. Defaults to the currently active context
21940
- * @param target function or event emitter to bind
21941
- */
21942
- bind(context, target) {
21943
- return this._getContextManager().bind(context, target);
21944
- }
21945
- _getContextManager() {
21946
- return getGlobal$3(API_NAME$1$2) || NOOP_CONTEXT_MANAGER$3;
21947
- }
21948
- /** Disable and remove the global context manager */
21949
- disable() {
21950
- this._getContextManager().disable();
21951
- unregisterGlobal$3(API_NAME$1$2, DiagAPI$3.instance());
21952
- }
21953
- };
21954
- /**
21955
- * @since 1.0.0
21956
- */
21957
- var TraceFlags$3;
21958
- (function(TraceFlags) {
21959
- /** Represents no flag set. */
21960
- TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
21961
- /** Bit to represent whether trace is sampled in trace flags. */
21962
- TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
21963
- })(TraceFlags$3 || (TraceFlags$3 = {}));
21964
21940
  /**
21965
21941
  * @since 1.0.0
21966
21942
  */
21967
21943
  const INVALID_SPAN_CONTEXT$3 = {
21968
21944
  traceId: "00000000000000000000000000000000",
21969
21945
  spanId: "0000000000000000",
21970
- traceFlags: TraceFlags$3.NONE
21946
+ traceFlags: 0
21971
21947
  };
21972
21948
  /**
21973
21949
  * The NonRecordingSpan is the default {@link Span} that is used when no Span
@@ -22008,60 +21984,6 @@ var NonRecordingSpan$3 = class {
22008
21984
  }
22009
21985
  recordException(_exception, _time) {}
22010
21986
  };
22011
- /**
22012
- * span key
22013
- */
22014
- const SPAN_KEY$3 = createContextKey$3("OpenTelemetry Context Key SPAN");
22015
- /**
22016
- * Return the span if one exists
22017
- *
22018
- * @param context context to get span from
22019
- */
22020
- function getSpan$3(context) {
22021
- return context.getValue(SPAN_KEY$3) || void 0;
22022
- }
22023
- /**
22024
- * Gets the span from the current context, if one exists.
22025
- */
22026
- function getActiveSpan$3() {
22027
- return getSpan$3(ContextAPI$3.getInstance().active());
22028
- }
22029
- /**
22030
- * Set the span on a context
22031
- *
22032
- * @param context context to use as parent
22033
- * @param span span to set active
22034
- */
22035
- function setSpan$3(context, span) {
22036
- return context.setValue(SPAN_KEY$3, span);
22037
- }
22038
- /**
22039
- * Remove current span stored in the context
22040
- *
22041
- * @param context context to delete span from
22042
- */
22043
- function deleteSpan$3(context) {
22044
- return context.deleteValue(SPAN_KEY$3);
22045
- }
22046
- /**
22047
- * Wrap span context in a NoopSpan and set as span in a new
22048
- * context
22049
- *
22050
- * @param context context to set active span on
22051
- * @param spanContext span context to be wrapped
22052
- */
22053
- function setSpanContext$3(context, spanContext) {
22054
- return setSpan$3(context, new NonRecordingSpan$3(spanContext));
22055
- }
22056
- /**
22057
- * Get the span context of the span if it exists.
22058
- *
22059
- * @param context context to get values from
22060
- */
22061
- function getSpanContext$3(context) {
22062
- var _a;
22063
- return (_a = getSpan$3(context)) === null || _a === void 0 ? void 0 : _a.spanContext();
22064
- }
22065
21987
  const isHex = new Uint8Array([
22066
21988
  0,
22067
21989
  0,
@@ -22203,6 +22125,173 @@ function isSpanContextValid$3(spanContext) {
22203
22125
  function wrapSpanContext$3(spanContext) {
22204
22126
  return new NonRecordingSpan$3(spanContext);
22205
22127
  }
22128
+ var NoopContextManager$3 = class {
22129
+ active() {
22130
+ return ROOT_CONTEXT$3;
22131
+ }
22132
+ with(_context, fn, thisArg, ...args) {
22133
+ return fn.call(thisArg, ...args);
22134
+ }
22135
+ bind(_context, target) {
22136
+ return target;
22137
+ }
22138
+ enable() {
22139
+ return this;
22140
+ }
22141
+ disable() {
22142
+ return this;
22143
+ }
22144
+ /** @experimental This API is experimental and may change in minor releases without prior notice. */
22145
+ attach(_context) {
22146
+ return { dispose() {} };
22147
+ }
22148
+ };
22149
+ const API_NAME$1$2 = "context";
22150
+ const NOOP_CONTEXT_MANAGER$3 = new NoopContextManager$3();
22151
+ const NOOP_TOKEN = Object.freeze({ dispose: () => {} });
22152
+ /**
22153
+ * Singleton object which represents the entry point to the OpenTelemetry Context API
22154
+ *
22155
+ * @since 1.0.0
22156
+ */
22157
+ var ContextAPI$3 = class ContextAPI {
22158
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
22159
+ constructor() {
22160
+ this._attachUnsupportedWarned = false;
22161
+ }
22162
+ /** Get the singleton instance of the Context API */
22163
+ static getInstance() {
22164
+ if (!this._instance) this._instance = new ContextAPI();
22165
+ return this._instance;
22166
+ }
22167
+ /**
22168
+ * Set the current context manager.
22169
+ *
22170
+ * @returns true if the context manager was successfully registered, else false
22171
+ */
22172
+ setGlobalContextManager(contextManager) {
22173
+ return registerGlobal$3(API_NAME$1$2, contextManager, DiagAPI$3.instance());
22174
+ }
22175
+ /**
22176
+ * Get the currently active context
22177
+ */
22178
+ active() {
22179
+ return this._getContextManager().active();
22180
+ }
22181
+ /**
22182
+ * Execute a function with an active context
22183
+ *
22184
+ * @param context context to be active during function execution
22185
+ * @param fn function to execute in a context
22186
+ * @param thisArg optional receiver to be used for calling fn
22187
+ * @param args optional arguments forwarded to fn
22188
+ */
22189
+ with(context, fn, thisArg, ...args) {
22190
+ return this._getContextManager().with(context, fn, thisArg, ...args);
22191
+ }
22192
+ /**
22193
+ * Bind a context to a target function or event emitter
22194
+ *
22195
+ * @param context context to bind to the event emitter or function. Defaults to the currently active context
22196
+ * @param target function or event emitter to bind
22197
+ */
22198
+ bind(context, target) {
22199
+ return this._getContextManager().bind(context, target);
22200
+ }
22201
+ /**
22202
+ * Imperatively sets `context` as active, returning a {@link ContextManagementToken} whose
22203
+ * {@link ContextManagementToken.dispose} restores the previous context.
22204
+ *
22205
+ * This is a delicate, low-level API - prefer {@link with}/{@link bind}, which
22206
+ * restore context automatically. Use `attach` only to bridge callback
22207
+ * boundaries that `with` cannot wrap. Call `token.dispose()` when the
22208
+ * operation is done.
22209
+ *
22210
+ * **Caveat for async functions:** If called inside an async function before
22211
+ * the first `await`, the context change may leak into the caller's context
22212
+ * and remain active there. Prefer {@link with} for async code.
22213
+ *
22214
+ * Support is best-effort and varies by the active ContextManager (see
22215
+ * {@link ContextManager.attach}); if it does not implement `attach`, this logs
22216
+ * a warning and returns a no-op token.
22217
+ *
22218
+ * @param context The Context to attach
22219
+ * @returns A {@link ContextManagementToken} whose dispose() restores the previous Context
22220
+ * @since 1.10.0
22221
+ * @experimental This API is experimental and may change in minor releases without prior notice.
22222
+ */
22223
+ attach(context) {
22224
+ const contextManager = this._getContextManager();
22225
+ if (contextManager.attach) return contextManager.attach(context);
22226
+ if (!this._attachUnsupportedWarned) {
22227
+ this._attachUnsupportedWarned = true;
22228
+ DiagAPI$3.instance().warn("The current ContextManager does not implement attach(). The context will not be attached. Use a ContextManager that supports attach() (e.g. AsyncLocalStorageContextManager) or use with()/bind() instead.");
22229
+ }
22230
+ return NOOP_TOKEN;
22231
+ }
22232
+ _getContextManager() {
22233
+ return getGlobal$3(API_NAME$1$2) || NOOP_CONTEXT_MANAGER$3;
22234
+ }
22235
+ /** Disable and remove the global context manager */
22236
+ disable() {
22237
+ this._getContextManager().disable();
22238
+ unregisterGlobal$3(API_NAME$1$2, DiagAPI$3.instance());
22239
+ }
22240
+ };
22241
+ /**
22242
+ * span key
22243
+ */
22244
+ const SPAN_KEY$3 = createContextKey$3("OpenTelemetry Context Key SPAN");
22245
+ /**
22246
+ * Return the span if one exists
22247
+ *
22248
+ * @param context context to get span from
22249
+ */
22250
+ function getSpan$3(context) {
22251
+ return context.getValue(SPAN_KEY$3) || void 0;
22252
+ }
22253
+ /**
22254
+ * Gets the span from the current context, if one exists.
22255
+ */
22256
+ function getActiveSpan$3() {
22257
+ return getSpan$3(ContextAPI$3.getInstance().active());
22258
+ }
22259
+ /**
22260
+ * Set the span on a context
22261
+ *
22262
+ * @param context context to use as parent
22263
+ * @param span span to set active
22264
+ */
22265
+ function setSpan$3(context, span) {
22266
+ return context.setValue(SPAN_KEY$3, span);
22267
+ }
22268
+ /**
22269
+ * Remove current span stored in the context
22270
+ *
22271
+ * @param context context to delete span from
22272
+ */
22273
+ function deleteSpan$3(context) {
22274
+ return context.deleteValue(SPAN_KEY$3);
22275
+ }
22276
+ /**
22277
+ * Wrap span context in a NoopSpan and set as span in a new
22278
+ * context
22279
+ *
22280
+ * @param context context to set active span on
22281
+ * @param spanContext span context to be wrapped
22282
+ */
22283
+ function setSpanContext$3(context, spanContext) {
22284
+ return setSpan$3(context, new NonRecordingSpan$3(spanContext));
22285
+ }
22286
+ /**
22287
+ * Get the span context of the span if it exists.
22288
+ *
22289
+ * @param context context to get values from
22290
+ */
22291
+ function getSpanContext$3(context) {
22292
+ var _getSpan;
22293
+ return (_getSpan = getSpan$3(context)) === null || _getSpan === void 0 ? void 0 : _getSpan.spanContext();
22294
+ }
22206
22295
  const contextApi$3 = ContextAPI$3.getInstance();
22207
22296
  /**
22208
22297
  * No-op implementations of {@link Tracer}.
@@ -22215,6 +22304,7 @@ var NoopTracer$3 = class {
22215
22304
  else return new NonRecordingSpan$3();
22216
22305
  }
22217
22306
  startActiveSpan(name, arg2, arg3, arg4) {
22307
+ var _ctx;
22218
22308
  let opts;
22219
22309
  let ctx;
22220
22310
  let fn;
@@ -22228,7 +22318,7 @@ var NoopTracer$3 = class {
22228
22318
  ctx = arg3;
22229
22319
  fn = arg4;
22230
22320
  }
22231
- const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi$3.active();
22321
+ const parentContext = (_ctx = ctx) !== null && _ctx !== void 0 ? _ctx : contextApi$3.active();
22232
22322
  const span = this.startSpan(name, opts, parentContext);
22233
22323
  const contextWithSpanSet = setSpan$3(parentContext, span);
22234
22324
  return contextApi$3.with(contextWithSpanSet, fn, void 0, span);
@@ -22270,6 +22360,27 @@ var ProxyTracer$3 = class {
22270
22360
  }
22271
22361
  };
22272
22362
  /**
22363
+ * An enumeration of status codes.
22364
+ *
22365
+ * @since 1.0.0
22366
+ */
22367
+ let SpanStatusCode$3 = /* @__PURE__ */ function(SpanStatusCode) {
22368
+ /**
22369
+ * The default status.
22370
+ */
22371
+ SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
22372
+ /**
22373
+ * The operation has been validated by an Application developer or
22374
+ * Operator to have completed successfully.
22375
+ */
22376
+ SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
22377
+ /**
22378
+ * The operation contains an error.
22379
+ */
22380
+ SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
22381
+ return SpanStatusCode;
22382
+ }({});
22383
+ /**
22273
22384
  * An implementation of the {@link TracerProvider} which returns an impotent
22274
22385
  * Tracer for all calls to `getTracer`.
22275
22386
  *
@@ -22297,12 +22408,12 @@ var ProxyTracerProvider$3 = class {
22297
22408
  * Get a {@link ProxyTracer}
22298
22409
  */
22299
22410
  getTracer(name, version, options) {
22300
- var _a;
22301
- return (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer$3(this, name, version, options);
22411
+ var _this$getDelegateTrac;
22412
+ return (_this$getDelegateTrac = this.getDelegateTracer(name, version, options)) !== null && _this$getDelegateTrac !== void 0 ? _this$getDelegateTrac : new ProxyTracer$3(this, name, version, options);
22302
22413
  }
22303
22414
  getDelegate() {
22304
- var _a;
22305
- return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER$3;
22415
+ var _this$_delegate;
22416
+ return (_this$_delegate = this._delegate) !== null && _this$_delegate !== void 0 ? _this$_delegate : NOOP_TRACER_PROVIDER$3;
22306
22417
  }
22307
22418
  /**
22308
22419
  * Set the delegate tracer provider
@@ -22311,32 +22422,11 @@ var ProxyTracerProvider$3 = class {
22311
22422
  this._delegate = delegate;
22312
22423
  }
22313
22424
  getDelegateTracer(name, version, options) {
22314
- var _a;
22315
- return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
22425
+ var _this$_delegate2;
22426
+ return (_this$_delegate2 = this._delegate) === null || _this$_delegate2 === void 0 ? void 0 : _this$_delegate2.getTracer(name, version, options);
22316
22427
  }
22317
22428
  };
22318
22429
  /**
22319
- * An enumeration of status codes.
22320
- *
22321
- * @since 1.0.0
22322
- */
22323
- var SpanStatusCode$3;
22324
- (function(SpanStatusCode) {
22325
- /**
22326
- * The default status.
22327
- */
22328
- SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
22329
- /**
22330
- * The operation has been validated by an Application developer or
22331
- * Operator to have completed successfully.
22332
- */
22333
- SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
22334
- /**
22335
- * The operation contains an error.
22336
- */
22337
- SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
22338
- })(SpanStatusCode$3 || (SpanStatusCode$3 = {}));
22339
- /**
22340
22430
  * Entrypoint for context API
22341
22431
  * @since 1.0.0
22342
22432
  */
@@ -22554,7 +22644,7 @@ function getTotalTimeoutMs(timeout) {
22554
22644
  if (typeof timeout === "number") return timeout;
22555
22645
  return timeout.totalMs;
22556
22646
  }
22557
- var VERSION$3 = "6.0.315";
22647
+ var VERSION$3 = "6.0.317";
22558
22648
  var dataContentSchema$3 = z.union([
22559
22649
  z.string(),
22560
22650
  z.instanceof(Uint8Array),
@@ -24336,6 +24426,7 @@ function convertBase64ToUint8Array(base64String) {
24336
24426
  return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
24337
24427
  }
24338
24428
  function convertUint8ArrayToBase64(array) {
24429
+ if (typeof globalThis.Buffer?.from === "function") return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString("base64");
24339
24430
  const chunks = [];
24340
24431
  const chunkSize = 4096;
24341
24432
  for (let i = 0; i < array.length; i += chunkSize) chunks.push(String.fromCodePoint(...array.subarray(i, i + chunkSize)));
@@ -24418,7 +24509,7 @@ function handleFetchError({ error, url, requestBodyValues }) {
24418
24509
  }
24419
24510
  return error;
24420
24511
  }
24421
- const VERSION$2 = "5.0.68";
24512
+ const VERSION$2 = "5.0.70";
24422
24513
  /**
24423
24514
  * Normalizes different header inputs into a plain record with lower-case keys.
24424
24515
  * Entries with `undefined` or `null` values are removed.
@@ -30084,7 +30175,7 @@ const gatewayTools = {
30084
30175
  async function getVercelRequestId() {
30085
30176
  return getContext().headers?.["x-vercel-id"];
30086
30177
  }
30087
- const VERSION$1$3 = "4.0.126";
30178
+ const VERSION$1$3 = "4.0.128";
30088
30179
  const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
30089
30180
  /** Response shape of `POST /v1/realtime/client-secrets`. `expiresAt` is epoch seconds. */
30090
30181
  const gatewayClientSecretResponseSchema = lazySchema(() => zodSchema$4(z$3.object({
@@ -30875,310 +30966,7 @@ function resolveEmbeddingModel(model) {
30875
30966
  function getGlobalProvider() {
30876
30967
  return asProviderV4(globalThis.AI_SDK_DEFAULT_PROVIDER ?? gateway);
30877
30968
  }
30878
- const VERSION = "7.0.153";
30879
- const z$2$1 = {
30880
- array,
30881
- boolean,
30882
- custom,
30883
- discriminatedUnion,
30884
- enum: enum$1,
30885
- instanceof: instanceof$1,
30886
- lazy,
30887
- literal,
30888
- looseObject,
30889
- never,
30890
- null: null$1,
30891
- number,
30892
- object,
30893
- record,
30894
- string,
30895
- union,
30896
- unknown
30897
- };
30898
- const jsonValueSchema$4 = z$2$1.lazy(() => z$2$1.union([
30899
- z$2$1.null(),
30900
- z$2$1.string(),
30901
- z$2$1.number(),
30902
- z$2$1.boolean(),
30903
- z$2$1.record(z$2$1.string(), jsonValueSchema$4.optional()),
30904
- z$2$1.array(jsonValueSchema$4)
30905
- ]));
30906
- const providerMetadataSchema$4 = z$2$1.record(z$2$1.string(), z$2$1.record(z$2$1.string(), jsonValueSchema$4.optional()));
30907
- const fileInlineDataSchema = z$2$1.union([
30908
- z$2$1.string(),
30909
- z$2$1.instanceof(Uint8Array),
30910
- z$2$1.instanceof(ArrayBuffer),
30911
- z$2$1.custom(isBuffer, { message: "Must be a Buffer" })
30912
- ]);
30913
- const providerReferenceSchema$1 = z$2$1.record(z$2$1.string(), z$2$1.string());
30914
- /**
30915
- * @internal
30916
- */
30917
- const textPartSchema$4 = z$2$1.object({
30918
- type: z$2$1.literal("text"),
30919
- text: z$2$1.string(),
30920
- providerOptions: providerMetadataSchema$4.optional()
30921
- });
30922
- /**
30923
- * @internal
30924
- * @deprecated Use `filePartSchema` with `mediaType: 'image'` instead:
30925
- * `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
30926
- */
30927
- const imagePartSchema$4 = z$2$1.object({
30928
- type: z$2$1.literal("image"),
30929
- image: z$2$1.union([
30930
- fileInlineDataSchema,
30931
- z$2$1.instanceof(URL),
30932
- providerReferenceSchema$1
30933
- ]),
30934
- mediaType: z$2$1.string().optional(),
30935
- providerOptions: providerMetadataSchema$4.optional()
30936
- });
30937
- const taggedFileDataSchema = z$2$1.discriminatedUnion("type", [
30938
- z$2$1.object({
30939
- type: z$2$1.literal("data"),
30940
- data: fileInlineDataSchema
30941
- }),
30942
- z$2$1.object({
30943
- type: z$2$1.literal("url"),
30944
- url: z$2$1.instanceof(URL)
30945
- }),
30946
- z$2$1.object({
30947
- type: z$2$1.literal("reference"),
30948
- reference: providerReferenceSchema$1
30949
- }),
30950
- z$2$1.object({
30951
- type: z$2$1.literal("text"),
30952
- text: z$2$1.string()
30953
- })
30954
- ]);
30955
- const taggedReasoningFileDataSchema = z$2$1.discriminatedUnion("type", [z$2$1.object({
30956
- type: z$2$1.literal("data"),
30957
- data: fileInlineDataSchema
30958
- }), z$2$1.object({
30959
- type: z$2$1.literal("url"),
30960
- url: z$2$1.instanceof(URL)
30961
- })]);
30962
- /**
30963
- * @internal
30964
- */
30965
- const filePartSchema$4 = z$2$1.object({
30966
- type: z$2$1.literal("file"),
30967
- data: z$2$1.union([
30968
- taggedFileDataSchema,
30969
- fileInlineDataSchema,
30970
- z$2$1.instanceof(URL),
30971
- providerReferenceSchema$1
30972
- ]),
30973
- filename: z$2$1.string().optional(),
30974
- mediaType: z$2$1.string(),
30975
- providerOptions: providerMetadataSchema$4.optional()
30976
- });
30977
- /**
30978
- * @internal
30979
- */
30980
- const reasoningPartSchema$4 = z$2$1.object({
30981
- type: z$2$1.literal("reasoning"),
30982
- text: z$2$1.string(),
30983
- providerOptions: providerMetadataSchema$4.optional()
30984
- });
30985
- /**
30986
- * @internal
30987
- */
30988
- const customPartSchema = z$2$1.object({
30989
- type: z$2$1.literal("custom"),
30990
- kind: z$2$1.string().transform((value) => value),
30991
- providerOptions: providerMetadataSchema$4.optional()
30992
- });
30993
- /**
30994
- * @internal
30995
- */
30996
- const reasoningFilePartSchema = z$2$1.object({
30997
- type: z$2$1.literal("reasoning-file"),
30998
- data: z$2$1.union([
30999
- taggedReasoningFileDataSchema,
31000
- fileInlineDataSchema,
31001
- z$2$1.instanceof(URL)
31002
- ]),
31003
- mediaType: z$2$1.string(),
31004
- providerOptions: providerMetadataSchema$4.optional()
31005
- });
31006
- /**
31007
- * @internal
31008
- */
31009
- const toolCallPartSchema$4 = z$2$1.object({
31010
- type: z$2$1.literal("tool-call"),
31011
- toolCallId: z$2$1.string(),
31012
- toolName: z$2$1.string(),
31013
- input: z$2$1.unknown(),
31014
- providerOptions: providerMetadataSchema$4.optional(),
31015
- providerExecuted: z$2$1.boolean().optional()
31016
- });
31017
- /**
31018
- * @internal
31019
- */
31020
- const outputSchema$3 = z$2$1.discriminatedUnion("type", [
31021
- z$2$1.object({
31022
- type: z$2$1.literal("text"),
31023
- value: z$2$1.string(),
31024
- providerOptions: providerMetadataSchema$4.optional()
31025
- }),
31026
- z$2$1.object({
31027
- type: z$2$1.literal("json"),
31028
- value: jsonValueSchema$4,
31029
- providerOptions: providerMetadataSchema$4.optional()
31030
- }),
31031
- z$2$1.object({
31032
- type: z$2$1.literal("execution-denied"),
31033
- reason: z$2$1.string().optional(),
31034
- providerOptions: providerMetadataSchema$4.optional()
31035
- }),
31036
- z$2$1.object({
31037
- type: z$2$1.literal("error-text"),
31038
- value: z$2$1.string(),
31039
- providerOptions: providerMetadataSchema$4.optional()
31040
- }),
31041
- z$2$1.object({
31042
- type: z$2$1.literal("error-json"),
31043
- value: jsonValueSchema$4,
31044
- providerOptions: providerMetadataSchema$4.optional()
31045
- }),
31046
- z$2$1.object({
31047
- type: z$2$1.literal("content"),
31048
- value: z$2$1.array(z$2$1.union([
31049
- z$2$1.object({
31050
- type: z$2$1.literal("text"),
31051
- text: z$2$1.string(),
31052
- providerOptions: providerMetadataSchema$4.optional()
31053
- }),
31054
- z$2$1.object({
31055
- type: z$2$1.literal("file"),
31056
- data: taggedFileDataSchema,
31057
- mediaType: z$2$1.string(),
31058
- filename: z$2$1.string().optional(),
31059
- providerOptions: providerMetadataSchema$4.optional()
31060
- }),
31061
- z$2$1.object({
31062
- type: z$2$1.literal("file-data"),
31063
- data: z$2$1.string(),
31064
- mediaType: z$2$1.string(),
31065
- filename: z$2$1.string().optional(),
31066
- providerOptions: providerMetadataSchema$4.optional()
31067
- }),
31068
- z$2$1.object({
31069
- type: z$2$1.literal("file-url"),
31070
- url: z$2$1.string(),
31071
- mediaType: z$2$1.string().optional(),
31072
- providerOptions: providerMetadataSchema$4.optional()
31073
- }),
31074
- z$2$1.object({
31075
- type: z$2$1.literal("file-id"),
31076
- fileId: z$2$1.union([z$2$1.string(), z$2$1.record(z$2$1.string(), z$2$1.string())]),
31077
- providerOptions: providerMetadataSchema$4.optional()
31078
- }),
31079
- z$2$1.object({
31080
- type: z$2$1.literal("file-reference"),
31081
- providerReference: z$2$1.record(z$2$1.string(), z$2$1.string()),
31082
- providerOptions: providerMetadataSchema$4.optional()
31083
- }),
31084
- z$2$1.object({
31085
- type: z$2$1.literal("image-data"),
31086
- data: z$2$1.string(),
31087
- mediaType: z$2$1.string(),
31088
- providerOptions: providerMetadataSchema$4.optional()
31089
- }),
31090
- z$2$1.object({
31091
- type: z$2$1.literal("image-url"),
31092
- url: z$2$1.string(),
31093
- providerOptions: providerMetadataSchema$4.optional()
31094
- }),
31095
- z$2$1.object({
31096
- type: z$2$1.literal("image-file-id"),
31097
- fileId: z$2$1.union([z$2$1.string(), z$2$1.record(z$2$1.string(), z$2$1.string())]),
31098
- providerOptions: providerMetadataSchema$4.optional()
31099
- }),
31100
- z$2$1.object({
31101
- type: z$2$1.literal("image-file-reference"),
31102
- providerReference: z$2$1.record(z$2$1.string(), z$2$1.string()),
31103
- providerOptions: providerMetadataSchema$4.optional()
31104
- }),
31105
- z$2$1.object({
31106
- type: z$2$1.literal("custom"),
31107
- providerOptions: providerMetadataSchema$4.optional()
31108
- })
31109
- ]))
31110
- })
31111
- ]);
31112
- /**
31113
- * @internal
31114
- */
31115
- const toolResultPartSchema$4 = z$2$1.object({
31116
- type: z$2$1.literal("tool-result"),
31117
- toolCallId: z$2$1.string(),
31118
- toolName: z$2$1.string(),
31119
- output: outputSchema$3,
31120
- providerOptions: providerMetadataSchema$4.optional()
31121
- });
31122
- /**
31123
- * @internal
31124
- */
31125
- const toolApprovalRequestSchema = z$2$1.object({
31126
- type: z$2$1.literal("tool-approval-request"),
31127
- approvalId: z$2$1.string(),
31128
- toolCallId: z$2$1.string(),
31129
- reason: z$2$1.string().optional(),
31130
- isAutomatic: z$2$1.boolean().optional(),
31131
- signature: z$2$1.string().optional(),
31132
- inputSchemaInput: z$2$1.unknown().optional()
31133
- });
31134
- /**
31135
- * @internal
31136
- */
31137
- const toolApprovalResponseSchema = z$2$1.object({
31138
- type: z$2$1.literal("tool-approval-response"),
31139
- approvalId: z$2$1.string(),
31140
- approved: z$2$1.boolean(),
31141
- reason: z$2$1.string().optional()
31142
- });
31143
- const systemModelMessageSchema$3 = z$2$1.object({
31144
- role: z$2$1.literal("system"),
31145
- content: z$2$1.string(),
31146
- providerOptions: providerMetadataSchema$4.optional()
31147
- });
31148
- const userModelMessageSchema$3 = z$2$1.object({
31149
- role: z$2$1.literal("user"),
31150
- content: z$2$1.union([z$2$1.string(), z$2$1.array(z$2$1.union([
31151
- textPartSchema$4,
31152
- imagePartSchema$4,
31153
- filePartSchema$4
31154
- ]))]),
31155
- providerOptions: providerMetadataSchema$4.optional()
31156
- });
31157
- const assistantModelMessageSchema$3 = z$2$1.object({
31158
- role: z$2$1.literal("assistant"),
31159
- content: z$2$1.union([z$2$1.string(), z$2$1.array(z$2$1.union([
31160
- textPartSchema$4,
31161
- customPartSchema,
31162
- filePartSchema$4,
31163
- reasoningPartSchema$4,
31164
- reasoningFilePartSchema,
31165
- toolCallPartSchema$4,
31166
- toolResultPartSchema$4,
31167
- toolApprovalRequestSchema
31168
- ]))]),
31169
- providerOptions: providerMetadataSchema$4.optional()
31170
- });
31171
- const toolModelMessageSchema$3 = z$2$1.object({
31172
- role: z$2$1.literal("tool"),
31173
- content: z$2$1.array(z$2$1.union([toolResultPartSchema$4, toolApprovalResponseSchema])),
31174
- providerOptions: providerMetadataSchema$4.optional()
31175
- });
31176
- z$2$1.union([
31177
- systemModelMessageSchema$3,
31178
- userModelMessageSchema$3,
31179
- assistantModelMessageSchema$3,
31180
- toolModelMessageSchema$3
31181
- ]);
30969
+ const VERSION = "7.0.155";
31182
30970
  /**
31183
30971
  * Reads a property by an untrusted key, ignoring inherited prototype members.
31184
30972
  *
@@ -31424,7 +31212,8 @@ function augmentEvent(event, telemetry, filterContext = false) {
31424
31212
  const augmentedEvent = Object.assign(Object.create(Object.getPrototypeOf(event)), event, {
31425
31213
  recordInputs: telemetry.recordInputs,
31426
31214
  recordOutputs: telemetry.recordOutputs,
31427
- functionId: telemetry.functionId
31215
+ functionId: telemetry.functionId,
31216
+ aiVersion: VERSION
31428
31217
  });
31429
31218
  if (filterContext && event != null && typeof event === "object" && "runtimeContext" in event) augmentedEvent.runtimeContext = filterIncludedContext({
31430
31219
  context: event.runtimeContext,
@@ -31501,6 +31290,7 @@ function createTelemetryDispatcher({ telemetry }) {
31501
31290
  onToolExecutionStart: mergeTelemetryCallback("onToolExecutionStart"),
31502
31291
  onToolExecutionEnd: mergeTelemetryCallback("onToolExecutionEnd"),
31503
31292
  onStepEnd: onStepEnd == null && onStepFinish == null ? void 0 : mergeCallbacks(onStepEnd, onStepFinish),
31293
+ onStepError: mergeTelemetryCallback("onStepError"),
31504
31294
  onObjectStepStart: mergeTelemetryCallback("onObjectStepStart"),
31505
31295
  onObjectStepEnd: mergeTelemetryCallback("onObjectStepEnd"),
31506
31296
  onEmbedStart: mergeTelemetryCallback("onEmbedStart"),
@@ -31555,6 +31345,10 @@ function createTelemetryDispatcher({ telemetry }) {
31555
31345
  }
31556
31346
  };
31557
31347
  }
31348
+ createIdGenerator$4({
31349
+ prefix: "steer",
31350
+ size: 24
31351
+ });
31558
31352
  new TextEncoder();
31559
31353
  new TextEncoder();
31560
31354
  createIdGenerator$4({
@@ -31566,6 +31360,34 @@ createIdGenerator$4({
31566
31360
  size: 24
31567
31361
  });
31568
31362
  TransformStream;
31363
+ const z$2$1 = {
31364
+ array,
31365
+ boolean,
31366
+ custom,
31367
+ discriminatedUnion,
31368
+ enum: enum$1,
31369
+ instanceof: instanceof$1,
31370
+ lazy,
31371
+ literal,
31372
+ looseObject,
31373
+ never,
31374
+ null: null$1,
31375
+ number,
31376
+ object,
31377
+ record,
31378
+ string,
31379
+ union,
31380
+ unknown
31381
+ };
31382
+ const jsonValueSchema$4 = z$2$1.lazy(() => z$2$1.union([
31383
+ z$2$1.null(),
31384
+ z$2$1.string(),
31385
+ z$2$1.number(),
31386
+ z$2$1.boolean(),
31387
+ z$2$1.record(z$2$1.string(), jsonValueSchema$4.optional()),
31388
+ z$2$1.array(jsonValueSchema$4)
31389
+ ]));
31390
+ const providerMetadataSchema$4 = z$2$1.record(z$2$1.string(), z$2$1.record(z$2$1.string(), jsonValueSchema$4.optional()));
31569
31391
  z$2$1.object({
31570
31392
  source: z$2$1.discriminatedUnion("sourceType", [z$2$1.object({
31571
31393
  type: z$2$1.literal("source"),
@@ -32012,6 +31834,281 @@ createIdGenerator$4({
32012
31834
  prefix: "call",
32013
31835
  size: 24
32014
31836
  });
31837
+ const fileInlineDataSchema = z$2$1.union([
31838
+ z$2$1.string(),
31839
+ z$2$1.instanceof(Uint8Array),
31840
+ z$2$1.instanceof(ArrayBuffer),
31841
+ z$2$1.custom(isBuffer, { message: "Must be a Buffer" })
31842
+ ]);
31843
+ const providerReferenceSchema = z$2$1.record(z$2$1.string(), z$2$1.string());
31844
+ /**
31845
+ * @internal
31846
+ */
31847
+ const textPartSchema$4 = z$2$1.object({
31848
+ type: z$2$1.literal("text"),
31849
+ text: z$2$1.string(),
31850
+ providerOptions: providerMetadataSchema$4.optional()
31851
+ });
31852
+ /**
31853
+ * @internal
31854
+ * @deprecated Use `filePartSchema` with `mediaType: 'image'` instead:
31855
+ * `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
31856
+ */
31857
+ const imagePartSchema$4 = z$2$1.object({
31858
+ type: z$2$1.literal("image"),
31859
+ image: z$2$1.union([
31860
+ fileInlineDataSchema,
31861
+ z$2$1.instanceof(URL),
31862
+ providerReferenceSchema
31863
+ ]),
31864
+ mediaType: z$2$1.string().optional(),
31865
+ providerOptions: providerMetadataSchema$4.optional()
31866
+ });
31867
+ const taggedFileDataSchema = z$2$1.discriminatedUnion("type", [
31868
+ z$2$1.object({
31869
+ type: z$2$1.literal("data"),
31870
+ data: fileInlineDataSchema
31871
+ }),
31872
+ z$2$1.object({
31873
+ type: z$2$1.literal("url"),
31874
+ url: z$2$1.instanceof(URL)
31875
+ }),
31876
+ z$2$1.object({
31877
+ type: z$2$1.literal("reference"),
31878
+ reference: providerReferenceSchema
31879
+ }),
31880
+ z$2$1.object({
31881
+ type: z$2$1.literal("text"),
31882
+ text: z$2$1.string()
31883
+ })
31884
+ ]);
31885
+ const taggedReasoningFileDataSchema = z$2$1.discriminatedUnion("type", [z$2$1.object({
31886
+ type: z$2$1.literal("data"),
31887
+ data: fileInlineDataSchema
31888
+ }), z$2$1.object({
31889
+ type: z$2$1.literal("url"),
31890
+ url: z$2$1.instanceof(URL)
31891
+ })]);
31892
+ /**
31893
+ * @internal
31894
+ */
31895
+ const filePartSchema$4 = z$2$1.object({
31896
+ type: z$2$1.literal("file"),
31897
+ data: z$2$1.union([
31898
+ taggedFileDataSchema,
31899
+ fileInlineDataSchema,
31900
+ z$2$1.instanceof(URL),
31901
+ providerReferenceSchema
31902
+ ]),
31903
+ filename: z$2$1.string().optional(),
31904
+ mediaType: z$2$1.string(),
31905
+ providerOptions: providerMetadataSchema$4.optional()
31906
+ });
31907
+ /**
31908
+ * @internal
31909
+ */
31910
+ const reasoningPartSchema$4 = z$2$1.object({
31911
+ type: z$2$1.literal("reasoning"),
31912
+ text: z$2$1.string(),
31913
+ providerOptions: providerMetadataSchema$4.optional()
31914
+ });
31915
+ /**
31916
+ * @internal
31917
+ */
31918
+ const customPartSchema = z$2$1.object({
31919
+ type: z$2$1.literal("custom"),
31920
+ kind: z$2$1.string().transform((value) => value),
31921
+ providerOptions: providerMetadataSchema$4.optional()
31922
+ });
31923
+ /**
31924
+ * @internal
31925
+ */
31926
+ const reasoningFilePartSchema = z$2$1.object({
31927
+ type: z$2$1.literal("reasoning-file"),
31928
+ data: z$2$1.union([
31929
+ taggedReasoningFileDataSchema,
31930
+ fileInlineDataSchema,
31931
+ z$2$1.instanceof(URL)
31932
+ ]),
31933
+ mediaType: z$2$1.string(),
31934
+ providerOptions: providerMetadataSchema$4.optional()
31935
+ });
31936
+ /**
31937
+ * @internal
31938
+ */
31939
+ const toolCallPartSchema$4 = z$2$1.object({
31940
+ type: z$2$1.literal("tool-call"),
31941
+ toolCallId: z$2$1.string(),
31942
+ toolName: z$2$1.string(),
31943
+ input: z$2$1.unknown(),
31944
+ providerOptions: providerMetadataSchema$4.optional(),
31945
+ providerExecuted: z$2$1.boolean().optional()
31946
+ });
31947
+ /**
31948
+ * @internal
31949
+ */
31950
+ const outputSchema$3 = z$2$1.discriminatedUnion("type", [
31951
+ z$2$1.object({
31952
+ type: z$2$1.literal("text"),
31953
+ value: z$2$1.string(),
31954
+ providerOptions: providerMetadataSchema$4.optional()
31955
+ }),
31956
+ z$2$1.object({
31957
+ type: z$2$1.literal("json"),
31958
+ value: jsonValueSchema$4,
31959
+ providerOptions: providerMetadataSchema$4.optional()
31960
+ }),
31961
+ z$2$1.object({
31962
+ type: z$2$1.literal("execution-denied"),
31963
+ reason: z$2$1.string().optional(),
31964
+ providerOptions: providerMetadataSchema$4.optional()
31965
+ }),
31966
+ z$2$1.object({
31967
+ type: z$2$1.literal("error-text"),
31968
+ value: z$2$1.string(),
31969
+ providerOptions: providerMetadataSchema$4.optional()
31970
+ }),
31971
+ z$2$1.object({
31972
+ type: z$2$1.literal("error-json"),
31973
+ value: jsonValueSchema$4,
31974
+ providerOptions: providerMetadataSchema$4.optional()
31975
+ }),
31976
+ z$2$1.object({
31977
+ type: z$2$1.literal("content"),
31978
+ value: z$2$1.array(z$2$1.union([
31979
+ z$2$1.object({
31980
+ type: z$2$1.literal("text"),
31981
+ text: z$2$1.string(),
31982
+ providerOptions: providerMetadataSchema$4.optional()
31983
+ }),
31984
+ z$2$1.object({
31985
+ type: z$2$1.literal("file"),
31986
+ data: taggedFileDataSchema,
31987
+ mediaType: z$2$1.string(),
31988
+ filename: z$2$1.string().optional(),
31989
+ providerOptions: providerMetadataSchema$4.optional()
31990
+ }),
31991
+ z$2$1.object({
31992
+ type: z$2$1.literal("file-data"),
31993
+ data: z$2$1.string(),
31994
+ mediaType: z$2$1.string(),
31995
+ filename: z$2$1.string().optional(),
31996
+ providerOptions: providerMetadataSchema$4.optional()
31997
+ }),
31998
+ z$2$1.object({
31999
+ type: z$2$1.literal("file-url"),
32000
+ url: z$2$1.string(),
32001
+ mediaType: z$2$1.string().optional(),
32002
+ providerOptions: providerMetadataSchema$4.optional()
32003
+ }),
32004
+ z$2$1.object({
32005
+ type: z$2$1.literal("file-id"),
32006
+ fileId: z$2$1.union([z$2$1.string(), z$2$1.record(z$2$1.string(), z$2$1.string())]),
32007
+ providerOptions: providerMetadataSchema$4.optional()
32008
+ }),
32009
+ z$2$1.object({
32010
+ type: z$2$1.literal("file-reference"),
32011
+ providerReference: z$2$1.record(z$2$1.string(), z$2$1.string()),
32012
+ providerOptions: providerMetadataSchema$4.optional()
32013
+ }),
32014
+ z$2$1.object({
32015
+ type: z$2$1.literal("image-data"),
32016
+ data: z$2$1.string(),
32017
+ mediaType: z$2$1.string(),
32018
+ providerOptions: providerMetadataSchema$4.optional()
32019
+ }),
32020
+ z$2$1.object({
32021
+ type: z$2$1.literal("image-url"),
32022
+ url: z$2$1.string(),
32023
+ providerOptions: providerMetadataSchema$4.optional()
32024
+ }),
32025
+ z$2$1.object({
32026
+ type: z$2$1.literal("image-file-id"),
32027
+ fileId: z$2$1.union([z$2$1.string(), z$2$1.record(z$2$1.string(), z$2$1.string())]),
32028
+ providerOptions: providerMetadataSchema$4.optional()
32029
+ }),
32030
+ z$2$1.object({
32031
+ type: z$2$1.literal("image-file-reference"),
32032
+ providerReference: z$2$1.record(z$2$1.string(), z$2$1.string()),
32033
+ providerOptions: providerMetadataSchema$4.optional()
32034
+ }),
32035
+ z$2$1.object({
32036
+ type: z$2$1.literal("custom"),
32037
+ providerOptions: providerMetadataSchema$4.optional()
32038
+ })
32039
+ ]))
32040
+ })
32041
+ ]);
32042
+ /**
32043
+ * @internal
32044
+ */
32045
+ const toolResultPartSchema$4 = z$2$1.object({
32046
+ type: z$2$1.literal("tool-result"),
32047
+ toolCallId: z$2$1.string(),
32048
+ toolName: z$2$1.string(),
32049
+ output: outputSchema$3,
32050
+ providerOptions: providerMetadataSchema$4.optional()
32051
+ });
32052
+ /**
32053
+ * @internal
32054
+ */
32055
+ const toolApprovalRequestSchema = z$2$1.object({
32056
+ type: z$2$1.literal("tool-approval-request"),
32057
+ approvalId: z$2$1.string(),
32058
+ toolCallId: z$2$1.string(),
32059
+ reason: z$2$1.string().optional(),
32060
+ isAutomatic: z$2$1.boolean().optional(),
32061
+ signature: z$2$1.string().optional(),
32062
+ inputSchemaInput: z$2$1.unknown().optional()
32063
+ });
32064
+ /**
32065
+ * @internal
32066
+ */
32067
+ const toolApprovalResponseSchema = z$2$1.object({
32068
+ type: z$2$1.literal("tool-approval-response"),
32069
+ approvalId: z$2$1.string(),
32070
+ approved: z$2$1.boolean(),
32071
+ reason: z$2$1.string().optional()
32072
+ });
32073
+ const systemModelMessageSchema$3 = z$2$1.object({
32074
+ role: z$2$1.literal("system"),
32075
+ content: z$2$1.string(),
32076
+ providerOptions: providerMetadataSchema$4.optional()
32077
+ });
32078
+ const userModelMessageSchema$3 = z$2$1.object({
32079
+ role: z$2$1.literal("user"),
32080
+ content: z$2$1.union([z$2$1.string(), z$2$1.array(z$2$1.union([
32081
+ textPartSchema$4,
32082
+ imagePartSchema$4,
32083
+ filePartSchema$4
32084
+ ]))]),
32085
+ providerOptions: providerMetadataSchema$4.optional()
32086
+ });
32087
+ const assistantModelMessageSchema$3 = z$2$1.object({
32088
+ role: z$2$1.literal("assistant"),
32089
+ content: z$2$1.union([z$2$1.string(), z$2$1.array(z$2$1.union([
32090
+ textPartSchema$4,
32091
+ customPartSchema,
32092
+ filePartSchema$4,
32093
+ reasoningPartSchema$4,
32094
+ reasoningFilePartSchema,
32095
+ toolCallPartSchema$4,
32096
+ toolResultPartSchema$4,
32097
+ toolApprovalRequestSchema
32098
+ ]))]),
32099
+ providerOptions: providerMetadataSchema$4.optional()
32100
+ });
32101
+ const toolModelMessageSchema$3 = z$2$1.object({
32102
+ role: z$2$1.literal("tool"),
32103
+ content: z$2$1.array(z$2$1.union([toolResultPartSchema$4, toolApprovalResponseSchema])),
32104
+ providerOptions: providerMetadataSchema$4.optional()
32105
+ });
32106
+ z$2$1.union([
32107
+ systemModelMessageSchema$3,
32108
+ userModelMessageSchema$3,
32109
+ assistantModelMessageSchema$3,
32110
+ toolModelMessageSchema$3
32111
+ ]);
32015
32112
  z$2$1.object({
32016
32113
  token: z$2$1.string().refine((value) => value.trim().length > 0),
32017
32114
  url: z$2$1.string().refine((value) => {
@@ -35860,10 +35957,17 @@ function isOmModelExecutionFailure(error) {
35860
35957
  }
35861
35958
  var OmModelExecutionError = class extends Error {
35862
35959
  failureKind;
35863
- constructor(failureKind, cause) {
35960
+ #observerSpanId;
35961
+ get observerSpanId() {
35962
+ return this.#observerSpanId;
35963
+ }
35964
+ constructor(failureKind, cause, observerSpan) {
35864
35965
  super(formatOmError(cause), { cause });
35865
35966
  this.failureKind = failureKind;
35866
35967
  this.name = "OmModelExecutionError";
35968
+ try {
35969
+ this.#observerSpanId = observerSpan && (typeof observerSpan.getExportedSpanId !== "function" || observerSpan.getExportedSpanId() === observerSpan.id) ? observerSpan.id : void 0;
35970
+ } catch {}
35867
35971
  }
35868
35972
  };
35869
35973
  function isOmModelExecutionError(error) {
@@ -35874,8 +35978,22 @@ function isOmModelExecutionError(error) {
35874
35978
  }
35875
35979
  }
35876
35980
  function getOmFailureMetadata(error, failurePolicy) {
35981
+ let observerFailure;
35982
+ if (typeof coreObservability.executionFailureTermination === "function") try {
35983
+ const modelFailure = isOmModelExecutionError(error);
35984
+ observerFailure = {
35985
+ ...modelFailure && error.observerSpanId ? { observerSpanId: error.observerSpanId } : {},
35986
+ cause: coreObservability.executionFailureTermination(modelFailure ? error.cause : error, modelFailure ? "model_error" : "runtime_error")
35987
+ };
35988
+ } catch {
35989
+ observerFailure = { cause: {
35990
+ outcome: "error",
35991
+ stopReason: "runtime_error"
35992
+ } };
35993
+ }
35877
35994
  return {
35878
35995
  failurePolicy,
35996
+ ...observerFailure ? { observerFailure } : {},
35879
35997
  ...isOmModelExecutionError(error) ? { failureKind: error.failureKind } : {}
35880
35998
  };
35881
35999
  }
@@ -38757,7 +38875,7 @@ var ObserverRunner = class {
38757
38875
  aborted: abortSignal?.aborted ?? false
38758
38876
  });
38759
38877
  if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
38760
- throw new OmModelExecutionError("observer-model", error);
38878
+ throw new OmModelExecutionError("observer-model", error, childObservabilityContext.tracingContext?.currentSpan);
38761
38879
  }
38762
38880
  }, abortSignal)
38763
38881
  }), {
@@ -38972,7 +39090,7 @@ var ObserverRunner = class {
38972
39090
  aborted: abortSignal?.aborted ?? false
38973
39091
  });
38974
39092
  if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
38975
- throw new OmModelExecutionError("observer-model", error);
39093
+ throw new OmModelExecutionError("observer-model", error, childObservabilityContext.tracingContext?.currentSpan);
38976
39094
  }
38977
39095
  }, abortSignal)
38978
39096
  }), {
@@ -39391,7 +39509,7 @@ async function resolveImageDimensionsAsync(part) {
39391
39509
  const url = resolveHttpAssetUrl(getObjectValue(part, "image") ?? getObjectValue(part, "data"));
39392
39510
  if (!url) return existing;
39393
39511
  try {
39394
- const probeImageSize = (await import("./probe-image-size-BLtXo-AD.js").then((m) => /* @__PURE__ */ __toESM$1(m.default, 1))).default;
39512
+ const probeImageSize = (await import("./probe-image-size-BqH96zcz.js").then((m) => /* @__PURE__ */ __toESM$1(m.default, 1))).default;
39395
39513
  const probed = await probeImageSize(url, {
39396
39514
  open_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
39397
39515
  response_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
@@ -46857,7 +46975,7 @@ var ReflectorRunner = class {
46857
46975
  })).getFullOutput(), "OM reflector");
46858
46976
  } catch (error) {
46859
46977
  if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
46860
- throw new OmModelExecutionError("reflector-model", error);
46978
+ throw new OmModelExecutionError("reflector-model", error, childObservabilityContext.tracingContext?.currentSpan);
46861
46979
  }
46862
46980
  }, abortSignal)
46863
46981
  }), {
@@ -50900,7 +51018,7 @@ var ObservationalMemoryProcessor = class {
50900
51018
  await failedTurn.end().catch(() => {});
50901
51019
  if (this.turn === failedTurn) this.turn = void 0;
50902
51020
  state.__omTurn = void 0;
50903
- if (typeof abort === "function") abort(abortMessage);
51021
+ if (typeof abort === "function") abort(abortMessage, { metadata: getOmFailureMetadata(error, "abort") });
50904
51022
  throw err;
50905
51023
  }
50906
51024
  injectObservationContextMessages({
@@ -54879,7 +54997,7 @@ const createModelInstance = async (provider, modelId, version = "v2") => {
54879
54997
  try {
54880
54998
  const providerFn = version === `v1` ? { v1: {
54881
54999
  openai: async () => {
54882
- const { openai } = await import("./dist-C_xVj979.js");
55000
+ const { openai } = await import("./dist-_M1jEPcL.js");
54883
55001
  return openai(modelId);
54884
55002
  },
54885
55003
  anthropic: async () => {
@@ -62580,6 +62698,6 @@ const agentBuilderWorkflows = {
62580
62698
  };
62581
62699
  }).then(taskExecutionStep).commit()
62582
62700
  };
62583
- export { require_exif_utils as a, agentBuilderWorkflows, require_svg_header as i, openai as n, require_miaf_utils as o, require_sync as r, require_common as s, createOpenAI as t };
62701
+ export { require_tiff as a, agentBuilderWorkflows, require_png as c, require_gif as d, require_bmp as f, require_webp as i, require_jpeg as l, require_utils as m, openai as n, require_svg as o, require_avif as p, require_sync as r, require_psd as s, createOpenAI as t, require_ico as u };
62584
62702
 
62585
- //# sourceMappingURL=dist-DK9HHAgo.js.map
62703
+ //# sourceMappingURL=dist-BLjE21MA.js.map