@riverbankcms/sdk 0.121.0 → 0.123.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/{PreviewEditorSidebar-lZ600tJx.mjs → PreviewEditorSidebar-DvJFmC29.mjs} +6 -6
  2. package/dist/{PreviewEditorUI-CTBWzLSb.mjs → PreviewEditorUI-DVHP4bCo.mjs} +3 -3
  3. package/dist/{PreviewQueryProvider-BHT8CJvZ.mjs → PreviewQueryProvider-07EE4uWL.mjs} +1 -1
  4. package/dist/{SdkPreviewModeRuntime-DhPU58s7.mjs → SdkPreviewModeRuntime-BE5eFayo.mjs} +5 -5
  5. package/dist/{SiteChromeCustomizeContext-BkNvpzNZ.mjs → SiteChromeCustomizeContext-4hn4A0HX.mjs} +3 -3
  6. package/dist/_dts/api/src/bookingConfig.d.ts +32 -6
  7. package/dist/_dts/api/src/endpoints.d.ts +1 -1
  8. package/dist/_dts/api/src/index.d.ts +2 -2
  9. package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +3 -3
  10. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +23 -11
  11. package/dist/_dts/sdk/src/version.d.ts +1 -1
  12. package/dist/cli/index.mjs +142 -2511
  13. package/dist/client/client.mjs +2 -1
  14. package/dist/preview-next/before-render.mjs +1 -0
  15. package/dist/preview-next/client/runtime.mjs +4 -4
  16. package/dist/preview-next/middleware.mjs +1 -0
  17. package/dist/{previewAuthStore-31xH13Jc.mjs → previewAuthStore-ShY26RNz.mjs} +1 -0
  18. package/dist/{sdk-runtime-BE_vcGua.mjs → sdk-runtime-CJxkFq2B.mjs} +2 -2
  19. package/dist/{separator-CiffYtk3.mjs → separator-CoFmo8uA.mjs} +1 -1
  20. package/dist/server/components.mjs +32 -2401
  21. package/dist/server/index.mjs +2 -1
  22. package/dist/server/next.mjs +34 -2401
  23. package/dist/server/prebuild.mjs +1 -1
  24. package/dist/server/rendering/server.mjs +32 -2404
  25. package/dist/server/rendering.mjs +32 -2401
  26. package/dist/server/server.mjs +2 -1
  27. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- import { createRequire } from "node:module";
2
1
  import { notFound, permanentRedirect, redirect } from "next/navigation";
3
2
  import { cookies } from "next/headers";
4
3
  import z, { z as z$1 } from "zod";
@@ -6,9 +5,6 @@ import * as React$1 from "react";
6
5
  import React, { forwardRef } from "react";
7
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
7
  import { BlocksIslandsHydrator } from "#sdk-rendering-client";
9
- //#region \0rolldown/runtime.js
10
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
11
- var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
12
8
  /**
13
9
  * Detect if preview mode is enabled.
14
10
  * Uses RIVERBANK_PREVIEW_MODE first, then falls back to RIVERBANK_PREVIEW for backward compat.
@@ -522,6 +518,7 @@ const API_ENDPOINTS$1 = {
522
518
  errors: [
523
519
  "validation:invalid_input",
524
520
  "auth:forbidden",
521
+ "resource:conflict",
525
522
  "server:internal_error"
526
523
  ]
527
524
  },
@@ -53075,2395 +53072,7 @@ function resolveButtonAffordance(input) {
53075
53072
  return null;
53076
53073
  }
53077
53074
  //#endregion
53078
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/shared.js
53079
- var require_shared = /* @__PURE__ */ __commonJSMin(((exports) => {
53080
- Object.defineProperty(exports, "__esModule", { value: true });
53081
- exports.throttle = exports.EndpointType = exports.isNoPrettyPrint = void 0;
53082
- exports.requestToJSON = requestToJSON;
53083
- exports.isNoPrettyPrint = process.env.AXIOM_NO_PRETTY_PRINT == "true" ? true : false;
53084
- var EndpointType;
53085
- (function(EndpointType) {
53086
- EndpointType["webVitals"] = "web-vitals";
53087
- EndpointType["logs"] = "logs";
53088
- })(EndpointType || (exports.EndpointType = EndpointType = {}));
53089
- /**
53090
- * Transforms a NextRequest or Request object into a JSON-serializable object
53091
- */
53092
- async function requestToJSON(request) {
53093
- const headers = {};
53094
- request.headers.forEach((value, key) => {
53095
- headers[key] = value;
53096
- });
53097
- let cookiesData = {};
53098
- if ("cookies" in request) request.cookies.getAll().forEach((cookie) => {
53099
- cookiesData[cookie.name] = cookie.value;
53100
- });
53101
- else {
53102
- const cookieHeader = headers["cookie"];
53103
- if (cookieHeader) cookiesData = Object.fromEntries(cookieHeader.split(";").map((cookie) => {
53104
- const [key, value] = cookie.trim().split("=");
53105
- return [key, value];
53106
- }));
53107
- }
53108
- let nextUrlData;
53109
- if ("nextUrl" in request) {
53110
- const nextUrl = request.nextUrl;
53111
- nextUrlData = {
53112
- basePath: nextUrl.basePath,
53113
- buildId: nextUrl.buildId,
53114
- hash: nextUrl.hash,
53115
- host: nextUrl.host,
53116
- hostname: nextUrl.hostname,
53117
- href: nextUrl.href,
53118
- origin: nextUrl.origin,
53119
- password: nextUrl.password,
53120
- pathname: nextUrl.pathname,
53121
- port: nextUrl.port,
53122
- protocol: nextUrl.protocol,
53123
- search: nextUrl.search,
53124
- searchParams: Object.fromEntries(nextUrl.searchParams.entries()),
53125
- username: nextUrl.username
53126
- };
53127
- }
53128
- let body;
53129
- if (request.body) try {
53130
- const clonedRequest = request.clone();
53131
- try {
53132
- body = await clonedRequest.json();
53133
- clonedRequest.body?.getReader;
53134
- } catch {
53135
- body = await clonedRequest.text();
53136
- }
53137
- } catch (error) {
53138
- console.warn("Could not parse request body:", error);
53139
- }
53140
- const cache = {
53141
- mode: request.cache,
53142
- credentials: request.credentials,
53143
- redirect: request.redirect,
53144
- referrerPolicy: request.referrerPolicy,
53145
- integrity: request.integrity
53146
- };
53147
- let ip;
53148
- if ("ip" in request) ip = request.ip;
53149
- let geo;
53150
- if ("geo" in request) geo = request.geo;
53151
- return {
53152
- method: request.method,
53153
- url: request.url,
53154
- headers,
53155
- cookies: cookiesData,
53156
- nextUrl: nextUrlData,
53157
- ip,
53158
- geo,
53159
- body,
53160
- cache,
53161
- mode: request.mode,
53162
- destination: request.destination,
53163
- referrer: request.referrer,
53164
- keepalive: request.keepalive,
53165
- signal: {
53166
- aborted: request.signal.aborted,
53167
- reason: request.signal.reason
53168
- }
53169
- };
53170
- }
53171
- const throttle = (fn, wait) => {
53172
- let lastFn, lastTime;
53173
- return function() {
53174
- const context = this, args = arguments;
53175
- if (lastTime == null) lastTime = Date.now();
53176
- clearTimeout(lastFn);
53177
- lastFn = setTimeout(() => {
53178
- if (Date.now() - lastTime >= wait) {
53179
- fn.apply(context, args);
53180
- lastTime = Date.now();
53181
- }
53182
- }, Math.max(wait - (Date.now() - lastTime), 0));
53183
- };
53184
- };
53185
- exports.throttle = throttle;
53186
- }));
53187
- //#endregion
53188
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/platform/generic.js
53189
- var require_generic = /* @__PURE__ */ __commonJSMin(((exports) => {
53190
- Object.defineProperty(exports, "__esModule", { value: true });
53191
- const shared_1 = require_shared();
53192
- const config_1 = require_config();
53193
- var GenericConfig = class {
53194
- constructor() {
53195
- this.proxyPath = "/_axiom";
53196
- this.shouldSendEdgeReport = false;
53197
- this.token = process.env.NEXT_PUBLIC_AXIOM_TOKEN || process.env.AXIOM_TOKEN;
53198
- this.dataset = process.env.NEXT_PUBLIC_AXIOM_DATASET || process.env.AXIOM_DATASET;
53199
- this.environment = process.env.NODE_ENV;
53200
- this.axiomUrl = process.env.NEXT_PUBLIC_AXIOM_URL || process.env.AXIOM_URL || "https://api.axiom.co";
53201
- this.region = process.env.REGION || void 0;
53202
- this.customEndpoint = process.env.NEXT_PUBLIC_AXIOM_CUSTOM_ENDPOINT;
53203
- }
53204
- isEnvVarsSet() {
53205
- return !!(this.axiomUrl && this.dataset && this.token) || !!this.customEndpoint;
53206
- }
53207
- getIngestURL(_) {
53208
- return `${this.axiomUrl}/v1/datasets/${this.dataset}/ingest`;
53209
- }
53210
- getLogsEndpoint() {
53211
- if (config_1.isBrowser && this.customEndpoint) return this.customEndpoint;
53212
- return config_1.isBrowser ? `${this.proxyPath}/logs` : this.getIngestURL(shared_1.EndpointType.logs);
53213
- }
53214
- getWebVitalsEndpoint() {
53215
- if (config_1.isBrowser && this.customEndpoint) return this.customEndpoint;
53216
- return config_1.isBrowser ? `${this.proxyPath}/web-vitals` : this.getIngestURL(shared_1.EndpointType.webVitals);
53217
- }
53218
- wrapWebVitalsObject(metrics) {
53219
- return metrics.map((m) => ({
53220
- webVital: m,
53221
- _time: (/* @__PURE__ */ new Date()).getTime(),
53222
- platform: {
53223
- environment: this.environment,
53224
- source: "web-vital"
53225
- },
53226
- source: "web-vital"
53227
- }));
53228
- }
53229
- injectPlatformMetadata(logEvent, source) {
53230
- let key = "platform";
53231
- if (config_1.isVercel) key = "vercel";
53232
- logEvent.source = source;
53233
- logEvent[key] = {
53234
- environment: this.environment,
53235
- region: this.region,
53236
- source
53237
- };
53238
- if (config_1.isVercel) {
53239
- logEvent[key].region = process.env.VERCEL_REGION;
53240
- logEvent[key].deploymentId = process.env.VERCEL_DEPLOYMENT_ID;
53241
- logEvent[key].deploymentUrl = process.env.NEXT_PUBLIC_VERCEL_URL;
53242
- logEvent[key].project = process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL;
53243
- logEvent.git = {
53244
- commit: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,
53245
- repo: process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG,
53246
- ref: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF
53247
- };
53248
- }
53249
- }
53250
- getHeaderOrDefault(req, headerName, defaultValue) {
53251
- return req.headers[headerName] ? req.headers[headerName] : defaultValue;
53252
- }
53253
- };
53254
- exports.default = GenericConfig;
53255
- }));
53256
- //#endregion
53257
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/platform/vercel.js
53258
- var require_vercel = /* @__PURE__ */ __commonJSMin(((exports) => {
53259
- var __importDefault = exports && exports.__importDefault || function(mod) {
53260
- return mod && mod.__esModule ? mod : { "default": mod };
53261
- };
53262
- Object.defineProperty(exports, "__esModule", { value: true });
53263
- const config_1 = require_config();
53264
- const shared_1 = require_shared();
53265
- const generic_1 = __importDefault(require_generic());
53266
- const ingestEndpoint = process.env.NEXT_PUBLIC_AXIOM_INGEST_ENDPOINT || process.env.AXIOM_INGEST_ENDPOINT || "";
53267
- var VercelConfig = class extends generic_1.default {
53268
- constructor(..._args) {
53269
- super(..._args);
53270
- this.provider = "vercel";
53271
- this.shouldSendEdgeReport = true;
53272
- this.region = process.env.VERCEL_REGION || void 0;
53273
- this.environment = process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.VERCEL_ENV || process.env.NODE_ENV || "";
53274
- this.token = void 0;
53275
- this.axiomUrl = ingestEndpoint;
53276
- }
53277
- isEnvVarsSet() {
53278
- return ingestEndpoint != void 0 && ingestEndpoint != "" || !!this.customEndpoint;
53279
- }
53280
- getIngestURL(t) {
53281
- const url = new URL(this.axiomUrl);
53282
- url.searchParams.set("type", t.toString());
53283
- return url.toString();
53284
- }
53285
- getWebVitalsEndpoint() {
53286
- if (config_1.isBrowser && this.customEndpoint) return this.customEndpoint;
53287
- return `${this.proxyPath}/web-vitals`;
53288
- }
53289
- getLogsEndpoint() {
53290
- if (config_1.isBrowser && this.customEndpoint) return this.customEndpoint;
53291
- return config_1.isBrowser ? `${this.proxyPath}/logs` : this.getIngestURL(shared_1.EndpointType.logs);
53292
- }
53293
- wrapWebVitalsObject(metrics) {
53294
- return {
53295
- webVitals: metrics,
53296
- environment: this.environment
53297
- };
53298
- }
53299
- injectPlatformMetadata(logEvent, source) {
53300
- logEvent.vercel = {
53301
- environment: this.environment,
53302
- region: this.region,
53303
- source
53304
- };
53305
- }
53306
- };
53307
- exports.default = VercelConfig;
53308
- }));
53309
- //#endregion
53310
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/platform/netlify.js
53311
- var require_netlify = /* @__PURE__ */ __commonJSMin(((exports) => {
53312
- var __importDefault = exports && exports.__importDefault || function(mod) {
53313
- return mod && mod.__esModule ? mod : { "default": mod };
53314
- };
53315
- Object.defineProperty(exports, "__esModule", { value: true });
53316
- const generic_1 = __importDefault(require_generic());
53317
- const netlifySiteId = process.env.SITE_ID;
53318
- const netlifyBuildId = process.env.BUILD_ID;
53319
- const netlifyContext = process.env.CONTEXT;
53320
- const netlifyDeploymentUrl = process.env.DEPLOYMENT_URL;
53321
- const netlifyDeploymentId = process.env.DEPLOYMENT_ID;
53322
- var NetlifyConfig = class extends generic_1.default {
53323
- wrapWebVitalsObject(metrics) {
53324
- return metrics.map((m) => ({
53325
- webVital: m,
53326
- _time: (/* @__PURE__ */ new Date()).getTime(),
53327
- netlify: {
53328
- environment: this.environment,
53329
- source: "web-vital",
53330
- siteId: netlifySiteId,
53331
- buildId: netlifyBuildId,
53332
- context: netlifyContext,
53333
- deploymentUrl: netlifyDeploymentUrl,
53334
- deploymentId: netlifyDeploymentId
53335
- }
53336
- }));
53337
- }
53338
- injectPlatformMetadata(logEvent, source) {
53339
- logEvent.netlify = {
53340
- environment: this.environment,
53341
- region: source === "edge" ? process.env.DENO_REGION : process.env.AWS_REGION,
53342
- source,
53343
- siteId: netlifySiteId,
53344
- buildId: netlifyBuildId,
53345
- context: netlifyContext,
53346
- deploymentUrl: netlifyDeploymentUrl,
53347
- deploymentId: source === "edge" ? process.env.DENO_DEPLOYMENT_ID : netlifyDeploymentId
53348
- };
53349
- }
53350
- };
53351
- exports.default = NetlifyConfig;
53352
- }));
53353
- //#endregion
53354
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/package.json
53355
- var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53356
- module.exports = {
53357
- "name": "next-axiom",
53358
- "description": "Send WebVitals from your Next.js project to Axiom.",
53359
- "version": "1.10.0",
53360
- "author": "Axiom, Inc.",
53361
- "license": "MIT",
53362
- "contributors": ["Arne Bahlo <arne@axiom.co>", "Islam Shehata <islam@axiom.co>"],
53363
- "engines": { "node": ">=18" },
53364
- "main": "dist/index.js",
53365
- "types": "dist/index.d.ts",
53366
- "repository": {
53367
- "type": "git",
53368
- "url": "git+https://github.com/axiomhq/next-axiom.git"
53369
- },
53370
- "keywords": [
53371
- "web-vitals",
53372
- "axiom",
53373
- "observability",
53374
- "performance",
53375
- "nextjs"
53376
- ],
53377
- "bugs": { "url": "https://github.com/axiomhq/next-axiom/issues" },
53378
- "homepage": "https://github.com/axiomhq/next-axiom#readme",
53379
- "peerDependencies": {
53380
- "next": ">=14.0",
53381
- "react": ">=18.0.0"
53382
- },
53383
- "devDependencies": {
53384
- "@types/node": "^20.19.26",
53385
- "@types/react": "^18.3.27",
53386
- "@vitest/coverage-v8": "^2.1.9",
53387
- "next": "^14.2.33",
53388
- "prettier": "^3.7.4",
53389
- "react-dom": "^19.2.1",
53390
- "ts-node": "^10.9.2",
53391
- "typescript": "^5.9.3",
53392
- "vitest": "^2.1.9"
53393
- },
53394
- "dependencies": {
53395
- "@vercel/functions": "^2.2.13",
53396
- "use-deep-compare": "^1.3.0",
53397
- "whatwg-fetch": "^3.6.20"
53398
- },
53399
- "scripts": {
53400
- "build": "tsc",
53401
- "format": "prettier --write src/*.ts tests/*.ts",
53402
- "check-format": "prettier -c src/*.ts tests/*.ts",
53403
- "test": "vitest run tests --coverage"
53404
- }
53405
- };
53406
- }));
53407
- //#endregion
53408
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/config.js
53409
- var require_config = /* @__PURE__ */ __commonJSMin(((exports) => {
53410
- var __importDefault = exports && exports.__importDefault || function(mod) {
53411
- return mod && mod.__esModule ? mod : { "default": mod };
53412
- };
53413
- Object.defineProperty(exports, "__esModule", { value: true });
53414
- exports.config = exports.isEdgeRuntime = exports.isBrowser = exports.isWebWorker = exports.isNetlify = exports.isVercel = exports.isVercelIntegration = exports.Version = void 0;
53415
- const generic_1 = __importDefault(require_generic());
53416
- const vercel_1 = __importDefault(require_vercel());
53417
- const netlify_1 = __importDefault(require_netlify());
53418
- exports.Version = require_package().version;
53419
- exports.isVercelIntegration = process.env.NEXT_PUBLIC_AXIOM_INGEST_ENDPOINT || process.env.AXIOM_INGEST_ENDPOINT;
53420
- exports.isVercel = process.env.NEXT_PUBLIC_VERCEL || process.env.VERCEL;
53421
- exports.isNetlify = process.env.NETLIFY == "true";
53422
- exports.isWebWorker = typeof self !== "undefined" && typeof globalThis.WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
53423
- exports.isBrowser = typeof window !== "undefined" || exports.isWebWorker;
53424
- exports.isEdgeRuntime = globalThis.EdgeRuntime ? true : false;
53425
- let config = new generic_1.default();
53426
- exports.config = config;
53427
- if (exports.isVercelIntegration) exports.config = config = new vercel_1.default();
53428
- else if (exports.isNetlify) exports.config = config = new netlify_1.default();
53429
- }));
53430
- //#endregion
53431
- //#region ../../node_modules/.pnpm/whatwg-fetch@3.6.20/node_modules/whatwg-fetch/dist/fetch.umd.js
53432
- var require_fetch_umd = /* @__PURE__ */ __commonJSMin(((exports, module) => {
53433
- (function(global, factory) {
53434
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global.WHATWGFetch = {});
53435
- })(exports, (function(exports$2) {
53436
- "use strict";
53437
- var g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || typeof global !== "undefined" && global || {};
53438
- var support = {
53439
- searchParams: "URLSearchParams" in g,
53440
- iterable: "Symbol" in g && "iterator" in Symbol,
53441
- blob: "FileReader" in g && "Blob" in g && (function() {
53442
- try {
53443
- new Blob();
53444
- return true;
53445
- } catch (e) {
53446
- return false;
53447
- }
53448
- })(),
53449
- formData: "FormData" in g,
53450
- arrayBuffer: "ArrayBuffer" in g
53451
- };
53452
- function isDataView(obj) {
53453
- return obj && DataView.prototype.isPrototypeOf(obj);
53454
- }
53455
- if (support.arrayBuffer) {
53456
- var viewClasses = [
53457
- "[object Int8Array]",
53458
- "[object Uint8Array]",
53459
- "[object Uint8ClampedArray]",
53460
- "[object Int16Array]",
53461
- "[object Uint16Array]",
53462
- "[object Int32Array]",
53463
- "[object Uint32Array]",
53464
- "[object Float32Array]",
53465
- "[object Float64Array]"
53466
- ];
53467
- var isArrayBufferView = ArrayBuffer.isView || function(obj) {
53468
- return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
53469
- };
53470
- }
53471
- function normalizeName(name) {
53472
- if (typeof name !== "string") name = String(name);
53473
- if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") throw new TypeError("Invalid character in header field name: \"" + name + "\"");
53474
- return name.toLowerCase();
53475
- }
53476
- function normalizeValue(value) {
53477
- if (typeof value !== "string") value = String(value);
53478
- return value;
53479
- }
53480
- function iteratorFor(items) {
53481
- var iterator = { next: function() {
53482
- var value = items.shift();
53483
- return {
53484
- done: value === void 0,
53485
- value
53486
- };
53487
- } };
53488
- if (support.iterable) iterator[Symbol.iterator] = function() {
53489
- return iterator;
53490
- };
53491
- return iterator;
53492
- }
53493
- function Headers(headers) {
53494
- this.map = {};
53495
- if (headers instanceof Headers) headers.forEach(function(value, name) {
53496
- this.append(name, value);
53497
- }, this);
53498
- else if (Array.isArray(headers)) headers.forEach(function(header) {
53499
- if (header.length != 2) throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
53500
- this.append(header[0], header[1]);
53501
- }, this);
53502
- else if (headers) Object.getOwnPropertyNames(headers).forEach(function(name) {
53503
- this.append(name, headers[name]);
53504
- }, this);
53505
- }
53506
- Headers.prototype.append = function(name, value) {
53507
- name = normalizeName(name);
53508
- value = normalizeValue(value);
53509
- var oldValue = this.map[name];
53510
- this.map[name] = oldValue ? oldValue + ", " + value : value;
53511
- };
53512
- Headers.prototype["delete"] = function(name) {
53513
- delete this.map[normalizeName(name)];
53514
- };
53515
- Headers.prototype.get = function(name) {
53516
- name = normalizeName(name);
53517
- return this.has(name) ? this.map[name] : null;
53518
- };
53519
- Headers.prototype.has = function(name) {
53520
- return this.map.hasOwnProperty(normalizeName(name));
53521
- };
53522
- Headers.prototype.set = function(name, value) {
53523
- this.map[normalizeName(name)] = normalizeValue(value);
53524
- };
53525
- Headers.prototype.forEach = function(callback, thisArg) {
53526
- for (var name in this.map) if (this.map.hasOwnProperty(name)) callback.call(thisArg, this.map[name], name, this);
53527
- };
53528
- Headers.prototype.keys = function() {
53529
- var items = [];
53530
- this.forEach(function(value, name) {
53531
- items.push(name);
53532
- });
53533
- return iteratorFor(items);
53534
- };
53535
- Headers.prototype.values = function() {
53536
- var items = [];
53537
- this.forEach(function(value) {
53538
- items.push(value);
53539
- });
53540
- return iteratorFor(items);
53541
- };
53542
- Headers.prototype.entries = function() {
53543
- var items = [];
53544
- this.forEach(function(value, name) {
53545
- items.push([name, value]);
53546
- });
53547
- return iteratorFor(items);
53548
- };
53549
- if (support.iterable) Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
53550
- function consumed(body) {
53551
- if (body._noBody) return;
53552
- if (body.bodyUsed) return Promise.reject(/* @__PURE__ */ new TypeError("Already read"));
53553
- body.bodyUsed = true;
53554
- }
53555
- function fileReaderReady(reader) {
53556
- return new Promise(function(resolve, reject) {
53557
- reader.onload = function() {
53558
- resolve(reader.result);
53559
- };
53560
- reader.onerror = function() {
53561
- reject(reader.error);
53562
- };
53563
- });
53564
- }
53565
- function readBlobAsArrayBuffer(blob) {
53566
- var reader = new FileReader();
53567
- var promise = fileReaderReady(reader);
53568
- reader.readAsArrayBuffer(blob);
53569
- return promise;
53570
- }
53571
- function readBlobAsText(blob) {
53572
- var reader = new FileReader();
53573
- var promise = fileReaderReady(reader);
53574
- var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
53575
- var encoding = match ? match[1] : "utf-8";
53576
- reader.readAsText(blob, encoding);
53577
- return promise;
53578
- }
53579
- function readArrayBufferAsText(buf) {
53580
- var view = new Uint8Array(buf);
53581
- var chars = new Array(view.length);
53582
- for (var i = 0; i < view.length; i++) chars[i] = String.fromCharCode(view[i]);
53583
- return chars.join("");
53584
- }
53585
- function bufferClone(buf) {
53586
- if (buf.slice) return buf.slice(0);
53587
- else {
53588
- var view = new Uint8Array(buf.byteLength);
53589
- view.set(new Uint8Array(buf));
53590
- return view.buffer;
53591
- }
53592
- }
53593
- function Body() {
53594
- this.bodyUsed = false;
53595
- this._initBody = function(body) {
53596
- this.bodyUsed = this.bodyUsed;
53597
- this._bodyInit = body;
53598
- if (!body) {
53599
- this._noBody = true;
53600
- this._bodyText = "";
53601
- } else if (typeof body === "string") this._bodyText = body;
53602
- else if (support.blob && Blob.prototype.isPrototypeOf(body)) this._bodyBlob = body;
53603
- else if (support.formData && FormData.prototype.isPrototypeOf(body)) this._bodyFormData = body;
53604
- else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) this._bodyText = body.toString();
53605
- else if (support.arrayBuffer && support.blob && isDataView(body)) {
53606
- this._bodyArrayBuffer = bufferClone(body.buffer);
53607
- this._bodyInit = new Blob([this._bodyArrayBuffer]);
53608
- } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) this._bodyArrayBuffer = bufferClone(body);
53609
- else this._bodyText = body = Object.prototype.toString.call(body);
53610
- if (!this.headers.get("content-type")) {
53611
- if (typeof body === "string") this.headers.set("content-type", "text/plain;charset=UTF-8");
53612
- else if (this._bodyBlob && this._bodyBlob.type) this.headers.set("content-type", this._bodyBlob.type);
53613
- else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
53614
- }
53615
- };
53616
- if (support.blob) this.blob = function() {
53617
- var rejected = consumed(this);
53618
- if (rejected) return rejected;
53619
- if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
53620
- else if (this._bodyArrayBuffer) return Promise.resolve(new Blob([this._bodyArrayBuffer]));
53621
- else if (this._bodyFormData) throw new Error("could not read FormData body as blob");
53622
- else return Promise.resolve(new Blob([this._bodyText]));
53623
- };
53624
- this.arrayBuffer = function() {
53625
- if (this._bodyArrayBuffer) {
53626
- var isConsumed = consumed(this);
53627
- if (isConsumed) return isConsumed;
53628
- else if (ArrayBuffer.isView(this._bodyArrayBuffer)) return Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset, this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength));
53629
- else return Promise.resolve(this._bodyArrayBuffer);
53630
- } else if (support.blob) return this.blob().then(readBlobAsArrayBuffer);
53631
- else throw new Error("could not read as ArrayBuffer");
53632
- };
53633
- this.text = function() {
53634
- var rejected = consumed(this);
53635
- if (rejected) return rejected;
53636
- if (this._bodyBlob) return readBlobAsText(this._bodyBlob);
53637
- else if (this._bodyArrayBuffer) return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
53638
- else if (this._bodyFormData) throw new Error("could not read FormData body as text");
53639
- else return Promise.resolve(this._bodyText);
53640
- };
53641
- if (support.formData) this.formData = function() {
53642
- return this.text().then(decode);
53643
- };
53644
- this.json = function() {
53645
- return this.text().then(JSON.parse);
53646
- };
53647
- return this;
53648
- }
53649
- var methods = [
53650
- "CONNECT",
53651
- "DELETE",
53652
- "GET",
53653
- "HEAD",
53654
- "OPTIONS",
53655
- "PATCH",
53656
- "POST",
53657
- "PUT",
53658
- "TRACE"
53659
- ];
53660
- function normalizeMethod(method) {
53661
- var upcased = method.toUpperCase();
53662
- return methods.indexOf(upcased) > -1 ? upcased : method;
53663
- }
53664
- function Request(input, options) {
53665
- if (!(this instanceof Request)) throw new TypeError("Please use the \"new\" operator, this DOM object constructor cannot be called as a function.");
53666
- options = options || {};
53667
- var body = options.body;
53668
- if (input instanceof Request) {
53669
- if (input.bodyUsed) throw new TypeError("Already read");
53670
- this.url = input.url;
53671
- this.credentials = input.credentials;
53672
- if (!options.headers) this.headers = new Headers(input.headers);
53673
- this.method = input.method;
53674
- this.mode = input.mode;
53675
- this.signal = input.signal;
53676
- if (!body && input._bodyInit != null) {
53677
- body = input._bodyInit;
53678
- input.bodyUsed = true;
53679
- }
53680
- } else this.url = String(input);
53681
- this.credentials = options.credentials || this.credentials || "same-origin";
53682
- if (options.headers || !this.headers) this.headers = new Headers(options.headers);
53683
- this.method = normalizeMethod(options.method || this.method || "GET");
53684
- this.mode = options.mode || this.mode || null;
53685
- this.signal = options.signal || this.signal || function() {
53686
- if ("AbortController" in g) return new AbortController().signal;
53687
- }();
53688
- this.referrer = null;
53689
- if ((this.method === "GET" || this.method === "HEAD") && body) throw new TypeError("Body not allowed for GET or HEAD requests");
53690
- this._initBody(body);
53691
- if (this.method === "GET" || this.method === "HEAD") {
53692
- if (options.cache === "no-store" || options.cache === "no-cache") {
53693
- var reParamSearch = /([?&])_=[^&]*/;
53694
- if (reParamSearch.test(this.url)) this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
53695
- else {
53696
- var reQueryString = /\?/;
53697
- this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
53698
- }
53699
- }
53700
- }
53701
- }
53702
- Request.prototype.clone = function() {
53703
- return new Request(this, { body: this._bodyInit });
53704
- };
53705
- function decode(body) {
53706
- var form = new FormData();
53707
- body.trim().split("&").forEach(function(bytes) {
53708
- if (bytes) {
53709
- var split = bytes.split("=");
53710
- var name = split.shift().replace(/\+/g, " ");
53711
- var value = split.join("=").replace(/\+/g, " ");
53712
- form.append(decodeURIComponent(name), decodeURIComponent(value));
53713
- }
53714
- });
53715
- return form;
53716
- }
53717
- function parseHeaders(rawHeaders) {
53718
- var headers = new Headers();
53719
- rawHeaders.replace(/\r?\n[\t ]+/g, " ").split("\r").map(function(header) {
53720
- return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
53721
- }).forEach(function(line) {
53722
- var parts = line.split(":");
53723
- var key = parts.shift().trim();
53724
- if (key) {
53725
- var value = parts.join(":").trim();
53726
- try {
53727
- headers.append(key, value);
53728
- } catch (error) {
53729
- console.warn("Response " + error.message);
53730
- }
53731
- }
53732
- });
53733
- return headers;
53734
- }
53735
- Body.call(Request.prototype);
53736
- function Response(bodyInit, options) {
53737
- if (!(this instanceof Response)) throw new TypeError("Please use the \"new\" operator, this DOM object constructor cannot be called as a function.");
53738
- if (!options) options = {};
53739
- this.type = "default";
53740
- this.status = options.status === void 0 ? 200 : options.status;
53741
- if (this.status < 200 || this.status > 599) throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
53742
- this.ok = this.status >= 200 && this.status < 300;
53743
- this.statusText = options.statusText === void 0 ? "" : "" + options.statusText;
53744
- this.headers = new Headers(options.headers);
53745
- this.url = options.url || "";
53746
- this._initBody(bodyInit);
53747
- }
53748
- Body.call(Response.prototype);
53749
- Response.prototype.clone = function() {
53750
- return new Response(this._bodyInit, {
53751
- status: this.status,
53752
- statusText: this.statusText,
53753
- headers: new Headers(this.headers),
53754
- url: this.url
53755
- });
53756
- };
53757
- Response.error = function() {
53758
- var response = new Response(null, {
53759
- status: 200,
53760
- statusText: ""
53761
- });
53762
- response.ok = false;
53763
- response.status = 0;
53764
- response.type = "error";
53765
- return response;
53766
- };
53767
- var redirectStatuses = [
53768
- 301,
53769
- 302,
53770
- 303,
53771
- 307,
53772
- 308
53773
- ];
53774
- Response.redirect = function(url, status) {
53775
- if (redirectStatuses.indexOf(status) === -1) throw new RangeError("Invalid status code");
53776
- return new Response(null, {
53777
- status,
53778
- headers: { location: url }
53779
- });
53780
- };
53781
- exports$2.DOMException = g.DOMException;
53782
- try {
53783
- new exports$2.DOMException();
53784
- } catch (err) {
53785
- exports$2.DOMException = function(message, name) {
53786
- this.message = message;
53787
- this.name = name;
53788
- var error = Error(message);
53789
- this.stack = error.stack;
53790
- };
53791
- exports$2.DOMException.prototype = Object.create(Error.prototype);
53792
- exports$2.DOMException.prototype.constructor = exports$2.DOMException;
53793
- }
53794
- function fetch(input, init) {
53795
- return new Promise(function(resolve, reject) {
53796
- var request = new Request(input, init);
53797
- if (request.signal && request.signal.aborted) return reject(new exports$2.DOMException("Aborted", "AbortError"));
53798
- var xhr = new XMLHttpRequest();
53799
- function abortXhr() {
53800
- xhr.abort();
53801
- }
53802
- xhr.onload = function() {
53803
- var options = {
53804
- statusText: xhr.statusText,
53805
- headers: parseHeaders(xhr.getAllResponseHeaders() || "")
53806
- };
53807
- if (request.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) options.status = 200;
53808
- else options.status = xhr.status;
53809
- options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
53810
- var body = "response" in xhr ? xhr.response : xhr.responseText;
53811
- setTimeout(function() {
53812
- resolve(new Response(body, options));
53813
- }, 0);
53814
- };
53815
- xhr.onerror = function() {
53816
- setTimeout(function() {
53817
- reject(/* @__PURE__ */ new TypeError("Network request failed"));
53818
- }, 0);
53819
- };
53820
- xhr.ontimeout = function() {
53821
- setTimeout(function() {
53822
- reject(/* @__PURE__ */ new TypeError("Network request timed out"));
53823
- }, 0);
53824
- };
53825
- xhr.onabort = function() {
53826
- setTimeout(function() {
53827
- reject(new exports$2.DOMException("Aborted", "AbortError"));
53828
- }, 0);
53829
- };
53830
- function fixUrl(url) {
53831
- try {
53832
- return url === "" && g.location.href ? g.location.href : url;
53833
- } catch (e) {
53834
- return url;
53835
- }
53836
- }
53837
- xhr.open(request.method, fixUrl(request.url), true);
53838
- if (request.credentials === "include") xhr.withCredentials = true;
53839
- else if (request.credentials === "omit") xhr.withCredentials = false;
53840
- if ("responseType" in xhr) {
53841
- if (support.blob) xhr.responseType = "blob";
53842
- else if (support.arrayBuffer) xhr.responseType = "arraybuffer";
53843
- }
53844
- if (init && typeof init.headers === "object" && !(init.headers instanceof Headers || g.Headers && init.headers instanceof g.Headers)) {
53845
- var names = [];
53846
- Object.getOwnPropertyNames(init.headers).forEach(function(name) {
53847
- names.push(normalizeName(name));
53848
- xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
53849
- });
53850
- request.headers.forEach(function(value, name) {
53851
- if (names.indexOf(name) === -1) xhr.setRequestHeader(name, value);
53852
- });
53853
- } else request.headers.forEach(function(value, name) {
53854
- xhr.setRequestHeader(name, value);
53855
- });
53856
- if (request.signal) {
53857
- request.signal.addEventListener("abort", abortXhr);
53858
- xhr.onreadystatechange = function() {
53859
- if (xhr.readyState === 4) request.signal.removeEventListener("abort", abortXhr);
53860
- };
53861
- }
53862
- xhr.send(typeof request._bodyInit === "undefined" ? null : request._bodyInit);
53863
- });
53864
- }
53865
- fetch.polyfill = true;
53866
- if (!g.fetch) {
53867
- g.fetch = fetch;
53868
- g.Headers = Headers;
53869
- g.Request = Request;
53870
- g.Response = Response;
53871
- }
53872
- exports$2.Headers = Headers;
53873
- exports$2.Request = Request;
53874
- exports$2.Response = Response;
53875
- exports$2.fetch = fetch;
53876
- Object.defineProperty(exports$2, "__esModule", { value: true });
53877
- }));
53878
- }));
53879
- //#endregion
53880
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/logger.js
53881
- var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
53882
- Object.defineProperty(exports, "__esModule", { value: true });
53883
- exports.log = exports.Logger = exports.LogLevel = void 0;
53884
- exports.prettyPrint = prettyPrint;
53885
- const config_1 = require_config();
53886
- const shared_1 = require_shared();
53887
- const url = config_1.config.getLogsEndpoint();
53888
- const LOG_LEVEL = process.env.NEXT_PUBLIC_AXIOM_LOG_LEVEL || "debug";
53889
- var LogLevel;
53890
- (function(LogLevel) {
53891
- LogLevel[LogLevel["debug"] = 0] = "debug";
53892
- LogLevel[LogLevel["info"] = 1] = "info";
53893
- LogLevel[LogLevel["warn"] = 2] = "warn";
53894
- LogLevel[LogLevel["error"] = 3] = "error";
53895
- LogLevel[LogLevel["off"] = 100] = "off";
53896
- })(LogLevel || (exports.LogLevel = LogLevel = {}));
53897
- var Logger = class Logger {
53898
- constructor(initConfig = {}) {
53899
- this.logEvents = [];
53900
- this.throttledSendLogs = (0, shared_1.throttle)(this.sendLogs, 1e3);
53901
- this.children = [];
53902
- this.logLevel = LogLevel.debug;
53903
- this.config = {
53904
- autoFlush: true,
53905
- source: "frontend-log",
53906
- prettyPrint
53907
- };
53908
- this.debug = (message, args = {}) => {
53909
- this.log(LogLevel.debug, message, args);
53910
- };
53911
- this.info = (message, args = {}) => {
53912
- this.log(LogLevel.info, message, args);
53913
- };
53914
- this.warn = (message, args = {}) => {
53915
- this.log(LogLevel.warn, message, args);
53916
- };
53917
- this.error = (message, args = {}) => {
53918
- this.log(LogLevel.error, message, args);
53919
- };
53920
- this.with = (args) => {
53921
- const child = new Logger({
53922
- ...this.config,
53923
- args: {
53924
- ...this.config.args,
53925
- ...args
53926
- }
53927
- });
53928
- this.children.push(child);
53929
- return child;
53930
- };
53931
- this.withRequest = (req) => {
53932
- return new Logger({
53933
- ...this.config,
53934
- req: {
53935
- ...this.config.req,
53936
- ...req
53937
- }
53938
- });
53939
- };
53940
- this._transformEvent = (level, message, args = {}) => {
53941
- const logEvent = {
53942
- level: LogLevel[level].toString(),
53943
- message,
53944
- _time: new Date(Date.now()).toISOString(),
53945
- source: this.config.source,
53946
- fields: this.config.args || {},
53947
- "@app": { "next-axiom-version": config_1.Version }
53948
- };
53949
- if (args instanceof Error) logEvent.fields = {
53950
- ...logEvent.fields,
53951
- message: args.message,
53952
- stack: args.stack,
53953
- name: args.name,
53954
- cause: args.cause
53955
- };
53956
- else if (typeof args === "object" && args !== null && Object.keys(args).length > 0) {
53957
- const parsedArgs = JSON.parse(JSON.stringify(args, jsonFriendlyErrorReplacer));
53958
- logEvent.fields = {
53959
- ...logEvent.fields,
53960
- ...parsedArgs
53961
- };
53962
- } else if (args && args.length) logEvent.fields = {
53963
- ...logEvent.fields,
53964
- args
53965
- };
53966
- config_1.config.injectPlatformMetadata(logEvent, this.config.source);
53967
- if (this.config.req != null) {
53968
- logEvent.request = this.config.req;
53969
- if (logEvent.platform) logEvent.platform.route = this.config.req.path;
53970
- else if (logEvent.vercel) logEvent.vercel.route = this.config.req.path;
53971
- }
53972
- return logEvent;
53973
- };
53974
- this.log = (level, message, args = {}) => {
53975
- if (level < this.logLevel) return;
53976
- const logEvent = this._transformEvent(level, message, args);
53977
- this.logEvents.push(logEvent);
53978
- if (this.config.autoFlush) this.throttledSendLogs();
53979
- };
53980
- this.attachResponseStatus = (statusCode) => {
53981
- this.logEvents = this.logEvents.map((log) => {
53982
- if (log.request) log.request.statusCode = statusCode;
53983
- return log;
53984
- });
53985
- };
53986
- this.flush = async () => {
53987
- await Promise.all([this.sendLogs(), ...this.children.map((c) => c.flush())]);
53988
- };
53989
- this.initConfig = initConfig;
53990
- if (this.initConfig.logLevel != void 0 && this.initConfig.logLevel >= 0) this.logLevel = this.initConfig.logLevel;
53991
- else if (LOG_LEVEL) this.logLevel = LogLevel[LOG_LEVEL];
53992
- this.config = {
53993
- ...this.config,
53994
- ...initConfig
53995
- };
53996
- }
53997
- logHttpRequest(level, message, request, args) {
53998
- const logEvent = this._transformEvent(level, message, args);
53999
- logEvent.request = request;
54000
- this.logEvents.push(logEvent);
54001
- if (this.config.autoFlush) this.throttledSendLogs();
54002
- }
54003
- middleware(request, config) {
54004
- const req = {
54005
- ip: request.ip,
54006
- region: request.geo?.region,
54007
- method: request.method,
54008
- host: request.nextUrl.hostname,
54009
- path: request.nextUrl.pathname,
54010
- scheme: request.nextUrl.protocol.split(":")[0],
54011
- referer: request.headers.get("Referer"),
54012
- userAgent: request.headers.get("user-agent")
54013
- };
54014
- const message = `${request.method} ${request.nextUrl.pathname}`;
54015
- if (config?.logRequestDetails) return (0, shared_1.requestToJSON)(request).then((details) => {
54016
- const newReq = {
54017
- ...req,
54018
- details: Array.isArray(config.logRequestDetails) ? Object.fromEntries(Object.entries(details).filter(([key]) => config.logRequestDetails.includes(key))) : details
54019
- };
54020
- return this.logHttpRequest(LogLevel.info, message, newReq, {});
54021
- });
54022
- return this.logHttpRequest(LogLevel.info, message, req, {});
54023
- }
54024
- async sendLogs() {
54025
- if (!this.logEvents.length) return;
54026
- if (!config_1.config.isEnvVarsSet()) {
54027
- this.logEvents.forEach((ev) => this.config.prettyPrint ? this.config.prettyPrint(ev) : prettyPrint(ev));
54028
- this.logEvents = [];
54029
- return;
54030
- }
54031
- const method = "POST";
54032
- const keepalive = true;
54033
- const body = JSON.stringify(this.logEvents);
54034
- this.logEvents = [];
54035
- const headers = {
54036
- "Content-Type": "application/json",
54037
- "User-Agent": "next-axiom/v" + config_1.Version
54038
- };
54039
- if (config_1.config.token) headers["Authorization"] = `Bearer ${config_1.config.token}`;
54040
- const reqOptions = {
54041
- body,
54042
- method,
54043
- keepalive,
54044
- headers
54045
- };
54046
- function sendFallback() {
54047
- return fetch(url, reqOptions).catch(console.error);
54048
- }
54049
- try {
54050
- if (typeof fetch === "undefined") return (await require_fetch_umd())(url, reqOptions).catch(console.error);
54051
- else if (config_1.isBrowser && config_1.isVercelIntegration && navigator.sendBeacon) try {
54052
- if (!navigator.sendBeacon.bind(navigator)(url, body)) return sendFallback();
54053
- } catch (error) {
54054
- return sendFallback();
54055
- }
54056
- else return sendFallback();
54057
- } catch (e) {
54058
- console.warn(`Failed to send logs to Axiom: ${e}`);
54059
- this.logEvents = [...this.logEvents, JSON.parse(body)];
54060
- }
54061
- }
54062
- };
54063
- exports.Logger = Logger;
54064
- exports.log = new Logger({});
54065
- const levelColors = {
54066
- info: {
54067
- terminal: "32",
54068
- browser: "lightgreen"
54069
- },
54070
- debug: {
54071
- terminal: "36",
54072
- browser: "lightblue"
54073
- },
54074
- warn: {
54075
- terminal: "33",
54076
- browser: "yellow"
54077
- },
54078
- error: {
54079
- terminal: "31",
54080
- browser: "red"
54081
- }
54082
- };
54083
- function prettyPrint(ev) {
54084
- const hasFields = Object.keys(ev.fields).length > 0;
54085
- if (shared_1.isNoPrettyPrint) {
54086
- let msg = `${ev.level} - ${ev.message}`;
54087
- if (hasFields) msg += " " + JSON.stringify(ev.fields);
54088
- console.log(msg);
54089
- return;
54090
- }
54091
- let msgString = "";
54092
- let args = [ev.level, ev.message];
54093
- if (config_1.isBrowser) {
54094
- msgString = "%c%s - %s";
54095
- args = [`color: ${levelColors[ev.level].browser};`, ...args];
54096
- } else msgString = `\x1b[${levelColors[ev.level].terminal}m%s\x1b[0m - %s`;
54097
- if (hasFields) {
54098
- msgString += " %o";
54099
- args.push(ev.fields);
54100
- }
54101
- if (ev.request) {
54102
- msgString += " %o";
54103
- args.push(ev.request);
54104
- }
54105
- console.log.apply(console, [msgString, ...args]);
54106
- }
54107
- function jsonFriendlyErrorReplacer(key, value) {
54108
- if (value instanceof Error) return {
54109
- ...value,
54110
- name: value.name,
54111
- message: value.message,
54112
- stack: value.stack,
54113
- cause: jsonFriendlyErrorReplacer("", value.cause)
54114
- };
54115
- return value;
54116
- }
54117
- }));
54118
- //#endregion
54119
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/platform/base.js
54120
- var require_base = /* @__PURE__ */ __commonJSMin(((exports) => {
54121
- Object.defineProperty(exports, "__esModule", { value: true });
54122
- }));
54123
- //#endregion
54124
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/headers.js
54125
- var require_headers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54126
- var __defProp = Object.defineProperty;
54127
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54128
- var __getOwnPropNames = Object.getOwnPropertyNames;
54129
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54130
- var __export = (target, all) => {
54131
- for (var name in all) __defProp(target, name, {
54132
- get: all[name],
54133
- enumerable: true
54134
- });
54135
- };
54136
- var __copyProps = (to, from, except, desc) => {
54137
- if (from && typeof from === "object" || typeof from === "function") {
54138
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54139
- get: () => from[key],
54140
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54141
- });
54142
- }
54143
- return to;
54144
- };
54145
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54146
- var headers_exports = {};
54147
- __export(headers_exports, {
54148
- CITY_HEADER_NAME: () => CITY_HEADER_NAME,
54149
- COUNTRY_HEADER_NAME: () => COUNTRY_HEADER_NAME,
54150
- EMOJI_FLAG_UNICODE_STARTING_POSITION: () => EMOJI_FLAG_UNICODE_STARTING_POSITION,
54151
- IP_HEADER_NAME: () => IP_HEADER_NAME,
54152
- LATITUDE_HEADER_NAME: () => LATITUDE_HEADER_NAME,
54153
- LONGITUDE_HEADER_NAME: () => LONGITUDE_HEADER_NAME,
54154
- POSTAL_CODE_HEADER_NAME: () => POSTAL_CODE_HEADER_NAME,
54155
- REGION_HEADER_NAME: () => REGION_HEADER_NAME,
54156
- REQUEST_ID_HEADER_NAME: () => REQUEST_ID_HEADER_NAME,
54157
- geolocation: () => geolocation,
54158
- ipAddress: () => ipAddress
54159
- });
54160
- module.exports = __toCommonJS(headers_exports);
54161
- const CITY_HEADER_NAME = "x-vercel-ip-city";
54162
- const COUNTRY_HEADER_NAME = "x-vercel-ip-country";
54163
- const IP_HEADER_NAME = "x-real-ip";
54164
- const LATITUDE_HEADER_NAME = "x-vercel-ip-latitude";
54165
- const LONGITUDE_HEADER_NAME = "x-vercel-ip-longitude";
54166
- const REGION_HEADER_NAME = "x-vercel-ip-country-region";
54167
- const POSTAL_CODE_HEADER_NAME = "x-vercel-ip-postal-code";
54168
- const REQUEST_ID_HEADER_NAME = "x-vercel-id";
54169
- const EMOJI_FLAG_UNICODE_STARTING_POSITION = 127397;
54170
- function getHeader(headers, key) {
54171
- return headers.get(key) ?? void 0;
54172
- }
54173
- function getHeaderWithDecode(request, key) {
54174
- const header = getHeader(request.headers, key);
54175
- return header ? decodeURIComponent(header) : void 0;
54176
- }
54177
- function getFlag(countryCode) {
54178
- const regex = (/* @__PURE__ */ new RegExp("^[A-Z]{2}$")).test(countryCode);
54179
- if (!countryCode || !regex) return void 0;
54180
- return String.fromCodePoint(...countryCode.split("").map((char) => EMOJI_FLAG_UNICODE_STARTING_POSITION + char.charCodeAt(0)));
54181
- }
54182
- function ipAddress(input) {
54183
- return getHeader("headers" in input ? input.headers : input, IP_HEADER_NAME);
54184
- }
54185
- function getRegionFromRequestId(requestId) {
54186
- if (!requestId) return "dev1";
54187
- return requestId.split(":")[0];
54188
- }
54189
- function geolocation(request) {
54190
- return {
54191
- city: getHeaderWithDecode(request, CITY_HEADER_NAME),
54192
- country: getHeader(request.headers, COUNTRY_HEADER_NAME),
54193
- flag: getFlag(getHeader(request.headers, COUNTRY_HEADER_NAME)),
54194
- countryRegion: getHeader(request.headers, REGION_HEADER_NAME),
54195
- region: getRegionFromRequestId(getHeader(request.headers, REQUEST_ID_HEADER_NAME)),
54196
- latitude: getHeader(request.headers, LATITUDE_HEADER_NAME),
54197
- longitude: getHeader(request.headers, LONGITUDE_HEADER_NAME),
54198
- postalCode: getHeader(request.headers, POSTAL_CODE_HEADER_NAME)
54199
- };
54200
- }
54201
- 0 && (module.exports = {
54202
- CITY_HEADER_NAME,
54203
- COUNTRY_HEADER_NAME,
54204
- EMOJI_FLAG_UNICODE_STARTING_POSITION,
54205
- IP_HEADER_NAME,
54206
- LATITUDE_HEADER_NAME,
54207
- LONGITUDE_HEADER_NAME,
54208
- POSTAL_CODE_HEADER_NAME,
54209
- REGION_HEADER_NAME,
54210
- REQUEST_ID_HEADER_NAME,
54211
- geolocation,
54212
- ipAddress
54213
- });
54214
- }));
54215
- //#endregion
54216
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/get-env.js
54217
- var require_get_env = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54218
- var __defProp = Object.defineProperty;
54219
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54220
- var __getOwnPropNames = Object.getOwnPropertyNames;
54221
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54222
- var __export = (target, all) => {
54223
- for (var name in all) __defProp(target, name, {
54224
- get: all[name],
54225
- enumerable: true
54226
- });
54227
- };
54228
- var __copyProps = (to, from, except, desc) => {
54229
- if (from && typeof from === "object" || typeof from === "function") {
54230
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54231
- get: () => from[key],
54232
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54233
- });
54234
- }
54235
- return to;
54236
- };
54237
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54238
- var get_env_exports = {};
54239
- __export(get_env_exports, { getEnv: () => getEnv });
54240
- module.exports = __toCommonJS(get_env_exports);
54241
- const getEnv = (env = process.env) => ({
54242
- /**
54243
- * An indicator to show that System Environment Variables have been exposed to your project's Deployments.
54244
- * @example "1"
54245
- */
54246
- VERCEL: get(env, "VERCEL"),
54247
- /**
54248
- * An indicator that the code is running in a Continuous Integration environment.
54249
- * @example "1"
54250
- */
54251
- CI: get(env, "CI"),
54252
- /**
54253
- * The Environment that the app is deployed and running on.
54254
- * @example "production"
54255
- */
54256
- VERCEL_ENV: get(env, "VERCEL_ENV"),
54257
- /**
54258
- * The domain name of the generated deployment URL. The value does not include the protocol scheme https://.
54259
- * NOTE: This Variable cannot be used in conjunction with Standard Deployment Protection.
54260
- * @example "*.vercel.app"
54261
- */
54262
- VERCEL_URL: get(env, "VERCEL_URL"),
54263
- /**
54264
- * The domain name of the generated Git branch URL. The value does not include the protocol scheme https://.
54265
- * @example "*-git-*.vercel.app"
54266
- */
54267
- VERCEL_BRANCH_URL: get(env, "VERCEL_BRANCH_URL"),
54268
- /**
54269
- * A production domain name of the project. This is useful to reliably generate links that point to production such as OG-image URLs.
54270
- * The value does not include the protocol scheme https://.
54271
- * @example "myproject.vercel.app"
54272
- */
54273
- VERCEL_PROJECT_PRODUCTION_URL: get(env, "VERCEL_PROJECT_PRODUCTION_URL"),
54274
- /**
54275
- * The ID of the Region where the app is running.
54276
- *
54277
- * Possible values:
54278
- * - arn1 (Stockholm, Sweden)
54279
- * - bom1 (Mumbai, India)
54280
- * - cdg1 (Paris, France)
54281
- * - cle1 (Cleveland, USA)
54282
- * - cpt1 (Cape Town, South Africa)
54283
- * - dub1 (Dublin, Ireland)
54284
- * - fra1 (Frankfurt, Germany)
54285
- * - gru1 (São Paulo, Brazil)
54286
- * - hkg1 (Hong Kong)
54287
- * - hnd1 (Tokyo, Japan)
54288
- * - iad1 (Washington, D.C., USA)
54289
- * - icn1 (Seoul, South Korea)
54290
- * - kix1 (Osaka, Japan)
54291
- * - lhr1 (London, United Kingdom)
54292
- * - pdx1 (Portland, USA)
54293
- * - sfo1 (San Francisco, USA)
54294
- * - sin1 (Singapore)
54295
- * - syd1 (Sydney, Australia)
54296
- * - dev1 (Development Region)
54297
- *
54298
- * @example "iad1"
54299
- */
54300
- VERCEL_REGION: get(env, "VERCEL_REGION"),
54301
- /**
54302
- * The unique identifier for the deployment, which can be used to implement Skew Protection.
54303
- * @example "dpl_7Gw5ZMBpQA8h9GF832KGp7nwbuh3"
54304
- */
54305
- VERCEL_DEPLOYMENT_ID: get(env, "VERCEL_DEPLOYMENT_ID"),
54306
- /**
54307
- * When Skew Protection is enabled in Project Settings, this value is set to 1.
54308
- * @example "1"
54309
- */
54310
- VERCEL_SKEW_PROTECTION_ENABLED: get(env, "VERCEL_SKEW_PROTECTION_ENABLED"),
54311
- /**
54312
- * The Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings.
54313
- */
54314
- VERCEL_AUTOMATION_BYPASS_SECRET: get(env, "VERCEL_AUTOMATION_BYPASS_SECRET"),
54315
- /**
54316
- * The Git Provider the deployment is triggered from.
54317
- * @example "github"
54318
- */
54319
- VERCEL_GIT_PROVIDER: get(env, "VERCEL_GIT_PROVIDER"),
54320
- /**
54321
- * The origin repository the deployment is triggered from.
54322
- * @example "my-site"
54323
- */
54324
- VERCEL_GIT_REPO_SLUG: get(env, "VERCEL_GIT_REPO_SLUG"),
54325
- /**
54326
- * The account that owns the repository the deployment is triggered from.
54327
- * @example "acme"
54328
- */
54329
- VERCEL_GIT_REPO_OWNER: get(env, "VERCEL_GIT_REPO_OWNER"),
54330
- /**
54331
- * The ID of the repository the deployment is triggered from.
54332
- * @example "117716146"
54333
- */
54334
- VERCEL_GIT_REPO_ID: get(env, "VERCEL_GIT_REPO_ID"),
54335
- /**
54336
- * The git branch of the commit the deployment was triggered by.
54337
- * @example "improve-about-page"
54338
- */
54339
- VERCEL_GIT_COMMIT_REF: get(env, "VERCEL_GIT_COMMIT_REF"),
54340
- /**
54341
- * The git SHA of the commit the deployment was triggered by.
54342
- * @example "fa1eade47b73733d6312d5abfad33ce9e4068081"
54343
- */
54344
- VERCEL_GIT_COMMIT_SHA: get(env, "VERCEL_GIT_COMMIT_SHA"),
54345
- /**
54346
- * The message attached to the commit the deployment was triggered by.
54347
- * @example "Update about page"
54348
- */
54349
- VERCEL_GIT_COMMIT_MESSAGE: get(env, "VERCEL_GIT_COMMIT_MESSAGE"),
54350
- /**
54351
- * The username attached to the author of the commit that the project was deployed by.
54352
- * @example "johndoe"
54353
- */
54354
- VERCEL_GIT_COMMIT_AUTHOR_LOGIN: get(env, "VERCEL_GIT_COMMIT_AUTHOR_LOGIN"),
54355
- /**
54356
- * The name attached to the author of the commit that the project was deployed by.
54357
- * @example "John Doe"
54358
- */
54359
- VERCEL_GIT_COMMIT_AUTHOR_NAME: get(env, "VERCEL_GIT_COMMIT_AUTHOR_NAME"),
54360
- /**
54361
- * The git SHA of the last successful deployment for the project and branch.
54362
- * NOTE: This Variable is only exposed when an Ignored Build Step is provided.
54363
- * @example "fa1eade47b73733d6312d5abfad33ce9e4068080"
54364
- */
54365
- VERCEL_GIT_PREVIOUS_SHA: get(env, "VERCEL_GIT_PREVIOUS_SHA"),
54366
- /**
54367
- * The pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string.
54368
- * @example "23"
54369
- */
54370
- VERCEL_GIT_PULL_REQUEST_ID: get(env, "VERCEL_GIT_PULL_REQUEST_ID")
54371
- });
54372
- const get = (env, key) => {
54373
- const value = env[key];
54374
- return value === "" ? void 0 : value;
54375
- };
54376
- 0 && (module.exports = { getEnv });
54377
- }));
54378
- //#endregion
54379
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/get-context.js
54380
- var require_get_context = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54381
- var __defProp = Object.defineProperty;
54382
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54383
- var __getOwnPropNames = Object.getOwnPropertyNames;
54384
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54385
- var __export = (target, all) => {
54386
- for (var name in all) __defProp(target, name, {
54387
- get: all[name],
54388
- enumerable: true
54389
- });
54390
- };
54391
- var __copyProps = (to, from, except, desc) => {
54392
- if (from && typeof from === "object" || typeof from === "function") {
54393
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54394
- get: () => from[key],
54395
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54396
- });
54397
- }
54398
- return to;
54399
- };
54400
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54401
- var get_context_exports = {};
54402
- __export(get_context_exports, {
54403
- SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
54404
- getContext: () => getContext
54405
- });
54406
- module.exports = __toCommonJS(get_context_exports);
54407
- const SYMBOL_FOR_REQ_CONTEXT = Symbol.for("@vercel/request-context");
54408
- function getContext() {
54409
- return globalThis[SYMBOL_FOR_REQ_CONTEXT]?.get?.() ?? {};
54410
- }
54411
- 0 && (module.exports = {
54412
- SYMBOL_FOR_REQ_CONTEXT,
54413
- getContext
54414
- });
54415
- }));
54416
- //#endregion
54417
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/wait-until.js
54418
- var require_wait_until = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54419
- var __defProp = Object.defineProperty;
54420
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54421
- var __getOwnPropNames = Object.getOwnPropertyNames;
54422
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54423
- var __export = (target, all) => {
54424
- for (var name in all) __defProp(target, name, {
54425
- get: all[name],
54426
- enumerable: true
54427
- });
54428
- };
54429
- var __copyProps = (to, from, except, desc) => {
54430
- if (from && typeof from === "object" || typeof from === "function") {
54431
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54432
- get: () => from[key],
54433
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54434
- });
54435
- }
54436
- return to;
54437
- };
54438
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54439
- var wait_until_exports = {};
54440
- __export(wait_until_exports, { waitUntil: () => waitUntil });
54441
- module.exports = __toCommonJS(wait_until_exports);
54442
- var import_get_context = require_get_context();
54443
- const waitUntil = (promise) => {
54444
- if (promise === null || typeof promise !== "object" || typeof promise.then !== "function") throw new TypeError(`waitUntil can only be called with a Promise, got ${typeof promise}`);
54445
- return (0, import_get_context.getContext)().waitUntil?.(promise);
54446
- };
54447
- 0 && (module.exports = { waitUntil });
54448
- }));
54449
- //#endregion
54450
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/middleware.js
54451
- var require_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54452
- var __defProp = Object.defineProperty;
54453
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54454
- var __getOwnPropNames = Object.getOwnPropertyNames;
54455
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54456
- var __export = (target, all) => {
54457
- for (var name in all) __defProp(target, name, {
54458
- get: all[name],
54459
- enumerable: true
54460
- });
54461
- };
54462
- var __copyProps = (to, from, except, desc) => {
54463
- if (from && typeof from === "object" || typeof from === "function") {
54464
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54465
- get: () => from[key],
54466
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54467
- });
54468
- }
54469
- return to;
54470
- };
54471
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54472
- var middleware_exports = {};
54473
- __export(middleware_exports, {
54474
- next: () => next,
54475
- rewrite: () => rewrite
54476
- });
54477
- module.exports = __toCommonJS(middleware_exports);
54478
- function handleMiddlewareField(init, headers) {
54479
- if (init?.request?.headers) {
54480
- if (!(init.request.headers instanceof Headers)) throw new Error("request.headers must be an instance of Headers");
54481
- const keys = [];
54482
- for (const [key, value] of init.request.headers) {
54483
- headers.set("x-middleware-request-" + key, value);
54484
- keys.push(key);
54485
- }
54486
- headers.set("x-middleware-override-headers", keys.join(","));
54487
- }
54488
- }
54489
- function rewrite(destination, init) {
54490
- const headers = new Headers(init?.headers ?? {});
54491
- headers.set("x-middleware-rewrite", String(destination));
54492
- handleMiddlewareField(init, headers);
54493
- return new Response(null, {
54494
- ...init,
54495
- headers
54496
- });
54497
- }
54498
- function next(init) {
54499
- const headers = new Headers(init?.headers ?? {});
54500
- headers.set("x-middleware-next", "1");
54501
- handleMiddlewareField(init, headers);
54502
- return new Response(null, {
54503
- ...init,
54504
- headers
54505
- });
54506
- }
54507
- 0 && (module.exports = {
54508
- next,
54509
- rewrite
54510
- });
54511
- }));
54512
- //#endregion
54513
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/cache/in-memory-cache.js
54514
- var require_in_memory_cache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54515
- var __defProp = Object.defineProperty;
54516
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54517
- var __getOwnPropNames = Object.getOwnPropertyNames;
54518
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54519
- var __export = (target, all) => {
54520
- for (var name in all) __defProp(target, name, {
54521
- get: all[name],
54522
- enumerable: true
54523
- });
54524
- };
54525
- var __copyProps = (to, from, except, desc) => {
54526
- if (from && typeof from === "object" || typeof from === "function") {
54527
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54528
- get: () => from[key],
54529
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54530
- });
54531
- }
54532
- return to;
54533
- };
54534
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54535
- var in_memory_cache_exports = {};
54536
- __export(in_memory_cache_exports, { InMemoryCache: () => InMemoryCache });
54537
- module.exports = __toCommonJS(in_memory_cache_exports);
54538
- var InMemoryCache = class {
54539
- constructor() {
54540
- this.cache = {};
54541
- }
54542
- async get(key) {
54543
- const entry = this.cache[key];
54544
- if (entry) {
54545
- if (entry.ttl && entry.lastModified + entry.ttl * 1e3 < Date.now()) {
54546
- await this.delete(key);
54547
- return null;
54548
- }
54549
- return entry.value;
54550
- }
54551
- return null;
54552
- }
54553
- async set(key, value, options) {
54554
- this.cache[key] = {
54555
- value,
54556
- lastModified: Date.now(),
54557
- ttl: options?.ttl,
54558
- tags: new Set(options?.tags || [])
54559
- };
54560
- }
54561
- async delete(key) {
54562
- delete this.cache[key];
54563
- }
54564
- async expireTag(tag) {
54565
- const tags = Array.isArray(tag) ? tag : [tag];
54566
- for (const key in this.cache) if (Object.prototype.hasOwnProperty.call(this.cache, key)) {
54567
- const entry = this.cache[key];
54568
- if (tags.some((t) => entry.tags.has(t))) delete this.cache[key];
54569
- }
54570
- }
54571
- };
54572
- 0 && (module.exports = { InMemoryCache });
54573
- }));
54574
- //#endregion
54575
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/cache/build-client.js
54576
- var require_build_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54577
- var __defProp = Object.defineProperty;
54578
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54579
- var __getOwnPropNames = Object.getOwnPropertyNames;
54580
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54581
- var __export = (target, all) => {
54582
- for (var name in all) __defProp(target, name, {
54583
- get: all[name],
54584
- enumerable: true
54585
- });
54586
- };
54587
- var __copyProps = (to, from, except, desc) => {
54588
- if (from && typeof from === "object" || typeof from === "function") {
54589
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54590
- get: () => from[key],
54591
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54592
- });
54593
- }
54594
- return to;
54595
- };
54596
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54597
- var build_client_exports = {};
54598
- __export(build_client_exports, { BuildCache: () => BuildCache });
54599
- module.exports = __toCommonJS(build_client_exports);
54600
- var import_index = require_cache();
54601
- var BuildCache = class {
54602
- constructor({ endpoint, headers, onError }) {
54603
- this.get = async (key) => {
54604
- try {
54605
- const res = await fetch(`${this.endpoint}${key}`, {
54606
- headers: this.headers,
54607
- method: "GET"
54608
- });
54609
- if (res.status === 404) return null;
54610
- if (res.status === 200) {
54611
- if (res.headers.get(import_index.HEADERS_VERCEL_CACHE_STATE) !== import_index.PkgCacheState.Fresh) {
54612
- res.body?.cancel?.();
54613
- return null;
54614
- }
54615
- return await res.json();
54616
- } else throw new Error(`Failed to get cache: ${res.statusText}`);
54617
- } catch (error) {
54618
- this.onError?.(error);
54619
- return null;
54620
- }
54621
- };
54622
- this.set = async (key, value, options) => {
54623
- try {
54624
- const optionalHeaders = {};
54625
- if (options?.ttl) optionalHeaders[import_index.HEADERS_VERCEL_REVALIDATE] = options.ttl.toString();
54626
- if (options?.tags && options.tags.length > 0) optionalHeaders[import_index.HEADERS_VERCEL_CACHE_TAGS] = options.tags.join(",");
54627
- if (options?.name) optionalHeaders[import_index.HEADERS_VERCEL_CACHE_ITEM_NAME] = options.name;
54628
- const res = await fetch(`${this.endpoint}${key}`, {
54629
- method: "POST",
54630
- headers: {
54631
- ...this.headers,
54632
- ...optionalHeaders
54633
- },
54634
- body: JSON.stringify(value)
54635
- });
54636
- if (res.status !== 200) throw new Error(`Failed to set cache: ${res.status} ${res.statusText}`);
54637
- } catch (error) {
54638
- this.onError?.(error);
54639
- }
54640
- };
54641
- this.delete = async (key) => {
54642
- try {
54643
- const res = await fetch(`${this.endpoint}${key}`, {
54644
- method: "DELETE",
54645
- headers: this.headers
54646
- });
54647
- if (res.status !== 200) throw new Error(`Failed to delete cache: ${res.statusText}`);
54648
- } catch (error) {
54649
- this.onError?.(error);
54650
- }
54651
- };
54652
- this.expireTag = async (tag) => {
54653
- try {
54654
- if (Array.isArray(tag)) tag = tag.join(",");
54655
- const res = await fetch(`${this.endpoint}revalidate?tags=${tag}`, {
54656
- method: "POST",
54657
- headers: this.headers
54658
- });
54659
- if (res.status !== 200) throw new Error(`Failed to revalidate tag: ${res.statusText}`);
54660
- } catch (error) {
54661
- this.onError?.(error);
54662
- }
54663
- };
54664
- this.endpoint = endpoint;
54665
- this.headers = headers;
54666
- this.onError = onError;
54667
- }
54668
- };
54669
- 0 && (module.exports = { BuildCache });
54670
- }));
54671
- //#endregion
54672
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/cache/index.js
54673
- var require_cache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54674
- var __defProp = Object.defineProperty;
54675
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54676
- var __getOwnPropNames = Object.getOwnPropertyNames;
54677
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54678
- var __export = (target, all) => {
54679
- for (var name in all) __defProp(target, name, {
54680
- get: all[name],
54681
- enumerable: true
54682
- });
54683
- };
54684
- var __copyProps = (to, from, except, desc) => {
54685
- if (from && typeof from === "object" || typeof from === "function") {
54686
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54687
- get: () => from[key],
54688
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54689
- });
54690
- }
54691
- return to;
54692
- };
54693
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54694
- var cache_exports = {};
54695
- __export(cache_exports, {
54696
- HEADERS_VERCEL_CACHE_ITEM_NAME: () => HEADERS_VERCEL_CACHE_ITEM_NAME,
54697
- HEADERS_VERCEL_CACHE_STATE: () => HEADERS_VERCEL_CACHE_STATE,
54698
- HEADERS_VERCEL_CACHE_TAGS: () => HEADERS_VERCEL_CACHE_TAGS,
54699
- HEADERS_VERCEL_REVALIDATE: () => HEADERS_VERCEL_REVALIDATE,
54700
- PkgCacheState: () => PkgCacheState,
54701
- getCache: () => getCache
54702
- });
54703
- module.exports = __toCommonJS(cache_exports);
54704
- var import_get_context = require_get_context();
54705
- var import_in_memory_cache = require_in_memory_cache();
54706
- var import_build_client = require_build_client();
54707
- const defaultKeyHashFunction = (key) => {
54708
- let hash = 5381;
54709
- for (let i = 0; i < key.length; i++) hash = hash * 33 ^ key.charCodeAt(i);
54710
- return (hash >>> 0).toString(16);
54711
- };
54712
- const defaultNamespaceSeparator = "$";
54713
- let inMemoryCacheInstance = null;
54714
- let buildCacheInstance = null;
54715
- const getCache = (cacheOptions) => {
54716
- const resolveCache = () => {
54717
- let cache;
54718
- if ((0, import_get_context.getContext)().cache) cache = (0, import_get_context.getContext)().cache;
54719
- else cache = getCacheImplementation(process.env.SUSPENSE_CACHE_DEBUG === "true");
54720
- return cache;
54721
- };
54722
- return wrapWithKeyTransformation(resolveCache, createKeyTransformer(cacheOptions));
54723
- };
54724
- function createKeyTransformer(cacheOptions) {
54725
- const hashFunction = cacheOptions?.keyHashFunction || defaultKeyHashFunction;
54726
- return (key) => {
54727
- if (!cacheOptions?.namespace) return hashFunction(key);
54728
- const separator = cacheOptions.namespaceSeparator || defaultNamespaceSeparator;
54729
- return `${cacheOptions.namespace}${separator}${hashFunction(key)}`;
54730
- };
54731
- }
54732
- function wrapWithKeyTransformation(resolveCache, makeKey) {
54733
- return {
54734
- get: (key) => {
54735
- return resolveCache().get(makeKey(key));
54736
- },
54737
- set: (key, value, options) => {
54738
- return resolveCache().set(makeKey(key), value, options);
54739
- },
54740
- delete: (key) => {
54741
- return resolveCache().delete(makeKey(key));
54742
- },
54743
- expireTag: (tag) => {
54744
- return resolveCache().expireTag(tag);
54745
- }
54746
- };
54747
- }
54748
- let warnedCacheUnavailable = false;
54749
- function getCacheImplementation(debug) {
54750
- if (!inMemoryCacheInstance) inMemoryCacheInstance = new import_in_memory_cache.InMemoryCache();
54751
- if (process.env.RUNTIME_CACHE_DISABLE_BUILD_CACHE === "true") {
54752
- debug && console.log("Using InMemoryCache as build cache is disabled");
54753
- return inMemoryCacheInstance;
54754
- }
54755
- const { RUNTIME_CACHE_ENDPOINT, RUNTIME_CACHE_HEADERS } = process.env;
54756
- if (debug) console.log("Runtime cache environment variables:", {
54757
- RUNTIME_CACHE_ENDPOINT,
54758
- RUNTIME_CACHE_HEADERS
54759
- });
54760
- if (!RUNTIME_CACHE_ENDPOINT || !RUNTIME_CACHE_HEADERS) {
54761
- if (!warnedCacheUnavailable) {
54762
- console.warn("Runtime Cache unavailable in this environment. Falling back to in-memory cache.");
54763
- warnedCacheUnavailable = true;
54764
- }
54765
- return inMemoryCacheInstance;
54766
- }
54767
- if (!buildCacheInstance) {
54768
- let parsedHeaders = {};
54769
- try {
54770
- parsedHeaders = JSON.parse(RUNTIME_CACHE_HEADERS);
54771
- } catch (e) {
54772
- console.error("Failed to parse RUNTIME_CACHE_HEADERS:", e);
54773
- return inMemoryCacheInstance;
54774
- }
54775
- buildCacheInstance = new import_build_client.BuildCache({
54776
- endpoint: RUNTIME_CACHE_ENDPOINT,
54777
- headers: parsedHeaders,
54778
- onError: (error) => console.error(error)
54779
- });
54780
- }
54781
- return buildCacheInstance;
54782
- }
54783
- var PkgCacheState = /* @__PURE__ */ ((PkgCacheState2) => {
54784
- PkgCacheState2["Fresh"] = "fresh";
54785
- PkgCacheState2["Stale"] = "stale";
54786
- PkgCacheState2["Expired"] = "expired";
54787
- PkgCacheState2["NotFound"] = "notFound";
54788
- PkgCacheState2["Error"] = "error";
54789
- return PkgCacheState2;
54790
- })(PkgCacheState || {});
54791
- const HEADERS_VERCEL_CACHE_STATE = "x-vercel-cache-state";
54792
- const HEADERS_VERCEL_REVALIDATE = "x-vercel-revalidate";
54793
- const HEADERS_VERCEL_CACHE_TAGS = "x-vercel-cache-tags";
54794
- const HEADERS_VERCEL_CACHE_ITEM_NAME = "x-vercel-cache-item-name";
54795
- 0 && (module.exports = {
54796
- HEADERS_VERCEL_CACHE_ITEM_NAME,
54797
- HEADERS_VERCEL_CACHE_STATE,
54798
- HEADERS_VERCEL_CACHE_TAGS,
54799
- HEADERS_VERCEL_REVALIDATE,
54800
- PkgCacheState,
54801
- getCache
54802
- });
54803
- }));
54804
- //#endregion
54805
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/db-connections/index.js
54806
- var require_db_connections = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54807
- var __defProp = Object.defineProperty;
54808
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54809
- var __getOwnPropNames = Object.getOwnPropertyNames;
54810
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54811
- var __export = (target, all) => {
54812
- for (var name in all) __defProp(target, name, {
54813
- get: all[name],
54814
- enumerable: true
54815
- });
54816
- };
54817
- var __copyProps = (to, from, except, desc) => {
54818
- if (from && typeof from === "object" || typeof from === "function") {
54819
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54820
- get: () => from[key],
54821
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54822
- });
54823
- }
54824
- return to;
54825
- };
54826
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54827
- var db_connections_exports = {};
54828
- __export(db_connections_exports, {
54829
- attachDatabasePool: () => attachDatabasePool,
54830
- experimental_attachDatabasePool: () => experimental_attachDatabasePool
54831
- });
54832
- module.exports = __toCommonJS(db_connections_exports);
54833
- var import_get_context = require_get_context();
54834
- const DEBUG = !!process.env.DEBUG;
54835
- function getIdleTimeout(dbPool) {
54836
- if ("options" in dbPool && dbPool.options) {
54837
- if ("idleTimeoutMillis" in dbPool.options) return typeof dbPool.options.idleTimeoutMillis === "number" ? dbPool.options.idleTimeoutMillis : 1e4;
54838
- if ("maxIdleTimeMS" in dbPool.options) return typeof dbPool.options.maxIdleTimeMS === "number" ? dbPool.options.maxIdleTimeMS : 0;
54839
- if ("status" in dbPool) return 5e3;
54840
- if ("connect" in dbPool && "execute" in dbPool) return 3e4;
54841
- }
54842
- if ("config" in dbPool && dbPool.config) {
54843
- if ("connectionConfig" in dbPool.config && dbPool.config.connectionConfig) return dbPool.config.connectionConfig.idleTimeout || 6e4;
54844
- if ("idleTimeout" in dbPool.config) return typeof dbPool.config.idleTimeout === "number" ? dbPool.config.idleTimeout : 6e4;
54845
- }
54846
- if ("poolTimeout" in dbPool) return typeof dbPool.poolTimeout === "number" ? dbPool.poolTimeout : 6e4;
54847
- if ("idleTimeout" in dbPool) return typeof dbPool.idleTimeout === "number" ? dbPool.idleTimeout : 0;
54848
- return 1e4;
54849
- }
54850
- let idleTimeout = null;
54851
- let idleTimeoutResolve = () => {};
54852
- const bootTime = Date.now();
54853
- const maximumDuration = 900 * 1e3 - 1e3;
54854
- function waitUntilIdleTimeout(dbPool) {
54855
- if (!process.env.VERCEL_URL) return;
54856
- if (idleTimeout) {
54857
- clearTimeout(idleTimeout);
54858
- idleTimeoutResolve();
54859
- }
54860
- const promise = new Promise((resolve) => {
54861
- idleTimeoutResolve = resolve;
54862
- });
54863
- const waitTime = Math.min(getIdleTimeout(dbPool) + 100, maximumDuration - (Date.now() - bootTime));
54864
- idleTimeout = setTimeout(() => {
54865
- idleTimeoutResolve?.();
54866
- if (DEBUG) console.log("Database pool idle timeout reached. Releasing connections.");
54867
- }, waitTime);
54868
- const requestContext = (0, import_get_context.getContext)();
54869
- if (requestContext?.waitUntil) requestContext.waitUntil(promise);
54870
- else console.warn("Pool release event triggered outside of request scope.");
54871
- }
54872
- function attachDatabasePool(dbPool) {
54873
- if (idleTimeout) {
54874
- idleTimeoutResolve?.();
54875
- clearTimeout(idleTimeout);
54876
- }
54877
- if ("on" in dbPool && dbPool.on && "options" in dbPool && "idleTimeoutMillis" in dbPool.options) {
54878
- dbPool.on("release", () => {
54879
- if (DEBUG) console.log("Client released from pool");
54880
- waitUntilIdleTimeout(dbPool);
54881
- });
54882
- return;
54883
- } else if ("on" in dbPool && dbPool.on && "config" in dbPool && dbPool.config && "connectionConfig" in dbPool.config) {
54884
- dbPool.on("release", () => {
54885
- if (DEBUG) console.log("MySQL client released from pool");
54886
- waitUntilIdleTimeout(dbPool);
54887
- });
54888
- return;
54889
- } else if ("on" in dbPool && dbPool.on && "config" in dbPool && dbPool.config && "idleTimeout" in dbPool.config) {
54890
- dbPool.on("release", () => {
54891
- if (DEBUG) console.log("MySQL2/MariaDB client released from pool");
54892
- waitUntilIdleTimeout(dbPool);
54893
- });
54894
- return;
54895
- }
54896
- if ("on" in dbPool && dbPool.on && "options" in dbPool && dbPool.options && "maxIdleTimeMS" in dbPool.options) {
54897
- dbPool.on("connectionCheckedOut", () => {
54898
- if (DEBUG) console.log("MongoDB connection checked out");
54899
- waitUntilIdleTimeout(dbPool);
54900
- });
54901
- return;
54902
- }
54903
- if ("on" in dbPool && dbPool.on && "options" in dbPool && dbPool.options && "socket" in dbPool.options) {
54904
- dbPool.on("end", () => {
54905
- if (DEBUG) console.log("Redis connection ended");
54906
- waitUntilIdleTimeout(dbPool);
54907
- });
54908
- return;
54909
- }
54910
- throw new Error("Unsupported database pool type");
54911
- }
54912
- const experimental_attachDatabasePool = attachDatabasePool;
54913
- 0 && (module.exports = {
54914
- attachDatabasePool,
54915
- experimental_attachDatabasePool
54916
- });
54917
- }));
54918
- //#endregion
54919
- //#region ../../node_modules/.pnpm/@vercel+functions@2.2.13/node_modules/@vercel/functions/index.js
54920
- var require_functions = /* @__PURE__ */ __commonJSMin(((exports, module) => {
54921
- var __defProp = Object.defineProperty;
54922
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
54923
- var __getOwnPropNames = Object.getOwnPropertyNames;
54924
- var __hasOwnProp = Object.prototype.hasOwnProperty;
54925
- var __export = (target, all) => {
54926
- for (var name in all) __defProp(target, name, {
54927
- get: all[name],
54928
- enumerable: true
54929
- });
54930
- };
54931
- var __copyProps = (to, from, except, desc) => {
54932
- if (from && typeof from === "object" || typeof from === "function") {
54933
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
54934
- get: () => from[key],
54935
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
54936
- });
54937
- }
54938
- return to;
54939
- };
54940
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
54941
- var src_exports = {};
54942
- __export(src_exports, {
54943
- attachDatabasePool: () => import_db_connections.attachDatabasePool,
54944
- experimental_attachDatabasePool: () => import_db_connections.experimental_attachDatabasePool,
54945
- geolocation: () => import_headers.geolocation,
54946
- getCache: () => import_cache.getCache,
54947
- getEnv: () => import_get_env.getEnv,
54948
- ipAddress: () => import_headers.ipAddress,
54949
- next: () => import_middleware.next,
54950
- rewrite: () => import_middleware.rewrite,
54951
- waitUntil: () => import_wait_until.waitUntil
54952
- });
54953
- module.exports = __toCommonJS(src_exports);
54954
- var import_headers = require_headers();
54955
- var import_get_env = require_get_env();
54956
- var import_wait_until = require_wait_until();
54957
- var import_middleware = require_middleware();
54958
- var import_cache = require_cache();
54959
- var import_db_connections = require_db_connections();
54960
- 0 && (module.exports = {
54961
- attachDatabasePool,
54962
- experimental_attachDatabasePool,
54963
- geolocation,
54964
- getCache,
54965
- getEnv,
54966
- ipAddress,
54967
- next,
54968
- rewrite,
54969
- waitUntil
54970
- });
54971
- }));
54972
- //#endregion
54973
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/withAxiom.js
54974
- var require_withAxiom = /* @__PURE__ */ __commonJSMin(((exports) => {
54975
- Object.defineProperty(exports, "__esModule", { value: true });
54976
- exports.withAxiomNextConfig = withAxiomNextConfig;
54977
- exports.withAxiomRouteHandler = withAxiomRouteHandler;
54978
- exports.withAxiom = withAxiom;
54979
- const functions_1 = require_functions();
54980
- const config_1 = require_config();
54981
- const logger_1 = require_logger();
54982
- const shared_1 = require_shared();
54983
- function applyAxiomRewrites(nextConfig) {
54984
- return {
54985
- ...nextConfig,
54986
- rewrites: async () => {
54987
- const rewrites = await nextConfig.rewrites?.();
54988
- const webVitalsEndpoint = config_1.config.getIngestURL(shared_1.EndpointType.webVitals);
54989
- const logsEndpoint = config_1.config.getIngestURL(shared_1.EndpointType.logs);
54990
- if (!webVitalsEndpoint && !logsEndpoint) {
54991
- const log = new logger_1.Logger();
54992
- log.warn("axiom: Envvars not detected. If this is production please see https://github.com/axiomhq/next-axiom for help");
54993
- log.warn("axiom: Sending Web Vitals to /dev/null");
54994
- log.warn("axiom: Sending logs to console");
54995
- return rewrites || [];
54996
- }
54997
- const axiomRewrites = [{
54998
- source: `${config_1.config.proxyPath}/web-vitals`,
54999
- destination: webVitalsEndpoint,
55000
- basePath: false
55001
- }, {
55002
- source: `${config_1.config.proxyPath}/logs`,
55003
- destination: logsEndpoint,
55004
- basePath: false
55005
- }];
55006
- if (!rewrites) return axiomRewrites;
55007
- else if (Array.isArray(rewrites)) return rewrites.concat(axiomRewrites);
55008
- else {
55009
- rewrites.afterFiles = (rewrites.afterFiles || []).concat(axiomRewrites);
55010
- return rewrites;
55011
- }
55012
- }
55013
- };
55014
- }
55015
- function withAxiomNextConfig(nextConfigOrFn) {
55016
- if (typeof nextConfigOrFn === "function") return async (phase, ctx) => {
55017
- const nextConfig = await nextConfigOrFn(phase, ctx);
55018
- return applyAxiomRewrites(Object.assign({}, nextConfig));
55019
- };
55020
- return applyAxiomRewrites(Object.assign({}, nextConfigOrFn));
55021
- }
55022
- function withAxiomRouteHandler(handler, config) {
55023
- return async (req, arg) => {
55024
- let region = "";
55025
- if ("geo" in req) region = req.geo?.region ?? "";
55026
- let pathname = "";
55027
- if ("nextUrl" in req) pathname = req.nextUrl.pathname;
55028
- else if (req instanceof Request) pathname = new URL(req.url).pathname;
55029
- const requestDetails = Array.isArray(config?.logRequestDetails) || config?.logRequestDetails === true ? await (0, shared_1.requestToJSON)(req) : void 0;
55030
- const report = {
55031
- startTime: (/* @__PURE__ */ new Date()).getTime(),
55032
- endTime: (/* @__PURE__ */ new Date()).getTime(),
55033
- path: pathname,
55034
- method: req.method,
55035
- host: req.headers.get("host"),
55036
- userAgent: req.headers.get("user-agent"),
55037
- scheme: req.url.split("://")[0],
55038
- ip: req.headers.get("x-forwarded-for"),
55039
- region,
55040
- details: Array.isArray(config?.logRequestDetails) ? Object.fromEntries(Object.entries(requestDetails).filter(([key]) => (config?.logRequestDetails).includes(key))) : requestDetails
55041
- };
55042
- const logger = new logger_1.Logger({
55043
- req: report,
55044
- source: config_1.isEdgeRuntime ? "edge" : "lambda"
55045
- });
55046
- const log = logger.with({});
55047
- log.config.source = `${config_1.isEdgeRuntime ? "edge" : "lambda"}${!config_1.isVercelIntegration ? "-log" : ""}`;
55048
- const axiomContext = req;
55049
- const args = arg;
55050
- axiomContext.log = log;
55051
- try {
55052
- const result = await handler(axiomContext, args);
55053
- report.endTime = (/* @__PURE__ */ new Date()).getTime();
55054
- report.statusCode = result.status;
55055
- report.durationMs = report.endTime - report.startTime;
55056
- if (!config_1.isVercelIntegration) logger.logHttpRequest(logger_1.LogLevel.info, `${req.method} ${report.path} ${report.statusCode} in ${report.endTime - report.startTime}ms`, report, {});
55057
- log.attachResponseStatus(result.status);
55058
- if (config_1.isVercel) (0, functions_1.waitUntil)(logger.flush());
55059
- else await logger.flush();
55060
- return result;
55061
- } catch (error) {
55062
- report.endTime = (/* @__PURE__ */ new Date()).getTime();
55063
- let statusCode = 500;
55064
- let logLevel = logger_1.LogLevel.error;
55065
- if (error instanceof Error) {
55066
- if (error.message === "NEXT_NOT_FOUND") {
55067
- logLevel = config?.notFoundLogLevel ?? logger_1.LogLevel.warn;
55068
- statusCode = 404;
55069
- } else if (error.message === "NEXT_REDIRECT") {
55070
- logLevel = config?.redirectLogLevel ?? logger_1.LogLevel.info;
55071
- const e = error;
55072
- if (e.digest) {
55073
- const d = e.digest.split(";");
55074
- statusCode = parseInt(d[3]);
55075
- } else statusCode = 307;
55076
- }
55077
- }
55078
- report.statusCode = statusCode;
55079
- report.durationMs = report.endTime - report.startTime;
55080
- if (!config_1.isVercelIntegration) logger.logHttpRequest(logLevel, `${req.method} ${report.path} ${report.statusCode} in ${report.endTime - report.startTime}ms`, report, {});
55081
- log.log(logLevel, error.message, { error });
55082
- log.attachResponseStatus(statusCode);
55083
- if (config_1.isVercel) (0, functions_1.waitUntil)(logger.flush());
55084
- else await logger.flush();
55085
- throw error;
55086
- }
55087
- };
55088
- }
55089
- function isNextConfig(param) {
55090
- return typeof param == "object";
55091
- }
55092
- function isNextConfigFn(param) {
55093
- return typeof param === "function" && param.length === 2;
55094
- }
55095
- function withAxiom(param, config) {
55096
- if (typeof param == "function") {
55097
- if (isNextConfigFn(param)) return withAxiomNextConfig(param);
55098
- return withAxiomRouteHandler(param, config);
55099
- } else if (isNextConfig(param)) return withAxiomNextConfig(param);
55100
- return withAxiomRouteHandler(param, config);
55101
- }
55102
- }));
55103
- //#endregion
55104
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/webVitals/webVitals.js
55105
- var require_webVitals$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
55106
- Object.defineProperty(exports, "__esModule", { value: true });
55107
- exports.reportWebVitalsWithPath = reportWebVitalsWithPath;
55108
- const config_1 = require_config();
55109
- const shared_1 = require_shared();
55110
- const url = config_1.config.getWebVitalsEndpoint();
55111
- const throttledSendMetrics = (0, shared_1.throttle)(sendMetrics, 1e3);
55112
- let collectedMetrics = [];
55113
- function reportWebVitalsWithPath(metric, route) {
55114
- collectedMetrics.push({
55115
- route,
55116
- ...metric
55117
- });
55118
- if (!config_1.config.isEnvVarsSet()) return;
55119
- throttledSendMetrics();
55120
- }
55121
- function sendMetrics() {
55122
- const body = JSON.stringify(config_1.config.wrapWebVitalsObject(collectedMetrics));
55123
- const headers = {
55124
- "Content-Type": "application/json",
55125
- "User-Agent": "next-axiom/v" + config_1.Version
55126
- };
55127
- if (config_1.config.token) headers["Authorization"] = `Bearer ${config_1.config.token}`;
55128
- const reqOptions = {
55129
- body,
55130
- method: "POST",
55131
- keepalive: true,
55132
- headers
55133
- };
55134
- function sendFallback() {
55135
- fetch(url, reqOptions).catch(console.error);
55136
- }
55137
- if (config_1.isBrowser && config_1.isVercelIntegration && navigator.sendBeacon) try {
55138
- navigator.sendBeacon.bind(navigator)(url, body);
55139
- } catch (err) {
55140
- sendFallback();
55141
- }
55142
- else sendFallback();
55143
- collectedMetrics = [];
55144
- }
55145
- }));
55146
- //#endregion
55147
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/webVitals/components.js
55148
- var require_components = /* @__PURE__ */ __commonJSMin(((exports) => {
55149
- var __importDefault = exports && exports.__importDefault || function(mod) {
55150
- return mod && mod.__esModule ? mod : { "default": mod };
55151
- };
55152
- Object.defineProperty(exports, "__esModule", { value: true });
55153
- exports.AxiomWebVitals = AxiomWebVitals;
55154
- const react_1$2 = __importDefault(__require("react"));
55155
- const _1 = require_webVitals();
55156
- function AxiomWebVitals({ path }) {
55157
- (0, _1.useReportWebVitals)(path);
55158
- return react_1$2.default.createElement(react_1$2.default.Fragment, null);
55159
- }
55160
- }));
55161
- //#endregion
55162
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/webVitals/index.js
55163
- var require_webVitals = /* @__PURE__ */ __commonJSMin(((exports) => {
55164
- Object.defineProperty(exports, "__esModule", { value: true });
55165
- exports.AxiomWebVitals = void 0;
55166
- exports.useReportWebVitals = useReportWebVitals;
55167
- const navigation_1$1 = __require("next/navigation");
55168
- const web_vitals_1 = __require("next/web-vitals");
55169
- const webVitals_1 = require_webVitals$1();
55170
- const react_1$1 = __require("react");
55171
- var components_1 = require_components();
55172
- Object.defineProperty(exports, "AxiomWebVitals", {
55173
- enumerable: true,
55174
- get: function() {
55175
- return components_1.AxiomWebVitals;
55176
- }
55177
- });
55178
- function useReportWebVitals(path) {
55179
- const pathName = (0, navigation_1$1.usePathname)();
55180
- /**
55181
- * Refs allows us to stabilize the path name so that we can properly stabilize the reportWebVitalsFn
55182
- */
55183
- const stabilizedPath = (0, react_1$1.useRef)(path || pathName);
55184
- /**
55185
- * If the path changes, we update the stabilizedPath ref
55186
- */
55187
- if (typeof path === "string" && path !== stabilizedPath.current) stabilizedPath.current = pathName;
55188
- else if (typeof path === "string" && path === stabilizedPath.current) stabilizedPath.current = path;
55189
- /**
55190
- * Stabilizing the reportWebVitalsFn avoids reporting the same metrics from multiple paths, it happens because internally
55191
- * the useReportWebVitals from next uses a useEffect to report the metrics, and the reportWebVitalsFn is passed as a dependency
55192
- * to the useEffect, so when the path changes, the useEffect is re-run, and the same metrics are reported again.
55193
- */
55194
- const reportWebVitalsFn = (0, react_1$1.useCallback)((metric) => (0, webVitals_1.reportWebVitalsWithPath)(metric, stabilizedPath.current), []);
55195
- (0, web_vitals_1.useReportWebVitals)(reportWebVitalsFn);
55196
- }
55197
- }));
55198
- //#endregion
55199
- //#region ../../node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.js
55200
- var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
55201
- var has = Object.prototype.hasOwnProperty;
55202
- function find(iter, tar, key) {
55203
- for (key of iter.keys()) if (dequal(key, tar)) return key;
55204
- }
55205
- function dequal(foo, bar) {
55206
- var ctor, len, tmp;
55207
- if (foo === bar) return true;
55208
- if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
55209
- if (ctor === Date) return foo.getTime() === bar.getTime();
55210
- if (ctor === RegExp) return foo.toString() === bar.toString();
55211
- if (ctor === Array) {
55212
- if ((len = foo.length) === bar.length) while (len-- && dequal(foo[len], bar[len]));
55213
- return len === -1;
55214
- }
55215
- if (ctor === Set) {
55216
- if (foo.size !== bar.size) return false;
55217
- for (len of foo) {
55218
- tmp = len;
55219
- if (tmp && typeof tmp === "object") {
55220
- tmp = find(bar, tmp);
55221
- if (!tmp) return false;
55222
- }
55223
- if (!bar.has(tmp)) return false;
55224
- }
55225
- return true;
55226
- }
55227
- if (ctor === Map) {
55228
- if (foo.size !== bar.size) return false;
55229
- for (len of foo) {
55230
- tmp = len[0];
55231
- if (tmp && typeof tmp === "object") {
55232
- tmp = find(bar, tmp);
55233
- if (!tmp) return false;
55234
- }
55235
- if (!dequal(len[1], bar.get(tmp))) return false;
55236
- }
55237
- return true;
55238
- }
55239
- if (ctor === ArrayBuffer) {
55240
- foo = new Uint8Array(foo);
55241
- bar = new Uint8Array(bar);
55242
- } else if (ctor === DataView) {
55243
- if ((len = foo.byteLength) === bar.byteLength) while (len-- && foo.getInt8(len) === bar.getInt8(len));
55244
- return len === -1;
55245
- }
55246
- if (ArrayBuffer.isView(foo)) {
55247
- if ((len = foo.byteLength) === bar.byteLength) while (len-- && foo[len] === bar[len]);
55248
- return len === -1;
55249
- }
55250
- if (!ctor || typeof foo === "object") {
55251
- len = 0;
55252
- for (ctor in foo) {
55253
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
55254
- if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
55255
- }
55256
- return Object.keys(bar).length === len;
55257
- }
55258
- }
55259
- return foo !== foo && bar !== bar;
55260
- }
55261
- exports.dequal = dequal;
55262
- }));
55263
- //#endregion
55264
- //#region ../../node_modules/.pnpm/use-deep-compare@1.3.0_react@19.2.7/node_modules/use-deep-compare/dist-node/index.js
55265
- var require_dist_node = /* @__PURE__ */ __commonJSMin(((exports) => {
55266
- Object.defineProperty(exports, "__esModule", { value: true });
55267
- function _interopDefault(ex) {
55268
- return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
55269
- }
55270
- var React$2 = _interopDefault(__require("react"));
55271
- var dequal = require_dist$1();
55272
- function useDeepCompareMemoize(dependencies) {
55273
- const dependenciesRef = React$2.useRef(dependencies);
55274
- const signalRef = React$2.useRef(0);
55275
- if (!dequal.dequal(dependencies, dependenciesRef.current)) {
55276
- dependenciesRef.current = dependencies;
55277
- signalRef.current += 1;
55278
- }
55279
- return React$2.useMemo(() => dependenciesRef.current, [signalRef.current]);
55280
- }
55281
- /**
55282
- * `useDeepCompareCallback` will return a memoized version of the callback that
55283
- * only changes if one of the `dependencies` has changed.
55284
- *
55285
- * Warning: `useDeepCompareCallback` should not be used with dependencies that
55286
- * are all primitive values. Use `React.useCallback` instead.
55287
- *
55288
- * @see {@link https://react.dev/reference/react/useCallback}
55289
- */
55290
- function useDeepCompareCallback(callback, dependencies) {
55291
- return React$2.useCallback(callback, useDeepCompareMemoize(dependencies));
55292
- }
55293
- /**
55294
- * Accepts a function that contains imperative, possibly effectful code.
55295
- *
55296
- * Warning: `useDeepCompareEffect` should not be used with dependencies that
55297
- * are all primitive values. Use `React.useEffect` instead.
55298
- *
55299
- * @see {@link https://react.dev/reference/react/useEffect}
55300
- */
55301
- function useDeepCompareEffect(effect, dependencies) {
55302
- React$2.useEffect(effect, useDeepCompareMemoize(dependencies));
55303
- }
55304
- /**
55305
- * `useDeepCompareImperativeHandle` customizes the instance value that is exposed to parent components when using `ref`.
55306
- * As always, imperative code using refs should be avoided in most cases.
55307
- *
55308
- * `useDeepCompareImperativeHandle` should be used with `React.forwardRef`.
55309
- *
55310
- * It's similar to `useImperativeHandle`, but uses deep comparison on the dependencies.
55311
- *
55312
- * Warning: `useDeepCompareImperativeHandle` should not be used with dependencies that
55313
- * are all primitive values. Use `React.useImperativeHandle` instead.
55314
- *
55315
- * @see {@link https://react.dev/reference/react/useImperativeHandle}
55316
- */
55317
- function useDeepCompareImperativeHandle(ref, init, dependencies) {
55318
- React$2.useImperativeHandle(ref, init, useDeepCompareMemoize(dependencies));
55319
- }
55320
- /**
55321
- * The signature is identical to `useDeepCompareEffect`, but it fires synchronously after all DOM mutations.
55322
- * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
55323
- * `useDeepCompareLayoutEffect` will be flushed synchronously, before the browser has a chance to paint.
55324
- *
55325
- * Prefer the standard `useDeepCompareEffect` when possible to avoid blocking visual updates.
55326
- *
55327
- * If you’re migrating code from a class component, `useDeepCompareLayoutEffect` fires in the same phase as
55328
- * `componentDidMount` and `componentDidUpdate`.
55329
- *
55330
- * Warning: `useDeepCompareLayoutEffect` should not be used with dependencies that
55331
- * are all primitive values. Use `React.useLayoutEffect` instead.
55332
- *
55333
- * @see {@link https://react.dev/reference/react/useLayoutEffect}
55334
- */
55335
- function useDeepCompareLayoutEffect(effect, dependencies) {
55336
- React$2.useLayoutEffect(effect, useDeepCompareMemoize(dependencies));
55337
- }
55338
- /**
55339
- * `useDeepCompareMemo` will only recompute the memoized value when one of the
55340
- * `dependencies` has changed.
55341
- *
55342
- * Warning: `useDeepCompareMemo` should not be used with dependencies that
55343
- * are all primitive values. Use `React.useMemo` instead.
55344
- *
55345
- * @see {@link https://react.dev/reference/react/useMemo}
55346
- */
55347
- function useDeepCompareMemo(factory, dependencies) {
55348
- return React$2.useMemo(factory, useDeepCompareMemoize(dependencies));
55349
- }
55350
- exports.useDeepCompareCallback = useDeepCompareCallback;
55351
- exports.useDeepCompareEffect = useDeepCompareEffect;
55352
- exports.useDeepCompareImperativeHandle = useDeepCompareImperativeHandle;
55353
- exports.useDeepCompareLayoutEffect = useDeepCompareLayoutEffect;
55354
- exports.useDeepCompareMemo = useDeepCompareMemo;
55355
- }));
55356
- //#endregion
55357
- //#region ../../node_modules/.pnpm/next-axiom@1.10.0_next@16.2.9_@opentelemetry+api@1.9.1_@playwright+test@1.61.0_react-do_4315f05d6e55f50fff8ada7e553b82cf/node_modules/next-axiom/dist/hooks.js
55358
- var require_hooks = /* @__PURE__ */ __commonJSMin(((exports) => {
55359
- Object.defineProperty(exports, "__esModule", { value: true });
55360
- exports.useLogger = useLogger;
55361
- const navigation_1 = __require("next/navigation");
55362
- const logger_1 = require_logger();
55363
- const react_1 = __require("react");
55364
- const use_deep_compare_1 = require_dist_node();
55365
- function useLogger(config = {}) {
55366
- const path = (0, navigation_1.usePathname)();
55367
- const memoizedConfig = (0, use_deep_compare_1.useDeepCompareMemo)(() => ({
55368
- ...config,
55369
- args: {
55370
- ...config.args ?? {},
55371
- path
55372
- }
55373
- }), [config, path]);
55374
- const logger = (0, react_1.useMemo)(() => new logger_1.Logger(memoizedConfig), [memoizedConfig]);
55375
- (0, react_1.useEffect)(() => {
55376
- return () => {
55377
- if (logger) logger.flush();
55378
- };
55379
- }, [path]);
55380
- return logger;
55381
- }
55382
- }));
55383
- //#endregion
55384
53075
  //#region ../logger/src/sanitize.ts
55385
- var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
55386
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
55387
- if (k2 === void 0) k2 = k;
55388
- var desc = Object.getOwnPropertyDescriptor(m, k);
55389
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
55390
- enumerable: true,
55391
- get: function() {
55392
- return m[k];
55393
- }
55394
- };
55395
- Object.defineProperty(o, k2, desc);
55396
- }) : (function(o, m, k, k2) {
55397
- if (k2 === void 0) k2 = k;
55398
- o[k2] = m[k];
55399
- }));
55400
- var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
55401
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
55402
- };
55403
- Object.defineProperty(exports, "__esModule", { value: true });
55404
- exports.useLogger = exports.withAxiomRouteHandler = exports.withAxiomNextConfig = exports.withAxiom = exports.throttle = exports.EndpointType = exports.LogLevel = exports.Logger = exports.log = void 0;
55405
- var logger_1 = require_logger();
55406
- Object.defineProperty(exports, "log", {
55407
- enumerable: true,
55408
- get: function() {
55409
- return logger_1.log;
55410
- }
55411
- });
55412
- Object.defineProperty(exports, "Logger", {
55413
- enumerable: true,
55414
- get: function() {
55415
- return logger_1.Logger;
55416
- }
55417
- });
55418
- Object.defineProperty(exports, "LogLevel", {
55419
- enumerable: true,
55420
- get: function() {
55421
- return logger_1.LogLevel;
55422
- }
55423
- });
55424
- var shared_1 = require_shared();
55425
- Object.defineProperty(exports, "EndpointType", {
55426
- enumerable: true,
55427
- get: function() {
55428
- return shared_1.EndpointType;
55429
- }
55430
- });
55431
- Object.defineProperty(exports, "throttle", {
55432
- enumerable: true,
55433
- get: function() {
55434
- return shared_1.throttle;
55435
- }
55436
- });
55437
- __exportStar(require_base(), exports);
55438
- __exportStar(require_config(), exports);
55439
- var withAxiom_1 = require_withAxiom();
55440
- Object.defineProperty(exports, "withAxiom", {
55441
- enumerable: true,
55442
- get: function() {
55443
- return withAxiom_1.withAxiom;
55444
- }
55445
- });
55446
- Object.defineProperty(exports, "withAxiomNextConfig", {
55447
- enumerable: true,
55448
- get: function() {
55449
- return withAxiom_1.withAxiomNextConfig;
55450
- }
55451
- });
55452
- Object.defineProperty(exports, "withAxiomRouteHandler", {
55453
- enumerable: true,
55454
- get: function() {
55455
- return withAxiom_1.withAxiomRouteHandler;
55456
- }
55457
- });
55458
- __exportStar(require_webVitals(), exports);
55459
- var hooks_1 = require_hooks();
55460
- Object.defineProperty(exports, "useLogger", {
55461
- enumerable: true,
55462
- get: function() {
55463
- return hooks_1.useLogger;
55464
- }
55465
- });
55466
- })))();
55467
53076
  const DEFAULT_MAX_STRING_LENGTH = 2e3;
55468
53077
  const STRUCTURED_KEYS = /* @__PURE__ */ new Set([
55469
53078
  "source",
@@ -55544,17 +53153,41 @@ function sanitizeLogFields(fields, options) {
55544
53153
  return sanitizeV2(fields, options?.maxStringLength ?? DEFAULT_MAX_STRING_LENGTH);
55545
53154
  }
55546
53155
  //#endregion
55547
- //#region ../logger/src/next.ts
55548
- function wrap(base = import_dist.log) {
53156
+ //#region ../logger/src/console.ts
53157
+ function formatLog(level, message, fields) {
53158
+ const entry = {
53159
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
53160
+ level,
53161
+ message,
53162
+ ...sanitizeLogFields(fields)
53163
+ };
53164
+ return JSON.stringify(entry);
53165
+ }
53166
+ function createLogger(baseFields = {}) {
55549
53167
  return {
55550
- debug: (message, fields) => base.debug(message, sanitizeLogFields(fields)),
55551
- info: (message, fields) => base.info(message, sanitizeLogFields(fields)),
55552
- warn: (message, fields) => base.warn(message, sanitizeLogFields(fields)),
55553
- error: (message, fields) => base.error(message, sanitizeLogFields(fields)),
55554
- withFields: (fields) => wrap(base.with(sanitizeLogFields(fields) ?? {}))
53168
+ debug: (msg, fields) => console.debug(formatLog("debug", msg, {
53169
+ ...baseFields,
53170
+ ...fields
53171
+ })),
53172
+ info: (msg, fields) => console.info(formatLog("info", msg, {
53173
+ ...baseFields,
53174
+ ...fields
53175
+ })),
53176
+ warn: (msg, fields) => console.warn(formatLog("warn", msg, {
53177
+ ...baseFields,
53178
+ ...fields
53179
+ })),
53180
+ error: (msg, fields) => console.error(formatLog("error", msg, {
53181
+ ...baseFields,
53182
+ ...fields
53183
+ })),
53184
+ withFields: (fields) => createLogger({
53185
+ ...baseFields,
53186
+ ...fields
53187
+ })
55555
53188
  };
55556
53189
  }
55557
- const logger = wrap();
53190
+ const logger = createLogger();
55558
53191
  //#endregion
55559
53192
  //#region ../blocks/src/system/runtime/nodes/richText-coerce.ts
55560
53193
  function parseRichTextDoc(value) {
@@ -87014,7 +84647,7 @@ var CircuitOpenError = class extends Error {
87014
84647
  * 1. This constant
87015
84648
  * 2. The "version" field in package.json
87016
84649
  */
87017
- const SDK_VERSION = "0.121.0";
84650
+ const SDK_VERSION = "0.123.0";
87018
84651
  //#endregion
87019
84652
  //#region src/next/content-load-failure.ts
87020
84653
  const SdkContentLoadError = RiverbankContentLoadError;