@reactionary/feeds 0.12.5 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +1939 -522
  2. package/package.json +9 -9
package/cli.cjs CHANGED
@@ -1764,8 +1764,8 @@ var require_errors = __commonJS({
1764
1764
  };
1765
1765
  exports2.AbortError = AbortError;
1766
1766
  var WatchError = class extends Error {
1767
- constructor(message = "One (or more) of the watched keys has been changed") {
1768
- super(message);
1767
+ constructor(message2 = "One (or more) of the watched keys has been changed") {
1768
+ super(message2);
1769
1769
  }
1770
1770
  };
1771
1771
  exports2.WatchError = WatchError;
@@ -2962,11 +2962,11 @@ var require_generic_transformers = __commonJS({
2962
2962
  3: void 0
2963
2963
  };
2964
2964
  function transformTuplesToMap(reply, func) {
2965
- const message = /* @__PURE__ */ Object.create(null);
2965
+ const message2 = /* @__PURE__ */ Object.create(null);
2966
2966
  for (let i3 = 0; i3 < reply.length; i3 += 2) {
2967
- message[reply[i3].toString()] = func(reply[i3 + 1]);
2967
+ message2[reply[i3].toString()] = func(reply[i3 + 1]);
2968
2968
  }
2969
- return message;
2969
+ return message2;
2970
2970
  }
2971
2971
  exports2.transformTuplesToMap = transformTuplesToMap;
2972
2972
  function createTransformTuplesReplyFunc(preserve, typeMapping) {
@@ -3218,10 +3218,10 @@ var require_generic_transformers = __commonJS({
3218
3218
  }
3219
3219
  exports2.parseArgs = parseArgs;
3220
3220
  function transformStreamMessageReply(typeMapping, reply) {
3221
- const [id, message, millisElapsedFromDelivery, deliveriesCounter] = reply;
3221
+ const [id, message2, millisElapsedFromDelivery, deliveriesCounter] = reply;
3222
3222
  return {
3223
3223
  id,
3224
- message: transformTuplesReply(message, void 0, typeMapping),
3224
+ message: transformTuplesReply(message2, void 0, typeMapping),
3225
3225
  ...millisElapsedFromDelivery !== void 0 ? { millisElapsedFromDelivery } : {},
3226
3226
  ...deliveriesCounter !== void 0 ? { deliveriesCounter } : {}
3227
3227
  };
@@ -5611,8 +5611,8 @@ var require_ECHO = __commonJS({
5611
5611
  * @param parser - The Redis command parser
5612
5612
  * @param message - Message to echo back
5613
5613
  */
5614
- parseCommand(parser, message) {
5615
- parser.push("ECHO", message);
5614
+ parseCommand(parser, message2) {
5615
+ parser.push("ECHO", message2);
5616
5616
  },
5617
5617
  transformReply: void 0
5618
5618
  };
@@ -10063,10 +10063,10 @@ var require_PING = __commonJS({
10063
10063
  * @param message - Optional message to be returned instead of PONG
10064
10064
  * @see https://redis.io/commands/ping/
10065
10065
  */
10066
- parseCommand(parser, message) {
10066
+ parseCommand(parser, message2) {
10067
10067
  parser.push("PING");
10068
- if (message) {
10069
- parser.push(message);
10068
+ if (message2) {
10069
+ parser.push(message2);
10070
10070
  }
10071
10071
  },
10072
10072
  transformReply: void 0
@@ -10139,8 +10139,8 @@ var require_PUBLISH = __commonJS({
10139
10139
  * @param message - The message to publish
10140
10140
  * @see https://redis.io/commands/publish/
10141
10141
  */
10142
- parseCommand(parser, channel, message) {
10143
- parser.push("PUBLISH", channel, message);
10142
+ parseCommand(parser, channel, message2) {
10143
+ parser.push("PUBLISH", channel, message2);
10144
10144
  },
10145
10145
  transformReply: void 0
10146
10146
  };
@@ -11399,10 +11399,10 @@ var require_SPUBLISH = __commonJS({
11399
11399
  * @param message - The message to publish
11400
11400
  * @see https://redis.io/commands/spublish/
11401
11401
  */
11402
- parseCommand(parser, channel, message) {
11402
+ parseCommand(parser, channel, message2) {
11403
11403
  parser.push("SPUBLISH");
11404
11404
  parser.pushKey(channel);
11405
- parser.push(message);
11405
+ parser.push(message2);
11406
11406
  },
11407
11407
  transformReply: void 0
11408
11408
  };
@@ -11836,7 +11836,7 @@ var require_XADD = __commonJS({
11836
11836
  "use strict";
11837
11837
  Object.defineProperty(exports2, "__esModule", { value: true });
11838
11838
  exports2.parseXAddArguments = void 0;
11839
- function parseXAddArguments(optional2, parser, key, id, message, options) {
11839
+ function parseXAddArguments(optional2, parser, key, id, message2, options) {
11840
11840
  parser.push("XADD");
11841
11841
  parser.pushKey(key);
11842
11842
  if (optional2) {
@@ -11866,7 +11866,7 @@ var require_XADD = __commonJS({
11866
11866
  }
11867
11867
  }
11868
11868
  parser.push(id);
11869
- for (const [key2, value] of Object.entries(message)) {
11869
+ for (const [key2, value] of Object.entries(message2)) {
11870
11870
  parser.push(key2, value);
11871
11871
  }
11872
11872
  }
@@ -12482,10 +12482,10 @@ var require_XINFO_STREAM = __commonJS({
12482
12482
  function transformEntry(entry) {
12483
12483
  if ((0, generic_transformers_1.isNullReply)(entry))
12484
12484
  return entry;
12485
- const [id, message] = entry;
12485
+ const [id, message2] = entry;
12486
12486
  return {
12487
12487
  id,
12488
- message: (0, generic_transformers_1.transformTuplesReply)(message)
12488
+ message: (0, generic_transformers_1.transformTuplesReply)(message2)
12489
12489
  };
12490
12490
  }
12491
12491
  }
@@ -16558,9 +16558,9 @@ var require_token_manager = __commonJS({
16558
16558
  var IDPError = class extends Error {
16559
16559
  message;
16560
16560
  isRetryable;
16561
- constructor(message, isRetryable2) {
16562
- super(message);
16563
- this.message = message;
16561
+ constructor(message2, isRetryable2) {
16562
+ super(message2);
16563
+ this.message = message2;
16564
16564
  this.isRetryable = isRetryable2;
16565
16565
  this.name = "IDPError";
16566
16566
  }
@@ -16727,15 +16727,15 @@ var require_credentials_provider = __commonJS({
16727
16727
  Object.defineProperty(exports2, "__esModule", { value: true });
16728
16728
  exports2.UnableToObtainNewCredentialsError = exports2.CredentialsError = void 0;
16729
16729
  var CredentialsError = class extends Error {
16730
- constructor(message) {
16731
- super(`Re-authentication with latest credentials failed: ${message}`);
16730
+ constructor(message2) {
16731
+ super(`Re-authentication with latest credentials failed: ${message2}`);
16732
16732
  this.name = "CredentialsError";
16733
16733
  }
16734
16734
  };
16735
16735
  exports2.CredentialsError = CredentialsError;
16736
16736
  var UnableToObtainNewCredentialsError = class extends Error {
16737
- constructor(message) {
16738
- super(`Unable to obtain new credentials : ${message}`);
16737
+ constructor(message2) {
16738
+ super(`Unable to obtain new credentials : ${message2}`);
16739
16739
  this.name = "UnableToObtainNewCredentialsError";
16740
16740
  }
16741
16741
  };
@@ -17645,7 +17645,7 @@ var require_pub_sub = __commonJS({
17645
17645
  [exports2.PUBSUB_TYPE.SHARDED]: sharded
17646
17646
  };
17647
17647
  }
17648
- #emitPubSubMessage(type, message, channel, pattern) {
17648
+ #emitPubSubMessage(type, message2, channel, pattern) {
17649
17649
  const keyString = (pattern ?? channel).toString(), listeners = this.listeners[type].get(keyString);
17650
17650
  if (!listeners)
17651
17651
  return;
@@ -17656,15 +17656,15 @@ var require_pub_sub = __commonJS({
17656
17656
  sharded: type === exports2.PUBSUB_TYPE.SHARDED
17657
17657
  }));
17658
17658
  for (const listener of listeners.buffers) {
17659
- listener(message, channel);
17659
+ listener(message2, channel);
17660
17660
  }
17661
17661
  if (!listeners.strings.size)
17662
17662
  return;
17663
17663
  const channelString = pattern ? channel.toString() : keyString, messageString = channelString === "__redis__:invalidate" ? (
17664
17664
  // https://github.com/redis/redis/pull/7469
17665
17665
  // https://github.com/redis/redis/issues/7463
17666
- message === null ? null : message.map((x4) => x4.toString())
17667
- ) : message.toString();
17666
+ message2 === null ? null : message2.map((x4) => x4.toString())
17667
+ ) : message2.toString();
17668
17668
  for (const listener of listeners.strings) {
17669
17669
  listener(messageString, channelString);
17670
17670
  }
@@ -19894,8 +19894,8 @@ var require_error_util = __commonJS({
19894
19894
  function isNodeRedisNetworkError(error5) {
19895
19895
  return error5 instanceof errors_1.ConnectionTimeoutError || error5 instanceof errors_1.SocketTimeoutError || error5 instanceof errors_1.SocketClosedUnexpectedlyError || error5 instanceof errors_1.SocketTimeoutDuringMaintenanceError || error5 instanceof errors_1.CommandTimeoutDuringMaintenanceError;
19896
19896
  }
19897
- function isTlsErrorMessage(message) {
19898
- const lowerMessage = message.toLowerCase();
19897
+ function isTlsErrorMessage(message2) {
19898
+ const lowerMessage = message2.toLowerCase();
19899
19899
  return lowerMessage.includes("certificate") || lowerMessage.includes("handshake") || lowerMessage.includes("ssl") || lowerMessage.includes("tls");
19900
19900
  }
19901
19901
  function categorizeRedisError(error5) {
@@ -20337,10 +20337,10 @@ var require_metrics = __commonJS({
20337
20337
  ...!this.#options.hideStreamNames ? { [types_1.OTEL_ATTRIBUTES.redisClientStreamName]: stream2 } : {},
20338
20338
  ...consumerGroup !== void 0 ? { [types_1.OTEL_ATTRIBUTES.redisClientConsumerGroup]: consumerGroup } : {}
20339
20339
  };
20340
- for (const message of messages) {
20341
- if (!message?.id)
20340
+ for (const message2 of messages) {
20341
+ if (!message2?.id)
20342
20342
  continue;
20343
- const [tsPart] = message.id.split("-");
20343
+ const [tsPart] = message2.id.split("-");
20344
20344
  const messageTimestamp = Number.parseInt(tsPart, 10);
20345
20345
  if (!Number.isFinite(messageTimestamp))
20346
20346
  continue;
@@ -24101,12 +24101,12 @@ var require_sentinel = __commonJS({
24101
24101
  }
24102
24102
  }
24103
24103
  async #createPubSub(client) {
24104
- await client.pSubscribe(["switch-master", "[-+]sdown", "+slave", "+sentinel", "[-+]odown", "+slave-reconf-done"], (message, channel) => {
24105
- this.#handlePubSubControlChannel(channel, message);
24104
+ await client.pSubscribe(["switch-master", "[-+]sdown", "+slave", "+sentinel", "[-+]odown", "+slave-reconf-done"], (message2, channel) => {
24105
+ this.#handlePubSubControlChannel(channel, message2);
24106
24106
  }, true);
24107
24107
  return client;
24108
24108
  }
24109
- async #handlePubSubControlChannel(channel, message) {
24109
+ async #handlePubSubControlChannel(channel, message2) {
24110
24110
  this.#trace("pubsub control channel message on " + channel);
24111
24111
  this.#reset();
24112
24112
  }
@@ -27738,23 +27738,23 @@ var require_SEARCH = __commonJS({
27738
27738
  unstableResp3: true
27739
27739
  };
27740
27740
  function documentValue(tuples) {
27741
- const message = /* @__PURE__ */ Object.create(null);
27741
+ const message2 = /* @__PURE__ */ Object.create(null);
27742
27742
  if (!tuples) {
27743
- return message;
27743
+ return message2;
27744
27744
  }
27745
27745
  let i3 = 0;
27746
27746
  while (i3 < tuples.length) {
27747
27747
  const key = tuples[i3++], value = tuples[i3++];
27748
27748
  if (key === "$") {
27749
27749
  try {
27750
- Object.assign(message, JSON.parse(value));
27750
+ Object.assign(message2, JSON.parse(value));
27751
27751
  continue;
27752
27752
  } catch {
27753
27753
  }
27754
27754
  }
27755
- message[key] = value;
27755
+ message2[key] = value;
27756
27756
  }
27757
- return message;
27757
+ return message2;
27758
27758
  }
27759
27759
  }
27760
27760
  });
@@ -31984,14 +31984,14 @@ function prefixIssues(path2, issues) {
31984
31984
  return iss;
31985
31985
  });
31986
31986
  }
31987
- function unwrapMessage(message) {
31988
- return typeof message === "string" ? message : message?.message;
31987
+ function unwrapMessage(message2) {
31988
+ return typeof message2 === "string" ? message2 : message2?.message;
31989
31989
  }
31990
31990
  function finalizeIssue(iss, ctx, config3) {
31991
31991
  const full = { ...iss, path: iss.path ?? [] };
31992
31992
  if (!iss.message) {
31993
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config3.customError?.(iss)) ?? unwrapMessage(config3.localeError?.(iss)) ?? "Invalid input";
31994
- full.message = message;
31993
+ const message2 = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config3.customError?.(iss)) ?? unwrapMessage(config3.localeError?.(iss)) ?? "Invalid input";
31994
+ full.message = message2;
31995
31995
  }
31996
31996
  delete full.inst;
31997
31997
  delete full.continue;
@@ -33620,13 +33620,13 @@ var init_schemas = __esm({
33620
33620
  }
33621
33621
  return propValues;
33622
33622
  });
33623
- const isObject2 = isObject;
33623
+ const isObject3 = isObject;
33624
33624
  const catchall = def.catchall;
33625
33625
  let value;
33626
33626
  inst._zod.parse = (payload, ctx) => {
33627
33627
  value ?? (value = _normalized.value);
33628
33628
  const input = payload.value;
33629
- if (!isObject2(input)) {
33629
+ if (!isObject3(input)) {
33630
33630
  payload.issues.push({
33631
33631
  expected: "object",
33632
33632
  code: "invalid_type",
@@ -33700,7 +33700,7 @@ var init_schemas = __esm({
33700
33700
  return (payload, ctx) => fn(shape, payload, ctx);
33701
33701
  };
33702
33702
  let fastpass;
33703
- const isObject2 = isObject;
33703
+ const isObject3 = isObject;
33704
33704
  const jit = !globalConfig.jitless;
33705
33705
  const allowsEval2 = allowsEval;
33706
33706
  const fastEnabled = jit && allowsEval2.value;
@@ -33709,7 +33709,7 @@ var init_schemas = __esm({
33709
33709
  inst._zod.parse = (payload, ctx) => {
33710
33710
  value ?? (value = _normalized.value);
33711
33711
  const input = payload.value;
33712
- if (!isObject2(input)) {
33712
+ if (!isObject3(input)) {
33713
33713
  payload.issues.push({
33714
33714
  expected: "object",
33715
33715
  code: "invalid_type",
@@ -39531,7 +39531,8 @@ var init_session_schema = __esm({
39531
39531
  pendingExternalLogin: looseObject({
39532
39532
  provider: string2(),
39533
39533
  state: string2(),
39534
- createdAt: coerce_exports.date()
39534
+ createdAt: coerce_exports.date(),
39535
+ data: record(string2(), string2()).optional().meta({ description: "Provider specific values that must survive the redirect, such as a PKCE code verifier and nonce." })
39535
39536
  }).optional().meta({ description: "An external login that has been started but not completed. Binds the callback to the browser that started it." })
39536
39537
  });
39537
39538
  SessionSchema = looseObject({
@@ -39986,8 +39987,8 @@ var init_base_capability = __esm({
39986
39987
  BaseCapability = class {
39987
39988
  cache;
39988
39989
  context;
39989
- constructor(cache, context2) {
39990
- this.cache = cache;
39990
+ constructor(cache3, context2) {
39991
+ this.cache = cache3;
39991
39992
  this.context = context2;
39992
39993
  }
39993
39994
  getReactionaryResourceName() {
@@ -40023,8 +40024,8 @@ var init_analytics_capability = __esm({
40023
40024
  init_base_capability();
40024
40025
  AnalyticsCapability = class extends BaseCapability {
40025
40026
  dispatcher;
40026
- constructor(cache, context2, dispatcher) {
40027
- super(cache, context2);
40027
+ constructor(cache3, context2, dispatcher) {
40028
+ super(cache3, context2);
40028
40029
  this.dispatcher = dispatcher;
40029
40030
  }
40030
40031
  getResourceName() {
@@ -40269,15 +40270,15 @@ function notFound(identifier) {
40269
40270
  return error({ type: "NotFound", identifier });
40270
40271
  }
40271
40272
  function memoize(fn, keyOf) {
40272
- const cache = /* @__PURE__ */ new Map();
40273
+ const cache3 = /* @__PURE__ */ new Map();
40273
40274
  return (arg) => {
40274
40275
  const key = keyOf(arg);
40275
- const hit = cache.get(key);
40276
+ const hit = cache3.get(key);
40276
40277
  if (hit) {
40277
40278
  return hit;
40278
40279
  }
40279
40280
  const pending = fn(arg);
40280
- cache.set(key, pending);
40281
+ cache3.set(key, pending);
40281
40282
  return pending;
40282
40283
  };
40283
40284
  }
@@ -40524,9 +40525,9 @@ var init_dispatcher = __esm({
40524
40525
  const schema = AnalyticsEventMutationSchemas[type];
40525
40526
  const mutation = schema.safeParse(input);
40526
40527
  if (!mutation.success) {
40527
- const message = mutation.error.message;
40528
- console.warn(`Analytics event '${type}' had invalid input and has been dropped: ${message}`);
40529
- return error({ type: "InvalidInput", error: message });
40528
+ const message2 = mutation.error.message;
40529
+ console.warn(`Analytics event '${type}' had invalid input and has been dropped: ${message2}`);
40530
+ return error({ type: "InvalidInput", error: message2 });
40530
40531
  }
40531
40532
  if (type === "consent-changed") {
40532
40533
  const change = AnalyticsMutationConsentChangedSchema.parse(input);
@@ -40713,8 +40714,8 @@ var init_product_recommendations_capability = __esm({
40713
40714
  };
40714
40715
  MulticastProductRecommendationsCapability = class extends ProductRecommendationsCapability {
40715
40716
  capabilities;
40716
- constructor(cache, requestContext, capabilities) {
40717
- super(cache, requestContext);
40717
+ constructor(cache3, requestContext, capabilities) {
40718
+ super(cache3, requestContext);
40718
40719
  this.capabilities = capabilities;
40719
40720
  }
40720
40721
  async getRecommendations(query) {
@@ -40788,9 +40789,9 @@ var init_client_builder = __esm({
40788
40789
  newBuilder.factories = [...this.factories, factory];
40789
40790
  return newBuilder;
40790
40791
  }
40791
- withCache(cache) {
40792
+ withCache(cache3) {
40792
40793
  const newBuilder = this.clone();
40793
- newBuilder.cache = cache;
40794
+ newBuilder.cache = cache3;
40794
40795
  return newBuilder;
40795
40796
  }
40796
40797
  withCollisionStrategy(strategy) {
@@ -40859,11 +40860,11 @@ var init_client_builder = __esm({
40859
40860
  newBuilder.analyticsSubscribers = [...this.analyticsSubscribers];
40860
40861
  return newBuilder;
40861
40862
  }
40862
- resolveFactory(factory, cache, context2) {
40863
+ resolveFactory(factory, cache3, context2) {
40863
40864
  if (factory.length <= 1) {
40864
- return factory({ cache, context: context2 });
40865
+ return factory({ cache: cache3, context: context2 });
40865
40866
  }
40866
- return factory(cache, context2);
40867
+ return factory(cache3, context2);
40867
40868
  }
40868
40869
  mergeCapabilities(target, source) {
40869
40870
  const result = { ...target };
@@ -41304,18 +41305,33 @@ var init_identity_capability = __esm({
41304
41305
  this.context.session.identityContext.lastUpdated = /* @__PURE__ */ new Date();
41305
41306
  this.context.session.identityContext.identity = identity;
41306
41307
  }
41307
- setPendingExternalLogin(provider, state) {
41308
- this.context.session.identityContext.pendingExternalLogin = { provider, state, createdAt: /* @__PURE__ */ new Date() };
41308
+ setPendingExternalLogin(provider, state, data) {
41309
+ this.context.session.identityContext.pendingExternalLogin = {
41310
+ provider,
41311
+ state,
41312
+ createdAt: /* @__PURE__ */ new Date(),
41313
+ ...data ? { data } : {}
41314
+ };
41309
41315
  }
41310
- /** Returns true, and clears the pending login, when provider and state match a login started in this session within the last 10 minutes. */
41311
- consumePendingExternalLogin(provider, state) {
41316
+ /**
41317
+ * Returns the pending login, and clears it, when provider and state match a login started in this session within
41318
+ * the last 10 minutes. Returns undefined otherwise. A pending login can only be taken once.
41319
+ */
41320
+ takePendingExternalLogin(provider, state) {
41312
41321
  const pending = this.context.session.identityContext.pendingExternalLogin;
41313
41322
  delete this.context.session.identityContext.pendingExternalLogin;
41314
41323
  if (!pending || !state) {
41315
- return false;
41324
+ return void 0;
41316
41325
  }
41317
41326
  const fresh = Date.now() - new Date(pending.createdAt).getTime() <= PENDING_EXTERNAL_LOGIN_TTL_MS;
41318
- return fresh && pending.provider === provider && pending.state === state;
41327
+ if (!fresh || pending.provider !== provider || pending.state !== state) {
41328
+ return void 0;
41329
+ }
41330
+ return { data: pending.data ?? {} };
41331
+ }
41332
+ /** Returns true, and clears the pending login, when provider and state match a login started in this session within the last 10 minutes. */
41333
+ consumePendingExternalLogin(provider, state) {
41334
+ return this.takePendingExternalLogin(provider, state) !== void 0;
41319
41335
  }
41320
41336
  };
41321
41337
  }
@@ -42245,7 +42261,7 @@ var require_lib6 = __commonJS({
42245
42261
  exports2.isNumber = isNumber;
42246
42262
  exports2.isString = isString;
42247
42263
  exports2.isFunction = isFunction;
42248
- exports2.isObject = isObject2;
42264
+ exports2.isObject = isObject3;
42249
42265
  exports2.isArray = isArray;
42250
42266
  exports2.isSet = isSet;
42251
42267
  exports2.isMap = isMap;
@@ -42378,7 +42394,7 @@ var require_lib6 = __commonJS({
42378
42394
  function isFunction(x4) {
42379
42395
  return !!x4 && typeof x4 === "function";
42380
42396
  }
42381
- function isObject2(x4) {
42397
+ function isObject3(x4) {
42382
42398
  const type = typeof x4;
42383
42399
  return !!x4 && (type === "function" || type === "object");
42384
42400
  }
@@ -42398,7 +42414,7 @@ var require_lib6 = __commonJS({
42398
42414
  return !x4.size;
42399
42415
  } else if (isMap(x4)) {
42400
42416
  return !x4.size;
42401
- } else if (isObject2(x4)) {
42417
+ } else if (isObject3(x4)) {
42402
42418
  for (const key in x4) {
42403
42419
  if (x4.hasOwnProperty(key)) {
42404
42420
  return false;
@@ -42409,7 +42425,7 @@ var require_lib6 = __commonJS({
42409
42425
  return false;
42410
42426
  }
42411
42427
  function isPlainObject2(x4) {
42412
- if (isObject2(x4)) {
42428
+ if (isObject3(x4)) {
42413
42429
  const proto = Object.getPrototypeOf(x4);
42414
42430
  const ctor = proto.constructor;
42415
42431
  return proto && ctor && typeof ctor === "function" && ctor instanceof ctor && Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object);
@@ -43698,8 +43714,8 @@ var require_DOMException = __commonJS({
43698
43714
  * @param name - message name
43699
43715
  * @param message - error message
43700
43716
  */
43701
- constructor(name, message = "") {
43702
- super(message);
43717
+ constructor(name, message2 = "") {
43718
+ super(message2);
43703
43719
  this.name = name;
43704
43720
  }
43705
43721
  };
@@ -43708,8 +43724,8 @@ var require_DOMException = __commonJS({
43708
43724
  /**
43709
43725
  * @param message - error message
43710
43726
  */
43711
- constructor(message = "") {
43712
- super("DOMStringSizeError", message);
43727
+ constructor(message2 = "") {
43728
+ super("DOMStringSizeError", message2);
43713
43729
  }
43714
43730
  };
43715
43731
  exports2.DOMStringSizeError = DOMStringSizeError;
@@ -43717,8 +43733,8 @@ var require_DOMException = __commonJS({
43717
43733
  /**
43718
43734
  * @param message - error message
43719
43735
  */
43720
- constructor(message = "") {
43721
- super("WrongDocumentError", "The object is in the wrong document. " + message);
43736
+ constructor(message2 = "") {
43737
+ super("WrongDocumentError", "The object is in the wrong document. " + message2);
43722
43738
  }
43723
43739
  };
43724
43740
  exports2.WrongDocumentError = WrongDocumentError;
@@ -43726,8 +43742,8 @@ var require_DOMException = __commonJS({
43726
43742
  /**
43727
43743
  * @param message - error message
43728
43744
  */
43729
- constructor(message = "") {
43730
- super("NoDataAllowedError", message);
43745
+ constructor(message2 = "") {
43746
+ super("NoDataAllowedError", message2);
43731
43747
  }
43732
43748
  };
43733
43749
  exports2.NoDataAllowedError = NoDataAllowedError;
@@ -43735,8 +43751,8 @@ var require_DOMException = __commonJS({
43735
43751
  /**
43736
43752
  * @param message - error message
43737
43753
  */
43738
- constructor(message = "") {
43739
- super("NoModificationAllowedError", "The object can not be modified. " + message);
43754
+ constructor(message2 = "") {
43755
+ super("NoModificationAllowedError", "The object can not be modified. " + message2);
43740
43756
  }
43741
43757
  };
43742
43758
  exports2.NoModificationAllowedError = NoModificationAllowedError;
@@ -43744,8 +43760,8 @@ var require_DOMException = __commonJS({
43744
43760
  /**
43745
43761
  * @param message - error message
43746
43762
  */
43747
- constructor(message = "") {
43748
- super("NotSupportedError", "The operation is not supported. " + message);
43763
+ constructor(message2 = "") {
43764
+ super("NotSupportedError", "The operation is not supported. " + message2);
43749
43765
  }
43750
43766
  };
43751
43767
  exports2.NotSupportedError = NotSupportedError;
@@ -43753,8 +43769,8 @@ var require_DOMException = __commonJS({
43753
43769
  /**
43754
43770
  * @param message - error message
43755
43771
  */
43756
- constructor(message = "") {
43757
- super("InUseAttributeError", message);
43772
+ constructor(message2 = "") {
43773
+ super("InUseAttributeError", message2);
43758
43774
  }
43759
43775
  };
43760
43776
  exports2.InUseAttributeError = InUseAttributeError;
@@ -43762,8 +43778,8 @@ var require_DOMException = __commonJS({
43762
43778
  /**
43763
43779
  * @param message - error message
43764
43780
  */
43765
- constructor(message = "") {
43766
- super("InvalidStateError", "The object is in an invalid state. " + message);
43781
+ constructor(message2 = "") {
43782
+ super("InvalidStateError", "The object is in an invalid state. " + message2);
43767
43783
  }
43768
43784
  };
43769
43785
  exports2.InvalidStateError = InvalidStateError;
@@ -43771,8 +43787,8 @@ var require_DOMException = __commonJS({
43771
43787
  /**
43772
43788
  * @param message - error message
43773
43789
  */
43774
- constructor(message = "") {
43775
- super("InvalidModificationError", "The object can not be modified in this way. " + message);
43790
+ constructor(message2 = "") {
43791
+ super("InvalidModificationError", "The object can not be modified in this way. " + message2);
43776
43792
  }
43777
43793
  };
43778
43794
  exports2.InvalidModificationError = InvalidModificationError;
@@ -43780,8 +43796,8 @@ var require_DOMException = __commonJS({
43780
43796
  /**
43781
43797
  * @param message - error message
43782
43798
  */
43783
- constructor(message = "") {
43784
- super("NamespaceError", "The operation is not allowed by Namespaces in XML. [XMLNS] " + message);
43799
+ constructor(message2 = "") {
43800
+ super("NamespaceError", "The operation is not allowed by Namespaces in XML. [XMLNS] " + message2);
43785
43801
  }
43786
43802
  };
43787
43803
  exports2.NamespaceError = NamespaceError;
@@ -43789,8 +43805,8 @@ var require_DOMException = __commonJS({
43789
43805
  /**
43790
43806
  * @param message - error message
43791
43807
  */
43792
- constructor(message = "") {
43793
- super("InvalidAccessError", "The object does not support the operation or argument. " + message);
43808
+ constructor(message2 = "") {
43809
+ super("InvalidAccessError", "The object does not support the operation or argument. " + message2);
43794
43810
  }
43795
43811
  };
43796
43812
  exports2.InvalidAccessError = InvalidAccessError;
@@ -43798,8 +43814,8 @@ var require_DOMException = __commonJS({
43798
43814
  /**
43799
43815
  * @param message - error message
43800
43816
  */
43801
- constructor(message = "") {
43802
- super("ValidationError", message);
43817
+ constructor(message2 = "") {
43818
+ super("ValidationError", message2);
43803
43819
  }
43804
43820
  };
43805
43821
  exports2.ValidationError = ValidationError;
@@ -43807,8 +43823,8 @@ var require_DOMException = __commonJS({
43807
43823
  /**
43808
43824
  * @param message - error message
43809
43825
  */
43810
- constructor(message = "") {
43811
- super("TypeMismatchError", message);
43826
+ constructor(message2 = "") {
43827
+ super("TypeMismatchError", message2);
43812
43828
  }
43813
43829
  };
43814
43830
  exports2.TypeMismatchError = TypeMismatchError;
@@ -43816,8 +43832,8 @@ var require_DOMException = __commonJS({
43816
43832
  /**
43817
43833
  * @param message - error message
43818
43834
  */
43819
- constructor(message = "") {
43820
- super("SecurityError", "The operation is insecure. " + message);
43835
+ constructor(message2 = "") {
43836
+ super("SecurityError", "The operation is insecure. " + message2);
43821
43837
  }
43822
43838
  };
43823
43839
  exports2.SecurityError = SecurityError;
@@ -43825,8 +43841,8 @@ var require_DOMException = __commonJS({
43825
43841
  /**
43826
43842
  * @param message - error message
43827
43843
  */
43828
- constructor(message = "") {
43829
- super("NetworkError", "A network error occurred. " + message);
43844
+ constructor(message2 = "") {
43845
+ super("NetworkError", "A network error occurred. " + message2);
43830
43846
  }
43831
43847
  };
43832
43848
  exports2.NetworkError = NetworkError;
@@ -43834,8 +43850,8 @@ var require_DOMException = __commonJS({
43834
43850
  /**
43835
43851
  * @param message - error message
43836
43852
  */
43837
- constructor(message = "") {
43838
- super("AbortError", "The operation was aborted. " + message);
43853
+ constructor(message2 = "") {
43854
+ super("AbortError", "The operation was aborted. " + message2);
43839
43855
  }
43840
43856
  };
43841
43857
  exports2.AbortError = AbortError;
@@ -43843,8 +43859,8 @@ var require_DOMException = __commonJS({
43843
43859
  /**
43844
43860
  * @param message - error message
43845
43861
  */
43846
- constructor(message = "") {
43847
- super("URLMismatchError", "The given URL does not match another URL. " + message);
43862
+ constructor(message2 = "") {
43863
+ super("URLMismatchError", "The given URL does not match another URL. " + message2);
43848
43864
  }
43849
43865
  };
43850
43866
  exports2.URLMismatchError = URLMismatchError;
@@ -43852,8 +43868,8 @@ var require_DOMException = __commonJS({
43852
43868
  /**
43853
43869
  * @param message - error message
43854
43870
  */
43855
- constructor(message = "") {
43856
- super("QuotaExceededError", "The quota has been exceeded. " + message);
43871
+ constructor(message2 = "") {
43872
+ super("QuotaExceededError", "The quota has been exceeded. " + message2);
43857
43873
  }
43858
43874
  };
43859
43875
  exports2.QuotaExceededError = QuotaExceededError;
@@ -43861,8 +43877,8 @@ var require_DOMException = __commonJS({
43861
43877
  /**
43862
43878
  * @param message - error message
43863
43879
  */
43864
- constructor(message = "") {
43865
- super("TimeoutError", "The operation timed out. " + message);
43880
+ constructor(message2 = "") {
43881
+ super("TimeoutError", "The operation timed out. " + message2);
43866
43882
  }
43867
43883
  };
43868
43884
  exports2.TimeoutError = TimeoutError;
@@ -43870,8 +43886,8 @@ var require_DOMException = __commonJS({
43870
43886
  /**
43871
43887
  * @param message - error message
43872
43888
  */
43873
- constructor(message = "") {
43874
- super("InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation. " + message);
43889
+ constructor(message2 = "") {
43890
+ super("InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation. " + message2);
43875
43891
  }
43876
43892
  };
43877
43893
  exports2.InvalidNodeTypeError = InvalidNodeTypeError;
@@ -43879,8 +43895,8 @@ var require_DOMException = __commonJS({
43879
43895
  /**
43880
43896
  * @param message - error message
43881
43897
  */
43882
- constructor(message = "") {
43883
- super("DataCloneError", "The object can not be cloned. " + message);
43898
+ constructor(message2 = "") {
43899
+ super("DataCloneError", "The object can not be cloned. " + message2);
43884
43900
  }
43885
43901
  };
43886
43902
  exports2.DataCloneError = DataCloneError;
@@ -43888,8 +43904,8 @@ var require_DOMException = __commonJS({
43888
43904
  /**
43889
43905
  * @param message - error message
43890
43906
  */
43891
- constructor(message = "") {
43892
- super("NotImplementedError", "The DOM method is not implemented by this module. " + message);
43907
+ constructor(message2 = "") {
43908
+ super("NotImplementedError", "The DOM method is not implemented by this module. " + message2);
43893
43909
  }
43894
43910
  };
43895
43911
  exports2.NotImplementedError = NotImplementedError;
@@ -43897,8 +43913,8 @@ var require_DOMException = __commonJS({
43897
43913
  /**
43898
43914
  * @param message - error message
43899
43915
  */
43900
- constructor(message = "") {
43901
- super("HierarchyRequestError", "The operation would yield an incorrect node tree. " + message);
43916
+ constructor(message2 = "") {
43917
+ super("HierarchyRequestError", "The operation would yield an incorrect node tree. " + message2);
43902
43918
  }
43903
43919
  };
43904
43920
  exports2.HierarchyRequestError = HierarchyRequestError;
@@ -43906,8 +43922,8 @@ var require_DOMException = __commonJS({
43906
43922
  /**
43907
43923
  * @param message - error message
43908
43924
  */
43909
- constructor(message = "") {
43910
- super("NotFoundError", "The object can not be found here. " + message);
43925
+ constructor(message2 = "") {
43926
+ super("NotFoundError", "The object can not be found here. " + message2);
43911
43927
  }
43912
43928
  };
43913
43929
  exports2.NotFoundError = NotFoundError;
@@ -43915,8 +43931,8 @@ var require_DOMException = __commonJS({
43915
43931
  /**
43916
43932
  * @param message - error message
43917
43933
  */
43918
- constructor(message = "") {
43919
- super("IndexSizeError", "The index is not in the allowed range. " + message);
43934
+ constructor(message2 = "") {
43935
+ super("IndexSizeError", "The index is not in the allowed range. " + message2);
43920
43936
  }
43921
43937
  };
43922
43938
  exports2.IndexSizeError = IndexSizeError;
@@ -43924,8 +43940,8 @@ var require_DOMException = __commonJS({
43924
43940
  /**
43925
43941
  * @param message - error message
43926
43942
  */
43927
- constructor(message = "") {
43928
- super("SyntaxError", "The string did not match the expected pattern. " + message);
43943
+ constructor(message2 = "") {
43944
+ super("SyntaxError", "The string did not match the expected pattern. " + message2);
43929
43945
  }
43930
43946
  };
43931
43947
  exports2.SyntaxError = SyntaxError2;
@@ -43933,8 +43949,8 @@ var require_DOMException = __commonJS({
43933
43949
  /**
43934
43950
  * @param message - error message
43935
43951
  */
43936
- constructor(message = "") {
43937
- super("InvalidCharacterError", "The string contains invalid characters. " + message);
43952
+ constructor(message2 = "") {
43953
+ super("InvalidCharacterError", "The string contains invalid characters. " + message2);
43938
43954
  }
43939
43955
  };
43940
43956
  exports2.InvalidCharacterError = InvalidCharacterError;
@@ -44447,9 +44463,9 @@ var require_URLAlgorithm = __commonJS({
44447
44463
  function setValidationErrorCallback(validationErrorCallback) {
44448
44464
  _validationErrorCallback = validationErrorCallback;
44449
44465
  }
44450
- function validationError(message) {
44466
+ function validationError(message2) {
44451
44467
  if (_validationErrorCallback !== void 0) {
44452
- _validationErrorCallback.call(null, "Validation Error: " + message);
44468
+ _validationErrorCallback.call(null, "Validation Error: " + message2);
44453
44469
  }
44454
44470
  }
44455
44471
  function newURL() {
@@ -56506,7 +56522,7 @@ var require_BaseReader = __commonJS({
56506
56522
  _decodeText(text2) {
56507
56523
  if (text2 == null)
56508
56524
  return text2;
56509
- return text2.replace(/&(quot|amp|apos|lt|gt);/g, (_match, tag) => _BaseReader._entityTable[tag]).replace(/&#(?:x([a-fA-F0-9]+)|([0-9]+));/g, (_match, hexStr, numStr) => String.fromCodePoint(parseInt(hexStr || numStr, hexStr ? 16 : 10)));
56525
+ return text2.replace(/&(quot|amp|apos|lt|gt);/g, (_match, tag2) => _BaseReader._entityTable[tag2]).replace(/&#(?:x([a-fA-F0-9]+)|([0-9]+));/g, (_match, hexStr, numStr) => String.fromCodePoint(parseInt(hexStr || numStr, hexStr ? 16 : 10)));
56510
56526
  }
56511
56527
  /**
56512
56528
  * Decodes serialized attribute value.
@@ -56883,7 +56899,7 @@ var require_common = __commonJS({
56883
56899
  function isNothing(subject) {
56884
56900
  return typeof subject === "undefined" || subject === null;
56885
56901
  }
56886
- function isObject2(subject) {
56902
+ function isObject3(subject) {
56887
56903
  return typeof subject === "object" && subject !== null;
56888
56904
  }
56889
56905
  function toArray(sequence) {
@@ -56912,7 +56928,7 @@ var require_common = __commonJS({
56912
56928
  return number4 === 0 && Number.NEGATIVE_INFINITY === 1 / number4;
56913
56929
  }
56914
56930
  module2.exports.isNothing = isNothing;
56915
- module2.exports.isObject = isObject2;
56931
+ module2.exports.isObject = isObject3;
56916
56932
  module2.exports.toArray = toArray;
56917
56933
  module2.exports.repeat = repeat;
56918
56934
  module2.exports.isNegativeZero = isNegativeZero;
@@ -56926,8 +56942,8 @@ var require_exception = __commonJS({
56926
56942
  "use strict";
56927
56943
  function formatError2(exception, compact) {
56928
56944
  let where = "";
56929
- const message = exception.reason || "(unknown reason)";
56930
- if (!exception.mark) return message;
56945
+ const message2 = exception.reason || "(unknown reason)";
56946
+ if (!exception.mark) return message2;
56931
56947
  if (exception.mark.name) {
56932
56948
  where += 'in "' + exception.mark.name + '" ';
56933
56949
  }
@@ -56935,7 +56951,7 @@ var require_exception = __commonJS({
56935
56951
  if (!compact && exception.mark.snippet) {
56936
56952
  where += "\n\n" + exception.mark.snippet;
56937
56953
  }
56938
- return message + " " + where;
56954
+ return message2 + " " + where;
56939
56955
  }
56940
56956
  function YAMLException(reason, mark) {
56941
56957
  Error.call(this);
@@ -57071,15 +57087,15 @@ var require_type = __commonJS({
57071
57087
  }
57072
57088
  return result;
57073
57089
  }
57074
- function Type(tag, options) {
57090
+ function Type(tag2, options) {
57075
57091
  options = options || {};
57076
57092
  Object.keys(options).forEach(function(name) {
57077
57093
  if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
57078
- throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
57094
+ throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag2 + '" YAML type.');
57079
57095
  }
57080
57096
  });
57081
57097
  this.options = options;
57082
- this.tag = tag;
57098
+ this.tag = tag2;
57083
57099
  this.kind = options["kind"] || null;
57084
57100
  this.resolve = options["resolve"] || function() {
57085
57101
  return true;
@@ -57095,7 +57111,7 @@ var require_type = __commonJS({
57095
57111
  this.multi = options["multi"] || false;
57096
57112
  this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
57097
57113
  if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
57098
- throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
57114
+ throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag2 + '" YAML type.');
57099
57115
  }
57100
57116
  }
57101
57117
  module2.exports = Type;
@@ -58000,7 +58016,7 @@ var require_loader = __commonJS({
58000
58016
  this.documents = [];
58001
58017
  this.anchorMapTransactions = [];
58002
58018
  }
58003
- function generateError(state, message) {
58019
+ function generateError(state, message2) {
58004
58020
  const mark = {
58005
58021
  name: state.filename,
58006
58022
  buffer: state.input.slice(0, -1),
@@ -58010,14 +58026,14 @@ var require_loader = __commonJS({
58010
58026
  column: state.position - state.lineStart
58011
58027
  };
58012
58028
  mark.snippet = makeSnippet(mark);
58013
- return new YAMLException(message, mark);
58029
+ return new YAMLException(message2, mark);
58014
58030
  }
58015
- function throwError(state, message) {
58016
- throw generateError(state, message);
58031
+ function throwError(state, message2) {
58032
+ throw generateError(state, message2);
58017
58033
  }
58018
- function throwWarning(state, message) {
58034
+ function throwWarning(state, message2) {
58019
58035
  if (state.onWarning) {
58020
- state.onWarning.call(null, generateError(state, message));
58036
+ state.onWarning.call(null, generateError(state, message2));
58021
58037
  }
58022
58038
  }
58023
58039
  function storeAnchor(state, name, value) {
@@ -59290,16 +59306,16 @@ var require_dumper = __commonJS({
59290
59306
  const result = {};
59291
59307
  const keys = Object.keys(map);
59292
59308
  for (let index = 0, length = keys.length; index < length; index += 1) {
59293
- let tag = keys[index];
59294
- let style = String(map[tag]);
59295
- if (tag.slice(0, 2) === "!!") {
59296
- tag = "tag:yaml.org,2002:" + tag.slice(2);
59309
+ let tag2 = keys[index];
59310
+ let style = String(map[tag2]);
59311
+ if (tag2.slice(0, 2) === "!!") {
59312
+ tag2 = "tag:yaml.org,2002:" + tag2.slice(2);
59297
59313
  }
59298
- const type = schema.compiledTypeMap["fallback"][tag];
59314
+ const type = schema.compiledTypeMap["fallback"][tag2];
59299
59315
  if (type && _hasOwnProperty.call(type.styleAliases, style)) {
59300
59316
  style = type.styleAliases[style];
59301
59317
  }
59302
- result[tag] = style;
59318
+ result[tag2] = style;
59303
59319
  }
59304
59320
  return result;
59305
59321
  }
@@ -62598,23 +62614,23 @@ var require_sax = __commonJS({
62598
62614
  SAXParser.call(parser, parser.strict, parser.opt);
62599
62615
  return parser;
62600
62616
  }
62601
- function strictFail(parser, message) {
62617
+ function strictFail(parser, message2) {
62602
62618
  if (typeof parser !== "object" || !(parser instanceof SAXParser)) {
62603
62619
  throw new Error("bad call to strictFail");
62604
62620
  }
62605
62621
  if (parser.strict) {
62606
- error5(parser, message);
62622
+ error5(parser, message2);
62607
62623
  }
62608
62624
  }
62609
62625
  function newTag(parser) {
62610
62626
  if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]();
62611
62627
  var parent = parser.tags[parser.tags.length - 1] || parser;
62612
- var tag = parser.tag = { name: parser.tagName, attributes: {} };
62628
+ var tag2 = parser.tag = { name: parser.tagName, attributes: {} };
62613
62629
  if (parser.opt.xmlns) {
62614
- tag.ns = parent.ns;
62630
+ tag2.ns = parent.ns;
62615
62631
  }
62616
62632
  parser.attribList.length = 0;
62617
- emitNode(parser, "onopentagstart", tag);
62633
+ emitNode(parser, "onopentagstart", tag2);
62618
62634
  }
62619
62635
  function qname(name, attribute) {
62620
62636
  var i3 = name.indexOf(":");
@@ -62651,12 +62667,12 @@ var require_sax = __commonJS({
62651
62667
  "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\nActual: " + parser.attribValue
62652
62668
  );
62653
62669
  } else {
62654
- var tag = parser.tag;
62670
+ var tag2 = parser.tag;
62655
62671
  var parent = parser.tags[parser.tags.length - 1] || parser;
62656
- if (tag.ns === parent.ns) {
62657
- tag.ns = Object.create(parent.ns);
62672
+ if (tag2.ns === parent.ns) {
62673
+ tag2.ns = Object.create(parent.ns);
62658
62674
  }
62659
- tag.ns[local] = parser.attribValue;
62675
+ tag2.ns[local] = parser.attribValue;
62660
62676
  }
62661
62677
  }
62662
62678
  parser.attribList.push([parser.attribName, parser.attribValue]);
@@ -62671,24 +62687,24 @@ var require_sax = __commonJS({
62671
62687
  }
62672
62688
  function openTag(parser, selfClosing) {
62673
62689
  if (parser.opt.xmlns) {
62674
- var tag = parser.tag;
62690
+ var tag2 = parser.tag;
62675
62691
  var qn = qname(parser.tagName);
62676
- tag.prefix = qn.prefix;
62677
- tag.local = qn.local;
62678
- tag.uri = tag.ns[qn.prefix] || "";
62679
- if (tag.prefix && !tag.uri) {
62692
+ tag2.prefix = qn.prefix;
62693
+ tag2.local = qn.local;
62694
+ tag2.uri = tag2.ns[qn.prefix] || "";
62695
+ if (tag2.prefix && !tag2.uri) {
62680
62696
  strictFail(
62681
62697
  parser,
62682
62698
  "Unbound namespace prefix: " + JSON.stringify(parser.tagName)
62683
62699
  );
62684
- tag.uri = qn.prefix;
62700
+ tag2.uri = qn.prefix;
62685
62701
  }
62686
62702
  var parent = parser.tags[parser.tags.length - 1] || parser;
62687
- if (tag.ns && parent.ns !== tag.ns) {
62688
- Object.keys(tag.ns).forEach(function(p4) {
62703
+ if (tag2.ns && parent.ns !== tag2.ns) {
62704
+ Object.keys(tag2.ns).forEach(function(p4) {
62689
62705
  emitNode(parser, "onopennamespace", {
62690
62706
  prefix: p4,
62691
- uri: tag.ns[p4]
62707
+ uri: tag2.ns[p4]
62692
62708
  });
62693
62709
  });
62694
62710
  }
@@ -62699,7 +62715,7 @@ var require_sax = __commonJS({
62699
62715
  var qualName = qname(name, true);
62700
62716
  var prefix = qualName.prefix;
62701
62717
  var local = qualName.local;
62702
- var uri = prefix === "" ? "" : tag.ns[prefix] || "";
62718
+ var uri = prefix === "" ? "" : tag2.ns[prefix] || "";
62703
62719
  var a3 = {
62704
62720
  name,
62705
62721
  value,
@@ -62775,17 +62791,17 @@ var require_sax = __commonJS({
62775
62791
  parser.tagName = tagName;
62776
62792
  var s4 = parser.tags.length;
62777
62793
  while (s4-- > t2) {
62778
- var tag = parser.tag = parser.tags.pop();
62794
+ var tag2 = parser.tag = parser.tags.pop();
62779
62795
  parser.tagName = parser.tag.name;
62780
62796
  emitNode(parser, "onclosetag", parser.tagName);
62781
62797
  var x4 = {};
62782
- for (var i3 in tag.ns) {
62783
- x4[i3] = tag.ns[i3];
62798
+ for (var i3 in tag2.ns) {
62799
+ x4[i3] = tag2.ns[i3];
62784
62800
  }
62785
62801
  var parent = parser.tags[parser.tags.length - 1] || parser;
62786
- if (parser.opt.xmlns && tag.ns !== parent.ns) {
62787
- Object.keys(tag.ns).forEach(function(p4) {
62788
- var n3 = tag.ns[p4];
62802
+ if (parser.opt.xmlns && tag2.ns !== parent.ns) {
62803
+ Object.keys(tag2.ns).forEach(function(p4) {
62804
+ var n3 = tag2.ns[p4];
62789
62805
  emitNode(parser, "onclosenamespace", { prefix: p4, uri: n3 });
62790
62806
  });
62791
62807
  }
@@ -63471,28 +63487,28 @@ function createNullCache() {
63471
63487
  };
63472
63488
  }
63473
63489
  function createMemoryCache(options = { serializable: true }) {
63474
- let cache = {};
63490
+ let cache3 = {};
63475
63491
  return {
63476
63492
  get(key, defaultValue, events2 = {
63477
63493
  miss: () => Promise.resolve()
63478
63494
  }) {
63479
63495
  const keyAsString = JSON.stringify(key);
63480
- if (keyAsString in cache) {
63481
- return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
63496
+ if (keyAsString in cache3) {
63497
+ return Promise.resolve(options.serializable ? JSON.parse(cache3[keyAsString]) : cache3[keyAsString]);
63482
63498
  }
63483
63499
  const promise = defaultValue();
63484
63500
  return promise.then((value) => events2.miss(value)).then(() => promise);
63485
63501
  },
63486
63502
  set(key, value) {
63487
- cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
63503
+ cache3[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
63488
63504
  return Promise.resolve(value);
63489
63505
  },
63490
63506
  delete(key) {
63491
- delete cache[JSON.stringify(key)];
63507
+ delete cache3[JSON.stringify(key)];
63492
63508
  return Promise.resolve();
63493
63509
  },
63494
63510
  clear() {
63495
- cache = {};
63511
+ cache3 = {};
63496
63512
  return Promise.resolve();
63497
63513
  }
63498
63514
  };
@@ -63596,13 +63612,13 @@ function toAsyncIterable(stream2) {
63596
63612
  return readableStreamToAsyncIterable(stream2);
63597
63613
  }
63598
63614
  async function* iterLines(stream2) {
63599
- const decoder = new TextDecoder("utf-8");
63615
+ const decoder2 = new TextDecoder("utf-8");
63600
63616
  const buffer = [];
63601
63617
  let bufferSize = 0;
63602
63618
  let trailingCR = false;
63603
63619
  let isFirstLine = true;
63604
63620
  for await (const chunk of toAsyncIterable(stream2)) {
63605
- const text2 = decoder.decode(chunk, { stream: true });
63621
+ const text2 = decoder2.decode(chunk, { stream: true });
63606
63622
  let offset = 0;
63607
63623
  if (trailingCR) {
63608
63624
  trailingCR = false;
@@ -63651,7 +63667,7 @@ async function* iterLines(stream2) {
63651
63667
  offset = endIdx + skipLen;
63652
63668
  }
63653
63669
  }
63654
- const remaining = decoder.decode();
63670
+ const remaining = decoder2.decode();
63655
63671
  if (remaining) {
63656
63672
  buffer.push(remaining);
63657
63673
  }
@@ -63664,9 +63680,9 @@ async function* iterLines(stream2) {
63664
63680
  }
63665
63681
  }
63666
63682
  async function* iterSSEEvents(stream2) {
63667
- const decoder = new SSEDecoder();
63683
+ const decoder2 = new SSEDecoder();
63668
63684
  for await (const line of iterLines(stream2)) {
63669
- const event = decoder.decode(line);
63685
+ const event = decoder2.decode(line);
63670
63686
  if (event !== null) {
63671
63687
  yield event;
63672
63688
  }
@@ -64073,8 +64089,8 @@ var init_common = __esm({
64073
64089
  EXPIRATION_DELAY = 2 * 60 * 1e3;
64074
64090
  AlgoliaError = class extends Error {
64075
64091
  name = "AlgoliaError";
64076
- constructor(message, name) {
64077
- super(message);
64092
+ constructor(message2, name) {
64093
+ super(message2);
64078
64094
  if (name) {
64079
64095
  this.name = name;
64080
64096
  }
@@ -64097,8 +64113,8 @@ var init_common = __esm({
64097
64113
  };
64098
64114
  ErrorWithStackTrace = class extends AlgoliaError {
64099
64115
  stackTrace;
64100
- constructor(message, stackTrace, name) {
64101
- super(message, name);
64116
+ constructor(message2, stackTrace, name) {
64117
+ super(message2, name);
64102
64118
  this.stackTrace = stackTrace;
64103
64119
  }
64104
64120
  };
@@ -64113,22 +64129,22 @@ var init_common = __esm({
64113
64129
  };
64114
64130
  ApiError = class extends ErrorWithStackTrace {
64115
64131
  status;
64116
- constructor(message, status, stackTrace, name = "ApiError") {
64117
- super(message, stackTrace, name);
64132
+ constructor(message2, status, stackTrace, name = "ApiError") {
64133
+ super(message2, stackTrace, name);
64118
64134
  this.status = status;
64119
64135
  }
64120
64136
  };
64121
64137
  DeserializationError = class extends AlgoliaError {
64122
64138
  response;
64123
- constructor(message, response) {
64124
- super(message, "DeserializationError");
64139
+ constructor(message2, response) {
64140
+ super(message2, "DeserializationError");
64125
64141
  this.response = response;
64126
64142
  }
64127
64143
  };
64128
64144
  DetailedApiError = class extends ApiError {
64129
64145
  error;
64130
- constructor(message, status, error5, stackTrace) {
64131
- super(message, status, stackTrace, "DetailedApiError");
64146
+ constructor(message2, status, error5, stackTrace) {
64147
+ super(message2, status, stackTrace, "DetailedApiError");
64132
64148
  this.error = error5;
64133
64149
  }
64134
64150
  };
@@ -72462,8 +72478,8 @@ var init_product_search_capability2 = __esm({
72462
72478
  AlgoliaProductSearchCapability = class extends ProductSearchCapability {
72463
72479
  config;
72464
72480
  factory;
72465
- constructor(cache, context2, config3, factory) {
72466
- super(cache, context2);
72481
+ constructor(cache3, context2, config3, factory) {
72482
+ super(cache3, context2);
72467
72483
  this.config = config3;
72468
72484
  this.factory = factory;
72469
72485
  }
@@ -72576,8 +72592,8 @@ var init_analytics_capability2 = __esm({
72576
72592
  purpose = "analytics";
72577
72593
  client;
72578
72594
  config;
72579
- constructor(cache, requestContext, config3) {
72580
- super(cache, requestContext);
72595
+ constructor(cache3, requestContext, config3) {
72596
+ super(cache3, requestContext);
72581
72597
  this.config = config3;
72582
72598
  this.client = algoliasearch(this.config.appId, this.config.apiKey).initInsights({});
72583
72599
  }
@@ -72990,8 +73006,8 @@ var init_product_recommendations_capability2 = __esm({
72990
73006
  AlgoliaProductRecommendationsCapability = class extends ProductRecommendationsCapability {
72991
73007
  config;
72992
73008
  client;
72993
- constructor(config3, cache, context2) {
72994
- super(cache, context2);
73009
+ constructor(config3, cache3, context2) {
73010
+ super(cache3, context2);
72995
73011
  this.config = config3;
72996
73012
  this.client = liteClient(this.config.appId, this.config.apiKey);
72997
73013
  }
@@ -73353,7 +73369,7 @@ var init_initialize_types = __esm({
73353
73369
 
73354
73370
  // packages/algolia/src/core/initialize.ts
73355
73371
  function withAlgoliaCapabilities(configuration, capabilities) {
73356
- return (cache, context2) => {
73372
+ return (cache3, context2) => {
73357
73373
  const client = {};
73358
73374
  if (capabilities.productSearch?.enabled) {
73359
73375
  const defaultFactory = new AlgoliaProductSearchFactory(
@@ -73371,7 +73387,7 @@ function withAlgoliaCapabilities(configuration, capabilities) {
73371
73387
  )
73372
73388
  },
73373
73389
  (factory) => ({
73374
- cache,
73390
+ cache: cache3,
73375
73391
  context: context2,
73376
73392
  config: configuration,
73377
73393
  factory
@@ -73383,7 +73399,7 @@ function withAlgoliaCapabilities(configuration, capabilities) {
73383
73399
  capabilities.analytics,
73384
73400
  (args) => new AlgoliaAnalyticsCapability(args.cache, args.context, args.config),
73385
73401
  {
73386
- cache,
73402
+ cache: cache3,
73387
73403
  context: context2,
73388
73404
  config: configuration
73389
73405
  }
@@ -73398,7 +73414,7 @@ function withAlgoliaCapabilities(configuration, capabilities) {
73398
73414
  args.context
73399
73415
  ),
73400
73416
  {
73401
- cache,
73417
+ cache: cache3,
73402
73418
  context: context2,
73403
73419
  config: configuration
73404
73420
  }
@@ -73525,11 +73541,11 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
73525
73541
  var CTP_API_URL = "https://api.europe-west1.gcp.commercetools.com";
73526
73542
  var CTP_AUTH_URL = "https://auth.europe-west1.gcp.commercetools.com";
73527
73543
  var DEFAULT_HEADERS = ["content-type", "access-control-allow-origin", "access-control-allow-headers", "access-control-allow-methods", "access-control-expose-headers", "access-control-max-ag", "x-correlation-id", "server-timing", "date", "server", "transfer-encoding", "access-control-max-age", "content-encoding", "x-envoy-upstream-service-time", "via", "alt-svc", "connection"];
73528
- function DefineError(statusCode, message, meta = {}) {
73544
+ function DefineError(statusCode, message2, meta = {}) {
73529
73545
  this.code = meta["code"] ??= this.constructor.name;
73530
73546
  this.statusCode = statusCode;
73531
73547
  this.status = statusCode;
73532
- this.message = message;
73548
+ this.message = message2;
73533
73549
  Object.assign(this, meta);
73534
73550
  this.name = this.constructor.name;
73535
73551
  this.constructor.prototype.__proto__ = Error.prototype;
@@ -73586,10 +73602,10 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
73586
73602
  }
73587
73603
  function createError({
73588
73604
  statusCode,
73589
- message,
73605
+ message: message2,
73590
73606
  ...rest
73591
73607
  }) {
73592
- let errorMessage = message || "Unexpected non-JSON error response";
73608
+ let errorMessage = message2 || "Unexpected non-JSON error response";
73593
73609
  if (statusCode === 404) errorMessage = `URI not found: ${rest.originalRequest?.uri || rest.uri}`;
73594
73610
  const ResponseError = getErrorByCode(statusCode);
73595
73611
  if (ResponseError) return new ResponseError(errorMessage, rest);
@@ -74063,12 +74079,12 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
74063
74079
  refresh_token: refreshToken
74064
74080
  } = response?.data;
74065
74081
  const expirationTime = calculateExpirationTime(expiresIn);
74066
- const cache = {
74082
+ const cache3 = {
74067
74083
  token,
74068
74084
  expirationTime,
74069
74085
  refreshToken
74070
74086
  };
74071
- await tokenCache.set(cache, tokenCacheKey);
74087
+ await tokenCache.set(cache3, tokenCacheKey);
74072
74088
  return Promise.resolve(true);
74073
74089
  }
74074
74090
  throw createError({
@@ -74323,12 +74339,12 @@ var require_commercetools_ts_client_cjs_prod = __commonJS({
74323
74339
  } catch (e2) {
74324
74340
  const headers = includeResponseHeaders ? getHeaders(e2.response?.headers) : null;
74325
74341
  const statusCode = e2.response?.status || e2.response?.statusCode || e2.response?.data.statusCode || 0;
74326
- const message = e2.response?.data?.message;
74342
+ const message2 = e2.response?.data?.message;
74327
74343
  const error5 = createError({
74328
74344
  statusCode,
74329
74345
  code: "NetworkError",
74330
74346
  status: statusCode,
74331
- message: message || e2.message,
74347
+ message: message2 || e2.message,
74332
74348
  headers,
74333
74349
  /**
74334
74350
  * @deprecated use `error` instead
@@ -74958,11 +74974,11 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
74958
74974
  var CTP_API_URL = "https://api.europe-west1.gcp.commercetools.com";
74959
74975
  var CTP_AUTH_URL = "https://auth.europe-west1.gcp.commercetools.com";
74960
74976
  var DEFAULT_HEADERS = ["content-type", "access-control-allow-origin", "access-control-allow-headers", "access-control-allow-methods", "access-control-expose-headers", "access-control-max-ag", "x-correlation-id", "server-timing", "date", "server", "transfer-encoding", "access-control-max-age", "content-encoding", "x-envoy-upstream-service-time", "via", "alt-svc", "connection"];
74961
- function DefineError(statusCode, message, meta = {}) {
74977
+ function DefineError(statusCode, message2, meta = {}) {
74962
74978
  this.code = meta["code"] ??= this.constructor.name;
74963
74979
  this.statusCode = statusCode;
74964
74980
  this.status = statusCode;
74965
- this.message = message;
74981
+ this.message = message2;
74966
74982
  Object.assign(this, meta);
74967
74983
  this.name = this.constructor.name;
74968
74984
  this.constructor.prototype.__proto__ = Error.prototype;
@@ -75019,10 +75035,10 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
75019
75035
  }
75020
75036
  function createError({
75021
75037
  statusCode,
75022
- message,
75038
+ message: message2,
75023
75039
  ...rest
75024
75040
  }) {
75025
- let errorMessage = message || "Unexpected non-JSON error response";
75041
+ let errorMessage = message2 || "Unexpected non-JSON error response";
75026
75042
  if (statusCode === 404) errorMessage = `URI not found: ${rest.originalRequest?.uri || rest.uri}`;
75027
75043
  const ResponseError = getErrorByCode(statusCode);
75028
75044
  if (ResponseError) return new ResponseError(errorMessage, rest);
@@ -75496,12 +75512,12 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
75496
75512
  refresh_token: refreshToken
75497
75513
  } = response?.data;
75498
75514
  const expirationTime = calculateExpirationTime(expiresIn);
75499
- const cache = {
75515
+ const cache3 = {
75500
75516
  token,
75501
75517
  expirationTime,
75502
75518
  refreshToken
75503
75519
  };
75504
- await tokenCache.set(cache, tokenCacheKey);
75520
+ await tokenCache.set(cache3, tokenCacheKey);
75505
75521
  return Promise.resolve(true);
75506
75522
  }
75507
75523
  throw createError({
@@ -75756,12 +75772,12 @@ var require_commercetools_ts_client_cjs_dev = __commonJS({
75756
75772
  } catch (e2) {
75757
75773
  const headers = includeResponseHeaders ? getHeaders(e2.response?.headers) : null;
75758
75774
  const statusCode = e2.response?.status || e2.response?.statusCode || e2.response?.data.statusCode || 0;
75759
- const message = e2.response?.data?.message;
75775
+ const message2 = e2.response?.data?.message;
75760
75776
  const error5 = createError({
75761
75777
  statusCode,
75762
75778
  code: "NetworkError",
75763
75779
  status: statusCode,
75764
- message: message || e2.message,
75780
+ message: message2 || e2.message,
75765
75781
  headers,
75766
75782
  /**
75767
75783
  * @deprecated use `error` instead
@@ -113850,6 +113866,1158 @@ var require_src = __commonJS({
113850
113866
  }
113851
113867
  });
113852
113868
 
113869
+ // packages/oidc/src/client/pkce.ts
113870
+ function base64Url(bytes) {
113871
+ let binary = "";
113872
+ bytes.forEach((byte) => {
113873
+ binary += String.fromCharCode(byte);
113874
+ });
113875
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
113876
+ }
113877
+ function randomToken(byteLength = 32) {
113878
+ const bytes = new Uint8Array(byteLength);
113879
+ crypto.getRandomValues(bytes);
113880
+ return base64Url(bytes);
113881
+ }
113882
+ async function codeChallenge(verifier) {
113883
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(verifier));
113884
+ return base64Url(new Uint8Array(digest));
113885
+ }
113886
+ var init_pkce = __esm({
113887
+ "packages/oidc/src/client/pkce.ts"() {
113888
+ "use strict";
113889
+ }
113890
+ });
113891
+
113892
+ // packages/oidc/src/client/discovery.ts
113893
+ async function resolveMetadata(provider) {
113894
+ if (provider.authorizationEndpoint && provider.tokenEndpoint && provider.jwksUri) {
113895
+ return {
113896
+ issuer: provider.issuer,
113897
+ authorizationEndpoint: provider.authorizationEndpoint,
113898
+ tokenEndpoint: provider.tokenEndpoint,
113899
+ jwksUri: provider.jwksUri
113900
+ };
113901
+ }
113902
+ let discovered = cache.get(provider.issuer);
113903
+ if (!discovered || discovered.expires < Date.now()) {
113904
+ const url2 = `${provider.issuer.replace(/\/$/, "")}/.well-known/openid-configuration`;
113905
+ const response = await fetch(url2, { headers: { accept: "application/json" } });
113906
+ if (!response.ok) {
113907
+ throw new Error(`Discovery failed for ${provider.key}: HTTP ${response.status}`);
113908
+ }
113909
+ const document2 = DiscoveryDocumentSchema.parse(await response.json());
113910
+ if (document2.issuer !== provider.issuer) {
113911
+ throw new Error(`Discovery document of ${provider.key} names a different issuer than configured`);
113912
+ }
113913
+ discovered = {
113914
+ expires: Date.now() + DISCOVERY_TTL_MS,
113915
+ metadata: {
113916
+ issuer: document2.issuer,
113917
+ authorizationEndpoint: document2.authorization_endpoint,
113918
+ tokenEndpoint: document2.token_endpoint,
113919
+ jwksUri: document2.jwks_uri,
113920
+ ...document2.end_session_endpoint ? { endSessionEndpoint: document2.end_session_endpoint } : {}
113921
+ }
113922
+ };
113923
+ cache.set(provider.issuer, discovered);
113924
+ }
113925
+ return {
113926
+ ...discovered.metadata,
113927
+ authorizationEndpoint: provider.authorizationEndpoint ?? discovered.metadata.authorizationEndpoint,
113928
+ tokenEndpoint: provider.tokenEndpoint ?? discovered.metadata.tokenEndpoint,
113929
+ jwksUri: provider.jwksUri ?? discovered.metadata.jwksUri
113930
+ };
113931
+ }
113932
+ var DISCOVERY_TTL_MS, DiscoveryDocumentSchema, cache;
113933
+ var init_discovery = __esm({
113934
+ "packages/oidc/src/client/discovery.ts"() {
113935
+ "use strict";
113936
+ init_zod();
113937
+ DISCOVERY_TTL_MS = 60 * 60 * 1e3;
113938
+ DiscoveryDocumentSchema = looseObject({
113939
+ issuer: string2(),
113940
+ authorization_endpoint: string2(),
113941
+ token_endpoint: string2(),
113942
+ jwks_uri: string2(),
113943
+ end_session_endpoint: string2().optional()
113944
+ });
113945
+ cache = /* @__PURE__ */ new Map();
113946
+ }
113947
+ });
113948
+
113949
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/buffer_utils.js
113950
+ function concat(...buffers) {
113951
+ const size = buffers.reduce((acc, { length }) => acc + length, 0), buf = new Uint8Array(size);
113952
+ let i3 = 0;
113953
+ for (const buffer of buffers)
113954
+ buf.set(buffer, i3), i3 += buffer.length;
113955
+ return buf;
113956
+ }
113957
+ function encode2(string4) {
113958
+ if (typeof string4 == "string" && string4.length >= 128) {
113959
+ if (NON_ASCII.test(string4))
113960
+ throw new TypeError("non-ASCII string encountered in encode()");
113961
+ return encoder.encode(string4);
113962
+ }
113963
+ const bytes = new Uint8Array(string4.length);
113964
+ for (let i3 = 0; i3 < string4.length; i3++) {
113965
+ const code = string4.charCodeAt(i3);
113966
+ if (code > 127)
113967
+ throw new TypeError("non-ASCII string encountered in encode()");
113968
+ bytes[i3] = code;
113969
+ }
113970
+ return bytes;
113971
+ }
113972
+ function decodeBase64(encoded, url2 = false) {
113973
+ if (Uint8Array.fromBase64)
113974
+ return Uint8Array.fromBase64(encoded, { alphabet: url2 ? "base64url" : "base64" });
113975
+ if (url2) {
113976
+ if (encoded.includes("+") || encoded.includes("/"))
113977
+ throw new TypeError("Invalid base64url");
113978
+ encoded = encoded.replace(/-/g, "+").replace(/_/g, "/");
113979
+ }
113980
+ const binary = atob(encoded), bytes = new Uint8Array(binary.length);
113981
+ for (let i3 = 0; i3 < binary.length; i3++)
113982
+ bytes[i3] = binary.charCodeAt(i3);
113983
+ return bytes;
113984
+ }
113985
+ var encoder, decoder, strictDecoder, UINT32_RANGE, NON_ASCII;
113986
+ var init_buffer_utils = __esm({
113987
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/buffer_utils.js"() {
113988
+ encoder = new TextEncoder();
113989
+ decoder = new TextDecoder();
113990
+ strictDecoder = new TextDecoder("utf-8", { fatal: true });
113991
+ UINT32_RANGE = 2 ** 32;
113992
+ NON_ASCII = /[^\x00-\x7f]/;
113993
+ }
113994
+ });
113995
+
113996
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/util/errors.js
113997
+ var JOSEError, JWTClaimValidationFailed, JWTExpired, JOSEAlgNotAllowed, JOSENotSupported, JWSInvalid, JWTInvalid, JWKSInvalid, JWKSNoMatchingKey, JWKSMultipleMatchingKeys, JWKSTimeout, JWSSignatureVerificationFailed;
113998
+ var init_errors4 = __esm({
113999
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/util/errors.js"() {
114000
+ JOSEError = class extends Error {
114001
+ static code = "ERR_JOSE_GENERIC";
114002
+ code = "ERR_JOSE_GENERIC";
114003
+ constructor(message2, options) {
114004
+ super(message2, options), this.name = this.constructor.name, Error.captureStackTrace?.(this, this.constructor);
114005
+ }
114006
+ };
114007
+ JWTClaimValidationFailed = class extends JOSEError {
114008
+ static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
114009
+ code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
114010
+ claim;
114011
+ reason;
114012
+ payload;
114013
+ constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
114014
+ super(message2, { cause: { claim, reason, payload } }), this.claim = claim, this.reason = reason, this.payload = payload;
114015
+ }
114016
+ };
114017
+ JWTExpired = class extends JOSEError {
114018
+ static code = "ERR_JWT_EXPIRED";
114019
+ code = "ERR_JWT_EXPIRED";
114020
+ claim;
114021
+ reason;
114022
+ payload;
114023
+ constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
114024
+ super(message2, { cause: { claim, reason, payload } }), this.claim = claim, this.reason = reason, this.payload = payload;
114025
+ }
114026
+ };
114027
+ JOSEAlgNotAllowed = class extends JOSEError {
114028
+ static code = "ERR_JOSE_ALG_NOT_ALLOWED";
114029
+ code = "ERR_JOSE_ALG_NOT_ALLOWED";
114030
+ };
114031
+ JOSENotSupported = class extends JOSEError {
114032
+ static code = "ERR_JOSE_NOT_SUPPORTED";
114033
+ code = "ERR_JOSE_NOT_SUPPORTED";
114034
+ };
114035
+ JWSInvalid = class extends JOSEError {
114036
+ static code = "ERR_JWS_INVALID";
114037
+ code = "ERR_JWS_INVALID";
114038
+ };
114039
+ JWTInvalid = class extends JOSEError {
114040
+ static code = "ERR_JWT_INVALID";
114041
+ code = "ERR_JWT_INVALID";
114042
+ };
114043
+ JWKSInvalid = class extends JOSEError {
114044
+ static code = "ERR_JWKS_INVALID";
114045
+ code = "ERR_JWKS_INVALID";
114046
+ };
114047
+ JWKSNoMatchingKey = class extends JOSEError {
114048
+ static code = "ERR_JWKS_NO_MATCHING_KEY";
114049
+ code = "ERR_JWKS_NO_MATCHING_KEY";
114050
+ constructor(message2 = "no applicable key found in the JSON Web Key Set", options) {
114051
+ super(message2, options);
114052
+ }
114053
+ };
114054
+ JWKSMultipleMatchingKeys = class extends JOSEError {
114055
+ [Symbol.asyncIterator] = async function* () {
114056
+ };
114057
+ static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
114058
+ code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
114059
+ constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
114060
+ super(message2, options);
114061
+ }
114062
+ };
114063
+ JWKSTimeout = class extends JOSEError {
114064
+ static code = "ERR_JWKS_TIMEOUT";
114065
+ code = "ERR_JWKS_TIMEOUT";
114066
+ constructor(message2 = "request timed out", options) {
114067
+ super(message2, options);
114068
+ }
114069
+ };
114070
+ JWSSignatureVerificationFailed = class extends JOSEError {
114071
+ static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
114072
+ code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
114073
+ constructor(message2 = "signature verification failed", options) {
114074
+ super(message2, options);
114075
+ }
114076
+ };
114077
+ }
114078
+ });
114079
+
114080
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/util/base64url.js
114081
+ function decode2(input) {
114082
+ try {
114083
+ return decodeBase64(typeof input == "string" ? input : decoder.decode(input), true);
114084
+ } catch (cause) {
114085
+ throw new TypeError(invalid, { cause });
114086
+ }
114087
+ }
114088
+ var invalid;
114089
+ var init_base64url = __esm({
114090
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/util/base64url.js"() {
114091
+ init_buffer_utils();
114092
+ invalid = "The input to be decoded is not correctly encoded.";
114093
+ }
114094
+ });
114095
+
114096
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/validate.js
114097
+ function isObject2(input) {
114098
+ if (typeof input != "object" || input === null || Object.prototype.toString.call(input) !== "[object Object]")
114099
+ return false;
114100
+ const prototype = Object.getPrototypeOf(input);
114101
+ return prototype === null || Object.getPrototypeOf(prototype) === null;
114102
+ }
114103
+ function isJwkSet(input) {
114104
+ return isObject2(input) && Array.isArray(input.keys) && Array.from(input.keys).every(isObject2);
114105
+ }
114106
+ function isDisjoint(...headers) {
114107
+ const parameters = /* @__PURE__ */ new Set();
114108
+ for (const header of headers)
114109
+ if (header)
114110
+ for (const parameter of Object.keys(header)) {
114111
+ if (parameters.has(parameter))
114112
+ return false;
114113
+ parameters.add(parameter);
114114
+ }
114115
+ return true;
114116
+ }
114117
+ function decodeBase64url(value, label, ErrorClass) {
114118
+ try {
114119
+ return decode2(value);
114120
+ } catch (cause) {
114121
+ throw new ErrorClass(`Failed to base64url decode the ${label}`, { cause });
114122
+ }
114123
+ }
114124
+ function encodeAsciiMember(value, label, ErrorClass) {
114125
+ try {
114126
+ return encode2(value);
114127
+ } catch (cause) {
114128
+ throw new ErrorClass(`The ${label} is not a valid base64url string`, { cause });
114129
+ }
114130
+ }
114131
+ function parseJoseHeader(encodedProtectedHeader, ErrorClass, message2) {
114132
+ let parsed;
114133
+ try {
114134
+ parsed = JSON.parse(strictDecoder.decode(decode2(encodedProtectedHeader)));
114135
+ } catch (cause) {
114136
+ throw new ErrorClass(message2, { cause });
114137
+ }
114138
+ if (!isObject2(parsed))
114139
+ throw new ErrorClass(message2);
114140
+ return parsed;
114141
+ }
114142
+ function validateAlgorithms(option, algorithms) {
114143
+ if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s3) => typeof s3 != "string")))
114144
+ throw new TypeError(`"${option}" option must be an array of strings`);
114145
+ return algorithms === void 0 ? void 0 : new Set(algorithms);
114146
+ }
114147
+ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
114148
+ if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0)
114149
+ throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
114150
+ if (!protectedHeader || protectedHeader.crit === void 0)
114151
+ return [];
114152
+ if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input != "string" || input.length === 0))
114153
+ throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
114154
+ const recognized = recognizedOption === void 0 ? recognizedDefault : { __proto__: null, ...recognizedOption, ...recognizedDefault };
114155
+ for (const parameter of protectedHeader.crit) {
114156
+ if (!(parameter in recognized))
114157
+ throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
114158
+ if (!Object.hasOwn(joseHeader, parameter) || joseHeader[parameter] === void 0)
114159
+ throw new Err(`Extension Header Parameter "${parameter}" is missing`);
114160
+ if (recognized[parameter] && (!Object.hasOwn(protectedHeader, parameter) || protectedHeader[parameter] === void 0))
114161
+ throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
114162
+ }
114163
+ return protectedHeader.crit;
114164
+ }
114165
+ function validateB64(protectedHeader, extensions) {
114166
+ if (extensions.includes("b64")) {
114167
+ const b64 = protectedHeader.b64;
114168
+ if (typeof b64 != "boolean")
114169
+ throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
114170
+ return b64;
114171
+ }
114172
+ return true;
114173
+ }
114174
+ var JWS_RECOGNIZED;
114175
+ var init_validate = __esm({
114176
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/validate.js"() {
114177
+ init_errors4();
114178
+ init_base64url();
114179
+ init_buffer_utils();
114180
+ JWS_RECOGNIZED = { __proto__: null, b64: true };
114181
+ }
114182
+ });
114183
+
114184
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/key.js
114185
+ async function prepareKey(entry, key, usage) {
114186
+ const { alg, secret } = entry, requiresPrivateKey = usage === "decrypt" || usage === "sign";
114187
+ if (secret && key instanceof Uint8Array)
114188
+ return key;
114189
+ let normalized, keyObject;
114190
+ if (isObject2(key)) {
114191
+ if (normalized = normalizeJwk(key), typeof normalized.kty != "string")
114192
+ throw invalidKeyType(alg, key, secret);
114193
+ if (!(secret ? normalized.kty === "oct" && typeof normalized.k == "string" : normalized.kty !== "oct" && (requiresPrivateKey ? normalized.kty === "AKP" && typeof normalized.priv == "string" || typeof normalized.d == "string" : normalized.d === void 0 && normalized.priv === void 0)))
114194
+ throw new TypeError(secret ? 'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present' : `JSON Web Key for this operation must be a ${requiresPrivateKey ? "private" : "public"} JWK`);
114195
+ if (jwkMatchesOp(entry, normalized, usage), normalized.kty === "oct")
114196
+ return decode2(normalized.k);
114197
+ if (!Object.isFrozen(key)) {
114198
+ const { key_ops } = key;
114199
+ Array.isArray(key_ops) && Object.freeze(key_ops), Object.freeze(key);
114200
+ }
114201
+ } else {
114202
+ if (!isKeyLike(key))
114203
+ throw invalidKeyType(alg, key, secret);
114204
+ const expectedType = secret ? "secret" : requiresPrivateKey ? "private" : "public";
114205
+ if (key.type !== expectedType && (secret || ["secret", "public", "private"].includes(key.type)))
114206
+ throw new TypeError(`${tag(key)} instances must be of type "${expectedType}" for the ${alg} algorithm`);
114207
+ if (isCryptoKey(key))
114208
+ return key;
114209
+ if (keyObject = key, keyObject.type === "secret")
114210
+ return keyObject.export();
114211
+ }
114212
+ cache2 ||= /* @__PURE__ */ new WeakMap();
114213
+ const cacheKey = key;
114214
+ let cached2 = cache2.get(cacheKey);
114215
+ if (cached2?.[alg])
114216
+ return cached2[alg];
114217
+ if (cached2 || cache2.set(cacheKey, cached2 = {}), keyObject && typeof keyObject.toCryptoKey == "function") {
114218
+ const isPublic = keyObject.type === "public", crv = nist[keyObject.asymmetricKeyDetails?.namedCurve], params = entry.resolve?.({ crv, asymmetricKeyType: keyObject.asymmetricKeyType }) ?? entry.subtle;
114219
+ return cached2[alg] = keyObject.toCryptoKey(params, isPublic, entry.usages[isPublic ? 0 : 1]);
114220
+ }
114221
+ return normalized ??= keyObject.export({ format: "jwk" }), normalized.alg = alg, cached2[alg] = await jwkToKey(entry, normalized);
114222
+ }
114223
+ function message(msg, actual, ...types) {
114224
+ if (types.length > 2) {
114225
+ const last = types.pop();
114226
+ msg += `one of type ${types.join(", ")}, or ${last}.`;
114227
+ } else types.length === 2 ? msg += `one of type ${types[0]} or ${types[1]}.` : msg += `of type ${types[0]}.`;
114228
+ return actual == null ? msg += ` Received ${actual}` : typeof actual == "function" && actual.name ? msg += ` Received function ${actual.name}` : typeof actual == "object" && actual != null && actual.constructor?.name && (msg += ` Received an instance of ${actual.constructor.name}`), msg;
114229
+ }
114230
+ function invalidKeyType(alg, actual, secret) {
114231
+ const types = ["CryptoKey", "KeyObject", "JSON Web Key"];
114232
+ return secret && types.push("Uint8Array"), new TypeError(message(`Key for the ${alg} algorithm must be `, actual, ...types));
114233
+ }
114234
+ function checkUsage(key, usage) {
114235
+ if (usage && !key.usages.includes(usage))
114236
+ throw new TypeError(`CryptoKey does not support this operation, its usages must include ${usage}.`);
114237
+ }
114238
+ function checkModulusLength(alg, key) {
114239
+ const { modulusLength } = key.algorithm;
114240
+ if (typeof modulusLength != "number" || modulusLength < 2048)
114241
+ throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
114242
+ }
114243
+ function checkCryptoKey(key, expected, usage) {
114244
+ const algorithm = key.algorithm;
114245
+ if (algorithm.name !== expected.name)
114246
+ throw unusable(expected.name);
114247
+ if (expected.hash && algorithm.hash?.name !== expected.hash)
114248
+ throw unusable(expected.hash, "algorithm.hash");
114249
+ if (expected.namedCurve && algorithm.namedCurve !== expected.namedCurve)
114250
+ throw unusable(expected.namedCurve, "algorithm.namedCurve");
114251
+ if (expected.length !== void 0 && algorithm.length !== expected.length)
114252
+ throw unusable(expected.length, "algorithm.length");
114253
+ checkUsage(key, usage);
114254
+ }
114255
+ function snapshotJwk(jwk) {
114256
+ return { __proto__: null, ...jwk };
114257
+ }
114258
+ function normalizeJwk(jwk) {
114259
+ const normalized = snapshotJwk(jwk);
114260
+ if (normalized.ext !== void 0 && typeof normalized.ext != "boolean")
114261
+ throw new TypeError('"ext" (Extractable) Parameter must be a boolean');
114262
+ if (normalized.key_ops !== void 0) {
114263
+ const value = normalized.key_ops, keyOps = Array.isArray(value) ? [...value] : void 0;
114264
+ if (!keyOps || keyOps.some((operation) => typeof operation != "string") || new Set(keyOps).size !== keyOps.length)
114265
+ throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');
114266
+ normalized.key_ops = keyOps;
114267
+ }
114268
+ return normalized;
114269
+ }
114270
+ async function jwkToKey(entry, jwk, extractable) {
114271
+ if (!entry.kty.includes(jwk.kty))
114272
+ throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
114273
+ const algorithm = entry.resolve?.({ kty: jwk.kty, crv: jwk.crv }) ?? entry.subtle, isPrivate = !!(jwk.d || jwk.priv), keyData = { ...jwk, ext: extractable ?? jwk.ext };
114274
+ return keyData.kty !== "AKP" && delete keyData.alg, delete keyData.use, crypto.subtle.importKey("jwk", keyData, algorithm, keyData.ext ?? !isPrivate, jwk.key_ops ?? entry.usages[isPrivate ? 1 : 0]);
114275
+ }
114276
+ async function rawKey(key, expected, usage, extractable = false) {
114277
+ return key instanceof Uint8Array && (key = await crypto.subtle.importKey("raw", key, expected, extractable, [usage])), checkCryptoKey(key, expected, usage), key;
114278
+ }
114279
+ var tag, jwkMatchesOp, cache2, nist, isCryptoKey, isKeyObject, isKeyLike, unusable;
114280
+ var init_key = __esm({
114281
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/key.js"() {
114282
+ init_validate();
114283
+ init_base64url();
114284
+ init_errors4();
114285
+ tag = (key) => key[Symbol.toStringTag];
114286
+ jwkMatchesOp = (entry, key, usage) => {
114287
+ const { alg } = entry;
114288
+ if (key.use !== void 0) {
114289
+ const expected = usage === "sign" || usage === "verify" ? "sig" : "enc";
114290
+ if (key.use !== expected)
114291
+ throw new TypeError(`Invalid key for this operation, its "use" must be "${expected}" when present`);
114292
+ }
114293
+ if (key.alg !== void 0 && key.alg !== alg)
114294
+ throw new TypeError(`Invalid key for this operation, its "alg" must be "${alg}" when present`);
114295
+ if (Array.isArray(key.key_ops)) {
114296
+ const expectedKeyOp = usage === "encrypt" || usage === "decrypt" ? entry.ops?.[usage === "encrypt" ? 0 : 1] : usage;
114297
+ if (expectedKeyOp && !key.key_ops.includes(expectedKeyOp))
114298
+ throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${expectedKeyOp}" when present`);
114299
+ }
114300
+ };
114301
+ nist = {
114302
+ __proto__: null,
114303
+ prime256v1: "P-256",
114304
+ secp384r1: "P-384",
114305
+ secp521r1: "P-521"
114306
+ };
114307
+ isCryptoKey = (key) => {
114308
+ if (key?.[Symbol.toStringTag] === "CryptoKey")
114309
+ return true;
114310
+ try {
114311
+ return key instanceof CryptoKey;
114312
+ } catch {
114313
+ return false;
114314
+ }
114315
+ };
114316
+ isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
114317
+ isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
114318
+ unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
114319
+ }
114320
+ });
114321
+
114322
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/key_descriptor.js
114323
+ function table(entries) {
114324
+ const out = { __proto__: null };
114325
+ for (const alg in entries)
114326
+ out[alg] = { ...entries[alg], alg };
114327
+ return out;
114328
+ }
114329
+ var init_key_descriptor = __esm({
114330
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/key_descriptor.js"() {
114331
+ }
114332
+ });
114333
+
114334
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/jws_algorithms.js
114335
+ function hmac(bits) {
114336
+ const subtle2 = { name: "HMAC", hash: `SHA-${bits}` };
114337
+ return { kty: ["oct"], secret: true, subtle: subtle2, signing: subtle2, usages: sig };
114338
+ }
114339
+ function rsa(bits, saltLength) {
114340
+ const subtle2 = { name: saltLength ? "RSA-PSS" : "RSASSA-PKCS1-v1_5", hash: `SHA-${bits}` };
114341
+ return {
114342
+ kty: ["RSA"],
114343
+ subtle: subtle2,
114344
+ signing: saltLength ? { ...subtle2, saltLength } : subtle2,
114345
+ usages: sig,
114346
+ minRsaBits: 2048
114347
+ };
114348
+ }
114349
+ function ecdsa(crv, bits) {
114350
+ return {
114351
+ kty: ["EC"],
114352
+ crv,
114353
+ subtle: { name: "ECDSA", namedCurve: crv },
114354
+ signing: { name: "ECDSA", hash: `SHA-${bits}` },
114355
+ usages: sig
114356
+ };
114357
+ }
114358
+ function eddsa() {
114359
+ const subtle2 = { name: "Ed25519" };
114360
+ return {
114361
+ kty: ["OKP"],
114362
+ crv: "Ed25519",
114363
+ subtle: subtle2,
114364
+ signing: subtle2,
114365
+ usages: sig
114366
+ };
114367
+ }
114368
+ function mldsa(parameterSet) {
114369
+ const subtle2 = { name: `ML-DSA-${parameterSet}` };
114370
+ return {
114371
+ kty: ["AKP"],
114372
+ subtle: subtle2,
114373
+ signing: subtle2,
114374
+ usages: sig
114375
+ };
114376
+ }
114377
+ function jwsAlgorithm(alg) {
114378
+ const entry = typeof alg == "string" ? JWS[alg] : void 0;
114379
+ if (!entry)
114380
+ throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
114381
+ return entry;
114382
+ }
114383
+ var sig, JWS;
114384
+ var init_jws_algorithms = __esm({
114385
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/jws_algorithms.js"() {
114386
+ init_errors4();
114387
+ init_key_descriptor();
114388
+ sig = [["verify"], ["sign"]];
114389
+ JWS = table({
114390
+ HS256: hmac(256),
114391
+ HS384: hmac(384),
114392
+ HS512: hmac(512),
114393
+ RS256: rsa(256),
114394
+ RS384: rsa(384),
114395
+ RS512: rsa(512),
114396
+ PS256: rsa(256, 32),
114397
+ PS384: rsa(384, 48),
114398
+ PS512: rsa(512, 64),
114399
+ ES256: ecdsa("P-256", 256),
114400
+ ES384: ecdsa("P-384", 384),
114401
+ ES512: ecdsa("P-521", 512),
114402
+ EdDSA: eddsa(),
114403
+ Ed25519: eddsa(),
114404
+ "ML-DSA-44": mldsa(44),
114405
+ "ML-DSA-65": mldsa(65),
114406
+ "ML-DSA-87": mldsa(87)
114407
+ });
114408
+ }
114409
+ });
114410
+
114411
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/jws_verify.js
114412
+ function prepareVerify(options) {
114413
+ return [options && validateAlgorithms("algorithms", options.algorithms), options?.crit];
114414
+ }
114415
+ function parseProtectedHeader(encodedProtectedHeader) {
114416
+ return encodedProtectedHeader === void 0 ? {} : parseJoseHeader(encodedProtectedHeader, JWSInvalid, "JWS Protected Header is invalid");
114417
+ }
114418
+ function encodeCompactUnencodedPayload(payload) {
114419
+ try {
114420
+ return encode2(payload);
114421
+ } catch (cause) {
114422
+ throw new JWSInvalid("JWS Compact Serialization payload must use only ASCII characters", {
114423
+ cause
114424
+ });
114425
+ }
114426
+ }
114427
+ async function verifySignature(jws, shared, key, encodeUnencodedPayload, parsedProtected) {
114428
+ const { protected: encodedProtectedHeader, header, payload: inputPayload } = jws, protectedHeader = parsedProtected ?? parseProtectedHeader(encodedProtectedHeader);
114429
+ if (!isDisjoint(protectedHeader, header))
114430
+ throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
114431
+ const joseHeader = { ...protectedHeader, ...header }, b64 = validateB64(protectedHeader, validateCrit(JWSInvalid, JWS_RECOGNIZED, shared[1], protectedHeader, joseHeader)), { alg } = joseHeader;
114432
+ if (typeof alg != "string" || !alg)
114433
+ throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
114434
+ if (shared[0] && !shared[0].has(alg))
114435
+ throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
114436
+ if (b64) {
114437
+ if (typeof inputPayload != "string")
114438
+ throw new JWSInvalid("JWS Payload must be a string");
114439
+ } else if (typeof inputPayload != "string" && !(inputPayload instanceof Uint8Array))
114440
+ throw new JWSInvalid("JWS Payload must be a string or an Uint8Array instance");
114441
+ const signingPayload = b64 || typeof inputPayload != "string" ? inputPayload : encodeUnencodedPayload(inputPayload);
114442
+ let resolvedKey = false;
114443
+ typeof key == "function" && (key = await key(protectedHeader, jws), resolvedKey = true);
114444
+ const entry = jwsAlgorithm(alg), signingInput = concat(encodedProtectedHeader !== void 0 ? encode2(encodedProtectedHeader) : new Uint8Array(), encode2("."), typeof signingPayload == "string" ? shared[2] ??= encodeAsciiMember(signingPayload, "payload", JWSInvalid) : signingPayload), signature = decodeBase64url(jws.signature, "signature", JWSInvalid), verificationKey = await prepareKey(entry, key, "verify"), cryptoKey = await rawKey(verificationKey, entry.subtle, "verify");
114445
+ entry.minRsaBits && checkModulusLength(entry.alg, cryptoKey);
114446
+ let verified = false;
114447
+ try {
114448
+ verified = await crypto.subtle.verify(entry.signing, cryptoKey, signature, signingInput);
114449
+ } catch (cause) {
114450
+ throw new JWSSignatureVerificationFailed(void 0, { cause });
114451
+ }
114452
+ if (!verified)
114453
+ throw new JWSSignatureVerificationFailed();
114454
+ const result = { payload: typeof signingPayload == "string" ? decodeBase64url(signingPayload, "payload", JWSInvalid) : signingPayload };
114455
+ return encodedProtectedHeader !== void 0 && (result.protectedHeader = protectedHeader), header !== void 0 && (result.unprotectedHeader = header), resolvedKey ? [{ ...result, key: verificationKey }, b64] : [result, b64];
114456
+ }
114457
+ async function verifyCompact(jws, shared, key) {
114458
+ if (jws instanceof Uint8Array && (jws = decoder.decode(jws)), typeof jws != "string")
114459
+ throw new JWSInvalid("Compact JWS must be a string or Uint8Array");
114460
+ const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split(".");
114461
+ if (length !== 3)
114462
+ throw new JWSInvalid("Invalid Compact JWS");
114463
+ return verifySignature({ payload, protected: protectedHeader, signature }, shared, key, encodeCompactUnencodedPayload);
114464
+ }
114465
+ var init_jws_verify = __esm({
114466
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/jws_verify.js"() {
114467
+ init_jws_algorithms();
114468
+ init_errors4();
114469
+ init_buffer_utils();
114470
+ init_validate();
114471
+ init_key();
114472
+ }
114473
+ });
114474
+
114475
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
114476
+ function invalidDuration() {
114477
+ throw new TypeError("Invalid time period format");
114478
+ }
114479
+ function secs(str) {
114480
+ typeof str != "string" && invalidDuration();
114481
+ const matched = REGEX.exec(str);
114482
+ (!matched || matched[4] && matched[1]) && invalidDuration();
114483
+ const value = parseFloat(matched[2]), durationSeconds = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
114484
+ return Number.isFinite(durationSeconds) || invalidDuration(), matched[1] === "-" || matched[4] === "ago" ? -durationSeconds : durationSeconds;
114485
+ }
114486
+ function validateInput2(label, input) {
114487
+ if (!Number.isFinite(input))
114488
+ throw new TypeError(`Invalid ${label} input`);
114489
+ return input;
114490
+ }
114491
+ function validateNumericDate(claimsSet, claim, required2 = false) {
114492
+ const value = claimsSet[claim];
114493
+ if (!(value === void 0 && !required2)) {
114494
+ if (typeof value != "number")
114495
+ throw new JWTClaimValidationFailed(`"${claim}" claim must be a number`, claimsSet, claim, "invalid");
114496
+ return value;
114497
+ }
114498
+ }
114499
+ function unexpectedClaim(claimsSet, claim) {
114500
+ throw new JWTClaimValidationFailed(`unexpected "${claim}" claim value`, claimsSet, claim, checkFailed);
114501
+ }
114502
+ function validateClaimsSet(protectedHeader, claimsSetBytes, options = {}) {
114503
+ let claimsSet;
114504
+ try {
114505
+ claimsSet = JSON.parse(strictDecoder.decode(claimsSetBytes));
114506
+ } catch (cause) {
114507
+ throw new JWTInvalid("JWT Claims Set must be a top-level JSON object", { cause });
114508
+ }
114509
+ if (!isObject2(claimsSet))
114510
+ throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
114511
+ const { typ } = options;
114512
+ if (typ !== void 0 && (typeof protectedHeader.typ != "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ)))
114513
+ throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', claimsSet, "typ", checkFailed);
114514
+ const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options, presenceCheck = [...requiredClaims];
114515
+ maxTokenAge !== void 0 && presenceCheck.push("iat"), audience !== void 0 && presenceCheck.push("aud"), subject !== void 0 && presenceCheck.push("sub"), issuer !== void 0 && presenceCheck.push("iss");
114516
+ for (const claim of new Set(presenceCheck.reverse()))
114517
+ if (!Object.hasOwn(claimsSet, claim))
114518
+ throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, claimsSet, claim, "missing");
114519
+ issuer !== void 0 && !(Array.isArray(issuer) ? issuer : [issuer]).includes(claimsSet.iss) && unexpectedClaim(claimsSet, "iss"), subject !== void 0 && claimsSet.sub !== subject && unexpectedClaim(claimsSet, "sub"), audience !== void 0 && !checkAudiencePresence(claimsSet.aud, typeof audience == "string" ? [audience] : audience) && unexpectedClaim(claimsSet, "aud");
114520
+ const { clockTolerance } = options;
114521
+ let tolerance = 0;
114522
+ if (typeof clockTolerance == "string")
114523
+ tolerance = secs(clockTolerance);
114524
+ else if (clockTolerance !== void 0) {
114525
+ if (typeof clockTolerance != "number")
114526
+ throw new TypeError("Invalid clockTolerance option type");
114527
+ tolerance = clockTolerance;
114528
+ }
114529
+ validateInput2("clockTolerance option", tolerance);
114530
+ const { currentDate } = options, now = validateInput2("currentDate option", epoch(currentDate === void 0 ? /* @__PURE__ */ new Date() : currentDate)), iat = validateNumericDate(claimsSet, "iat", maxTokenAge !== void 0), nbf = validateNumericDate(claimsSet, "nbf");
114531
+ if (nbf !== void 0 && nbf > now + tolerance)
114532
+ throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', claimsSet, "nbf", checkFailed);
114533
+ const exp = validateNumericDate(claimsSet, "exp");
114534
+ if (exp !== void 0 && exp <= now - tolerance)
114535
+ throw new JWTExpired('"exp" claim timestamp check failed', claimsSet, "exp", checkFailed);
114536
+ if (maxTokenAge !== void 0) {
114537
+ const age = now - iat, max = validateInput2("maxTokenAge option", typeof maxTokenAge == "number" ? maxTokenAge : secs(maxTokenAge));
114538
+ if (age - tolerance > max)
114539
+ throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', claimsSet, "iat", checkFailed);
114540
+ if (age < -tolerance)
114541
+ throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', claimsSet, "iat", checkFailed);
114542
+ }
114543
+ return claimsSet;
114544
+ }
114545
+ var epoch, multipliers, REGEX, checkFailed, normalizeTyp, checkAudiencePresence;
114546
+ var init_jwt_claims_set = __esm({
114547
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/lib/jwt_claims_set.js"() {
114548
+ init_errors4();
114549
+ init_buffer_utils();
114550
+ init_validate();
114551
+ epoch = (date4) => Math.floor(date4.getTime() / 1e3);
114552
+ multipliers = {
114553
+ s: 1,
114554
+ m: 60,
114555
+ h: 3600,
114556
+ d: 86400,
114557
+ w: 604800,
114558
+ y: 31557600
114559
+ };
114560
+ REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
114561
+ checkFailed = "check_failed";
114562
+ normalizeTyp = (value) => {
114563
+ const normalized = value.toLowerCase();
114564
+ return value.includes("/") ? normalized : `application/${normalized}`;
114565
+ };
114566
+ checkAudiencePresence = (audPayload, audOption) => typeof audPayload == "string" ? audOption.includes(audPayload) : Array.isArray(audPayload) ? audOption.some((aud) => audPayload.includes(aud)) : false;
114567
+ }
114568
+ });
114569
+
114570
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/jwt/verify.js
114571
+ async function jwtVerify(jwt, key, options) {
114572
+ const [verified, b64] = await verifyCompact(jwt, prepareVerify(options), key);
114573
+ if (!b64)
114574
+ throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
114575
+ const payload = validateClaimsSet(verified.protectedHeader, verified.payload, options);
114576
+ return { ...verified, payload };
114577
+ }
114578
+ var init_verify = __esm({
114579
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/jwt/verify.js"() {
114580
+ init_jws_verify();
114581
+ init_jwt_claims_set();
114582
+ init_errors4();
114583
+ }
114584
+ });
114585
+
114586
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/jwks/local.js
114587
+ function isUsableJWK(jwk, entry, alg, kid) {
114588
+ const { kty, key_ops: keyOps, ext, kid: jwkKid, alg: jwkAlg, use, crv } = jwk;
114589
+ return (ext === void 0 || typeof ext == "boolean") && (keyOps === void 0 || Array.isArray(keyOps) && keyOps.every((operation, index) => typeof operation == "string" && keyOps.indexOf(operation) === index) && keyOps.includes("verify")) && entry.kty.includes(kty) && (kid === void 0 || typeof kid == "string" && kid === jwkKid) && (jwkAlg === void 0 ? kty !== "AKP" : alg === jwkAlg) && (use === void 0 || use === "sig") && (!entry.crv || crv === entry.crv);
114590
+ }
114591
+ async function importWithAlgCache(cache3, jwk, entry) {
114592
+ const cached2 = cache3.get(jwk) || cache3.set(jwk, {}).get(jwk), { alg } = entry;
114593
+ if (cached2[alg] === void 0) {
114594
+ const pending = jwkToKey(entry, jwk, true).then((key) => {
114595
+ if (key.type !== "public")
114596
+ throw new JWKSInvalid("JSON Web Key Set members must be public keys");
114597
+ return cached2[alg] = key, key;
114598
+ }).catch((error5) => {
114599
+ throw cached2[alg] === pending && delete cached2[alg], error5;
114600
+ });
114601
+ cached2[alg] = pending;
114602
+ }
114603
+ return cached2[alg];
114604
+ }
114605
+ function createLocalJWKSet(jwks) {
114606
+ let snapshot;
114607
+ try {
114608
+ snapshot = structuredClone(jwks);
114609
+ } catch (cause) {
114610
+ throw new JWKSInvalid("JSON Web Key Set malformed", { cause });
114611
+ }
114612
+ if (!isJwkSet(snapshot))
114613
+ throw new JWKSInvalid("JSON Web Key Set malformed");
114614
+ const metadata = snapshot.keys.map((jwk) => {
114615
+ const normalized = snapshotJwk(jwk);
114616
+ return Array.isArray(normalized.key_ops) && (normalized.key_ops = [...normalized.key_ops]), normalized;
114617
+ }), cached2 = /* @__PURE__ */ new WeakMap();
114618
+ return Object.defineProperty(async (protectedHeader, token) => {
114619
+ const { alg, kid } = { ...protectedHeader, ...token?.header }, entry = typeof alg == "string" ? JWS[alg] : void 0;
114620
+ if (!entry || entry.secret)
114621
+ throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
114622
+ const candidates = snapshot.keys.filter((_4, index) => isUsableJWK(metadata[index], entry, alg, kid)), { 0: jwk, length } = candidates;
114623
+ if (!length)
114624
+ throw new JWKSNoMatchingKey();
114625
+ if (length !== 1) {
114626
+ const error5 = new JWKSMultipleMatchingKeys();
114627
+ throw error5[Symbol.asyncIterator] = async function* () {
114628
+ for (const jwk2 of candidates)
114629
+ try {
114630
+ yield await importWithAlgCache(cached2, jwk2, entry);
114631
+ } catch {
114632
+ }
114633
+ }, error5;
114634
+ }
114635
+ return importWithAlgCache(cached2, jwk, entry);
114636
+ }, "jwks", {
114637
+ value: () => structuredClone(snapshot)
114638
+ });
114639
+ }
114640
+ var init_local = __esm({
114641
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/jwks/local.js"() {
114642
+ init_key();
114643
+ init_jws_algorithms();
114644
+ init_errors4();
114645
+ init_validate();
114646
+ }
114647
+ });
114648
+
114649
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/jwks/remote.js
114650
+ function isCloudflareWorkers() {
114651
+ return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
114652
+ }
114653
+ async function fetchJwks(url2, headers, signal, fetchImpl = fetch) {
114654
+ const response = await fetchImpl(url2, {
114655
+ method: "GET",
114656
+ signal,
114657
+ redirect: "manual",
114658
+ headers
114659
+ }).catch((err) => {
114660
+ throw err.name === "TimeoutError" ? new JWKSTimeout(void 0, { cause: err }) : err;
114661
+ });
114662
+ if (response.status !== 200)
114663
+ throw new JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");
114664
+ try {
114665
+ return await response.json();
114666
+ } catch (cause) {
114667
+ throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON", { cause });
114668
+ }
114669
+ }
114670
+ function isFreshFor(timestamp, duration3) {
114671
+ return Number.isFinite(timestamp) && Date.now() < timestamp + duration3;
114672
+ }
114673
+ function validateDuration(value, fallback2, option) {
114674
+ if (Number.isNaN(value))
114675
+ throw new TypeError(`"${option}" option must not be NaN`);
114676
+ return typeof value == "number" ? value : fallback2;
114677
+ }
114678
+ function createRemoteJWKSet(url2, options) {
114679
+ if (!(url2 instanceof URL))
114680
+ throw new TypeError("url must be an instance of URL");
114681
+ const href = new URL(url2.href).href, opts = options ?? {}, timeoutOption = opts.timeoutDuration;
114682
+ if (typeof timeoutOption == "number" && (!Number.isInteger(timeoutOption) || timeoutOption < 0))
114683
+ throw new TypeError('"timeoutDuration" option must be a non-negative integer');
114684
+ const timeoutDuration = typeof timeoutOption == "number" ? timeoutOption : 5e3, cooldownDuration = validateDuration(opts.cooldownDuration, 3e4, "cooldownDuration"), cacheMaxAge = validateDuration(opts.cacheMaxAge, 6e5, "cacheMaxAge"), headers = new Headers(opts.headers);
114685
+ USER_AGENT && !headers.has("User-Agent") && headers.set("User-Agent", USER_AGENT), headers.has("accept") || headers.set("accept", "application/json, application/jwk-set+json");
114686
+ const fetchImpl = opts[customFetch], cache3 = opts[jwksCache];
114687
+ let jwksTimestamp, pendingFetch, reloadSequence = 0, appliedSequence = 0, local;
114688
+ if (cache3 && typeof cache3 == "object") {
114689
+ const { uat, jwks } = cache3;
114690
+ isFreshFor(uat, cacheMaxAge) && isJwkSet(jwks) && (jwksTimestamp = uat, local = createLocalJWKSet(jwks));
114691
+ }
114692
+ const reload = async () => {
114693
+ if (pendingFetch && isCloudflareWorkers() && (pendingFetch = void 0), !pendingFetch) {
114694
+ const sequence = ++reloadSequence, current = pendingFetch = fetchJwks(href, headers, AbortSignal.timeout(timeoutDuration), fetchImpl).then((json2) => {
114695
+ const next = createLocalJWKSet(json2);
114696
+ if (sequence <= appliedSequence)
114697
+ return;
114698
+ local = next;
114699
+ const updatedAt = Date.now();
114700
+ cache3 && (cache3.uat = updatedAt, cache3.jwks = json2), jwksTimestamp = updatedAt, appliedSequence = sequence;
114701
+ }).finally(() => {
114702
+ pendingFetch === current && (pendingFetch = void 0);
114703
+ });
114704
+ }
114705
+ await pendingFetch;
114706
+ };
114707
+ return Object.defineProperties(async (protectedHeader, token) => {
114708
+ (!local || !isFreshFor(jwksTimestamp, cacheMaxAge)) && await reload();
114709
+ try {
114710
+ return await local(protectedHeader, token);
114711
+ } catch (err) {
114712
+ if (err instanceof JWKSNoMatchingKey && !isFreshFor(jwksTimestamp, cooldownDuration))
114713
+ return await reload(), local(protectedHeader, token);
114714
+ throw err;
114715
+ }
114716
+ }, {
114717
+ coolingDown: {
114718
+ get: () => isFreshFor(jwksTimestamp, cooldownDuration),
114719
+ enumerable: true
114720
+ },
114721
+ fresh: {
114722
+ get: () => isFreshFor(jwksTimestamp, cacheMaxAge),
114723
+ enumerable: true
114724
+ },
114725
+ reload: {
114726
+ value: reload,
114727
+ enumerable: true
114728
+ },
114729
+ reloading: {
114730
+ get: () => !!pendingFetch,
114731
+ enumerable: true
114732
+ },
114733
+ jwks: {
114734
+ value: () => local?.jwks(),
114735
+ enumerable: true
114736
+ }
114737
+ });
114738
+ }
114739
+ var USER_AGENT, customFetch, jwksCache;
114740
+ var init_remote = __esm({
114741
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/jwks/remote.js"() {
114742
+ init_errors4();
114743
+ init_local();
114744
+ init_validate();
114745
+ (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.13");
114746
+ customFetch = /* @__PURE__ */ Symbol();
114747
+ jwksCache = /* @__PURE__ */ Symbol();
114748
+ }
114749
+ });
114750
+
114751
+ // node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/index.js
114752
+ var init_webapi = __esm({
114753
+ "node_modules/.pnpm/jose@6.2.13/node_modules/jose/dist/webapi/index.js"() {
114754
+ init_verify();
114755
+ init_remote();
114756
+ }
114757
+ });
114758
+
114759
+ // packages/oidc/src/schema/external-identity-provider.schema.ts
114760
+ function isSecureUrl(value) {
114761
+ const url2 = new URL(value);
114762
+ return url2.protocol === "https:" || ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname);
114763
+ }
114764
+ var RESERVED_AUTHORIZATION_PARAMS, DEFAULT_SCOPES, secureUrlSchema, ExternalIdentityProviderSchema;
114765
+ var init_external_identity_provider_schema = __esm({
114766
+ "packages/oidc/src/schema/external-identity-provider.schema.ts"() {
114767
+ "use strict";
114768
+ init_zod();
114769
+ RESERVED_AUTHORIZATION_PARAMS = [
114770
+ "client_id",
114771
+ "response_type",
114772
+ "redirect_uri",
114773
+ "scope",
114774
+ "state",
114775
+ "nonce",
114776
+ "code_challenge",
114777
+ "code_challenge_method"
114778
+ ];
114779
+ DEFAULT_SCOPES = ["openid", "email", "profile"];
114780
+ secureUrlSchema = url().refine(isSecureUrl, { error: "Must be an https URL (http is only allowed for localhost)" });
114781
+ ExternalIdentityProviderSchema = looseObject({
114782
+ key: string2().min(1).meta({ description: "Stable identifier the storefront passes back to startExternalLogin." }),
114783
+ displayName: string2().min(1),
114784
+ brand: string2().optional().meta({ description: "Neutral brand slug (google, apple, ...) so a storefront can choose its own icon." }),
114785
+ issuer: secureUrlSchema.meta({ description: "The issuer URL. Used for discovery and as the expected iss claim." }),
114786
+ clientId: string2().min(1),
114787
+ clientSecret: string2().optional().meta({ description: "Without a secret the client is public and relies on PKCE alone." }),
114788
+ scopes: array(string2()).optional().meta({ description: `Defaults to ${DEFAULT_SCOPES.join(" ")}.` }),
114789
+ authorizationParams: record(string2(), string2()).refine((params) => Object.keys(params).every((key) => !RESERVED_AUTHORIZATION_PARAMS.includes(key)), {
114790
+ error: `authorizationParams cannot set ${RESERVED_AUTHORIZATION_PARAMS.join(", ")}`
114791
+ }).optional().meta({ description: 'Fixed extra authorize parameters, e.g. { prompt: "login" } or { connection: "apple" } for Auth0.' }),
114792
+ requireVerifiedEmail: boolean2().optional().meta({ description: "Require email_verified to be true. Defaults to true; some providers (Azure B2C) never send the claim." }),
114793
+ authorizationEndpoint: secureUrlSchema.optional(),
114794
+ tokenEndpoint: secureUrlSchema.optional(),
114795
+ jwksUri: secureUrlSchema.optional()
114796
+ });
114797
+ }
114798
+ });
114799
+
114800
+ // packages/oidc/src/client/relying-party.ts
114801
+ function buildAuthorizationUrl(provider, metadata, request) {
114802
+ const url2 = new URL(metadata.authorizationEndpoint);
114803
+ url2.searchParams.set("response_type", "code");
114804
+ url2.searchParams.set("client_id", provider.clientId);
114805
+ url2.searchParams.set("redirect_uri", request.callbackUrl);
114806
+ url2.searchParams.set("scope", (provider.scopes ?? DEFAULT_SCOPES).join(" "));
114807
+ url2.searchParams.set("state", request.state);
114808
+ url2.searchParams.set("nonce", request.nonce);
114809
+ url2.searchParams.set("code_challenge", request.codeChallenge);
114810
+ url2.searchParams.set("code_challenge_method", "S256");
114811
+ for (const [key, value] of Object.entries(provider.authorizationParams ?? {})) {
114812
+ url2.searchParams.set(key, value);
114813
+ }
114814
+ return url2.toString();
114815
+ }
114816
+ async function exchangeCode(provider, metadata, request) {
114817
+ const body = new URLSearchParams({
114818
+ grant_type: "authorization_code",
114819
+ code: request.code,
114820
+ redirect_uri: request.callbackUrl,
114821
+ client_id: provider.clientId,
114822
+ code_verifier: request.codeVerifier
114823
+ });
114824
+ if (provider.clientSecret) {
114825
+ body.set("client_secret", provider.clientSecret);
114826
+ }
114827
+ const response = await fetch(metadata.tokenEndpoint, {
114828
+ method: "POST",
114829
+ headers: { "content-type": "application/x-www-form-urlencoded", accept: "application/json" },
114830
+ body
114831
+ });
114832
+ if (!response.ok) {
114833
+ throw new Error(`The identity provider refused the authorization code: HTTP ${response.status}`);
114834
+ }
114835
+ const tokens = TokenResponseSchema.parse(await response.json());
114836
+ return {
114837
+ idToken: tokens.id_token,
114838
+ ...tokens.access_token ? { accessToken: tokens.access_token } : {},
114839
+ ...tokens.refresh_token ? { refreshToken: tokens.refresh_token } : {},
114840
+ ...tokens.expires_in !== void 0 ? { expiresIn: tokens.expires_in } : {}
114841
+ };
114842
+ }
114843
+ async function refreshTokens(provider, metadata, refreshToken) {
114844
+ const body = new URLSearchParams({
114845
+ grant_type: "refresh_token",
114846
+ refresh_token: refreshToken,
114847
+ client_id: provider.clientId
114848
+ });
114849
+ if (provider.clientSecret) {
114850
+ body.set("client_secret", provider.clientSecret);
114851
+ }
114852
+ const response = await fetch(metadata.tokenEndpoint, {
114853
+ method: "POST",
114854
+ headers: { "content-type": "application/x-www-form-urlencoded", accept: "application/json" },
114855
+ body
114856
+ });
114857
+ if (!response.ok) {
114858
+ throw new Error(`The identity provider refused the refresh token: HTTP ${response.status}`);
114859
+ }
114860
+ const tokens = RefreshResponseSchema.parse(await response.json());
114861
+ return {
114862
+ accessToken: tokens.access_token,
114863
+ ...tokens.refresh_token ? { refreshToken: tokens.refresh_token } : {},
114864
+ ...tokens.id_token ? { idToken: tokens.id_token } : {},
114865
+ ...tokens.expires_in !== void 0 ? { expiresIn: tokens.expires_in } : {}
114866
+ };
114867
+ }
114868
+ function keysFor(jwksUri) {
114869
+ let keys = jwksByUri.get(jwksUri);
114870
+ if (!keys) {
114871
+ keys = createRemoteJWKSet(new URL(jwksUri));
114872
+ jwksByUri.set(jwksUri, keys);
114873
+ }
114874
+ return keys;
114875
+ }
114876
+ async function verifyIdToken(provider, metadata, idToken, expectedNonce) {
114877
+ const { payload } = await jwtVerify(idToken, keysFor(metadata.jwksUri), {
114878
+ issuer: metadata.issuer,
114879
+ audience: provider.clientId,
114880
+ algorithms: ALLOWED_ALGORITHMS,
114881
+ clockTolerance: CLOCK_TOLERANCE_SECONDS
114882
+ });
114883
+ if (payload["nonce"] !== expectedNonce) {
114884
+ throw new Error("The ID token nonce does not match this login");
114885
+ }
114886
+ return payload;
114887
+ }
114888
+ var ALLOWED_ALGORITHMS, CLOCK_TOLERANCE_SECONDS, RefreshResponseSchema, TokenResponseSchema, jwksByUri;
114889
+ var init_relying_party = __esm({
114890
+ "packages/oidc/src/client/relying-party.ts"() {
114891
+ "use strict";
114892
+ init_zod();
114893
+ init_webapi();
114894
+ init_external_identity_provider_schema();
114895
+ ALLOWED_ALGORITHMS = ["RS256", "RS384", "RS512", "PS256", "ES256", "ES384"];
114896
+ CLOCK_TOLERANCE_SECONDS = 30;
114897
+ RefreshResponseSchema = looseObject({
114898
+ access_token: string2(),
114899
+ refresh_token: string2().optional(),
114900
+ id_token: string2().optional(),
114901
+ expires_in: number2().optional()
114902
+ });
114903
+ TokenResponseSchema = looseObject({
114904
+ id_token: string2(),
114905
+ access_token: string2().optional(),
114906
+ refresh_token: string2().optional(),
114907
+ expires_in: number2().optional()
114908
+ });
114909
+ jwksByUri = /* @__PURE__ */ new Map();
114910
+ }
114911
+ });
114912
+
114913
+ // packages/oidc/src/capabilities/oidc-identity.capability.ts
114914
+ var OidcIdentityCapability;
114915
+ var init_oidc_identity_capability = __esm({
114916
+ "packages/oidc/src/capabilities/oidc-identity.capability.ts"() {
114917
+ "use strict";
114918
+ init_src();
114919
+ init_pkce();
114920
+ init_discovery();
114921
+ init_relying_party();
114922
+ OidcIdentityCapability = class extends IdentityCapability {
114923
+ externalProviders;
114924
+ constructor(cache3, context2, externalProviders) {
114925
+ super(cache3, context2);
114926
+ this.externalProviders = externalProviders ?? [];
114927
+ }
114928
+ async listProviders() {
114929
+ return success([
114930
+ PASSWORD_IDENTITY_PROVIDER,
114931
+ ...this.externalProviders.map((provider) => ({
114932
+ identifier: { key: provider.key },
114933
+ displayName: provider.displayName,
114934
+ flow: "redirect",
114935
+ ...provider.brand ? { brand: provider.brand } : {}
114936
+ }))
114937
+ ]);
114938
+ }
114939
+ async startExternalLogin(payload) {
114940
+ const provider = this.externalProviders.find((candidate) => candidate.key === payload.provider.key);
114941
+ if (!provider) {
114942
+ return error({ type: "InvalidInput", error: `Unknown identity provider ${payload.provider.key}` });
114943
+ }
114944
+ const metadata = await resolveMetadata(provider);
114945
+ const state = randomToken();
114946
+ const nonce = randomToken();
114947
+ const codeVerifier = randomToken(48);
114948
+ const location = buildAuthorizationUrl(provider, metadata, {
114949
+ callbackUrl: payload.callbackUrl,
114950
+ state,
114951
+ nonce,
114952
+ codeChallenge: await codeChallenge(codeVerifier)
114953
+ });
114954
+ this.setPendingExternalLogin(provider.key, state, { nonce, codeVerifier });
114955
+ return success({ location });
114956
+ }
114957
+ async completeExternalLogin(payload) {
114958
+ const provider = this.externalProviders.find((candidate) => candidate.key === payload.provider.key);
114959
+ if (!provider) {
114960
+ return error({ type: "InvalidInput", error: `Unknown identity provider ${payload.provider.key}` });
114961
+ }
114962
+ const params = payload.callbackParameters;
114963
+ const pending = this.takePendingExternalLogin(provider.key, params["state"]);
114964
+ if (!pending) {
114965
+ return error({ type: "InvalidInput", error: "The login was not started in this session, or has expired" });
114966
+ }
114967
+ if (params["error"]) {
114968
+ return error({ type: "InvalidInput", error: `The identity provider refused the login: ${params["error"]}` });
114969
+ }
114970
+ const code = params["code"];
114971
+ const { nonce, codeVerifier } = pending.data;
114972
+ if (!code || !nonce || !codeVerifier) {
114973
+ return error({ type: "InvalidInput", error: "The login response has no authorization code" });
114974
+ }
114975
+ const metadata = await resolveMetadata(provider);
114976
+ const tokens = await exchangeCode(provider, metadata, { code, callbackUrl: payload.callbackUrl, codeVerifier });
114977
+ const claims = await verifyIdToken(provider, metadata, tokens.idToken, nonce);
114978
+ if (provider.requireVerifiedEmail !== false && claims["email_verified"] !== true) {
114979
+ return error({ type: "InvalidInput", error: "The identity provider did not confirm a verified email address" });
114980
+ }
114981
+ const result = await this.exchangeExternalIdentity({ provider, claims, tokens });
114982
+ if (result.success) {
114983
+ this.updateIdentityContext(result.value);
114984
+ }
114985
+ return result;
114986
+ }
114987
+ };
114988
+ __decorateClass([
114989
+ Reactionary({
114990
+ inputSchema: IdentityQueryProvidersSchema,
114991
+ outputSchema: IdentityProviderSchema.array()
114992
+ })
114993
+ ], OidcIdentityCapability.prototype, "listProviders", 1);
114994
+ __decorateClass([
114995
+ Reactionary({
114996
+ inputSchema: IdentityMutationStartExternalLoginSchema,
114997
+ outputSchema: ExternalLoginRedirectSchema
114998
+ })
114999
+ ], OidcIdentityCapability.prototype, "startExternalLogin", 1);
115000
+ __decorateClass([
115001
+ Reactionary({
115002
+ inputSchema: IdentityMutationCompleteExternalLoginSchema,
115003
+ outputSchema: IdentitySchema
115004
+ })
115005
+ ], OidcIdentityCapability.prototype, "completeExternalLogin", 1);
115006
+ }
115007
+ });
115008
+
115009
+ // packages/oidc/src/index.ts
115010
+ var init_src3 = __esm({
115011
+ "packages/oidc/src/index.ts"() {
115012
+ "use strict";
115013
+ init_oidc_identity_capability();
115014
+ init_discovery();
115015
+ init_pkce();
115016
+ init_relying_party();
115017
+ init_external_identity_provider_schema();
115018
+ }
115019
+ });
115020
+
113853
115021
  // packages/commercetools/src/schema/session.schema.ts
113854
115022
  var CommercetoolsSessionSchema;
113855
115023
  var init_session_schema2 = __esm({
@@ -113859,7 +115027,10 @@ var init_session_schema2 = __esm({
113859
115027
  CommercetoolsSessionSchema = looseObject({
113860
115028
  token: string2().default(""),
113861
115029
  refreshToken: string2().optional(),
113862
- expirationTime: number2().default(0)
115030
+ expirationTime: number2().default(0),
115031
+ tokenSource: _enum(["commercetools", "external"]).optional().meta({ description: "external when token is an identity provider access token from an external login." }),
115032
+ externalProvider: string2().optional().meta({ description: "Key of the external identity provider that issued token." }),
115033
+ customerId: string2().optional().meta({ description: "The commercetools customer of an external login." })
113863
115034
  });
113864
115035
  }
113865
115036
  });
@@ -113894,14 +115065,14 @@ var init_token_cache = __esm({
113894
115065
  expirationTime: session.expirationTime
113895
115066
  };
113896
115067
  }
113897
- async set(cache, tokenCacheOptions) {
115068
+ async set(cache3, tokenCacheOptions) {
113898
115069
  const session = CommercetoolsSessionSchema.parse(
113899
115070
  this.context.session[this.sessionProviderKey] || {}
113900
115071
  );
113901
115072
  this.context.session[this.sessionProviderKey] = session;
113902
- session.refreshToken = cache.refreshToken;
113903
- session.token = cache.token;
113904
- session.expirationTime = cache.expirationTime;
115073
+ session.refreshToken = cache3.refreshToken;
115074
+ session.token = cache3.token;
115075
+ session.expirationTime = cache3.expirationTime;
113905
115076
  }
113906
115077
  };
113907
115078
  }
@@ -113925,6 +115096,13 @@ var init_oauth_schema = __esm({
113925
115096
  });
113926
115097
 
113927
115098
  // packages/commercetools/src/core/client.ts
115099
+ function externalExpiration(expiresIn) {
115100
+ return Date.now() + (expiresIn ?? 300) * 1e3 - 60 * 1e3;
115101
+ }
115102
+ function isDuplicateEmail(err) {
115103
+ const errors = err?.body?.errors;
115104
+ return Boolean(errors?.some((e2) => e2.code === "DuplicateField" && e2.field === "email"));
115105
+ }
113928
115106
  var import_ts_client, import_platform_sdk, import_crypto2, crypto2, import_debug, debug, PROVIDER_SESSION_KEY, CommercetoolsAPI;
113929
115107
  var init_client3 = __esm({
113930
115108
  "packages/commercetools/src/core/client.ts"() {
@@ -113935,6 +115113,7 @@ var init_client3 = __esm({
113935
115113
  init_src();
113936
115114
  crypto2 = __toESM(require("crypto"), 1);
113937
115115
  import_debug = __toESM(require_src(), 1);
115116
+ init_src3();
113938
115117
  init_token_cache();
113939
115118
  init_session_schema2();
113940
115119
  init_oauth_schema();
@@ -114061,6 +115240,12 @@ var init_client3 = __esm({
114061
115240
  return (0, import_platform_sdk.createApiBuilderFromCtpClient)(builder.build());
114062
115241
  }
114063
115242
  async createClient() {
115243
+ const external = this.getSessionData();
115244
+ if (external.tokenSource === "external" && external.externalProvider) {
115245
+ return (0, import_platform_sdk.createApiBuilderFromCtpClient)(
115246
+ this.createBaseClientBuilder().withMiddleware(this.externalAuthMiddleware(external.externalProvider)).build()
115247
+ );
115248
+ }
114064
115249
  let session = await this.tokenCache.get();
114065
115250
  const isNewSession = !session || !session.refreshToken;
114066
115251
  if (isNewSession) {
@@ -114103,6 +115288,9 @@ var init_client3 = __esm({
114103
115288
  return login;
114104
115289
  }
114105
115290
  async login(username, password) {
115291
+ if (this.getSessionData().tokenSource === "external") {
115292
+ this.clearExternalSession();
115293
+ }
114106
115294
  const loginBuilder = this.createBaseClientBuilder().withPasswordFlow({
114107
115295
  host: this.config.authUrl,
114108
115296
  projectKey: this.config.projectKey,
@@ -114135,6 +115323,7 @@ var init_client3 = __esm({
114135
115323
  refreshToken: "",
114136
115324
  expirationTime: 0
114137
115325
  });
115326
+ this.clearExternalSession();
114138
115327
  const identity = {
114139
115328
  type: "Anonymous"
114140
115329
  };
@@ -114148,6 +115337,10 @@ var init_client3 = __esm({
114148
115337
  };
114149
115338
  return identity;
114150
115339
  }
115340
+ const sessionData = this.getSessionData();
115341
+ if (sessionData.tokenSource === "external") {
115342
+ return this.introspectExternalSession(sessionData);
115343
+ }
114151
115344
  let body = await this.introspectToken(session.token);
114152
115345
  if (body && !body.active && session.refreshToken) {
114153
115346
  const refreshedToken = await this.refreshAccessToken(session.refreshToken);
@@ -114237,6 +115430,151 @@ var init_client3 = __esm({
114237
115430
  });
114238
115431
  return result.access_token;
114239
115432
  }
115433
+ /**
115434
+ * Signs in a verified external identity. The customer is found by externalId (<iss>|<sub>); a customer with the
115435
+ * same email but another externalId is reported as a conflict rather than linked. The shopper's guest cart goes
115436
+ * with them. The identity provider's access token becomes the session token, which commercetools accepts
115437
+ * through the project's externalOAuth introspection endpoint.
115438
+ */
115439
+ async loginWithExternalIdentity(input) {
115440
+ const admin = (await this.getAdminClient()).withProjectKey({
115441
+ projectKey: this.config.projectKey
115442
+ });
115443
+ const guestId = await this.currentGuestId();
115444
+ const existing = (await admin.customers().get({ queryArgs: { where: "externalId = :e", "var.e": input.externalId, limit: 1 } }).execute()).body.results[0];
115445
+ let customerId = existing?.id;
115446
+ if (customerId) {
115447
+ if (guestId) {
115448
+ await this.assignGuestCarts(guestId, customerId);
115449
+ }
115450
+ } else {
115451
+ const sameEmail = (await admin.customers().get({
115452
+ queryArgs: {
115453
+ where: "email in (:a, :b)",
115454
+ "var.a": input.email,
115455
+ "var.b": input.email.toLowerCase(),
115456
+ limit: 1
115457
+ }
115458
+ }).execute()).body.results[0];
115459
+ if (sameEmail) {
115460
+ return { type: "Conflict", message: "A customer with this email address already exists" };
115461
+ }
115462
+ try {
115463
+ const created = await admin.customers().post({
115464
+ body: {
115465
+ email: input.email,
115466
+ externalId: input.externalId,
115467
+ authenticationMode: "ExternalAuth",
115468
+ isEmailVerified: true,
115469
+ ...input.firstName ? { firstName: input.firstName } : {},
115470
+ ...input.lastName ? { lastName: input.lastName } : {},
115471
+ // Assigns the guest's carts to the new customer
115472
+ ...guestId ? { anonymousId: guestId } : {}
115473
+ }
115474
+ }).execute();
115475
+ customerId = created.body.customer.id;
115476
+ } catch (err) {
115477
+ if (isDuplicateEmail(err)) {
115478
+ return { type: "Conflict", message: "A customer with this email address already exists" };
115479
+ }
115480
+ throw err;
115481
+ }
115482
+ }
115483
+ await this.tokenCache.set({
115484
+ token: input.tokens.accessToken,
115485
+ refreshToken: input.tokens.refreshToken,
115486
+ expirationTime: externalExpiration(input.tokens.expiresIn)
115487
+ });
115488
+ this.setSessionData({
115489
+ tokenSource: "external",
115490
+ externalProvider: input.provider.key,
115491
+ customerId
115492
+ });
115493
+ this.client = void 0;
115494
+ return { type: "Registered", customerId };
115495
+ }
115496
+ /** The anonymous id of the current guest session, if there is one. */
115497
+ async currentGuestId() {
115498
+ try {
115499
+ const identity = await this.introspect();
115500
+ return identity.type === "Guest" ? identity.id.userId : void 0;
115501
+ } catch (err) {
115502
+ debug("Could not read the guest session before external login: %o", err);
115503
+ return void 0;
115504
+ }
115505
+ }
115506
+ /** Hands a guest's active carts to a customer that already existed. */
115507
+ async assignGuestCarts(anonymousId, customerId) {
115508
+ const admin = (await this.getAdminClient()).withProjectKey({
115509
+ projectKey: this.config.projectKey
115510
+ });
115511
+ const carts = await admin.carts().get({
115512
+ queryArgs: {
115513
+ where: 'anonymousId = :a and cartState = "Active"',
115514
+ "var.a": anonymousId
115515
+ }
115516
+ }).execute();
115517
+ for (const cart of carts.body.results) {
115518
+ await admin.carts().withId({ ID: cart.id }).post({
115519
+ body: { version: cart.version, actions: [{ action: "setCustomerId", customerId }] }
115520
+ }).execute();
115521
+ }
115522
+ }
115523
+ /** Adds the external session's access token to every request, refreshing it through the identity provider first when it has expired. */
115524
+ externalAuthMiddleware(providerKey) {
115525
+ return (next) => async (request) => {
115526
+ const token = await this.currentExternalAccessToken(providerKey);
115527
+ return next({
115528
+ ...request,
115529
+ headers: { ...request.headers, Authorization: `Bearer ${token}` }
115530
+ });
115531
+ };
115532
+ }
115533
+ async currentExternalAccessToken(providerKey) {
115534
+ const session = await this.tokenCache.get();
115535
+ if (session?.token && session.expirationTime > Date.now()) {
115536
+ return session.token;
115537
+ }
115538
+ const provider = this.config.externalIdentityProviders?.find((candidate) => candidate.key === providerKey);
115539
+ if (!provider || !session?.refreshToken) {
115540
+ this.clearExternalSession();
115541
+ throw new Error("The external login has expired, sign in again");
115542
+ }
115543
+ try {
115544
+ const refreshed = await refreshTokens(provider, await resolveMetadata(provider), session.refreshToken);
115545
+ await this.tokenCache.set({
115546
+ token: refreshed.accessToken,
115547
+ refreshToken: refreshed.refreshToken ?? session.refreshToken,
115548
+ expirationTime: externalExpiration(refreshed.expiresIn)
115549
+ });
115550
+ return refreshed.accessToken;
115551
+ } catch (err) {
115552
+ debug("Refreshing the external login failed: %o", err);
115553
+ this.clearExternalSession();
115554
+ throw new Error("The external login has expired, sign in again");
115555
+ }
115556
+ }
115557
+ async introspectExternalSession(session) {
115558
+ if (!session.customerId || !session.externalProvider) {
115559
+ return { type: "Anonymous" };
115560
+ }
115561
+ try {
115562
+ await this.currentExternalAccessToken(session.externalProvider);
115563
+ } catch {
115564
+ return { type: "Anonymous" };
115565
+ }
115566
+ return { type: "Registered", id: { userId: session.customerId } };
115567
+ }
115568
+ /** Forgets that the session belongs to an external login, and the client built for it. */
115569
+ clearExternalSession() {
115570
+ const data = this.context.session[PROVIDER_SESSION_KEY];
115571
+ if (data) {
115572
+ delete data.tokenSource;
115573
+ delete data.externalProvider;
115574
+ delete data.customerId;
115575
+ }
115576
+ this.client = void 0;
115577
+ }
114240
115578
  async becomeGuest() {
114241
115579
  const credentials = Buffer.from(
114242
115580
  `${this.config.clientId}:${this.config.clientSecret}`
@@ -114364,6 +115702,7 @@ var init_configuration_schema2 = __esm({
114364
115702
  "packages/commercetools/src/schema/configuration.schema.ts"() {
114365
115703
  "use strict";
114366
115704
  init_zod();
115705
+ init_src3();
114367
115706
  init_src();
114368
115707
  CommercetoolsConfigurationSchema = looseObject({
114369
115708
  projectKey: string2(),
@@ -114378,6 +115717,7 @@ var init_configuration_schema2 = __esm({
114378
115717
  facetFieldsForSearch: array(string2()).default(() => []),
114379
115718
  listPriceChannelKey: string2().optional(),
114380
115719
  customerPriceChannelKey: string2().optional(),
115720
+ externalIdentityProviders: array(ExternalIdentityProviderSchema).optional().meta({ description: "OpenID Connect identity providers shoppers can sign in with. commercetools has no social login of its own: reactionary runs the OpenID Connect flow, then creates or finds the customer (externalId = <iss>|<sub>) with the admin client, and commercetools accepts the identity provider's access token on the /me endpoints through the project's externalOAuth introspection endpoint. The access token must be one that endpoint can verify (a JWT; for Auth0 set authorizationParams.audience). The admin API client needs manage_customers and manage_orders." }),
114381
115721
  bopis: looseObject({
114382
115722
  shippingMethodKeys: array(string2()).default(() => []).meta({ description: 'The keys of the commercetools shipping methods that represent in-store pickup (BOPIS). Shipping methods with these keys are tagged with fulfillmentType "pickup"; all others are tagged "delivery".' })
114383
115723
  }).optional().meta({ description: "Optional buy-online-pickup-in-store (BOPIS) configuration." })
@@ -115977,8 +117317,8 @@ var init_cart_capability2 = __esm({
115977
117317
  "discountOnTotalPrice.includedDiscounts[*].discount"
115978
117318
  ];
115979
117319
  factory;
115980
- constructor(config3, cache, context2, commercetools, factory) {
115981
- super(cache, context2);
117320
+ constructor(config3, cache3, context2, commercetools, factory) {
117321
+ super(cache3, context2);
115982
117322
  this.config = config3;
115983
117323
  this.commercetools = commercetools;
115984
117324
  this.factory = factory;
@@ -116393,8 +117733,8 @@ var init_category_capability2 = __esm({
116393
117733
  config;
116394
117734
  commercetools;
116395
117735
  factory;
116396
- constructor(config3, cache, context2, commercetools, factory) {
116397
- super(cache, context2);
117736
+ constructor(config3, cache3, context2, commercetools, factory) {
117737
+ super(cache3, context2);
116398
117738
  this.config = config3;
116399
117739
  this.commercetools = commercetools;
116400
117740
  this.factory = factory;
@@ -116657,8 +117997,8 @@ var init_checkout_capability2 = __esm({
116657
117997
  config;
116658
117998
  commercetools;
116659
117999
  factory;
116660
- constructor(config3, cache, context2, commercetools, factory) {
116661
- super(cache, context2);
118000
+ constructor(config3, cache3, context2, commercetools, factory) {
118001
+ super(cache3, context2);
116662
118002
  this.config = config3;
116663
118003
  this.commercetools = commercetools;
116664
118004
  this.factory = factory;
@@ -117064,12 +118404,13 @@ var init_identity_capability2 = __esm({
117064
118404
  "packages/commercetools/src/capabilities/identity.capability.ts"() {
117065
118405
  "use strict";
117066
118406
  init_src();
117067
- CommercetoolsIdentityCapability = class extends IdentityCapability {
118407
+ init_src3();
118408
+ CommercetoolsIdentityCapability = class extends OidcIdentityCapability {
117068
118409
  config;
117069
118410
  commercetools;
117070
118411
  factory;
117071
- constructor(config3, cache, context2, commercetools, factory) {
117072
- super(cache, context2);
118412
+ constructor(config3, cache3, context2, commercetools, factory) {
118413
+ super(cache3, context2, config3.externalIdentityProviders);
117073
118414
  this.config = config3;
117074
118415
  this.commercetools = commercetools;
117075
118416
  this.factory = factory;
@@ -117112,14 +118453,45 @@ var init_identity_capability2 = __esm({
117112
118453
  this.updateIdentityContext(identity);
117113
118454
  return success(identity);
117114
118455
  }
117115
- async listProviders(_payload) {
117116
- return success([PASSWORD_IDENTITY_PROVIDER]);
117117
- }
117118
- async startExternalLogin(_payload) {
117119
- return error({ type: "InvalidInput", error: "External login is not supported by commercetools" });
117120
- }
117121
- async completeExternalLogin(_payload) {
117122
- return error({ type: "InvalidInput", error: "External login is not supported by commercetools" });
118456
+ /**
118457
+ * The shared OpenID Connect client has verified the identity. commercetools gets the identity provider's access
118458
+ * token as the session token, so that is what must be present; the customer is found or created by externalId.
118459
+ */
118460
+ async exchangeExternalIdentity(input) {
118461
+ const { claims, tokens, provider } = input;
118462
+ if (!tokens.accessToken) {
118463
+ return error({
118464
+ type: "InvalidInput",
118465
+ error: "The identity provider returned no access token, which commercetools needs"
118466
+ });
118467
+ }
118468
+ const text2 = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
118469
+ const email3 = text2(claims["email"]);
118470
+ const issuer = text2(claims.iss);
118471
+ const subject = text2(claims.sub);
118472
+ if (!email3 || !issuer || !subject) {
118473
+ return error({
118474
+ type: "InvalidInput",
118475
+ error: "The identity provider did not return an email address, issuer and subject"
118476
+ });
118477
+ }
118478
+ const outcome = await this.commercetools.loginWithExternalIdentity({
118479
+ provider,
118480
+ externalId: `${issuer}|${subject}`,
118481
+ email: email3,
118482
+ ...text2(claims["given_name"]) ? { firstName: text2(claims["given_name"]) } : {},
118483
+ ...text2(claims["family_name"]) ? { lastName: text2(claims["family_name"]) } : {},
118484
+ tokens: { ...tokens, accessToken: tokens.accessToken }
118485
+ });
118486
+ if (outcome.type === "Conflict") {
118487
+ return error({ type: "IdentityConflict", message: outcome.message });
118488
+ }
118489
+ return success(
118490
+ this.factory.parseIdentity(this.context, {
118491
+ type: "Registered",
118492
+ id: { userId: outcome.customerId }
118493
+ })
118494
+ );
117123
118495
  }
117124
118496
  };
117125
118497
  __decorateClass([
@@ -117145,24 +118517,6 @@ var init_identity_capability2 = __esm({
117145
118517
  outputSchema: IdentitySchema
117146
118518
  })
117147
118519
  ], CommercetoolsIdentityCapability.prototype, "register", 1);
117148
- __decorateClass([
117149
- Reactionary({
117150
- inputSchema: IdentityQueryProvidersSchema,
117151
- outputSchema: IdentityProviderSchema.array()
117152
- })
117153
- ], CommercetoolsIdentityCapability.prototype, "listProviders", 1);
117154
- __decorateClass([
117155
- Reactionary({
117156
- inputSchema: IdentityMutationStartExternalLoginSchema,
117157
- outputSchema: ExternalLoginRedirectSchema
117158
- })
117159
- ], CommercetoolsIdentityCapability.prototype, "startExternalLogin", 1);
117160
- __decorateClass([
117161
- Reactionary({
117162
- inputSchema: IdentityMutationCompleteExternalLoginSchema,
117163
- outputSchema: IdentitySchema
117164
- })
117165
- ], CommercetoolsIdentityCapability.prototype, "completeExternalLogin", 1);
117166
118520
  }
117167
118521
  });
117168
118522
 
@@ -117176,8 +118530,8 @@ var init_inventory_capability2 = __esm({
117176
118530
  config;
117177
118531
  commercetools;
117178
118532
  factory;
117179
- constructor(config3, cache, context2, commercetools, factory) {
117180
- super(cache, context2);
118533
+ constructor(config3, cache3, context2, commercetools, factory) {
118534
+ super(cache3, context2);
117181
118535
  this.config = config3;
117182
118536
  this.commercetools = commercetools;
117183
118537
  this.factory = factory;
@@ -117233,8 +118587,8 @@ var init_order_capability2 = __esm({
117233
118587
  config;
117234
118588
  commercetools;
117235
118589
  factory;
117236
- constructor(config3, cache, context2, commercetools, factory) {
117237
- super(cache, context2);
118590
+ constructor(config3, cache3, context2, commercetools, factory) {
118591
+ super(cache3, context2);
117238
118592
  this.config = config3;
117239
118593
  this.commercetools = commercetools;
117240
118594
  this.factory = factory;
@@ -117277,8 +118631,8 @@ var init_order_search_capability2 = __esm({
117277
118631
  config;
117278
118632
  commercetools;
117279
118633
  factory;
117280
- constructor(config3, cache, context2, commercetools, factory) {
117281
- super(cache, context2);
118634
+ constructor(config3, cache3, context2, commercetools, factory) {
118635
+ super(cache3, context2);
117282
118636
  this.config = config3;
117283
118637
  this.commercetools = commercetools;
117284
118638
  this.factory = factory;
@@ -117369,8 +118723,8 @@ var init_price_capability2 = __esm({
117369
118723
  config;
117370
118724
  commercetools;
117371
118725
  factory;
117372
- constructor(config3, cache, context2, commercetools, factory) {
117373
- super(cache, context2);
118726
+ constructor(config3, cache3, context2, commercetools, factory) {
118727
+ super(cache3, context2);
117374
118728
  this.config = config3;
117375
118729
  this.commercetools = commercetools;
117376
118730
  this.factory = factory;
@@ -117470,8 +118824,8 @@ var init_product_associations_capability2 = __esm({
117470
118824
  config;
117471
118825
  commercetools;
117472
118826
  factory;
117473
- constructor(config3, cache, context2, commercetools, factory) {
117474
- super(cache, context2);
118827
+ constructor(config3, cache3, context2, commercetools, factory) {
118828
+ super(cache3, context2);
117475
118829
  this.config = config3;
117476
118830
  this.commercetools = commercetools;
117477
118831
  this.factory = factory;
@@ -117579,8 +118933,8 @@ var init_product_list_capability2 = __esm({
117579
118933
  config;
117580
118934
  commercetools;
117581
118935
  factory;
117582
- constructor(config3, cache, context2, commercetools, factory) {
117583
- super(cache, context2);
118936
+ constructor(config3, cache3, context2, commercetools, factory) {
118937
+ super(cache3, context2);
117584
118938
  this.config = config3;
117585
118939
  this.commercetools = commercetools;
117586
118940
  this.factory = factory;
@@ -118022,8 +119376,8 @@ var init_product_capability2 = __esm({
118022
119376
  init_src();
118023
119377
  init_locale_utils();
118024
119378
  CommercetoolsProductCapability = class extends ProductCapability {
118025
- constructor(cache, context2, config3, commercetools, factory) {
118026
- super(cache, context2);
119379
+ constructor(cache3, context2, config3, commercetools, factory) {
119380
+ super(cache3, context2);
118027
119381
  this.config = config3;
118028
119382
  this.commercetools = commercetools;
118029
119383
  this.factory = factory;
@@ -118117,8 +119471,8 @@ var init_product_reviews_capability2 = __esm({
118117
119471
  config;
118118
119472
  commercetools;
118119
119473
  factory;
118120
- constructor(config3, cache, context2, commercetools, factory) {
118121
- super(cache, context2);
119474
+ constructor(config3, cache3, context2, commercetools, factory) {
119475
+ super(cache3, context2);
118122
119476
  this.config = config3;
118123
119477
  this.commercetools = commercetools;
118124
119478
  this.factory = factory;
@@ -118304,8 +119658,8 @@ var init_product_search_capability3 = __esm({
118304
119658
  * We assume all commercetools data is indexed on the language level, not the country subdivision
118305
119659
  */
118306
119660
  languageCode = getLanguageCodeFromLocale(this.context.languageContext.locale);
118307
- constructor(config3, cache, context2, commercetools, factory) {
118308
- super(cache, context2);
119661
+ constructor(config3, cache3, context2, commercetools, factory) {
119662
+ super(cache3, context2);
118309
119663
  this.config = config3;
118310
119664
  this.commercetools = commercetools;
118311
119665
  this.factory = factory;
@@ -118586,8 +119940,8 @@ var init_profile_capability2 = __esm({
118586
119940
  config;
118587
119941
  commercetools;
118588
119942
  factory;
118589
- constructor(config3, cache, context2, commercetools, factory) {
118590
- super(cache, context2);
119943
+ constructor(config3, cache3, context2, commercetools, factory) {
119944
+ super(cache3, context2);
118591
119945
  this.config = config3;
118592
119946
  this.commercetools = commercetools;
118593
119947
  this.factory = factory;
@@ -118918,8 +120272,8 @@ var init_store_capability2 = __esm({
118918
120272
  config;
118919
120273
  commercetools;
118920
120274
  factory;
118921
- constructor(config3, cache, context2, commercetools, factory) {
118922
- super(cache, context2);
120275
+ constructor(config3, cache3, context2, commercetools, factory) {
120276
+ super(cache3, context2);
118923
120277
  this.config = config3;
118924
120278
  this.commercetools = commercetools;
118925
120279
  this.factory = factory;
@@ -119016,8 +120370,8 @@ var init_company_registration_capability2 = __esm({
119016
120370
  config;
119017
120371
  commercetools;
119018
120372
  factory;
119019
- constructor(config3, cache, context2, commercetools, factory) {
119020
- super(cache, context2);
120373
+ constructor(config3, cache3, context2, commercetools, factory) {
120374
+ super(cache3, context2);
119021
120375
  this.config = config3;
119022
120376
  this.commercetools = commercetools;
119023
120377
  this.factory = factory;
@@ -119139,8 +120493,8 @@ var init_company_capability2 = __esm({
119139
120493
  config;
119140
120494
  commercetools;
119141
120495
  factory;
119142
- constructor(config3, cache, context2, commercetools, factory) {
119143
- super(cache, context2);
120496
+ constructor(config3, cache3, context2, commercetools, factory) {
120497
+ super(cache3, context2);
119144
120498
  this.config = config3;
119145
120499
  this.commercetools = commercetools;
119146
120500
  this.factory = factory;
@@ -119573,8 +120927,8 @@ var init_employee_capability2 = __esm({
119573
120927
  config;
119574
120928
  commercetools;
119575
120929
  factory;
119576
- constructor(config3, cache, context2, commercetools, factory) {
119577
- super(cache, context2);
120930
+ constructor(config3, cache3, context2, commercetools, factory) {
120931
+ super(cache3, context2);
119578
120932
  this.config = config3;
119579
120933
  this.commercetools = commercetools;
119580
120934
  this.factory = factory;
@@ -119965,8 +121319,8 @@ var init_employee_invitation_capability2 = __esm({
119965
121319
  config;
119966
121320
  commercetools;
119967
121321
  factory;
119968
- constructor(config3, cache, context2, commercetools, factory) {
119969
- super(cache, context2);
121322
+ constructor(config3, cache3, context2, commercetools, factory) {
121323
+ super(cache3, context2);
119970
121324
  this.config = config3;
119971
121325
  this.commercetools = commercetools;
119972
121326
  this.factory = factory;
@@ -120342,8 +121696,8 @@ var init_personalization_profile_capability2 = __esm({
120342
121696
  config;
120343
121697
  commercetools;
120344
121698
  factory;
120345
- constructor(config3, cache, context2, commercetools, factory) {
120346
- super(cache, context2);
121699
+ constructor(config3, cache3, context2, commercetools, factory) {
121700
+ super(cache3, context2);
120347
121701
  this.config = config3;
120348
121702
  this.commercetools = commercetools;
120349
121703
  this.factory = factory;
@@ -120767,13 +122121,13 @@ var init_initialize_types2 = __esm({
120767
122121
 
120768
122122
  // packages/commercetools/src/core/initialize.ts
120769
122123
  function withCommercetoolsCapabilities(configuration, capabilities) {
120770
- return (cache, context2) => {
122124
+ return (cache3, context2) => {
120771
122125
  const client = {};
120772
122126
  const config3 = CommercetoolsConfigurationSchema.parse(configuration);
120773
122127
  const caps = CommercetoolsCapabilitiesSchema.parse(capabilities);
120774
122128
  const commercetoolsApi = new CommercetoolsAPI(config3, context2);
120775
122129
  const buildCapabilityArgs = (factory) => ({
120776
- cache,
122130
+ cache: cache3,
120777
122131
  context: context2,
120778
122132
  config: config3,
120779
122133
  commercetoolsApi,
@@ -120808,7 +122162,7 @@ var init_initialize2 = __esm({
120808
122162
  });
120809
122163
 
120810
122164
  // packages/commercetools/src/index.ts
120811
- var init_src3 = __esm({
122165
+ var init_src4 = __esm({
120812
122166
  "packages/commercetools/src/index.ts"() {
120813
122167
  "use strict";
120814
122168
  init_client3();
@@ -122921,8 +124275,8 @@ var init_product_capability3 = __esm({
122921
124275
  FakeProductCapability = class extends ProductCapability {
122922
124276
  config;
122923
124277
  factory;
122924
- constructor(config3, cache, context2, factory) {
122925
- super(cache, context2);
124278
+ constructor(config3, cache3, context2, factory) {
124279
+ super(cache3, context2);
122926
124280
  this.config = config3;
122927
124281
  this.factory = factory;
122928
124282
  }
@@ -123053,8 +124407,8 @@ var init_product_search_capability4 = __esm({
123053
124407
  FakeProductSearchCapability = class extends ProductSearchCapability {
123054
124408
  config;
123055
124409
  factory;
123056
- constructor(config3, cache, context2, factory) {
123057
- super(cache, context2);
124410
+ constructor(config3, cache3, context2, factory) {
124411
+ super(cache3, context2);
123058
124412
  this.config = config3;
123059
124413
  this.factory = factory;
123060
124414
  }
@@ -123253,8 +124607,8 @@ var init_category_capability3 = __esm({
123253
124607
  this.allCategories.set(identifier.key, category);
123254
124608
  return category;
123255
124609
  }
123256
- constructor(config3, cache, context2, factory) {
123257
- super(cache, context2);
124610
+ constructor(config3, cache3, context2, factory) {
124611
+ super(cache3, context2);
123258
124612
  this.config = config3;
123259
124613
  this.factory = factory;
123260
124614
  this.categoryGenerator = new Qe2({
@@ -123388,8 +124742,8 @@ var init_cart_capability3 = __esm({
123388
124742
  factory;
123389
124743
  carts = /* @__PURE__ */ new Map();
123390
124744
  generator;
123391
- constructor(config3, cache, context2, factory) {
123392
- super(cache, context2);
124745
+ constructor(config3, cache3, context2, factory) {
124746
+ super(cache3, context2);
123393
124747
  this.generator = new Qe2({
123394
124748
  locale: [ys, Oi],
123395
124749
  seed: config3.seeds.product
@@ -123741,8 +125095,8 @@ var init_checkout_capability3 = __esm({
123741
125095
  config;
123742
125096
  generator;
123743
125097
  factory;
123744
- constructor(config3, cache, context2, factory) {
123745
- super(cache, context2);
125098
+ constructor(config3, cache3, context2, factory) {
125099
+ super(cache3, context2);
123746
125100
  this.config = config3;
123747
125101
  this.generator = new Qe2({
123748
125102
  locale: [ys, Oi],
@@ -123952,8 +125306,8 @@ var init_feature_flag_capability2 = __esm({
123952
125306
  config;
123953
125307
  factory;
123954
125308
  flagDefinitions;
123955
- constructor(config3, cache, context2, factory) {
123956
- super(cache, context2);
125309
+ constructor(config3, cache3, context2, factory) {
125310
+ super(cache3, context2);
123957
125311
  this.config = config3;
123958
125312
  this.factory = factory;
123959
125313
  this.flagDefinitions = new Map(config3.featureFlags?.flags.map((f3) => [f3.key, f3]) ?? []);
@@ -124005,8 +125359,8 @@ var init_identity_capability3 = __esm({
124005
125359
  config;
124006
125360
  factory;
124007
125361
  currentIdentity = null;
124008
- constructor(config3, cache, context2, factory) {
124009
- super(cache, context2);
125362
+ constructor(config3, cache3, context2, factory) {
125363
+ super(cache3, context2);
124010
125364
  this.config = config3;
124011
125365
  this.factory = factory;
124012
125366
  }
@@ -124145,8 +125499,8 @@ var init_inventory_capability3 = __esm({
124145
125499
  FakeInventoryCapability = class extends InventoryCapability {
124146
125500
  config;
124147
125501
  factory;
124148
- constructor(config3, cache, context2, factory) {
124149
- super(cache, context2);
125502
+ constructor(config3, cache3, context2, factory) {
125503
+ super(cache3, context2);
124150
125504
  this.config = config3;
124151
125505
  this.factory = factory;
124152
125506
  }
@@ -124217,8 +125571,8 @@ var init_personalization_profile_capability3 = __esm({
124217
125571
  FakePersonalizationProfileCapability = class extends PersonalizationProfileCapability {
124218
125572
  config;
124219
125573
  factory;
124220
- constructor(config3, cache, context2, factory) {
124221
- super(cache, context2);
125574
+ constructor(config3, cache3, context2, factory) {
125575
+ super(cache3, context2);
124222
125576
  this.config = config3;
124223
125577
  this.factory = factory;
124224
125578
  }
@@ -124267,8 +125621,8 @@ var init_order_search_capability3 = __esm({
124267
125621
  config;
124268
125622
  generator;
124269
125623
  factory;
124270
- constructor(config3, cache, context2, factory) {
124271
- super(cache, context2);
125624
+ constructor(config3, cache3, context2, factory) {
125625
+ super(cache3, context2);
124272
125626
  this.config = config3;
124273
125627
  this.generator = new Qe2({
124274
125628
  locale: [ys, Oi],
@@ -124329,8 +125683,8 @@ var init_order_capability3 = __esm({
124329
125683
  config;
124330
125684
  generator;
124331
125685
  factory;
124332
- constructor(config3, cache, context2, factory) {
124333
- super(cache, context2);
125686
+ constructor(config3, cache3, context2, factory) {
125687
+ super(cache3, context2);
124334
125688
  this.config = config3;
124335
125689
  this.generator = new Qe2({
124336
125690
  locale: [ys, Oi],
@@ -124440,8 +125794,8 @@ var init_price_capability3 = __esm({
124440
125794
  NOK: [0, 90],
124441
125795
  SEK: [0, 90]
124442
125796
  };
124443
- constructor(config3, cache, context2, factory) {
124444
- super(cache, context2);
125797
+ constructor(config3, cache3, context2, factory) {
125798
+ super(cache3, context2);
124445
125799
  this.config = config3;
124446
125800
  this.faker = new Qe2({
124447
125801
  locale: [ys, Oi]
@@ -124543,8 +125897,8 @@ var init_product_associations_capability3 = __esm({
124543
125897
  config;
124544
125898
  factory;
124545
125899
  faker;
124546
- constructor(config3, cache, context2, factory) {
124547
- super(cache, context2);
125900
+ constructor(config3, cache3, context2, factory) {
125901
+ super(cache3, context2);
124548
125902
  this.config = config3;
124549
125903
  this.factory = factory;
124550
125904
  this.faker = new Qe2({ locale: [ys] });
@@ -124655,8 +126009,8 @@ var init_product_reviews_capability3 = __esm({
124655
126009
  config;
124656
126010
  factory;
124657
126011
  faker;
124658
- constructor(config3, cache, context2, factory) {
124659
- super(cache, context2);
126012
+ constructor(config3, cache3, context2, factory) {
126013
+ super(cache3, context2);
124660
126014
  this.config = config3;
124661
126015
  this.factory = factory;
124662
126016
  this.faker = new Qe2({ locale: [ys, Oi] });
@@ -124794,8 +126148,8 @@ var init_profile_capability3 = __esm({
124794
126148
  config;
124795
126149
  factory;
124796
126150
  generator;
124797
- constructor(config3, cache, context2, factory) {
124798
- super(cache, context2);
126151
+ constructor(config3, cache3, context2, factory) {
126152
+ super(cache3, context2);
124799
126153
  this.generator = new Qe2({
124800
126154
  locale: [ys, Oi],
124801
126155
  seed: config3.seeds.product
@@ -124906,8 +126260,8 @@ var init_store_capability3 = __esm({
124906
126260
  FakeStoreCapability = class extends StoreCapability {
124907
126261
  config;
124908
126262
  factory;
124909
- constructor(config3, cache, context2, factory) {
124910
- super(cache, context2);
126263
+ constructor(config3, cache3, context2, factory) {
126264
+ super(cache3, context2);
124911
126265
  this.config = config3;
124912
126266
  this.factory = factory;
124913
126267
  }
@@ -125378,11 +126732,11 @@ var init_initialize_types3 = __esm({
125378
126732
 
125379
126733
  // packages/fake/src/core/initialize.ts
125380
126734
  function withFakeCapabilities(configuration, capabilities) {
125381
- return (cache, context2) => {
126735
+ return (cache3, context2) => {
125382
126736
  const client = {};
125383
126737
  const caps = FakeCapabilitiesSchema.parse(capabilities);
125384
126738
  const buildCapabilityArgs = (factory) => ({
125385
- cache,
126739
+ cache: cache3,
125386
126740
  context: context2,
125387
126741
  config: configuration,
125388
126742
  factory
@@ -125640,7 +126994,7 @@ var init_configuration_schema3 = __esm({
125640
126994
  });
125641
126995
 
125642
126996
  // packages/fake/src/index.ts
125643
- var init_src4 = __esm({
126997
+ var init_src5 = __esm({
125644
126998
  "packages/fake/src/index.ts"() {
125645
126999
  "use strict";
125646
127000
  init_initialize3();
@@ -125658,6 +127012,7 @@ var init_configuration_schema4 = __esm({
125658
127012
  "packages/magento/src/schema/configuration.schema.ts"() {
125659
127013
  "use strict";
125660
127014
  init_zod();
127015
+ init_src3();
125661
127016
  MagentoConfigurationSchema = looseObject({
125662
127017
  adminApiKey: string2().meta({ description: "The API key for Magento admin operations. Needed for the few tasks that require admin access." }),
125663
127018
  baseUrl: string2().meta({ description: "The base URL for the Magento installation." }),
@@ -125670,6 +127025,7 @@ var init_configuration_schema4 = __esm({
125670
127025
  reviewRatingCode: string2().optional().meta({ description: 'The name of the Magento review rating (as listed by `productReviewRatingsMetadata`) that carries the overall star rating. Defaults to "Rating"; the first available rating is used as a fallback.' }),
125671
127026
  storeCode: string2().default(""),
125672
127027
  checkoutAgreementIds: array(string2()).optional().meta({ description: "Ids of the Magento terms and conditions (Magento_CheckoutAgreements) the shopper accepts when placing an order. Required by stores with \"Enable Terms and Conditions\" on, which otherwise reject order placement. Sent as the payment method's `extension_attributes.agreement_ids`. The storefront must collect the shopper's consent before finalizing checkout." }),
127028
+ externalIdentityProviders: array(ExternalIdentityProviderSchema).optional().meta({ description: "OpenID Connect identity providers shoppers can sign in with. Stock Magento has no social login, so reactionary runs the OpenID Connect flow and then creates or finds the customer by verified email and issues a customer token (Adobe's documented pattern). The admin API key needs the Magento_Customer::retrieve_tokens permission and the Storefront Compatibility Package (4.7.6 or newer) must be installed." }),
125673
127029
  authStoreCode: string2().default("default").meta({ description: "The store/website scope used for customer authentication and account operations (token, customers/me). Customers typically live on the default website, which may differ from the catalog storeCode." })
125674
127030
  });
125675
127031
  }
@@ -125745,8 +127101,8 @@ var init_cart_capability4 = __esm({
125745
127101
  init_magento_schema();
125746
127102
  debug5 = (0, import_debug5.default)("reactionary:magento:cart");
125747
127103
  MagentoCartCapability = class extends CartCapability {
125748
- constructor(config3, cache, context2, magentoApi, factory) {
125749
- super(cache, context2);
127104
+ constructor(config3, cache3, context2, magentoApi, factory) {
127105
+ super(cache3, context2);
125750
127106
  this.magentoApi = magentoApi;
125751
127107
  this.config = config3;
125752
127108
  this.factory = factory;
@@ -126014,8 +127370,8 @@ var init_category_capability4 = __esm({
126014
127370
  import_debug6 = __toESM(require_src(), 1);
126015
127371
  debug6 = (0, import_debug6.default)("reactionary:magento:category");
126016
127372
  MagentoCategoryCapability = class extends CategoryCapability {
126017
- constructor(config3, cache, context2, magentoApi, factory) {
126018
- super(cache, context2);
127373
+ constructor(config3, cache3, context2, magentoApi, factory) {
127374
+ super(cache3, context2);
126019
127375
  this.magentoApi = magentoApi;
126020
127376
  this.config = config3;
126021
127377
  this.factory = factory;
@@ -126243,16 +127599,27 @@ var init_category_capability4 = __esm({
126243
127599
  });
126244
127600
 
126245
127601
  // packages/magento/src/capabilities/identity.capability.ts
127602
+ function namesFromClaims(claims) {
127603
+ const text2 = (value) => typeof value === "string" && value.trim() ? value.trim() : void 0;
127604
+ const given = text2(claims["given_name"]);
127605
+ const family = text2(claims["family_name"]);
127606
+ if (given || family) {
127607
+ return { firstName: given ?? "User", lastName: family ?? "Account" };
127608
+ }
127609
+ const [first, ...rest] = (text2(claims["name"]) ?? "").split(" ").filter(Boolean);
127610
+ return { firstName: first ?? "User", lastName: rest.join(" ") || "Account" };
127611
+ }
126246
127612
  var import_debug7, debug7, MagentoIdentityCapability;
126247
127613
  var init_identity_capability4 = __esm({
126248
127614
  "packages/magento/src/capabilities/identity.capability.ts"() {
126249
127615
  "use strict";
126250
127616
  init_src();
127617
+ init_src3();
126251
127618
  import_debug7 = __toESM(require_src(), 1);
126252
127619
  debug7 = (0, import_debug7.default)("reactionary:magento:identity");
126253
- MagentoIdentityCapability = class extends IdentityCapability {
126254
- constructor(config3, cache, context2, magentoApi) {
126255
- super(cache, context2);
127620
+ MagentoIdentityCapability = class extends OidcIdentityCapability {
127621
+ constructor(config3, cache3, context2, magentoApi) {
127622
+ super(cache3, context2, config3.externalIdentityProviders);
126256
127623
  this.magentoApi = magentoApi;
126257
127624
  this.config = config3;
126258
127625
  }
@@ -126322,14 +127689,20 @@ var init_identity_capability4 = __esm({
126322
127689
  password: payload.password
126323
127690
  });
126324
127691
  }
126325
- async listProviders(_payload) {
126326
- return success([PASSWORD_IDENTITY_PROVIDER]);
126327
- }
126328
- async startExternalLogin(_payload) {
126329
- return error({ type: "InvalidInput", error: "External login is not supported by Magento" });
126330
- }
126331
- async completeExternalLogin(_payload) {
126332
- return error({ type: "InvalidInput", error: "External login is not supported by Magento" });
127692
+ /**
127693
+ * Stock Magento has no external login. Once the shared OpenID Connect client has verified the identity, this
127694
+ * finds or creates the customer by verified email (the pattern in Adobe's social login guide) and issues a
127695
+ * customer token. An existing account with the same email is signed in, which is only appropriate for identity
127696
+ * providers the shop owner trusts: that is what the configured provider list is.
127697
+ */
127698
+ async exchangeExternalIdentity(input) {
127699
+ const email3 = input.claims["email"];
127700
+ if (typeof email3 !== "string" || email3.length === 0) {
127701
+ return error({ type: "InvalidInput", error: "The identity provider did not return an email address" });
127702
+ }
127703
+ await this.magentoApi.loginWithExternalIdentity({ email: email3, ...namesFromClaims(input.claims) });
127704
+ const me3 = await this.magentoApi.getMe();
127705
+ return success({ type: "Registered", id: { userId: String(me3.id) } });
126333
127706
  }
126334
127707
  };
126335
127708
  __decorateClass([
@@ -126356,24 +127729,6 @@ var init_identity_capability4 = __esm({
126356
127729
  outputSchema: IdentitySchema
126357
127730
  })
126358
127731
  ], MagentoIdentityCapability.prototype, "register", 1);
126359
- __decorateClass([
126360
- Reactionary({
126361
- inputSchema: IdentityQueryProvidersSchema,
126362
- outputSchema: IdentityProviderSchema.array()
126363
- })
126364
- ], MagentoIdentityCapability.prototype, "listProviders", 1);
126365
- __decorateClass([
126366
- Reactionary({
126367
- inputSchema: IdentityMutationStartExternalLoginSchema,
126368
- outputSchema: ExternalLoginRedirectSchema
126369
- })
126370
- ], MagentoIdentityCapability.prototype, "startExternalLogin", 1);
126371
- __decorateClass([
126372
- Reactionary({
126373
- inputSchema: IdentityMutationCompleteExternalLoginSchema,
126374
- outputSchema: IdentitySchema
126375
- })
126376
- ], MagentoIdentityCapability.prototype, "completeExternalLogin", 1);
126377
127732
  }
126378
127733
  });
126379
127734
 
@@ -126386,8 +127741,8 @@ var init_inventory_capability4 = __esm({
126386
127741
  import_debug8 = __toESM(require_src(), 1);
126387
127742
  debug8 = (0, import_debug8.default)("reactionary:magento:inventory");
126388
127743
  MagentoInventoryCapability = class extends InventoryCapability {
126389
- constructor(config3, cache, context2, magentoApi, factory) {
126390
- super(cache, context2);
127744
+ constructor(config3, cache3, context2, magentoApi, factory) {
127745
+ super(cache3, context2);
126391
127746
  this.magentoApi = magentoApi;
126392
127747
  this.config = config3;
126393
127748
  this.factory = factory;
@@ -126459,8 +127814,8 @@ var init_price_capability4 = __esm({
126459
127814
  import_debug9 = __toESM(require_src(), 1);
126460
127815
  debug9 = (0, import_debug9.default)("reactionary:magento:price");
126461
127816
  MagentoPriceCapability = class extends PriceCapability {
126462
- constructor(config3, cache, context2, magentoApi, factory) {
126463
- super(cache, context2);
127817
+ constructor(config3, cache3, context2, magentoApi, factory) {
127818
+ super(cache3, context2);
126464
127819
  this.magentoApi = magentoApi;
126465
127820
  this.config = config3;
126466
127821
  this.factory = factory;
@@ -126521,8 +127876,8 @@ var init_product_search_capability5 = __esm({
126521
127876
  CATEGORY_FACET_KEY = "categories";
126522
127877
  CATEGORY_FIELD = "category_id";
126523
127878
  MagentoProductSearchCapability = class extends ProductSearchCapability {
126524
- constructor(config3, cache, context2, magentoApi, factory) {
126525
- super(cache, context2);
127879
+ constructor(config3, cache3, context2, magentoApi, factory) {
127880
+ super(cache3, context2);
126526
127881
  this.magentoApi = magentoApi;
126527
127882
  this.config = config3;
126528
127883
  this.factory = factory;
@@ -126688,8 +128043,8 @@ var init_product_capability4 = __esm({
126688
128043
  import_debug11 = __toESM(require_src(), 1);
126689
128044
  debug11 = (0, import_debug11.default)("reactionary:magento:product");
126690
128045
  MagentoProductCapability = class extends ProductCapability {
126691
- constructor(config3, cache, context2, magentoApi, factory) {
126692
- super(cache, context2);
128046
+ constructor(config3, cache3, context2, magentoApi, factory) {
128047
+ super(cache3, context2);
126693
128048
  this.magentoApi = magentoApi;
126694
128049
  this.config = config3;
126695
128050
  this.factory = factory;
@@ -126783,8 +128138,8 @@ var init_profile_capability4 = __esm({
126783
128138
  import_debug12 = __toESM(require_src(), 1);
126784
128139
  debug12 = (0, import_debug12.default)("reactionary:magento:profile");
126785
128140
  MagentoProfileCapability = class extends ProfileCapability {
126786
- constructor(config3, cache, context2, magentoApi, factory) {
126787
- super(cache, context2);
128141
+ constructor(config3, cache3, context2, magentoApi, factory) {
128142
+ super(cache3, context2);
126788
128143
  this.magentoApi = magentoApi;
126789
128144
  this.config = config3;
126790
128145
  this.factory = factory;
@@ -127050,8 +128405,8 @@ var init_order_search_capability4 = __esm({
127050
128405
  import_debug13 = __toESM(require_src(), 1);
127051
128406
  debug13 = (0, import_debug13.default)("reactionary:magento:order-search");
127052
128407
  MagentoOrderSearchCapability = class extends OrderSearchCapability {
127053
- constructor(config3, cache, context2, magentoApi, factory) {
127054
- super(cache, context2);
128408
+ constructor(config3, cache3, context2, magentoApi, factory) {
128409
+ super(cache3, context2);
127055
128410
  this.magentoApi = magentoApi;
127056
128411
  this.config = config3;
127057
128412
  this.factory = factory;
@@ -127189,8 +128544,8 @@ var init_order_capability4 = __esm({
127189
128544
  import_debug14 = __toESM(require_src(), 1);
127190
128545
  debug14 = (0, import_debug14.default)("reactionary:magento:order");
127191
128546
  MagentoOrderCapability = class extends OrderCapability {
127192
- constructor(config3, cache, context2, magentoApi, factory) {
127193
- super(cache, context2);
128547
+ constructor(config3, cache3, context2, magentoApi, factory) {
128548
+ super(cache3, context2);
127194
128549
  this.magentoApi = magentoApi;
127195
128550
  this.config = config3;
127196
128551
  this.factory = factory;
@@ -127473,8 +128828,8 @@ var init_checkout_capability4 = __esm({
127473
128828
  checkoutIdentifier;
127474
128829
  };
127475
128830
  MagentoCheckoutCapability = class extends CheckoutCapability {
127476
- constructor(config3, cache, context2, magentoApi, factory) {
127477
- super(cache, context2);
128831
+ constructor(config3, cache3, context2, magentoApi, factory) {
128832
+ super(cache3, context2);
127478
128833
  this.magentoApi = magentoApi;
127479
128834
  this.config = config3;
127480
128835
  this.factory = factory;
@@ -127904,8 +129259,8 @@ var init_product_associations_capability4 = __esm({
127904
129259
  init_magento_product_lookup();
127905
129260
  debug16 = (0, import_debug16.default)("reactionary:magento:product-associations");
127906
129261
  MagentoProductAssociationsCapability = class extends ProductAssociationsCapability {
127907
- constructor(config3, cache, context2, magentoApi, factory) {
127908
- super(cache, context2);
129262
+ constructor(config3, cache3, context2, magentoApi, factory) {
129263
+ super(cache3, context2);
127909
129264
  this.magentoApi = magentoApi;
127910
129265
  this.config = config3;
127911
129266
  this.factory = factory;
@@ -128121,8 +129476,8 @@ var init_product_recommendations_capability3 = __esm({
128121
129476
  init_magento_product();
128122
129477
  debug18 = (0, import_debug18.default)("reactionary:magento:product-recommendations");
128123
129478
  MagentoProductRecommendationsCapability = class extends ProductRecommendationsCapability {
128124
- constructor(config3, cache, context2, magentoApi) {
128125
- super(cache, context2);
129479
+ constructor(config3, cache3, context2, magentoApi) {
129480
+ super(cache3, context2);
128126
129481
  this.magentoApi = magentoApi;
128127
129482
  this.config = config3;
128128
129483
  }
@@ -128256,8 +129611,8 @@ var init_product_reviews_capability4 = __esm({
128256
129611
  DEFAULT_PAGE_SIZE = 20;
128257
129612
  DEFAULT_REVIEW_RATING_CODE = "Rating";
128258
129613
  MagentoProductReviewsCapability = class extends ProductReviewsCapability {
128259
- constructor(config3, cache, context2, magentoApi, factory) {
128260
- super(cache, context2);
129614
+ constructor(config3, cache3, context2, magentoApi, factory) {
129615
+ super(cache3, context2);
128261
129616
  this.magentoApi = magentoApi;
128262
129617
  this.config = config3;
128263
129618
  this.factory = factory;
@@ -128493,6 +129848,11 @@ function ensureMagentoPasswordPolicy(password) {
128493
129848
  if (!/[^A-Za-z0-9]/.test(password)) suffix += "!";
128494
129849
  return `${password}${suffix}`;
128495
129850
  }
129851
+ function randomMagentoPassword() {
129852
+ const bytes = new Uint8Array(24);
129853
+ crypto.getRandomValues(bytes);
129854
+ return ensureMagentoPasswordPolicy(btoa(String.fromCharCode(...bytes)));
129855
+ }
128496
129856
  function resolveGraphQLEndpoint(config3) {
128497
129857
  if (config3.graphqlUrl) {
128498
129858
  return config3.graphqlUrl;
@@ -128652,6 +130012,34 @@ ${text2}`
128652
130012
  await this.tokenStore.setItem("customerToken", normalized);
128653
130013
  return normalized;
128654
130014
  },
130015
+ /**
130016
+ * Establishes a customer session for a verified external identity, the way Adobe's social login guide does:
130017
+ * find the customer by email, create it if there is none, then issue a customer token with the admin key.
130018
+ * Needs the Storefront Compatibility Package (4.7.6+) for POST /V1/customers/{id}/token.
130019
+ */
130020
+ loginWithExternalIdentity: async (identity) => {
130021
+ const params = new URLSearchParams();
130022
+ params.set("searchCriteria[filterGroups][0][filters][0][field]", "email");
130023
+ params.set("searchCriteria[filterGroups][0][filters][0][value]", identity.email);
130024
+ params.set("searchCriteria[filterGroups][0][filters][0][condition_type]", "eq");
130025
+ params.set("searchCriteria[pageSize]", "1");
130026
+ const found = await this.adminRest.request(
130027
+ "GET",
130028
+ `/V1/customers/search?${params.toString()}`
130029
+ );
130030
+ let customerId = found.items?.[0]?.id;
130031
+ if (customerId === void 0) {
130032
+ const created = await this.adminRest.request("POST", "/V1/customers", {
130033
+ customer: { email: identity.email, firstname: identity.firstName, lastname: identity.lastName },
130034
+ password: randomMagentoPassword()
130035
+ });
130036
+ customerId = created.id;
130037
+ }
130038
+ const token = await this.adminRest.request("POST", `/V1/customers/${customerId}/token`);
130039
+ const normalized = typeof token === "string" ? token.replace(/^"|"$/g, "") : String(token);
130040
+ await this.tokenStore.setItem("customerToken", normalized);
130041
+ return normalized;
130042
+ },
128655
130043
  logout: async () => {
128656
130044
  await this.tokenStore.removeItem("customerToken");
128657
130045
  }
@@ -128789,6 +130177,16 @@ ${text2}`
128789
130177
  }
128790
130178
  },
128791
130179
  cart: {
130180
+ /**
130181
+ * Moves a guest cart's items into the signed-in customer's cart (Adobe's recommended step after login).
130182
+ * Must run with the customer token already stored.
130183
+ */
130184
+ mergeGuestCart: async (guestCartId) => {
130185
+ await this.gql.request(
130186
+ "mutation MergeGuestCart($source: String!) { mergeCarts(source_cart_id: $source) { id } }",
130187
+ { source: guestCartId }
130188
+ );
130189
+ },
128792
130190
  create: async (customerToken) => {
128793
130191
  if (customerToken) {
128794
130192
  const res2 = await this.rest.request("POST", "/V1/carts/mine");
@@ -128911,6 +130309,25 @@ ${text2}`
128911
130309
  const client = await this.getClient();
128912
130310
  return client.auth.login(email3, password);
128913
130311
  }
130312
+ /**
130313
+ * Signs in a verified external identity (see Magento.auth.loginWithExternalIdentity) and carries a guest cart over.
130314
+ * The guest cart id is cleared either way: after login the cart endpoints use /carts/mine, and a stale id would
130315
+ * make getSelf report a guest after the next logout.
130316
+ */
130317
+ async loginWithExternalIdentity(identity) {
130318
+ const client = await this.getClient();
130319
+ const guestCartId = await this.getActiveCartId();
130320
+ const token = await client.auth.loginWithExternalIdentity(identity);
130321
+ if (guestCartId) {
130322
+ try {
130323
+ await client.store.cart.mergeGuestCart(guestCartId);
130324
+ } catch (err) {
130325
+ debug20("Could not merge the guest cart after external login:", err);
130326
+ }
130327
+ await this.clearActiveCartId();
130328
+ }
130329
+ return token;
130330
+ }
128914
130331
  async logout() {
128915
130332
  const client = await this.getClient();
128916
130333
  return client.auth.logout();
@@ -129995,13 +131412,13 @@ var init_initialize_types4 = __esm({
129995
131412
 
129996
131413
  // packages/magento/src/core/initialize.ts
129997
131414
  function withMagentoCapabilities(configuration, capabilities) {
129998
- return (cache, context2) => {
131415
+ return (cache3, context2) => {
129999
131416
  const client = {};
130000
131417
  const config3 = MagentoConfigurationSchema.parse(configuration);
130001
131418
  const caps = MagentoCapabilitiesSchema.parse(capabilities);
130002
131419
  const magentoApi = new MagentoClient(config3, context2);
130003
131420
  const buildCapabilityArgs = (factory) => ({
130004
- cache,
131421
+ cache: cache3,
130005
131422
  context: context2,
130006
131423
  config: config3,
130007
131424
  magentoApi,
@@ -130120,7 +131537,7 @@ function withMagentoCapabilities(configuration, capabilities) {
130120
131537
  args.magentoApi
130121
131538
  ),
130122
131539
  {
130123
- cache,
131540
+ cache: cache3,
130124
131541
  context: context2,
130125
131542
  config: config3,
130126
131543
  magentoApi
@@ -130225,7 +131642,7 @@ function withMagentoCapabilities(configuration, capabilities) {
130225
131642
  args.magentoApi
130226
131643
  ),
130227
131644
  {
130228
- cache,
131645
+ cache: cache3,
130229
131646
  context: context2,
130230
131647
  config: config3,
130231
131648
  magentoApi
@@ -130282,7 +131699,7 @@ var init_initialize4 = __esm({
130282
131699
  });
130283
131700
 
130284
131701
  // packages/magento/src/index.ts
130285
- var init_src5 = __esm({
131702
+ var init_src6 = __esm({
130286
131703
  "packages/magento/src/index.ts"() {
130287
131704
  "use strict";
130288
131705
  init_configuration_schema4();
@@ -137130,9 +138547,9 @@ var init_text_line_stream = __esm({
137130
138547
 
137131
138548
  // node_modules/.pnpm/fetch-event-stream@0.1.6/node_modules/fetch-event-stream/esm/utils.js
137132
138549
  function stream(input) {
137133
- let decoder = new TextDecoderStream();
138550
+ let decoder2 = new TextDecoderStream();
137134
138551
  let split2 = new TextLineStream({ allowCR: true });
137135
- return input.pipeThrough(decoder).pipeThrough(split2);
138552
+ return input.pipeThrough(decoder2).pipeThrough(split2);
137136
138553
  }
137137
138554
  function split(input) {
137138
138555
  let rgx = /[:]\s*/;
@@ -137446,14 +138863,14 @@ var require_object_inspect = __commonJS({
137446
138863
  var protoTag = obj instanceof Object ? "" : "null prototype";
137447
138864
  var stringTag = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
137448
138865
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
137449
- var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
138866
+ var tag2 = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
137450
138867
  if (ys2.length === 0) {
137451
- return tag + "{}";
138868
+ return tag2 + "{}";
137452
138869
  }
137453
138870
  if (indent) {
137454
- return tag + "{" + indentedJoin(ys2, indent) + "}";
138871
+ return tag2 + "{" + indentedJoin(ys2, indent) + "}";
137455
138872
  }
137456
- return tag + "{ " + $join.call(ys2, ", ") + " }";
138873
+ return tag2 + "{ " + $join.call(ys2, ", ") + " }";
137457
138874
  }
137458
138875
  return String(obj);
137459
138876
  };
@@ -139009,7 +140426,7 @@ var require_utils3 = __commonJS({
139009
140426
  return acc;
139010
140427
  }, target);
139011
140428
  };
139012
- var decode2 = function(str, defaultDecoder, charset) {
140429
+ var decode3 = function(str, defaultDecoder, charset) {
139013
140430
  var strWithoutPlus = str.replace(/\+/g, " ");
139014
140431
  if (charset === "iso-8859-1") {
139015
140432
  return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
@@ -139021,7 +140438,7 @@ var require_utils3 = __commonJS({
139021
140438
  }
139022
140439
  };
139023
140440
  var limit = 1024;
139024
- var encode2 = function encode3(str, defaultEncoder, charset, kind, format) {
140441
+ var encode3 = function encode4(str, defaultEncoder, charset, kind, format) {
139025
140442
  if (str.length === 0) {
139026
140443
  return str;
139027
140444
  }
@@ -139135,8 +140552,8 @@ var require_utils3 = __commonJS({
139135
140552
  assign,
139136
140553
  combine,
139137
140554
  compact,
139138
- decode: decode2,
139139
- encode: encode2,
140555
+ decode: decode3,
140556
+ encode: encode3,
139140
140557
  isBuffer,
139141
140558
  isOverflow,
139142
140559
  isRegExp,
@@ -139202,7 +140619,7 @@ var require_stringify = __commonJS({
139202
140619
  return typeof v4 === "string" || typeof v4 === "number" || typeof v4 === "boolean" || typeof v4 === "symbol" || typeof v4 === "bigint";
139203
140620
  };
139204
140621
  var sentinel = {};
139205
- var stringify2 = function stringify3(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
140622
+ var stringify2 = function stringify3(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder2, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
139206
140623
  var obj = object2;
139207
140624
  var tmpSc = sideChannel;
139208
140625
  var step = 0;
@@ -139235,14 +140652,14 @@ var require_stringify = __commonJS({
139235
140652
  }
139236
140653
  if (obj === null) {
139237
140654
  if (strictNullHandling) {
139238
- return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix);
140655
+ return formatter(encoder2 && !encodeValuesOnly ? encoder2(prefix, defaults.encoder, charset, "key", format) : prefix);
139239
140656
  }
139240
140657
  obj = "";
139241
140658
  }
139242
140659
  if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
139243
- if (encoder) {
139244
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format);
139245
- return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset, "value", format))];
140660
+ if (encoder2) {
140661
+ var keyValue = encodeValuesOnly ? prefix : encoder2(prefix, defaults.encoder, charset, "key", format);
140662
+ return [formatter(keyValue) + "=" + formatter(encoder2(obj, defaults.encoder, charset, "value", format))];
139246
140663
  }
139247
140664
  return [formatter(prefix) + "=" + formatter(String(obj))];
139248
140665
  }
@@ -139252,9 +140669,9 @@ var require_stringify = __commonJS({
139252
140669
  }
139253
140670
  var objKeys;
139254
140671
  if (generateArrayPrefix === "comma" && isArray(obj)) {
139255
- if (encodeValuesOnly && encoder) {
140672
+ if (encodeValuesOnly && encoder2) {
139256
140673
  obj = utils.maybeMap(obj, function(v4) {
139257
- return v4 == null ? v4 : encoder(v4);
140674
+ return v4 == null ? v4 : encoder2(v4);
139258
140675
  });
139259
140676
  }
139260
140677
  objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }];
@@ -139289,7 +140706,7 @@ var require_stringify = __commonJS({
139289
140706
  strictNullHandling,
139290
140707
  skipNulls,
139291
140708
  encodeDotInKeys,
139292
- generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder,
140709
+ generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder2,
139293
140710
  filter,
139294
140711
  sort,
139295
140712
  allowDots,
@@ -139939,8 +141356,8 @@ var init_client5 = __esm({
139939
141356
  return isJsonRequest ? yield resp.json() : resp;
139940
141357
  });
139941
141358
  FetchError = class extends Error {
139942
- constructor(message, statusText, status) {
139943
- super(message);
141359
+ constructor(message2, statusText, status) {
141360
+ super(message2);
139944
141361
  this.statusText = statusText;
139945
141362
  this.status = status;
139946
141363
  }
@@ -140188,9 +141605,9 @@ var init_client5 = __esm({
140188
141605
  return null;
140189
141606
  });
140190
141607
  }
140191
- throwError_(message) {
140192
- this.logger.error(message);
140193
- throw new Error(message);
141608
+ throwError_(message2) {
141609
+ this.logger.error(message2);
141610
+ throw new Error(message2);
140194
141611
  }
140195
141612
  };
140196
141613
  }
@@ -160554,7 +161971,7 @@ var init_client6 = __esm({
160554
161971
  "use strict";
160555
161972
  init_esm2();
160556
161973
  import_debug21 = __toESM(require_src(), 1);
160557
- init_src6();
161974
+ init_src7();
160558
161975
  debug21 = (0, import_debug21.default)("reactionary:medusa:client");
160559
161976
  SESSION_KEY2 = "MEDUSA_PROVIDER";
160560
161977
  RequestContextTokenStore2 = class {
@@ -160799,10 +162216,10 @@ var init_client6 = __esm({
160799
162216
  last_name: String(metadata["family_name"] ?? fallbackRest.join(" "))
160800
162217
  });
160801
162218
  } catch (error5) {
160802
- const message = error5 instanceof Error ? error5.message : String(error5);
160803
- if (/already has an account/i.test(message)) {
162219
+ const message2 = error5 instanceof Error ? error5.message : String(error5);
162220
+ if (/already has an account/i.test(message2)) {
160804
162221
  await client.client.clearToken();
160805
- return { type: "Conflict", message };
162222
+ return { type: "Conflict", message: message2 };
160806
162223
  }
160807
162224
  throw error5;
160808
162225
  }
@@ -160962,8 +162379,8 @@ var init_cart_capability5 = __esm({
160962
162379
  init_medusa_helpers();
160963
162380
  debug23 = (0, import_debug23.default)("reactionary:medusa:cart");
160964
162381
  MedusaCartCapability = class extends CartCapability {
160965
- constructor(config3, cache, context2, medusaApi, factory) {
160966
- super(cache, context2);
162382
+ constructor(config3, cache3, context2, medusaApi, factory) {
162383
+ super(cache3, context2);
160967
162384
  this.medusaApi = medusaApi;
160968
162385
  this.config = config3;
160969
162386
  this.factory = factory;
@@ -161652,8 +163069,8 @@ var init_category_capability5 = __esm({
161652
163069
  init_src();
161653
163070
  init_zod();
161654
163071
  MedusaCategoryCapability = class extends CategoryCapability {
161655
- constructor(config3, cache, context2, medusaApi, factory) {
161656
- super(cache, context2);
163072
+ constructor(config3, cache3, context2, medusaApi, factory) {
163073
+ super(cache3, context2);
161657
163074
  this.medusaApi = medusaApi;
161658
163075
  this.config = config3;
161659
163076
  this.factory = factory;
@@ -161836,8 +163253,8 @@ var init_checkout_capability5 = __esm({
161836
163253
  checkoutIdentifier;
161837
163254
  };
161838
163255
  MedusaCheckoutCapability = class extends CheckoutCapability {
161839
- constructor(config3, cache, context2, medusaApi, factory) {
161840
- super(cache, context2);
163256
+ constructor(config3, cache3, context2, medusaApi, factory) {
163257
+ super(cache3, context2);
161841
163258
  this.medusaApi = medusaApi;
161842
163259
  this.config = config3;
161843
163260
  this.factory = factory;
@@ -162340,8 +163757,8 @@ var init_company_capability3 = __esm({
162340
163757
  init_medusa_helpers();
162341
163758
  debug25 = (0, import_debug25.default)("reactionary:medusa:company");
162342
163759
  MedusaCompanyCapability = class extends CompanyCapability {
162343
- constructor(config3, cache, context2, medusaApi, factory) {
162344
- super(cache, context2);
163760
+ constructor(config3, cache3, context2, medusaApi, factory) {
163761
+ super(cache3, context2);
162345
163762
  this.medusaApi = medusaApi;
162346
163763
  this.config = config3;
162347
163764
  this.factory = factory;
@@ -162579,8 +163996,8 @@ var init_company_registration_capability3 = __esm({
162579
163996
  init_medusa_helpers();
162580
163997
  debug26 = (0, import_debug26.default)("reactionary:medusa:company-registration");
162581
163998
  MedusaCompanyRegistrationCapability = class extends CompanyRegistrationCapability {
162582
- constructor(config3, cache, context2, medusaApi, factory) {
162583
- super(cache, context2);
163999
+ constructor(config3, cache3, context2, medusaApi, factory) {
164000
+ super(cache3, context2);
162584
164001
  this.medusaApi = medusaApi;
162585
164002
  this.config = config3;
162586
164003
  this.factory = factory;
@@ -162683,8 +164100,8 @@ var init_employee_capability3 = __esm({
162683
164100
  debug27 = (0, import_debug27.default)("reactionary:medusa:employee");
162684
164101
  EMPLOYEE_FIELDS = ["*", "customer.*"].join(",");
162685
164102
  MedusaEmployeeCapability = class extends EmployeeCapability {
162686
- constructor(config3, cache, context2, medusaApi, factory) {
162687
- super(cache, context2);
164103
+ constructor(config3, cache3, context2, medusaApi, factory) {
164104
+ super(cache3, context2);
162688
164105
  this.medusaApi = medusaApi;
162689
164106
  this.config = config3;
162690
164107
  this.factory = factory;
@@ -163021,8 +164438,8 @@ var init_employee_invitation_capability3 = __esm({
163021
164438
  "validUntil"
163022
164439
  ].join(",");
163023
164440
  MedusaEmployeeInvitationCapability = class extends EmployeeInvitationCapability {
163024
- constructor(config3, cache, context2, medusaApi, factory) {
163025
- super(cache, context2);
164441
+ constructor(config3, cache3, context2, medusaApi, factory) {
164442
+ super(cache3, context2);
163026
164443
  this.medusaApi = medusaApi;
163027
164444
  this.config = config3;
163028
164445
  this.factory = factory;
@@ -163250,8 +164667,8 @@ var init_identity_capability5 = __esm({
163250
164667
  MedusaIdentityCapability = class extends IdentityCapability {
163251
164668
  config;
163252
164669
  medusaApi;
163253
- constructor(config3, cache, context2, medusaApi) {
163254
- super(cache, context2);
164670
+ constructor(config3, cache3, context2, medusaApi) {
164671
+ super(cache3, context2);
163255
164672
  this.config = config3;
163256
164673
  this.medusaApi = medusaApi;
163257
164674
  }
@@ -163435,8 +164852,8 @@ var init_inventory_capability5 = __esm({
163435
164852
  init_client6();
163436
164853
  debug30 = (0, import_debug30.default)("reactionary:medusa:inventory");
163437
164854
  MedusaInventoryCapability = class extends InventoryCapability {
163438
- constructor(config3, cache, context2, medusaApi, factory) {
163439
- super(cache, context2);
164855
+ constructor(config3, cache3, context2, medusaApi, factory) {
164856
+ super(cache3, context2);
163440
164857
  this.medusaApi = medusaApi;
163441
164858
  this.config = config3;
163442
164859
  this.factory = factory;
@@ -163520,8 +164937,8 @@ var init_order_search_capability5 = __esm({
163520
164937
  import_debug31 = __toESM(require_src(), 1);
163521
164938
  debug31 = (0, import_debug31.default)("reactionary:medusa:order-search");
163522
164939
  MedusaOrderSearchCapability = class extends OrderSearchCapability {
163523
- constructor(config3, cache, context2, medusaApi, factory) {
163524
- super(cache, context2);
164940
+ constructor(config3, cache3, context2, medusaApi, factory) {
164941
+ super(cache3, context2);
163525
164942
  this.medusaApi = medusaApi;
163526
164943
  this.config = config3;
163527
164944
  this.factory = factory;
@@ -163605,8 +165022,8 @@ var init_order_capability5 = __esm({
163605
165022
  init_medusa_helpers();
163606
165023
  debug32 = (0, import_debug32.default)("reactionary:medusa:order");
163607
165024
  MedusaOrderCapability = class extends OrderCapability {
163608
- constructor(config3, cache, context2, medusaApi, factory) {
163609
- super(cache, context2);
165025
+ constructor(config3, cache3, context2, medusaApi, factory) {
165026
+ super(cache3, context2);
163610
165027
  this.medusaApi = medusaApi;
163611
165028
  this.config = config3;
163612
165029
  this.factory = factory;
@@ -163650,8 +165067,8 @@ var init_price_capability5 = __esm({
163650
165067
  import_debug33 = __toESM(require_src(), 1);
163651
165068
  debug33 = (0, import_debug33.default)("reactionary:medusa:price");
163652
165069
  MedusaPriceCapability = class extends PriceCapability {
163653
- constructor(config3, cache, context2, medusaApi, factory) {
163654
- super(cache, context2);
165070
+ constructor(config3, cache3, context2, medusaApi, factory) {
165071
+ super(cache3, context2);
163655
165072
  this.medusaApi = medusaApi;
163656
165073
  this.config = config3;
163657
165074
  this.factory = factory;
@@ -163730,8 +165147,8 @@ var init_product_search_capability6 = __esm({
163730
165147
  import_debug34 = __toESM(require_src(), 1);
163731
165148
  debug34 = (0, import_debug34.default)("reactionary:medusa:search");
163732
165149
  MedusaProductSearchCapability = class extends ProductSearchCapability {
163733
- constructor(config3, cache, context2, medusaApi, factory) {
163734
- super(cache, context2);
165150
+ constructor(config3, cache3, context2, medusaApi, factory) {
165151
+ super(cache3, context2);
163735
165152
  this.medusaApi = medusaApi;
163736
165153
  this.config = config3;
163737
165154
  this.factory = factory;
@@ -163900,8 +165317,8 @@ var init_product_recommendations_capability4 = __esm({
163900
165317
  MedusaProductRecommendationsCapability = class extends ProductRecommendationsCapability {
163901
165318
  config;
163902
165319
  medusaApi;
163903
- constructor(config3, cache, context2, medusaApi) {
163904
- super(cache, context2);
165320
+ constructor(config3, cache3, context2, medusaApi) {
165321
+ super(cache3, context2);
163905
165322
  this.config = config3;
163906
165323
  this.medusaApi = medusaApi;
163907
165324
  }
@@ -164017,8 +165434,8 @@ var init_product_capability5 = __esm({
164017
165434
  import_debug36 = __toESM(require_src(), 1);
164018
165435
  debug36 = (0, import_debug36.default)("reactionary:medusa:product");
164019
165436
  MedusaProductCapability = class extends ProductCapability {
164020
- constructor(config3, cache, context2, medusaApi, factory) {
164021
- super(cache, context2);
165437
+ constructor(config3, cache3, context2, medusaApi, factory) {
165438
+ super(cache3, context2);
164022
165439
  this.medusaApi = medusaApi;
164023
165440
  this.config = config3;
164024
165441
  this.factory = factory;
@@ -164161,8 +165578,8 @@ var init_product_associations_capability5 = __esm({
164161
165578
  "+metadata",
164162
165579
  "+external_id"
164163
165580
  ];
164164
- constructor(config3, cache, context2, medusa, factory) {
164165
- super(cache, context2);
165581
+ constructor(config3, cache3, context2, medusa, factory) {
165582
+ super(cache3, context2);
164166
165583
  this.config = config3;
164167
165584
  this.medusa = medusa;
164168
165585
  this.factory = factory;
@@ -164264,8 +165681,8 @@ var init_profile_capability5 = __esm({
164264
165681
  import_debug37 = __toESM(require_src(), 1);
164265
165682
  debug37 = (0, import_debug37.default)("reactionary:medusa:profile");
164266
165683
  MedusaProfileCapability = class extends ProfileCapability {
164267
- constructor(config3, cache, context2, medusaApi, factory) {
164268
- super(cache, context2);
165684
+ constructor(config3, cache3, context2, medusaApi, factory) {
165685
+ super(cache3, context2);
164269
165686
  this.medusaApi = medusaApi;
164270
165687
  this.config = config3;
164271
165688
  this.factory = factory;
@@ -164531,8 +165948,8 @@ var init_personalization_profile_capability4 = __esm({
164531
165948
  init_client6();
164532
165949
  debug38 = (0, import_debug38.default)("reactionary:medusa:personalization-profile");
164533
165950
  MedusaPersonalizationProfileCapability = class extends PersonalizationProfileCapability {
164534
- constructor(config3, cache, context2, medusaApi, factory) {
164535
- super(cache, context2);
165951
+ constructor(config3, cache3, context2, medusaApi, factory) {
165952
+ super(cache3, context2);
164536
165953
  this.medusaApi = medusaApi;
164537
165954
  this.config = config3;
164538
165955
  this.factory = factory;
@@ -164609,8 +166026,8 @@ var init_store_capability4 = __esm({
164609
166026
  init_geo();
164610
166027
  debug39 = (0, import_debug39.default)("reactionary:medusa:store");
164611
166028
  MedusaStoreCapability = class extends StoreCapability {
164612
- constructor(config3, cache, context2, medusaApi, factory) {
164613
- super(cache, context2);
166029
+ constructor(config3, cache3, context2, medusaApi, factory) {
166030
+ super(cache3, context2);
164614
166031
  this.medusaApi = medusaApi;
164615
166032
  this.config = config3;
164616
166033
  this.factory = factory;
@@ -166446,13 +167863,13 @@ var init_initialize_types5 = __esm({
166446
167863
 
166447
167864
  // packages/medusa/src/core/initialize.ts
166448
167865
  function withMedusaCapabilities(configuration, capabilities) {
166449
- return (cache, context2) => {
167866
+ return (cache3, context2) => {
166450
167867
  const client = {};
166451
167868
  const config3 = MedusaConfigurationSchema.parse(configuration);
166452
167869
  const caps = MedusaCapabilitiesSchema.parse(capabilities);
166453
167870
  const medusaApi = new MedusaAPI(config3, context2);
166454
167871
  const buildCapabilityArgs = (factory) => ({
166455
- cache,
167872
+ cache: cache3,
166456
167873
  context: context2,
166457
167874
  config: config3,
166458
167875
  medusaApi,
@@ -166607,7 +168024,7 @@ function withMedusaCapabilities(configuration, capabilities) {
166607
168024
  args.medusaApi
166608
168025
  ),
166609
168026
  {
166610
- cache,
168027
+ cache: cache3,
166611
168028
  context: context2,
166612
168029
  config: config3,
166613
168030
  medusaApi
@@ -166676,7 +168093,7 @@ function withMedusaCapabilities(configuration, capabilities) {
166676
168093
  args.medusaApi
166677
168094
  ),
166678
168095
  {
166679
- cache,
168096
+ cache: cache3,
166680
168097
  context: context2,
166681
168098
  config: config3,
166682
168099
  medusaApi
@@ -166814,7 +168231,7 @@ var init_initialize5 = __esm({
166814
168231
  });
166815
168232
 
166816
168233
  // packages/medusa/src/index.ts
166817
- var init_src6 = __esm({
168234
+ var init_src7 = __esm({
166818
168235
  "packages/medusa/src/index.ts"() {
166819
168236
  "use strict";
166820
168237
  init_configuration_schema5();
@@ -168022,8 +169439,8 @@ var init_product_search_capability7 = __esm({
168022
169439
  MeilisearchProductSearchCapability = class extends ProductSearchCapability {
168023
169440
  config;
168024
169441
  factory;
168025
- constructor(config3, cache, context2, factory) {
168026
- super(cache, context2);
169442
+ constructor(config3, cache3, context2, factory) {
169443
+ super(cache3, context2);
168027
169444
  this.config = config3;
168028
169445
  this.factory = factory;
168029
169446
  }
@@ -168233,8 +169650,8 @@ var init_product_recommendations_capability5 = __esm({
168233
169650
  init_index_utils2();
168234
169651
  MeilisearchProductRecommendationsCapability = class extends ProductRecommendationsCapability {
168235
169652
  config;
168236
- constructor(config3, cache, context2) {
168237
- super(cache, context2);
169653
+ constructor(config3, cache3, context2) {
169654
+ super(cache3, context2);
168238
169655
  this.config = config3;
168239
169656
  }
168240
169657
  getSimilarProductsRecommendationsPayload(query) {
@@ -168324,8 +169741,8 @@ var init_order_search_capability6 = __esm({
168324
169741
  MeilisearchOrderSearchCapability = class extends OrderSearchCapability {
168325
169742
  config;
168326
169743
  factory;
168327
- constructor(config3, cache, context2, factory) {
168328
- super(cache, context2);
169744
+ constructor(config3, cache3, context2, factory) {
169745
+ super(cache3, context2);
168329
169746
  this.config = config3;
168330
169747
  this.factory = factory;
168331
169748
  }
@@ -168546,7 +169963,7 @@ var init_initialize_types6 = __esm({
168546
169963
 
168547
169964
  // packages/meilisearch/src/core/initialize.ts
168548
169965
  function withMeilisearchCapabilities(configuration, capabilities) {
168549
- return (cache, context2) => {
169966
+ return (cache3, context2) => {
168550
169967
  const client = {};
168551
169968
  const caps = MeilisearchCapabilitiesSchema.parse(capabilities);
168552
169969
  if (caps.productSearch?.enabled) {
@@ -168562,7 +169979,7 @@ function withMeilisearchCapabilities(configuration, capabilities) {
168562
169979
  )
168563
169980
  },
168564
169981
  (factory) => ({
168565
- cache,
169982
+ cache: cache3,
168566
169983
  context: context2,
168567
169984
  config: configuration,
168568
169985
  factory
@@ -168582,7 +169999,7 @@ function withMeilisearchCapabilities(configuration, capabilities) {
168582
169999
  )
168583
170000
  },
168584
170001
  (factory) => ({
168585
- cache,
170002
+ cache: cache3,
168586
170003
  context: context2,
168587
170004
  config: configuration,
168588
170005
  factory
@@ -168598,7 +170015,7 @@ function withMeilisearchCapabilities(configuration, capabilities) {
168598
170015
  args.context
168599
170016
  ),
168600
170017
  {
168601
- cache,
170018
+ cache: cache3,
168602
170019
  context: context2,
168603
170020
  config: configuration
168604
170021
  }
@@ -168649,7 +170066,7 @@ var init_configuration_schema6 = __esm({
168649
170066
  });
168650
170067
 
168651
170068
  // packages/meilisearch/src/index.ts
168652
- var init_src7 = __esm({
170069
+ var init_src8 = __esm({
168653
170070
  "packages/meilisearch/src/index.ts"() {
168654
170071
  "use strict";
168655
170072
  init_initialize6();
@@ -168742,14 +170159,14 @@ var require_main = __commonJS({
168742
170159
  }
168743
170160
  return DotenvModule.parse(decrypted);
168744
170161
  }
168745
- function _warn(message) {
168746
- console.error(`\u26A0 ${message}`);
170162
+ function _warn(message2) {
170163
+ console.error(`\u26A0 ${message2}`);
168747
170164
  }
168748
- function _debug(message) {
168749
- console.log(`\u2506 ${message}`);
170165
+ function _debug(message2) {
170166
+ console.log(`\u2506 ${message2}`);
168750
170167
  }
168751
- function _log(message) {
168752
- console.log(`\u25C7 ${message}`);
170168
+ function _log(message2) {
170169
+ console.log(`\u25C7 ${message2}`);
168753
170170
  }
168754
170171
  function _dotenvKey(options) {
168755
170172
  if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
@@ -169229,12 +170646,12 @@ var init_env_client_builder = __esm({
169229
170646
  "packages/feeds/src/lib/env-client-builder.ts"() {
169230
170647
  "use strict";
169231
170648
  init_src2();
169232
- init_src3();
169233
- init_src();
169234
170649
  init_src4();
170650
+ init_src();
169235
170651
  init_src5();
169236
170652
  init_src6();
169237
170653
  init_src7();
170654
+ init_src8();
169238
170655
  init_load_cwd_env();
169239
170656
  providerSystems = [
169240
170657
  "FAKE",
@@ -169256,8 +170673,8 @@ var CommanderError = class extends Error {
169256
170673
  * @param {string} code an id string representing the error
169257
170674
  * @param {string} message human-readable description of the error
169258
170675
  */
169259
- constructor(exitCode, code, message) {
169260
- super(message);
170676
+ constructor(exitCode, code, message2) {
170677
+ super(message2);
169261
170678
  Error.captureStackTrace(this, this.constructor);
169262
170679
  this.name = this.constructor.name;
169263
170680
  this.code = code;
@@ -169270,8 +170687,8 @@ var InvalidArgumentError = class extends CommanderError {
169270
170687
  * Constructs the InvalidArgumentError class
169271
170688
  * @param {string} [message] explanation of why argument is invalid
169272
170689
  */
169273
- constructor(message) {
169274
- super(1, "commander.invalidArgument", message);
170690
+ constructor(message2) {
170691
+ super(1, "commander.invalidArgument", message2);
169275
170692
  Error.captureStackTrace(this, this.constructor);
169276
170693
  this.name = this.constructor.name;
169277
170694
  }
@@ -170817,9 +172234,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
170817
172234
  * @return never
170818
172235
  * @private
170819
172236
  */
170820
- _exit(exitCode, code, message) {
172237
+ _exit(exitCode, code, message2) {
170821
172238
  if (this._exitCallback) {
170822
- this._exitCallback(new CommanderError(exitCode, code, message));
172239
+ this._exitCallback(new CommanderError(exitCode, code, message2));
170823
172240
  }
170824
172241
  import_node_process.default.exit(exitCode);
170825
172242
  }
@@ -170879,8 +172296,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
170879
172296
  return target.parseArg(value, previous);
170880
172297
  } catch (err) {
170881
172298
  if (err.code === "commander.invalidArgument") {
170882
- const message = `${invalidArgumentMessage} ${err.message}`;
170883
- this.error(message, { exitCode: err.exitCode, code: err.code });
172299
+ const message2 = `${invalidArgumentMessage} ${err.message}`;
172300
+ this.error(message2, { exitCode: err.exitCode, code: err.code });
170884
172301
  }
170885
172302
  throw err;
170886
172303
  }
@@ -171958,9 +173375,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
171958
173375
  * @param {string} [errorOptions.code] - an id string representing the error
171959
173376
  * @param {number} [errorOptions.exitCode] - used with process.exit
171960
173377
  */
171961
- error(message, errorOptions) {
173378
+ error(message2, errorOptions) {
171962
173379
  this._outputConfiguration.outputError(
171963
- `${message}
173380
+ `${message2}
171964
173381
  `,
171965
173382
  this._outputConfiguration.writeErr
171966
173383
  );
@@ -171974,7 +173391,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
171974
173391
  const config3 = errorOptions || {};
171975
173392
  const exitCode = config3.exitCode || 1;
171976
173393
  const code = config3.code || "commander.error";
171977
- this._exit(exitCode, code, message);
173394
+ this._exit(exitCode, code, message2);
171978
173395
  }
171979
173396
  /**
171980
173397
  * Apply any option related environment variables, if option does
@@ -172030,8 +173447,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
172030
173447
  * @private
172031
173448
  */
172032
173449
  missingArgument(name) {
172033
- const message = `error: missing required argument '${name}'`;
172034
- this.error(message, { code: "commander.missingArgument" });
173450
+ const message2 = `error: missing required argument '${name}'`;
173451
+ this.error(message2, { code: "commander.missingArgument" });
172035
173452
  }
172036
173453
  /**
172037
173454
  * `Option` is missing an argument.
@@ -172040,8 +173457,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
172040
173457
  * @private
172041
173458
  */
172042
173459
  optionMissingArgument(option) {
172043
- const message = `error: option '${option.flags}' argument missing`;
172044
- this.error(message, { code: "commander.optionMissingArgument" });
173460
+ const message2 = `error: option '${option.flags}' argument missing`;
173461
+ this.error(message2, { code: "commander.optionMissingArgument" });
172045
173462
  }
172046
173463
  /**
172047
173464
  * `Option` does not have a value, and is a mandatory option.
@@ -172050,8 +173467,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
172050
173467
  * @private
172051
173468
  */
172052
173469
  missingMandatoryOptionValue(option) {
172053
- const message = `error: required option '${option.flags}' not specified`;
172054
- this.error(message, { code: "commander.missingMandatoryOptionValue" });
173470
+ const message2 = `error: required option '${option.flags}' not specified`;
173471
+ this.error(message2, { code: "commander.missingMandatoryOptionValue" });
172055
173472
  }
172056
173473
  /**
172057
173474
  * `Option` conflicts with another option.
@@ -172084,8 +173501,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
172084
173501
  }
172085
173502
  return `option '${bestOption.flags}'`;
172086
173503
  };
172087
- const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;
172088
- this.error(message, { code: "commander.conflictingOption" });
173504
+ const message2 = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;
173505
+ this.error(message2, { code: "commander.conflictingOption" });
172089
173506
  }
172090
173507
  /**
172091
173508
  * Unknown option `flag`.
@@ -172106,8 +173523,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
172106
173523
  } while (command && !command._enablePositionalOptions);
172107
173524
  suggestion = suggestSimilar(flag, candidateFlags);
172108
173525
  }
172109
- const message = `error: unknown option '${flag}'${suggestion}`;
172110
- this.error(message, { code: "commander.unknownOption" });
173526
+ const message2 = `error: unknown option '${flag}'${suggestion}`;
173527
+ this.error(message2, { code: "commander.unknownOption" });
172111
173528
  }
172112
173529
  /**
172113
173530
  * Excess arguments, more than expected.
@@ -172122,8 +173539,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
172122
173539
  const received = receivedArgs.length;
172123
173540
  const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
172124
173541
  const details = receivedArgs.join(", ");
172125
- const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s3} but got ${received}: ${details}.`;
172126
- this.error(message, { code: "commander.excessArguments" });
173542
+ const message2 = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s3} but got ${received}: ${details}.`;
173543
+ this.error(message2, { code: "commander.excessArguments" });
172127
173544
  }
172128
173545
  /**
172129
173546
  * Unknown command.
@@ -172141,8 +173558,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
172141
173558
  });
172142
173559
  suggestion = suggestSimilar(unknownName, candidateNames);
172143
173560
  }
172144
- const message = `error: unknown command '${unknownName}'${suggestion}`;
172145
- this.error(message, { code: "commander.unknownCommand" });
173561
+ const message2 = `error: unknown command '${unknownName}'${suggestion}`;
173562
+ this.error(message2, { code: "commander.unknownCommand" });
172146
173563
  }
172147
173564
  /**
172148
173565
  * Get or set the program version.
@@ -173451,15 +174868,15 @@ var import_node_stream = require("node:stream");
173451
174868
 
173452
174869
  // node_modules/.pnpm/sitemap@9.0.1/node_modules/sitemap/dist/esm/lib/errors.js
173453
174870
  var NoURLError = class _NoURLError extends Error {
173454
- constructor(message) {
173455
- super(message || "URL is required");
174871
+ constructor(message2) {
174872
+ super(message2 || "URL is required");
173456
174873
  this.name = "NoURLError";
173457
174874
  Error.captureStackTrace(this, _NoURLError);
173458
174875
  }
173459
174876
  };
173460
174877
  var NoConfigError = class _NoConfigError extends Error {
173461
- constructor(message) {
173462
- super(message || "SitemapItem requires a configuration");
174878
+ constructor(message2) {
174879
+ super(message2 || "SitemapItem requires a configuration");
173463
174880
  this.name = "NoConfigError";
173464
174881
  Error.captureStackTrace(this, _NoConfigError);
173465
174882
  }
@@ -173494,8 +174911,8 @@ var InvalidVideoDuration = class _InvalidVideoDuration extends Error {
173494
174911
  };
173495
174912
  var InvalidVideoDescription = class _InvalidVideoDescription extends Error {
173496
174913
  constructor(url2, length) {
173497
- const message = `${url2}: video description is too long ${length} vs limit of 2048 characters.`;
173498
- super(message);
174914
+ const message2 = `${url2}: video description is too long ${length} vs limit of 2048 characters.`;
174915
+ super(message2);
173499
174916
  this.name = "InvalidVideoDescription";
173500
174917
  Error.captureStackTrace(this, _InvalidVideoDescription);
173501
174918
  }
@@ -173854,8 +175271,8 @@ var SitemapItemStream = class extends import_node_stream.Transform {
173854
175271
  this.push(element(TagNames["video:publication_date"], video.publication_date));
173855
175272
  }
173856
175273
  if (video.tag && video.tag.length > 0) {
173857
- for (const tag of video.tag) {
173858
- this.push(element(TagNames["video:tag"], tag));
175274
+ for (const tag2 of video.tag) {
175275
+ this.push(element(TagNames["video:tag"], tag2));
173859
175276
  }
173860
175277
  }
173861
175278
  if (video.category) {