@opentiny/webmcp-cli 0.1.0 → 0.1.1-alpha.1

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.
@@ -1871,8 +1871,8 @@
1871
1871
  var _a;
1872
1872
  const { gen, keyword, schema, parentSchema, $data, it } = cxt;
1873
1873
  checkAsyncKeyword(it, def);
1874
- const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
1875
- const validateRef = useKeyword(gen, keyword, validate);
1874
+ const validate2 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
1875
+ const validateRef = useKeyword(gen, keyword, validate2);
1876
1876
  const valid = gen.let("valid");
1877
1877
  cxt.block$data(valid, validateKeyword);
1878
1878
  cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
@@ -2782,20 +2782,20 @@
2782
2782
  (0, keyword_1.funcKeywordCode)(cxt, def);
2783
2783
  }
2784
2784
  }
2785
- var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
2786
- var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
2785
+ var JSON_POINTER2 = /^\/(?:[^~]|~0|~1)*$/;
2786
+ var RELATIVE_JSON_POINTER2 = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
2787
2787
  function getData($data, { dataLevel, dataNames, dataPathArr }) {
2788
2788
  let jsonPointer;
2789
2789
  let data;
2790
2790
  if ($data === "")
2791
2791
  return names_1.default.rootData;
2792
2792
  if ($data[0] === "/") {
2793
- if (!JSON_POINTER.test($data))
2793
+ if (!JSON_POINTER2.test($data))
2794
2794
  throw new Error(`Invalid JSON-pointer: ${$data}`);
2795
2795
  jsonPointer = $data;
2796
2796
  data = names_1.default.rootData;
2797
2797
  } else {
2798
- const matches = RELATIVE_JSON_POINTER.exec($data);
2798
+ const matches = RELATIVE_JSON_POINTER2.exec($data);
2799
2799
  if (!matches)
2800
2800
  throw new Error(`Invalid JSON-pointer: ${$data}`);
2801
2801
  const up = +matches[1];
@@ -2945,28 +2945,28 @@
2945
2945
  if (this.opts.code.process)
2946
2946
  sourceCode = this.opts.code.process(sourceCode, sch);
2947
2947
  const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
2948
- const validate = makeValidate(this, this.scope.get());
2949
- this.scope.value(validateName, { ref: validate });
2950
- validate.errors = null;
2951
- validate.schema = sch.schema;
2952
- validate.schemaEnv = sch;
2948
+ const validate2 = makeValidate(this, this.scope.get());
2949
+ this.scope.value(validateName, { ref: validate2 });
2950
+ validate2.errors = null;
2951
+ validate2.schema = sch.schema;
2952
+ validate2.schemaEnv = sch;
2953
2953
  if (sch.$async)
2954
- validate.$async = true;
2954
+ validate2.$async = true;
2955
2955
  if (this.opts.code.source === true) {
2956
- validate.source = { validateName, validateCode, scopeValues: gen._values };
2956
+ validate2.source = { validateName, validateCode, scopeValues: gen._values };
2957
2957
  }
2958
2958
  if (this.opts.unevaluated) {
2959
2959
  const { props, items } = schemaCxt;
2960
- validate.evaluated = {
2960
+ validate2.evaluated = {
2961
2961
  props: props instanceof codegen_1.Name ? void 0 : props,
2962
2962
  items: items instanceof codegen_1.Name ? void 0 : items,
2963
2963
  dynamicProps: props instanceof codegen_1.Name,
2964
2964
  dynamicItems: items instanceof codegen_1.Name
2965
2965
  };
2966
- if (validate.source)
2967
- validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
2966
+ if (validate2.source)
2967
+ validate2.source.evaluated = (0, codegen_1.stringify)(validate2.evaluated);
2968
2968
  }
2969
- sch.validate = validate;
2969
+ sch.validate = validate2;
2970
2970
  return sch;
2971
2971
  } catch (e) {
2972
2972
  delete sch.validate;
@@ -3104,9 +3104,9 @@
3104
3104
  }
3105
3105
  });
3106
3106
 
3107
- // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js
3107
+ // ../../node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/utils.js
3108
3108
  var require_utils = __commonJS({
3109
- "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js"(exports, module) {
3109
+ "../../node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/utils.js"(exports, module) {
3110
3110
  "use strict";
3111
3111
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3112
3112
  var 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);
@@ -3338,6 +3338,37 @@
3338
3338
  }
3339
3339
  return output.join("");
3340
3340
  }
3341
+ function removeDotSegmentsRelative(path) {
3342
+ if (path === "" || path[0] === "/") {
3343
+ return removeDotSegments(path);
3344
+ }
3345
+ const segments = path.split("/");
3346
+ const last = segments.length - 1;
3347
+ const output = [];
3348
+ let trailingDirectory = false;
3349
+ for (let i = 0; i <= last; i++) {
3350
+ const segment = segments[i];
3351
+ if (segment === "." || segment === "..") {
3352
+ if (segment === "..") {
3353
+ if (output.length !== 0 && output[output.length - 1] !== "..") {
3354
+ output.pop();
3355
+ } else {
3356
+ output.push("..");
3357
+ }
3358
+ }
3359
+ trailingDirectory = i === last;
3360
+ } else {
3361
+ output.push(segment);
3362
+ }
3363
+ }
3364
+ if (trailingDirectory && output[output.length - 1] !== "..") {
3365
+ output.push("");
3366
+ }
3367
+ if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
3368
+ output.unshift(".");
3369
+ }
3370
+ return output.join("/");
3371
+ }
3341
3372
  var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3342
3373
  var HOST_DELIM_RE = /[@/?#:]/g;
3343
3374
  var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
@@ -3598,6 +3629,7 @@
3598
3629
  encodeFragment,
3599
3630
  escapePreservingEscapes,
3600
3631
  removeDotSegments,
3632
+ removeDotSegmentsRelative,
3601
3633
  isIPv4,
3602
3634
  isUUID,
3603
3635
  normalizeIPv6,
@@ -3606,9 +3638,9 @@
3606
3638
  }
3607
3639
  });
3608
3640
 
3609
- // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js
3641
+ // ../../node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/schemes.js
3610
3642
  var require_schemes = __commonJS({
3611
- "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3643
+ "../../node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3612
3644
  "use strict";
3613
3645
  var { isUUID } = require_utils();
3614
3646
  var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
@@ -3817,30 +3849,32 @@
3817
3849
  }
3818
3850
  });
3819
3851
 
3820
- // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js
3852
+ // ../../node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/index.js
3821
3853
  var require_fast_uri = __commonJS({
3822
- "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js"(exports, module) {
3854
+ "../../node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/index.js"(exports, module) {
3823
3855
  "use strict";
3824
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3856
+ var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3825
3857
  var { SCHEMES, getSchemeHandler } = require_schemes();
3826
3858
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3827
3859
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3828
- function decodeValidScheme(scheme) {
3829
- const decodedScheme = unescape(String(scheme));
3830
- if (!VALID_SCHEME.test(decodedScheme)) {
3860
+ var MALFORMED_HOST_ERROR = "URI host is malformed.";
3861
+ var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
3862
+ function validateScheme(scheme) {
3863
+ const stringScheme = String(scheme);
3864
+ if (!VALID_SCHEME.test(stringScheme)) {
3831
3865
  throw new TypeError(MALFORMED_SCHEME_ERROR);
3832
3866
  }
3833
- return decodedScheme;
3867
+ return stringScheme;
3834
3868
  }
3835
- function normalize(uri, options) {
3836
- if (typeof uri === "string") {
3837
- uri = /** @type {T} */
3838
- normalizeString(uri, options);
3839
- } else if (typeof uri === "object") {
3840
- uri = /** @type {T} */
3841
- parse2(serialize(uri, options), options);
3869
+ function normalize(uri2, options) {
3870
+ if (typeof uri2 === "string") {
3871
+ uri2 = /** @type {T} */
3872
+ normalizeString(uri2, options);
3873
+ } else if (typeof uri2 === "object") {
3874
+ uri2 = /** @type {T} */
3875
+ parse2(serialize(uri2, options), options);
3842
3876
  }
3843
- return uri;
3877
+ return uri2;
3844
3878
  }
3845
3879
  function resolve(baseURI, relativeURI, options) {
3846
3880
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
@@ -3867,6 +3901,9 @@
3867
3901
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3868
3902
  const resolvedHost = resolved.host;
3869
3903
  const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3904
+ if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
3905
+ throw new Error(MALFORMED_HOST_ERROR);
3906
+ }
3870
3907
  canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3871
3908
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3872
3909
  if (resolved.error && !encodedASCIIHost) {
@@ -3908,14 +3945,15 @@
3908
3945
  if (relative.path[0] === "/") {
3909
3946
  target.path = removeDotSegments(relative.path);
3910
3947
  } else {
3911
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
3948
+ const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
3949
+ if (baseHasAuthority && !base.path) {
3912
3950
  target.path = "/" + relative.path;
3913
3951
  } else if (!base.path) {
3914
3952
  target.path = relative.path;
3915
3953
  } else {
3916
3954
  target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3917
3955
  }
3918
- target.path = removeDotSegments(target.path);
3956
+ target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
3919
3957
  }
3920
3958
  target.query = relative.query;
3921
3959
  }
@@ -3953,12 +3991,13 @@
3953
3991
  const options = Object.assign({}, opts);
3954
3992
  const uriTokens = [];
3955
3993
  if (component.scheme) {
3956
- component.scheme = decodeValidScheme(component.scheme);
3994
+ component.scheme = validateScheme(component.scheme);
3957
3995
  }
3958
3996
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3959
3997
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3960
3998
  const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3961
- const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
3999
+ const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
4000
+ const pathNoScheme = !options.skipEscape && schemelessReference;
3962
4001
  if (component.path !== void 0) {
3963
4002
  if (!options.skipEscape) {
3964
4003
  component.path = serializePathEncoding(component.path, pathNoScheme);
@@ -3967,7 +4006,7 @@
3967
4006
  }
3968
4007
  }
3969
4008
  if (options.reference !== "suffix" && component.scheme) {
3970
- component.scheme = decodeValidScheme(component.scheme);
4009
+ component.scheme = validateScheme(component.scheme);
3971
4010
  uriTokens.push(component.scheme, ":");
3972
4011
  }
3973
4012
  const authority = recomposeAuthority(component);
@@ -3983,9 +4022,9 @@
3983
4022
  if (component.path !== void 0) {
3984
4023
  let s = component.path;
3985
4024
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3986
- s = removeDotSegments(s);
4025
+ s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
3987
4026
  }
3988
- if (pathNoScheme) {
4027
+ if (schemelessReference) {
3989
4028
  s = serializePathEncoding(s, true);
3990
4029
  }
3991
4030
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
@@ -4032,17 +4071,35 @@
4032
4071
  return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4033
4072
  }
4034
4073
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4074
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
4075
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4076
+ return true;
4077
+ }
4035
4078
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4079
+ let url2;
4036
4080
  try {
4037
- parsed.host = new URL("http://" + parsed.host).hostname;
4081
+ url2 = new URL("http://" + parsed.host);
4038
4082
  } catch (e) {
4039
4083
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4040
4084
  return true;
4041
4085
  }
4086
+ if (!isHostOnlyURL(url2)) {
4087
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4088
+ return true;
4089
+ }
4090
+ parsed.host = url2.hostname;
4042
4091
  }
4043
4092
  return false;
4044
4093
  }
4045
- function parseWithStatus(uri, opts) {
4094
+ function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
4095
+ return Boolean(
4096
+ parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
4097
+ );
4098
+ }
4099
+ function isHostOnlyURL(url2) {
4100
+ return url2.username === "" && url2.password === "" && url2.port === "" && url2.pathname === "/" && url2.search === "" && url2.hash === "" && url2.hostname !== "";
4101
+ }
4102
+ function parseWithStatus(uri2, opts) {
4046
4103
  const options = Object.assign({}, opts);
4047
4104
  const parsed = {
4048
4105
  scheme: void 0,
@@ -4062,17 +4119,17 @@
4062
4119
  let isIP = false;
4063
4120
  if (options.reference === "suffix") {
4064
4121
  if (options.scheme) {
4065
- uri = options.scheme + ":" + uri;
4122
+ uri2 = options.scheme + ":" + uri2;
4066
4123
  } else {
4067
- uri = "//" + uri;
4124
+ uri2 = "//" + uri2;
4068
4125
  }
4069
4126
  }
4070
- const authorityMatch = uri.match(AUTHORITY_PREFIX);
4127
+ const authorityMatch = uri2.match(AUTHORITY_PREFIX);
4071
4128
  if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
4072
4129
  parsed.error = "URI authority must not contain a literal backslash.";
4073
4130
  malformedAuthorityOrPort = true;
4074
4131
  }
4075
- const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
4132
+ const introducerMatch = uri2.match(AUTHORITY_INTRODUCER_REGION);
4076
4133
  if (introducerMatch !== null) {
4077
4134
  const region = introducerMatch[1];
4078
4135
  const normalizedRegion = region.replace(/[\t\n\r]/g, "");
@@ -4086,7 +4143,7 @@
4086
4143
  }
4087
4144
  }
4088
4145
  }
4089
- const matches = uri.match(URI_PARSE);
4146
+ const matches = uri2.match(URI_PARSE);
4090
4147
  if (matches) {
4091
4148
  parsed.scheme = matches[1];
4092
4149
  parsed.userinfo = matches[3];
@@ -4096,9 +4153,8 @@
4096
4153
  parsed.query = matches[7];
4097
4154
  parsed.fragment = matches[8];
4098
4155
  if (parsed.scheme !== void 0) {
4099
- const decodedScheme = unescape(parsed.scheme);
4100
- if (VALID_SCHEME.test(decodedScheme)) {
4101
- parsed.scheme = decodedScheme.toLowerCase();
4156
+ if (VALID_SCHEME.test(parsed.scheme)) {
4157
+ parsed.scheme = parsed.scheme.toLowerCase();
4102
4158
  } else {
4103
4159
  parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4104
4160
  malformedScheme = true;
@@ -4126,7 +4182,7 @@
4126
4182
  malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4127
4183
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4128
4184
  if (malformedIPLiteral) {
4129
- parsed.error = parsed.error || "URI host is malformed.";
4185
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4130
4186
  malformedAuthorityOrPort = true;
4131
4187
  }
4132
4188
  } else {
@@ -4149,12 +4205,12 @@
4149
4205
  if (!malformedIPLiteral) {
4150
4206
  malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4151
4207
  }
4152
- if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4208
+ if (uri2.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4153
4209
  let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4154
4210
  if (!isIP) {
4155
4211
  host = normalizePercentEncoding(host.toLowerCase());
4156
4212
  }
4157
- parsed.host = reescapeHostDelimiters(host, isIP);
4213
+ parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
4158
4214
  }
4159
4215
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4160
4216
  if (parsed.path) {
@@ -4178,16 +4234,16 @@
4178
4234
  }
4179
4235
  return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
4180
4236
  }
4181
- function parse2(uri, opts) {
4182
- return parseWithStatus(uri, opts).parsed;
4237
+ function parse2(uri2, opts) {
4238
+ return parseWithStatus(uri2, opts).parsed;
4183
4239
  }
4184
- function normalizeString(uri, opts) {
4185
- return normalizeStringWithStatus(uri, opts).normalized;
4240
+ function normalizeString(uri2, opts) {
4241
+ return normalizeStringWithStatus(uri2, opts).normalized;
4186
4242
  }
4187
- function normalizeStringWithStatus(uri, opts) {
4188
- const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
4243
+ function normalizeStringWithStatus(uri2, opts) {
4244
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri2, opts);
4189
4245
  return {
4190
- normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
4246
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri2 : serialize(parsed, opts),
4191
4247
  malformedAuthorityOrPort,
4192
4248
  malformedPercentEncoding,
4193
4249
  malformedSchemeSpecific,
@@ -4195,13 +4251,13 @@
4195
4251
  malformedScheme
4196
4252
  };
4197
4253
  }
4198
- function normalizeComparableURI(uri, opts) {
4199
- if (typeof uri !== "string" && typeof uri !== "object") {
4254
+ function normalizeComparableURI(uri2, opts) {
4255
+ if (typeof uri2 !== "string" && typeof uri2 !== "object") {
4200
4256
  return void 0;
4201
4257
  }
4202
4258
  let value;
4203
4259
  try {
4204
- value = typeof uri === "string" ? uri : serialize(uri, opts);
4260
+ value = typeof uri2 === "string" ? uri2 : serialize(uri2, opts);
4205
4261
  } catch {
4206
4262
  return void 0;
4207
4263
  }
@@ -4228,9 +4284,9 @@
4228
4284
  "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js"(exports) {
4229
4285
  "use strict";
4230
4286
  Object.defineProperty(exports, "__esModule", { value: true });
4231
- var uri = require_fast_uri();
4232
- uri.code = 'require("ajv/dist/runtime/uri").default';
4233
- exports.default = uri;
4287
+ var uri2 = require_fast_uri();
4288
+ uri2.code = 'require("ajv/dist/runtime/uri").default';
4289
+ exports.default = uri2;
4234
4290
  }
4235
4291
  });
4236
4292
 
@@ -4617,10 +4673,10 @@
4617
4673
  return this;
4618
4674
  }
4619
4675
  // Add format
4620
- addFormat(name, format) {
4621
- if (typeof format == "string")
4622
- format = new RegExp(format);
4623
- this.formats[name] = format;
4676
+ addFormat(name, format2) {
4677
+ if (typeof format2 == "string")
4678
+ format2 = new RegExp(format2);
4679
+ this.formats[name] = format2;
4624
4680
  return this;
4625
4681
  }
4626
4682
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
@@ -4648,10 +4704,10 @@
4648
4704
  }
4649
4705
  return metaSchema;
4650
4706
  }
4651
- _removeAllSchemas(schemas, regex) {
4707
+ _removeAllSchemas(schemas, regex2) {
4652
4708
  for (const keyRef in schemas) {
4653
4709
  const sch = schemas[keyRef];
4654
- if (!regex || regex.test(keyRef)) {
4710
+ if (!regex2 || regex2.test(keyRef)) {
4655
4711
  if (typeof sch == "string") {
4656
4712
  delete schemas[keyRef];
4657
4713
  } else if (sch && !sch.meta) {
@@ -4738,9 +4794,9 @@
4738
4794
  }
4739
4795
  function addInitialFormats() {
4740
4796
  for (const name in this.opts.formats) {
4741
- const format = this.opts.formats[name];
4742
- if (format)
4743
- this.addFormat(name, format);
4797
+ const format2 = this.opts.formats[name];
4798
+ if (format2)
4799
+ this.addFormat(name, format2);
4744
4800
  }
4745
4801
  }
4746
4802
  function addInitialKeywords(defs) {
@@ -5068,7 +5124,7 @@
5068
5124
  "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
5069
5125
  "use strict";
5070
5126
  Object.defineProperty(exports, "__esModule", { value: true });
5071
- function ucs2length(str) {
5127
+ function ucs2length2(str) {
5072
5128
  const len = str.length;
5073
5129
  let length = 0;
5074
5130
  let pos = 0;
@@ -5084,8 +5140,8 @@
5084
5140
  }
5085
5141
  return length;
5086
5142
  }
5087
- exports.default = ucs2length;
5088
- ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
5143
+ exports.default = ucs2length2;
5144
+ ucs2length2.code = 'require("ajv/dist/runtime/ucs2length").default';
5089
5145
  }
5090
5146
  });
5091
5147
 
@@ -6423,18 +6479,18 @@
6423
6479
  });
6424
6480
  const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
6425
6481
  const fType = gen.let("fType");
6426
- const format = gen.let("format");
6427
- gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format, fDef));
6482
+ const format2 = gen.let("format");
6483
+ gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format2, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format2, fDef));
6428
6484
  cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
6429
6485
  function unknownFmt() {
6430
6486
  if (opts.strictSchema === false)
6431
6487
  return codegen_1.nil;
6432
- return (0, codegen_1._)`${schemaCode} && !${format}`;
6488
+ return (0, codegen_1._)`${schemaCode} && !${format2}`;
6433
6489
  }
6434
6490
  function invalidFmt() {
6435
- const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` : (0, codegen_1._)`${format}(${data})`;
6436
- const validData = (0, codegen_1._)`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`;
6437
- return (0, codegen_1._)`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`;
6491
+ const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format2}(${data}) : ${format2}(${data}))` : (0, codegen_1._)`${format2}(${data})`;
6492
+ const validData = (0, codegen_1._)`(typeof ${format2} == "function" ? ${callFormat} : ${format2}.test(${data}))`;
6493
+ return (0, codegen_1._)`${format2} && ${format2} !== true && ${fType} === ${ruleType} && !${validData}`;
6438
6494
  }
6439
6495
  }
6440
6496
  function validateFormat() {
@@ -6445,7 +6501,7 @@
6445
6501
  }
6446
6502
  if (formatDef === true)
6447
6503
  return;
6448
- const [fmtType, format, fmtRef] = getFormat(formatDef);
6504
+ const [fmtType, format2, fmtRef] = getFormat(formatDef);
6449
6505
  if (fmtType === ruleType)
6450
6506
  cxt.pass(validCondition());
6451
6507
  function unknownFormat() {
@@ -6472,7 +6528,7 @@
6472
6528
  throw new Error("async format in sync schema");
6473
6529
  return (0, codegen_1._)`await ${fmtRef}(${data})`;
6474
6530
  }
6475
- return typeof format == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
6531
+ return typeof format2 == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
6476
6532
  }
6477
6533
  }
6478
6534
  }
@@ -6487,8 +6543,8 @@
6487
6543
  "use strict";
6488
6544
  Object.defineProperty(exports, "__esModule", { value: true });
6489
6545
  var format_1 = require_format();
6490
- var format = [format_1.default];
6491
- exports.default = format;
6546
+ var format2 = [format_1.default];
6547
+ exports.default = format2;
6492
6548
  }
6493
6549
  });
6494
6550
 
@@ -6889,12 +6945,12 @@
6889
6945
  "use strict";
6890
6946
  Object.defineProperty(exports, "__esModule", { value: true });
6891
6947
  exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
6892
- function fmtDef(validate, compare) {
6893
- return { validate, compare };
6948
+ function fmtDef(validate2, compare) {
6949
+ return { validate: validate2, compare };
6894
6950
  }
6895
6951
  exports.fullFormats = {
6896
6952
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
6897
- date: fmtDef(date4, compareDate),
6953
+ date: fmtDef(date5, compareDate),
6898
6954
  // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
6899
6955
  time: fmtDef(getTime(true), compareTime),
6900
6956
  "date-time": fmtDef(getDateTime(true), compareDateTime),
@@ -6902,7 +6958,7 @@
6902
6958
  "iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
6903
6959
  // duration: https://tools.ietf.org/html/rfc3339#appendix-A
6904
6960
  duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
6905
- uri,
6961
+ uri: uri2,
6906
6962
  "uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
6907
6963
  // uri-template: https://tools.ietf.org/html/rfc6570
6908
6964
  "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,
@@ -6914,7 +6970,7 @@
6914
6970
  // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
6915
6971
  ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,
6916
6972
  ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
6917
- regex,
6973
+ regex: regex2,
6918
6974
  // uuid: http://tools.ietf.org/html/rfc4122
6919
6975
  uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
6920
6976
  // JSON-pointer: https://tools.ietf.org/html/rfc6901
@@ -6955,19 +7011,19 @@
6955
7011
  email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
6956
7012
  };
6957
7013
  exports.formatNames = Object.keys(exports.fullFormats);
6958
- function isLeapYear(year) {
7014
+ function isLeapYear2(year) {
6959
7015
  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
6960
7016
  }
6961
- var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
6962
- var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
6963
- function date4(str) {
6964
- const matches = DATE.exec(str);
7017
+ var DATE2 = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
7018
+ var DAYS2 = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
7019
+ function date5(str) {
7020
+ const matches = DATE2.exec(str);
6965
7021
  if (!matches)
6966
7022
  return false;
6967
7023
  const year = +matches[1];
6968
7024
  const month = +matches[2];
6969
7025
  const day = +matches[3];
6970
- return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
7026
+ return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear2(year) ? 29 : DAYS2[month]);
6971
7027
  }
6972
7028
  function compareDate(d1, d2) {
6973
7029
  if (!(d1 && d2))
@@ -6978,10 +7034,10 @@
6978
7034
  return -1;
6979
7035
  return 0;
6980
7036
  }
6981
- var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
7037
+ var TIME2 = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
6982
7038
  function getTime(strictTimeZone) {
6983
- return function time3(str) {
6984
- const matches = TIME.exec(str);
7039
+ return function time4(str) {
7040
+ const matches = TIME2.exec(str);
6985
7041
  if (!matches)
6986
7042
  return false;
6987
7043
  const hr = +matches[1];
@@ -7012,8 +7068,8 @@
7012
7068
  function compareIsoTime(t1, t2) {
7013
7069
  if (!(t1 && t2))
7014
7070
  return void 0;
7015
- const a1 = TIME.exec(t1);
7016
- const a2 = TIME.exec(t2);
7071
+ const a1 = TIME2.exec(t1);
7072
+ const a2 = TIME2.exec(t2);
7017
7073
  if (!(a1 && a2))
7018
7074
  return void 0;
7019
7075
  t1 = a1[1] + a1[2] + a1[3];
@@ -7024,12 +7080,12 @@
7024
7080
  return -1;
7025
7081
  return 0;
7026
7082
  }
7027
- var DATE_TIME_SEPARATOR = /t|\s/i;
7083
+ var DATE_TIME_SEPARATOR2 = /t|\s/i;
7028
7084
  function getDateTime(strictTimeZone) {
7029
- const time3 = getTime(strictTimeZone);
7030
- return function date_time(str) {
7031
- const dateTime = str.split(DATE_TIME_SEPARATOR);
7032
- return dateTime.length === 2 && date4(dateTime[0]) && time3(dateTime[1]);
7085
+ const time4 = getTime(strictTimeZone);
7086
+ return function date_time2(str) {
7087
+ const dateTime = str.split(DATE_TIME_SEPARATOR2);
7088
+ return dateTime.length === 2 && date5(dateTime[0]) && time4(dateTime[1]);
7033
7089
  };
7034
7090
  }
7035
7091
  function compareDateTime(dt1, dt2) {
@@ -7044,17 +7100,17 @@
7044
7100
  function compareIsoDateTime(dt1, dt2) {
7045
7101
  if (!(dt1 && dt2))
7046
7102
  return void 0;
7047
- const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
7048
- const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
7103
+ const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR2);
7104
+ const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR2);
7049
7105
  const res = compareDate(d1, d2);
7050
7106
  if (res === void 0)
7051
7107
  return void 0;
7052
7108
  return res || compareTime(t1, t2);
7053
7109
  }
7054
- var NOT_URI_FRAGMENT = /\/|:/;
7110
+ var NOT_URI_FRAGMENT2 = /\/|:/;
7055
7111
  var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
7056
- function uri(str) {
7057
- return NOT_URI_FRAGMENT.test(str) && URI.test(str);
7112
+ function uri2(str) {
7113
+ return NOT_URI_FRAGMENT2.test(str) && URI.test(str);
7058
7114
  }
7059
7115
  var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
7060
7116
  function byte(str) {
@@ -7072,9 +7128,9 @@
7072
7128
  function validateNumber() {
7073
7129
  return true;
7074
7130
  }
7075
- var Z_ANCHOR = /[^\\]\\Z/;
7076
- function regex(str) {
7077
- if (Z_ANCHOR.test(str))
7131
+ var Z_ANCHOR2 = /[^\\]\\Z/;
7132
+ function regex2(str) {
7133
+ if (Z_ANCHOR2.test(str))
7078
7134
  return false;
7079
7135
  try {
7080
7136
  new RegExp(str);
@@ -7130,17 +7186,17 @@
7130
7186
  cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
7131
7187
  }
7132
7188
  function validateFormat() {
7133
- const format = fCxt.schema;
7134
- const fmtDef = self2.formats[format];
7189
+ const format2 = fCxt.schema;
7190
+ const fmtDef = self2.formats[format2];
7135
7191
  if (!fmtDef || fmtDef === true)
7136
7192
  return;
7137
7193
  if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
7138
- throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
7194
+ throw new Error(`"${keyword}": format "${format2}" does not define "compare" function`);
7139
7195
  }
7140
7196
  const fmt = gen.scopeValue("formats", {
7141
- key: format,
7197
+ key: format2,
7142
7198
  ref: fmtDef,
7143
- code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
7199
+ code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format2)}` : void 0
7144
7200
  });
7145
7201
  cxt.fail$data(compareCode(fmt));
7146
7202
  }
@@ -8584,10 +8640,10 @@
8584
8640
  function getStringByteLength(str) {
8585
8641
  return unescape(encodeURIComponent(str)).length;
8586
8642
  }
8587
- function getSegments(regex, mode, str) {
8643
+ function getSegments(regex2, mode, str) {
8588
8644
  const segments = [];
8589
8645
  let result2;
8590
- while ((result2 = regex.exec(str)) !== null) {
8646
+ while ((result2 = regex2.exec(str)) !== null) {
8591
8647
  segments.push({
8592
8648
  data: result2[0],
8593
8649
  index: result2.index,
@@ -11220,13 +11276,13 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11220
11276
  return new RegExp(`^${timeRegexSource(args)}$`);
11221
11277
  }
11222
11278
  function datetimeRegex(args) {
11223
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
11279
+ let regex2 = `${dateRegexSource}T${timeRegexSource(args)}`;
11224
11280
  const opts = [];
11225
11281
  opts.push(args.local ? `Z?` : `Z`);
11226
11282
  if (args.offset)
11227
11283
  opts.push(`([+-]\\d{2}:?\\d{2})`);
11228
- regex = `${regex}(${opts.join("|")})`;
11229
- return new RegExp(`^${regex}$`);
11284
+ regex2 = `${regex2}(${opts.join("|")})`;
11285
+ return new RegExp(`^${regex2}$`);
11230
11286
  }
11231
11287
  function isValidIP(ip, version2) {
11232
11288
  if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
@@ -11472,8 +11528,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11472
11528
  status.dirty();
11473
11529
  }
11474
11530
  } else if (check2.kind === "datetime") {
11475
- const regex = datetimeRegex(check2);
11476
- if (!regex.test(input.data)) {
11531
+ const regex2 = datetimeRegex(check2);
11532
+ if (!regex2.test(input.data)) {
11477
11533
  ctx = this._getOrReturnCtx(input, ctx);
11478
11534
  addIssueToContext(ctx, {
11479
11535
  code: ZodIssueCode.invalid_string,
@@ -11483,8 +11539,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11483
11539
  status.dirty();
11484
11540
  }
11485
11541
  } else if (check2.kind === "date") {
11486
- const regex = dateRegex;
11487
- if (!regex.test(input.data)) {
11542
+ const regex2 = dateRegex;
11543
+ if (!regex2.test(input.data)) {
11488
11544
  ctx = this._getOrReturnCtx(input, ctx);
11489
11545
  addIssueToContext(ctx, {
11490
11546
  code: ZodIssueCode.invalid_string,
@@ -11494,8 +11550,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11494
11550
  status.dirty();
11495
11551
  }
11496
11552
  } else if (check2.kind === "time") {
11497
- const regex = timeRegex(check2);
11498
- if (!regex.test(input.data)) {
11553
+ const regex2 = timeRegex(check2);
11554
+ if (!regex2.test(input.data)) {
11499
11555
  ctx = this._getOrReturnCtx(input, ctx);
11500
11556
  addIssueToContext(ctx, {
11501
11557
  code: ZodIssueCode.invalid_string,
@@ -11570,8 +11626,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11570
11626
  }
11571
11627
  return { status: status.value, value: input.data };
11572
11628
  }
11573
- _regex(regex, validation, message) {
11574
- return this.refinement((data) => regex.test(data), {
11629
+ _regex(regex2, validation, message) {
11630
+ return this.refinement((data) => regex2.test(data), {
11575
11631
  validation,
11576
11632
  code: ZodIssueCode.invalid_string,
11577
11633
  ...errorUtil.errToObj(message)
@@ -11663,10 +11719,10 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11663
11719
  duration(message) {
11664
11720
  return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
11665
11721
  }
11666
- regex(regex, message) {
11722
+ regex(regex2, message) {
11667
11723
  return this._addCheck({
11668
11724
  kind: "regex",
11669
- regex,
11725
+ regex: regex2,
11670
11726
  ...errorUtil.errToObj(message)
11671
11727
  });
11672
11728
  }
@@ -15028,25 +15084,25 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
15028
15084
  var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
15029
15085
  function timeSource(args) {
15030
15086
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
15031
- const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
15032
- return regex;
15087
+ const regex2 = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
15088
+ return regex2;
15033
15089
  }
15034
15090
  function time(args) {
15035
15091
  return new RegExp(`^${timeSource(args)}$`);
15036
15092
  }
15037
15093
  function datetime(args) {
15038
- const time3 = timeSource({ precision: args.precision });
15094
+ const time4 = timeSource({ precision: args.precision });
15039
15095
  const opts = ["Z"];
15040
15096
  if (args.local)
15041
15097
  opts.push("");
15042
15098
  if (args.offset)
15043
15099
  opts.push(`([+-]\\d{2}:\\d{2})`);
15044
- const timeRegex2 = `${time3}(?:${opts.join("|")})`;
15100
+ const timeRegex2 = `${time4}(?:${opts.join("|")})`;
15045
15101
  return new RegExp(`^${dateSource}T(?:${timeRegex2})$`);
15046
15102
  }
15047
15103
  var string = (params) => {
15048
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
15049
- return new RegExp(`^${regex}$`);
15104
+ const regex2 = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
15105
+ return new RegExp(`^${regex2}$`);
15050
15106
  };
15051
15107
  var bigint = /^\d+n?$/;
15052
15108
  var integer = /^\d+$/;
@@ -18193,7 +18249,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
18193
18249
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
18194
18250
  config(en_default2());
18195
18251
 
18196
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.13_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
18252
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
18197
18253
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
18198
18254
  var JSONRPC_VERSION = "2.0";
18199
18255
  var AssertObjectSchema = custom2((v) => v !== null && (typeof v === "object" || typeof v === "function"));
@@ -19668,14 +19724,14 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19668
19724
  // ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
19669
19725
  var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
19670
19726
 
19671
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.13_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19727
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19672
19728
  var import_ajv_formats = __toESM(require_dist(), 1);
19673
19729
 
19674
19730
  // ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.browser.js
19675
19731
  var crypto2;
19676
19732
  crypto2 = globalThis.crypto;
19677
19733
 
19678
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.13_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
19734
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
19679
19735
  var SafeUrlSchema = url().superRefine((val, ctx) => {
19680
19736
  if (!URL.canParse(val)) {
19681
19737
  ctx.addIssue({
@@ -19819,7 +19875,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19819
19875
  token_type_hint: string2().optional()
19820
19876
  }).strip();
19821
19877
 
19822
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.13_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
19878
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
19823
19879
  var OAuthError = class extends Error {
19824
19880
  constructor(message, errorUri) {
19825
19881
  super(message);
@@ -19914,7 +19970,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19914
19970
  [InvalidTargetError.errorCode]: InvalidTargetError
19915
19971
  };
19916
19972
 
19917
- // ../../node_modules/.pnpm/@opentiny+next@0.3.2_@cfworker+json-schema@4.1.1_hono@4.13.13_zod@3.25.76/node_modules/@opentiny/next/index.js
19973
+ // ../../node_modules/.pnpm/@opentiny+next@0.3.2_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@opentiny/next/index.js
19918
19974
  var _0x4f2826 = _0xad7a;
19919
19975
  (function(_0x5153c5, _0x3abbea) {
19920
19976
  const _0x5f186f = _0xad7a, _0x3f8155 = _0xad7a, _0x5ad68c = _0x5153c5();
@@ -20238,7 +20294,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
20238
20294
  }, _0x275e(_0x25fced, _0x3ae797);
20239
20295
  }
20240
20296
 
20241
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.13_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20297
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20242
20298
  var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
20243
20299
  var McpZodTypeKind;
20244
20300
  (function(McpZodTypeKind2) {
@@ -20325,6 +20381,1669 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
20325
20381
  )
20326
20382
  });
20327
20383
 
20384
+ // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
20385
+ function deepCompareStrict(a, b) {
20386
+ const typeofa = typeof a;
20387
+ if (typeofa !== typeof b) {
20388
+ return false;
20389
+ }
20390
+ const aIsArray = Array.isArray(a);
20391
+ const bIsArray = Array.isArray(b);
20392
+ if (aIsArray !== bIsArray) {
20393
+ return false;
20394
+ }
20395
+ if (aIsArray) {
20396
+ const length = a.length;
20397
+ if (length !== b.length) {
20398
+ return false;
20399
+ }
20400
+ for (let i = 0; i < length; i++) {
20401
+ if (!deepCompareStrict(a[i], b[i])) {
20402
+ return false;
20403
+ }
20404
+ }
20405
+ return true;
20406
+ }
20407
+ if (typeofa === "object") {
20408
+ if (!a || !b) {
20409
+ return a === b;
20410
+ }
20411
+ const aKeys = Object.keys(a);
20412
+ const bKeys = Object.keys(b);
20413
+ const length = aKeys.length;
20414
+ if (length !== bKeys.length) {
20415
+ return false;
20416
+ }
20417
+ for (const k of aKeys) {
20418
+ if (!Object.prototype.hasOwnProperty.call(b, k)) {
20419
+ return false;
20420
+ }
20421
+ if (!deepCompareStrict(a[k], b[k])) {
20422
+ return false;
20423
+ }
20424
+ }
20425
+ return true;
20426
+ }
20427
+ return a === b;
20428
+ }
20429
+
20430
+ // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/pointer.js
20431
+ function encodePointer(p) {
20432
+ return encodeURI(escapePointer(p));
20433
+ }
20434
+ function escapePointer(p) {
20435
+ return p.replace(/~/g, "~0").replace(/\//g, "~1");
20436
+ }
20437
+
20438
+ // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/dereference.js
20439
+ var schemaArrayKeyword = {
20440
+ prefixItems: true,
20441
+ items: true,
20442
+ allOf: true,
20443
+ anyOf: true,
20444
+ oneOf: true
20445
+ };
20446
+ var schemaMapKeyword = {
20447
+ $defs: true,
20448
+ definitions: true,
20449
+ properties: true,
20450
+ patternProperties: true,
20451
+ dependentSchemas: true
20452
+ };
20453
+ var ignoredKeyword = {
20454
+ id: true,
20455
+ $id: true,
20456
+ $ref: true,
20457
+ $schema: true,
20458
+ $anchor: true,
20459
+ $vocabulary: true,
20460
+ $comment: true,
20461
+ default: true,
20462
+ enum: true,
20463
+ const: true,
20464
+ required: true,
20465
+ dependentRequired: true,
20466
+ type: true,
20467
+ maximum: true,
20468
+ minimum: true,
20469
+ exclusiveMaximum: true,
20470
+ exclusiveMinimum: true,
20471
+ multipleOf: true,
20472
+ maxLength: true,
20473
+ minLength: true,
20474
+ pattern: true,
20475
+ format: true,
20476
+ maxItems: true,
20477
+ minItems: true,
20478
+ uniqueItems: true,
20479
+ maxProperties: true,
20480
+ minProperties: true
20481
+ };
20482
+ var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
20483
+ function dereference(schema, lookup = /* @__PURE__ */ Object.create(null), baseURI = initialBaseURI, basePointer = "") {
20484
+ if (schema && typeof schema === "object" && !Array.isArray(schema)) {
20485
+ const id = schema.$id || schema["id"];
20486
+ if (id) {
20487
+ const url2 = new URL(id, baseURI.href);
20488
+ if (url2.hash.length > 1) {
20489
+ lookup[url2.href] = schema;
20490
+ } else {
20491
+ url2.hash = "";
20492
+ if (basePointer === "") {
20493
+ baseURI = url2;
20494
+ } else {
20495
+ dereference(schema, lookup, baseURI);
20496
+ }
20497
+ }
20498
+ }
20499
+ } else if (schema !== true && schema !== false) {
20500
+ return lookup;
20501
+ }
20502
+ const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
20503
+ if (lookup[schemaURI] !== void 0 && lookup[schemaURI] !== schema) {
20504
+ throw new Error(`Duplicate schema URI "${schemaURI}".`);
20505
+ }
20506
+ lookup[schemaURI] = schema;
20507
+ if (schema === true || schema === false) {
20508
+ return lookup;
20509
+ }
20510
+ if (schema.__absolute_uri__ === void 0) {
20511
+ Object.defineProperty(schema, "__absolute_uri__", {
20512
+ enumerable: false,
20513
+ value: schemaURI
20514
+ });
20515
+ }
20516
+ if (schema.$ref && schema.__absolute_ref__ === void 0) {
20517
+ const url2 = new URL(schema.$ref, baseURI.href);
20518
+ url2.hash = url2.hash;
20519
+ Object.defineProperty(schema, "__absolute_ref__", {
20520
+ enumerable: false,
20521
+ value: url2.href
20522
+ });
20523
+ }
20524
+ if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === void 0) {
20525
+ const url2 = new URL(schema.$recursiveRef, baseURI.href);
20526
+ url2.hash = url2.hash;
20527
+ Object.defineProperty(schema, "__absolute_recursive_ref__", {
20528
+ enumerable: false,
20529
+ value: url2.href
20530
+ });
20531
+ }
20532
+ if (schema.$anchor) {
20533
+ const url2 = new URL("#" + schema.$anchor, baseURI.href);
20534
+ lookup[url2.href] = schema;
20535
+ }
20536
+ for (let key in schema) {
20537
+ if (ignoredKeyword[key]) {
20538
+ continue;
20539
+ }
20540
+ const keyBase = `${basePointer}/${encodePointer(key)}`;
20541
+ const subSchema = schema[key];
20542
+ if (Array.isArray(subSchema)) {
20543
+ if (schemaArrayKeyword[key]) {
20544
+ const length = subSchema.length;
20545
+ for (let i = 0; i < length; i++) {
20546
+ dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
20547
+ }
20548
+ }
20549
+ } else if (schemaMapKeyword[key]) {
20550
+ for (let subKey in subSchema) {
20551
+ dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
20552
+ }
20553
+ } else {
20554
+ dereference(subSchema, lookup, baseURI, keyBase);
20555
+ }
20556
+ }
20557
+ return lookup;
20558
+ }
20559
+
20560
+ // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/format.js
20561
+ var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
20562
+ var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
20563
+ var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
20564
+ var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
20565
+ var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
20566
+ var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
20567
+ var URL_ = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
20568
+ var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
20569
+ var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
20570
+ var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
20571
+ var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
20572
+ var EMAIL = (input) => {
20573
+ if (input[0] === '"')
20574
+ return false;
20575
+ const [name, host, ...rest] = input.split("@");
20576
+ if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253)
20577
+ return false;
20578
+ if (name[0] === "." || name.endsWith(".") || name.includes(".."))
20579
+ return false;
20580
+ if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name))
20581
+ return false;
20582
+ return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
20583
+ };
20584
+ var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
20585
+ var IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
20586
+ var DURATION = (input) => input.length > 1 && input.length < 80 && (/^P\d+([.,]\d+)?W$/.test(input) || /^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) && /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input));
20587
+ function bind(r) {
20588
+ return r.test.bind(r);
20589
+ }
20590
+ var format = {
20591
+ date: date4,
20592
+ time: time3.bind(void 0, false),
20593
+ "date-time": date_time,
20594
+ duration: DURATION,
20595
+ uri,
20596
+ "uri-reference": bind(URIREF),
20597
+ "uri-template": bind(URITEMPLATE),
20598
+ url: bind(URL_),
20599
+ email: EMAIL,
20600
+ hostname: bind(HOSTNAME),
20601
+ ipv4: bind(IPV4),
20602
+ ipv6: bind(IPV6),
20603
+ regex,
20604
+ uuid: bind(UUID),
20605
+ "json-pointer": bind(JSON_POINTER),
20606
+ "json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
20607
+ "relative-json-pointer": bind(RELATIVE_JSON_POINTER)
20608
+ };
20609
+ function isLeapYear(year) {
20610
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
20611
+ }
20612
+ function date4(str) {
20613
+ const matches = str.match(DATE);
20614
+ if (!matches)
20615
+ return false;
20616
+ const yearPart = matches[1];
20617
+ const monthPart = matches[2];
20618
+ const dayPart = matches[3];
20619
+ if (!yearPart || !monthPart || !dayPart)
20620
+ return false;
20621
+ const year = +yearPart;
20622
+ const month = +monthPart;
20623
+ const day = +dayPart;
20624
+ const maxDay = month == 2 && isLeapYear(year) ? 29 : DAYS[month];
20625
+ return month >= 1 && month <= 12 && day >= 1 && maxDay !== void 0 && day <= maxDay;
20626
+ }
20627
+ function time3(full, str) {
20628
+ const matches = str.match(TIME);
20629
+ if (!matches)
20630
+ return false;
20631
+ const hourPart = matches[1];
20632
+ const minutePart = matches[2];
20633
+ const secondPart = matches[3];
20634
+ if (!hourPart || !minutePart || !secondPart)
20635
+ return false;
20636
+ const hour = +hourPart;
20637
+ const minute = +minutePart;
20638
+ const second = +secondPart;
20639
+ const timeZone = !!matches[5];
20640
+ return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
20641
+ }
20642
+ var DATE_TIME_SEPARATOR = /t|\s/i;
20643
+ function date_time(str) {
20644
+ const [datePart, timePart, extra] = str.split(DATE_TIME_SEPARATOR);
20645
+ return datePart !== void 0 && timePart !== void 0 && extra === void 0 && date4(datePart) && time3(true, timePart);
20646
+ }
20647
+ var NOT_URI_FRAGMENT = /\/|:/;
20648
+ var URI_PATTERN = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
20649
+ function uri(str) {
20650
+ return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
20651
+ }
20652
+ var Z_ANCHOR = /[^\\]\\Z/;
20653
+ function regex(str) {
20654
+ if (Z_ANCHOR.test(str))
20655
+ return false;
20656
+ try {
20657
+ new RegExp(str, "u");
20658
+ return true;
20659
+ } catch (e) {
20660
+ return false;
20661
+ }
20662
+ }
20663
+
20664
+ // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js
20665
+ function ucs2length(s) {
20666
+ let result2 = 0;
20667
+ let length = s.length;
20668
+ let index = 0;
20669
+ let charCode;
20670
+ while (index < length) {
20671
+ result2++;
20672
+ charCode = s.charCodeAt(index++);
20673
+ if (charCode >= 55296 && charCode <= 56319 && index < length) {
20674
+ charCode = s.charCodeAt(index);
20675
+ if ((charCode & 64512) == 56320) {
20676
+ index++;
20677
+ }
20678
+ }
20679
+ }
20680
+ return result2;
20681
+ }
20682
+
20683
+ // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/validate.js
20684
+ function hasOwnProperty(instance, key) {
20685
+ return Object.prototype.hasOwnProperty.call(instance, key);
20686
+ }
20687
+ function decimalInteger(value) {
20688
+ const coefficientAndExponent = Math.abs(value).toString().split("e");
20689
+ const coefficient = coefficientAndExponent[0];
20690
+ const exponent = coefficientAndExponent[1] ?? "0";
20691
+ const point = coefficient.indexOf(".");
20692
+ const fractionLength = point === -1 ? 0 : coefficient.length - point - 1;
20693
+ return [
20694
+ BigInt(coefficient.replace(".", "")),
20695
+ Number(exponent) - fractionLength
20696
+ ];
20697
+ }
20698
+ function isMultipleOf(instance, divisor) {
20699
+ if (!Number.isFinite(instance) || !Number.isFinite(divisor) || divisor <= 0) {
20700
+ return false;
20701
+ }
20702
+ const [instanceCoefficient, instanceExponent] = decimalInteger(instance);
20703
+ const [divisorCoefficient, divisorExponent] = decimalInteger(divisor);
20704
+ const exponentDifference = instanceExponent - divisorExponent;
20705
+ if (exponentDifference >= 0) {
20706
+ return instanceCoefficient * 10n ** BigInt(exponentDifference) % divisorCoefficient === 0n;
20707
+ }
20708
+ return instanceCoefficient % (divisorCoefficient * 10n ** BigInt(-exponentDifference)) === 0n;
20709
+ }
20710
+ function validate(instance, schema, draft = "2019-09", lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = "#", schemaLocation = "#", evaluated = /* @__PURE__ */ Object.create(null)) {
20711
+ if (schema === true) {
20712
+ return { valid: true, errors: [] };
20713
+ }
20714
+ if (schema === false) {
20715
+ return {
20716
+ valid: false,
20717
+ errors: [
20718
+ {
20719
+ instanceLocation,
20720
+ keyword: "false",
20721
+ keywordLocation: instanceLocation,
20722
+ error: "False boolean schema."
20723
+ }
20724
+ ]
20725
+ };
20726
+ }
20727
+ const rawInstanceType = typeof instance;
20728
+ let instanceType;
20729
+ switch (rawInstanceType) {
20730
+ case "boolean":
20731
+ case "number":
20732
+ case "string":
20733
+ instanceType = rawInstanceType;
20734
+ break;
20735
+ case "object":
20736
+ if (instance === null) {
20737
+ instanceType = "null";
20738
+ } else if (Array.isArray(instance)) {
20739
+ instanceType = "array";
20740
+ } else {
20741
+ instanceType = "object";
20742
+ }
20743
+ break;
20744
+ default:
20745
+ throw new Error(`Instances of "${rawInstanceType}" type are not supported.`);
20746
+ }
20747
+ const { $ref, $recursiveRef, $recursiveAnchor, type: $type, const: $const, enum: $enum, required: $required, not: $not, anyOf: $anyOf, allOf: $allOf, oneOf: $oneOf, if: $if, then: $then, else: $else, format: $format, properties: $properties, patternProperties: $patternProperties, additionalProperties: $additionalProperties, unevaluatedProperties: $unevaluatedProperties, minProperties: $minProperties, maxProperties: $maxProperties, propertyNames: $propertyNames, dependentRequired: $dependentRequired, dependentSchemas: $dependentSchemas, dependencies: $dependencies, prefixItems: $prefixItems, items: $items, additionalItems: $additionalItems, unevaluatedItems: $unevaluatedItems, contains: $contains, minContains: $minContains, maxContains: $maxContains, minItems: $minItems, maxItems: $maxItems, uniqueItems: $uniqueItems, minimum: $minimum, maximum: $maximum, exclusiveMinimum: $exclusiveMinimum, exclusiveMaximum: $exclusiveMaximum, multipleOf: $multipleOf, minLength: $minLength, maxLength: $maxLength, pattern: $pattern, __absolute_ref__, __absolute_recursive_ref__ } = schema;
20748
+ const errors = [];
20749
+ if ($recursiveAnchor === true && recursiveAnchor === null) {
20750
+ recursiveAnchor = schema;
20751
+ }
20752
+ if ($recursiveRef === "#") {
20753
+ const refSchema = recursiveAnchor === null ? lookup[__absolute_recursive_ref__] : recursiveAnchor;
20754
+ const keywordLocation = `${schemaLocation}/$recursiveRef`;
20755
+ const result2 = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);
20756
+ if (!result2.valid) {
20757
+ errors.push({
20758
+ instanceLocation,
20759
+ keyword: "$recursiveRef",
20760
+ keywordLocation,
20761
+ error: "A subschema had errors."
20762
+ }, ...result2.errors);
20763
+ }
20764
+ }
20765
+ if ($ref !== void 0) {
20766
+ const uri2 = __absolute_ref__ || $ref;
20767
+ const refSchema = lookup[uri2];
20768
+ if (refSchema === void 0) {
20769
+ let message = `Unresolved $ref "${$ref}".`;
20770
+ if (__absolute_ref__ && __absolute_ref__ !== $ref) {
20771
+ message += ` Absolute URI "${__absolute_ref__}".`;
20772
+ }
20773
+ message += `
20774
+ Known schemas:
20775
+ - ${Object.keys(lookup).join("\n- ")}`;
20776
+ throw new Error(message);
20777
+ }
20778
+ const keywordLocation = `${schemaLocation}/$ref`;
20779
+ const result2 = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);
20780
+ if (!result2.valid) {
20781
+ errors.push({
20782
+ instanceLocation,
20783
+ keyword: "$ref",
20784
+ keywordLocation,
20785
+ error: "A subschema had errors."
20786
+ }, ...result2.errors);
20787
+ }
20788
+ if (draft === "4" || draft === "7") {
20789
+ return { valid: errors.length === 0, errors };
20790
+ }
20791
+ }
20792
+ if (Array.isArray($type)) {
20793
+ let length = $type.length;
20794
+ let valid = false;
20795
+ for (let i = 0; i < length; i++) {
20796
+ if (instanceType === $type[i] || $type[i] === "integer" && instanceType === "number" && instance % 1 === 0 && instance === instance) {
20797
+ valid = true;
20798
+ break;
20799
+ }
20800
+ }
20801
+ if (!valid) {
20802
+ errors.push({
20803
+ instanceLocation,
20804
+ keyword: "type",
20805
+ keywordLocation: `${schemaLocation}/type`,
20806
+ error: `Instance type "${instanceType}" is invalid. Expected "${$type.join('", "')}".`
20807
+ });
20808
+ }
20809
+ } else if ($type === "integer") {
20810
+ if (instanceType !== "number" || instance % 1 || instance !== instance) {
20811
+ errors.push({
20812
+ instanceLocation,
20813
+ keyword: "type",
20814
+ keywordLocation: `${schemaLocation}/type`,
20815
+ error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
20816
+ });
20817
+ }
20818
+ } else if ($type !== void 0 && instanceType !== $type) {
20819
+ errors.push({
20820
+ instanceLocation,
20821
+ keyword: "type",
20822
+ keywordLocation: `${schemaLocation}/type`,
20823
+ error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
20824
+ });
20825
+ }
20826
+ if ($const !== void 0) {
20827
+ if (instanceType === "object" || instanceType === "array") {
20828
+ if (!deepCompareStrict(instance, $const)) {
20829
+ errors.push({
20830
+ instanceLocation,
20831
+ keyword: "const",
20832
+ keywordLocation: `${schemaLocation}/const`,
20833
+ error: `Instance does not match ${JSON.stringify($const)}.`
20834
+ });
20835
+ }
20836
+ } else if (instance !== $const) {
20837
+ errors.push({
20838
+ instanceLocation,
20839
+ keyword: "const",
20840
+ keywordLocation: `${schemaLocation}/const`,
20841
+ error: `Instance does not match ${JSON.stringify($const)}.`
20842
+ });
20843
+ }
20844
+ }
20845
+ if ($enum !== void 0) {
20846
+ if (instanceType === "object" || instanceType === "array") {
20847
+ if (!$enum.some((value) => deepCompareStrict(instance, value))) {
20848
+ errors.push({
20849
+ instanceLocation,
20850
+ keyword: "enum",
20851
+ keywordLocation: `${schemaLocation}/enum`,
20852
+ error: `Instance does not match any of ${JSON.stringify($enum)}.`
20853
+ });
20854
+ }
20855
+ } else if (!$enum.some((value) => instance === value)) {
20856
+ errors.push({
20857
+ instanceLocation,
20858
+ keyword: "enum",
20859
+ keywordLocation: `${schemaLocation}/enum`,
20860
+ error: `Instance does not match any of ${JSON.stringify($enum)}.`
20861
+ });
20862
+ }
20863
+ }
20864
+ if ($not !== void 0) {
20865
+ const keywordLocation = `${schemaLocation}/not`;
20866
+ const result2 = validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation);
20867
+ if (result2.valid) {
20868
+ errors.push({
20869
+ instanceLocation,
20870
+ keyword: "not",
20871
+ keywordLocation,
20872
+ error: 'Instance matched "not" schema.'
20873
+ });
20874
+ }
20875
+ }
20876
+ let subEvaluateds = [];
20877
+ if ($anyOf !== void 0) {
20878
+ const keywordLocation = `${schemaLocation}/anyOf`;
20879
+ const errorsLength = errors.length;
20880
+ let anyValid = false;
20881
+ for (const [i, subSchema] of $anyOf.entries()) {
20882
+ const subEvaluated = Object.create(evaluated);
20883
+ const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20884
+ errors.push(...result2.errors);
20885
+ anyValid = anyValid || result2.valid;
20886
+ if (result2.valid) {
20887
+ subEvaluateds.push(subEvaluated);
20888
+ }
20889
+ }
20890
+ if (anyValid) {
20891
+ errors.length = errorsLength;
20892
+ } else {
20893
+ errors.splice(errorsLength, 0, {
20894
+ instanceLocation,
20895
+ keyword: "anyOf",
20896
+ keywordLocation,
20897
+ error: "Instance does not match any subschemas."
20898
+ });
20899
+ }
20900
+ }
20901
+ if ($allOf !== void 0) {
20902
+ const keywordLocation = `${schemaLocation}/allOf`;
20903
+ const errorsLength = errors.length;
20904
+ let allValid = true;
20905
+ for (const [i, subSchema] of $allOf.entries()) {
20906
+ const subEvaluated = Object.create(evaluated);
20907
+ const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20908
+ errors.push(...result2.errors);
20909
+ allValid = allValid && result2.valid;
20910
+ if (result2.valid) {
20911
+ subEvaluateds.push(subEvaluated);
20912
+ }
20913
+ }
20914
+ if (allValid) {
20915
+ errors.length = errorsLength;
20916
+ } else {
20917
+ errors.splice(errorsLength, 0, {
20918
+ instanceLocation,
20919
+ keyword: "allOf",
20920
+ keywordLocation,
20921
+ error: `Instance does not match every subschema.`
20922
+ });
20923
+ }
20924
+ }
20925
+ if ($oneOf !== void 0) {
20926
+ const keywordLocation = `${schemaLocation}/oneOf`;
20927
+ const errorsLength = errors.length;
20928
+ const matches = $oneOf.filter((subSchema, i) => {
20929
+ const subEvaluated = Object.create(evaluated);
20930
+ const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20931
+ errors.push(...result2.errors);
20932
+ if (result2.valid) {
20933
+ subEvaluateds.push(subEvaluated);
20934
+ }
20935
+ return result2.valid;
20936
+ }).length;
20937
+ if (matches === 1) {
20938
+ errors.length = errorsLength;
20939
+ } else {
20940
+ errors.splice(errorsLength, 0, {
20941
+ instanceLocation,
20942
+ keyword: "oneOf",
20943
+ keywordLocation,
20944
+ error: `Instance does not match exactly one subschema (${matches} matches).`
20945
+ });
20946
+ }
20947
+ }
20948
+ if (instanceType === "object" || instanceType === "array") {
20949
+ Object.assign(evaluated, ...subEvaluateds);
20950
+ }
20951
+ if ($if !== void 0) {
20952
+ const keywordLocation = `${schemaLocation}/if`;
20953
+ const conditionResult = validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid;
20954
+ if (conditionResult) {
20955
+ if ($then !== void 0) {
20956
+ const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);
20957
+ if (!thenResult.valid) {
20958
+ errors.push({
20959
+ instanceLocation,
20960
+ keyword: "if",
20961
+ keywordLocation,
20962
+ error: `Instance does not match "then" schema.`
20963
+ }, ...thenResult.errors);
20964
+ }
20965
+ }
20966
+ } else if ($else !== void 0) {
20967
+ const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);
20968
+ if (!elseResult.valid) {
20969
+ errors.push({
20970
+ instanceLocation,
20971
+ keyword: "if",
20972
+ keywordLocation,
20973
+ error: `Instance does not match "else" schema.`
20974
+ }, ...elseResult.errors);
20975
+ }
20976
+ }
20977
+ }
20978
+ if (instanceType === "object") {
20979
+ if ($required !== void 0) {
20980
+ for (const key of $required) {
20981
+ if (!hasOwnProperty(instance, key)) {
20982
+ errors.push({
20983
+ instanceLocation,
20984
+ keyword: "required",
20985
+ keywordLocation: `${schemaLocation}/required`,
20986
+ error: `Instance does not have required property "${key}".`
20987
+ });
20988
+ }
20989
+ }
20990
+ }
20991
+ const keys = Object.keys(instance);
20992
+ if ($minProperties !== void 0 && keys.length < $minProperties) {
20993
+ errors.push({
20994
+ instanceLocation,
20995
+ keyword: "minProperties",
20996
+ keywordLocation: `${schemaLocation}/minProperties`,
20997
+ error: `Instance does not have at least ${$minProperties} properties.`
20998
+ });
20999
+ }
21000
+ if ($maxProperties !== void 0 && keys.length > $maxProperties) {
21001
+ errors.push({
21002
+ instanceLocation,
21003
+ keyword: "maxProperties",
21004
+ keywordLocation: `${schemaLocation}/maxProperties`,
21005
+ error: `Instance does not have at least ${$maxProperties} properties.`
21006
+ });
21007
+ }
21008
+ if ($propertyNames !== void 0) {
21009
+ const keywordLocation = `${schemaLocation}/propertyNames`;
21010
+ for (const key in instance) {
21011
+ const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21012
+ const result2 = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
21013
+ if (!result2.valid) {
21014
+ errors.push({
21015
+ instanceLocation,
21016
+ keyword: "propertyNames",
21017
+ keywordLocation,
21018
+ error: `Property name "${key}" does not match schema.`
21019
+ }, ...result2.errors);
21020
+ }
21021
+ }
21022
+ }
21023
+ if ($dependentRequired !== void 0) {
21024
+ const keywordLocation = `${schemaLocation}/dependantRequired`;
21025
+ for (const key in $dependentRequired) {
21026
+ if (hasOwnProperty(instance, key)) {
21027
+ const required2 = $dependentRequired[key];
21028
+ for (const dependantKey of required2) {
21029
+ if (!hasOwnProperty(instance, dependantKey)) {
21030
+ errors.push({
21031
+ instanceLocation,
21032
+ keyword: "dependentRequired",
21033
+ keywordLocation,
21034
+ error: `Instance has "${key}" but does not have "${dependantKey}".`
21035
+ });
21036
+ }
21037
+ }
21038
+ }
21039
+ }
21040
+ }
21041
+ if ($dependentSchemas !== void 0) {
21042
+ for (const [key, dependentSchema] of Object.entries($dependentSchemas)) {
21043
+ const keywordLocation = `${schemaLocation}/dependentSchemas`;
21044
+ if (hasOwnProperty(instance, key)) {
21045
+ const result2 = validate(instance, dependentSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);
21046
+ if (!result2.valid) {
21047
+ errors.push({
21048
+ instanceLocation,
21049
+ keyword: "dependentSchemas",
21050
+ keywordLocation,
21051
+ error: `Instance has "${key}" but does not match dependant schema.`
21052
+ }, ...result2.errors);
21053
+ }
21054
+ }
21055
+ }
21056
+ }
21057
+ if ($dependencies !== void 0) {
21058
+ const keywordLocation = `${schemaLocation}/dependencies`;
21059
+ for (const key in $dependencies) {
21060
+ if (hasOwnProperty(instance, key)) {
21061
+ const propsOrSchema = $dependencies[key];
21062
+ if (Array.isArray(propsOrSchema)) {
21063
+ for (const dependantKey of propsOrSchema) {
21064
+ if (!hasOwnProperty(instance, dependantKey)) {
21065
+ errors.push({
21066
+ instanceLocation,
21067
+ keyword: "dependencies",
21068
+ keywordLocation,
21069
+ error: `Instance has "${key}" but does not have "${dependantKey}".`
21070
+ });
21071
+ }
21072
+ }
21073
+ } else {
21074
+ const result2 = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);
21075
+ if (!result2.valid) {
21076
+ errors.push({
21077
+ instanceLocation,
21078
+ keyword: "dependencies",
21079
+ keywordLocation,
21080
+ error: `Instance has "${key}" but does not match dependant schema.`
21081
+ }, ...result2.errors);
21082
+ }
21083
+ }
21084
+ }
21085
+ }
21086
+ }
21087
+ const thisEvaluated = /* @__PURE__ */ Object.create(null);
21088
+ let stop = false;
21089
+ if ($properties !== void 0) {
21090
+ const keywordLocation = `${schemaLocation}/properties`;
21091
+ for (const [key, propertySchema] of Object.entries($properties)) {
21092
+ if (!hasOwnProperty(instance, key)) {
21093
+ continue;
21094
+ }
21095
+ const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21096
+ const result2 = validate(instance[key], propertySchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);
21097
+ thisEvaluated[key] = true;
21098
+ if (result2.valid) {
21099
+ evaluated[key] = true;
21100
+ } else {
21101
+ stop = shortCircuit;
21102
+ errors.push({
21103
+ instanceLocation,
21104
+ keyword: "properties",
21105
+ keywordLocation,
21106
+ error: `Property "${key}" does not match schema.`
21107
+ }, ...result2.errors);
21108
+ if (stop)
21109
+ break;
21110
+ }
21111
+ }
21112
+ }
21113
+ if (!stop && $patternProperties !== void 0) {
21114
+ const keywordLocation = `${schemaLocation}/patternProperties`;
21115
+ for (const [pattern, subSchema] of Object.entries($patternProperties)) {
21116
+ const regex2 = new RegExp(pattern, "u");
21117
+ for (const key in instance) {
21118
+ if (!regex2.test(key)) {
21119
+ continue;
21120
+ }
21121
+ const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21122
+ const result2 = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);
21123
+ thisEvaluated[key] = true;
21124
+ if (result2.valid) {
21125
+ evaluated[key] = true;
21126
+ } else {
21127
+ stop = shortCircuit;
21128
+ errors.push({
21129
+ instanceLocation,
21130
+ keyword: "patternProperties",
21131
+ keywordLocation,
21132
+ error: `Property "${key}" matches pattern "${pattern}" but does not match associated schema.`
21133
+ }, ...result2.errors);
21134
+ }
21135
+ }
21136
+ }
21137
+ }
21138
+ if (!stop && $additionalProperties !== void 0) {
21139
+ const keywordLocation = `${schemaLocation}/additionalProperties`;
21140
+ for (const key in instance) {
21141
+ if (thisEvaluated[key]) {
21142
+ continue;
21143
+ }
21144
+ const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21145
+ const result2 = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
21146
+ if (result2.valid) {
21147
+ evaluated[key] = true;
21148
+ } else {
21149
+ stop = shortCircuit;
21150
+ errors.push({
21151
+ instanceLocation,
21152
+ keyword: "additionalProperties",
21153
+ keywordLocation,
21154
+ error: `Property "${key}" does not match additional properties schema.`
21155
+ }, ...result2.errors);
21156
+ }
21157
+ }
21158
+ } else if (!stop && $unevaluatedProperties !== void 0) {
21159
+ const keywordLocation = `${schemaLocation}/unevaluatedProperties`;
21160
+ for (const key in instance) {
21161
+ if (!evaluated[key]) {
21162
+ const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21163
+ const result2 = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
21164
+ if (result2.valid) {
21165
+ evaluated[key] = true;
21166
+ } else {
21167
+ errors.push({
21168
+ instanceLocation,
21169
+ keyword: "unevaluatedProperties",
21170
+ keywordLocation,
21171
+ error: `Property "${key}" does not match unevaluated properties schema.`
21172
+ }, ...result2.errors);
21173
+ }
21174
+ }
21175
+ }
21176
+ }
21177
+ } else if (instanceType === "array") {
21178
+ if ($maxItems !== void 0 && instance.length > $maxItems) {
21179
+ errors.push({
21180
+ instanceLocation,
21181
+ keyword: "maxItems",
21182
+ keywordLocation: `${schemaLocation}/maxItems`,
21183
+ error: `Array has too many items (${instance.length} > ${$maxItems}).`
21184
+ });
21185
+ }
21186
+ if ($minItems !== void 0 && instance.length < $minItems) {
21187
+ errors.push({
21188
+ instanceLocation,
21189
+ keyword: "minItems",
21190
+ keywordLocation: `${schemaLocation}/minItems`,
21191
+ error: `Array has too few items (${instance.length} < ${$minItems}).`
21192
+ });
21193
+ }
21194
+ const length = instance.length;
21195
+ let i = 0;
21196
+ let stop = false;
21197
+ if ($prefixItems !== void 0) {
21198
+ const keywordLocation = `${schemaLocation}/prefixItems`;
21199
+ const length2 = Math.min($prefixItems.length, length);
21200
+ for (; i < length2; i++) {
21201
+ const result2 = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
21202
+ evaluated[i] = true;
21203
+ if (!result2.valid) {
21204
+ stop = shortCircuit;
21205
+ errors.push({
21206
+ instanceLocation,
21207
+ keyword: "prefixItems",
21208
+ keywordLocation,
21209
+ error: `Items did not match schema.`
21210
+ }, ...result2.errors);
21211
+ if (stop)
21212
+ break;
21213
+ }
21214
+ }
21215
+ }
21216
+ if ($items !== void 0) {
21217
+ const keywordLocation = `${schemaLocation}/items`;
21218
+ if (Array.isArray($items)) {
21219
+ const length2 = Math.min($items.length, length);
21220
+ for (; i < length2; i++) {
21221
+ const result2 = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
21222
+ evaluated[i] = true;
21223
+ if (!result2.valid) {
21224
+ stop = shortCircuit;
21225
+ errors.push({
21226
+ instanceLocation,
21227
+ keyword: "items",
21228
+ keywordLocation,
21229
+ error: `Items did not match schema.`
21230
+ }, ...result2.errors);
21231
+ if (stop)
21232
+ break;
21233
+ }
21234
+ }
21235
+ } else {
21236
+ for (; i < length; i++) {
21237
+ const result2 = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
21238
+ evaluated[i] = true;
21239
+ if (!result2.valid) {
21240
+ stop = shortCircuit;
21241
+ errors.push({
21242
+ instanceLocation,
21243
+ keyword: "items",
21244
+ keywordLocation,
21245
+ error: `Items did not match schema.`
21246
+ }, ...result2.errors);
21247
+ if (stop)
21248
+ break;
21249
+ }
21250
+ }
21251
+ }
21252
+ if (!stop && $additionalItems !== void 0) {
21253
+ const keywordLocation2 = `${schemaLocation}/additionalItems`;
21254
+ for (; i < length; i++) {
21255
+ const result2 = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation2);
21256
+ evaluated[i] = true;
21257
+ if (!result2.valid) {
21258
+ stop = shortCircuit;
21259
+ errors.push({
21260
+ instanceLocation,
21261
+ keyword: "additionalItems",
21262
+ keywordLocation: keywordLocation2,
21263
+ error: `Items did not match additional items schema.`
21264
+ }, ...result2.errors);
21265
+ }
21266
+ }
21267
+ }
21268
+ }
21269
+ if ($contains !== void 0) {
21270
+ if (length === 0 && $minContains === void 0) {
21271
+ errors.push({
21272
+ instanceLocation,
21273
+ keyword: "contains",
21274
+ keywordLocation: `${schemaLocation}/contains`,
21275
+ error: `Array is empty. It must contain at least one item matching the schema.`
21276
+ });
21277
+ } else if ($minContains !== void 0 && length < $minContains) {
21278
+ errors.push({
21279
+ instanceLocation,
21280
+ keyword: "minContains",
21281
+ keywordLocation: `${schemaLocation}/minContains`,
21282
+ error: `Array has less items (${length}) than minContains (${$minContains}).`
21283
+ });
21284
+ } else {
21285
+ const keywordLocation = `${schemaLocation}/contains`;
21286
+ const errorsLength = errors.length;
21287
+ let contained = 0;
21288
+ for (let j = 0; j < length; j++) {
21289
+ const result2 = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);
21290
+ if (result2.valid) {
21291
+ evaluated[j] = true;
21292
+ contained++;
21293
+ } else {
21294
+ errors.push(...result2.errors);
21295
+ }
21296
+ }
21297
+ if (contained >= ($minContains || 0)) {
21298
+ errors.length = errorsLength;
21299
+ }
21300
+ if ($minContains === void 0 && contained === 0) {
21301
+ errors.splice(errorsLength, 0, {
21302
+ instanceLocation,
21303
+ keyword: "contains",
21304
+ keywordLocation,
21305
+ error: `Array does not contain item matching schema.`
21306
+ });
21307
+ } else if ($minContains !== void 0 && contained < $minContains) {
21308
+ errors.push({
21309
+ instanceLocation,
21310
+ keyword: "minContains",
21311
+ keywordLocation: `${schemaLocation}/minContains`,
21312
+ error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`
21313
+ });
21314
+ } else if ($maxContains !== void 0 && contained > $maxContains) {
21315
+ errors.push({
21316
+ instanceLocation,
21317
+ keyword: "maxContains",
21318
+ keywordLocation: `${schemaLocation}/maxContains`,
21319
+ error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`
21320
+ });
21321
+ }
21322
+ }
21323
+ }
21324
+ if (!stop && $unevaluatedItems !== void 0) {
21325
+ const keywordLocation = `${schemaLocation}/unevaluatedItems`;
21326
+ for (i; i < length; i++) {
21327
+ if (evaluated[i]) {
21328
+ continue;
21329
+ }
21330
+ const result2 = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
21331
+ evaluated[i] = true;
21332
+ if (!result2.valid) {
21333
+ errors.push({
21334
+ instanceLocation,
21335
+ keyword: "unevaluatedItems",
21336
+ keywordLocation,
21337
+ error: `Items did not match unevaluated items schema.`
21338
+ }, ...result2.errors);
21339
+ }
21340
+ }
21341
+ }
21342
+ if ($uniqueItems) {
21343
+ for (let j = 0; j < length; j++) {
21344
+ const a = instance[j];
21345
+ const ao = typeof a === "object" && a !== null;
21346
+ for (let k = 0; k < length; k++) {
21347
+ if (j === k) {
21348
+ continue;
21349
+ }
21350
+ const b = instance[k];
21351
+ const bo = typeof b === "object" && b !== null;
21352
+ if (a === b || ao && bo && deepCompareStrict(a, b)) {
21353
+ errors.push({
21354
+ instanceLocation,
21355
+ keyword: "uniqueItems",
21356
+ keywordLocation: `${schemaLocation}/uniqueItems`,
21357
+ error: `Duplicate items at indexes ${j} and ${k}.`
21358
+ });
21359
+ j = Number.MAX_SAFE_INTEGER;
21360
+ k = Number.MAX_SAFE_INTEGER;
21361
+ }
21362
+ }
21363
+ }
21364
+ }
21365
+ } else if (instanceType === "number") {
21366
+ if (draft === "4") {
21367
+ if ($minimum !== void 0 && ($exclusiveMinimum === true && instance <= $minimum || instance < $minimum)) {
21368
+ errors.push({
21369
+ instanceLocation,
21370
+ keyword: "minimum",
21371
+ keywordLocation: `${schemaLocation}/minimum`,
21372
+ error: `${instance} is less than ${$exclusiveMinimum ? "or equal to " : ""} ${$minimum}.`
21373
+ });
21374
+ }
21375
+ if ($maximum !== void 0 && ($exclusiveMaximum === true && instance >= $maximum || instance > $maximum)) {
21376
+ errors.push({
21377
+ instanceLocation,
21378
+ keyword: "maximum",
21379
+ keywordLocation: `${schemaLocation}/maximum`,
21380
+ error: `${instance} is greater than ${$exclusiveMaximum ? "or equal to " : ""} ${$maximum}.`
21381
+ });
21382
+ }
21383
+ } else {
21384
+ if ($minimum !== void 0 && instance < $minimum) {
21385
+ errors.push({
21386
+ instanceLocation,
21387
+ keyword: "minimum",
21388
+ keywordLocation: `${schemaLocation}/minimum`,
21389
+ error: `${instance} is less than ${$minimum}.`
21390
+ });
21391
+ }
21392
+ if ($maximum !== void 0 && instance > $maximum) {
21393
+ errors.push({
21394
+ instanceLocation,
21395
+ keyword: "maximum",
21396
+ keywordLocation: `${schemaLocation}/maximum`,
21397
+ error: `${instance} is greater than ${$maximum}.`
21398
+ });
21399
+ }
21400
+ if ($exclusiveMinimum !== void 0 && instance <= $exclusiveMinimum) {
21401
+ errors.push({
21402
+ instanceLocation,
21403
+ keyword: "exclusiveMinimum",
21404
+ keywordLocation: `${schemaLocation}/exclusiveMinimum`,
21405
+ error: `${instance} is less than ${$exclusiveMinimum}.`
21406
+ });
21407
+ }
21408
+ if ($exclusiveMaximum !== void 0 && instance >= $exclusiveMaximum) {
21409
+ errors.push({
21410
+ instanceLocation,
21411
+ keyword: "exclusiveMaximum",
21412
+ keywordLocation: `${schemaLocation}/exclusiveMaximum`,
21413
+ error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`
21414
+ });
21415
+ }
21416
+ }
21417
+ if ($multipleOf !== void 0) {
21418
+ if (!isMultipleOf(instance, $multipleOf)) {
21419
+ errors.push({
21420
+ instanceLocation,
21421
+ keyword: "multipleOf",
21422
+ keywordLocation: `${schemaLocation}/multipleOf`,
21423
+ error: `${instance} is not a multiple of ${$multipleOf}.`
21424
+ });
21425
+ }
21426
+ }
21427
+ } else if (instanceType === "string") {
21428
+ const length = $minLength === void 0 && $maxLength === void 0 ? 0 : ucs2length(instance);
21429
+ if ($minLength !== void 0 && length < $minLength) {
21430
+ errors.push({
21431
+ instanceLocation,
21432
+ keyword: "minLength",
21433
+ keywordLocation: `${schemaLocation}/minLength`,
21434
+ error: `String is too short (${length} < ${$minLength}).`
21435
+ });
21436
+ }
21437
+ if ($maxLength !== void 0 && length > $maxLength) {
21438
+ errors.push({
21439
+ instanceLocation,
21440
+ keyword: "maxLength",
21441
+ keywordLocation: `${schemaLocation}/maxLength`,
21442
+ error: `String is too long (${length} > ${$maxLength}).`
21443
+ });
21444
+ }
21445
+ if ($pattern !== void 0 && !new RegExp($pattern, "u").test(instance)) {
21446
+ errors.push({
21447
+ instanceLocation,
21448
+ keyword: "pattern",
21449
+ keywordLocation: `${schemaLocation}/pattern`,
21450
+ error: `String does not match pattern.`
21451
+ });
21452
+ }
21453
+ if ($format !== void 0 && format[$format] && !format[$format](instance)) {
21454
+ errors.push({
21455
+ instanceLocation,
21456
+ keyword: "format",
21457
+ keywordLocation: `${schemaLocation}/format`,
21458
+ error: `String does not match format "${$format}".`
21459
+ });
21460
+ }
21461
+ }
21462
+ return { valid: errors.length === 0, errors };
21463
+ }
21464
+
21465
+ // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/validator.js
21466
+ var Validator = class {
21467
+ schema;
21468
+ draft;
21469
+ shortCircuit;
21470
+ lookup;
21471
+ constructor(schema, draft = "2019-09", shortCircuit = true) {
21472
+ this.schema = schema;
21473
+ this.draft = draft;
21474
+ this.shortCircuit = shortCircuit;
21475
+ this.lookup = dereference(schema);
21476
+ }
21477
+ validate(instance) {
21478
+ return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
21479
+ }
21480
+ addSchema(schema, id) {
21481
+ if (id) {
21482
+ schema = { ...schema, $id: id };
21483
+ }
21484
+ dereference(schema, this.lookup);
21485
+ }
21486
+ };
21487
+
21488
+ // ../../node_modules/.pnpm/@mcp-b+webmcp-polyfill@3.0.0/node_modules/@mcp-b/webmcp-polyfill/dist/index.js
21489
+ var FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE = "Failed to parse input arguments";
21490
+ var TOOL_INVOCATION_FAILED_MESSAGE = "Tool was executed but the invocation failed. For example, the script function threw an error";
21491
+ var TOOL_CANCELLED_MESSAGE = "Tool was cancelled";
21492
+ var DEFAULT_INPUT_SCHEMA = {
21493
+ type: "object",
21494
+ properties: {}
21495
+ };
21496
+ var STANDARD_JSON_SCHEMA_TARGETS = ["draft-2020-12", "draft-07"];
21497
+ var POLYFILL_MARKER_PROPERTY = "__isWebMCPPolyfill";
21498
+ var STANDARD_VALIDATOR_SYMBOL = Symbol("standardValidator");
21499
+ var installState = {
21500
+ installed: false,
21501
+ previousNavigatorModelContextDescriptor: void 0,
21502
+ previousNavigatorModelContextTestingDescriptor: void 0,
21503
+ previousDocumentModelContextDescriptor: void 0,
21504
+ installedNavigatorModelContext: false,
21505
+ installedNavigatorModelContextTesting: false,
21506
+ installedDocumentModelContext: false
21507
+ };
21508
+ var StrictWebMCPContext = class extends EventTarget {
21509
+ tools = /* @__PURE__ */ new Map();
21510
+ testingShim = null;
21511
+ _ontoolchange = null;
21512
+ unregisterToolDeprecationWarned = false;
21513
+ get ontoolchange() {
21514
+ return this._ontoolchange;
21515
+ }
21516
+ set ontoolchange(handler) {
21517
+ this._ontoolchange = handler;
21518
+ }
21519
+ registerTool(tool, options) {
21520
+ const signal2 = options?.signal;
21521
+ if (signal2?.aborted) {
21522
+ console.warn(`[WebMCPPolyfill] registerTool("${tool?.name ?? "<unknown>"}") skipped: options.signal was already aborted.`);
21523
+ return;
21524
+ }
21525
+ const normalized = normalizeToolDescriptor(tool, this.tools);
21526
+ this.tools.set(normalized.name, normalized);
21527
+ this.notifyToolsChanged();
21528
+ if (signal2) signal2.addEventListener("abort", () => {
21529
+ if (this.tools.delete(normalized.name)) this.notifyToolsChanged();
21530
+ }, { once: true });
21531
+ }
21532
+ unregisterTool(nameOrTool) {
21533
+ this.warnUnregisterToolDeprecationOnce();
21534
+ const name = getToolNameForUnregister(nameOrTool);
21535
+ if (this.tools.delete(name)) this.notifyToolsChanged();
21536
+ }
21537
+ getTools() {
21538
+ return Promise.resolve(this.getRegisteredToolInfos());
21539
+ }
21540
+ executeTool(tool, inputArgsJson, options) {
21541
+ return this.executeToolByName(tool.name, inputArgsJson, options, false);
21542
+ }
21543
+ getTestingShim() {
21544
+ if (!this.testingShim) this.testingShim = new PolyfillTestingShim(this);
21545
+ return this.testingShim;
21546
+ }
21547
+ /** @internal Used by PolyfillTestingShim */
21548
+ getToolInfos() {
21549
+ return [...this.tools.values()].map((tool) => {
21550
+ let inputSchema2;
21551
+ try {
21552
+ inputSchema2 = JSON.stringify(tool.inputSchema ?? { type: "object" });
21553
+ } catch {
21554
+ inputSchema2 = '{"type":"object"}';
21555
+ }
21556
+ return {
21557
+ name: tool.name,
21558
+ description: tool.description,
21559
+ inputSchema: inputSchema2
21560
+ };
21561
+ });
21562
+ }
21563
+ /** @internal Used by getTools() */
21564
+ getRegisteredToolInfos() {
21565
+ return this.getToolInfos().map((toolInfo) => {
21566
+ const tool = this.tools.get(toolInfo.name);
21567
+ return {
21568
+ ...toolInfo,
21569
+ title: tool?.title ?? "",
21570
+ origin: globalThis.location?.origin ?? "",
21571
+ window: globalThis.window
21572
+ };
21573
+ });
21574
+ }
21575
+ /** @internal Used by PolyfillTestingShim */
21576
+ async executeToolForTesting(toolName, inputArgsJson, options) {
21577
+ return this.executeToolByName(toolName, inputArgsJson, options, true);
21578
+ }
21579
+ async executeToolByName(toolName, inputArgsJson, options, normalizeResult) {
21580
+ if (options?.signal?.aborted) throw createUnknownError(TOOL_CANCELLED_MESSAGE);
21581
+ const tool = this.tools.get(toolName);
21582
+ if (!tool) throw createUnknownError(`Tool not found: ${toolName}`);
21583
+ const args = parseInputArgsJson(inputArgsJson);
21584
+ const validationError = await validateArgsForTool(args, tool);
21585
+ if (validationError) throw createUnknownError(validationError);
21586
+ let contextActive = true;
21587
+ const client = { requestUserInteraction: async (callback) => {
21588
+ if (!contextActive) throw new Error(`ModelContextClient for tool "${toolName}" is no longer active after execute() resolved`);
21589
+ if (typeof callback !== "function") throw new TypeError("requestUserInteraction(callback) requires a function callback");
21590
+ return callback();
21591
+ } };
21592
+ try {
21593
+ const execution = tool.execute(args, client);
21594
+ const rawResult = await withAbortSignal(Promise.resolve(execution), options?.signal);
21595
+ if (normalizeResult) return toSerializedTestingResult(normalizeToolResponse(rawResult));
21596
+ const serialized = JSON.stringify(rawResult);
21597
+ return serialized === void 0 ? null : serialized;
21598
+ } catch (error2) {
21599
+ throw createUnknownError(error2 instanceof Error ? `${TOOL_INVOCATION_FAILED_MESSAGE}: ${error2.message}` : TOOL_INVOCATION_FAILED_MESSAGE);
21600
+ } finally {
21601
+ contextActive = false;
21602
+ }
21603
+ }
21604
+ notifyToolsChanged() {
21605
+ queueMicrotask(() => {
21606
+ const event = new Event("toolchange");
21607
+ try {
21608
+ this._ontoolchange?.call(this, event);
21609
+ } catch (error2) {
21610
+ console.warn("[WebMCPPolyfill] navigator.modelContext.ontoolchange handler threw:", error2);
21611
+ }
21612
+ this.dispatchEvent(event);
21613
+ this.testingShim?.dispatchToolChange();
21614
+ });
21615
+ }
21616
+ warnUnregisterToolDeprecationOnce() {
21617
+ if (this.unregisterToolDeprecationWarned) return;
21618
+ this.unregisterToolDeprecationWarned = true;
21619
+ console.warn("[WebMCPPolyfill] navigator.modelContext.unregisterTool() is deprecated. The April 23, 2026 WebMCP draft removed it in favor of registerTool(tool, { signal }) \u2014 pass an AbortSignal and abort it to unregister.");
21620
+ }
21621
+ };
21622
+ var PolyfillTestingShim = class extends EventTarget {
21623
+ context;
21624
+ _ontoolchange = null;
21625
+ constructor(context) {
21626
+ super();
21627
+ this.context = context;
21628
+ }
21629
+ listTools() {
21630
+ return this.context.getToolInfos();
21631
+ }
21632
+ executeTool(toolName, inputArgsJson, options) {
21633
+ return this.context.executeToolForTesting(toolName, inputArgsJson, options);
21634
+ }
21635
+ getCrossDocumentScriptToolResult() {
21636
+ return Promise.resolve("[]");
21637
+ }
21638
+ get ontoolchange() {
21639
+ return this._ontoolchange;
21640
+ }
21641
+ set ontoolchange(handler) {
21642
+ this._ontoolchange = handler;
21643
+ }
21644
+ /**
21645
+ * @deprecated Use `addEventListener('toolchange', callback)` instead.
21646
+ * Kept for backward compatibility with older polyfill consumers.
21647
+ */
21648
+ registerToolsChangedCallback(callback) {
21649
+ if (typeof callback !== "function") throw new TypeError("Failed to execute 'registerToolsChangedCallback' on 'ModelContextTesting': parameter 1 is not of type 'Function'.");
21650
+ this.addEventListener("toolchange", callback);
21651
+ }
21652
+ /** @internal Called by StrictWebMCPContext when tools change. */
21653
+ dispatchToolChange() {
21654
+ const event = new Event("toolchange");
21655
+ try {
21656
+ this._ontoolchange?.call(this, event);
21657
+ } catch (error2) {
21658
+ console.warn("[WebMCPPolyfill] ontoolchange handler threw:", error2);
21659
+ }
21660
+ this.dispatchEvent(event);
21661
+ this.dispatchEvent(new Event("toolschanged"));
21662
+ }
21663
+ };
21664
+ function createUnknownError(message) {
21665
+ try {
21666
+ return new DOMException(message, "UnknownError");
21667
+ } catch {
21668
+ const error2 = new Error(message);
21669
+ error2.name = "UnknownError";
21670
+ return error2;
21671
+ }
21672
+ }
21673
+ function parseInputArgsJson(inputArgsJson) {
21674
+ let parsed;
21675
+ try {
21676
+ parsed = JSON.parse(inputArgsJson);
21677
+ } catch {
21678
+ throw createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);
21679
+ }
21680
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);
21681
+ return parsed;
21682
+ }
21683
+ function getToolNameForUnregister(nameOrTool) {
21684
+ if (typeof nameOrTool === "string") return nameOrTool;
21685
+ if (isPlainObject2(nameOrTool) && typeof nameOrTool.name === "string") return nameOrTool.name;
21686
+ throw new TypeError("Failed to execute 'unregisterTool' on 'ModelContext': parameter 1 must be a string or an object with a string name.");
21687
+ }
21688
+ function isPlainObject2(value) {
21689
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
21690
+ }
21691
+ function getStandardProps(value) {
21692
+ if (!isPlainObject2(value)) return null;
21693
+ const standard = value["~standard"];
21694
+ if (!isPlainObject2(standard)) return null;
21695
+ return standard;
21696
+ }
21697
+ function isStandardInputValidatorSchema(value) {
21698
+ const standard = getStandardProps(value);
21699
+ return Boolean(standard && standard.version === 1 && typeof standard.validate === "function");
21700
+ }
21701
+ function isStandardInputJsonSchema(value) {
21702
+ const standard = getStandardProps(value);
21703
+ if (!standard || standard.version !== 1 || !isPlainObject2(standard.jsonSchema)) return false;
21704
+ return typeof standard.jsonSchema.input === "function";
21705
+ }
21706
+ function createStandardValidatorFromJsonSchema(schema) {
21707
+ return { "~standard": {
21708
+ version: 1,
21709
+ vendor: "@mcp-b/webmcp-polyfill-json-schema",
21710
+ validate(value) {
21711
+ if (!isPlainObject2(value)) return { issues: [{ message: "expected object arguments" }] };
21712
+ const issue2 = validateArgsWithSchema(value, schema);
21713
+ if (issue2) return { issues: [issue2] };
21714
+ return { value };
21715
+ }
21716
+ } };
21717
+ }
21718
+ function convertStandardInputSchema(schema) {
21719
+ for (const target of STANDARD_JSON_SCHEMA_TARGETS) try {
21720
+ const converted = schema["~standard"].jsonSchema.input({ target });
21721
+ validateInputSchema(converted);
21722
+ return converted;
21723
+ } catch (error2) {
21724
+ console.warn(`[WebMCPPolyfill] Standard JSON Schema conversion failed for target "${target}":`, error2);
21725
+ }
21726
+ throw new Error("Failed to convert Standard JSON Schema inputSchema to a JSON Schema object");
21727
+ }
21728
+ function normalizeInputSchema(inputSchema2) {
21729
+ if (inputSchema2 === void 0) {
21730
+ const normalized = DEFAULT_INPUT_SCHEMA;
21731
+ return {
21732
+ inputSchema: normalized,
21733
+ standardValidator: createStandardValidatorFromJsonSchema(normalized)
21734
+ };
21735
+ }
21736
+ if (isStandardInputJsonSchema(inputSchema2)) {
21737
+ const converted = convertStandardInputSchema(inputSchema2);
21738
+ return {
21739
+ inputSchema: converted,
21740
+ standardValidator: createStandardValidatorFromJsonSchema(converted)
21741
+ };
21742
+ }
21743
+ if (isStandardInputValidatorSchema(inputSchema2)) return {
21744
+ inputSchema: DEFAULT_INPUT_SCHEMA,
21745
+ standardValidator: inputSchema2
21746
+ };
21747
+ validateInputSchema(inputSchema2);
21748
+ if (Object.keys(inputSchema2).length === 0) return {
21749
+ inputSchema: DEFAULT_INPUT_SCHEMA,
21750
+ standardValidator: createStandardValidatorFromJsonSchema(DEFAULT_INPUT_SCHEMA)
21751
+ };
21752
+ const normalizedSchema = inputSchema2.type === void 0 ? {
21753
+ type: "object",
21754
+ ...inputSchema2
21755
+ } : inputSchema2;
21756
+ return {
21757
+ inputSchema: normalizedSchema,
21758
+ standardValidator: createStandardValidatorFromJsonSchema(normalizedSchema)
21759
+ };
21760
+ }
21761
+ function validateInputSchema(schema) {
21762
+ if (!isPlainObject2(schema)) throw new Error("inputSchema must be a JSON Schema object");
21763
+ validateJsonSchemaNode(schema, "$");
21764
+ }
21765
+ function validateJsonSchemaNode(node, path) {
21766
+ const typeValue = node.type;
21767
+ if (typeValue !== void 0 && typeof typeValue !== "string" && !(Array.isArray(typeValue) && typeValue.every((entry) => typeof entry === "string" && entry.length > 0))) throw new Error(`Invalid JSON Schema at ${path}: "type" must be a string or string[]`);
21768
+ const requiredValue = node.required;
21769
+ if (requiredValue !== void 0 && !(Array.isArray(requiredValue) && requiredValue.every((entry) => typeof entry === "string"))) throw new Error(`Invalid JSON Schema at ${path}: "required" must be an array of strings`);
21770
+ const propertiesValue = node.properties;
21771
+ if (propertiesValue !== void 0) {
21772
+ if (!isPlainObject2(propertiesValue)) throw new Error(`Invalid JSON Schema at ${path}: "properties" must be an object`);
21773
+ for (const [key, value] of Object.entries(propertiesValue)) {
21774
+ if (!isPlainObject2(value)) throw new Error(`Invalid JSON Schema at ${path}.properties.${key}: expected object schema`);
21775
+ validateJsonSchemaNode(value, `${path}.properties.${key}`);
21776
+ }
21777
+ }
21778
+ const itemsValue = node.items;
21779
+ if (itemsValue !== void 0) if (Array.isArray(itemsValue)) for (const [index, value] of itemsValue.entries()) {
21780
+ if (!isPlainObject2(value)) throw new Error(`Invalid JSON Schema at ${path}.items[${index}]: expected object schema`);
21781
+ validateJsonSchemaNode(value, `${path}.items[${index}]`);
21782
+ }
21783
+ else if (isPlainObject2(itemsValue)) validateJsonSchemaNode(itemsValue, `${path}.items`);
21784
+ else throw new Error(`Invalid JSON Schema at ${path}: "items" must be an object or object[]`);
21785
+ for (const keyword of [
21786
+ "allOf",
21787
+ "anyOf",
21788
+ "oneOf"
21789
+ ]) {
21790
+ const value = node[keyword];
21791
+ if (value === void 0) continue;
21792
+ if (!Array.isArray(value)) throw new Error(`Invalid JSON Schema at ${path}: "${keyword}" must be an array`);
21793
+ for (const [index, entry] of value.entries()) {
21794
+ if (!isPlainObject2(entry)) throw new Error(`Invalid JSON Schema at ${path}.${keyword}[${index}]: expected object schema`);
21795
+ validateJsonSchemaNode(entry, `${path}.${keyword}[${index}]`);
21796
+ }
21797
+ }
21798
+ const notValue = node.not;
21799
+ if (notValue !== void 0) {
21800
+ if (!isPlainObject2(notValue)) throw new Error(`Invalid JSON Schema at ${path}: "not" must be an object schema`);
21801
+ validateJsonSchemaNode(notValue, `${path}.not`);
21802
+ }
21803
+ try {
21804
+ JSON.stringify(node);
21805
+ } catch {
21806
+ throw new Error(`Invalid JSON Schema at ${path}: schema must be JSON-serializable`);
21807
+ }
21808
+ }
21809
+ function normalizeToolDescriptor(tool, existing) {
21810
+ if (!tool || typeof tool !== "object") throw new TypeError("registerTool(tool) requires a tool object");
21811
+ if (typeof tool.name !== "string" || tool.name.length === 0) throw new TypeError('Tool "name" must be a non-empty string');
21812
+ if (typeof tool.description !== "string" || tool.description.length === 0) throw new TypeError('Tool "description" must be a non-empty string');
21813
+ if (typeof tool.execute !== "function") throw new TypeError('Tool "execute" must be a function');
21814
+ if (existing.has(tool.name)) throw new Error(`Tool already registered: ${tool.name}`);
21815
+ const normalizedInputSchema = normalizeInputSchema(tool.inputSchema);
21816
+ const annotations = tool.annotations;
21817
+ const normalizedAnnotations = annotations ? {
21818
+ ...annotations,
21819
+ ...annotations.readOnlyHint === "true" ? { readOnlyHint: true } : annotations.readOnlyHint === "false" ? { readOnlyHint: false } : {},
21820
+ ...annotations.destructiveHint === "true" ? { destructiveHint: true } : annotations.destructiveHint === "false" ? { destructiveHint: false } : {},
21821
+ ...annotations.idempotentHint === "true" ? { idempotentHint: true } : annotations.idempotentHint === "false" ? { idempotentHint: false } : {},
21822
+ ...annotations.openWorldHint === "true" ? { openWorldHint: true } : annotations.openWorldHint === "false" ? { openWorldHint: false } : {}
21823
+ } : void 0;
21824
+ return {
21825
+ ...tool,
21826
+ ...normalizedAnnotations ? { annotations: normalizedAnnotations } : {},
21827
+ inputSchema: normalizedInputSchema.inputSchema,
21828
+ [STANDARD_VALIDATOR_SYMBOL]: normalizedInputSchema.standardValidator
21829
+ };
21830
+ }
21831
+ function validateArgsWithSchema(args, schema) {
21832
+ const result2 = new Validator(schema, "2020-12", true).validate(args);
21833
+ if (result2.valid) return null;
21834
+ const error2 = result2.errors[result2.errors.length - 1];
21835
+ if (!error2) return { message: "Input validation failed" };
21836
+ return { message: error2.error };
21837
+ }
21838
+ function formatStandardIssuePath(path) {
21839
+ if (!path || path.length === 0) return null;
21840
+ const segments = path.map((segment) => {
21841
+ if (isPlainObject2(segment) && "key" in segment) return segment.key;
21842
+ return segment;
21843
+ }).map((segment) => String(segment)).filter((segment) => segment.length > 0);
21844
+ if (segments.length === 0) return null;
21845
+ return segments.join(".");
21846
+ }
21847
+ async function validateArgsWithStandardSchema(args, schema) {
21848
+ let result2;
21849
+ try {
21850
+ result2 = await Promise.resolve(schema["~standard"].validate(args));
21851
+ } catch (error2) {
21852
+ const detail = error2 instanceof Error ? `: ${error2.message}` : "";
21853
+ console.error("[WebMCPPolyfill] Standard Schema validation threw unexpectedly:", error2);
21854
+ return `Input validation error: schema validation failed${detail}`;
21855
+ }
21856
+ if (!result2.issues || result2.issues.length === 0) return null;
21857
+ const firstIssue = result2.issues[0];
21858
+ if (!firstIssue) return "Input validation error";
21859
+ const path = formatStandardIssuePath(firstIssue?.path);
21860
+ if (path) return `Input validation error: ${firstIssue.message} at ${path}`;
21861
+ return `Input validation error: ${firstIssue.message}`;
21862
+ }
21863
+ async function validateArgsForTool(args, tool) {
21864
+ return validateArgsWithStandardSchema(args, tool[STANDARD_VALIDATOR_SYMBOL]);
21865
+ }
21866
+ function isCallToolResult(value) {
21867
+ return isPlainObject2(value) && Array.isArray(value.content);
21868
+ }
21869
+ function isJsonPrimitive(value) {
21870
+ return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
21871
+ }
21872
+ function isJsonValue(value) {
21873
+ if (isJsonPrimitive(value)) return Number.isFinite(value) || typeof value !== "number";
21874
+ if (Array.isArray(value)) return value.every((entry) => isJsonValue(entry));
21875
+ if (!isPlainObject2(value)) return false;
21876
+ return Object.values(value).every((entry) => isJsonValue(entry));
21877
+ }
21878
+ function toStructuredContent(value) {
21879
+ if (!isPlainObject2(value) || !isJsonValue(value)) return;
21880
+ return value;
21881
+ }
21882
+ function serializeTextContent(value) {
21883
+ if (typeof value === "string") return value;
21884
+ try {
21885
+ return JSON.stringify(value) ?? String(value);
21886
+ } catch {
21887
+ return String(value);
21888
+ }
21889
+ }
21890
+ function normalizeToolResponse(value) {
21891
+ if (isCallToolResult(value)) return value;
21892
+ const structuredContent = toStructuredContent(value);
21893
+ return {
21894
+ content: [{
21895
+ type: "text",
21896
+ text: serializeTextContent(value)
21897
+ }],
21898
+ ...structuredContent ? { structuredContent } : {},
21899
+ isError: false
21900
+ };
21901
+ }
21902
+ function getFirstTextBlock(result2) {
21903
+ for (const block of result2.content ?? []) if (block.type === "text" && "text" in block && typeof block.text === "string") return block.text;
21904
+ return null;
21905
+ }
21906
+ function toSerializedTestingResult(result2) {
21907
+ if (result2.isError) throw createUnknownError(getFirstTextBlock(result2)?.replace(/^Error:\s*/i, "").trim() || TOOL_INVOCATION_FAILED_MESSAGE);
21908
+ const metadata = result2.metadata;
21909
+ if (metadata && typeof metadata === "object" && metadata.willNavigate) return null;
21910
+ try {
21911
+ return JSON.stringify(result2);
21912
+ } catch {
21913
+ throw createUnknownError(TOOL_INVOCATION_FAILED_MESSAGE);
21914
+ }
21915
+ }
21916
+ function withAbortSignal(operation, signal2) {
21917
+ if (!signal2) return operation;
21918
+ if (signal2.aborted) return Promise.reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
21919
+ return new Promise((resolve, reject) => {
21920
+ const onAbort = () => {
21921
+ cleanup();
21922
+ reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
21923
+ };
21924
+ const cleanup = () => {
21925
+ signal2.removeEventListener("abort", onAbort);
21926
+ };
21927
+ signal2.addEventListener("abort", onAbort, { once: true });
21928
+ operation.then((value) => {
21929
+ cleanup();
21930
+ resolve(value);
21931
+ }, (error2) => {
21932
+ cleanup();
21933
+ reject(error2);
21934
+ });
21935
+ });
21936
+ }
21937
+ function getNavigator() {
21938
+ if (typeof navigator !== "undefined") return navigator;
21939
+ return null;
21940
+ }
21941
+ function getDocument() {
21942
+ if (typeof document !== "undefined") return document;
21943
+ return null;
21944
+ }
21945
+ function defineNavigatorProperty(target, key, value) {
21946
+ Object.defineProperty(target, key, {
21947
+ configurable: true,
21948
+ enumerable: true,
21949
+ writable: false,
21950
+ value
21951
+ });
21952
+ }
21953
+ function defineDocumentModelContextProperty(target, value) {
21954
+ Object.defineProperty(target, "modelContext", {
21955
+ configurable: true,
21956
+ enumerable: true,
21957
+ writable: false,
21958
+ value
21959
+ });
21960
+ }
21961
+ var navigatorModelContextDeprecationWarned = false;
21962
+ function defineDeprecatedNavigatorModelContext(target, value) {
21963
+ Object.defineProperty(target, "modelContext", {
21964
+ configurable: true,
21965
+ enumerable: true,
21966
+ get() {
21967
+ if (!navigatorModelContextDeprecationWarned) {
21968
+ navigatorModelContextDeprecationWarned = true;
21969
+ console.warn("[WebMCPPolyfill] navigator.modelContext is deprecated. The May 27, 2026 WebMCP draft moved the modelContext getter from Navigator to Document \u2014 use document.modelContext instead. See https://github.com/webmachinelearning/webmcp/pull/184.");
21970
+ }
21971
+ return value;
21972
+ }
21973
+ });
21974
+ }
21975
+ function initializeWebMCPPolyfill(options) {
21976
+ const nav = getNavigator();
21977
+ const doc = getDocument();
21978
+ if (!nav && !doc) return;
21979
+ const documentModelContext = doc?.modelContext;
21980
+ if (Boolean(documentModelContext)) return;
21981
+ const navigatorModelContext = nav?.modelContext;
21982
+ const hasNavigatorModelContext = Boolean(navigatorModelContext);
21983
+ if (installState.installed) cleanupWebMCPPolyfill();
21984
+ if (doc && navigatorModelContext) {
21985
+ installState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, "modelContext");
21986
+ defineDocumentModelContextProperty(doc, navigatorModelContext);
21987
+ installState.installedDocumentModelContext = true;
21988
+ installState.installed = true;
21989
+ return;
21990
+ }
21991
+ if (hasNavigatorModelContext) return;
21992
+ const context = new StrictWebMCPContext();
21993
+ const modelContext = context;
21994
+ modelContext[POLYFILL_MARKER_PROPERTY] = true;
21995
+ if (doc) {
21996
+ installState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, "modelContext");
21997
+ defineDocumentModelContextProperty(doc, modelContext);
21998
+ installState.installedDocumentModelContext = true;
21999
+ }
22000
+ if (nav) {
22001
+ installState.previousNavigatorModelContextDescriptor = Object.getOwnPropertyDescriptor(nav, "modelContext");
22002
+ installState.previousNavigatorModelContextTestingDescriptor = Object.getOwnPropertyDescriptor(nav, "modelContextTesting");
22003
+ navigatorModelContextDeprecationWarned = false;
22004
+ defineDeprecatedNavigatorModelContext(nav, modelContext);
22005
+ installState.installedNavigatorModelContext = true;
22006
+ const installTestingShim = options?.installTestingShim ?? "if-missing";
22007
+ const hasModelContextTesting = Boolean(nav.modelContextTesting);
22008
+ if (installTestingShim === "always" || (installTestingShim === true || installTestingShim === "if-missing") && !hasModelContextTesting) {
22009
+ defineNavigatorProperty(nav, "modelContextTesting", context.getTestingShim());
22010
+ installState.installedNavigatorModelContextTesting = true;
22011
+ }
22012
+ }
22013
+ installState.installed = true;
22014
+ }
22015
+ function cleanupWebMCPPolyfill() {
22016
+ if (!installState.installed) return;
22017
+ const restore = (target, key, previousDescriptor) => {
22018
+ if (previousDescriptor) {
22019
+ Object.defineProperty(target, key, previousDescriptor);
22020
+ return;
22021
+ }
22022
+ delete target[key];
22023
+ };
22024
+ const nav = getNavigator();
22025
+ const doc = getDocument();
22026
+ if (doc && installState.installedDocumentModelContext) restore(doc, "modelContext", installState.previousDocumentModelContextDescriptor);
22027
+ if (nav && installState.installedNavigatorModelContext) restore(nav, "modelContext", installState.previousNavigatorModelContextDescriptor);
22028
+ if (nav && installState.installedNavigatorModelContextTesting) restore(nav, "modelContextTesting", installState.previousNavigatorModelContextTestingDescriptor);
22029
+ installState.installed = false;
22030
+ installState.previousDocumentModelContextDescriptor = void 0;
22031
+ installState.previousNavigatorModelContextDescriptor = void 0;
22032
+ installState.previousNavigatorModelContextTestingDescriptor = void 0;
22033
+ installState.installedDocumentModelContext = false;
22034
+ installState.installedNavigatorModelContext = false;
22035
+ installState.installedNavigatorModelContextTesting = false;
22036
+ navigatorModelContextDeprecationWarned = false;
22037
+ }
22038
+ if (typeof window !== "undefined" && typeof document !== "undefined") {
22039
+ const options = window.__webMCPPolyfillOptions;
22040
+ if (options?.autoInitialize !== false) try {
22041
+ initializeWebMCPPolyfill(options);
22042
+ } catch (error2) {
22043
+ console.error("[WebMCPPolyfill] Auto-initialization failed:", error2);
22044
+ }
22045
+ }
22046
+
20328
22047
  // ../../node_modules/.pnpm/@page-agent+page-controller@1.12.4/node_modules/@page-agent/page-controller/dist/lib/page-controller.js
20329
22048
  var __defProp2 = Object.defineProperty;
20330
22049
  var __exportAll = (all, no_symbols) => {
@@ -21522,19 +23241,19 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
21522
23241
  }
21523
23242
  var globRegexCache = /* @__PURE__ */ new Map();
21524
23243
  function globToRegex(pattern) {
21525
- let regex = globRegexCache.get(pattern);
21526
- if (!regex) {
23244
+ let regex2 = globRegexCache.get(pattern);
23245
+ if (!regex2) {
21527
23246
  const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&");
21528
- regex = new RegExp(`^${escaped.replace(/\*/g, ".*")}$`);
21529
- globRegexCache.set(pattern, regex);
23247
+ regex2 = new RegExp(`^${escaped.replace(/\*/g, ".*")}$`);
23248
+ globRegexCache.set(pattern, regex2);
21530
23249
  }
21531
- return regex;
23250
+ return regex2;
21532
23251
  }
21533
23252
  function matchAttributes(attrs, patterns) {
21534
23253
  const result2 = {};
21535
23254
  for (const pattern of patterns) if (pattern.includes("*")) {
21536
- const regex = globToRegex(pattern);
21537
- for (const key of Object.keys(attrs)) if (regex.test(key) && attrs[key].trim()) result2[key] = attrs[key].trim();
23255
+ const regex2 = globToRegex(pattern);
23256
+ for (const key of Object.keys(attrs)) if (regex2.test(key) && attrs[key].trim()) result2[key] = attrs[key].trim();
21538
23257
  } else {
21539
23258
  const value = attrs[pattern];
21540
23259
  if (value && value.trim()) result2[pattern] = value.trim();
@@ -22182,7 +23901,6 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
22182
23901
  enableHighlight: false,
22183
23902
  removeMaskAfterToolCall: true,
22184
23903
  enableExecuteJavascript: true,
22185
- cursorMode: "actionOnly",
22186
23904
  a11yConfig: DEFAULT_A11Y_CONFIG
22187
23905
  };
22188
23906
  function getPageAgentToolConfig() {
@@ -22193,7 +23911,6 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
22193
23911
  enableHighlight: DEFAULT_PAGE_AGENT_TOOL_CONFIG.enableHighlight,
22194
23912
  removeMaskAfterToolCall: DEFAULT_PAGE_AGENT_TOOL_CONFIG.removeMaskAfterToolCall,
22195
23913
  enableExecuteJavascript: DEFAULT_PAGE_AGENT_TOOL_CONFIG.enableExecuteJavascript,
22196
- cursorMode: DEFAULT_PAGE_AGENT_TOOL_CONFIG.cursorMode,
22197
23914
  a11yConfig: mergeA11yConfig()
22198
23915
  };
22199
23916
  }
@@ -22202,23 +23919,13 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
22202
23919
  enableHighlight: patch.enableHighlight ?? base.enableHighlight,
22203
23920
  removeMaskAfterToolCall: patch.removeMaskAfterToolCall ?? base.removeMaskAfterToolCall,
22204
23921
  enableExecuteJavascript: patch.enableExecuteJavascript ?? base.enableExecuteJavascript,
22205
- cursorMode: patch.cursorMode ?? base.cursorMode,
22206
23922
  a11yConfig: mergeA11yConfigs(base.a11yConfig, patch.a11yConfig ?? {})
22207
23923
  };
22208
23924
  }
22209
- function resolveFunctionPatch(fnPatch, current) {
22210
- return {
22211
- enableHighlight: fnPatch.enableHighlight ?? current.enableHighlight,
22212
- removeMaskAfterToolCall: fnPatch.removeMaskAfterToolCall ?? current.removeMaskAfterToolCall,
22213
- enableExecuteJavascript: fnPatch.enableExecuteJavascript ?? current.enableExecuteJavascript,
22214
- cursorMode: fnPatch.cursorMode ?? current.cursorMode,
22215
- a11yConfig: fnPatch.a11yConfig !== void 0 ? mergeA11yConfigs(DEFAULT_PAGE_AGENT_TOOL_CONFIG.a11yConfig, fnPatch.a11yConfig) : current.a11yConfig
22216
- };
22217
- }
22218
23925
  function setPageAgentToolConfig(patch, options) {
22219
23926
  const mode = options?.mode ?? "merge";
22220
23927
  const current = getPageAgentToolConfig();
22221
- const next = typeof patch === "function" ? resolveFunctionPatch(patch(current), current) : resolvePatch(patch, mode === "replace" ? DEFAULT_PAGE_AGENT_TOOL_CONFIG : current);
23928
+ const next = typeof patch === "function" ? resolvePatch(patch(current), DEFAULT_PAGE_AGENT_TOOL_CONFIG) : resolvePatch(patch, mode === "replace" ? DEFAULT_PAGE_AGENT_TOOL_CONFIG : current);
22222
23929
  if (typeof window !== "undefined") {
22223
23930
  window.__webmcpcli_toolConfig = next;
22224
23931
  }
@@ -22685,8 +24392,8 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
22685
24392
  }
22686
24393
  var wordWithSpaceDiff = new Diff();
22687
24394
  wordWithSpaceDiff.tokenize = function(value) {
22688
- var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
22689
- return value.match(regex) || [];
24395
+ var regex2 = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
24396
+ return value.match(regex2) || [];
22690
24397
  };
22691
24398
  var lineDiff = new Diff();
22692
24399
  lineDiff.tokenize = function(value, options) {
@@ -22825,7 +24532,7 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
22825
24532
  ]).describe(`\u6267\u884C\u7684\u52A8\u4F5C\u540D\u79F0, \u6BCF\u4E00\u6B21\u6267\u884C 'click', 'fill', 'select', 'hover'\u52A8\u4F5C\u4E4B\u524D\uFF0C**\u5FC5\u987B**\u8981\u5148\u8C03\u7528 'browserState' \u53BB\u83B7\u53D6\u9875\u9762\u7684\u6700\u65B0\u72B6\u6001\u3002
22826
24533
  browserState: '\u67E5\u8BE2\u6574\u4E2A\u9875\u9762\u7684\u6D4F\u89C8\u5668\u72B6\u6001;\u8FD4\u56DE\u9875\u9762\u7684\u6807\u9898\u3001URL\u3001YAML\u683C\u5F0F\u7684\u8BED\u4E49\u5316\u9875\u9762\u6811',
22827
24534
  click: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u70B9\u51FB;',
22828
- fill: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u586B\u5199\u6587\u672C\uFF08\u76EE\u6807\u4E3A input\u3001textarea \u6216 contenteditable \u7F16\u8F91\u5BBF\u4E3B\uFF0C\u7D22\u5F15\u6765\u81EA browserState YAML \u4E2D\u7684 #N\uFF09;';
24535
+ fill: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u586B\u5199\u6587\u672C;';
22829
24536
  select: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u9009\u62E9\u4E0B\u62C9\u6846\u9009\u9879;';
22830
24537
  scroll: '\u6EDA\u52A8\u9875\u9762\u7684\u52A8\u4F5C\uFF0C\u53EF\u4EE5\u6307\u5B9A\u6C34\u5E73\u6EDA\u52A8\u8FD8\u662F\u4E0A\u4E0B\u6EDA\u52A8; \u4E0D\u5E26\u5143\u7D20\u7D22\u5F15\u65F6\uFF1A\u6EDA\u52A8\u6574\u4E2A\u6587\u6863\u3002\u5E26\u5143\u7D20\u7D22\u5F15\u65F6\uFF1A\u6EDA\u52A8\u8BE5\u7D22\u5F15\u5904\u7684\u5BB9\u5668\uFF08\u6216\u5176\u6700\u8FD1\u7684\u53EF\u6EDA\u52A8\u7956\u5148\u5143\u7D20\uFF09'
22831
24538
  executeJavascript: '\u6267\u884Cjavascript\u4EE3\u7801'