@vite-hub/source 0.0.4 → 0.1.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 (48) hide show
  1. package/README.md +219 -82
  2. package/dist/{auth-Ddw55OUG.js → auth-B-tX_rp0.js} +255 -90
  3. package/dist/{client-CDfTmtQu.js → client-BwstxtdY.js} +584 -207
  4. package/dist/client.d.ts +27 -10
  5. package/dist/client.js +71 -13
  6. package/dist/collection-B_4w_J8h.d.ts +257 -0
  7. package/dist/{collection-B8pXGM2d.js → collection-cursor-WzV1Jd6v.js} +37 -54
  8. package/dist/collection-route-BplWPxHR.js +10 -0
  9. package/dist/drizzle.d.ts +41 -0
  10. package/dist/drizzle.js +89 -0
  11. package/dist/error-diagnostics-X0kuFjBT.js +51 -0
  12. package/dist/file-BX0FSvgE.js +60 -0
  13. package/dist/{file-EQ3AjVM6.d.ts → file-DadN9dbN.d.ts} +2 -3
  14. package/dist/file.d.ts +1 -1
  15. package/dist/file.js +1 -1
  16. package/dist/files.d.ts +15 -0
  17. package/dist/files.js +38 -0
  18. package/dist/github.d.ts +8 -5
  19. package/dist/github.js +725 -426
  20. package/dist/glob-BmFqTvJY.js +993 -0
  21. package/dist/glob.d.ts +12 -4
  22. package/dist/glob.js +1 -894
  23. package/dist/index.d.ts +118 -27
  24. package/dist/index.js +623 -14
  25. package/dist/markdown.d.ts +4 -6
  26. package/dist/markdown.js +2 -2
  27. package/dist/mcp.d.ts +3 -4
  28. package/dist/mcp.js +302 -5920
  29. package/dist/{file-BSWQg9Qv.js → mrmime-40h5OOIp.js} +1 -56
  30. package/dist/{path-CUhvUREm.js → path-BS8rYm0n.js} +60 -40
  31. package/dist/{path-BzmU4Eni.js → path-DOBpV8ol.js} +3 -7
  32. package/dist/server.d.ts +256 -6
  33. package/dist/server.js +90 -12
  34. package/dist/{sse-CE9Q2JqM.js → sse-D9gqqNPj.js} +50 -9
  35. package/dist/{streamableHttp-BszaXLmg.js → streamableHttp-BL-E7pl5.js} +40 -22
  36. package/dist/types-BigOktIj.d.ts +93 -0
  37. package/dist/{types-AIBmt_m6.js → types-CoWcW8oz.js} +2502 -1187
  38. package/dist/vite.d.ts +134 -13
  39. package/dist/vite.js +1734 -79
  40. package/package.json +55 -36
  41. package/dist/collection-CF2ON__k.d.ts +0 -92
  42. package/dist/collection-route-Dw7QLFyx.js +0 -6
  43. package/dist/content/client.d.ts +0 -3
  44. package/dist/content/client.js +0 -2
  45. package/dist/content.d.ts +0 -44
  46. package/dist/content.js +0 -157
  47. package/dist/registry-C8skfCSV.js +0 -120
  48. package/dist/types-Bu3WvNX9.d.ts +0 -71
@@ -1,6 +1,6 @@
1
- import { i as __toESM, r as __commonJSMin } from "./path-CUhvUREm.js";
2
- import { A as ProgressNotificationSchema, B as isJSONRPCNotification, C as ListResourceTemplatesResultSchema, D as ListToolsResultSchema, E as ListTasksResultSchema, F as SUPPORTED_PROTOCOL_VERSIONS, H as isJSONRPCResultResponse, I as TaskStatusNotificationSchema, L as ToolListChangedNotificationSchema, M as RELATED_TASK_META_KEY, N as ReadResourceResultSchema, O as McpError, P as ResourceListChangedNotificationSchema, S as ListPromptsResultSchema, T as ListTasksRequestSchema, U as isTaskAugmentedRequestParams, V as isJSONRPCRequest, _ as GetTaskResultSchema, a as CompleteResultSchema, b as LATEST_PROTOCOL_VERSION, c as CreateMessageResultWithToolsSchema, d as ElicitResultSchema, f as EmptyResultSchema, g as GetTaskRequestSchema, h as GetTaskPayloadRequestSchema, i as CancelledNotificationSchema, j as PromptListChangedNotificationSchema, k as PingRequestSchema, l as CreateTaskResultSchema, m as GetPromptResultSchema, n as CancelTaskRequestSchema, o as CreateMessageRequestSchema, p as ErrorCode, r as CancelTaskResultSchema, s as CreateMessageResultSchema, t as CallToolResultSchema, tt as safeParse$1, u as ElicitRequestSchema, v as InitializeResultSchema, w as ListResourcesResultSchema, x as ListChangedOptionsBaseSchema, z as isJSONRPCErrorResponse } from "./types-AIBmt_m6.js";
3
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
1
+ import { a as __toESM, i as __commonJSMin } from "./path-BS8rYm0n.js";
2
+ import { A as McpError, B as ToolListChangedNotificationSchema, C as ListChangedOptionsBaseSchema, D as ListTasksRequestSchema, E as ListResourcesResultSchema, F as ReadResourceResultSchema, G as isJSONRPCResultResponse, H as isJSONRPCErrorResponse, K as isTaskAugmentedRequestParams, L as ResourceListChangedNotificationSchema, M as ProgressNotificationSchema, N as PromptListChangedNotificationSchema, O as ListTasksResultSchema, P as RELATED_TASK_META_KEY, R as SUPPORTED_PROTOCOL_VERSIONS, S as LATEST_PROTOCOL_VERSION, T as ListResourceTemplatesResultSchema, U as isJSONRPCNotification, W as isJSONRPCRequest, _ as GetTaskPayloadRequestSchema, a as CancelTaskResultSchema, b as InitializeResultSchema, c as CreateMessageRequestSchema, d as CreateTaskResultSchema, f as ElicitRequestSchema, g as GetPromptResultSchema, h as ErrorCode, i as CancelTaskRequestSchema, it as safeParse$1, j as PingRequestSchema, k as ListToolsResultSchema, l as CreateMessageResultSchema, m as EmptyResultSchema, o as CancelledNotificationSchema, p as ElicitResultSchema, r as CallToolResultSchema, s as CompleteResultSchema, u as CreateMessageResultWithToolsSchema, v as GetTaskRequestSchema, w as ListPromptsResultSchema, y as GetTaskResultSchema, z as TaskStatusNotificationSchema } from "./types-CoWcW8oz.js";
3
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_@cfworker+json-schema@4.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
4
4
  function isZ4Schema(s) {
5
5
  return !!s._zod;
6
6
  }
@@ -43,7 +43,7 @@ function getLiteralValue(schema) {
43
43
  if (directValue !== void 0) return directValue;
44
44
  }
45
45
  //#endregion
46
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
46
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_@cfworker+json-schema@4.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
47
47
  /**
48
48
  * Experimental task interfaces for MCP SDK.
49
49
  * WARNING: These APIs are experimental and may change without notice.
@@ -60,7 +60,7 @@ function isTerminal(status) {
60
60
  return status === "completed" || status === "failed" || status === "cancelled";
61
61
  }
62
62
  //#endregion
63
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
63
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_@cfworker+json-schema@4.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
64
64
  function getMethodLiteral(schema) {
65
65
  const methodSchema = getObjectShape(schema)?.method;
66
66
  if (!methodSchema) throw new Error("Schema is missing a method literal");
@@ -108,6 +108,7 @@ var Protocol = class {
108
108
  this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
109
109
  const handleTaskResult = async () => {
110
110
  const taskId = request.params.taskId;
111
+ if (!await this._taskStore.getTask(taskId, extra.sessionId)) throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
111
112
  if (this._taskMessageQueue) {
112
113
  let queuedMessage;
113
114
  while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
@@ -134,12 +135,12 @@ var Protocol = class {
134
135
  const task = await this._taskStore.getTask(taskId, extra.sessionId);
135
136
  if (!task) throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
136
137
  if (!isTerminal(task.status)) {
137
- await this._waitForTaskUpdate(taskId, extra.signal);
138
+ await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
138
139
  return await handleTaskResult();
139
140
  }
140
141
  if (isTerminal(task.status)) {
141
142
  const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
142
- this._clearTaskQueue(taskId);
143
+ this._clearTaskQueue(taskId, extra.sessionId);
143
144
  return {
144
145
  ...result,
145
146
  _meta: {
@@ -170,7 +171,7 @@ var Protocol = class {
170
171
  if (!task) throw new McpError(ErrorCode.InvalidParams, `Task not found: ${request.params.taskId}`);
171
172
  if (isTerminal(task.status)) throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
172
173
  await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
173
- this._clearTaskQueue(request.params.taskId);
174
+ this._clearTaskQueue(request.params.taskId, extra.sessionId);
174
175
  const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
175
176
  if (!cancelledTask) throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
176
177
  return {
@@ -275,6 +276,17 @@ var Protocol = class {
275
276
  const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
276
277
  const capturedTransport = this._transport;
277
278
  const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
279
+ const sessionId = capturedTransport?.sessionId;
280
+ const store = this._taskStore;
281
+ let relatedTaskFound = true;
282
+ let relatedTaskLookup;
283
+ if (relatedTaskId && store && this._taskMessageQueue && sessionId !== void 0) {
284
+ relatedTaskFound = false;
285
+ relatedTaskLookup = (async () => {
286
+ if (!await store.getTask(relatedTaskId, sessionId)) throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
287
+ relatedTaskFound = true;
288
+ })();
289
+ }
278
290
  if (handler === void 0) {
279
291
  const errorResponse = {
280
292
  jsonrpc: "2.0",
@@ -284,7 +296,14 @@ var Protocol = class {
284
296
  message: "Method not found"
285
297
  }
286
298
  };
287
- if (relatedTaskId && this._taskMessageQueue) this._enqueueTaskMessage(relatedTaskId, {
299
+ if (relatedTaskId && relatedTaskLookup) {
300
+ const queuedError = {
301
+ type: "error",
302
+ message: errorResponse,
303
+ timestamp: Date.now()
304
+ };
305
+ relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send an error response: ${error}`)));
306
+ } else if (relatedTaskId && this._taskMessageQueue) this._enqueueTaskMessage(relatedTaskId, {
288
307
  type: "error",
289
308
  message: errorResponse,
290
309
  timestamp: Date.now()
@@ -326,7 +345,8 @@ var Protocol = class {
326
345
  closeSSEStream: extra?.closeSSEStream,
327
346
  closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
328
347
  };
329
- Promise.resolve().then(() => {
348
+ (relatedTaskLookup ?? Promise.resolve()).then(() => {
349
+ if (relatedTaskLookup && abortController.signal.aborted) throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
330
350
  if (taskCreationParams) this.assertTaskHandlerCapability(request.method);
331
351
  }).then(() => handler(request, fullExtra)).then(async (result) => {
332
352
  if (abortController.signal.aborted) return;
@@ -352,7 +372,7 @@ var Protocol = class {
352
372
  ...error["data"] !== void 0 && { data: error["data"] }
353
373
  }
354
374
  };
355
- if (relatedTaskId && this._taskMessageQueue) await this._enqueueTaskMessage(relatedTaskId, {
375
+ if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) await this._enqueueTaskMessage(relatedTaskId, {
356
376
  type: "error",
357
377
  message: errorResponse,
358
378
  timestamp: Date.now()
@@ -804,7 +824,7 @@ var Protocol = class {
804
824
  async _enqueueTaskMessage(taskId, message, sessionId) {
805
825
  if (!this._taskStore || !this._taskMessageQueue) throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
806
826
  const maxQueueSize = this._options?.maxTaskQueueSize;
807
- await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
827
+ await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
808
828
  }
809
829
  /**
810
830
  * Clears the message queue for a task and rejects any pending request resolvers.
@@ -829,12 +849,13 @@ var Protocol = class {
829
849
  * Uses polling to check for updates at the task's configured poll interval.
830
850
  * @param taskId The task ID to wait for
831
851
  * @param signal Abort signal to cancel the wait
852
+ * @param sessionId Session of the request that waits, passed to the task store
832
853
  * @returns Promise that resolves when an update occurs or rejects if aborted
833
854
  */
834
- async _waitForTaskUpdate(taskId, signal) {
855
+ async _waitForTaskUpdate(taskId, signal, sessionId) {
835
856
  let interval = this._options?.defaultTaskPollInterval ?? 1e3;
836
857
  try {
837
- const task = await this._taskStore?.getTask(taskId);
858
+ const task = await this._taskStore?.getTask(taskId, sessionId);
838
859
  if (task?.pollInterval) interval = task.pollInterval;
839
860
  } catch {}
840
861
  return new Promise((resolve, reject) => {
@@ -2168,7 +2189,7 @@ var require_boolSchema = /* @__PURE__ */ __commonJSMin(((exports) => {
2168
2189
  var require_rules = /* @__PURE__ */ __commonJSMin(((exports) => {
2169
2190
  Object.defineProperty(exports, "__esModule", { value: true });
2170
2191
  exports.getRules = exports.isJSONType = void 0;
2171
- const jsonTypes = new Set([
2192
+ const jsonTypes = /* @__PURE__ */ new Set([
2172
2193
  "string",
2173
2194
  "number",
2174
2195
  "integer",
@@ -2287,7 +2308,7 @@ var require_dataType = /* @__PURE__ */ __commonJSMin(((exports) => {
2287
2308
  return checkTypes;
2288
2309
  }
2289
2310
  exports.coerceAndCheckDataType = coerceAndCheckDataType;
2290
- const COERCIBLE = new Set([
2311
+ const COERCIBLE = /* @__PURE__ */ new Set([
2291
2312
  "string",
2292
2313
  "number",
2293
2314
  "integer",
@@ -2841,7 +2862,7 @@ var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
2841
2862
  const util_1 = require_util();
2842
2863
  const equal = require_fast_deep_equal();
2843
2864
  const traverse = require_json_schema_traverse();
2844
- const SIMPLE_INLINED = new Set([
2865
+ const SIMPLE_INLINED = /* @__PURE__ */ new Set([
2845
2866
  "type",
2846
2867
  "format",
2847
2868
  "pattern",
@@ -2866,7 +2887,7 @@ var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
2866
2887
  return countKeys(schema) <= limit;
2867
2888
  }
2868
2889
  exports.inlineRef = inlineRef;
2869
- const REF_KEYWORDS = new Set([
2890
+ const REF_KEYWORDS = /* @__PURE__ */ new Set([
2870
2891
  "$ref",
2871
2892
  "$recursiveRef",
2872
2893
  "$recursiveAnchor",
@@ -2937,10 +2958,12 @@ var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
2937
2958
  let schOrRef = this.refs[ref];
2938
2959
  if (typeof schOrRef == "string") schOrRef = this.refs[schOrRef];
2939
2960
  if (typeof schOrRef == "object") checkAmbiguosRef(sch, schOrRef.schema, ref);
2940
- else if (ref !== normalizeId(fullPath)) if (ref[0] === "#") {
2941
- checkAmbiguosRef(sch, localRefs[ref], ref);
2942
- localRefs[ref] = sch;
2943
- } else this.refs[ref] = fullPath;
2961
+ else if (ref !== normalizeId(fullPath)) {
2962
+ if (ref[0] === "#") {
2963
+ checkAmbiguosRef(sch, localRefs[ref], ref);
2964
+ localRefs[ref] = sch;
2965
+ } else this.refs[ref] = fullPath;
2966
+ }
2944
2967
  return ref;
2945
2968
  }
2946
2969
  function addAnchor(anchor) {
@@ -3587,7 +3610,7 @@ var require_compile = /* @__PURE__ */ __commonJSMin(((exports) => {
3587
3610
  return getJsonPointer.call(this, p, schOrRef);
3588
3611
  }
3589
3612
  exports.resolveSchema = resolveSchema;
3590
- const PREVENT_SCOPE_CHANGE = new Set([
3613
+ const PREVENT_SCOPE_CHANGE = /* @__PURE__ */ new Set([
3591
3614
  "properties",
3592
3615
  "patternProperties",
3593
3616
  "enum",
@@ -3636,18 +3659,34 @@ var require_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3636
3659
  };
3637
3660
  }));
3638
3661
  //#endregion
3639
- //#region ../../node_modules/.pnpm/fast-uri@3.1.3/node_modules/fast-uri/lib/utils.js
3662
+ //#region ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js
3640
3663
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3641
3664
  /** @type {(value: string) => boolean} */
3642
3665
  const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3643
3666
  /** @type {(value: string) => boolean} */
3644
3667
  const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
3645
3668
  /** @type {(value: string) => boolean} */
3669
+ const isPort = RegExp.prototype.test.bind(/^\d*$/u);
3670
+ /** @type {(value: string) => boolean} */
3646
3671
  const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3647
3672
  /** @type {(value: string) => boolean} */
3648
3673
  const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3649
3674
  /** @type {(value: string) => boolean} */
3650
- const isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3675
+ const isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
3676
+ /** @type {(value: string) => boolean} */
3677
+ const isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
3678
+ /** @type {(value: string) => boolean} */
3679
+ const isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
3680
+ const BYTE_HEX = new Array(256);
3681
+ {
3682
+ const HEX_DIGITS = "0123456789ABCDEF";
3683
+ for (let i = 0; i < 256; i++) BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
3684
+ }
3685
+ function percentEncodeNonAscii(cp) {
3686
+ if (cp < 2048) return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
3687
+ if (cp < 65536) return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
3688
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
3689
+ }
3651
3690
  /**
3652
3691
  * @param {Array<string>} input
3653
3692
  * @returns {string}
@@ -3670,119 +3709,162 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3670
3709
  }
3671
3710
  return acc;
3672
3711
  }
3673
- /**
3674
- * @typedef {Object} GetIPV6Result
3675
- * @property {boolean} error - Indicates if there was an error parsing the IPv6 address.
3676
- * @property {string} address - The parsed IPv6 address.
3677
- * @property {string} [zone] - The zone identifier, if present.
3678
- */
3712
+ /** @type {(value: string) => boolean} */
3713
+ const isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
3714
+ /** @type {(value: string) => boolean} */
3715
+ const isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
3716
+ /** @type {(value: string) => boolean} */
3717
+ const isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
3679
3718
  /**
3680
3719
  * @param {string} value
3681
3720
  * @returns {boolean}
3682
3721
  */
3683
3722
  const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
3684
3723
  /**
3685
- * @param {Array<string>} buffer
3724
+ * @param {string} zone
3686
3725
  * @returns {boolean}
3687
3726
  */
3688
- function consumeIsZone(buffer) {
3689
- buffer.length = 0;
3727
+ function isZoneIdentifier(zone) {
3728
+ if (zone.length === 0) return false;
3729
+ for (let i = 0; i < zone.length; i++) {
3730
+ if (isZoneCharacter(zone[i])) continue;
3731
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
3732
+ i += 2;
3733
+ continue;
3734
+ }
3735
+ return false;
3736
+ }
3690
3737
  return true;
3691
3738
  }
3692
3739
  /**
3693
- * @param {Array<string>} buffer
3694
- * @param {Array<string>} address
3695
- * @param {GetIPV6Result} output
3696
- * @returns {boolean}
3740
+ * Compresses the longest run of zero hextets to "::" per RFC 5952. A run of a
3741
+ * single zero hextet is left uncompressed. On ties the leftmost run wins.
3742
+ *
3743
+ * @param {string[]} hextets
3744
+ * @returns {string}
3697
3745
  */
3698
- function consumeHextets(buffer, address, output) {
3699
- if (buffer.length) {
3700
- const hex = stringArrayToHexStripped(buffer);
3701
- if (hex !== "") address.push(hex);
3702
- else {
3703
- output.error = true;
3704
- return false;
3746
+ function compressIPv6ZeroRun(hextets) {
3747
+ let bestStart = -1;
3748
+ let bestLength = 0;
3749
+ let runStart = -1;
3750
+ let runLength = 0;
3751
+ for (let i = 0; i < hextets.length; i++) if (hextets[i] === "0") {
3752
+ if (runStart === -1) runStart = i;
3753
+ runLength++;
3754
+ if (runLength > bestLength) {
3755
+ bestLength = runLength;
3756
+ bestStart = runStart;
3705
3757
  }
3706
- buffer.length = 0;
3758
+ } else {
3759
+ runStart = -1;
3760
+ runLength = 0;
3707
3761
  }
3708
- return true;
3762
+ if (bestLength < 2) return hextets.join(":");
3763
+ const head = hextets.slice(0, bestStart).join(":");
3764
+ const tail = hextets.slice(bestStart + bestLength).join(":");
3765
+ return head + "::" + tail;
3709
3766
  }
3710
3767
  /**
3768
+ * Validates an IPv6 address against the alternatives in RFC 3986 section
3769
+ * 3.2.2 and returns the same address with leading hextet zeroes removed.
3770
+ * An embedded IPv4 address counts as two hextets and is only valid at the end.
3771
+ *
3711
3772
  * @param {string} input
3712
- * @returns {GetIPV6Result}
3773
+ * @returns {string|undefined}
3713
3774
  */
3714
- function getIPV6(input) {
3715
- let tokenCount = 0;
3716
- const output = {
3717
- error: false,
3718
- address: "",
3719
- zone: ""
3720
- };
3721
- /** @type {Array<string>} */
3722
- const address = [];
3723
- /** @type {Array<string>} */
3724
- const buffer = [];
3725
- let endipv6Encountered = false;
3726
- let endIpv6 = false;
3727
- let consume = consumeHextets;
3728
- for (let i = 0; i < input.length; i++) {
3729
- const cursor = input[i];
3730
- if (cursor === "[" || cursor === "]") continue;
3731
- if (cursor === ":") {
3732
- if (endipv6Encountered === true) endIpv6 = true;
3733
- if (!consume(buffer, address, output)) break;
3734
- if (++tokenCount > 7) {
3735
- output.error = true;
3736
- break;
3737
- }
3738
- if (i > 0 && input[i - 1] === ":") endipv6Encountered = true;
3739
- address.push(":");
3740
- continue;
3741
- } else if (cursor === "%") {
3742
- if (!consume(buffer, address, output)) break;
3743
- consume = consumeIsZone;
3744
- } else {
3745
- buffer.push(cursor);
3775
+ function normalizeIPv6Address(input) {
3776
+ const compression = input.indexOf("::");
3777
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
3778
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
3779
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
3780
+ if (compression !== -1) {
3781
+ if (left.length === 1 && left[0] === "") left.length = 0;
3782
+ if (right.length === 1 && right[0] === "") right.length = 0;
3783
+ }
3784
+ const parts = left.concat(right);
3785
+ let hextetCount = 0;
3786
+ for (let i = 0; i < parts.length; i++) {
3787
+ const part = parts[i];
3788
+ if (part === "") return void 0;
3789
+ if (part.indexOf(".") !== -1) {
3790
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
3791
+ hextetCount += 2;
3746
3792
  continue;
3747
3793
  }
3794
+ if (!isHextet(part)) return void 0;
3795
+ parts[i] = parseInt(part, 16).toString(16);
3796
+ hextetCount++;
3748
3797
  }
3749
- if (buffer.length) if (consume === consumeIsZone) output.zone = buffer.join("");
3750
- else if (endIpv6) address.push(buffer.join(""));
3751
- else address.push(stringArrayToHexStripped(buffer));
3752
- output.address = address.join("");
3753
- return output;
3798
+ if (compression === -1) {
3799
+ if (hextetCount !== 8) return void 0;
3800
+ return compressIPv6ZeroRun(parts);
3801
+ }
3802
+ if (hextetCount >= 8) return void 0;
3803
+ const expanded = parts.slice(0, left.length);
3804
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
3805
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
3806
+ return compressIPv6ZeroRun(expanded);
3754
3807
  }
3755
3808
  /**
3756
3809
  * @typedef {Object} NormalizeIPv6Result
3757
3810
  * @property {string} host - The normalized host.
3758
3811
  * @property {string} [escapedHost] - The escaped host.
3759
3812
  * @property {boolean} isIPV6 - Indicates if the host is an IPv6 address.
3813
+ * @property {boolean} [isIPVFuture] - Indicates if the host is an IPvFuture literal.
3814
+ * @property {boolean} [error] - Indicates if a bracketed IP literal is malformed.
3760
3815
  */
3761
3816
  /**
3817
+ * Validates and normalizes a bracketed IP literal. Raw zone separators remain
3818
+ * accepted for backwards compatibility, while encoded separators and zone
3819
+ * contents follow RFC 6874.
3820
+ *
3762
3821
  * @param {string} host
3763
3822
  * @returns {NormalizeIPv6Result}
3764
3823
  */
3765
3824
  function normalizeIPv6(host) {
3766
- if (findToken(host, ":") < 2) return {
3825
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
3826
+ if ((host[0] === "[" || host[host.length - 1] === "]") && !bracketed) return {
3767
3827
  host,
3768
- isIPV6: false
3828
+ isIPV6: false,
3829
+ error: true
3769
3830
  };
3770
- const ipv6 = getIPV6(host);
3771
- if (!ipv6.error) {
3772
- let newHost = ipv6.address;
3773
- let escapedHost = ipv6.address;
3774
- if (ipv6.zone) {
3775
- newHost += "%" + ipv6.zone;
3776
- escapedHost += "%25" + ipv6.zone;
3777
- }
3831
+ let input = bracketed ? host.slice(1, -1) : host;
3832
+ if (bracketed && isIPvFuture(input)) {
3833
+ input = input.toLowerCase();
3778
3834
  return {
3779
- host: newHost,
3780
- isIPV6: true,
3781
- escapedHost
3835
+ host: `[${input}]`,
3836
+ escapedHost: input,
3837
+ isIPV6: false,
3838
+ isIPVFuture: true
3782
3839
  };
3783
- } else return {
3840
+ }
3841
+ if (findToken(input, ":") < 2) return {
3842
+ host,
3843
+ isIPV6: false,
3844
+ error: bracketed
3845
+ };
3846
+ let zoneIdentifier = "";
3847
+ const zoneSeparator = input.indexOf("%");
3848
+ if (zoneSeparator !== -1) {
3849
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
3850
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
3851
+ if (!isZoneIdentifier(zoneIdentifier)) return {
3852
+ host,
3853
+ isIPV6: false,
3854
+ error: true
3855
+ };
3856
+ input = input.slice(0, zoneSeparator);
3857
+ }
3858
+ const address = normalizeIPv6Address(input);
3859
+ if (address === void 0) return {
3784
3860
  host,
3785
- isIPV6: false
3861
+ isIPV6: false,
3862
+ error: true
3863
+ };
3864
+ return {
3865
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
3866
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
3867
+ isIPV6: true
3786
3868
  };
3787
3869
  }
3788
3870
  /**
@@ -3807,15 +3889,16 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3807
3889
  let nextSlash = -1;
3808
3890
  let len = 0;
3809
3891
  while (len = input.length) {
3810
- if (len === 1) if (input === ".") break;
3811
- else if (input === "/") {
3812
- output.push("/");
3813
- break;
3814
- } else {
3815
- output.push(input);
3816
- break;
3817
- }
3818
- else if (len === 2) {
3892
+ if (len === 1) {
3893
+ if (input === ".") break;
3894
+ else if (input === "/") {
3895
+ output.push("/");
3896
+ break;
3897
+ } else {
3898
+ output.push(input);
3899
+ break;
3900
+ }
3901
+ } else if (len === 2) {
3819
3902
  if (input[0] === ".") {
3820
3903
  if (input[1] === ".") break;
3821
3904
  else if (input[1] === "/") {
@@ -3895,7 +3978,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3895
3978
  }
3896
3979
  /**
3897
3980
  * Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
3898
- * Reserved delimiters such as `%2F` and `%2E` stay escaped.
3981
+ * Reserved delimiters such as `%2F` stay escaped; `%2E` is unreserved.
3899
3982
  *
3900
3983
  * @param {string} input
3901
3984
  * @param {boolean} [decodeUnreserved=false]
@@ -3931,7 +4014,8 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3931
4014
  function normalizePathEncoding(input) {
3932
4015
  let output = "";
3933
4016
  for (let i = 0; i < input.length; i++) {
3934
- if (input[i] === "%" && i + 2 < input.length) {
4017
+ const ch = input[i];
4018
+ if (ch === "%" && i + 2 < input.length) {
3935
4019
  const hex = input.slice(i + 1, i + 3);
3936
4020
  if (isHexPair(hex)) {
3937
4021
  const normalizedHex = hex.toUpperCase();
@@ -3942,8 +4026,168 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3942
4026
  continue;
3943
4027
  }
3944
4028
  }
3945
- if (isPathCharacter(input[i])) output += input[i];
3946
- else output += escape(input[i]);
4029
+ if (isPathCharacter(ch)) output += ch;
4030
+ else {
4031
+ const code = input.charCodeAt(i);
4032
+ if (code < 128) output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
4033
+ else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
4034
+ else if (code <= 56319 && i + 1 < input.length) {
4035
+ const low = input.charCodeAt(i + 1);
4036
+ if (low >= 56320 && low <= 57343) {
4037
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
4038
+ i++;
4039
+ } else output += percentEncodeNonAscii(65533);
4040
+ } else output += percentEncodeNonAscii(65533);
4041
+ }
4042
+ }
4043
+ return output;
4044
+ }
4045
+ /**
4046
+ * Serializes a path without rewriting reserved data. Raw RFC 3986 path
4047
+ * characters remain literal, valid escapes are preserved and uppercased, and
4048
+ * everything else is UTF-8 percent-encoded. In a path-noscheme, a colon in the
4049
+ * first segment must be escaped so the result cannot be parsed as a scheme.
4050
+ *
4051
+ * @param {string} input
4052
+ * @param {boolean} [pathNoScheme=false]
4053
+ * @returns {string}
4054
+ */
4055
+ function serializePathEncoding(input, pathNoScheme = false) {
4056
+ let output = "";
4057
+ let firstSegment = pathNoScheme && input[0] !== "/";
4058
+ for (let i = 0; i < input.length; i++) {
4059
+ const ch = input[i];
4060
+ if (ch === "%" && i + 2 < input.length) {
4061
+ const hex = input.slice(i + 1, i + 3);
4062
+ if (isHexPair(hex)) {
4063
+ output += "%" + hex.toUpperCase();
4064
+ i += 2;
4065
+ continue;
4066
+ }
4067
+ }
4068
+ if (ch === "/") firstSegment = false;
4069
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) output += ch;
4070
+ else {
4071
+ const code = input.charCodeAt(i);
4072
+ if (code < 128) output += BYTE_HEX[code];
4073
+ else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
4074
+ else if (code <= 56319 && i + 1 < input.length) {
4075
+ const low = input.charCodeAt(i + 1);
4076
+ if (low >= 56320 && low <= 57343) {
4077
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
4078
+ i++;
4079
+ } else output += percentEncodeNonAscii(65533);
4080
+ } else output += percentEncodeNonAscii(65533);
4081
+ }
4082
+ }
4083
+ return output;
4084
+ }
4085
+ /**
4086
+ * Percent-encodes a URI component using its RFC 3986 literal character set.
4087
+ * Existing valid escapes are preserved and normalized to uppercase hex.
4088
+ *
4089
+ * @param {string} input
4090
+ * @param {(value: string) => boolean} isAllowed
4091
+ * @returns {string}
4092
+ */
4093
+ function encodeComponent(input, isAllowed) {
4094
+ let output = "";
4095
+ for (let i = 0; i < input.length; i++) {
4096
+ const ch = input[i];
4097
+ if (ch === "%" && i + 2 < input.length) {
4098
+ const hex = input.slice(i + 1, i + 3);
4099
+ if (isHexPair(hex)) {
4100
+ output += "%" + hex.toUpperCase();
4101
+ i += 2;
4102
+ continue;
4103
+ }
4104
+ }
4105
+ if (isAllowed(ch)) output += ch;
4106
+ else {
4107
+ const code = input.charCodeAt(i);
4108
+ if (code < 128) output += BYTE_HEX[code];
4109
+ else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
4110
+ else if (code <= 56319 && i + 1 < input.length) {
4111
+ const low = input.charCodeAt(i + 1);
4112
+ if (low >= 56320 && low <= 57343) {
4113
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
4114
+ i++;
4115
+ } else output += percentEncodeNonAscii(65533);
4116
+ } else output += percentEncodeNonAscii(65533);
4117
+ }
4118
+ }
4119
+ return output;
4120
+ }
4121
+ /**
4122
+ * Encodes userinfo while preserving its RFC 3986 §3.2.1 literal characters.
4123
+ * In particular, authority delimiters such as `@`, `/`, `?`, and `#` are data.
4124
+ *
4125
+ * @param {string} input
4126
+ * @returns {string}
4127
+ */
4128
+ function encodeUserinfo(input) {
4129
+ return encodeComponent(input, isUserinfoCharacter);
4130
+ }
4131
+ /**
4132
+ * Encodes query data using the RFC 3986 §3.4 grammar. A literal `#` must be
4133
+ * escaped because it would otherwise begin the fragment component.
4134
+ *
4135
+ * @param {string} input
4136
+ * @returns {string}
4137
+ */
4138
+ function encodeQuery(input) {
4139
+ return encodeComponent(input, isQueryFragmentCharacter);
4140
+ }
4141
+ /**
4142
+ * Encodes fragment data using the RFC 3986 §3.5 grammar.
4143
+ *
4144
+ * @param {string} input
4145
+ * @returns {string}
4146
+ */
4147
+ function encodeFragment(input) {
4148
+ return encodeComponent(input, isQueryFragmentCharacter);
4149
+ }
4150
+ function isEscapeSafe(cp) {
4151
+ return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
4152
+ }
4153
+ /**
4154
+ * Normalizes the percent-encoding of a query or fragment component.
4155
+ *
4156
+ * Like `normalizePathEncoding`, but uses the query/fragment character set
4157
+ * (which additionally allows `?`) and decodes `.` since it has no dot-segment
4158
+ * meaning outside of a path.
4159
+ *
4160
+ * @param {string} input
4161
+ * @returns {string}
4162
+ */
4163
+ function normalizeQueryFragmentEncoding(input) {
4164
+ let output = "";
4165
+ for (let i = 0; i < input.length; i++) {
4166
+ const ch = input[i];
4167
+ if (ch === "%" && i + 2 < input.length) {
4168
+ const hex = input.slice(i + 1, i + 3);
4169
+ if (isHexPair(hex)) {
4170
+ const normalizedHex = hex.toUpperCase();
4171
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
4172
+ if (isUnreserved(decoded)) output += decoded;
4173
+ else output += "%" + normalizedHex;
4174
+ i += 2;
4175
+ continue;
4176
+ }
4177
+ }
4178
+ if (isQueryFragmentCharacter(ch)) output += ch;
4179
+ else {
4180
+ const code = input.charCodeAt(i);
4181
+ if (code < 128) output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
4182
+ else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
4183
+ else if (code <= 56319 && i + 1 < input.length) {
4184
+ const low = input.charCodeAt(i + 1);
4185
+ if (low >= 56320 && low <= 57343) {
4186
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
4187
+ i++;
4188
+ } else output += percentEncodeNonAscii(65533);
4189
+ } else output += percentEncodeNonAscii(65533);
4190
+ }
3947
4191
  }
3948
4192
  return output;
3949
4193
  }
@@ -3975,21 +4219,27 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3975
4219
  function recomposeAuthority(component) {
3976
4220
  const uriTokens = [];
3977
4221
  if (component.userinfo !== void 0) {
3978
- uriTokens.push(component.userinfo);
4222
+ uriTokens.push(encodeUserinfo(component.userinfo));
3979
4223
  uriTokens.push("@");
3980
4224
  }
3981
4225
  if (component.host !== void 0) {
3982
- let host = unescape(component.host);
4226
+ let host = component.host;
3983
4227
  if (!isIPv4(host)) {
3984
- const ipV6res = normalizeIPv6(host);
3985
- if (ipV6res.isIPV6 === true) host = `[${ipV6res.escapedHost}]`;
4228
+ let ipV6res = normalizeIPv6(host);
4229
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
4230
+ host = normalizePercentEncoding(host, true);
4231
+ ipV6res = normalizeIPv6(host);
4232
+ }
4233
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) host = `[${ipV6res.escapedHost}]`;
3986
4234
  else host = reescapeHostDelimiters(host, false);
3987
4235
  }
3988
4236
  uriTokens.push(host);
3989
4237
  }
3990
4238
  if (typeof component.port === "number" || typeof component.port === "string") {
4239
+ const port = String(component.port);
4240
+ if (!isPort(port)) throw new TypeError("URI port is malformed.");
3991
4241
  uriTokens.push(":");
3992
- uriTokens.push(String(component.port));
4242
+ uriTokens.push(port);
3993
4243
  }
3994
4244
  return uriTokens.length ? uriTokens.join("") : void 0;
3995
4245
  }
@@ -3999,6 +4249,11 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3999
4249
  reescapeHostDelimiters,
4000
4250
  normalizePercentEncoding,
4001
4251
  normalizePathEncoding,
4252
+ serializePathEncoding,
4253
+ normalizeQueryFragmentEncoding,
4254
+ encodeUserinfo,
4255
+ encodeQuery,
4256
+ encodeFragment,
4002
4257
  escapePreservingEscapes,
4003
4258
  removeDotSegments,
4004
4259
  isIPv4,
@@ -4008,10 +4263,10 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4008
4263
  };
4009
4264
  }));
4010
4265
  //#endregion
4011
- //#region ../../node_modules/.pnpm/fast-uri@3.1.3/node_modules/fast-uri/lib/schemes.js
4266
+ //#region ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js
4012
4267
  var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4013
4268
  const { isUUID } = require_utils();
4014
- const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
4269
+ const URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
4015
4270
  const supportedSchemeNames = [
4016
4271
  "http",
4017
4272
  "https",
@@ -4082,9 +4337,10 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4082
4337
  wsComponent.secure = void 0;
4083
4338
  }
4084
4339
  if (wsComponent.resourceName) {
4085
- const [path, query] = wsComponent.resourceName.split("?");
4340
+ const queryIndex = wsComponent.resourceName.indexOf("?");
4341
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
4086
4342
  wsComponent.path = path && path !== "/" ? path : void 0;
4087
- wsComponent.query = query;
4343
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
4088
4344
  wsComponent.resourceName = void 0;
4089
4345
  }
4090
4346
  wsComponent.fragment = void 0;
@@ -4097,7 +4353,7 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4097
4353
  return urnComponent;
4098
4354
  }
4099
4355
  const matches = urnComponent.path.match(URN_REG);
4100
- if (matches) {
4356
+ if (matches && matches[0] === urnComponent.path) {
4101
4357
  const scheme = options.scheme || urnComponent.scheme || "urn";
4102
4358
  urnComponent.nid = matches[1].toLowerCase();
4103
4359
  urnComponent.nss = matches[2];
@@ -4191,10 +4447,21 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4191
4447
  };
4192
4448
  }));
4193
4449
  //#endregion
4194
- //#region ../../node_modules/.pnpm/fast-uri@3.1.3/node_modules/fast-uri/index.js
4450
+ //#region ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js
4195
4451
  var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4196
- const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
4452
+ const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
4197
4453
  const { SCHEMES, getSchemeHandler } = require_schemes();
4454
+ const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
4455
+ const MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
4456
+ /**
4457
+ * @param {string} scheme
4458
+ * @returns {string}
4459
+ */
4460
+ function decodeValidScheme(scheme) {
4461
+ const decodedScheme = unescape(String(scheme));
4462
+ if (!VALID_SCHEME.test(decodedScheme)) throw new TypeError(MALFORMED_SCHEME_ERROR);
4463
+ return decodedScheme;
4464
+ }
4198
4465
  /**
4199
4466
  * @template {import('./types/index').URIComponent|string} T
4200
4467
  * @param {T} uri
@@ -4214,7 +4481,16 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4214
4481
  */
4215
4482
  function resolve(baseURI, relativeURI, options) {
4216
4483
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
4217
- const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
4484
+ const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed, malformedPercentEncoding: baseMalformedPercentEncoding, malformedSchemeSpecific: baseMalformedSchemeSpecific, malformedHost: baseMalformedHost, malformedScheme: baseMalformedScheme } = parseWithStatus(baseURI, schemelessOptions);
4485
+ const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed, malformedPercentEncoding: relativeMalformedPercentEncoding, malformedSchemeSpecific: relativeMalformedSchemeSpecific, malformedHost: relativeMalformedHost, malformedScheme: relativeMalformedScheme } = parseWithStatus(relativeURI, schemelessOptions);
4486
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
4487
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
4488
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
4489
+ const resolvedHost = resolved.host;
4490
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
4491
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
4492
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
4493
+ if (resolved.error && !encodedASCIIHost) throw new Error(resolved.error);
4218
4494
  schemelessOptions.skipEscape = true;
4219
4495
  return serialize(resolved, schemelessOptions);
4220
4496
  }
@@ -4280,7 +4556,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4280
4556
  function equal(uriA, uriB, options) {
4281
4557
  const normalizedA = normalizeComparableURI(uriA, options);
4282
4558
  const normalizedB = normalizeComparableURI(uriB, options);
4283
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
4559
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
4284
4560
  }
4285
4561
  /**
4286
4562
  * @param {Readonly<import('./types/index').URIComponent>} cmpts
@@ -4306,13 +4582,19 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4306
4582
  };
4307
4583
  const options = Object.assign({}, opts);
4308
4584
  const uriTokens = [];
4585
+ if (component.scheme) component.scheme = decodeValidScheme(component.scheme);
4309
4586
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
4310
4587
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
4311
- if (component.path !== void 0) if (!options.skipEscape) {
4312
- component.path = escapePreservingEscapes(component.path);
4313
- if (component.scheme !== void 0) component.path = component.path.split("%3A").join(":");
4314
- } else component.path = normalizePercentEncoding(component.path);
4315
- if (options.reference !== "suffix" && component.scheme) uriTokens.push(component.scheme, ":");
4588
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
4589
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
4590
+ if (component.path !== void 0) {
4591
+ if (!options.skipEscape) component.path = serializePathEncoding(component.path, pathNoScheme);
4592
+ else component.path = normalizePercentEncoding(component.path);
4593
+ }
4594
+ if (options.reference !== "suffix" && component.scheme) {
4595
+ component.scheme = decodeValidScheme(component.scheme);
4596
+ uriTokens.push(component.scheme, ":");
4597
+ }
4316
4598
  const authority = recomposeAuthority(component);
4317
4599
  if (authority !== void 0) {
4318
4600
  if (options.reference !== "suffix") uriTokens.push("//");
@@ -4322,14 +4604,17 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4322
4604
  if (component.path !== void 0) {
4323
4605
  let s = component.path;
4324
4606
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) s = removeDotSegments(s);
4607
+ if (pathNoScheme) s = serializePathEncoding(s, true);
4325
4608
  if (authority === void 0 && s[0] === "/" && s[1] === "/") s = "/%2F" + s.slice(2);
4326
4609
  uriTokens.push(s);
4327
4610
  }
4328
- if (component.query !== void 0) uriTokens.push("?", component.query);
4329
- if (component.fragment !== void 0) uriTokens.push("#", component.fragment);
4611
+ if (component.query !== void 0) uriTokens.push("?", encodeQuery(component.query));
4612
+ if (component.fragment !== void 0) uriTokens.push("#", encodeFragment(component.fragment));
4330
4613
  return uriTokens.join("");
4331
4614
  }
4332
4615
  const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
4616
+ const AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
4617
+ const AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
4333
4618
  /**
4334
4619
  * @param {import('./types/index').URIComponent} parsed
4335
4620
  * @param {RegExpMatchArray} matches
@@ -4340,9 +4625,61 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4340
4625
  if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) return "URI port is malformed.";
4341
4626
  }
4342
4627
  /**
4628
+ * Checks percent syntax without decoding the represented octets. RFC 3986
4629
+ * percent-encoding is byte-oriented, so sequences such as `%FF` are valid even
4630
+ * though they are not independently valid UTF-8.
4631
+ *
4632
+ * @param {string|undefined} component
4633
+ * @returns {boolean}
4634
+ */
4635
+ function hasMalformedPercentEncoding(component) {
4636
+ if (component === void 0) return false;
4637
+ let percent = component.indexOf("%");
4638
+ while (percent !== -1) {
4639
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) return true;
4640
+ percent = component.indexOf("%", percent + 3);
4641
+ }
4642
+ return false;
4643
+ }
4644
+ /**
4645
+ * Whether the host is a bracketed IP literal (RFC 3986 `IP-literal`).
4646
+ * An unterminated `[` is not a literal, so it must still be validated as a
4647
+ * reg-name instead of being waved through as an IP.
4648
+ *
4649
+ * @param {string} host
4650
+ * @returns {boolean}
4651
+ */
4652
+ function isIPLiteral(host) {
4653
+ return host[0] === "[" && host[host.length - 1] === "]";
4654
+ }
4655
+ /**
4656
+ * @param {RegExpMatchArray} matches
4657
+ * @returns {boolean}
4658
+ */
4659
+ function hasMalformedComponentPercentEncoding(matches) {
4660
+ const host = matches[4];
4661
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4662
+ }
4663
+ /**
4664
+ * @param {import('./types/index').URIComponent} parsed
4665
+ * @param {import('./types/index').Options} options
4666
+ * @param {{ domainHost?: boolean, unicodeSupport?: boolean }|undefined} schemeHandler
4667
+ * @param {boolean} isIP
4668
+ * @returns {boolean} whether host conversion failed
4669
+ */
4670
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4671
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) try {
4672
+ parsed.host = new URL("http://" + parsed.host).hostname;
4673
+ } catch (e) {
4674
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4675
+ return true;
4676
+ }
4677
+ return false;
4678
+ }
4679
+ /**
4343
4680
  * @param {string} uri
4344
4681
  * @param {import('./types/index').Options} [opts]
4345
- * @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean }}
4682
+ * @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
4346
4683
  */
4347
4684
  function parseWithStatus(uri, opts) {
4348
4685
  const options = Object.assign({}, opts);
@@ -4357,9 +4694,35 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4357
4694
  fragment: void 0
4358
4695
  };
4359
4696
  let malformedAuthorityOrPort = false;
4697
+ let malformedPercentEncoding = false;
4698
+ let malformedSchemeSpecific = false;
4699
+ let malformedHost = false;
4700
+ let malformedIPLiteral = false;
4701
+ let malformedScheme = false;
4360
4702
  let isIP = false;
4361
- if (options.reference === "suffix") if (options.scheme) uri = options.scheme + ":" + uri;
4362
- else uri = "//" + uri;
4703
+ if (options.reference === "suffix") {
4704
+ if (options.scheme) uri = options.scheme + ":" + uri;
4705
+ else uri = "//" + uri;
4706
+ }
4707
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
4708
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
4709
+ parsed.error = "URI authority must not contain a literal backslash.";
4710
+ malformedAuthorityOrPort = true;
4711
+ }
4712
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
4713
+ if (introducerMatch !== null) {
4714
+ const region = introducerMatch[1];
4715
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
4716
+ if (normalizedRegion.length >= 2) {
4717
+ if (normalizedRegion.slice(0, 2) !== "//") {
4718
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
4719
+ malformedAuthorityOrPort = true;
4720
+ } else if (region.length !== normalizedRegion.length) {
4721
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
4722
+ malformedAuthorityOrPort = true;
4723
+ }
4724
+ }
4725
+ }
4363
4726
  const matches = uri.match(URI_PARSE);
4364
4727
  if (matches) {
4365
4728
  parsed.scheme = matches[1];
@@ -4369,47 +4732,65 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4369
4732
  parsed.path = matches[6] || "";
4370
4733
  parsed.query = matches[7];
4371
4734
  parsed.fragment = matches[8];
4735
+ if (parsed.scheme !== void 0) {
4736
+ const decodedScheme = unescape(parsed.scheme);
4737
+ if (VALID_SCHEME.test(decodedScheme)) parsed.scheme = decodedScheme.toLowerCase();
4738
+ else {
4739
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4740
+ malformedScheme = true;
4741
+ }
4742
+ }
4743
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
4744
+ if (malformedPercentEncoding) parsed.error = parsed.error || "URI contains malformed percent-encoding.";
4372
4745
  if (isNaN(parsed.port)) parsed.port = matches[5];
4373
4746
  const parseError = getParseError(parsed, matches);
4374
4747
  if (parseError !== void 0) {
4375
4748
  parsed.error = parsed.error || parseError;
4376
4749
  malformedAuthorityOrPort = true;
4377
4750
  }
4378
- if (parsed.host) if (isIPv4(parsed.host) === false) {
4379
- const ipv6result = normalizeIPv6(parsed.host);
4380
- parsed.host = ipv6result.host.toLowerCase();
4381
- isIP = ipv6result.isIPV6;
4382
- } else isIP = true;
4751
+ if (parsed.host) {
4752
+ if (isIPv4(parsed.host) === false) {
4753
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
4754
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
4755
+ const ipv6result = normalizeIPv6(parsed.host);
4756
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
4757
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4758
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4759
+ if (malformedIPLiteral) {
4760
+ parsed.error = parsed.error || "URI host is malformed.";
4761
+ malformedAuthorityOrPort = true;
4762
+ }
4763
+ } else isIP = true;
4764
+ }
4383
4765
  if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && parsed.query === void 0 && !parsed.path) parsed.reference = "same-document";
4384
4766
  else if (parsed.scheme === void 0) parsed.reference = "relative";
4385
4767
  else if (parsed.fragment === void 0) parsed.reference = "absolute";
4386
4768
  else parsed.reference = "uri";
4387
4769
  if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
4388
4770
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
4389
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
4390
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) try {
4391
- parsed.host = new URL("http://" + parsed.host).hostname;
4392
- } catch (e) {
4393
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4394
- }
4771
+ if (!malformedIPLiteral) malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4772
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4773
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4774
+ if (!isIP) host = normalizePercentEncoding(host.toLowerCase());
4775
+ parsed.host = reescapeHostDelimiters(host, isIP);
4395
4776
  }
4396
4777
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4397
- if (uri.indexOf("%") !== -1) {
4398
- if (parsed.scheme !== void 0) parsed.scheme = unescape(parsed.scheme);
4399
- if (parsed.host !== void 0) parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
4400
- }
4401
4778
  if (parsed.path) parsed.path = normalizePathEncoding(parsed.path);
4402
- if (parsed.fragment) try {
4403
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
4404
- } catch {
4405
- parsed.error = parsed.error || "URI malformed";
4406
- }
4779
+ if (parsed.query) parsed.query = normalizeQueryFragmentEncoding(parsed.query);
4780
+ if (parsed.fragment) parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
4781
+ }
4782
+ if (schemeHandler && schemeHandler.parse) {
4783
+ schemeHandler.parse(parsed, options);
4784
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) malformedSchemeSpecific = true;
4407
4785
  }
4408
- if (schemeHandler && schemeHandler.parse) schemeHandler.parse(parsed, options);
4409
4786
  } else parsed.error = parsed.error || "URI can not be parsed.";
4410
4787
  return {
4411
4788
  parsed,
4412
- malformedAuthorityOrPort
4789
+ malformedAuthorityOrPort,
4790
+ malformedPercentEncoding,
4791
+ malformedSchemeSpecific,
4792
+ malformedHost,
4793
+ malformedScheme
4413
4794
  };
4414
4795
  }
4415
4796
  /**
@@ -4431,13 +4812,17 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4431
4812
  /**
4432
4813
  * @param {string} uri
4433
4814
  * @param {import('./types/index').Options} [opts]
4434
- * @returns {{ normalized: string, malformedAuthorityOrPort: boolean }}
4815
+ * @returns {{ normalized: string, malformedAuthorityOrPort: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
4435
4816
  */
4436
4817
  function normalizeStringWithStatus(uri, opts) {
4437
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
4818
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
4438
4819
  return {
4439
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
4440
- malformedAuthorityOrPort
4820
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
4821
+ malformedAuthorityOrPort,
4822
+ malformedPercentEncoding,
4823
+ malformedSchemeSpecific,
4824
+ malformedHost,
4825
+ malformedScheme
4441
4826
  };
4442
4827
  }
4443
4828
  /**
@@ -4446,11 +4831,15 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4446
4831
  * @returns {string|undefined}
4447
4832
  */
4448
4833
  function normalizeComparableURI(uri, opts) {
4449
- if (typeof uri === "string") {
4450
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
4451
- return malformedAuthorityOrPort ? void 0 : normalized;
4834
+ if (typeof uri !== "string" && typeof uri !== "object") return;
4835
+ let value;
4836
+ try {
4837
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
4838
+ } catch {
4839
+ return;
4452
4840
  }
4453
- if (typeof uri === "object") return serialize(uri, opts);
4841
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
4842
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
4454
4843
  }
4455
4844
  const fastUri = {
4456
4845
  SCHEMES,
@@ -4539,7 +4928,7 @@ var require_core$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
4539
4928
  "useDefaults",
4540
4929
  "coerceTypes"
4541
4930
  ];
4542
- const EXT_SCOPE_NAMES = new Set([
4931
+ const EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
4543
4932
  "validate",
4544
4933
  "serialize",
4545
4934
  "parse",
@@ -5139,17 +5528,21 @@ var require_ref = /* @__PURE__ */ __commonJSMin(((exports) => {
5139
5528
  var _a;
5140
5529
  if (!it.opts.unevaluated) return;
5141
5530
  const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;
5142
- if (it.props !== true) if (schEvaluated && !schEvaluated.dynamicProps) {
5143
- if (schEvaluated.props !== void 0) it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props);
5144
- } else {
5145
- const props = gen.var("props", (0, codegen_1._)`${source}.evaluated.props`);
5146
- it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name);
5531
+ if (it.props !== true) {
5532
+ if (schEvaluated && !schEvaluated.dynamicProps) {
5533
+ if (schEvaluated.props !== void 0) it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props);
5534
+ } else {
5535
+ const props = gen.var("props", (0, codegen_1._)`${source}.evaluated.props`);
5536
+ it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name);
5537
+ }
5147
5538
  }
5148
- if (it.items !== true) if (schEvaluated && !schEvaluated.dynamicItems) {
5149
- if (schEvaluated.items !== void 0) it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);
5150
- } else {
5151
- const items = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`);
5152
- it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);
5539
+ if (it.items !== true) {
5540
+ if (schEvaluated && !schEvaluated.dynamicItems) {
5541
+ if (schEvaluated.items !== void 0) it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);
5542
+ } else {
5543
+ const items = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`);
5544
+ it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);
5545
+ }
5153
5546
  }
5154
5547
  }
5155
5548
  }
@@ -7127,7 +7520,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7127
7520
  exports.default = formatsPlugin;
7128
7521
  }));
7129
7522
  //#endregion
7130
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
7523
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_@cfworker+json-schema@4.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
7131
7524
  var import_ajv = /* @__PURE__ */ __toESM(require_ajv(), 1);
7132
7525
  var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
7133
7526
  function createDefaultAjvInstance() {
@@ -7203,7 +7596,7 @@ var AjvJsonSchemaValidator = class {
7203
7596
  }
7204
7597
  };
7205
7598
  //#endregion
7206
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
7599
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_@cfworker+json-schema@4.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
7207
7600
  /**
7208
7601
  * Experimental client task features for MCP SDK.
7209
7602
  * WARNING: These APIs are experimental and may change without notice.
@@ -7376,7 +7769,7 @@ var ExperimentalClientTasks = class {
7376
7769
  }
7377
7770
  };
7378
7771
  //#endregion
7379
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
7772
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_@cfworker+json-schema@4.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
7380
7773
  /**
7381
7774
  * Experimental task capability assertion helpers.
7382
7775
  * WARNING: These APIs are experimental and may change without notice.
@@ -7397,10 +7790,7 @@ var ExperimentalClientTasks = class {
7397
7790
  function assertToolsCallTaskCapability(requests, method, entityName) {
7398
7791
  if (!requests) throw new Error(`${entityName} does not support task creation (required for ${method})`);
7399
7792
  switch (method) {
7400
- case "tools/call":
7401
- if (!requests.tools?.call) throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);
7402
- break;
7403
- default: break;
7793
+ case "tools/call": if (!requests.tools?.call) throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);
7404
7794
  }
7405
7795
  }
7406
7796
  /**
@@ -7420,14 +7810,11 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
7420
7810
  case "sampling/createMessage":
7421
7811
  if (!requests.sampling?.createMessage) throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);
7422
7812
  break;
7423
- case "elicitation/create":
7424
- if (!requests.elicitation?.create) throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
7425
- break;
7426
- default: break;
7813
+ case "elicitation/create": if (!requests.elicitation?.create) throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
7427
7814
  }
7428
7815
  }
7429
7816
  //#endregion
7430
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
7817
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_@cfworker+json-schema@4.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
7431
7818
  /**
7432
7819
  * Elicitation default application helper. Applies defaults to the data based on the schema.
7433
7820
  *
@@ -7695,21 +8082,12 @@ var Client = class extends Protocol {
7695
8082
  case "tools/list":
7696
8083
  if (!this._serverCapabilities?.tools) throw new Error(`Server does not support tools (required for ${method})`);
7697
8084
  break;
7698
- case "completion/complete":
7699
- if (!this._serverCapabilities?.completions) throw new Error(`Server does not support completions (required for ${method})`);
7700
- break;
7701
- case "initialize": break;
7702
- case "ping": break;
8085
+ case "completion/complete": if (!this._serverCapabilities?.completions) throw new Error(`Server does not support completions (required for ${method})`);
7703
8086
  }
7704
8087
  }
7705
8088
  assertNotificationCapability(method) {
7706
8089
  switch (method) {
7707
- case "notifications/roots/list_changed":
7708
- if (!this._capabilities.roots?.listChanged) throw new Error(`Client does not support roots list changed notifications (required for ${method})`);
7709
- break;
7710
- case "notifications/initialized": break;
7711
- case "notifications/cancelled": break;
7712
- case "notifications/progress": break;
8090
+ case "notifications/roots/list_changed": if (!this._capabilities.roots?.listChanged) throw new Error(`Client does not support roots list changed notifications (required for ${method})`);
7713
8091
  }
7714
8092
  }
7715
8093
  assertRequestHandlerCapability(method) {
@@ -7727,10 +8105,7 @@ var Client = class extends Protocol {
7727
8105
  case "tasks/get":
7728
8106
  case "tasks/list":
7729
8107
  case "tasks/result":
7730
- case "tasks/cancel":
7731
- if (!this._capabilities.tasks) throw new Error(`Client does not support tasks capability (required for ${method})`);
7732
- break;
7733
- case "ping": break;
8108
+ case "tasks/cancel": if (!this._capabilities.tasks) throw new Error(`Client does not support tasks capability (required for ${method})`);
7734
8109
  }
7735
8110
  }
7736
8111
  assertTaskCapability(method) {
@@ -7880,9 +8255,11 @@ var Client = class extends Protocol {
7880
8255
  return;
7881
8256
  }
7882
8257
  try {
7883
- onChanged(null, await fetcher());
8258
+ const items = await fetcher();
8259
+ onChanged(null, items);
7884
8260
  } catch (e) {
7885
- onChanged(e instanceof Error ? e : new Error(String(e)), null);
8261
+ const error = e instanceof Error ? e : new Error(String(e));
8262
+ onChanged(error, null);
7886
8263
  }
7887
8264
  };
7888
8265
  const handler = () => {