@cerefox/memory 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7184,7 +7184,7 @@ var exports_meta = {};
7184
7184
  __export(exports_meta, {
7185
7185
  PKG_VERSION: () => PKG_VERSION
7186
7186
  });
7187
- var PKG_VERSION = "1.0.0";
7187
+ var PKG_VERSION = "1.0.1";
7188
7188
  var init_meta = () => {};
7189
7189
 
7190
7190
  // ../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.js
@@ -7792,7 +7792,7 @@ var require_tslib = __commonJS((exports, module) => {
7792
7792
  });
7793
7793
  });
7794
7794
 
7795
- // ../../node_modules/.bun/@supabase+functions-js@2.110.2/node_modules/@supabase/functions-js/dist/main/helper.js
7795
+ // ../../node_modules/.bun/@supabase+functions-js@2.111.0/node_modules/@supabase/functions-js/dist/main/helper.js
7796
7796
  var require_helper = __commonJS((exports) => {
7797
7797
  Object.defineProperty(exports, "__esModule", { value: true });
7798
7798
  exports.resolveFetch = undefined;
@@ -7805,7 +7805,7 @@ var require_helper = __commonJS((exports) => {
7805
7805
  exports.resolveFetch = resolveFetch;
7806
7806
  });
7807
7807
 
7808
- // ../../node_modules/.bun/@supabase+functions-js@2.110.2/node_modules/@supabase/functions-js/dist/main/types.js
7808
+ // ../../node_modules/.bun/@supabase+functions-js@2.111.0/node_modules/@supabase/functions-js/dist/main/types.js
7809
7809
  var require_types = __commonJS((exports) => {
7810
7810
  Object.defineProperty(exports, "__esModule", { value: true });
7811
7811
  exports.FunctionRegion = exports.FunctionsHttpError = exports.FunctionsRelayError = exports.FunctionsFetchError = exports.FunctionsError = undefined;
@@ -7866,7 +7866,7 @@ var require_types = __commonJS((exports) => {
7866
7866
  })(FunctionRegion || (exports.FunctionRegion = FunctionRegion = {}));
7867
7867
  });
7868
7868
 
7869
- // ../../node_modules/.bun/@supabase+functions-js@2.110.2/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js
7869
+ // ../../node_modules/.bun/@supabase+functions-js@2.111.0/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js
7870
7870
  var require_FunctionsClient = __commonJS((exports) => {
7871
7871
  Object.defineProperty(exports, "__esModule", { value: true });
7872
7872
  exports.FunctionsClient = undefined;
@@ -7886,9 +7886,10 @@ var require_FunctionsClient = __commonJS((exports) => {
7886
7886
  }
7887
7887
  invoke(functionName_1) {
7888
7888
  return tslib_1.__awaiter(this, arguments, undefined, function* (functionName, options = {}) {
7889
- var _a;
7889
+ var _a, _b;
7890
7890
  let timeoutId;
7891
7891
  let timeoutController;
7892
+ let onAbort;
7892
7893
  try {
7893
7894
  const { headers, method, body: functionArgs, signal, timeout } = options;
7894
7895
  let _headers = {};
@@ -7929,7 +7930,8 @@ var require_FunctionsClient = __commonJS((exports) => {
7929
7930
  timeoutId = setTimeout(() => timeoutController.abort(), timeout);
7930
7931
  if (signal) {
7931
7932
  effectiveSignal = timeoutController.signal;
7932
- signal.addEventListener("abort", () => timeoutController.abort());
7933
+ onAbort = () => timeoutController.abort();
7934
+ signal.addEventListener("abort", onAbort);
7933
7935
  } else {
7934
7936
  effectiveSignal = timeoutController.signal;
7935
7937
  }
@@ -7949,7 +7951,7 @@ var require_FunctionsClient = __commonJS((exports) => {
7949
7951
  if (!response.ok) {
7950
7952
  throw new types_1.FunctionsHttpError(response);
7951
7953
  }
7952
- let responseType = ((_a = response.headers.get("Content-Type")) !== null && _a !== undefined ? _a : "text/plain").split(";")[0].trim();
7954
+ let responseType = ((_a = response.headers.get("Content-Type")) !== null && _a !== undefined ? _a : "text/plain").split(";")[0].trim().toLowerCase();
7953
7955
  let data;
7954
7956
  if (responseType === "application/json") {
7955
7957
  data = yield response.json();
@@ -7973,6 +7975,9 @@ var require_FunctionsClient = __commonJS((exports) => {
7973
7975
  if (timeoutId) {
7974
7976
  clearTimeout(timeoutId);
7975
7977
  }
7978
+ if (onAbort) {
7979
+ (_b = options.signal) === null || _b === undefined || _b.removeEventListener("abort", onAbort);
7980
+ }
7976
7981
  }
7977
7982
  });
7978
7983
  }
@@ -7980,7 +7985,7 @@ var require_FunctionsClient = __commonJS((exports) => {
7980
7985
  exports.FunctionsClient = FunctionsClient;
7981
7986
  });
7982
7987
 
7983
- // ../../node_modules/.bun/@supabase+functions-js@2.110.2/node_modules/@supabase/functions-js/dist/main/index.js
7988
+ // ../../node_modules/.bun/@supabase+functions-js@2.111.0/node_modules/@supabase/functions-js/dist/main/index.js
7984
7989
  var require_main = __commonJS((exports) => {
7985
7990
  Object.defineProperty(exports, "__esModule", { value: true });
7986
7991
  exports.FunctionRegion = exports.FunctionsRelayError = exports.FunctionsHttpError = exports.FunctionsFetchError = exports.FunctionsError = exports.FunctionsClient = undefined;
@@ -8006,7 +8011,7 @@ var require_main = __commonJS((exports) => {
8006
8011
  } });
8007
8012
  });
8008
8013
 
8009
- // ../../node_modules/.bun/@supabase+postgrest-js@2.110.2/node_modules/@supabase/postgrest-js/dist/index.mjs
8014
+ // ../../node_modules/.bun/@supabase+postgrest-js@2.111.0/node_modules/@supabase/postgrest-js/dist/index.mjs
8010
8015
  function sleep(ms, signal) {
8011
8016
  return new Promise((resolve) => {
8012
8017
  if (signal === null || signal === undefined ? undefined : signal.aborted) {
@@ -8817,7 +8822,7 @@ var init_dist = __esm(() => {
8817
8822
  };
8818
8823
  });
8819
8824
 
8820
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js
8825
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js
8821
8826
  var require_websocket_factory = __commonJS((exports) => {
8822
8827
  Object.defineProperty(exports, "__esModule", { value: true });
8823
8828
  exports.WebSocketFactory = undefined;
@@ -8894,14 +8899,14 @@ Suggested solution: ${env.workaround}`;
8894
8899
  exports.default = WebSocketFactory;
8895
8900
  });
8896
8901
 
8897
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/version.js
8902
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/lib/version.js
8898
8903
  var require_version = __commonJS((exports) => {
8899
8904
  Object.defineProperty(exports, "__esModule", { value: true });
8900
8905
  exports.version = undefined;
8901
- exports.version = "2.110.2";
8906
+ exports.version = "2.111.0";
8902
8907
  });
8903
8908
 
8904
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/constants.js
8909
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/lib/constants.js
8905
8910
  var require_constants = __commonJS((exports) => {
8906
8911
  Object.defineProperty(exports, "__esModule", { value: true });
8907
8912
  exports.CONNECTION_STATE = exports.TRANSPORTS = exports.CHANNEL_EVENTS = exports.CHANNEL_STATES = exports.SOCKET_STATES = exports.MAX_PUSH_BUFFER_SIZE = exports.WS_CLOSE_NORMAL = exports.DEFAULT_TIMEOUT = exports.VERSION = exports.DEFAULT_VSN = exports.VSN_2_0_0 = exports.VSN_1_0_0 = exports.DEFAULT_VERSION = undefined;
@@ -8946,7 +8951,7 @@ var require_constants = __commonJS((exports) => {
8946
8951
  };
8947
8952
  });
8948
8953
 
8949
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js
8954
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js
8950
8955
  var require_serializer = __commonJS((exports) => {
8951
8956
  Object.defineProperty(exports, "__esModule", { value: true });
8952
8957
 
@@ -8990,12 +8995,13 @@ var require_serializer = __commonJS((exports) => {
8990
8995
  }
8991
8996
  _encodeUserBroadcastPush(message, encodingType, encodedPayload) {
8992
8997
  var _a, _b;
8993
- const topic = message.topic;
8994
- const ref = (_a = message.ref) !== null && _a !== undefined ? _a : "";
8995
- const joinRef = (_b = message.join_ref) !== null && _b !== undefined ? _b : "";
8996
- const userEvent = message.payload.event;
8998
+ const encoder = new TextEncoder;
8999
+ const topic = encoder.encode(message.topic);
9000
+ const ref = encoder.encode((_a = message.ref) !== null && _a !== undefined ? _a : "");
9001
+ const joinRef = encoder.encode((_b = message.join_ref) !== null && _b !== undefined ? _b : "");
9002
+ const userEvent = encoder.encode(message.payload.event);
8997
9003
  const rest = this.allowedMetadataKeys ? this._pick(message.payload, this.allowedMetadataKeys) : {};
8998
- const metadata = Object.keys(rest).length === 0 ? "" : JSON.stringify(rest);
9004
+ const metadata = encoder.encode(Object.keys(rest).length === 0 ? "" : JSON.stringify(rest));
8999
9005
  if (joinRef.length > 255) {
9000
9006
  throw new Error(`joinRef length ${joinRef.length} exceeds maximum of 255`);
9001
9007
  }
@@ -9013,7 +9019,8 @@ var require_serializer = __commonJS((exports) => {
9013
9019
  }
9014
9020
  const metaLength = this.USER_BROADCAST_PUSH_META_LENGTH + joinRef.length + ref.length + topic.length + userEvent.length + metadata.length;
9015
9021
  const header = new ArrayBuffer(this.HEADER_LENGTH + metaLength);
9016
- let view = new DataView(header);
9022
+ const view = new DataView(header);
9023
+ const bytes = new Uint8Array(header);
9017
9024
  let offset = 0;
9018
9025
  view.setUint8(offset++, this.KINDS.userBroadcastPush);
9019
9026
  view.setUint8(offset++, joinRef.length);
@@ -9022,11 +9029,16 @@ var require_serializer = __commonJS((exports) => {
9022
9029
  view.setUint8(offset++, userEvent.length);
9023
9030
  view.setUint8(offset++, metadata.length);
9024
9031
  view.setUint8(offset++, encodingType);
9025
- Array.from(joinRef, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9026
- Array.from(ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9027
- Array.from(topic, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9028
- Array.from(userEvent, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9029
- Array.from(metadata, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9032
+ bytes.set(joinRef, offset);
9033
+ offset += joinRef.length;
9034
+ bytes.set(ref, offset);
9035
+ offset += ref.length;
9036
+ bytes.set(topic, offset);
9037
+ offset += topic.length;
9038
+ bytes.set(userEvent, offset);
9039
+ offset += userEvent.length;
9040
+ bytes.set(metadata, offset);
9041
+ offset += metadata.length;
9030
9042
  var combined = new Uint8Array(header.byteLength + encodedPayload.byteLength);
9031
9043
  combined.set(new Uint8Array(header), 0);
9032
9044
  combined.set(new Uint8Array(encodedPayload), header.byteLength);
@@ -9091,7 +9103,7 @@ var require_serializer = __commonJS((exports) => {
9091
9103
  exports.default = Serializer;
9092
9104
  });
9093
9105
 
9094
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js
9106
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js
9095
9107
  var require_transformers = __commonJS((exports) => {
9096
9108
  Object.defineProperty(exports, "__esModule", { value: true });
9097
9109
  exports.httpEndpointURL = exports.toTimestampString = exports.toArray = exports.toJson = exports.toNumber = exports.toBoolean = exports.convertCell = exports.convertColumn = exports.convertChangeData = exports.PostgresTypes = undefined;
@@ -9260,7 +9272,7 @@ var require_transformers = __commonJS((exports) => {
9260
9272
  exports.httpEndpointURL = httpEndpointURL;
9261
9273
  });
9262
9274
 
9263
- // ../../node_modules/.bun/@supabase+phoenix@0.4.4/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js
9275
+ // ../../node_modules/.bun/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js
9264
9276
  var require_phoenix_cjs = __commonJS((exports, module) => {
9265
9277
  var __defProp2 = Object.defineProperty;
9266
9278
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -9306,6 +9318,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9306
9318
  var DEFAULT_VSN = "2.0.0";
9307
9319
  var DEFAULT_TIMEOUT = 1e4;
9308
9320
  var WS_CLOSE_NORMAL = 1000;
9321
+ var MAX_LONGPOLL_BATCH_SIZE = 100;
9309
9322
  var SOCKET_STATES = { connecting: 0, open: 1, closing: 2, closed: 3 };
9310
9323
  var CHANNEL_STATES = {
9311
9324
  closed: "closed",
@@ -9848,17 +9861,23 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9848
9861
  }, 0);
9849
9862
  }
9850
9863
  }
9851
- batchSend(messages) {
9864
+ batchSend(messages, offset = 0) {
9852
9865
  this.awaitingBatchAck = true;
9853
- this.ajax("POST", { "Content-Type": "application/x-ndjson" }, messages.join(`
9866
+ const next = offset + MAX_LONGPOLL_BATCH_SIZE;
9867
+ const batch = messages.slice(offset, next);
9868
+ this.ajax("POST", { "Content-Type": "application/x-ndjson" }, batch.join(`
9854
9869
  `), () => this.onerror("timeout"), (resp) => {
9855
- this.awaitingBatchAck = false;
9856
9870
  if (!resp || resp.status !== 200) {
9871
+ this.awaitingBatchAck = false;
9857
9872
  this.onerror(resp && resp.status);
9858
9873
  this.closeAndRetry(1011, "internal server error", false);
9874
+ } else if (next < messages.length) {
9875
+ this.batchSend(messages, next);
9859
9876
  } else if (this.batchBuffer.length > 0) {
9860
9877
  this.batchSend(this.batchBuffer);
9861
9878
  this.batchBuffer = [];
9879
+ } else {
9880
+ this.awaitingBatchAck = false;
9862
9881
  }
9863
9882
  });
9864
9883
  }
@@ -9895,7 +9914,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9895
9914
  var Presence = class _Presence {
9896
9915
  constructor(channel, opts = {}) {
9897
9916
  let events = opts.events || { state: "presence_state", diff: "presence_diff" };
9898
- this.state = {};
9917
+ this.state = /* @__PURE__ */ Object.create(null);
9899
9918
  this.pendingDiffs = [];
9900
9919
  this.channel = channel;
9901
9920
  this.joinRef = null;
@@ -9940,9 +9959,10 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9940
9959
  return !this.joinRef || this.joinRef !== this.channel.joinRef();
9941
9960
  }
9942
9961
  static syncState(currentState, newState, onJoin, onLeave) {
9943
- let state = this.clone(currentState);
9944
- let joins = {};
9945
- let leaves = {};
9962
+ let state = this.toNullProtoObj(this.clone(currentState));
9963
+ newState = this.toNullProtoObj(newState);
9964
+ let joins = /* @__PURE__ */ Object.create(null);
9965
+ let leaves = /* @__PURE__ */ Object.create(null);
9946
9966
  this.map(state, (key, presence) => {
9947
9967
  if (!newState[key]) {
9948
9968
  leaves[key] = presence;
@@ -9970,6 +9990,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9970
9990
  return this.syncDiff(state, { joins, leaves }, onJoin, onLeave);
9971
9991
  }
9972
9992
  static syncDiff(state, diff, onJoin, onLeave) {
9993
+ state = this.toNullProtoObj(state);
9973
9994
  let { joins, leaves } = this.clone(diff);
9974
9995
  if (!onJoin) {
9975
9996
  onJoin = function() {};
@@ -10016,6 +10037,16 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10016
10037
  static map(obj2, func) {
10017
10038
  return Object.getOwnPropertyNames(obj2).map((key) => func(key, obj2[key]));
10018
10039
  }
10040
+ static toNullProtoObj(obj2) {
10041
+ if (Object.getPrototypeOf(obj2) === null) {
10042
+ return obj2;
10043
+ }
10044
+ let cleaned = /* @__PURE__ */ Object.create(null);
10045
+ Object.getOwnPropertyNames(obj2).forEach((key) => {
10046
+ cleaned[key] = obj2[key];
10047
+ });
10048
+ return cleaned;
10049
+ }
10019
10050
  static clone(obj2) {
10020
10051
  return JSON.parse(JSON.stringify(obj2));
10021
10052
  }
@@ -10042,24 +10073,43 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10042
10073
  },
10043
10074
  binaryEncode(message) {
10044
10075
  let { join_ref, ref, event, topic, payload } = message;
10045
- let metaLength = this.META_LENGTH + join_ref.length + ref.length + topic.length + event.length;
10076
+ let encoder = new TextEncoder;
10077
+ let joinRefBytes = encoder.encode(join_ref);
10078
+ let refBytes = encoder.encode(ref);
10079
+ let topicBytes = encoder.encode(topic);
10080
+ let eventBytes = encoder.encode(event);
10081
+ this.assertFieldSize(joinRefBytes.byteLength, "join_ref");
10082
+ this.assertFieldSize(refBytes.byteLength, "ref");
10083
+ this.assertFieldSize(topicBytes.byteLength, "topic");
10084
+ this.assertFieldSize(eventBytes.byteLength, "event");
10085
+ let metaLength = this.META_LENGTH + joinRefBytes.byteLength + refBytes.byteLength + topicBytes.byteLength + eventBytes.byteLength;
10046
10086
  let header = new ArrayBuffer(this.HEADER_LENGTH + metaLength);
10087
+ let headerBytes = new Uint8Array(header);
10047
10088
  let view = new DataView(header);
10048
10089
  let offset = 0;
10049
10090
  view.setUint8(offset++, this.KINDS.push);
10050
- view.setUint8(offset++, join_ref.length);
10051
- view.setUint8(offset++, ref.length);
10052
- view.setUint8(offset++, topic.length);
10053
- view.setUint8(offset++, event.length);
10054
- Array.from(join_ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
10055
- Array.from(ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
10056
- Array.from(topic, (char) => view.setUint8(offset++, char.charCodeAt(0)));
10057
- Array.from(event, (char) => view.setUint8(offset++, char.charCodeAt(0)));
10091
+ view.setUint8(offset++, joinRefBytes.byteLength);
10092
+ view.setUint8(offset++, refBytes.byteLength);
10093
+ view.setUint8(offset++, topicBytes.byteLength);
10094
+ view.setUint8(offset++, eventBytes.byteLength);
10095
+ headerBytes.set(joinRefBytes, offset);
10096
+ offset += joinRefBytes.byteLength;
10097
+ headerBytes.set(refBytes, offset);
10098
+ offset += refBytes.byteLength;
10099
+ headerBytes.set(topicBytes, offset);
10100
+ offset += topicBytes.byteLength;
10101
+ headerBytes.set(eventBytes, offset);
10102
+ offset += eventBytes.byteLength;
10058
10103
  var combined = new Uint8Array(header.byteLength + payload.byteLength);
10059
- combined.set(new Uint8Array(header), 0);
10104
+ combined.set(headerBytes, 0);
10060
10105
  combined.set(new Uint8Array(payload), header.byteLength);
10061
10106
  return combined.buffer;
10062
10107
  },
10108
+ assertFieldSize(size, name) {
10109
+ if (size > 255) {
10110
+ throw new Error(`unable to convert ${name} to binary: must be less than or equal to 255 bytes, but is ${size} bytes`);
10111
+ }
10112
+ },
10063
10113
  binaryDecode(buffer) {
10064
10114
  let view = new DataView(buffer);
10065
10115
  let kind = view.getUint8(0);
@@ -10220,7 +10270,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10220
10270
  this.connect();
10221
10271
  });
10222
10272
  }, this.reconnectAfterMs);
10223
- this.authToken = opts.authToken;
10273
+ this.authToken = opts.authToken && closure(opts.authToken);
10224
10274
  }
10225
10275
  getLongPollTransport() {
10226
10276
  return LongPoll;
@@ -10331,7 +10381,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10331
10381
  this.closeWasClean = false;
10332
10382
  let protocols = undefined;
10333
10383
  if (this.authToken) {
10334
- protocols = ["phoenix", `${AUTH_TOKEN_PREFIX}${btoa(this.authToken).replace(/=/g, "")}`];
10384
+ protocols = ["phoenix", `${AUTH_TOKEN_PREFIX}${btoa(this.authToken()).replace(/=/g, "")}`];
10335
10385
  }
10336
10386
  this.conn = new this.transport(this.endPointURL(), protocols);
10337
10387
  this.conn.binaryType = this.binaryType;
@@ -10638,7 +10688,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10638
10688
  };
10639
10689
  });
10640
10690
 
10641
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js
10691
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js
10642
10692
  var require_presenceAdapter = __commonJS((exports) => {
10643
10693
  Object.defineProperty(exports, "__esModule", { value: true });
10644
10694
  var phoenix_1 = require_phoenix_cjs();
@@ -10694,10 +10744,12 @@ var require_presenceAdapter = __commonJS((exports) => {
10694
10744
  exports.default = PresenceAdapter;
10695
10745
  function transformState(presences) {
10696
10746
  return presences.metas.map((presence) => {
10697
- presence["presence_ref"] = presence["phx_ref"];
10698
- delete presence["phx_ref"];
10699
- delete presence["phx_ref_prev"];
10700
- return presence;
10747
+ const descriptors = Object.getOwnPropertyDescriptors(presence);
10748
+ const transformedPresence = Object.defineProperties({}, descriptors);
10749
+ transformedPresence["presence_ref"] = transformedPresence["phx_ref"];
10750
+ delete transformedPresence["phx_ref"];
10751
+ delete transformedPresence["phx_ref_prev"];
10752
+ return transformedPresence;
10701
10753
  });
10702
10754
  }
10703
10755
  function cloneState(state) {
@@ -10711,7 +10763,7 @@ var require_presenceAdapter = __commonJS((exports) => {
10711
10763
  }
10712
10764
  });
10713
10765
 
10714
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js
10766
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js
10715
10767
  var require_RealtimePresence = __commonJS((exports) => {
10716
10768
  Object.defineProperty(exports, "__esModule", { value: true });
10717
10769
  exports.REALTIME_PRESENCE_LISTEN_EVENTS = undefined;
@@ -10736,7 +10788,7 @@ var require_RealtimePresence = __commonJS((exports) => {
10736
10788
  exports.default = RealtimePresence;
10737
10789
  });
10738
10790
 
10739
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js
10791
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js
10740
10792
  var require_normalizeChannelError = __commonJS((exports) => {
10741
10793
  Object.defineProperty(exports, "__esModule", { value: true });
10742
10794
  exports.normalizeChannelError = normalizeChannelError;
@@ -10759,7 +10811,7 @@ var require_normalizeChannelError = __commonJS((exports) => {
10759
10811
  }
10760
10812
  });
10761
10813
 
10762
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js
10814
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js
10763
10815
  var require_channelAdapter = __commonJS((exports) => {
10764
10816
  Object.defineProperty(exports, "__esModule", { value: true });
10765
10817
  var constants_1 = require_constants();
@@ -10861,7 +10913,7 @@ var require_channelAdapter = __commonJS((exports) => {
10861
10913
  }
10862
10914
  });
10863
10915
 
10864
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/RealtimePostgresFilterBuilder.js
10916
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/RealtimePostgresFilterBuilder.js
10865
10917
  var require_RealtimePostgresFilterBuilder = __commonJS((exports) => {
10866
10918
  Object.defineProperty(exports, "__esModule", { value: true });
10867
10919
  exports.postgresChangesFilter = exports.RealtimePostgresFilterBuilder = undefined;
@@ -10951,7 +11003,7 @@ var require_RealtimePostgresFilterBuilder = __commonJS((exports) => {
10951
11003
  exports.postgresChangesFilter = postgresChangesFilter;
10952
11004
  });
10953
11005
 
10954
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js
11006
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js
10955
11007
  var require_RealtimeChannel = __commonJS((exports) => {
10956
11008
  Object.defineProperty(exports, "__esModule", { value: true });
10957
11009
  exports.REALTIME_CHANNEL_STATES = exports.REALTIME_SUBSCRIBE_STATES = exports.REALTIME_LISTEN_TYPES = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports.postgresChangesFilter = exports.RealtimePostgresFilterBuilder = undefined;
@@ -11111,7 +11163,7 @@ var require_RealtimeChannel = __commonJS((exports) => {
11111
11163
  type: "presence",
11112
11164
  event: "track",
11113
11165
  payload
11114
- }, opts.timeout || this.timeout);
11166
+ }, opts);
11115
11167
  }
11116
11168
  async untrack(opts = {}) {
11117
11169
  return await this.send({
@@ -11341,7 +11393,7 @@ var require_RealtimeChannel = __commonJS((exports) => {
11341
11393
  exports.default = RealtimeChannel;
11342
11394
  });
11343
11395
 
11344
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js
11396
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js
11345
11397
  var require_socketAdapter = __commonJS((exports) => {
11346
11398
  Object.defineProperty(exports, "__esModule", { value: true });
11347
11399
  var phoenix_1 = require_phoenix_cjs();
@@ -11454,7 +11506,7 @@ var require_socketAdapter = __commonJS((exports) => {
11454
11506
  exports.default = SocketAdapter;
11455
11507
  });
11456
11508
 
11457
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js
11509
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js
11458
11510
  var require_RealtimeClient = __commonJS((exports) => {
11459
11511
  Object.defineProperty(exports, "__esModule", { value: true });
11460
11512
  var tslib_1 = require_tslib();
@@ -11907,7 +11959,7 @@ var require_RealtimeClient = __commonJS((exports) => {
11907
11959
  exports.default = RealtimeClient;
11908
11960
  });
11909
11961
 
11910
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/index.js
11962
+ // ../../node_modules/.bun/@supabase+realtime-js@2.111.0/node_modules/@supabase/realtime-js/dist/main/index.js
11911
11963
  var require_main2 = __commonJS((exports) => {
11912
11964
  Object.defineProperty(exports, "__esModule", { value: true });
11913
11965
  exports.WebSocketFactory = exports.REALTIME_CHANNEL_STATES = exports.REALTIME_SUBSCRIBE_STATES = exports.REALTIME_PRESENCE_LISTEN_EVENTS = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports.REALTIME_LISTEN_TYPES = exports.postgresChangesFilter = exports.RealtimePostgresFilterBuilder = exports.RealtimeClient = exports.RealtimeChannel = exports.RealtimePresence = undefined;
@@ -12243,7 +12295,7 @@ var init_dist2 = __esm(() => {
12243
12295
  };
12244
12296
  });
12245
12297
 
12246
- // ../../node_modules/.bun/@supabase+storage-js@2.110.2/node_modules/@supabase/storage-js/dist/index.mjs
12298
+ // ../../node_modules/.bun/@supabase+storage-js@2.111.0/node_modules/@supabase/storage-js/dist/index.mjs
12247
12299
  function _typeof2(o) {
12248
12300
  "@babel/helpers - typeof";
12249
12301
  return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o$1) {
@@ -12382,7 +12434,7 @@ var StorageError, StorageApiError, StorageUnknownError, resolveFetch = (customFe
12382
12434
  if (bucketName.includes("/") || bucketName.includes("\\"))
12383
12435
  return false;
12384
12436
  return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
12385
- }, _getErrorMessage = (err) => {
12437
+ }, encodeStoragePath = (path) => path.split("/").map(encodeURIComponent).join("/"), _getErrorMessage = (err) => {
12386
12438
  if (typeof err === "object" && err !== null) {
12387
12439
  const e = err;
12388
12440
  if (typeof e.msg === "string")
@@ -12551,7 +12603,7 @@ var StorageError, StorageApiError, StorageUnknownError, resolveFetch = (customFe
12551
12603
  throw error;
12552
12604
  }
12553
12605
  }
12554
- }, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version = "2.110.2", DEFAULT_HEADERS, StorageBucketApi, StorageAnalyticsClient, VectorIndexApi, VectorDataApi, VectorBucketApi, StorageVectorsClient, VectorBucketScope, VectorIndexScope, StorageClient;
12606
+ }, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version = "2.111.0", DEFAULT_HEADERS, StorageBucketApi, StorageAnalyticsClient, VectorIndexApi, VectorDataApi, VectorBucketApi, StorageVectorsClient, VectorBucketScope, VectorIndexScope, StorageClient;
12555
12607
  var init_dist3 = __esm(() => {
12556
12608
  init_dist2();
12557
12609
  StorageError = class extends Error {
@@ -12841,7 +12893,7 @@ var init_dist3 = __esm(() => {
12841
12893
  async purgeCache(path, options, parameters) {
12842
12894
  var _this13 = this;
12843
12895
  return _this13.handleOperation(async () => {
12844
- const _path = _this13._getFinalPath(path);
12896
+ const _path = encodeStoragePath(_this13._getFinalPath(path));
12845
12897
  const query = new URLSearchParams;
12846
12898
  if (options === null || options === undefined ? undefined : options.transformations)
12847
12899
  query.set("transformations", "true");
@@ -12964,7 +13016,7 @@ var init_dist3 = __esm(() => {
12964
13016
  if (options === null || options === undefined ? undefined : options.transformations)
12965
13017
  query.set("transformations", "true");
12966
13018
  const queryString = query.toString();
12967
- return await remove(_this7.fetch, `${_this7.url}/cdn/${id}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this7.headers }, parameters);
13019
+ return await remove(_this7.fetch, `${_this7.url}/cdn/${encodeStoragePath(id)}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this7.headers }, parameters);
12968
13020
  });
12969
13021
  }
12970
13022
  listBucketOptionsToQueryString(options) {
@@ -13284,17 +13336,17 @@ var init_dist3 = __esm(() => {
13284
13336
  };
13285
13337
  });
13286
13338
 
13287
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/version.js
13339
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/version.js
13288
13340
  var require_version2 = __commonJS((exports) => {
13289
13341
  Object.defineProperty(exports, "__esModule", { value: true });
13290
13342
  exports.version = undefined;
13291
- exports.version = "2.110.2";
13343
+ exports.version = "2.111.0";
13292
13344
  });
13293
13345
 
13294
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/constants.js
13346
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/constants.js
13295
13347
  var require_constants2 = __commonJS((exports) => {
13296
13348
  Object.defineProperty(exports, "__esModule", { value: true });
13297
- exports.JWKS_TTL = exports.BASE64URL_REGEX = exports.API_VERSIONS = exports.API_VERSION_HEADER_NAME = exports.NETWORK_FAILURE = exports.DEFAULT_HEADERS = exports.AUDIENCE = exports.STORAGE_KEY = exports.GOTRUE_URL = exports.REFRESH_FAILURE_COOLDOWN_MS = exports.EXPIRY_MARGIN_MS = exports.AUTO_REFRESH_TICK_THRESHOLD = exports.AUTO_REFRESH_TICK_DURATION_MS = undefined;
13349
+ exports.JWKS_TTL = exports.PKCE_MAX_CONCURRENT_FLOWS = exports.PKCE_FLOW_ID_PARAM = exports.BASE64URL_REGEX = exports.API_VERSIONS = exports.API_VERSION_HEADER_NAME = exports.NETWORK_FAILURE = exports.DEFAULT_HEADERS = exports.AUDIENCE = exports.STORAGE_KEY = exports.GOTRUE_URL = exports.REFRESH_FAILURE_COOLDOWN_MS = exports.EXPIRY_MARGIN_MS = exports.AUTO_REFRESH_TICK_THRESHOLD = exports.AUTO_REFRESH_TICK_DURATION_MS = undefined;
13298
13350
  var version_1 = require_version2();
13299
13351
  exports.AUTO_REFRESH_TICK_DURATION_MS = 30 * 1000;
13300
13352
  exports.AUTO_REFRESH_TICK_THRESHOLD = 3;
@@ -13316,10 +13368,12 @@ var require_constants2 = __commonJS((exports) => {
13316
13368
  }
13317
13369
  };
13318
13370
  exports.BASE64URL_REGEX = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
13371
+ exports.PKCE_FLOW_ID_PARAM = "sb_flow_id";
13372
+ exports.PKCE_MAX_CONCURRENT_FLOWS = 5;
13319
13373
  exports.JWKS_TTL = 10 * 60 * 1000;
13320
13374
  });
13321
13375
 
13322
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/errors.js
13376
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/errors.js
13323
13377
  var require_errors = __commonJS((exports) => {
13324
13378
  Object.defineProperty(exports, "__esModule", { value: true });
13325
13379
  exports.AuthInvalidJwtError = exports.AuthWeakPasswordError = exports.AuthRefreshDiscardedError = exports.AuthRetryableFetchError = exports.AuthPKCECodeVerifierMissingError = exports.AuthPKCEGrantCodeExchangeError = exports.AuthImplicitGrantRedirectError = exports.AuthInvalidCredentialsError = exports.AuthInvalidTokenResponseError = exports.AuthSessionMissingError = exports.CustomAuthError = exports.AuthUnknownError = exports.AuthApiError = exports.AuthError = undefined;
@@ -13488,7 +13542,7 @@ var require_errors = __commonJS((exports) => {
13488
13542
  exports.AuthInvalidJwtError = AuthInvalidJwtError;
13489
13543
  });
13490
13544
 
13491
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/base64url.js
13545
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/base64url.js
13492
13546
  var require_base64url = __commonJS((exports) => {
13493
13547
  Object.defineProperty(exports, "__esModule", { value: true });
13494
13548
  exports.byteToBase64URL = byteToBase64URL;
@@ -13676,10 +13730,10 @@ var require_base64url = __commonJS((exports) => {
13676
13730
  }
13677
13731
  });
13678
13732
 
13679
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/helpers.js
13733
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/helpers.js
13680
13734
  var require_helpers = __commonJS((exports) => {
13681
13735
  Object.defineProperty(exports, "__esModule", { value: true });
13682
- exports.Deferred = exports.removeItemAsync = exports.getItemAsync = exports.setItemAsync = exports.looksLikeFetchResponse = exports.resolveFetch = exports.supportsLocalStorage = exports.isBrowser = undefined;
13736
+ exports.pkceVerifierSlotKey = exports.Deferred = exports.removeItemAsync = exports.getItemAsync = exports.setItemAsync = exports.looksLikeFetchResponse = exports.resolveFetch = exports.supportsLocalStorage = exports.isBrowser = undefined;
13683
13737
  exports.expiresAt = expiresAt;
13684
13738
  exports.generateCallbackId = generateCallbackId;
13685
13739
  exports.parseParametersFromURL = parseParametersFromURL;
@@ -13688,6 +13742,13 @@ var require_helpers = __commonJS((exports) => {
13688
13742
  exports.retryable = retryable;
13689
13743
  exports.generatePKCEVerifier = generatePKCEVerifier;
13690
13744
  exports.generatePKCEChallenge = generatePKCEChallenge;
13745
+ exports.validatePKCEFlowId = validatePKCEFlowId;
13746
+ exports.generatePKCEFlowId = generatePKCEFlowId;
13747
+ exports.storePKCEVerifier = storePKCEVerifier;
13748
+ exports.retrievePKCEVerifier = retrievePKCEVerifier;
13749
+ exports.removePKCEVerifier = removePKCEVerifier;
13750
+ exports.removeAllPKCEVerifiers = removeAllPKCEVerifiers;
13751
+ exports.appendFlowIdToRedirectTo = appendFlowIdToRedirectTo;
13691
13752
  exports.getCodeChallengeAndMethod = getCodeChallengeAndMethod;
13692
13753
  exports.parseResponseAPIVersion = parseResponseAPIVersion;
13693
13754
  exports.validateExp = validateExp;
@@ -13879,16 +13940,103 @@ var require_helpers = __commonJS((exports) => {
13879
13940
  const hashed = await sha256(verifier);
13880
13941
  return btoa(hashed).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
13881
13942
  }
13882
- async function getCodeChallengeAndMethod(storage, storageKey, isPasswordRecovery = false) {
13943
+ var PKCE_FLOW_ID_PATTERN = /^[a-zA-Z0-9_-]{8,64}$/;
13944
+ function validatePKCEFlowId(flowId) {
13945
+ return typeof flowId === "string" && PKCE_FLOW_ID_PATTERN.test(flowId) ? flowId : null;
13946
+ }
13947
+ function generatePKCEFlowId() {
13948
+ if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
13949
+ const bytes = new Uint8Array(16);
13950
+ crypto.getRandomValues(bytes);
13951
+ return Array.from(bytes, dec2hex).join("");
13952
+ }
13953
+ let flowId = "";
13954
+ for (let i = 0;i < 32; i++) {
13955
+ flowId += Math.floor(Math.random() * 16).toString(16);
13956
+ }
13957
+ return flowId;
13958
+ }
13959
+ var pkceVerifierSlotKey = (storageKey, flowId) => `${storageKey}-flow-${flowId}-code-verifier`;
13960
+ exports.pkceVerifierSlotKey = pkceVerifierSlotKey;
13961
+ var pkceFlowIndexKey = (storageKey) => `${storageKey}-flows-code-verifier`;
13962
+ async function getPKCEFlowIndex(storage, storageKey) {
13963
+ const index = await (0, exports.getItemAsync)(storage, pkceFlowIndexKey(storageKey));
13964
+ return Array.isArray(index) ? index.filter((id) => validatePKCEFlowId(id) !== null) : [];
13965
+ }
13966
+ async function storePKCEVerifier(storage, storageKey, flowId, verifier, onEvictFlow) {
13967
+ await (0, exports.setItemAsync)(storage, (0, exports.pkceVerifierSlotKey)(storageKey, flowId), verifier);
13968
+ const index = (await getPKCEFlowIndex(storage, storageKey)).filter((id) => id !== flowId);
13969
+ index.push(flowId);
13970
+ while (index.length > constants_1.PKCE_MAX_CONCURRENT_FLOWS) {
13971
+ const evicted = index.shift();
13972
+ await (0, exports.removeItemAsync)(storage, (0, exports.pkceVerifierSlotKey)(storageKey, evicted));
13973
+ onEvictFlow === null || onEvictFlow === undefined || onEvictFlow(evicted);
13974
+ }
13975
+ await (0, exports.setItemAsync)(storage, pkceFlowIndexKey(storageKey), index);
13976
+ await (0, exports.setItemAsync)(storage, `${storageKey}-code-verifier`, verifier);
13977
+ }
13978
+ async function retrievePKCEVerifier(storage, storageKey, flowId) {
13979
+ if (flowId) {
13980
+ const verifier2 = await (0, exports.getItemAsync)(storage, (0, exports.pkceVerifierSlotKey)(storageKey, flowId));
13981
+ return { verifier: typeof verifier2 === "string" ? verifier2 : null, flowId };
13982
+ }
13983
+ const verifier = await (0, exports.getItemAsync)(storage, `${storageKey}-code-verifier`);
13984
+ return { verifier: typeof verifier === "string" ? verifier : null, flowId: null };
13985
+ }
13986
+ async function removePKCEVerifier(storage, storageKey, flowId) {
13987
+ const legacyKey = `${storageKey}-code-verifier`;
13988
+ if (!flowId) {
13989
+ await (0, exports.removeItemAsync)(storage, legacyKey);
13990
+ return;
13991
+ }
13992
+ const slotKey = (0, exports.pkceVerifierSlotKey)(storageKey, flowId);
13993
+ const slotValue = await (0, exports.getItemAsync)(storage, slotKey);
13994
+ await (0, exports.removeItemAsync)(storage, slotKey);
13995
+ const index = await getPKCEFlowIndex(storage, storageKey);
13996
+ const remaining = index.filter((id) => id !== flowId);
13997
+ if (remaining.length !== index.length) {
13998
+ if (remaining.length > 0) {
13999
+ await (0, exports.setItemAsync)(storage, pkceFlowIndexKey(storageKey), remaining);
14000
+ } else {
14001
+ await (0, exports.removeItemAsync)(storage, pkceFlowIndexKey(storageKey));
14002
+ }
14003
+ }
14004
+ if (slotValue != null && slotValue === await (0, exports.getItemAsync)(storage, legacyKey)) {
14005
+ await (0, exports.removeItemAsync)(storage, legacyKey);
14006
+ }
14007
+ }
14008
+ async function removeAllPKCEVerifiers(storage, storageKey) {
14009
+ const index = await getPKCEFlowIndex(storage, storageKey);
14010
+ for (const flowId of index) {
14011
+ await (0, exports.removeItemAsync)(storage, (0, exports.pkceVerifierSlotKey)(storageKey, flowId));
14012
+ }
14013
+ await (0, exports.removeItemAsync)(storage, pkceFlowIndexKey(storageKey));
14014
+ await (0, exports.removeItemAsync)(storage, `${storageKey}-code-verifier`);
14015
+ }
14016
+ function appendFlowIdToRedirectTo(redirectTo, flowId) {
14017
+ const hashIndex = redirectTo.indexOf("#");
14018
+ let base = hashIndex === -1 ? redirectTo : redirectTo.slice(0, hashIndex);
14019
+ const fragment = hashIndex === -1 ? "" : redirectTo.slice(hashIndex);
14020
+ const queryIndex = base.indexOf("?");
14021
+ if (queryIndex !== -1) {
14022
+ const path = base.slice(0, queryIndex);
14023
+ const remaining = base.slice(queryIndex + 1).split("&").filter((pair) => pair !== "" && pair !== constants_1.PKCE_FLOW_ID_PARAM && !pair.startsWith(`${constants_1.PKCE_FLOW_ID_PARAM}=`));
14024
+ base = remaining.length > 0 ? `${path}?${remaining.join("&")}` : path;
14025
+ }
14026
+ const separator = base.includes("?") ? "&" : "?";
14027
+ return `${base}${separator}${constants_1.PKCE_FLOW_ID_PARAM}=${encodeURIComponent(flowId)}${fragment}`;
14028
+ }
14029
+ async function getCodeChallengeAndMethod(storage, storageKey, isPasswordRecovery = false, onEvictFlow) {
13883
14030
  const codeVerifier = generatePKCEVerifier();
13884
14031
  let storedCodeVerifier = codeVerifier;
13885
14032
  if (isPasswordRecovery) {
13886
14033
  storedCodeVerifier += "/recovery";
13887
14034
  }
13888
- await (0, exports.setItemAsync)(storage, `${storageKey}-code-verifier`, storedCodeVerifier);
14035
+ const flowId = generatePKCEFlowId();
14036
+ await storePKCEVerifier(storage, storageKey, flowId, storedCodeVerifier, onEvictFlow);
13889
14037
  const codeChallenge = await generatePKCEChallenge(codeVerifier);
13890
14038
  const codeChallengeMethod = codeVerifier === codeChallenge ? "plain" : "s256";
13891
- return [codeChallenge, codeChallengeMethod];
14039
+ return [codeChallenge, codeChallengeMethod, flowId];
13892
14040
  }
13893
14041
  var API_VERSION_REGEX = /^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;
13894
14042
  function parseResponseAPIVersion(response) {
@@ -13991,7 +14139,7 @@ var require_helpers = __commonJS((exports) => {
13991
14139
  }
13992
14140
  });
13993
14141
 
13994
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/fetch.js
14142
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/fetch.js
13995
14143
  var require_fetch = __commonJS((exports) => {
13996
14144
  Object.defineProperty(exports, "__esModule", { value: true });
13997
14145
  exports.handleError = handleError2;
@@ -14105,7 +14253,6 @@ var require_fetch = __commonJS((exports) => {
14105
14253
  try {
14106
14254
  result = await fetcher(url, Object.assign({}, requestParams));
14107
14255
  } catch (e) {
14108
- console.error(e);
14109
14256
  throw new errors_1.AuthRetryableFetchError(_getErrorMessage2(e), 0);
14110
14257
  }
14111
14258
  if (!result.ok) {
@@ -14173,14 +14320,14 @@ var require_fetch = __commonJS((exports) => {
14173
14320
  }
14174
14321
  });
14175
14322
 
14176
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/types.js
14323
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/types.js
14177
14324
  var require_types2 = __commonJS((exports) => {
14178
14325
  Object.defineProperty(exports, "__esModule", { value: true });
14179
14326
  exports.SIGN_OUT_SCOPES = undefined;
14180
14327
  exports.SIGN_OUT_SCOPES = ["global", "local", "others"];
14181
14328
  });
14182
14329
 
14183
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js
14330
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js
14184
14331
  var require_GoTrueAdminApi = __commonJS((exports) => {
14185
14332
  Object.defineProperty(exports, "__esModule", { value: true });
14186
14333
  var tslib_1 = require_tslib();
@@ -14627,7 +14774,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
14627
14774
  exports.default = GoTrueAdminApi;
14628
14775
  });
14629
14776
 
14630
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js
14777
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js
14631
14778
  var require_local_storage = __commonJS((exports) => {
14632
14779
  Object.defineProperty(exports, "__esModule", { value: true });
14633
14780
  exports.memoryLocalStorageAdapter = memoryLocalStorageAdapter;
@@ -14646,7 +14793,7 @@ var require_local_storage = __commonJS((exports) => {
14646
14793
  }
14647
14794
  });
14648
14795
 
14649
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/locks.js
14796
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/locks.js
14650
14797
  var require_locks = __commonJS((exports) => {
14651
14798
  Object.defineProperty(exports, "__esModule", { value: true });
14652
14799
  exports.ProcessLockAcquireTimeoutError = exports.NavigatorLockAcquireTimeoutError = exports.LockAcquireTimeoutError = exports.internals = undefined;
@@ -14820,7 +14967,7 @@ var require_locks = __commonJS((exports) => {
14820
14967
  }
14821
14968
  });
14822
14969
 
14823
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js
14970
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js
14824
14971
  var require_polyfills = __commonJS((exports) => {
14825
14972
  Object.defineProperty(exports, "__esModule", { value: true });
14826
14973
  exports.polyfillGlobalThis = polyfillGlobalThis;
@@ -14844,7 +14991,7 @@ var require_polyfills = __commonJS((exports) => {
14844
14991
  }
14845
14992
  });
14846
14993
 
14847
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js
14994
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js
14848
14995
  var require_ethereum = __commonJS((exports) => {
14849
14996
  Object.defineProperty(exports, "__esModule", { value: true });
14850
14997
  exports.getAddress = getAddress;
@@ -14921,7 +15068,7 @@ ${suffix}`;
14921
15068
  }
14922
15069
  });
14923
15070
 
14924
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js
15071
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js
14925
15072
  var require_webauthn_errors = __commonJS((exports) => {
14926
15073
  Object.defineProperty(exports, "__esModule", { value: true });
14927
15074
  exports.WebAuthnUnknownError = exports.WebAuthnError = undefined;
@@ -15108,7 +15255,7 @@ var require_webauthn_errors = __commonJS((exports) => {
15108
15255
  }
15109
15256
  });
15110
15257
 
15111
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js
15258
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js
15112
15259
  var require_webauthn = __commonJS((exports) => {
15113
15260
  Object.defineProperty(exports, "__esModule", { value: true });
15114
15261
  exports.WebAuthnApi = exports.DEFAULT_REQUEST_OPTIONS = exports.DEFAULT_CREATION_OPTIONS = exports.webAuthnAbortService = exports.WebAuthnAbortService = exports.identifyAuthenticationError = exports.identifyRegistrationError = exports.isWebAuthnError = exports.WebAuthnError = undefined;
@@ -15562,7 +15709,7 @@ var require_webauthn = __commonJS((exports) => {
15562
15709
  exports.WebAuthnApi = WebAuthnApi;
15563
15710
  });
15564
15711
 
15565
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js
15712
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js
15566
15713
  var require_GoTrueClient = __commonJS((exports) => {
15567
15714
  Object.defineProperty(exports, "__esModule", { value: true });
15568
15715
  var tslib_1 = require_tslib();
@@ -15861,6 +16008,7 @@ var require_GoTrueClient = __commonJS((exports) => {
15861
16008
  }
15862
16009
  async signUp(credentials) {
15863
16010
  var _a, _b, _c;
16011
+ let flowId = null;
15864
16012
  try {
15865
16013
  let res;
15866
16014
  if ("email" in credentials) {
@@ -15868,11 +16016,11 @@ var require_GoTrueClient = __commonJS((exports) => {
15868
16016
  let codeChallenge = null;
15869
16017
  let codeChallengeMethod = null;
15870
16018
  if (this.flowType === "pkce") {
15871
- [codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey);
16019
+ [codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
15872
16020
  }
15873
16021
  res = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/signup`, {
15874
16022
  headers: this.headers,
15875
- redirectTo: options === null || options === undefined ? undefined : options.emailRedirectTo,
16023
+ redirectTo: this._maybeAppendFlowIdToRedirect(options === null || options === undefined ? undefined : options.emailRedirectTo, flowId),
15876
16024
  body: {
15877
16025
  email,
15878
16026
  password,
@@ -15901,7 +16049,7 @@ var require_GoTrueClient = __commonJS((exports) => {
15901
16049
  }
15902
16050
  const { data, error } = res;
15903
16051
  if (error || !data) {
15904
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16052
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
15905
16053
  return this._returnResult({ data: { user: null, session: null }, error });
15906
16054
  }
15907
16055
  const session = data.session;
@@ -15912,7 +16060,7 @@ var require_GoTrueClient = __commonJS((exports) => {
15912
16060
  }
15913
16061
  return this._returnResult({ data: { user, session }, error: null });
15914
16062
  } catch (error) {
15915
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16063
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
15916
16064
  if ((0, errors_1.isAuthError)(error)) {
15917
16065
  return this._returnResult({ data: { user: null, session: null }, error });
15918
16066
  }
@@ -15978,14 +16126,14 @@ var require_GoTrueClient = __commonJS((exports) => {
15978
16126
  skipBrowserRedirect: (_d = credentials.options) === null || _d === undefined ? undefined : _d.skipBrowserRedirect
15979
16127
  });
15980
16128
  }
15981
- async exchangeCodeForSession(authCode) {
16129
+ async exchangeCodeForSession(authCode, options) {
15982
16130
  await this.initializePromise;
15983
16131
  if (this.lock != null) {
15984
16132
  return this._acquireLock(this.lockAcquireTimeout, async () => {
15985
- return this._exchangeCodeForSession(authCode);
16133
+ return this._exchangeCodeForSession(authCode, options);
15986
16134
  });
15987
16135
  }
15988
- return this._exchangeCodeForSession(authCode);
16136
+ return this._exchangeCodeForSession(authCode, options);
15989
16137
  }
15990
16138
  async signInWithWeb3(credentials) {
15991
16139
  const { chain } = credentials;
@@ -16189,8 +16337,13 @@ var require_GoTrueClient = __commonJS((exports) => {
16189
16337
  throw error;
16190
16338
  }
16191
16339
  }
16192
- async _exchangeCodeForSession(authCode) {
16193
- const storageItem = await (0, helpers_1.getItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16340
+ async _exchangeCodeForSession(authCode, options) {
16341
+ const hasExplicitFlowId = (options === null || options === undefined ? undefined : options.flowId) != null;
16342
+ const requestedFlowId = hasExplicitFlowId ? (0, helpers_1.validatePKCEFlowId)(options === null || options === undefined ? undefined : options.flowId) : (0, helpers_1.isBrowser)() ? (0, helpers_1.validatePKCEFlowId)((0, helpers_1.parseParametersFromURL)(window.location.href)[constants_1.PKCE_FLOW_ID_PARAM]) : null;
16343
+ if (hasExplicitFlowId && !requestedFlowId) {
16344
+ this._debug("#_exchangeCodeForSession()", "provided flowId is not a valid flow id", options === null || options === undefined ? undefined : options.flowId);
16345
+ }
16346
+ const { verifier: storageItem, flowId } = hasExplicitFlowId && !requestedFlowId ? { verifier: null, flowId: null } : await (0, helpers_1.retrievePKCEVerifier)(this.storage, this.storageKey, requestedFlowId);
16194
16347
  const [codeVerifier, redirectType] = (storageItem !== null && storageItem !== undefined ? storageItem : "").split("/");
16195
16348
  try {
16196
16349
  if (!codeVerifier && this.flowType === "pkce") {
@@ -16204,7 +16357,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16204
16357
  },
16205
16358
  xform: fetch_1._sessionResponse
16206
16359
  });
16207
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16360
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
16208
16361
  if (error) {
16209
16362
  throw error;
16210
16363
  }
@@ -16221,7 +16374,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16221
16374
  }
16222
16375
  return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== undefined ? redirectType : null }), error });
16223
16376
  } catch (error) {
16224
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16377
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
16225
16378
  if ((0, errors_1.isAuthError)(error)) {
16226
16379
  return this._returnResult({
16227
16380
  data: { user: null, session: null, redirectType: null },
@@ -16266,13 +16419,14 @@ var require_GoTrueClient = __commonJS((exports) => {
16266
16419
  }
16267
16420
  async signInWithOtp(credentials) {
16268
16421
  var _a, _b, _c, _d, _f;
16422
+ let flowId = null;
16269
16423
  try {
16270
16424
  if ("email" in credentials) {
16271
16425
  const { email, options } = credentials;
16272
16426
  let codeChallenge = null;
16273
16427
  let codeChallengeMethod = null;
16274
16428
  if (this.flowType === "pkce") {
16275
- [codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey);
16429
+ [codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
16276
16430
  }
16277
16431
  const { error } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/otp`, {
16278
16432
  headers: this.headers,
@@ -16284,7 +16438,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16284
16438
  code_challenge: codeChallenge,
16285
16439
  code_challenge_method: codeChallengeMethod
16286
16440
  },
16287
- redirectTo: options === null || options === undefined ? undefined : options.emailRedirectTo
16441
+ redirectTo: this._maybeAppendFlowIdToRedirect(options === null || options === undefined ? undefined : options.emailRedirectTo, flowId)
16288
16442
  });
16289
16443
  return this._returnResult({ data: { user: null, session: null }, error });
16290
16444
  }
@@ -16307,7 +16461,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16307
16461
  }
16308
16462
  throw new errors_1.AuthInvalidCredentialsError("You must provide either an email or phone number.");
16309
16463
  } catch (error) {
16310
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16464
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
16311
16465
  if ((0, errors_1.isAuthError)(error)) {
16312
16466
  return this._returnResult({ data: { user: null, session: null }, error });
16313
16467
  }
@@ -16351,24 +16505,25 @@ var require_GoTrueClient = __commonJS((exports) => {
16351
16505
  }
16352
16506
  }
16353
16507
  async signInWithSSO(params) {
16354
- var _a, _b, _c, _d, _f;
16508
+ var _a, _b, _c, _d;
16509
+ let flowId = null;
16355
16510
  try {
16356
16511
  let codeChallenge = null;
16357
16512
  let codeChallengeMethod = null;
16358
16513
  if (this.flowType === "pkce") {
16359
- [codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey);
16514
+ [codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
16360
16515
  }
16361
16516
  const result = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/sso`, {
16362
- body: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, "providerId" in params ? { provider_id: params.providerId } : null), "domain" in params ? { domain: params.domain } : null), { redirect_to: (_b = (_a = params.options) === null || _a === undefined ? undefined : _a.redirectTo) !== null && _b !== undefined ? _b : undefined }), ((_c = params === null || params === undefined ? undefined : params.options) === null || _c === undefined ? undefined : _c.captchaToken) ? { gotrue_meta_security: { captcha_token: params.options.captchaToken } } : null), { skip_http_redirect: true, code_challenge: codeChallenge, code_challenge_method: codeChallengeMethod }),
16517
+ body: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, "providerId" in params ? { provider_id: params.providerId } : null), "domain" in params ? { domain: params.domain } : null), { redirect_to: this._maybeAppendFlowIdToRedirect((_a = params.options) === null || _a === undefined ? undefined : _a.redirectTo, flowId) }), ((_b = params === null || params === undefined ? undefined : params.options) === null || _b === undefined ? undefined : _b.captchaToken) ? { gotrue_meta_security: { captcha_token: params.options.captchaToken } } : null), { skip_http_redirect: true, code_challenge: codeChallenge, code_challenge_method: codeChallengeMethod }),
16363
16518
  headers: this.headers,
16364
16519
  xform: fetch_1._ssoResponse
16365
16520
  });
16366
- if (((_d = result.data) === null || _d === undefined ? undefined : _d.url) && (0, helpers_1.isBrowser)() && !((_f = params.options) === null || _f === undefined ? undefined : _f.skipBrowserRedirect)) {
16521
+ if (((_c = result.data) === null || _c === undefined ? undefined : _c.url) && (0, helpers_1.isBrowser)() && !((_d = params.options) === null || _d === undefined ? undefined : _d.skipBrowserRedirect)) {
16367
16522
  window.location.assign(result.data.url);
16368
16523
  }
16369
16524
  return this._returnResult(result);
16370
16525
  } catch (error) {
16371
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16526
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
16372
16527
  if ((0, errors_1.isAuthError)(error)) {
16373
16528
  return this._returnResult({ data: null, error });
16374
16529
  }
@@ -16406,6 +16561,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16406
16561
  }
16407
16562
  }
16408
16563
  async resend(credentials) {
16564
+ let flowId = null;
16409
16565
  try {
16410
16566
  const endpoint = `${this.url}/resend`;
16411
16567
  if ("email" in credentials) {
@@ -16413,7 +16569,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16413
16569
  let codeChallenge = null;
16414
16570
  let codeChallengeMethod = null;
16415
16571
  if (this.flowType === "pkce") {
16416
- [codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey);
16572
+ [codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
16417
16573
  }
16418
16574
  const { error } = await (0, fetch_1._request)(this.fetch, "POST", endpoint, {
16419
16575
  headers: this.headers,
@@ -16424,10 +16580,10 @@ var require_GoTrueClient = __commonJS((exports) => {
16424
16580
  code_challenge: codeChallenge,
16425
16581
  code_challenge_method: codeChallengeMethod
16426
16582
  },
16427
- redirectTo: options === null || options === undefined ? undefined : options.emailRedirectTo
16583
+ redirectTo: this._maybeAppendFlowIdToRedirect(options === null || options === undefined ? undefined : options.emailRedirectTo, flowId)
16428
16584
  });
16429
16585
  if (error) {
16430
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16586
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
16431
16587
  }
16432
16588
  return this._returnResult({ data: { user: null, session: null }, error });
16433
16589
  } else if ("phone" in credentials) {
@@ -16447,7 +16603,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16447
16603
  }
16448
16604
  throw new errors_1.AuthInvalidCredentialsError("You must provide either an email or phone number and a type");
16449
16605
  } catch (error) {
16450
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16606
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
16451
16607
  if ((0, errors_1.isAuthError)(error)) {
16452
16608
  return this._returnResult({ data: { user: null, session: null }, error });
16453
16609
  }
@@ -16620,7 +16776,6 @@ var require_GoTrueClient = __commonJS((exports) => {
16620
16776
  if ((0, errors_1.isAuthError)(error)) {
16621
16777
  if ((0, errors_1.isAuthSessionMissingError)(error)) {
16622
16778
  await this._removeSession();
16623
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16624
16779
  }
16625
16780
  return this._returnResult({ data: { user: null }, error });
16626
16781
  }
@@ -16637,6 +16792,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16637
16792
  return await this._updateUser(attributes, options);
16638
16793
  }
16639
16794
  async _updateUser(attributes, options = {}) {
16795
+ let flowId = null;
16640
16796
  try {
16641
16797
  return await this._useSession(async (result) => {
16642
16798
  const { data: sessionData, error: sessionError } = result;
@@ -16650,11 +16806,11 @@ var require_GoTrueClient = __commonJS((exports) => {
16650
16806
  let codeChallenge = null;
16651
16807
  let codeChallengeMethod = null;
16652
16808
  if (this.flowType === "pkce" && attributes.email != null) {
16653
- [codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey);
16809
+ [codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
16654
16810
  }
16655
16811
  const { data, error: userError2 } = await (0, fetch_1._request)(this.fetch, "PUT", `${this.url}/user`, {
16656
16812
  headers: this.headers,
16657
- redirectTo: options === null || options === undefined ? undefined : options.emailRedirectTo,
16813
+ redirectTo: this._maybeAppendFlowIdToRedirect(options === null || options === undefined ? undefined : options.emailRedirectTo, flowId),
16658
16814
  body: Object.assign(Object.assign({}, attributes), { code_challenge: codeChallenge, code_challenge_method: codeChallengeMethod }),
16659
16815
  jwt: session.access_token,
16660
16816
  xform: fetch_1._userResponse
@@ -16668,7 +16824,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16668
16824
  return this._returnResult({ data: { user: session.user }, error: null });
16669
16825
  });
16670
16826
  } catch (error) {
16671
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16827
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
16672
16828
  if ((0, errors_1.isAuthError)(error)) {
16673
16829
  return this._returnResult({ data: { user: null }, error });
16674
16830
  }
@@ -16798,11 +16954,14 @@ var require_GoTrueClient = __commonJS((exports) => {
16798
16954
  this._debug("#_initialize()", "begin", "is PKCE flow", true);
16799
16955
  if (!params.code)
16800
16956
  throw new errors_1.AuthPKCEGrantCodeExchangeError("No code detected.");
16801
- const { data: data2, error: error2 } = await this._exchangeCodeForSession(params.code);
16957
+ const { data: data2, error: error2 } = await this._exchangeCodeForSession(params.code, {
16958
+ flowId: params[constants_1.PKCE_FLOW_ID_PARAM]
16959
+ });
16802
16960
  if (error2)
16803
16961
  throw error2;
16804
16962
  const url = new URL(window.location.href);
16805
16963
  url.searchParams.delete("code");
16964
+ url.searchParams.delete(constants_1.PKCE_FLOW_ID_PARAM);
16806
16965
  window.history.replaceState(window.history.state, "", url.toString());
16807
16966
  return {
16808
16967
  data: { session: data2.session, redirectType: (_a = data2.redirectType) !== null && _a !== undefined ? _a : null },
@@ -16859,8 +17018,15 @@ var require_GoTrueClient = __commonJS((exports) => {
16859
17018
  return Boolean(params.access_token || params.error || params.error_description || params.error_code);
16860
17019
  }
16861
17020
  async _isPKCECallback(params) {
17021
+ if (!params.code) {
17022
+ return false;
17023
+ }
17024
+ const flowId = (0, helpers_1.validatePKCEFlowId)(params[constants_1.PKCE_FLOW_ID_PARAM]);
17025
+ if (flowId && await (0, helpers_1.getItemAsync)(this.storage, (0, helpers_1.pkceVerifierSlotKey)(this.storageKey, flowId))) {
17026
+ return true;
17027
+ }
16862
17028
  const currentStorageContent = await (0, helpers_1.getItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16863
- return !!(params.code && currentStorageContent);
17029
+ return !!currentStorageContent;
16864
17030
  }
16865
17031
  async signOut(options = { scope: "global" }) {
16866
17032
  await this.initializePromise;
@@ -16876,7 +17042,6 @@ var require_GoTrueClient = __commonJS((exports) => {
16876
17042
  var _a;
16877
17043
  const removeCurrentSession = async () => {
16878
17044
  await this._removeSession();
16879
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
16880
17045
  };
16881
17046
  const { data, error: sessionError } = result;
16882
17047
  if (sessionError && !(0, errors_1.isAuthSessionMissingError)(sessionError)) {
@@ -16936,7 +17101,7 @@ var require_GoTrueClient = __commonJS((exports) => {
16936
17101
  } catch (err) {
16937
17102
  await ((_b = this.stateChangeEmitters.get(id)) === null || _b === undefined ? undefined : _b.callback("INITIAL_SESSION", null));
16938
17103
  this._debug("INITIAL_SESSION", "callback id", id, "error", err);
16939
- if ((0, errors_1.isAuthSessionMissingError)(err)) {
17104
+ if ((0, errors_1.isAuthSessionMissingError)(err) || (0, errors_1.isAuthRetryableFetchError)(err) || (0, errors_1.isAuthApiError)(err) && (err.code === "refresh_token_not_found" || err.code === "refresh_token_already_used" || err.code === "session_expired")) {
16940
17105
  console.warn(err);
16941
17106
  } else {
16942
17107
  console.error(err);
@@ -16947,8 +17112,9 @@ var require_GoTrueClient = __commonJS((exports) => {
16947
17112
  async resetPasswordForEmail(email, options = {}) {
16948
17113
  let codeChallenge = null;
16949
17114
  let codeChallengeMethod = null;
17115
+ let flowId = null;
16950
17116
  if (this.flowType === "pkce") {
16951
- [codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey, true);
17117
+ [codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod(true);
16952
17118
  }
16953
17119
  try {
16954
17120
  return await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/recover`, {
@@ -16959,10 +17125,10 @@ var require_GoTrueClient = __commonJS((exports) => {
16959
17125
  gotrue_meta_security: { captcha_token: options.captchaToken }
16960
17126
  },
16961
17127
  headers: this.headers,
16962
- redirectTo: options.redirectTo
17128
+ redirectTo: this._maybeAppendFlowIdToRedirect(options.redirectTo, flowId)
16963
17129
  });
16964
17130
  } catch (error) {
16965
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
17131
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, flowId);
16966
17132
  if ((0, errors_1.isAuthError)(error)) {
16967
17133
  return this._returnResult({ data: null, error });
16968
17134
  }
@@ -16991,18 +17157,20 @@ var require_GoTrueClient = __commonJS((exports) => {
16991
17157
  }
16992
17158
  async linkIdentityOAuth(credentials) {
16993
17159
  var _a;
17160
+ let flowId = null;
16994
17161
  try {
16995
17162
  const { data, error } = await this._useSession(async (result) => {
16996
17163
  var _a2, _b, _c, _d, _f;
16997
17164
  const { data: data2, error: error2 } = result;
16998
17165
  if (error2)
16999
17166
  throw error2;
17000
- const url = await this._getUrlForProvider(`${this.url}/user/identities/authorize`, credentials.provider, {
17167
+ const { url, flowId: urlFlowId } = await this._getUrlForProvider(`${this.url}/user/identities/authorize`, credentials.provider, {
17001
17168
  redirectTo: (_a2 = credentials.options) === null || _a2 === undefined ? undefined : _a2.redirectTo,
17002
17169
  scopes: (_b = credentials.options) === null || _b === undefined ? undefined : _b.scopes,
17003
17170
  queryParams: (_c = credentials.options) === null || _c === undefined ? undefined : _c.queryParams,
17004
17171
  skipBrowserRedirect: true
17005
17172
  });
17173
+ flowId = urlFlowId;
17006
17174
  return await (0, fetch_1._request)(this.fetch, "GET", url, {
17007
17175
  headers: this.headers,
17008
17176
  jwt: (_f = (_d = data2.session) === null || _d === undefined ? undefined : _d.access_token) !== null && _f !== undefined ? _f : undefined
@@ -17014,12 +17182,15 @@ var require_GoTrueClient = __commonJS((exports) => {
17014
17182
  window.location.assign(data === null || data === undefined ? undefined : data.url);
17015
17183
  }
17016
17184
  return this._returnResult({
17017
- data: { provider: credentials.provider, url: data === null || data === undefined ? undefined : data.url },
17185
+ data: { provider: credentials.provider, url: data === null || data === undefined ? undefined : data.url, flowId },
17018
17186
  error: null
17019
17187
  });
17020
17188
  } catch (error) {
17021
17189
  if ((0, errors_1.isAuthError)(error)) {
17022
- return this._returnResult({ data: { provider: credentials.provider, url: null }, error });
17190
+ return this._returnResult({
17191
+ data: { provider: credentials.provider, url: null, flowId },
17192
+ error
17193
+ });
17023
17194
  }
17024
17195
  throw error;
17025
17196
  }
@@ -17060,7 +17231,7 @@ var require_GoTrueClient = __commonJS((exports) => {
17060
17231
  }
17061
17232
  return this._returnResult({ data, error });
17062
17233
  } catch (error) {
17063
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
17234
+ await (0, helpers_1.removePKCEVerifier)(this.storage, this.storageKey, null);
17064
17235
  if ((0, errors_1.isAuthError)(error)) {
17065
17236
  return this._returnResult({ data: { user: null, session: null }, error });
17066
17237
  }
@@ -17122,7 +17293,7 @@ var require_GoTrueClient = __commonJS((exports) => {
17122
17293
  return isValidSession;
17123
17294
  }
17124
17295
  async _handleProviderSignIn(provider, options) {
17125
- const url = await this._getUrlForProvider(`${this.url}/authorize`, provider, {
17296
+ const { url, flowId } = await this._getUrlForProvider(`${this.url}/authorize`, provider, {
17126
17297
  redirectTo: options.redirectTo,
17127
17298
  scopes: options.scopes,
17128
17299
  queryParams: options.queryParams
@@ -17131,7 +17302,7 @@ var require_GoTrueClient = __commonJS((exports) => {
17131
17302
  if ((0, helpers_1.isBrowser)() && !options.skipBrowserRedirect) {
17132
17303
  window.location.assign(url);
17133
17304
  }
17134
- return { data: { provider, url }, error: null };
17305
+ return { data: { provider, url, flowId }, error: null };
17135
17306
  }
17136
17307
  async _recoverAndRefresh() {
17137
17308
  var _a, _b;
@@ -17198,7 +17369,11 @@ var require_GoTrueClient = __commonJS((exports) => {
17198
17369
  }
17199
17370
  } catch (err) {
17200
17371
  this._debug(debugName, "error", err);
17201
- console.error(err);
17372
+ if ((0, errors_1.isAuthRetryableFetchError)(err)) {
17373
+ console.warn(err);
17374
+ } else {
17375
+ console.error(err);
17376
+ }
17202
17377
  return;
17203
17378
  } finally {
17204
17379
  this._debug(debugName, "end");
@@ -17321,7 +17496,6 @@ var require_GoTrueClient = __commonJS((exports) => {
17321
17496
  async _saveSession(session) {
17322
17497
  this._debug("#_saveSession()", session);
17323
17498
  this.suppressGetSessionWarning = true;
17324
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
17325
17499
  const sessionToProcess = Object.assign({}, session);
17326
17500
  const userIsProxy = sessionToProcess.user && sessionToProcess.user.__isUserNotAvailableProxy === true;
17327
17501
  if (this.userStorage) {
@@ -17345,7 +17519,7 @@ var require_GoTrueClient = __commonJS((exports) => {
17345
17519
  this.lastRefreshFailure = null;
17346
17520
  this.suppressGetSessionWarning = false;
17347
17521
  await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey);
17348
- await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey + "-code-verifier");
17522
+ await (0, helpers_1.removeAllPKCEVerifiers)(this.storage, this.storageKey);
17349
17523
  await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey + "-user");
17350
17524
  if (this.userStorage) {
17351
17525
  await (0, helpers_1.removeItemAsync)(this.userStorage, this.storageKey + "-user");
@@ -17530,15 +17704,22 @@ var require_GoTrueClient = __commonJS((exports) => {
17530
17704
  }
17531
17705
  }
17532
17706
  async _getUrlForProvider(url, provider, options) {
17707
+ let redirectTo = options === null || options === undefined ? undefined : options.redirectTo;
17708
+ let codeChallenge = null;
17709
+ let codeChallengeMethod = null;
17710
+ let flowId = null;
17711
+ if (this.flowType === "pkce") {
17712
+ [codeChallenge, codeChallengeMethod, flowId] = await this._getCodeChallengeAndMethod();
17713
+ redirectTo = this._maybeAppendFlowIdToRedirect(redirectTo, flowId);
17714
+ }
17533
17715
  const urlParams = [`provider=${encodeURIComponent(provider)}`];
17534
- if (options === null || options === undefined ? undefined : options.redirectTo) {
17535
- urlParams.push(`redirect_to=${encodeURIComponent(options.redirectTo)}`);
17716
+ if (redirectTo) {
17717
+ urlParams.push(`redirect_to=${encodeURIComponent(redirectTo)}`);
17536
17718
  }
17537
17719
  if (options === null || options === undefined ? undefined : options.scopes) {
17538
17720
  urlParams.push(`scopes=${encodeURIComponent(options.scopes)}`);
17539
17721
  }
17540
- if (this.flowType === "pkce") {
17541
- const [codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey);
17722
+ if (codeChallenge != null && codeChallengeMethod != null) {
17542
17723
  const flowParams = new URLSearchParams({
17543
17724
  code_challenge: `${encodeURIComponent(codeChallenge)}`,
17544
17725
  code_challenge_method: `${encodeURIComponent(codeChallengeMethod)}`
@@ -17552,7 +17733,16 @@ var require_GoTrueClient = __commonJS((exports) => {
17552
17733
  if (options === null || options === undefined ? undefined : options.skipBrowserRedirect) {
17553
17734
  urlParams.push(`skip_http_redirect=${options.skipBrowserRedirect}`);
17554
17735
  }
17555
- return `${url}?${urlParams.join("&")}`;
17736
+ return { url: `${url}?${urlParams.join("&")}`, flowId };
17737
+ }
17738
+ _maybeAppendFlowIdToRedirect(redirectTo, flowId) {
17739
+ if (!redirectTo || !flowId || !this.experimental.appendPkceFlowIdToRedirects) {
17740
+ return redirectTo !== null && redirectTo !== undefined ? redirectTo : undefined;
17741
+ }
17742
+ return (0, helpers_1.appendFlowIdToRedirectTo)(redirectTo, flowId);
17743
+ }
17744
+ async _getCodeChallengeAndMethod(isPasswordRecovery = false) {
17745
+ return (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey, isPasswordRecovery, (evictedFlowId) => this._debug("#_getCodeChallengeAndMethod()", "evicted oldest pending PKCE verifier slot", evictedFlowId));
17556
17746
  }
17557
17747
  async _unenroll(params) {
17558
17748
  try {
@@ -18258,7 +18448,7 @@ var require_GoTrueClient = __commonJS((exports) => {
18258
18448
  exports.default = GoTrueClient;
18259
18449
  });
18260
18450
 
18261
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js
18451
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js
18262
18452
  var require_AuthAdminApi = __commonJS((exports) => {
18263
18453
  Object.defineProperty(exports, "__esModule", { value: true });
18264
18454
  var tslib_1 = require_tslib();
@@ -18267,7 +18457,7 @@ var require_AuthAdminApi = __commonJS((exports) => {
18267
18457
  exports.default = AuthAdminApi;
18268
18458
  });
18269
18459
 
18270
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/AuthClient.js
18460
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/AuthClient.js
18271
18461
  var require_AuthClient = __commonJS((exports) => {
18272
18462
  Object.defineProperty(exports, "__esModule", { value: true });
18273
18463
  var tslib_1 = require_tslib();
@@ -18276,7 +18466,7 @@ var require_AuthClient = __commonJS((exports) => {
18276
18466
  exports.default = AuthClient;
18277
18467
  });
18278
18468
 
18279
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/index.js
18469
+ // ../../node_modules/.bun/@supabase+auth-js@2.111.0/node_modules/@supabase/auth-js/dist/main/index.js
18280
18470
  var require_main3 = __commonJS((exports) => {
18281
18471
  Object.defineProperty(exports, "__esModule", { value: true });
18282
18472
  exports.processLock = exports.lockInternals = exports.NavigatorLockAcquireTimeoutError = exports.navigatorLock = exports.AuthClient = exports.AuthAdminApi = exports.GoTrueClient = exports.GoTrueAdminApi = undefined;
@@ -18306,7 +18496,7 @@ var require_main3 = __commonJS((exports) => {
18306
18496
  } });
18307
18497
  });
18308
18498
 
18309
- // ../../node_modules/.bun/@supabase+supabase-js@2.110.2/node_modules/@supabase/supabase-js/dist/index.mjs
18499
+ // ../../node_modules/.bun/@supabase+supabase-js@2.111.0/node_modules/@supabase/supabase-js/dist/index.mjs
18310
18500
  var exports_dist = {};
18311
18501
  __export(exports_dist, {
18312
18502
  createClient: () => createClient,
@@ -18554,7 +18744,7 @@ function validateSupabaseUrl(supabaseUrl) {
18554
18744
  }
18555
18745
  }
18556
18746
  function shouldShowDeprecationWarning() {
18557
- if (typeof window !== "undefined")
18747
+ if (typeof window !== "undefined" || globalThis["Deno"] !== undefined)
18558
18748
  return false;
18559
18749
  const _process = globalThis["process"];
18560
18750
  if (!_process)
@@ -18567,26 +18757,38 @@ function shouldShowDeprecationWarning() {
18567
18757
  return false;
18568
18758
  return parseInt(versionMatch[1], 10) <= 20;
18569
18759
  }
18570
- var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2", JS_ENV = "", JS_RUNTIME_VERSION, _Deno$version, _process$version, _runtimeMeta, DEFAULT_HEADERS2, DEFAULT_GLOBAL_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_AUTH_OPTIONS, DEFAULT_REALTIME_OPTIONS, DEFAULT_TRACE_PROPAGATION_OPTIONS, otelModulePromise = null, OTEL_PKG = "@opentelemetry/api", resolveFetch2 = (customFetch) => {
18760
+ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.111.0", JS_ENV = "", JS_RUNTIME_VERSION, _Deno$version, _process$version, _runtimeMeta, DEFAULT_HEADERS2, DEFAULT_GLOBAL_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_AUTH_OPTIONS, DEFAULT_REALTIME_OPTIONS, DEFAULT_TRACE_PROPAGATION_OPTIONS, otelModulePromise = null, OTEL_PKG = "@opentelemetry/api", resolveFetch2 = (customFetch) => {
18571
18761
  if (customFetch)
18572
18762
  return (...args) => customFetch(...args);
18573
18763
  return (...args) => fetch(...args);
18574
18764
  }, resolveHeadersConstructor = () => {
18575
18765
  return Headers;
18576
- }, fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tracePropagationOptions) => {
18766
+ }, isNewApiKey = (key) => key.startsWith("sb_publishable_") || key.startsWith("sb_secret_"), TEMP_KEY_PREFIX = "sb_temp_", warnedKeySubtypes, checkApiKeyFormat = (key) => {
18767
+ var _key$match$, _key$match;
18768
+ if (!key.startsWith("sb_") || isNewApiKey(key) || key.startsWith(TEMP_KEY_PREFIX))
18769
+ return;
18770
+ const subtype = (_key$match$ = (_key$match = key.match(/^sb_[a-zA-Z0-9]+_/)) === null || _key$match === undefined ? undefined : _key$match[0]) !== null && _key$match$ !== undefined ? _key$match$ : "unknown";
18771
+ if (warnedKeySubtypes.has(subtype))
18772
+ return;
18773
+ warnedKeySubtypes.add(subtype);
18774
+ console.warn("@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type.");
18775
+ }, fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tracePropagationOptions, options) => {
18577
18776
  const fetch$1 = resolveFetch2(customFetch);
18578
18777
  const HeadersConstructor = resolveHeadersConstructor();
18579
18778
  const traceEnabled = (tracePropagationOptions === null || tracePropagationOptions === undefined ? undefined : tracePropagationOptions.enabled) === true;
18580
18779
  const respectSampling = (tracePropagationOptions === null || tracePropagationOptions === undefined ? undefined : tracePropagationOptions.respectSamplingDecision) !== false;
18581
18780
  const traceTargets = traceEnabled ? getDefaultPropagationTargets(supabaseUrl) : null;
18781
+ const allowKeyAsBearer = !((options === null || options === undefined ? undefined : options.omitApiKeyAsBearer) && isNewApiKey(supabaseKey));
18582
18782
  return async (input, init) => {
18583
- var _await$getAccessToken;
18584
- const accessToken = (_await$getAccessToken = await getAccessToken()) !== null && _await$getAccessToken !== undefined ? _await$getAccessToken : supabaseKey;
18783
+ const realToken = await getAccessToken();
18585
18784
  let headers = new HeadersConstructor(init === null || init === undefined ? undefined : init.headers);
18586
18785
  if (!headers.has("apikey"))
18587
18786
  headers.set("apikey", supabaseKey);
18588
- if (!headers.has("Authorization"))
18589
- headers.set("Authorization", `Bearer ${accessToken}`);
18787
+ if (!headers.has("Authorization")) {
18788
+ const bearer = realToken !== null && realToken !== undefined ? realToken : allowKeyAsBearer ? supabaseKey : null;
18789
+ if (bearer)
18790
+ headers.set("Authorization", `Bearer ${bearer}`);
18791
+ }
18590
18792
  if (traceTargets) {
18591
18793
  const traceHeaders = await getTraceHeaders(input, traceTargets, respectSampling);
18592
18794
  if (traceHeaders) {
@@ -18608,6 +18810,7 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18608
18810
  const baseUrl = validateSupabaseUrl(supabaseUrl);
18609
18811
  if (!supabaseKey)
18610
18812
  throw new Error("supabaseKey is required.");
18813
+ checkApiKeyFormat(supabaseKey);
18611
18814
  this.realtimeUrl = new URL("realtime/v1", baseUrl);
18612
18815
  this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace("http", "ws");
18613
18816
  this.authUrl = new URL("auth/v1", baseUrl);
@@ -18634,7 +18837,8 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18634
18837
  throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(prop)} is not possible`);
18635
18838
  } });
18636
18839
  }
18637
- this.fetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getAccessToken.bind(this), settings.global.fetch, settings.tracePropagation);
18840
+ this.fetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getSessionToken.bind(this), settings.global.fetch, settings.tracePropagation);
18841
+ this.functionsFetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getSessionToken.bind(this), settings.global.fetch, settings.tracePropagation, { omitApiKeyAsBearer: true });
18638
18842
  this.realtime = this._initRealtimeClient(_objectSpread23({
18639
18843
  headers: this.headers,
18640
18844
  accessToken: this._getAccessToken.bind(this),
@@ -18656,7 +18860,7 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18656
18860
  get functions() {
18657
18861
  return new import_functions_js.FunctionsClient(this.functionsUrl.href, {
18658
18862
  headers: this.headers,
18659
- customFetch: this.fetch
18863
+ customFetch: this.functionsFetch
18660
18864
  });
18661
18865
  }
18662
18866
  from(relation) {
@@ -18684,13 +18888,18 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18684
18888
  removeAllChannels() {
18685
18889
  return this.realtime.removeAllChannels();
18686
18890
  }
18687
- async _getAccessToken() {
18891
+ async _getSessionToken() {
18688
18892
  var _this = this;
18689
18893
  var _data$session$access_, _data$session;
18690
18894
  if (_this.accessToken)
18691
18895
  return await _this.accessToken();
18692
18896
  const { data } = await _this.auth.getSession();
18693
- return (_data$session$access_ = (_data$session = data.session) === null || _data$session === undefined ? undefined : _data$session.access_token) !== null && _data$session$access_ !== undefined ? _data$session$access_ : _this.supabaseKey;
18897
+ return (_data$session$access_ = (_data$session = data.session) === null || _data$session === undefined ? undefined : _data$session.access_token) !== null && _data$session$access_ !== undefined ? _data$session$access_ : null;
18898
+ }
18899
+ async _getAccessToken() {
18900
+ var _this2 = this;
18901
+ var _await$this$_getSessi;
18902
+ return (_await$this$_getSessi = await _this2._getSessionToken()) !== null && _await$this$_getSessi !== undefined ? _await$this$_getSessi : _this2.supabaseKey;
18694
18903
  }
18695
18904
  _initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, storage, userStorage, storageKey, flowType, lock, debug, throwOnError, experimental, lockAcquireTimeout, skipAutoInitialize }, headers, fetch$1) {
18696
18905
  const authHeaders = {
@@ -18726,7 +18935,7 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18726
18935
  });
18727
18936
  }
18728
18937
  _handleTokenChanged(event, source, token) {
18729
- if ((event === "TOKEN_REFRESHED" || event === "SIGNED_IN") && this.changedAccessToken !== token) {
18938
+ if ((event === "TOKEN_REFRESHED" || event === "SIGNED_IN" || event === "INITIAL_SESSION") && this.changedAccessToken !== token) {
18730
18939
  this.changedAccessToken = token;
18731
18940
  this.realtime.setAuth(token);
18732
18941
  } else if (event === "SIGNED_OUT") {
@@ -18756,7 +18965,8 @@ var init_dist4 = __esm(() => {
18756
18965
  JS_ENV = "react-native";
18757
18966
  else {
18758
18967
  JS_ENV = "node";
18759
- JS_RUNTIME_VERSION = typeof process !== "undefined" ? (_process$version = process.version) === null || _process$version === undefined ? undefined : _process$version.replace(/^v/, "") : undefined;
18968
+ const _process = globalThis["process"];
18969
+ JS_RUNTIME_VERSION = _process === null || _process === undefined || (_process$version = _process["version"]) === null || _process$version === undefined ? undefined : _process$version.replace(/^v/, "");
18760
18970
  }
18761
18971
  _runtimeMeta = [`runtime=${JS_ENV}`];
18762
18972
  if (JS_RUNTIME_VERSION)
@@ -18775,6 +18985,7 @@ var init_dist4 = __esm(() => {
18775
18985
  enabled: false,
18776
18986
  respectSamplingDecision: true
18777
18987
  };
18988
+ warnedKeySubtypes = /* @__PURE__ */ new Set;
18778
18989
  SupabaseAuthClient = class extends import_auth_js.AuthClient {
18779
18990
  constructor(options) {
18780
18991
  super(options);
@@ -58793,7 +59004,7 @@ var init_v4_mini = __esm(() => {
58793
59004
  init_mini();
58794
59005
  });
58795
59006
 
58796
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
59007
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
58797
59008
  function isZ4Schema(s) {
58798
59009
  const schema = s;
58799
59010
  return !!schema._zod;
@@ -59600,7 +59811,7 @@ var init_v4 = __esm(() => {
59600
59811
  init_classic();
59601
59812
  });
59602
59813
 
59603
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
59814
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
59604
59815
  var LATEST_PROTOCOL_VERSION = "2025-11-25", SUPPORTED_PROTOCOL_VERSIONS, RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task", JSONRPC_VERSION = "2.0", AssertObjectSchema, ProgressTokenSchema, CursorSchema, TaskCreationParamsSchema, TaskMetadataSchema, RelatedTaskMetadataSchema, RequestMetaSchema, BaseRequestParamsSchema, TaskAugmentedRequestParamsSchema, isTaskAugmentedRequestParams = (value) => TaskAugmentedRequestParamsSchema.safeParse(value).success, RequestSchema, NotificationsParamsSchema, NotificationSchema, ResultSchema, RequestIdSchema, JSONRPCRequestSchema, isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success, JSONRPCNotificationSchema, isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success, JSONRPCResultResponseSchema, isJSONRPCResultResponse = (value) => JSONRPCResultResponseSchema.safeParse(value).success, ErrorCode, JSONRPCErrorResponseSchema, isJSONRPCErrorResponse = (value) => JSONRPCErrorResponseSchema.safeParse(value).success, JSONRPCMessageSchema, JSONRPCResponseSchema, EmptyResultSchema, CancelledNotificationParamsSchema, CancelledNotificationSchema, IconSchema, IconsSchema, BaseMetadataSchema, ImplementationSchema, FormElicitationCapabilitySchema, ElicitationCapabilitySchema, ClientTasksCapabilitySchema, ServerTasksCapabilitySchema, ClientCapabilitiesSchema, InitializeRequestParamsSchema, InitializeRequestSchema, ServerCapabilitiesSchema, InitializeResultSchema, InitializedNotificationSchema, PingRequestSchema, ProgressSchema, ProgressNotificationParamsSchema, ProgressNotificationSchema, PaginatedRequestParamsSchema, PaginatedRequestSchema, PaginatedResultSchema, TaskStatusSchema, TaskSchema, CreateTaskResultSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, GetTaskPayloadResultSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, ResourceContentsSchema, TextResourceContentsSchema, Base64Schema, BlobResourceContentsSchema, RoleSchema, AnnotationsSchema, ResourceSchema, ResourceTemplateSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ResourceRequestParamsSchema, ReadResourceRequestParamsSchema, ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, SubscribeRequestParamsSchema, SubscribeRequestSchema, UnsubscribeRequestParamsSchema, UnsubscribeRequestSchema, ResourceUpdatedNotificationParamsSchema, ResourceUpdatedNotificationSchema, PromptArgumentSchema, PromptSchema, ListPromptsRequestSchema, ListPromptsResultSchema, GetPromptRequestParamsSchema, GetPromptRequestSchema, TextContentSchema, ImageContentSchema, AudioContentSchema, ToolUseContentSchema, EmbeddedResourceSchema, ResourceLinkSchema, ContentBlockSchema, PromptMessageSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ToolAnnotationsSchema, ToolExecutionSchema, ToolSchema, ListToolsRequestSchema, ListToolsResultSchema, CallToolResultSchema, CompatibilityCallToolResultSchema, CallToolRequestParamsSchema, CallToolRequestSchema, ToolListChangedNotificationSchema, ListChangedOptionsBaseSchema, LoggingLevelSchema, SetLevelRequestParamsSchema, SetLevelRequestSchema, LoggingMessageNotificationParamsSchema, LoggingMessageNotificationSchema, ModelHintSchema, ModelPreferencesSchema, ToolChoiceSchema, ToolResultContentSchema, SamplingContentSchema, SamplingMessageContentBlockSchema, SamplingMessageSchema, CreateMessageRequestParamsSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema, LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema, EnumSchemaSchema, PrimitiveSchemaDefinitionSchema, ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema, ElicitRequestParamsSchema, ElicitRequestSchema, ElicitationCompleteNotificationParamsSchema, ElicitationCompleteNotificationSchema, ElicitResultSchema, ResourceTemplateReferenceSchema, PromptReferenceSchema, CompleteRequestParamsSchema, CompleteRequestSchema, CompleteResultSchema, RootSchema, ListRootsRequestSchema, ListRootsResultSchema, RootsListChangedNotificationSchema, ClientRequestSchema, ClientNotificationSchema, ClientResultSchema, ServerRequestSchema, ServerNotificationSchema, ServerResultSchema, McpError, UrlElicitationRequiredError;
59605
59816
  var init_types4 = __esm(() => {
59606
59817
  init_v4();
@@ -60428,7 +60639,7 @@ var init_types4 = __esm(() => {
60428
60639
  };
60429
60640
  });
60430
60641
 
60431
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
60642
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
60432
60643
  function isTerminal(status) {
60433
60644
  return status === "completed" || status === "failed" || status === "cancelled";
60434
60645
  }
@@ -60646,7 +60857,7 @@ var init_esm = __esm(() => {
60646
60857
  init_zodToJsonSchema();
60647
60858
  });
60648
60859
 
60649
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
60860
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
60650
60861
  function getMethodLiteral(schema) {
60651
60862
  const shape = getObjectShape(schema);
60652
60863
  const methodSchema = shape?.method;
@@ -60671,7 +60882,7 @@ var init_zod_json_schema_compat = __esm(() => {
60671
60882
  init_esm();
60672
60883
  });
60673
60884
 
60674
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
60885
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
60675
60886
  class Protocol {
60676
60887
  constructor(_options) {
60677
60888
  this._options = _options;
@@ -64518,7 +64729,7 @@ var require_data = __commonJS((exports, module) => {
64518
64729
  };
64519
64730
  });
64520
64731
 
64521
- // ../../node_modules/.bun/fast-uri@3.1.3/node_modules/fast-uri/lib/utils.js
64732
+ // ../../node_modules/.bun/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js
64522
64733
  var require_utils2 = __commonJS((exports, module) => {
64523
64734
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
64524
64735
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
@@ -64829,7 +65040,7 @@ var require_utils2 = __commonJS((exports, module) => {
64829
65040
  };
64830
65041
  });
64831
65042
 
64832
- // ../../node_modules/.bun/fast-uri@3.1.3/node_modules/fast-uri/lib/schemes.js
65043
+ // ../../node_modules/.bun/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js
64833
65044
  var require_schemes = __commonJS((exports, module) => {
64834
65045
  var { isUUID } = require_utils2();
64835
65046
  var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
@@ -65003,7 +65214,7 @@ var require_schemes = __commonJS((exports, module) => {
65003
65214
  };
65004
65215
  });
65005
65216
 
65006
- // ../../node_modules/.bun/fast-uri@3.1.3/node_modules/fast-uri/index.js
65217
+ // ../../node_modules/.bun/fast-uri@3.1.5/node_modules/fast-uri/index.js
65007
65218
  var require_fast_uri = __commonJS((exports, module) => {
65008
65219
  var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils2();
65009
65220
  var { SCHEMES, getSchemeHandler } = require_schemes();
@@ -65017,7 +65228,12 @@ var require_fast_uri = __commonJS((exports, module) => {
65017
65228
  }
65018
65229
  function resolve4(baseURI, relativeURI, options) {
65019
65230
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
65020
- const resolved = resolveComponent(parse8(baseURI, schemelessOptions), parse8(relativeURI, schemelessOptions), schemelessOptions, true);
65231
+ const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
65232
+ const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
65233
+ if (baseMalformed || relativeMalformed) {
65234
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
65235
+ }
65236
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
65021
65237
  schemelessOptions.skipEscape = true;
65022
65238
  return serialize(resolved, schemelessOptions);
65023
65239
  }
@@ -65143,6 +65359,8 @@ var require_fast_uri = __commonJS((exports, module) => {
65143
65359
  return uriTokens.join("");
65144
65360
  }
65145
65361
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
65362
+ var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
65363
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
65146
65364
  function getParseError(parsed, matches) {
65147
65365
  if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
65148
65366
  return 'URI path must start with "/" when authority is present.';
@@ -65172,6 +65390,25 @@ var require_fast_uri = __commonJS((exports, module) => {
65172
65390
  uri = "//" + uri;
65173
65391
  }
65174
65392
  }
65393
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
65394
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
65395
+ parsed.error = "URI authority must not contain a literal backslash.";
65396
+ malformedAuthorityOrPort = true;
65397
+ }
65398
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
65399
+ if (introducerMatch !== null) {
65400
+ const region = introducerMatch[1];
65401
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
65402
+ if (normalizedRegion.length >= 2) {
65403
+ if (normalizedRegion.slice(0, 2) !== "//") {
65404
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
65405
+ malformedAuthorityOrPort = true;
65406
+ } else if (region.length !== normalizedRegion.length) {
65407
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
65408
+ malformedAuthorityOrPort = true;
65409
+ }
65410
+ }
65411
+ }
65175
65412
  const matches = uri.match(URI_PARSE);
65176
65413
  if (matches) {
65177
65414
  parsed.scheme = matches[1];
@@ -68075,7 +68312,7 @@ var require_dist3 = __commonJS((exports, module) => {
68075
68312
  exports.default = formatsPlugin;
68076
68313
  });
68077
68314
 
68078
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
68315
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
68079
68316
  function createDefaultAjvInstance() {
68080
68317
  const ajv = new import_ajv.default({
68081
68318
  strict: false,
@@ -68118,7 +68355,7 @@ var init_ajv_provider = __esm(() => {
68118
68355
  import_ajv_formats = __toESM(require_dist3(), 1);
68119
68356
  });
68120
68357
 
68121
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
68358
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
68122
68359
  class ExperimentalServerTasks {
68123
68360
  constructor(_server) {
68124
68361
  this._server = _server;
@@ -68199,7 +68436,7 @@ var init_server = __esm(() => {
68199
68436
  init_types4();
68200
68437
  });
68201
68438
 
68202
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
68439
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
68203
68440
  function assertToolsCallTaskCapability(requests, method, entityName) {
68204
68441
  if (!requests) {
68205
68442
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -68234,7 +68471,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
68234
68471
  }
68235
68472
  }
68236
68473
 
68237
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
68474
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
68238
68475
  var Server;
68239
68476
  var init_server2 = __esm(() => {
68240
68477
  init_protocol();
@@ -68289,16 +68526,7 @@ var init_server2 = __esm(() => {
68289
68526
  if (!methodSchema) {
68290
68527
  throw new Error("Schema is missing a method literal");
68291
68528
  }
68292
- let methodValue;
68293
- if (isZ4Schema(methodSchema)) {
68294
- const v4Schema = methodSchema;
68295
- const v4Def = v4Schema._zod?.def;
68296
- methodValue = v4Def?.value ?? v4Schema.value;
68297
- } else {
68298
- const v3Schema = methodSchema;
68299
- const legacyDef = v3Schema._def;
68300
- methodValue = legacyDef?.value ?? v3Schema.value;
68301
- }
68529
+ const methodValue = getLiteralValue(methodSchema);
68302
68530
  if (typeof methodValue !== "string") {
68303
68531
  throw new Error("Schema method literal must be a string");
68304
68532
  }
@@ -68575,9 +68803,17 @@ var init_server2 = __esm(() => {
68575
68803
  };
68576
68804
  });
68577
68805
 
68578
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
68806
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
68579
68807
  class ReadBuffer {
68808
+ constructor(options) {
68809
+ this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
68810
+ }
68580
68811
  append(chunk) {
68812
+ const newSize = (this._buffer?.length ?? 0) + chunk.length;
68813
+ if (newSize > this._maxBufferSize) {
68814
+ this.clear();
68815
+ throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
68816
+ }
68581
68817
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
68582
68818
  }
68583
68819
  readMessage() {
@@ -68604,26 +68840,33 @@ function serializeMessage(message) {
68604
68840
  return JSON.stringify(message) + `
68605
68841
  `;
68606
68842
  }
68843
+ var STDIO_DEFAULT_MAX_BUFFER_SIZE;
68607
68844
  var init_stdio = __esm(() => {
68608
68845
  init_types4();
68846
+ STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
68609
68847
  });
68610
68848
 
68611
- // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.29.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
68849
+ // ../../node_modules/.bun/@modelcontextprotocol+sdk@1.30.0+759ce506b1ed1a42/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
68612
68850
  import process9 from "node:process";
68613
68851
 
68614
68852
  class StdioServerTransport {
68615
- constructor(_stdin = process9.stdin, _stdout = process9.stdout) {
68853
+ constructor(_stdin = process9.stdin, _stdout = process9.stdout, options) {
68616
68854
  this._stdin = _stdin;
68617
68855
  this._stdout = _stdout;
68618
- this._readBuffer = new ReadBuffer;
68619
68856
  this._started = false;
68620
68857
  this._ondata = (chunk) => {
68621
- this._readBuffer.append(chunk);
68622
- this.processReadBuffer();
68858
+ try {
68859
+ this._readBuffer.append(chunk);
68860
+ this.processReadBuffer();
68861
+ } catch (error3) {
68862
+ this.onerror?.(error3);
68863
+ this.close().catch(() => {});
68864
+ }
68623
68865
  };
68624
68866
  this._onerror = (error3) => {
68625
68867
  this.onerror?.(error3);
68626
68868
  };
68869
+ this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
68627
68870
  }
68628
68871
  async start() {
68629
68872
  if (this._started) {
@@ -69205,7 +69448,7 @@ import { homedir as homedir4, platform } from "node:os";
69205
69448
  import { dirname, join as join4 } from "node:path";
69206
69449
  import { spawnSync } from "node:child_process";
69207
69450
 
69208
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/date.js
69451
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/date.js
69209
69452
  /*!
69210
69453
  * Copyright (c) Squirrel Chat et al., All rights reserved.
69211
69454
  * SPDX-License-Identifier: BSD-3-Clause
@@ -69325,7 +69568,7 @@ class TomlDate extends Date {
69325
69568
  }
69326
69569
  }
69327
69570
 
69328
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/error.js
69571
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/error.js
69329
69572
  /*!
69330
69573
  * Copyright (c) Squirrel Chat et al., All rights reserved.
69331
69574
  * SPDX-License-Identifier: BSD-3-Clause
@@ -69395,7 +69638,7 @@ ${codeblock}`, options);
69395
69638
  }
69396
69639
  }
69397
69640
 
69398
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/primitive.js
69641
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/primitive.js
69399
69642
  /*!
69400
69643
  * Copyright (c) Squirrel Chat et al., All rights reserved.
69401
69644
  * SPDX-License-Identifier: BSD-3-Clause
@@ -69575,7 +69818,7 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
69575
69818
  return date;
69576
69819
  }
69577
69820
 
69578
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/util.js
69821
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/util.js
69579
69822
  /*!
69580
69823
  * Copyright (c) Squirrel Chat et al., All rights reserved.
69581
69824
  * SPDX-License-Identifier: BSD-3-Clause
@@ -69650,6 +69893,8 @@ function skipUntil(str, ptr, sep, end, banNewLines = false) {
69650
69893
  let c2 = str[i];
69651
69894
  if (c2 === "#") {
69652
69895
  i = indexOfNewline(str, i);
69896
+ if (i < 0)
69897
+ break;
69653
69898
  } else if (c2 === sep) {
69654
69899
  return i + 1;
69655
69900
  } else if (c2 === end || banNewLines && (c2 === `
@@ -69664,7 +69909,7 @@ function skipUntil(str, ptr, sep, end, banNewLines = false) {
69664
69909
  });
69665
69910
  }
69666
69911
 
69667
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/extract.js
69912
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/extract.js
69668
69913
  /*!
69669
69914
  * Copyright (c) Squirrel Chat et al., All rights reserved.
69670
69915
  * SPDX-License-Identifier: BSD-3-Clause
@@ -69759,7 +70004,7 @@ function extractValue(str, ptr, end, depth, integersAsBigInt) {
69759
70004
  ];
69760
70005
  }
69761
70006
 
69762
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/struct.js
70007
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/struct.js
69763
70008
  /*!
69764
70009
  * Copyright (c) Squirrel Chat et al., All rights reserved.
69765
70010
  * SPDX-License-Identifier: BSD-3-Clause
@@ -69930,7 +70175,7 @@ function parseArray(str, ptr, depth, integersAsBigInt) {
69930
70175
  return [res, ptr];
69931
70176
  }
69932
70177
 
69933
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/parse.js
70178
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/parse.js
69934
70179
  /*!
69935
70180
  * Copyright (c) Squirrel Chat et al., All rights reserved.
69936
70181
  * SPDX-License-Identifier: BSD-3-Clause
@@ -70071,7 +70316,7 @@ function parse(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
70071
70316
  return res;
70072
70317
  }
70073
70318
 
70074
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/stringify.js
70319
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/stringify.js
70075
70320
  /*!
70076
70321
  * Copyright (c) Squirrel Chat et al., All rights reserved.
70077
70322
  * SPDX-License-Identifier: BSD-3-Clause
@@ -70245,7 +70490,7 @@ function stringify(obj2, { maxDepth = 1000, numbersAsFloat = false } = {}) {
70245
70490
  return str;
70246
70491
  }
70247
70492
 
70248
- // ../../node_modules/.bun/smol-toml@1.7.0/node_modules/smol-toml/dist/index.js
70493
+ // ../../node_modules/.bun/smol-toml@1.7.1/node_modules/smol-toml/dist/index.js
70249
70494
  /*!
70250
70495
  * Copyright (c) Squirrel Chat et al., All rights reserved.
70251
70496
  * SPDX-License-Identifier: BSD-3-Clause
@@ -70850,6 +71095,14 @@ async function action9(options) {
70850
71095
  }
70851
71096
  println(c.green(`
70852
71097
  ✓ All prerequisites satisfied.`));
71098
+ if (doFunctions && process.platform === "darwin" && !process.env.SUPABASE_ACCESS_TOKEN) {
71099
+ println(c.cyan(`
71100
+ ℹ Heads-up (macOS): the Supabase CLI will read its login token from the
71101
+ ` + ` Keychain — expect a password dialog per function (click "Always Allow").
71102
+ ` + ` To skip the dialogs entirely, put a personal access token
71103
+ ` + ` (supabase.com/dashboard/account/tokens) in ~/.cerefox/.env:
71104
+ ` + " SUPABASE_ACCESS_TOKEN=sbp_…"));
71105
+ }
70853
71106
  let schemaMode = "unknown";
70854
71107
  let pending = [];
70855
71108
  if (doSchema) {
@@ -70892,11 +71145,13 @@ Plan:`));
70892
71145
  ⚠ --dry-run: nothing was deployed.`));
70893
71146
  process.exit(0);
70894
71147
  }
70895
- const proceed = await confirm(`
71148
+ if (!options.yes) {
71149
+ const proceed = await confirm(`
70896
71150
  Proceed with deployment to Supabase?`, true);
70897
- if (!proceed) {
70898
- println(c.dim("Aborted."));
70899
- process.exit(0);
71151
+ if (!proceed) {
71152
+ println(c.dim("Aborted."));
71153
+ process.exit(0);
71154
+ }
70900
71155
  }
70901
71156
  if (doSchema) {
70902
71157
  if (schemaMode === "fresh") {
@@ -70997,7 +71252,7 @@ Proceed with deployment to Supabase?`, true);
70997
71252
  println(c.dim("Verify with: cerefox doctor"));
70998
71253
  }
70999
71254
  function registerDeployServer(program2) {
71000
- program2.command("deploy-server").description("Deploy/update the Cerefox server side (schema + RPCs + Edge Functions) on Supabase.").option("--dry-run", "Print the plan + pre-flight without deploying.").option("--schema-only", "Deploy/update only the schema + RPCs (skip Edge Functions).").option("--functions-only", "Deploy only the Edge Functions (skip the schema/RPCs).").option("--project-ref <ref>", "Supabase project ref for Edge Function deploys (default: derived from CEREFOX_SUPABASE_URL).").action(action9);
71255
+ program2.command("deploy-server").description("Deploy/update the Cerefox server side (schema + RPCs + Edge Functions) on Supabase.").option("--dry-run", "Print the plan + pre-flight without deploying.").option("--schema-only", "Deploy/update only the schema + RPCs (skip Edge Functions).").option("--functions-only", "Deploy only the Edge Functions (skip the schema/RPCs).").option("--project-ref <ref>", "Supabase project ref for Edge Function deploys (default: derived from CEREFOX_SUPABASE_URL).").option("--yes", "Non-interactive (skip the deployment confirmation).").action(action9);
71001
71256
  }
71002
71257
 
71003
71258
  // src/cli/commands/document-edit.ts
@@ -71057,6 +71312,9 @@ async function action10(documentId, options) {
71057
71312
  }
71058
71313
  const author = resolveAuthor(options.author);
71059
71314
  const authorType = resolveAuthorType(options.authorType);
71315
+ if (author === "unknown") {
71316
+ warn("No --author / CEREFOX_AUTHOR_NAME set — audit log will record this write as 'unknown'.");
71317
+ }
71060
71318
  await client.raw.rpc("cerefox_create_audit_entry", {
71061
71319
  p_document_id: documentId,
71062
71320
  p_operation: "update-metadata",
@@ -71251,6 +71509,9 @@ async function setArchived(versionId, archived, options) {
71251
71509
  throw notFound(`Version ${versionId} not found.`);
71252
71510
  const author = resolveAuthor(options.author);
71253
71511
  const authorType = resolveAuthorType(options.authorType);
71512
+ if (author === "unknown") {
71513
+ warn("No --author / CEREFOX_AUTHOR_NAME set — audit log will record this write as 'unknown'.");
71514
+ }
71254
71515
  const op = archived ? "archive" : "unarchive";
71255
71516
  await client.raw.rpc("cerefox_create_audit_entry", {
71256
71517
  p_document_id: data.document_id,
@@ -73801,7 +74062,7 @@ __export(exports_symbols, {
73801
74062
  error: () => error
73802
74063
  });
73803
74064
 
73804
- // ../../node_modules/.bun/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
74065
+ // ../../node_modules/.bun/yoctocolors@2.2.0/node_modules/yoctocolors/base.js
73805
74066
  import tty2 from "node:tty";
73806
74067
  var hasColors = tty2?.WriteStream?.prototype?.hasColors?.() ?? false;
73807
74068
  var format = (open, close) => {
@@ -73834,6 +74095,10 @@ var bold = format(1, 22);
73834
74095
  var dim = format(2, 22);
73835
74096
  var italic = format(3, 23);
73836
74097
  var underline = format(4, 24);
74098
+ var underlineDouble = format("4:2", 24);
74099
+ var underlineCurly = format("4:3", 24);
74100
+ var underlineDotted = format("4:4", 24);
74101
+ var underlineDashed = format("4:5", 24);
73837
74102
  var overline = format(53, 55);
73838
74103
  var inverse = format(7, 27);
73839
74104
  var hidden = format(8, 28);
@@ -73870,6 +74135,22 @@ var bgBlueBright = format(104, 49);
73870
74135
  var bgMagentaBright = format(105, 49);
73871
74136
  var bgCyanBright = format(106, 49);
73872
74137
  var bgWhiteBright = format(107, 49);
74138
+ var underlineBlack = format("58;5;0", 59);
74139
+ var underlineRed = format("58;5;1", 59);
74140
+ var underlineGreen = format("58;5;2", 59);
74141
+ var underlineYellow = format("58;5;3", 59);
74142
+ var underlineBlue = format("58;5;4", 59);
74143
+ var underlineMagenta = format("58;5;5", 59);
74144
+ var underlineCyan = format("58;5;6", 59);
74145
+ var underlineWhite = format("58;5;7", 59);
74146
+ var underlineGray = format("58;5;8", 59);
74147
+ var underlineRedBright = format("58;5;9", 59);
74148
+ var underlineGreenBright = format("58;5;10", 59);
74149
+ var underlineYellowBright = format("58;5;11", 59);
74150
+ var underlineBlueBright = format("58;5;12", 59);
74151
+ var underlineMagentaBright = format("58;5;13", 59);
74152
+ var underlineCyanBright = format("58;5;14", 59);
74153
+ var underlineWhiteBright = format("58;5;15", 59);
73873
74154
 
73874
74155
  // ../../node_modules/.bun/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
73875
74156
  import process6 from "node:process";
@@ -74660,7 +74941,7 @@ import { homedir as homedir6 } from "node:os";
74660
74941
  import { join as join9 } from "node:path";
74661
74942
 
74662
74943
  // ../../_shared/ef-meta/index.ts
74663
- var EF_VERSION = "1.0.0-rc.4";
74944
+ var EF_VERSION = "1.0.1";
74664
74945
 
74665
74946
  // src/cli/util/checks.ts
74666
74947
  init_config();
@@ -75179,9 +75460,9 @@ async function checkEdgeFunctionsCompat() {
75179
75460
  case "above-min-but-old":
75180
75461
  return {
75181
75462
  name: "edge functions",
75182
- status: "warn",
75183
- detail: `Deployed EF v${deployed} works but is older than the bundled Edge Functions (v${EF_VERSION}).`,
75184
- hint: "Update the Edge Functions (see remediation below)."
75463
+ status: "skipped",
75464
+ detail: `Deployed Edge Functions (v${deployed}) are older than the ones bundled with this client (v${EF_VERSION}). Compatible — nothing is broken — but redeploying ` + `picks up the latest server-side fixes.`,
75465
+ hint: "Redeploy with: cerefox server deploy --functions-only"
75185
75466
  };
75186
75467
  default:
75187
75468
  return {
@@ -76013,8 +76294,9 @@ async function readContent(path, paste) {
76013
76294
  }
76014
76295
  async function action18(path, options) {
76015
76296
  const { content, titleFromPath } = await readContent(path, Boolean(options.paste));
76016
- const title = options.title ?? titleFromPath;
76017
- if (!title || title.trim() === "") {
76297
+ const updatingById = Boolean(options.documentId);
76298
+ let title = options.title ?? (updatingById ? null : titleFromPath);
76299
+ if (title !== null && (!title || title.trim() === "")) {
76018
76300
  throw userError(options.paste ? "--title is required with --paste." : "Cannot derive a title from the file path; pass --title explicitly.");
76019
76301
  }
76020
76302
  const author = resolveAuthor(options.author);
@@ -76039,6 +76321,14 @@ async function action18(path, options) {
76039
76321
  const supabase = createClient(settings.supabaseUrl, settings.supabaseKey, {
76040
76322
  auth: { persistSession: false }
76041
76323
  });
76324
+ if (title === null) {
76325
+ const { data, error: error2 } = await supabase.from("cerefox_documents").select("title").eq("id", options.documentId).maybeSingle();
76326
+ if (error2 || !data?.title) {
76327
+ throw userError(`Could not resolve document ${options.documentId} to keep its title` + `${error2 ? ` (${error2.message})` : ""}.`, "Pass --title explicitly, or check the --document-id.");
76328
+ }
76329
+ title = data.title;
76330
+ println(c.dim(` (keeping existing title: ${JSON.stringify(title)})`));
76331
+ }
76042
76332
  const pipeline = new IngestionPipeline({
76043
76333
  supabase,
76044
76334
  openAiApiKey: settings.openaiApiKey
@@ -76658,38 +76948,34 @@ async function action22(options) {
76658
76948
  }
76659
76949
  projectId = project.id;
76660
76950
  }
76661
- let query = client.raw.from("cerefox_documents").select("id, title, source, metadata, created_at, updated_at, review_status, deleted_at").limit(limit);
76951
+ const docCols = "id, title, source, metadata, created_at, updated_at, review_status, deleted_at";
76952
+ const selectCols = projectId ? `${docCols}, cerefox_document_projects!inner(project_id)` : docCols;
76953
+ let query = client.raw.from("cerefox_documents").select(selectCols).limit(limit);
76662
76954
  query = deleted ? query.not("deleted_at", "is", null).order("deleted_at", { ascending: false, nullsFirst: false }) : query.is("deleted_at", null).order("updated_at", { ascending: false, nullsFirst: false });
76663
76955
  if (projectId) {
76664
- const { data: junctionRows, error: junctionError } = await client.raw.from("cerefox_document_projects").select("document_id").eq("project_id", projectId);
76665
- if (junctionError) {
76666
- throw systemError(`Project membership lookup failed: ${junctionError.message}`);
76667
- }
76668
- const docIds = (junctionRows ?? []).map((r) => r.document_id);
76669
- if (docIds.length === 0) {
76670
- if (options.json) {
76671
- printJson([]);
76672
- } else {
76673
- process.stdout.write(`(no documents in project "${options.project}")
76674
- `);
76675
- }
76676
- return;
76677
- }
76678
- query = query.in("id", docIds);
76956
+ query = query.eq("cerefox_document_projects.project_id", projectId);
76679
76957
  }
76680
76958
  const { data, error: error2 } = await query;
76681
76959
  if (error2) {
76682
76960
  throw systemError(`Could not list documents: ${error2.message}`);
76683
76961
  }
76684
- const rows = data ?? [];
76962
+ const rows = (data ?? []).map((row) => {
76963
+ const { cerefox_document_projects: _junction, ...doc } = row;
76964
+ return doc;
76965
+ });
76685
76966
  if (options.json) {
76686
76967
  printJson(rows);
76687
76968
  return;
76688
76969
  }
76689
76970
  if (rows.length === 0) {
76690
- process.stdout.write(deleted ? `(trash is empty)
76971
+ if (projectId) {
76972
+ process.stdout.write(`(no documents in project "${options.project}")
76973
+ `);
76974
+ } else {
76975
+ process.stdout.write(deleted ? `(trash is empty)
76691
76976
  ` : `(no documents)
76692
76977
  `);
76978
+ }
76693
76979
  return;
76694
76980
  }
76695
76981
  printTable(rows.map((doc) => {
@@ -77354,13 +77640,13 @@ async function action30(options) {
77354
77640
  println("");
77355
77641
  println(c.green(`✓ Upgraded to ${target}.`));
77356
77642
  println("");
77357
- println(c.dim("Refreshing bundled-docs ingest…"));
77358
- try {
77359
- const { runSyncSelfDocs: runSyncSelfDocs2 } = await Promise.resolve().then(() => (init_sync_self_docs(), exports_sync_self_docs));
77360
- await runSyncSelfDocs2({});
77361
- } catch (err) {
77362
- println(cErr.yellow("⚠ ") + `Could not refresh self-docs: ${err instanceof Error ? err.message : String(err)}`);
77363
- println(c.dim(" Run `cerefox sync-self-docs` manually after a successful `cerefox init`."));
77643
+ println(c.dim("Refreshing bundled-docs ingest (using the new version)…"));
77644
+ const sync = spawnSync5(process.execPath, [process.argv[1], "guides", "ingest"], {
77645
+ stdio: "inherit"
77646
+ });
77647
+ if (sync.status !== 0) {
77648
+ println(cErr.yellow("⚠ ") + "Could not refresh self-docs (see output above).");
77649
+ println(c.dim(" Run `cerefox guides ingest` manually after a successful `cerefox init`."));
77364
77650
  }
77365
77651
  }
77366
77652
  function registerSelfUpdate(program2) {
@@ -77598,15 +77884,15 @@ init_sync_self_docs();
77598
77884
  // src/cli/commands/web.ts
77599
77885
  init_cli_core();
77600
77886
 
77601
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
77887
+ // ../../node_modules/.bun/@hono+node-server@2.0.12+711a9a789551665d/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
77602
77888
  var X_ALREADY_SENT = "x-hono-already-sent";
77603
77889
 
77604
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/index.mjs
77890
+ // ../../node_modules/.bun/@hono+node-server@2.0.12+711a9a789551665d/node_modules/@hono/node-server/dist/index.mjs
77605
77891
  import { STATUS_CODES, createServer } from "node:http";
77606
77892
  import { Http2ServerRequest, constants } from "node:http2";
77607
77893
  import { Readable } from "node:stream";
77608
77894
 
77609
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/helper/websocket/index.js
77895
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/helper/websocket/index.js
77610
77896
  var WSContext = class {
77611
77897
  #init;
77612
77898
  constructor(init) {
@@ -77654,7 +77940,7 @@ var defineWebSocketHelper = (handler11) => {
77654
77940
  };
77655
77941
  };
77656
77942
 
77657
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/index.mjs
77943
+ // ../../node_modules/.bun/@hono+node-server@2.0.12+711a9a789551665d/node_modules/@hono/node-server/dist/index.mjs
77658
77944
  var RequestError = class extends Error {
77659
77945
  constructor(message, options) {
77660
77946
  super(message, options);
@@ -77711,6 +77997,62 @@ var newHeadersFromIncoming = (incoming) => {
77711
77997
  return new Headers(headerRecord);
77712
77998
  };
77713
77999
  var wrapBodyStream = Symbol("wrapBodyStream");
78000
+ var byteExactEncodings = new Set([
78001
+ "latin1",
78002
+ "binary",
78003
+ "hex",
78004
+ "base64",
78005
+ "base64url"
78006
+ ]);
78007
+ var isByteExactEncoding = (encoding) => encoding === null || byteExactEncodings.has(encoding);
78008
+ var bodyBufferedBeforeDisconnectKey = Symbol("bodyBufferedBeforeDisconnect");
78009
+ var bodyBufferedLengthBeforeDisconnectKey = Symbol("bodyBufferedLengthBeforeDisconnect");
78010
+ var toBufferChunk = (chunk, encoding) => Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding ?? "utf8");
78011
+ var isRecoverableDisconnectedIncoming = (incoming) => !(incoming instanceof Http2ServerRequest) && !!incoming.complete && !!incoming.readableAborted && typeof incoming.read === "function" && isByteExactEncoding(incoming.readableEncoding);
78012
+ var recordBodyBufferedBeforeDisconnect = (incoming) => {
78013
+ if (incoming.readableDidRead || !isRecoverableDisconnectedIncoming(incoming))
78014
+ return;
78015
+ const incomingWithRecovery = incoming;
78016
+ incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] ??= incoming.readableLength;
78017
+ };
78018
+ var readBodyBufferedBeforeDisconnect = (incoming, chunks) => {
78019
+ if (incoming.readableDidRead && !chunks || !isRecoverableDisconnectedIncoming(incoming))
78020
+ return;
78021
+ const incomingWithRecovery = incoming;
78022
+ if (incomingWithRecovery[bodyBufferedBeforeDisconnectKey] !== undefined)
78023
+ return incomingWithRecovery[bodyBufferedBeforeDisconnectKey];
78024
+ let result;
78025
+ const errored = incoming.errored;
78026
+ if (errored && errored.code !== "ECONNRESET")
78027
+ result = errored;
78028
+ else if (incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] !== undefined && incoming.readableLength !== incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey])
78029
+ result = newBodyUnusableError();
78030
+ else {
78031
+ const bodyChunks = chunks ?? [];
78032
+ const chunk = incoming.read();
78033
+ if (chunk !== null)
78034
+ bodyChunks.push(toBufferChunk(chunk, incoming.readableEncoding));
78035
+ const buffer2 = bodyChunks.length === 1 ? bodyChunks[0] : Buffer.concat(bodyChunks);
78036
+ result = buffer2;
78037
+ const contentLength = incoming.headers["content-length"];
78038
+ if (typeof contentLength === "string" && /^\d+$/.test(contentLength)) {
78039
+ const expectedLength = Number(contentLength);
78040
+ if (Number.isSafeInteger(expectedLength) && buffer2.length !== expectedLength)
78041
+ result = newBodyUnusableError();
78042
+ }
78043
+ }
78044
+ incomingWithRecovery[bodyBufferedBeforeDisconnectKey] = result;
78045
+ return result;
78046
+ };
78047
+ var enqueueBufferedBody = (controller, buffered) => {
78048
+ if (buffered instanceof Error) {
78049
+ controller.error(buffered);
78050
+ return;
78051
+ }
78052
+ if (buffered.length > 0)
78053
+ controller.enqueue(buffered);
78054
+ controller.close();
78055
+ };
77714
78056
  var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
77715
78057
  const init = {
77716
78058
  method,
@@ -77735,6 +78077,13 @@ var newRequestFromIncoming = (method, url, headers, incoming, abortController) =
77735
78077
  let reader;
77736
78078
  init.body = new ReadableStream({ async pull(controller) {
77737
78079
  try {
78080
+ if (!reader) {
78081
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
78082
+ if (buffered !== undefined) {
78083
+ enqueueBufferedBody(controller, buffered);
78084
+ return;
78085
+ }
78086
+ }
77738
78087
  reader ||= Readable.toWeb(incoming).getReader();
77739
78088
  const { done, value } = await reader.read();
77740
78089
  if (done)
@@ -77745,8 +78094,15 @@ var newRequestFromIncoming = (method, url, headers, incoming, abortController) =
77745
78094
  controller.error(error3);
77746
78095
  }
77747
78096
  } });
77748
- } else
77749
- init.body = Readable.toWeb(incoming);
78097
+ } else {
78098
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
78099
+ if (buffered !== undefined)
78100
+ init.body = new ReadableStream({ start(controller) {
78101
+ enqueueBufferedBody(controller, buffered);
78102
+ } });
78103
+ else
78104
+ init.body = Readable.toWeb(incoming);
78105
+ }
77750
78106
  return new Request$1(url, init);
77751
78107
  };
77752
78108
  var getRequestCache = Symbol("getRequestCache");
@@ -77790,8 +78146,10 @@ var normalizeIncomingMethod = (method) => {
77790
78146
  case "GET":
77791
78147
  case "HEAD":
77792
78148
  case "OPTIONS":
78149
+ case "PATCH":
77793
78150
  case "POST":
77794
78151
  case "PUT":
78152
+ case "QUERY":
77795
78153
  return method;
77796
78154
  }
77797
78155
  const upper = method.toUpperCase();
@@ -77847,14 +78205,29 @@ var readRawBodyIfAvailable = (request) => {
77847
78205
  if ("rawBody" in incoming && incoming.rawBody instanceof Buffer)
77848
78206
  return incoming.rawBody;
77849
78207
  };
78208
+ var normalizeAbortError = (request, incoming) => {
78209
+ if (incoming.errored)
78210
+ return incoming.errored;
78211
+ const reason = request[abortReasonKey];
78212
+ if (reason !== undefined)
78213
+ return reason instanceof Error ? reason : new Error(String(reason));
78214
+ return /* @__PURE__ */ new Error("Client connection prematurely closed.");
78215
+ };
77850
78216
  var readBodyDirect = (request) => {
77851
78217
  if (request[bodyBufferKey])
77852
78218
  return Promise.resolve(request[bodyBufferKey]);
77853
78219
  if (request[bodyReadPromiseKey])
77854
78220
  return request[bodyReadPromiseKey];
77855
78221
  const incoming = request[incomingKey];
77856
- if (Readable.isDisturbed(incoming))
78222
+ if (incoming.readableDidRead)
77857
78223
  return rejectBodyUnusable();
78224
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
78225
+ if (buffered !== undefined) {
78226
+ if (buffered instanceof Error)
78227
+ return Promise.reject(buffered);
78228
+ request[bodyBufferKey] = buffered;
78229
+ return Promise.resolve(buffered);
78230
+ }
77858
78231
  const promise2 = new Promise((resolve5, reject) => {
77859
78232
  const chunks = [];
77860
78233
  let settled = false;
@@ -77865,8 +78238,25 @@ var readBodyDirect = (request) => {
77865
78238
  cleanup();
77866
78239
  callback();
77867
78240
  };
78241
+ const recoverCompleteBodyAfterDisconnect = (error3) => {
78242
+ const streamError = incoming.errored ?? error3;
78243
+ if (!isRecoverableDisconnectedIncoming(incoming) || streamError && streamError.code !== "ECONNRESET")
78244
+ return false;
78245
+ finish(() => {
78246
+ const recovered = readBodyBufferedBeforeDisconnect(incoming, chunks);
78247
+ if (recovered instanceof Error)
78248
+ reject(recovered);
78249
+ else if (recovered === undefined)
78250
+ reject(error3 ?? normalizeAbortError(request, incoming));
78251
+ else {
78252
+ request[bodyBufferKey] = recovered;
78253
+ resolve5(recovered);
78254
+ }
78255
+ });
78256
+ return true;
78257
+ };
77868
78258
  const onData = (chunk) => {
77869
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
78259
+ chunks.push(toBufferChunk(chunk, incoming.readableEncoding));
77870
78260
  };
77871
78261
  const onEnd = () => {
77872
78262
  finish(() => {
@@ -77876,6 +78266,8 @@ var readBodyDirect = (request) => {
77876
78266
  });
77877
78267
  };
77878
78268
  const onError = (error3) => {
78269
+ if (recoverCompleteBodyAfterDisconnect(error3))
78270
+ return;
77879
78271
  finish(() => {
77880
78272
  reject(error3);
77881
78273
  });
@@ -77885,17 +78277,10 @@ var readBodyDirect = (request) => {
77885
78277
  onEnd();
77886
78278
  return;
77887
78279
  }
78280
+ if (recoverCompleteBodyAfterDisconnect())
78281
+ return;
77888
78282
  finish(() => {
77889
- if (incoming.errored) {
77890
- reject(incoming.errored);
77891
- return;
77892
- }
77893
- const reason = request[abortReasonKey];
77894
- if (reason !== undefined) {
77895
- reject(reason instanceof Error ? reason : new Error(String(reason)));
77896
- return;
77897
- }
77898
- reject(/* @__PURE__ */ new Error("Client connection prematurely closed."));
78283
+ reject(normalizeAbortError(request, incoming));
77899
78284
  });
77900
78285
  };
77901
78286
  const cleanup = () => {
@@ -78103,16 +78488,15 @@ var Response$1 = class Response$12 {
78103
78488
  constructor(body, init) {
78104
78489
  let headers;
78105
78490
  this.#body = body;
78106
- if (init instanceof Response$12) {
78491
+ if (init instanceof GlobalResponse) {
78107
78492
  const cachedGlobalResponse = init[responseCache];
78108
78493
  if (cachedGlobalResponse) {
78109
78494
  this.#init = cachedGlobalResponse;
78110
78495
  this[getResponseCache]();
78111
78496
  return;
78112
- } else {
78113
- this.#init = init.#init;
78114
- headers = new Headers(init.headers);
78115
78497
  }
78498
+ this.#init = init instanceof Response$12 ? init.#init : init;
78499
+ headers = new Headers(init.headers);
78116
78500
  } else
78117
78501
  this.#init = init;
78118
78502
  if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array)
@@ -78328,10 +78712,13 @@ var drainIncoming = (incoming) => {
78328
78712
  incoming.resume();
78329
78713
  };
78330
78714
  var makeCloseHandler = (req, incoming, outgoing, needsBodyCleanup) => () => {
78331
- if (incoming.errored)
78715
+ if (incoming.errored) {
78716
+ recordBodyBufferedBeforeDisconnect(incoming);
78332
78717
  req[abortRequest](incoming.errored.toString());
78333
- else if (!outgoing.writableFinished)
78718
+ } else if (!outgoing.writableFinished) {
78719
+ recordBodyBufferedBeforeDisconnect(incoming);
78334
78720
  req[abortRequest]("Client connection prematurely closed.");
78721
+ }
78335
78722
  if (needsBodyCleanup && !incoming.readableEnded)
78336
78723
  setTimeout(() => {
78337
78724
  if (!incoming.readableEnded)
@@ -78580,6 +78967,28 @@ var CloseEvent2 = globalThis.CloseEvent ?? class extends Event {
78580
78967
  return this.#eventInitDict.reason ?? "";
78581
78968
  }
78582
78969
  };
78970
+ var ErrorEvent = globalThis.ErrorEvent ?? class extends Event {
78971
+ #eventInitDict;
78972
+ constructor(type, eventInitDict = {}) {
78973
+ super(type, eventInitDict);
78974
+ this.#eventInitDict = eventInitDict;
78975
+ }
78976
+ get message() {
78977
+ return this.#eventInitDict.message ?? "";
78978
+ }
78979
+ get filename() {
78980
+ return this.#eventInitDict.filename ?? "";
78981
+ }
78982
+ get lineno() {
78983
+ return this.#eventInitDict.lineno ?? 0;
78984
+ }
78985
+ get colno() {
78986
+ return this.#eventInitDict.colno ?? 0;
78987
+ }
78988
+ get error() {
78989
+ return this.#eventInitDict.error ?? null;
78990
+ }
78991
+ };
78583
78992
  var generateConnectionSymbol = () => Symbol("connection");
78584
78993
  var CONNECTION_SYMBOL_KEY = Symbol("CONNECTION_SYMBOL_KEY");
78585
78994
  var WAIT_FOR_WEBSOCKET_SYMBOL = Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");
@@ -78637,10 +79046,18 @@ var setupWebSocket = (options) => {
78637
79046
  waiterMap.delete(request);
78638
79047
  }
78639
79048
  });
79049
+ const rejectWaiter = (request) => {
79050
+ const waiter = waiterMap.get(request);
79051
+ if (waiter) {
79052
+ waiterMap.delete(request);
79053
+ waiter.reject(/* @__PURE__ */ new Error("WebSocket handshake aborted"));
79054
+ }
79055
+ };
78640
79056
  const waitForWebSocket = (request, connectionSymbol) => {
78641
- return new Promise((resolve5) => {
79057
+ return new Promise((resolve5, reject) => {
78642
79058
  waiterMap.set(request, {
78643
79059
  resolve: resolve5,
79060
+ reject,
78644
79061
  connectionSymbol
78645
79062
  });
78646
79063
  });
@@ -78669,7 +79086,7 @@ var setupWebSocket = (options) => {
78669
79086
  }
78670
79087
  const waiter = waiterMap.get(request);
78671
79088
  if (!waiter || waiter.connectionSymbol !== env4[CONNECTION_SYMBOL_KEY]) {
78672
- waiterMap.delete(request);
79089
+ rejectWaiter(request);
78673
79090
  if (server.listenerCount("upgrade") === 1)
78674
79091
  rejectUpgradeRequest(socket, status, responseHeaders);
78675
79092
  return;
@@ -78677,9 +79094,12 @@ var setupWebSocket = (options) => {
78677
79094
  const addResponseHeaders = (headers) => {
78678
79095
  appendResponseHeaders(headers, responseHeaders);
78679
79096
  };
79097
+ const reclaimWaiterOnClose = () => rejectWaiter(request);
79098
+ socket.once("close", reclaimWaiterOnClose);
78680
79099
  wss.on("headers", addResponseHeaders);
78681
79100
  try {
78682
79101
  wss.handleUpgrade(request, socket, head2, (ws) => {
79102
+ socket.off("close", reclaimWaiterOnClose);
78683
79103
  wss.emit("connection", ws, request);
78684
79104
  });
78685
79105
  } finally {
@@ -78700,7 +79120,12 @@ var upgradeWebSocket = defineWebSocketHelper(async (c2, events, options) => {
78700
79120
  const connectionSymbol = generateConnectionSymbol();
78701
79121
  env4[CONNECTION_SYMBOL_KEY] = connectionSymbol;
78702
79122
  (async () => {
78703
- const ws = await waitForWebSocket(env4.incoming, connectionSymbol);
79123
+ let ws;
79124
+ try {
79125
+ ws = await waitForWebSocket(env4.incoming, connectionSymbol);
79126
+ } catch {
79127
+ return;
79128
+ }
78704
79129
  const messagesReceivedInStarting = [];
78705
79130
  const bufferMessage = (data, isBinary) => {
78706
79131
  messagesReceivedInStarting.push([data, isBinary]);
@@ -78789,7 +79214,7 @@ var serve = (options, listeningListener) => {
78789
79214
  return server;
78790
79215
  };
78791
79216
 
78792
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/utils/stream.mjs
79217
+ // ../../node_modules/.bun/@hono+node-server@2.0.12+711a9a789551665d/node_modules/@hono/node-server/dist/utils/stream.mjs
78793
79218
  import { Readable as Readable2 } from "node:stream";
78794
79219
  import { versions as versions2 } from "node:process";
78795
79220
  var pr54206Applied = () => {
@@ -78855,7 +79280,7 @@ var createStreamBody = (stream, useNativeReadableToWeb = useReadableToWeb) => {
78855
79280
  });
78856
79281
  };
78857
79282
 
78858
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/mime.js
79283
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/utils/mime.js
78859
79284
  var getMimeType = (filename, mimes = baseMimes) => {
78860
79285
  const regexp = /\.([a-zA-Z0-9]+?)$/;
78861
79286
  const match = filename.match(regexp);
@@ -78924,7 +79349,7 @@ var _baseMimes = {
78924
79349
  };
78925
79350
  var baseMimes = _baseMimes;
78926
79351
 
78927
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/serve-static.mjs
79352
+ // ../../node_modules/.bun/@hono+node-server@2.0.12+711a9a789551665d/node_modules/@hono/node-server/dist/serve-static.mjs
78928
79353
  import { createReadStream, existsSync as existsSync15, statSync as statSync5 } from "node:fs";
78929
79354
  import { join as join13 } from "node:path";
78930
79355
  var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
@@ -78941,6 +79366,47 @@ var getStats = (path) => {
78941
79366
  } catch {}
78942
79367
  return stats;
78943
79368
  };
79369
+ var BYTE_RANGE_PATTERN = /^(?:bytes=)?(?!-$)(\d*)-(\d*)$/;
79370
+ var parseByteRange = (range) => {
79371
+ const match = range.match(BYTE_RANGE_PATTERN);
79372
+ if (!match)
79373
+ return;
79374
+ const [, start, end] = match;
79375
+ if (start === "")
79376
+ return {
79377
+ type: "suffix",
79378
+ length: Number(end)
79379
+ };
79380
+ if (end === "")
79381
+ return {
79382
+ type: "open-ended",
79383
+ start: Number(start)
79384
+ };
79385
+ return {
79386
+ type: "bounded",
79387
+ start: Number(start),
79388
+ end: Number(end)
79389
+ };
79390
+ };
79391
+ var resolveByteRange = (spec, size2) => {
79392
+ if (size2 === 0)
79393
+ return;
79394
+ if (spec.type === "suffix") {
79395
+ if (spec.length === 0)
79396
+ return;
79397
+ return {
79398
+ start: Math.max(size2 - spec.length, 0),
79399
+ end: size2 - 1
79400
+ };
79401
+ }
79402
+ const end = spec.type === "bounded" ? Math.min(spec.end, size2 - 1) : size2 - 1;
79403
+ if (spec.start >= size2 || spec.start > end)
79404
+ return;
79405
+ return {
79406
+ start: spec.start,
79407
+ end
79408
+ };
79409
+ };
78944
79410
  var tryDecode = (str, decoder) => {
78945
79411
  try {
78946
79412
  return decoder(str);
@@ -79016,19 +79482,24 @@ var serveStatic = (options = { root: "" }) => {
79016
79482
  result = c2.body(createStreamBody(createReadStream(path)), 200);
79017
79483
  } else {
79018
79484
  c2.header("Accept-Ranges", "bytes");
79019
- const parts = range.replace(/bytes=/, "").split("-", 2);
79020
- const start = parseInt(parts[0], 10) || 0;
79021
- let end = parseInt(parts[1], 10) || size2 - 1;
79022
- if (size2 < end - start + 1)
79023
- end = size2 - 1;
79024
- const chunksize = end - start + 1;
79025
- const stream = createReadStream(path, {
79026
- start,
79027
- end
79028
- });
79029
- c2.header("Content-Length", chunksize.toString());
79030
- c2.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
79031
- result = c2.body(createStreamBody(stream), 206);
79485
+ const resolvedRange = resolveByteRange(parseByteRange(range) ?? {
79486
+ type: "open-ended",
79487
+ start: 0
79488
+ }, size2);
79489
+ if (!resolvedRange) {
79490
+ c2.header("Content-Range", `bytes */${size2}`);
79491
+ result = c2.body(null, 416);
79492
+ } else {
79493
+ const { start, end } = resolvedRange;
79494
+ const chunkSize = end - start + 1;
79495
+ const stream = createReadStream(path, {
79496
+ start,
79497
+ end
79498
+ });
79499
+ c2.header("Content-Length", chunkSize.toString());
79500
+ c2.header("Content-Range", `bytes ${start}-${end}/${size2}`);
79501
+ result = c2.body(createStreamBody(stream), 206);
79502
+ }
79032
79503
  }
79033
79504
  await options.onFound?.(path, c2);
79034
79505
  return result;
@@ -79040,7 +79511,7 @@ import { existsSync as existsSync19 } from "node:fs";
79040
79511
  import { readFileSync as readFileSync17 } from "node:fs";
79041
79512
  import { join as join17 } from "node:path";
79042
79513
 
79043
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/compose.js
79514
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/compose.js
79044
79515
  var compose = (middleware, onError, onNotFound) => {
79045
79516
  return (context, next) => {
79046
79517
  let index = -1;
@@ -79084,10 +79555,10 @@ var compose = (middleware, onError, onNotFound) => {
79084
79555
  };
79085
79556
  };
79086
79557
 
79087
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/request/constants.js
79558
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/request/constants.js
79088
79559
  var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
79089
79560
 
79090
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/buffer.js
79561
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/utils/buffer.js
79091
79562
  var bufferToFormData = (arrayBuffer, contentType2) => {
79092
79563
  const response = new Response(arrayBuffer, {
79093
79564
  headers: {
@@ -79097,7 +79568,7 @@ var bufferToFormData = (arrayBuffer, contentType2) => {
79097
79568
  return response.formData();
79098
79569
  };
79099
79570
 
79100
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/body.js
79571
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/utils/body.js
79101
79572
  var isRawRequest = (request) => ("headers" in request);
79102
79573
  var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
79103
79574
  const { all = false, dot = false } = options;
@@ -79110,6 +79581,9 @@ var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) =
79110
79581
  return {};
79111
79582
  };
79112
79583
  async function parseFormData(request, options) {
79584
+ if (!isRawRequest(request) && request.bodyCache.formData) {
79585
+ return convertFormDataToBodyData(await request.bodyCache.formData, options);
79586
+ }
79113
79587
  const headers = isRawRequest(request) ? request.headers : request.raw.headers;
79114
79588
  const arrayBuffer = await request.arrayBuffer();
79115
79589
  const formDataPromise = bufferToFormData(arrayBuffer, headers.get("Content-Type") || "");
@@ -79176,7 +79650,7 @@ var handleParsingNestedValues = (form, key, value) => {
79176
79650
  });
79177
79651
  };
79178
79652
 
79179
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/url.js
79653
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/utils/url.js
79180
79654
  var splitPath = (path) => {
79181
79655
  const paths = path.split("/");
79182
79656
  if (paths[0] === "") {
@@ -79333,7 +79807,7 @@ var _getQueryParam = (url, key, multiple) => {
79333
79807
  return;
79334
79808
  }
79335
79809
  }
79336
- const results = {};
79810
+ const results = /* @__PURE__ */ Object.create(null);
79337
79811
  encoded ??= /[%+]/.test(url);
79338
79812
  let keyIndex = url.indexOf("?", 8);
79339
79813
  while (keyIndex !== -1) {
@@ -79376,7 +79850,7 @@ var getQueryParams = (url, key) => {
79376
79850
  };
79377
79851
  var decodeURIComponent_ = decodeURIComponent;
79378
79852
 
79379
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/request.js
79853
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/request.js
79380
79854
  var tryDecodeURIComponent = (str) => tryDecode2(str, decodeURIComponent_);
79381
79855
  var HonoRequest = class {
79382
79856
  raw;
@@ -79423,7 +79897,7 @@ var HonoRequest = class {
79423
79897
  if (name) {
79424
79898
  return this.raw.headers.get(name) ?? undefined;
79425
79899
  }
79426
- const headerData = {};
79900
+ const headerData = /* @__PURE__ */ Object.create(null);
79427
79901
  this.raw.headers.forEach((value, key) => {
79428
79902
  headerData[key] = value;
79429
79903
  });
@@ -79490,7 +79964,7 @@ var HonoRequest = class {
79490
79964
  }
79491
79965
  };
79492
79966
 
79493
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/html.js
79967
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/utils/html.js
79494
79968
  var HtmlEscapedCallbackPhase = {
79495
79969
  Stringify: 1,
79496
79970
  BeforeStream: 2,
@@ -79528,7 +80002,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer2) =>
79528
80002
  }
79529
80003
  };
79530
80004
 
79531
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/context.js
80005
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/context.js
79532
80006
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
79533
80007
  var setDefaultContentType = (contentType2, headers) => {
79534
80008
  return {
@@ -79695,7 +80169,7 @@ var Context = class {
79695
80169
  };
79696
80170
  };
79697
80171
 
79698
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router.js
80172
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router.js
79699
80173
  var METHOD_NAME_ALL = "ALL";
79700
80174
  var METHOD_NAME_ALL_LOWERCASE = "all";
79701
80175
  var METHODS = ["get", "post", "put", "delete", "options", "patch"];
@@ -79703,10 +80177,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
79703
80177
  var UnsupportedPathError = class extends Error {
79704
80178
  };
79705
80179
 
79706
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/constants.js
80180
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/utils/constants.js
79707
80181
  var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
79708
80182
 
79709
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/hono-base.js
80183
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/hono-base.js
79710
80184
  var notFoundHandler = (c2) => {
79711
80185
  return c2.text("404 Not Found", 404);
79712
80186
  };
@@ -79930,7 +80404,7 @@ var Hono = class _Hono {
79930
80404
  };
79931
80405
  };
79932
80406
 
79933
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/matcher.js
80407
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router/reg-exp-router/matcher.js
79934
80408
  var emptyParam = [];
79935
80409
  function match(method, path) {
79936
80410
  const matchers = this.buildAllMatchers();
@@ -79951,7 +80425,7 @@ function match(method, path) {
79951
80425
  return match2(method, path);
79952
80426
  }
79953
80427
 
79954
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/node.js
80428
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router/reg-exp-router/node.js
79955
80429
  var LABEL_REG_EXP_STR = "[^/]+";
79956
80430
  var ONLY_WILDCARD_REG_EXP_STR = ".*";
79957
80431
  var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
@@ -80055,7 +80529,7 @@ var Node = class _Node {
80055
80529
  }
80056
80530
  };
80057
80531
 
80058
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/trie.js
80532
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router/reg-exp-router/trie.js
80059
80533
  var Trie = class {
80060
80534
  #context = { varIndex: 0 };
80061
80535
  #root = new Node;
@@ -80111,7 +80585,7 @@ var Trie = class {
80111
80585
  }
80112
80586
  };
80113
80587
 
80114
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/router.js
80588
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router/reg-exp-router/router.js
80115
80589
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
80116
80590
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
80117
80591
  function buildWildcardRegExp(path) {
@@ -80276,7 +80750,7 @@ var RegExpRouter = class {
80276
80750
  }
80277
80751
  };
80278
80752
 
80279
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
80753
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
80280
80754
  var PreparedRegExpRouter = class {
80281
80755
  name = "PreparedRegExpRouter";
80282
80756
  #matchers;
@@ -80348,7 +80822,7 @@ var PreparedRegExpRouter = class {
80348
80822
  match = match;
80349
80823
  };
80350
80824
 
80351
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/smart-router/router.js
80825
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router/smart-router/router.js
80352
80826
  var SmartRouter = class {
80353
80827
  name = "SmartRouter";
80354
80828
  #routers = [];
@@ -80403,7 +80877,7 @@ var SmartRouter = class {
80403
80877
  }
80404
80878
  };
80405
80879
 
80406
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/trie-router/node.js
80880
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router/trie-router/node.js
80407
80881
  var emptyParams = /* @__PURE__ */ Object.create(null);
80408
80882
  var hasChildren = (children) => {
80409
80883
  for (const _ in children) {
@@ -80575,7 +81049,7 @@ var Node2 = class _Node2 {
80575
81049
  }
80576
81050
  };
80577
81051
 
80578
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/trie-router/router.js
81052
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/router/trie-router/router.js
80579
81053
  var TrieRouter = class {
80580
81054
  name = "TrieRouter";
80581
81055
  #node;
@@ -80597,7 +81071,7 @@ var TrieRouter = class {
80597
81071
  }
80598
81072
  };
80599
81073
 
80600
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/hono.js
81074
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/hono.js
80601
81075
  var Hono2 = class extends Hono {
80602
81076
  constructor(options = {}) {
80603
81077
  super(options);
@@ -80607,7 +81081,7 @@ var Hono2 = class extends Hono {
80607
81081
  }
80608
81082
  };
80609
81083
 
80610
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/color.js
81084
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/utils/color.js
80611
81085
  function getColorEnabled() {
80612
81086
  const { process: process10, Deno: Deno2 } = globalThis;
80613
81087
  const isNoColor = typeof Deno2?.noColor === "boolean" ? Deno2.noColor : process10 !== undefined ? "NO_COLOR" in process10?.env : false;
@@ -80626,7 +81100,7 @@ async function getColorEnabledAsync() {
80626
81100
  return !isNoColor;
80627
81101
  }
80628
81102
 
80629
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/middleware/logger/index.js
81103
+ // ../../node_modules/.bun/hono@4.12.33/node_modules/hono/dist/middleware/logger/index.js
80630
81104
  var humanize = (times) => {
80631
81105
  const [delimiter, separator] = [",", "."];
80632
81106
  const orderTimes = times.map((v) => v.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + delimiter));