@dodopayments/sveltekit 0.2.4 → 0.2.5

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.
package/dist/index.js CHANGED
@@ -7600,6 +7600,32 @@ var buildCheckoutUrl = async ({
7600
7600
  }
7601
7601
  };
7602
7602
 
7603
+ var __create = Object.create;
7604
+ var __defProp = Object.defineProperty;
7605
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7606
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7607
+ var __getProtoOf = Object.getPrototypeOf;
7608
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7609
+ var __commonJS = (cb, mod) => function __require2() {
7610
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7611
+ };
7612
+ var __copyProps = (to, from, except, desc) => {
7613
+ if (from && typeof from === "object" || typeof from === "function") {
7614
+ for (let key of __getOwnPropNames(from))
7615
+ if (!__hasOwnProp.call(to, key) && key !== except)
7616
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
7617
+ }
7618
+ return to;
7619
+ };
7620
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
7621
+ // If the importer is in node compatibility mode or this is not an ESM
7622
+ // file that has been converted to a CommonJS file using a Babel-
7623
+ // compatible transform (i.e. "__esModule" has not been set), then set
7624
+ // "default" to the CommonJS "module.exports" for node compatibility.
7625
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
7626
+ mod
7627
+ ));
7628
+
7603
7629
  const Checkout = (config) => {
7604
7630
  const getHandler = async (event) => {
7605
7631
  const searchParams = event.url.searchParams;
@@ -8026,6 +8052,675 @@ var WebhookPayloadSchema = discriminatedUnionType("type", [
8026
8052
  LicenseKeyCreatedPayloadSchema
8027
8053
  ]);
8028
8054
 
8055
+ // ../../node_modules/@stablelib/base64/lib/base64.js
8056
+ var require_base64 = __commonJS({
8057
+ "../../node_modules/@stablelib/base64/lib/base64.js"(exports) {
8058
+ var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
8059
+ var extendStatics = function(d, b) {
8060
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
8061
+ d2.__proto__ = b2;
8062
+ } || function(d2, b2) {
8063
+ for (var p in b2) if (b2.hasOwnProperty(p)) d2[p] = b2[p];
8064
+ };
8065
+ return extendStatics(d, b);
8066
+ };
8067
+ return function(d, b) {
8068
+ extendStatics(d, b);
8069
+ function __() {
8070
+ this.constructor = d;
8071
+ }
8072
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8073
+ };
8074
+ }();
8075
+ Object.defineProperty(exports, "__esModule", { value: true });
8076
+ var INVALID_BYTE = 256;
8077
+ var Coder = (
8078
+ /** @class */
8079
+ function() {
8080
+ function Coder2(_paddingCharacter) {
8081
+ if (_paddingCharacter === void 0) {
8082
+ _paddingCharacter = "=";
8083
+ }
8084
+ this._paddingCharacter = _paddingCharacter;
8085
+ }
8086
+ Coder2.prototype.encodedLength = function(length) {
8087
+ if (!this._paddingCharacter) {
8088
+ return (length * 8 + 5) / 6 | 0;
8089
+ }
8090
+ return (length + 2) / 3 * 4 | 0;
8091
+ };
8092
+ Coder2.prototype.encode = function(data) {
8093
+ var out = "";
8094
+ var i = 0;
8095
+ for (; i < data.length - 2; i += 3) {
8096
+ var c = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
8097
+ out += this._encodeByte(c >>> 3 * 6 & 63);
8098
+ out += this._encodeByte(c >>> 2 * 6 & 63);
8099
+ out += this._encodeByte(c >>> 1 * 6 & 63);
8100
+ out += this._encodeByte(c >>> 0 * 6 & 63);
8101
+ }
8102
+ var left = data.length - i;
8103
+ if (left > 0) {
8104
+ var c = data[i] << 16 | (left === 2 ? data[i + 1] << 8 : 0);
8105
+ out += this._encodeByte(c >>> 3 * 6 & 63);
8106
+ out += this._encodeByte(c >>> 2 * 6 & 63);
8107
+ if (left === 2) {
8108
+ out += this._encodeByte(c >>> 1 * 6 & 63);
8109
+ } else {
8110
+ out += this._paddingCharacter || "";
8111
+ }
8112
+ out += this._paddingCharacter || "";
8113
+ }
8114
+ return out;
8115
+ };
8116
+ Coder2.prototype.maxDecodedLength = function(length) {
8117
+ if (!this._paddingCharacter) {
8118
+ return (length * 6 + 7) / 8 | 0;
8119
+ }
8120
+ return length / 4 * 3 | 0;
8121
+ };
8122
+ Coder2.prototype.decodedLength = function(s) {
8123
+ return this.maxDecodedLength(s.length - this._getPaddingLength(s));
8124
+ };
8125
+ Coder2.prototype.decode = function(s) {
8126
+ if (s.length === 0) {
8127
+ return new Uint8Array(0);
8128
+ }
8129
+ var paddingLength = this._getPaddingLength(s);
8130
+ var length = s.length - paddingLength;
8131
+ var out = new Uint8Array(this.maxDecodedLength(length));
8132
+ var op = 0;
8133
+ var i = 0;
8134
+ var haveBad = 0;
8135
+ var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
8136
+ for (; i < length - 4; i += 4) {
8137
+ v0 = this._decodeChar(s.charCodeAt(i + 0));
8138
+ v1 = this._decodeChar(s.charCodeAt(i + 1));
8139
+ v2 = this._decodeChar(s.charCodeAt(i + 2));
8140
+ v3 = this._decodeChar(s.charCodeAt(i + 3));
8141
+ out[op++] = v0 << 2 | v1 >>> 4;
8142
+ out[op++] = v1 << 4 | v2 >>> 2;
8143
+ out[op++] = v2 << 6 | v3;
8144
+ haveBad |= v0 & INVALID_BYTE;
8145
+ haveBad |= v1 & INVALID_BYTE;
8146
+ haveBad |= v2 & INVALID_BYTE;
8147
+ haveBad |= v3 & INVALID_BYTE;
8148
+ }
8149
+ if (i < length - 1) {
8150
+ v0 = this._decodeChar(s.charCodeAt(i));
8151
+ v1 = this._decodeChar(s.charCodeAt(i + 1));
8152
+ out[op++] = v0 << 2 | v1 >>> 4;
8153
+ haveBad |= v0 & INVALID_BYTE;
8154
+ haveBad |= v1 & INVALID_BYTE;
8155
+ }
8156
+ if (i < length - 2) {
8157
+ v2 = this._decodeChar(s.charCodeAt(i + 2));
8158
+ out[op++] = v1 << 4 | v2 >>> 2;
8159
+ haveBad |= v2 & INVALID_BYTE;
8160
+ }
8161
+ if (i < length - 3) {
8162
+ v3 = this._decodeChar(s.charCodeAt(i + 3));
8163
+ out[op++] = v2 << 6 | v3;
8164
+ haveBad |= v3 & INVALID_BYTE;
8165
+ }
8166
+ if (haveBad !== 0) {
8167
+ throw new Error("Base64Coder: incorrect characters for decoding");
8168
+ }
8169
+ return out;
8170
+ };
8171
+ Coder2.prototype._encodeByte = function(b) {
8172
+ var result = b;
8173
+ result += 65;
8174
+ result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
8175
+ result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
8176
+ result += 61 - b >>> 8 & 52 - 48 - 62 + 43;
8177
+ result += 62 - b >>> 8 & 62 - 43 - 63 + 47;
8178
+ return String.fromCharCode(result);
8179
+ };
8180
+ Coder2.prototype._decodeChar = function(c) {
8181
+ var result = INVALID_BYTE;
8182
+ result += (42 - c & c - 44) >>> 8 & -INVALID_BYTE + c - 43 + 62;
8183
+ result += (46 - c & c - 48) >>> 8 & -INVALID_BYTE + c - 47 + 63;
8184
+ result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
8185
+ result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
8186
+ result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
8187
+ return result;
8188
+ };
8189
+ Coder2.prototype._getPaddingLength = function(s) {
8190
+ var paddingLength = 0;
8191
+ if (this._paddingCharacter) {
8192
+ for (var i = s.length - 1; i >= 0; i--) {
8193
+ if (s[i] !== this._paddingCharacter) {
8194
+ break;
8195
+ }
8196
+ paddingLength++;
8197
+ }
8198
+ if (s.length < 4 || paddingLength > 2) {
8199
+ throw new Error("Base64Coder: incorrect padding");
8200
+ }
8201
+ }
8202
+ return paddingLength;
8203
+ };
8204
+ return Coder2;
8205
+ }()
8206
+ );
8207
+ exports.Coder = Coder;
8208
+ var stdCoder = new Coder();
8209
+ function encode2(data) {
8210
+ return stdCoder.encode(data);
8211
+ }
8212
+ exports.encode = encode2;
8213
+ function decode2(s) {
8214
+ return stdCoder.decode(s);
8215
+ }
8216
+ exports.decode = decode2;
8217
+ var URLSafeCoder = (
8218
+ /** @class */
8219
+ function(_super) {
8220
+ __extends(URLSafeCoder2, _super);
8221
+ function URLSafeCoder2() {
8222
+ return _super !== null && _super.apply(this, arguments) || this;
8223
+ }
8224
+ URLSafeCoder2.prototype._encodeByte = function(b) {
8225
+ var result = b;
8226
+ result += 65;
8227
+ result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
8228
+ result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
8229
+ result += 61 - b >>> 8 & 52 - 48 - 62 + 45;
8230
+ result += 62 - b >>> 8 & 62 - 45 - 63 + 95;
8231
+ return String.fromCharCode(result);
8232
+ };
8233
+ URLSafeCoder2.prototype._decodeChar = function(c) {
8234
+ var result = INVALID_BYTE;
8235
+ result += (44 - c & c - 46) >>> 8 & -INVALID_BYTE + c - 45 + 62;
8236
+ result += (94 - c & c - 96) >>> 8 & -INVALID_BYTE + c - 95 + 63;
8237
+ result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
8238
+ result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
8239
+ result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
8240
+ return result;
8241
+ };
8242
+ return URLSafeCoder2;
8243
+ }(Coder)
8244
+ );
8245
+ exports.URLSafeCoder = URLSafeCoder;
8246
+ var urlSafeCoder = new URLSafeCoder();
8247
+ function encodeURLSafe(data) {
8248
+ return urlSafeCoder.encode(data);
8249
+ }
8250
+ exports.encodeURLSafe = encodeURLSafe;
8251
+ function decodeURLSafe(s) {
8252
+ return urlSafeCoder.decode(s);
8253
+ }
8254
+ exports.decodeURLSafe = decodeURLSafe;
8255
+ exports.encodedLength = function(length) {
8256
+ return stdCoder.encodedLength(length);
8257
+ };
8258
+ exports.maxDecodedLength = function(length) {
8259
+ return stdCoder.maxDecodedLength(length);
8260
+ };
8261
+ exports.decodedLength = function(s) {
8262
+ return stdCoder.decodedLength(s);
8263
+ };
8264
+ }
8265
+ });
8266
+
8267
+ // ../../node_modules/fast-sha256/sha256.js
8268
+ var require_sha256 = __commonJS({
8269
+ "../../node_modules/fast-sha256/sha256.js"(exports, module) {
8270
+ (function(root, factory) {
8271
+ var exports2 = {};
8272
+ factory(exports2);
8273
+ var sha2562 = exports2["default"];
8274
+ for (var k in exports2) {
8275
+ sha2562[k] = exports2[k];
8276
+ }
8277
+ if (typeof module === "object" && typeof module.exports === "object") {
8278
+ module.exports = sha2562;
8279
+ } else if (typeof define === "function" && define.amd) {
8280
+ define(function() {
8281
+ return sha2562;
8282
+ });
8283
+ } else {
8284
+ root.sha256 = sha2562;
8285
+ }
8286
+ })(exports, function(exports2) {
8287
+ exports2.__esModule = true;
8288
+ exports2.digestLength = 32;
8289
+ exports2.blockSize = 64;
8290
+ var K = new Uint32Array([
8291
+ 1116352408,
8292
+ 1899447441,
8293
+ 3049323471,
8294
+ 3921009573,
8295
+ 961987163,
8296
+ 1508970993,
8297
+ 2453635748,
8298
+ 2870763221,
8299
+ 3624381080,
8300
+ 310598401,
8301
+ 607225278,
8302
+ 1426881987,
8303
+ 1925078388,
8304
+ 2162078206,
8305
+ 2614888103,
8306
+ 3248222580,
8307
+ 3835390401,
8308
+ 4022224774,
8309
+ 264347078,
8310
+ 604807628,
8311
+ 770255983,
8312
+ 1249150122,
8313
+ 1555081692,
8314
+ 1996064986,
8315
+ 2554220882,
8316
+ 2821834349,
8317
+ 2952996808,
8318
+ 3210313671,
8319
+ 3336571891,
8320
+ 3584528711,
8321
+ 113926993,
8322
+ 338241895,
8323
+ 666307205,
8324
+ 773529912,
8325
+ 1294757372,
8326
+ 1396182291,
8327
+ 1695183700,
8328
+ 1986661051,
8329
+ 2177026350,
8330
+ 2456956037,
8331
+ 2730485921,
8332
+ 2820302411,
8333
+ 3259730800,
8334
+ 3345764771,
8335
+ 3516065817,
8336
+ 3600352804,
8337
+ 4094571909,
8338
+ 275423344,
8339
+ 430227734,
8340
+ 506948616,
8341
+ 659060556,
8342
+ 883997877,
8343
+ 958139571,
8344
+ 1322822218,
8345
+ 1537002063,
8346
+ 1747873779,
8347
+ 1955562222,
8348
+ 2024104815,
8349
+ 2227730452,
8350
+ 2361852424,
8351
+ 2428436474,
8352
+ 2756734187,
8353
+ 3204031479,
8354
+ 3329325298
8355
+ ]);
8356
+ function hashBlocks(w, v, p, pos, len) {
8357
+ var a, b, c, d, e, f, g, h, u, i, j, t1, t2;
8358
+ while (len >= 64) {
8359
+ a = v[0];
8360
+ b = v[1];
8361
+ c = v[2];
8362
+ d = v[3];
8363
+ e = v[4];
8364
+ f = v[5];
8365
+ g = v[6];
8366
+ h = v[7];
8367
+ for (i = 0; i < 16; i++) {
8368
+ j = pos + i * 4;
8369
+ w[i] = (p[j] & 255) << 24 | (p[j + 1] & 255) << 16 | (p[j + 2] & 255) << 8 | p[j + 3] & 255;
8370
+ }
8371
+ for (i = 16; i < 64; i++) {
8372
+ u = w[i - 2];
8373
+ t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10;
8374
+ u = w[i - 15];
8375
+ t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3;
8376
+ w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);
8377
+ }
8378
+ for (i = 0; i < 64; i++) {
8379
+ t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[i] + w[i] | 0) | 0) | 0;
8380
+ t2 = ((a >>> 2 | a << 32 - 2) ^ (a >>> 13 | a << 32 - 13) ^ (a >>> 22 | a << 32 - 22)) + (a & b ^ a & c ^ b & c) | 0;
8381
+ h = g;
8382
+ g = f;
8383
+ f = e;
8384
+ e = d + t1 | 0;
8385
+ d = c;
8386
+ c = b;
8387
+ b = a;
8388
+ a = t1 + t2 | 0;
8389
+ }
8390
+ v[0] += a;
8391
+ v[1] += b;
8392
+ v[2] += c;
8393
+ v[3] += d;
8394
+ v[4] += e;
8395
+ v[5] += f;
8396
+ v[6] += g;
8397
+ v[7] += h;
8398
+ pos += 64;
8399
+ len -= 64;
8400
+ }
8401
+ return pos;
8402
+ }
8403
+ var Hash = (
8404
+ /** @class */
8405
+ function() {
8406
+ function Hash2() {
8407
+ this.digestLength = exports2.digestLength;
8408
+ this.blockSize = exports2.blockSize;
8409
+ this.state = new Int32Array(8);
8410
+ this.temp = new Int32Array(64);
8411
+ this.buffer = new Uint8Array(128);
8412
+ this.bufferLength = 0;
8413
+ this.bytesHashed = 0;
8414
+ this.finished = false;
8415
+ this.reset();
8416
+ }
8417
+ Hash2.prototype.reset = function() {
8418
+ this.state[0] = 1779033703;
8419
+ this.state[1] = 3144134277;
8420
+ this.state[2] = 1013904242;
8421
+ this.state[3] = 2773480762;
8422
+ this.state[4] = 1359893119;
8423
+ this.state[5] = 2600822924;
8424
+ this.state[6] = 528734635;
8425
+ this.state[7] = 1541459225;
8426
+ this.bufferLength = 0;
8427
+ this.bytesHashed = 0;
8428
+ this.finished = false;
8429
+ return this;
8430
+ };
8431
+ Hash2.prototype.clean = function() {
8432
+ for (var i = 0; i < this.buffer.length; i++) {
8433
+ this.buffer[i] = 0;
8434
+ }
8435
+ for (var i = 0; i < this.temp.length; i++) {
8436
+ this.temp[i] = 0;
8437
+ }
8438
+ this.reset();
8439
+ };
8440
+ Hash2.prototype.update = function(data, dataLength) {
8441
+ if (dataLength === void 0) {
8442
+ dataLength = data.length;
8443
+ }
8444
+ if (this.finished) {
8445
+ throw new Error("SHA256: can't update because hash was finished.");
8446
+ }
8447
+ var dataPos = 0;
8448
+ this.bytesHashed += dataLength;
8449
+ if (this.bufferLength > 0) {
8450
+ while (this.bufferLength < 64 && dataLength > 0) {
8451
+ this.buffer[this.bufferLength++] = data[dataPos++];
8452
+ dataLength--;
8453
+ }
8454
+ if (this.bufferLength === 64) {
8455
+ hashBlocks(this.temp, this.state, this.buffer, 0, 64);
8456
+ this.bufferLength = 0;
8457
+ }
8458
+ }
8459
+ if (dataLength >= 64) {
8460
+ dataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);
8461
+ dataLength %= 64;
8462
+ }
8463
+ while (dataLength > 0) {
8464
+ this.buffer[this.bufferLength++] = data[dataPos++];
8465
+ dataLength--;
8466
+ }
8467
+ return this;
8468
+ };
8469
+ Hash2.prototype.finish = function(out) {
8470
+ if (!this.finished) {
8471
+ var bytesHashed = this.bytesHashed;
8472
+ var left = this.bufferLength;
8473
+ var bitLenHi = bytesHashed / 536870912 | 0;
8474
+ var bitLenLo = bytesHashed << 3;
8475
+ var padLength = bytesHashed % 64 < 56 ? 64 : 128;
8476
+ this.buffer[left] = 128;
8477
+ for (var i = left + 1; i < padLength - 8; i++) {
8478
+ this.buffer[i] = 0;
8479
+ }
8480
+ this.buffer[padLength - 8] = bitLenHi >>> 24 & 255;
8481
+ this.buffer[padLength - 7] = bitLenHi >>> 16 & 255;
8482
+ this.buffer[padLength - 6] = bitLenHi >>> 8 & 255;
8483
+ this.buffer[padLength - 5] = bitLenHi >>> 0 & 255;
8484
+ this.buffer[padLength - 4] = bitLenLo >>> 24 & 255;
8485
+ this.buffer[padLength - 3] = bitLenLo >>> 16 & 255;
8486
+ this.buffer[padLength - 2] = bitLenLo >>> 8 & 255;
8487
+ this.buffer[padLength - 1] = bitLenLo >>> 0 & 255;
8488
+ hashBlocks(this.temp, this.state, this.buffer, 0, padLength);
8489
+ this.finished = true;
8490
+ }
8491
+ for (var i = 0; i < 8; i++) {
8492
+ out[i * 4 + 0] = this.state[i] >>> 24 & 255;
8493
+ out[i * 4 + 1] = this.state[i] >>> 16 & 255;
8494
+ out[i * 4 + 2] = this.state[i] >>> 8 & 255;
8495
+ out[i * 4 + 3] = this.state[i] >>> 0 & 255;
8496
+ }
8497
+ return this;
8498
+ };
8499
+ Hash2.prototype.digest = function() {
8500
+ var out = new Uint8Array(this.digestLength);
8501
+ this.finish(out);
8502
+ return out;
8503
+ };
8504
+ Hash2.prototype._saveState = function(out) {
8505
+ for (var i = 0; i < this.state.length; i++) {
8506
+ out[i] = this.state[i];
8507
+ }
8508
+ };
8509
+ Hash2.prototype._restoreState = function(from, bytesHashed) {
8510
+ for (var i = 0; i < this.state.length; i++) {
8511
+ this.state[i] = from[i];
8512
+ }
8513
+ this.bytesHashed = bytesHashed;
8514
+ this.finished = false;
8515
+ this.bufferLength = 0;
8516
+ };
8517
+ return Hash2;
8518
+ }()
8519
+ );
8520
+ exports2.Hash = Hash;
8521
+ var HMAC = (
8522
+ /** @class */
8523
+ function() {
8524
+ function HMAC2(key) {
8525
+ this.inner = new Hash();
8526
+ this.outer = new Hash();
8527
+ this.blockSize = this.inner.blockSize;
8528
+ this.digestLength = this.inner.digestLength;
8529
+ var pad = new Uint8Array(this.blockSize);
8530
+ if (key.length > this.blockSize) {
8531
+ new Hash().update(key).finish(pad).clean();
8532
+ } else {
8533
+ for (var i = 0; i < key.length; i++) {
8534
+ pad[i] = key[i];
8535
+ }
8536
+ }
8537
+ for (var i = 0; i < pad.length; i++) {
8538
+ pad[i] ^= 54;
8539
+ }
8540
+ this.inner.update(pad);
8541
+ for (var i = 0; i < pad.length; i++) {
8542
+ pad[i] ^= 54 ^ 92;
8543
+ }
8544
+ this.outer.update(pad);
8545
+ this.istate = new Uint32Array(8);
8546
+ this.ostate = new Uint32Array(8);
8547
+ this.inner._saveState(this.istate);
8548
+ this.outer._saveState(this.ostate);
8549
+ for (var i = 0; i < pad.length; i++) {
8550
+ pad[i] = 0;
8551
+ }
8552
+ }
8553
+ HMAC2.prototype.reset = function() {
8554
+ this.inner._restoreState(this.istate, this.inner.blockSize);
8555
+ this.outer._restoreState(this.ostate, this.outer.blockSize);
8556
+ return this;
8557
+ };
8558
+ HMAC2.prototype.clean = function() {
8559
+ for (var i = 0; i < this.istate.length; i++) {
8560
+ this.ostate[i] = this.istate[i] = 0;
8561
+ }
8562
+ this.inner.clean();
8563
+ this.outer.clean();
8564
+ };
8565
+ HMAC2.prototype.update = function(data) {
8566
+ this.inner.update(data);
8567
+ return this;
8568
+ };
8569
+ HMAC2.prototype.finish = function(out) {
8570
+ if (this.outer.finished) {
8571
+ this.outer.finish(out);
8572
+ } else {
8573
+ this.inner.finish(out);
8574
+ this.outer.update(out, this.digestLength).finish(out);
8575
+ }
8576
+ return this;
8577
+ };
8578
+ HMAC2.prototype.digest = function() {
8579
+ var out = new Uint8Array(this.digestLength);
8580
+ this.finish(out);
8581
+ return out;
8582
+ };
8583
+ return HMAC2;
8584
+ }()
8585
+ );
8586
+ exports2.HMAC = HMAC;
8587
+ function hash(data) {
8588
+ var h = new Hash().update(data);
8589
+ var digest = h.digest();
8590
+ h.clean();
8591
+ return digest;
8592
+ }
8593
+ exports2.hash = hash;
8594
+ exports2["default"] = hash;
8595
+ function hmac2(key, data) {
8596
+ var h = new HMAC(key).update(data);
8597
+ var digest = h.digest();
8598
+ h.clean();
8599
+ return digest;
8600
+ }
8601
+ exports2.hmac = hmac2;
8602
+ function fillBuffer(buffer, hmac3, info, counter) {
8603
+ var num = counter[0];
8604
+ if (num === 0) {
8605
+ throw new Error("hkdf: cannot expand more");
8606
+ }
8607
+ hmac3.reset();
8608
+ if (num > 1) {
8609
+ hmac3.update(buffer);
8610
+ }
8611
+ if (info) {
8612
+ hmac3.update(info);
8613
+ }
8614
+ hmac3.update(counter);
8615
+ hmac3.finish(buffer);
8616
+ counter[0]++;
8617
+ }
8618
+ var hkdfSalt = new Uint8Array(exports2.digestLength);
8619
+ function hkdf(key, salt, info, length) {
8620
+ if (salt === void 0) {
8621
+ salt = hkdfSalt;
8622
+ }
8623
+ if (length === void 0) {
8624
+ length = 32;
8625
+ }
8626
+ var counter = new Uint8Array([1]);
8627
+ var okm = hmac2(salt, key);
8628
+ var hmac_ = new HMAC(okm);
8629
+ var buffer = new Uint8Array(hmac_.digestLength);
8630
+ var bufpos = buffer.length;
8631
+ var out = new Uint8Array(length);
8632
+ for (var i = 0; i < length; i++) {
8633
+ if (bufpos === buffer.length) {
8634
+ fillBuffer(buffer, hmac_, info, counter);
8635
+ bufpos = 0;
8636
+ }
8637
+ out[i] = buffer[bufpos++];
8638
+ }
8639
+ hmac_.clean();
8640
+ buffer.fill(0);
8641
+ counter.fill(0);
8642
+ return out;
8643
+ }
8644
+ exports2.hkdf = hkdf;
8645
+ function pbkdf2(password, salt, iterations, dkLen) {
8646
+ var prf = new HMAC(password);
8647
+ var len = prf.digestLength;
8648
+ var ctr = new Uint8Array(4);
8649
+ var t = new Uint8Array(len);
8650
+ var u = new Uint8Array(len);
8651
+ var dk = new Uint8Array(dkLen);
8652
+ for (var i = 0; i * len < dkLen; i++) {
8653
+ var c = i + 1;
8654
+ ctr[0] = c >>> 24 & 255;
8655
+ ctr[1] = c >>> 16 & 255;
8656
+ ctr[2] = c >>> 8 & 255;
8657
+ ctr[3] = c >>> 0 & 255;
8658
+ prf.reset();
8659
+ prf.update(salt);
8660
+ prf.update(ctr);
8661
+ prf.finish(u);
8662
+ for (var j = 0; j < len; j++) {
8663
+ t[j] = u[j];
8664
+ }
8665
+ for (var j = 2; j <= iterations; j++) {
8666
+ prf.reset();
8667
+ prf.update(u).finish(u);
8668
+ for (var k = 0; k < len; k++) {
8669
+ t[k] ^= u[k];
8670
+ }
8671
+ }
8672
+ for (var j = 0; j < len && i * len + j < dkLen; j++) {
8673
+ dk[i * len + j] = t[j];
8674
+ }
8675
+ }
8676
+ for (var i = 0; i < len; i++) {
8677
+ t[i] = u[i] = 0;
8678
+ }
8679
+ for (var i = 0; i < 4; i++) {
8680
+ ctr[i] = 0;
8681
+ }
8682
+ prf.clean();
8683
+ return dk;
8684
+ }
8685
+ exports2.pbkdf2 = pbkdf2;
8686
+ });
8687
+ }
8688
+ });
8689
+
8690
+ // src/webhook/vendor/standardwebhook.ts
8691
+ __toESM(require_base64());
8692
+ __toESM(require_sha256());
8693
+ /**
8694
+ * The MIT License
8695
+ *
8696
+ * Copyright (c) 2023 Svix (https://www.svix.com)
8697
+ *
8698
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8699
+ * of this software and associated documentation files (the "Software"), to deal
8700
+ * in the Software without restriction, including without limitation the rights
8701
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8702
+ * copies of the Software, and to permit persons to whom the Software is
8703
+ * furnished to do so, subject to the following conditions:
8704
+ *
8705
+ * The above copyright notice and this permission notice shall be included in
8706
+ * all copies or substantial portions of the Software.
8707
+ *
8708
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8709
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8710
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8711
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8712
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
8713
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
8714
+ * THE SOFTWARE.
8715
+ *
8716
+ * @fileoverview Server-only webhook verification implementation.
8717
+ * @description Vendored from standardwebhooks package to avoid bundling issues.
8718
+ * Uses Node.js crypto module - DO NOT import in client/browser code.
8719
+ * @license MIT
8720
+ * @internal
8721
+ */
8722
+
8723
+ // src/webhook/webhook.ts
8029
8724
  async function handleWebhookPayload(payload, config, context) {
8030
8725
  const callHandler = (handler, payload2) => {
8031
8726
  if (!handler) return;