@donotdev/functions 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/chunks/chunk-6NXIK35R.js +23 -0
- package/lib/chunks/chunk-6NXIK35R.js.map +7 -0
- package/lib/chunks/chunk-EZKRLLSQ.js +22 -0
- package/lib/chunks/chunk-EZKRLLSQ.js.map +7 -0
- package/lib/chunks/chunk-F3PHE627.js +22 -0
- package/lib/chunks/chunk-F3PHE627.js.map +7 -0
- package/lib/chunks/chunk-F3WBFWPO.js +151 -0
- package/lib/chunks/chunk-F3WBFWPO.js.map +7 -0
- package/lib/chunks/chunk-G5DRV3DH.js +22 -0
- package/lib/chunks/chunk-G5DRV3DH.js.map +7 -0
- package/lib/chunks/{chunk-5IPULSUX.js → chunk-GDIUOJMD.js} +2 -2
- package/lib/chunks/chunk-GDIUOJMD.js.map +7 -0
- package/lib/chunks/chunk-Q2WLRFOE.js +22 -0
- package/lib/chunks/chunk-Q2WLRFOE.js.map +7 -0
- package/lib/chunks/chunk-QXIOO2RL.js +22 -0
- package/lib/chunks/chunk-QXIOO2RL.js.map +7 -0
- package/lib/chunks/{chunk-3F4BWKQD.js → chunk-UH445BGK.js} +2 -2
- package/lib/chunks/chunk-W6W4L44F.js +22 -0
- package/lib/chunks/chunk-W6W4L44F.js.map +7 -0
- package/lib/chunks/chunk-W74UL7AY.js +22 -0
- package/lib/chunks/chunk-W74UL7AY.js.map +7 -0
- package/lib/chunks/{monitoring-E7JBYBHQ.js → monitoring-LXNVBD3G.js} +2 -2
- package/lib/chunks/{rateLimiter-SQISLOP5.js → rateLimiter-GG5LPWXJ.js} +2 -2
- package/lib/chunks/server-NODQAE3F.js +22 -0
- package/lib/firebase/billing/index.d.ts +2 -2
- package/lib/firebase/crud/aggregate.d.ts +1 -1
- package/lib/firebase/index.d.ts +1 -1
- package/lib/firebase/index.js +1 -1
- package/lib/firebase/index.js.map +4 -4
- package/lib/firebase/registerCrudFunctions.d.ts +0 -5
- package/lib/shared/billing/checkoutPrice.d.ts +3 -6
- package/lib/shared/billing/checkoutValidation.d.ts +1 -1
- package/lib/shared/billing/createCheckout.d.ts +4 -4
- package/lib/shared/billing/firestoreIdempotency.d.ts +2 -2
- package/lib/shared/billing/helpers/subscriptionManagement.d.ts +2 -2
- package/lib/shared/billing/idempotency.d.ts +3 -23
- package/lib/shared/billing/idempotencyContract.d.ts +0 -20
- package/lib/shared/billing/orderWebhook.d.ts +29 -2
- package/lib/shared/billing/stripePinned.d.ts +43 -0
- package/lib/shared/denoEnv.d.ts +25 -0
- package/lib/shared/github.d.ts +0 -8
- package/lib/shared/index.js +1 -1
- package/lib/shared/logger.d.ts +14 -14
- package/lib/shared/utils/external/subscription.d.ts +0 -8
- package/lib/shared/utils/internal/auth.d.ts +1 -5
- package/lib/shared/utils.d.ts +12 -83
- package/lib/supabase/auth/deleteAccount.d.ts +34 -2
- package/lib/supabase/crud/create.d.ts +0 -8
- package/lib/supabase/crud/entityStore.d.ts +13 -0
- package/lib/supabase/crud/update.d.ts +0 -8
- package/lib/supabase/index.d.ts +1 -0
- package/lib/supabase/index.js +1 -1
- package/lib/supabase/index.js.map +4 -4
- package/lib/vercel/api/index.js +1 -1
- package/lib/vercel/api/index.js.map +3 -3
- package/package.json +9 -9
- package/src/firebase/auth/getCustomClaims.ts +2 -0
- package/src/firebase/auth/getUserAuthStatus.ts +2 -0
- package/src/firebase/auth/removeCustomClaims.ts +2 -0
- package/src/firebase/auth/setCustomClaims.ts +3 -0
- package/src/firebase/baseFunction.ts +8 -4
- package/src/firebase/billing/changePlan.ts +6 -5
- package/src/firebase/billing/createCustomerPortal.ts +6 -4
- package/src/firebase/billing/index.d.ts +0 -12
- package/src/firebase/billing/index.ts +0 -3
- package/src/firebase/billing/refreshSubscriptionStatus.ts +7 -5
- package/src/firebase/billing/webhookHandler.ts +4 -4
- package/src/firebase/crud/aggregate.ts +41 -12
- package/src/firebase/crud/bulk.ts +7 -0
- package/src/firebase/crud/create.ts +21 -8
- package/src/firebase/crud/delete.ts +6 -1
- package/src/firebase/crud/get.ts +9 -2
- package/src/firebase/crud/list.ts +18 -8
- package/src/firebase/crud/update.ts +15 -7
- package/src/firebase/helpers/githubAccessHelper.ts +3 -0
- package/src/firebase/helpers/githubTeamAccessHelper.ts +1 -0
- package/src/firebase/index.ts +0 -1
- package/src/firebase/oauth/disconnect.ts +2 -2
- package/src/firebase/oauth/exchangeToken.ts +6 -2
- package/src/firebase/oauth/getConnections.ts +3 -3
- package/src/firebase/oauth/githubAccess.ts +7 -4
- package/src/firebase/oauth/refreshToken.ts +3 -2
- package/src/firebase/registerCrudFunctions.ts +0 -19
- package/src/firebase/scheduled/checkExpiredSubscriptions.ts +4 -1
- package/src/shared/__tests__/idempotency.test.ts +0 -32
- package/src/shared/__tests__/utils.test.ts +0 -25
- package/src/shared/ai/classifyAIError.ts +18 -10
- package/src/shared/ai/createAIRoute.ts +2 -1
- package/src/shared/ai/resolveModelTier.ts +2 -1
- package/src/shared/billing/__tests__/createCheckout.compat.test.ts +4 -110
- package/src/shared/billing/__tests__/createCheckout.test.ts +94 -0
- package/src/shared/billing/__tests__/firestoreIdempotency.emulator.test.ts +1 -1
- package/src/shared/billing/__tests__/webhookHandler.test.ts +108 -0
- package/src/shared/billing/checkoutPrice.ts +7 -42
- package/src/shared/billing/checkoutValidation.ts +19 -2
- package/src/shared/billing/createCheckout.ts +59 -30
- package/src/shared/billing/firestoreIdempotency.ts +2 -21
- package/src/shared/billing/helpers/subscriptionManagement.ts +14 -10
- package/src/shared/billing/idempotency.ts +4 -54
- package/src/shared/billing/idempotencyContract.ts +0 -21
- package/src/shared/billing/orderWebhook.ts +69 -1
- package/src/shared/billing/stripeClient.ts +2 -1
- package/src/shared/billing/stripePinned.ts +71 -0
- package/src/shared/billing/tierWebhookEvents.ts +3 -2
- package/src/shared/billing/webhookHandler.ts +5 -1
- package/src/shared/crud/bulkCore.ts +3 -2
- package/src/shared/denoEnv.ts +29 -0
- package/src/shared/email/createEmailRoute.ts +2 -2
- package/src/shared/errorHandling.ts +8 -8
- package/src/shared/firebase.ts +26 -9
- package/src/shared/github.ts +15 -5
- package/src/shared/logger.ts +37 -38
- package/src/shared/schema.ts +6 -10
- package/src/shared/utils/external/date.ts +4 -4
- package/src/shared/utils/external/subscription.ts +2 -89
- package/src/shared/utils/firebaseHelpers.ts +2 -0
- package/src/shared/utils/internal/auth.ts +1 -6
- package/src/shared/utils/internal/idempotency.ts +3 -0
- package/src/shared/utils/internal/monitoring.ts +6 -5
- package/src/shared/utils/internal/validation.ts +2 -0
- package/src/shared/utils/schemaValidation.ts +1 -0
- package/src/shared/utils/validation.ts +10 -20
- package/src/shared/utils.ts +12 -138
- package/src/supabase/__tests__/aggregate.test.ts +132 -0
- package/src/supabase/auth/__tests__/deleteAccount.test.ts +102 -0
- package/src/supabase/auth/deleteAccount.ts +72 -5
- package/src/supabase/billing/refreshSubscriptionStatus.ts +6 -5
- package/src/supabase/crud/aggregate.ts +85 -72
- package/src/supabase/crud/bulk.ts +3 -0
- package/src/supabase/crud/create.ts +13 -9
- package/src/supabase/crud/delete.ts +2 -1
- package/src/supabase/crud/entityStore.ts +1 -1
- package/src/supabase/crud/get.ts +2 -1
- package/src/supabase/crud/list.ts +23 -17
- package/src/supabase/crud/update.ts +9 -6
- package/src/supabase/edgeFunction.ts +2 -1
- package/src/supabase/email/createEmailFunction.ts +2 -1
- package/src/supabase/index.ts +1 -0
- package/src/supabase/oauth/exchangeToken.ts +1 -0
- package/src/supabase/oauth/getConnections.ts +1 -1
- package/src/supabase/oauth/refreshToken.ts +1 -0
- package/src/supabase/utils/idempotency.ts +1 -1
- package/src/supabase/utils/monitoring.ts +1 -0
- package/src/vercel/api/billing/change-plan.ts +6 -5
- package/src/vercel/api/billing/refresh-subscription-status.ts +3 -1
- package/src/vercel/api/crud/bulk.ts +7 -2
- package/src/vercel/api/crud/create.ts +6 -3
- package/src/vercel/api/crud/delete.ts +5 -2
- package/src/vercel/api/crud/get.ts +5 -2
- package/src/vercel/api/crud/list.ts +6 -3
- package/src/vercel/api/crud/update.ts +6 -3
- package/src/vercel/api/oauth/check-github-access.ts +1 -0
- package/src/vercel/api/oauth/exchange-token.ts +5 -2
- package/src/vercel/api/oauth/grant-github-access.ts +1 -0
- package/src/vercel/api/oauth/revoke-github-access.ts +1 -0
- package/src/vercel/baseFunction.ts +5 -1
- package/lib/chunks/chunk-5IPULSUX.js.map +0 -7
- package/lib/chunks/chunk-6USHTJED.js +0 -22
- package/lib/chunks/chunk-6USHTJED.js.map +0 -7
- package/lib/chunks/chunk-CXBSROEW.js +0 -23
- package/lib/chunks/chunk-CXBSROEW.js.map +0 -7
- package/lib/chunks/chunk-GYTCWMXV.js +0 -22
- package/lib/chunks/chunk-GYTCWMXV.js.map +0 -7
- package/lib/chunks/chunk-LCDLG4VG.js +0 -151
- package/lib/chunks/chunk-LCDLG4VG.js.map +0 -7
- package/lib/chunks/chunk-MQANUSY3.js +0 -22
- package/lib/chunks/chunk-MQANUSY3.js.map +0 -7
- package/lib/chunks/chunk-OFQVO3FD.js +0 -22
- package/lib/chunks/chunk-OFQVO3FD.js.map +0 -7
- package/lib/chunks/chunk-PWAGW4R6.js +0 -22
- package/lib/chunks/chunk-PWAGW4R6.js.map +0 -7
- package/lib/chunks/chunk-US2VOP4S.js +0 -22
- package/lib/chunks/chunk-US2VOP4S.js.map +0 -7
- package/lib/chunks/chunk-YTKDNZNW.js +0 -22
- package/lib/chunks/chunk-YTKDNZNW.js.map +0 -7
- package/lib/chunks/server-IQ5JNJOM.js +0 -22
- package/lib/shared/utils/functionWrapper.d.ts +0 -36
- package/src/shared/utils/__tests__/functionWrapper.test.ts +0 -122
- package/src/shared/utils/functionWrapper.ts +0 -73
- /package/lib/chunks/{chunk-3F4BWKQD.js.map → chunk-UH445BGK.js.map} +0 -0
- /package/lib/chunks/{monitoring-E7JBYBHQ.js.map → monitoring-LXNVBD3G.js.map} +0 -0
- /package/lib/chunks/{rateLimiter-SQISLOP5.js.map → rateLimiter-GG5LPWXJ.js.map} +0 -0
- /package/lib/chunks/{server-IQ5JNJOM.js.map → server-NODQAE3F.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/shared/logger.ts"],
|
|
4
|
+
"sourcesContent": ["// packages/functions/src/shared/logger.ts\n\n/**\n * @fileoverview Server-side logging utility with Sentry integration\n * @description Structured logging for server environments with Sentry integration\n *\n * Sentry Integration:\n * - Uses @sentry/node for backend error tracking\n * - Automatically detects if Sentry is installed\n * - Works with or without Sentry (graceful degradation)\n * - Consumer must install @sentry/node and set SENTRY_DSN env var\n *\n * Usage:\n * ```typescript\n * import { logger } from '../shared/logger.js';\n *\n * logger.info('Server started', { port: 3000 });\n * logger.error('Database connection failed', { error: err });\n * ```\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\n\n// Server-only by package: @donotdev/functions is never imported by client code,\n// so no runtime browser check (Supabase Edge defines `window`, which made such a\n// check throw on every edge function).\n\nlet sentryEnabled = false;\nlet sentryClient: Pick<\n typeof import('@sentry/node'),\n 'captureException' | 'captureMessage'\n> | null = null;\n\n// Initialize Sentry lazily to avoid Firebase Functions issues\nlet sentryInitialized = false;\n\n/**\n * Initialize Sentry if not already done\n * Called lazily to avoid Firebase Functions issues\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\nasync function initializeSentry(): Promise<void> {\n if (sentryInitialized) return;\n\n try {\n // Check if Sentry is available (consumer must install @sentry/node)\n const sentryDsn = process.env.SENTRY_DSN;\n if (sentryDsn) {\n // Dynamic import to avoid build errors if @sentry/node is not installed\n const { init, captureException, captureMessage } =\n await import('@sentry/node');\n\n init({\n dsn: sentryDsn,\n environment: process.env.NODE_ENV || 'development',\n });\n\n sentryClient = { captureException, captureMessage };\n sentryEnabled = true;\n }\n } catch (error) {\n // Sentry not available, continue without it\n sentryEnabled = false;\n } finally {\n sentryInitialized = true;\n }\n}\n\n/**\n * Log levels for structured logging\n */\nexport enum LogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n FATAL = 4,\n}\n\n/**\n * Log entry interface for structured logging\n */\nexport interface LogEntry {\n level: LogLevel;\n message: string;\n timestamp: string;\n context?: Record<string, unknown>;\n error?: Error;\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Server-side logger with Sentry integration\n *\n * Features:\n * - Structured logging with context\n * - Automatic Sentry error reporting\n * - Performance monitoring\n * - Request correlation\n *\n * @example\n * ```typescript\n * import { logger } from '../shared/logger.js';\n *\n * // Basic logging\n * logger.info('Server started', { port: 3000 });\n *\n * // Error logging with Sentry\n * logger.error('Database error', { error: err, query: 'SELECT * FROM users' });\n *\n * // Performance logging\n * logger.info('Request completed', {\n * duration: 150,\n * status: 200,\n * path: '/api/users'\n * });\n * ```\n */\nexport const logger = {\n /**\n * Log debug information\n * @param message - Log message\n * @param context - Additional context data\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\n debug(message: string, context?: Record<string, unknown>): void {\n this.log(LogLevel.DEBUG, message, context);\n },\n\n /**\n * Log informational messages\n * @param message - Log message\n * @param context - Additional context data\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\n info(message: string, context?: Record<string, unknown>): void {\n this.log(LogLevel.INFO, message, context);\n },\n\n /**\n * Log warning messages\n * @param message - Log message\n * @param context - Additional context data\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\n warn(message: string, context?: Record<string, unknown>): void {\n this.log(LogLevel.WARN, message, context);\n },\n\n /**\n * Log error messages with Sentry integration\n * @param message - Log message\n * @param context - Additional context data\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\n async error(\n message: string,\n context?: Record<string, unknown>\n ): Promise<void> {\n this.log(LogLevel.ERROR, message, context);\n\n // Initialize Sentry lazily if needed\n if (!sentryInitialized) {\n await initializeSentry();\n }\n\n // Send to Sentry if available\n if (sentryEnabled && sentryClient) {\n try {\n if (context?.error instanceof Error) {\n sentryClient.captureException(context.error);\n } else {\n sentryClient.captureMessage(message, 'error');\n }\n } catch (sentryError) {\n // Don't let Sentry errors break logging\n console.error('Sentry error:', sentryError);\n }\n }\n },\n\n /**\n * Log fatal errors with Sentry integration\n * @param message - Log message\n * @param context - Additional context data\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\n async fatal(\n message: string,\n context?: Record<string, unknown>\n ): Promise<void> {\n this.log(LogLevel.FATAL, message, context);\n\n // Initialize Sentry lazily if needed\n if (!sentryInitialized) {\n await initializeSentry();\n }\n\n // Send to Sentry if available\n if (sentryEnabled && sentryClient) {\n try {\n if (context?.error instanceof Error) {\n sentryClient.captureException(context.error);\n } else {\n sentryClient.captureMessage(message, 'fatal');\n }\n } catch (sentryError) {\n // Don't let Sentry errors break logging\n console.error('Sentry error:', sentryError);\n }\n }\n },\n\n /**\n * Core logging method\n * @param level - Log level\n * @param message - Log message\n * @param context - Additional context data\n *\n * @security Callers MUST NOT pass secrets (tokens, passwords, API keys) in context. Context is logged in plaintext.\n *\n * @version 0.1.0\n * @since 0.0.1\n * @author AMBROISE PARK Consulting\n */\n log(\n level: LogLevel,\n message: string,\n context?: Record<string, unknown>\n ): void {\n const timestamp = new Date().toISOString();\n // Format log entry for console output\n const levelName = LogLevel[level];\n const contextStr = context ? ` ${JSON.stringify(context)}` : '';\n\n // Use appropriate console method based on level\n switch (level) {\n case LogLevel.DEBUG:\n console.debug(`[${timestamp}] [DEBUG] ${message}${contextStr}`);\n break;\n case LogLevel.INFO:\n console.info(`[${timestamp}] [INFO] ${message}${contextStr}`);\n break;\n case LogLevel.WARN:\n console.warn(`[${timestamp}] [WARN] ${message}${contextStr}`);\n break;\n case LogLevel.ERROR:\n console.error(`[${timestamp}] [ERROR] ${message}${contextStr}`);\n break;\n case LogLevel.FATAL:\n console.error(`[${timestamp}] [FATAL] ${message}${contextStr}`);\n break;\n }\n },\n\n /**\n * Check if Sentry is enabled\n * @returns True if Sentry is available and configured\n */\n isSentryEnabled(): boolean {\n return sentryEnabled;\n },\n\n /**\n * Get current log level (always DEBUG for server)\n * @returns Current log level\n */\n getLevel(): LogLevel {\n return LogLevel.DEBUG;\n },\n};\n\n/**\n * Create a child logger with additional context\n * @param context - Additional context to include in all logs\n * @returns Child logger instance\n */\nexport function createChildLogger(context: Record<string, unknown>) {\n return {\n debug: (message: string, additionalContext?: Record<string, unknown>) => {\n logger.debug(message, { ...context, ...additionalContext });\n },\n info: (message: string, additionalContext?: Record<string, unknown>) => {\n logger.info(message, { ...context, ...additionalContext });\n },\n warn: (message: string, additionalContext?: Record<string, unknown>) => {\n logger.warn(message, { ...context, ...additionalContext });\n },\n error: async (\n message: string,\n additionalContext?: Record<string, unknown>\n ) => {\n await logger.error(message, { ...context, ...additionalContext });\n },\n fatal: async (\n message: string,\n additionalContext?: Record<string, unknown>\n ) => {\n await logger.fatal(message, { ...context, ...additionalContext });\n },\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;wCA6BA,IAAIA,EAAgB,GAChBC,EAGO,KAGPC,EAAoB,GAUxB,eAAeC,GAAkC,CAC/C,GAAI,CAAAD,EAEJ,GAAI,CAEF,IAAME,EAAY,QAAQ,IAAI,WAC9B,GAAIA,EAAW,CAEb,GAAM,CAAE,KAAAC,EAAM,iBAAAC,EAAkB,eAAAC,CAAe,EAC7C,KAAM,QAAO,cAAc,EAE7BF,EAAK,CACH,IAAKD,EACL,YAAa,YACf,CAAC,EAEDH,EAAe,CAAE,iBAAAK,EAAkB,eAAAC,CAAe,EAClDP,EAAgB,EAClB,CACF,MAAgB,CAEdA,EAAgB,EAClB,QAAE,CACAE,EAAoB,EACtB,CACF,CAzBeM,EAAAL,EAAA,oBA8BR,IAAKM,OACVA,IAAA,MAAQ,GAAR,QACAA,IAAA,KAAO,GAAP,OACAA,IAAA,KAAO,GAAP,OACAA,IAAA,MAAQ,GAAR,QACAA,IAAA,MAAQ,GAAR,QALUA,OAAA,IA+CCC,EAAS,CAUpB,MAAMC,EAAiBC,EAAyC,CAC9D,KAAK,IAAI,EAAgBD,EAASC,CAAO,CAC3C,EAWA,KAAKD,EAAiBC,EAAyC,CAC7D,KAAK,IAAI,EAAeD,EAASC,CAAO,CAC1C,EAWA,KAAKD,EAAiBC,EAAyC,CAC7D,KAAK,IAAI,EAAeD,EAASC,CAAO,CAC1C,EAWA,MAAM,MACJD,EACAC,EACe,CASf,GARA,KAAK,IAAI,EAAgBD,EAASC,CAAO,EAGpCV,GACH,MAAMC,EAAiB,EAIrBH,GAAiBC,EACnB,GAAI,CACEW,GAAS,iBAAiB,MAC5BX,EAAa,iBAAiBW,EAAQ,KAAK,EAE3CX,EAAa,eAAeU,EAAS,OAAO,CAEhD,OAASE,EAAa,CAEpB,QAAQ,MAAM,gBAAiBA,CAAW,CAC5C,CAEJ,EAWA,MAAM,MACJF,EACAC,EACe,CASf,GARA,KAAK,IAAI,EAAgBD,EAASC,CAAO,EAGpCV,GACH,MAAMC,EAAiB,EAIrBH,GAAiBC,EACnB,GAAI,CACEW,GAAS,iBAAiB,MAC5BX,EAAa,iBAAiBW,EAAQ,KAAK,EAE3CX,EAAa,eAAeU,EAAS,OAAO,CAEhD,OAASE,EAAa,CAEpB,QAAQ,MAAM,gBAAiBA,CAAW,CAC5C,CAEJ,EAcA,IACEC,EACAH,EACAC,EACM,CACN,IAAMG,EAAY,IAAI,KAAK,EAAE,YAAY,EAEnCC,EAAYP,EAASK,CAAK,EAC1BG,EAAaL,EAAU,IAAI,KAAK,UAAUA,CAAO,CAAC,GAAK,GAG7D,OAAQE,EAAO,CACb,IAAK,GACH,QAAQ,MAAM,IAAIC,CAAS,aAAaJ,CAAO,GAAGM,CAAU,EAAE,EAC9D,MACF,IAAK,GACH,QAAQ,KAAK,IAAIF,CAAS,YAAYJ,CAAO,GAAGM,CAAU,EAAE,EAC5D,MACF,IAAK,GACH,QAAQ,KAAK,IAAIF,CAAS,YAAYJ,CAAO,GAAGM,CAAU,EAAE,EAC5D,MACF,IAAK,GACH,QAAQ,MAAM,IAAIF,CAAS,aAAaJ,CAAO,GAAGM,CAAU,EAAE,EAC9D,MACF,IAAK,GACH,QAAQ,MAAM,IAAIF,CAAS,aAAaJ,CAAO,GAAGM,CAAU,EAAE,EAC9D,KACJ,CACF,EAMA,iBAA2B,CACzB,OAAOjB,CACT,EAMA,UAAqB,CACnB,MAAO,EACT,CACF",
|
|
6
|
+
"names": ["sentryEnabled", "sentryClient", "sentryInitialized", "initializeSentry", "sentryDsn", "init", "captureException", "captureMessage", "__name", "LogLevel", "logger", "message", "context", "sentryError", "level", "timestamp", "levelName", "contextStr"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
4
|
+
import { Buffer } from 'node:buffer';
|
|
5
|
+
import process from 'node:process';
|
|
6
|
+
|
|
7
|
+
const require = __createRequire(import.meta.url);
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
if (typeof globalThis !== 'undefined') {
|
|
12
|
+
globalThis.require = require;
|
|
13
|
+
globalThis.__filename = __filename;
|
|
14
|
+
globalThis.__dirname = __dirname;
|
|
15
|
+
globalThis.Buffer = Buffer;
|
|
16
|
+
globalThis.process = process;
|
|
17
|
+
if (typeof global === 'undefined') {
|
|
18
|
+
globalThis.global = globalThis;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
import{a as i}from"./chunk-AYY7UXNI.js";var de={ALREADY_EXISTS:"already-exists",CANCELLED:"cancelled",DEADLINE_EXCEEDED:"deadline-exceeded",DELETE_ACCOUNT_REQUIRES_SERVER:"DELETE_ACCOUNT_REQUIRES_SERVER",INTERNAL:"internal",INVALID_ARGUMENT:"invalid-argument",NOT_FOUND:"not-found",PERMISSION_DENIED:"permission-denied",RATE_LIMIT_EXCEEDED:"rate-limit-exceeded",TIMEOUT:"timeout",UNAUTHENTICATED:"unauthenticated",UNAVAILABLE:"unavailable",UNIMPLEMENTED:"unimplemented",UNKNOWN:"unknown",VALIDATION_FAILED:"validation-failed"};var ve={INTERNAL_ERROR:"INTERNAL_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",PERMISSION_DENIED:"PERMISSION_DENIED",NOT_FOUND:"NOT_FOUND",ALREADY_EXISTS:"ALREADY_EXISTS",NETWORK_ERROR:"NETWORK_ERROR"},we={[de.PERMISSION_DENIED]:{type:ve.PERMISSION_DENIED,message:"You do not have permission to perform this action"},[de.NOT_FOUND]:{type:ve.NOT_FOUND,message:"The requested resource was not found"},[de.ALREADY_EXISTS]:{type:ve.ALREADY_EXISTS,message:"The resource already exists"},[de.INVALID_ARGUMENT]:{type:ve.VALIDATION_ERROR,message:"Invalid argument provided"}};function Ot(e){return"captureStackTrace"in e&&typeof e.captureStackTrace=="function"}i(Ot,"hasCaptureStackTrace");var O=class e extends Error{static{i(this,"DoNotDevError")}code;details;source;originalError;context;displayable;userMessageProvided;constructor(t,n=de.INTERNAL,o){super(t),Object.setPrototypeOf(this,e.prototype),this.code=n,this.details=o?.details,this.source=o?.source,this.originalError=o?.originalError,this.context=o?.context,this.displayable=o?.displayable??!0,this.userMessageProvided=o?.userMessageProvided,this.name=this.constructor.name,Ot(Error)&&Error.captureStackTrace(this,this.constructor)}toString(){return`${this.name} [${this.code}]: ${this.message}`}toJSON(){return{name:this.name,code:this.code,message:this.message,details:this.details,source:this.source,originalError:this.originalError,context:this.context,displayable:this.displayable,userMessageProvided:this.userMessageProvided}}};var q={ANTHROPIC:"anthropic",OPENAI:"openai",GOOGLE:"google"},be={USER:"user",ASSISTANT:"assistant",SYSTEM:"system"},Zn={[q.ANTHROPIC]:{default:"claude-sonnet-4-6",models:["claude-sonnet-4-6","claude-sonnet-4-20250514","claude-haiku-4-5-20251001","claude-opus-4-6","claude-opus-4-20250514"]},[q.OPENAI]:{default:"gpt-4o",models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-mini"]},[q.GOOGLE]:{default:"gemini-2.0-flash",models:["gemini-2.0-flash","gemini-2.5-pro","gemini-2.5-flash"]}};var Jn={FAST:{id:"fast",defaultModel:"claude-haiku-4-5-20251001"},STANDARD:{id:"standard",defaultModel:"claude-sonnet-4-6"},PREMIUM:{id:"premium",defaultModel:"claude-opus-4-6"}},Qn=4,er={"claude-sonnet-4-6":{promptPer1M:3,completionPer1M:15,currency:"usd"},"claude-haiku-4-5-20251001":{promptPer1M:.8,completionPer1M:4,currency:"usd"},"claude-opus-4-6":{promptPer1M:15,completionPer1M:75,currency:"usd"},"claude-sonnet-4-20250514":{promptPer1M:3,completionPer1M:15,currency:"usd"},"claude-opus-4-20250514":{promptPer1M:15,completionPer1M:75,currency:"usd"},"gpt-4o":{promptPer1M:2.5,completionPer1M:10,currency:"usd"},"gpt-4o-mini":{promptPer1M:.15,completionPer1M:.6,currency:"usd"},"gpt-4.1":{promptPer1M:2,completionPer1M:8,currency:"usd"},"gpt-4.1-mini":{promptPer1M:.4,completionPer1M:1.6,currency:"usd"},"o3-mini":{promptPer1M:1.1,completionPer1M:4.4,currency:"usd"},"gemini-2.0-flash":{promptPer1M:.1,completionPer1M:.4,currency:"usd"},"gemini-2.5-pro":{promptPer1M:1.25,completionPer1M:10,currency:"usd"},"gemini-2.5-flash":{promptPer1M:.15,completionPer1M:.6,currency:"usd"}};var Ee,Pt={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Oe(e){return!e&&!Ee?Pt:{lang:e?.lang??Ee?.lang,message:e?.message,abortEarly:e?.abortEarly??Ee?.abortEarly,abortPipeEarly:e?.abortPipeEarly??Ee?.abortPipeEarly}}i(Oe,"getGlobalConfig");var Dt;function _t(e){return Dt?.get(e)}i(_t,"getGlobalMessage");var Nt;function Ft(e){return Nt?.get(e)}i(Ft,"getSchemaMessage");var Ut;function Mt(e,t){return Ut?.get(e)?.get(t)}i(Mt,"getSpecificMessage");function X(e){let t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}i(X,"_stringify");function x(e,t,n,o,u){let a=u&&"input"in u?u.input:n.value,l=u?.expected??e.expects??null,y=u?.received??X(a),f={kind:e.kind,type:e.type,input:a,expected:l,received:y,message:`Invalid ${t}: ${l?`Expected ${l} but r`:"R"}eceived ${y}`,requirement:e.requirement,path:u?.path,issues:u?.issues,lang:o.lang,abortEarly:o.abortEarly,abortPipeEarly:o.abortPipeEarly},h=e.kind==="schema",d=u?.message??e.message??Mt(e.reference,f.lang)??(h?Ft(f.lang):null)??o.message??_t(f.lang);d!==void 0&&(f.message=typeof d=="function"?d(f):d),h&&(n.typed=!1),n.issues?n.issues.push(f):n.issues=[f]}i(x,"_addIssue");function Lt(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}i(Lt,"_isSameValueZero");function Ze(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}i(Ze,"_isValidObjectKey");function Pe(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}i(Pe,"_joinExpects");function I(e){return e["~standard"]={version:1,vendor:"valibot",validate:i(t=>e["~run"]({value:t},Oe()),"validate")},e}i(I,"_standardSchema");var xe=class extends Error{static{i(this,"ValiError")}constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function nr(e){return e instanceof xe}i(nr,"isValiError");var Bt=/^[\w+-]+(?:\.[\w+-]+)*@[\da-zA-Z]+(?:[.-][\da-zA-Z]+)*\.[a-zA-Z]{2,}$/u,rr=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");var qt=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z| ?[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;function fe(e,t){return{kind:"validation",type:"check",reference:fe,async:!1,expects:null,requirement:e,message:t,"~run"(n,o){return n.typed&&!this.requirement(n.value)&&x(this,"input",n,o),n}}}i(fe,"check");function L(e){return{kind:"validation",type:"email",reference:L,expects:null,async:!1,requirement:Bt,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&x(this,"email",t,n),t}}}i(L,"email");function ne(e){return{kind:"validation",type:"integer",reference:ne,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&x(this,"integer",t,n),t}}}i(ne,"integer");function j(e){return{kind:"validation",type:"iso_timestamp",reference:j,async:!1,expects:null,requirement:qt,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&x(this,"timestamp",t,n),t}}}i(j,"isoTimestamp");function re(e,t){return{kind:"validation",type:"length",reference:re,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(n,o){return n.typed&&n.value.length!==this.requirement&&x(this,"length",n,o,{received:`${n.value.length}`}),n}}}i(re,"length");function V(e,t){return{kind:"validation",type:"max_length",reference:V,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(n,o){return n.typed&&n.value.length>this.requirement&&x(this,"length",n,o,{received:`${n.value.length}`}),n}}}i(V,"maxLength");function B(e,t){return{kind:"validation",type:"max_value",reference:B,async:!1,expects:`<=${e instanceof Date?e.toJSON():X(e)}`,requirement:e,message:t,"~run"(n,o){return n.typed&&!(n.value<=this.requirement)&&x(this,"value",n,o,{received:n.value instanceof Date?n.value.toJSON():X(n.value)}),n}}}i(B,"maxValue");function m(e,t){return{kind:"validation",type:"min_length",reference:m,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(n,o){return n.typed&&n.value.length<this.requirement&&x(this,"length",n,o,{received:`${n.value.length}`}),n}}}i(m,"minLength");function _(e,t){return{kind:"validation",type:"min_value",reference:_,async:!1,expects:`>=${e instanceof Date?e.toJSON():X(e)}`,requirement:e,message:t,"~run"(n,o){return n.typed&&!(n.value>=this.requirement)&&x(this,"value",n,o,{received:n.value instanceof Date?n.value.toJSON():X(n.value)}),n}}}i(_,"minValue");function De(e){return{kind:"transformation",type:"raw_transform",reference:De,async:!1,"~run"(t,n){let o=e({dataset:t,config:n,addIssue:i(u=>x(this,u?.label??"input",t,n,u),"addIssue"),NEVER:null});return t.issues?t.typed=!1:t.value=o,t}}}i(De,"rawTransform");function ie(e,t){return{kind:"validation",type:"regex",reference:ie,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(n,o){return n.typed&&!this.requirement.test(n.value)&&x(this,"format",n,o),n}}}i(ie,"regex");function jt(e){return{kind:"transformation",type:"transform",reference:jt,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}i(jt,"transform");function N(e){return{kind:"validation",type:"url",reference:N,async:!1,expects:null,requirement(t){try{return URL.canParse?URL.canParse(t):(new URL(t),!0)}catch{return!1}},message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&x(this,"URL",t,n),t}}}i(N,"url");var Vt={abortEarly:!0};function Je(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}i(Je,"getFallback");function me(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}i(me,"getDefault");function Z(){return I({kind:"schema",type:"any",reference:Z,expects:"any",async:!1,"~run"(e){return e.typed=!0,e}})}i(Z,"any");function v(e,t){return I({kind:"schema",type:"array",reference:v,expects:"Array",async:!1,item:e,message:t,"~run"(n,o){let u=n.value;if(Array.isArray(u)){n.typed=!0,n.value=[];for(let a=0;a<u.length;a++){let l=u[a],y=this.item["~run"]({value:l},o);if(y.issues){let f={type:"array",origin:"value",input:u,key:a,value:l};for(let h of y.issues)h.path?h.path.unshift(f):h.path=[f],n.issues?.push(h);if(n.issues||(n.issues=y.issues),o.abortEarly){n.typed=!1;break}}y.typed||(n.typed=!1),n.value.push(y.value)}}else x(this,"type",n,o);return n}})}i(v,"array");function S(e){return I({kind:"schema",type:"boolean",reference:S,expects:"boolean",async:!1,message:e,"~run"(t,n){return typeof t.value=="boolean"?t.typed=!0:x(this,"type",t,n),t}})}i(S,"boolean");function _e(e,t){return I({kind:"schema",type:"custom",reference:_e,expects:"unknown",async:!1,check:e,message:t,"~run"(n,o){return this.check(n.value)?n.typed=!0:x(this,"type",n,o),n}})}i(_e,"custom");function Ne(e){return I({kind:"schema",type:"lazy",reference:Ne,expects:"unknown",async:!1,getter:e,"~run"(t,n){return this.getter(t.value)["~run"](t,n)}})}i(Ne,"lazy");function F(e,t){return I({kind:"schema",type:"literal",reference:F,expects:X(e),async:!1,literal:e,message:t,"~run"(n,o){return Lt(n.value,this.literal)?n.typed=!0:x(this,"type",n,o),n}})}i(F,"literal");function Fe(e,t){return I({kind:"schema",type:"loose_object",reference:Fe,expects:"Object",async:!1,entries:e,message:t,"~run"(n,o){let u=n.value;if(u&&typeof u=="object"){n.typed=!0,n.value={};for(let a in this.entries){let l=this.entries[a];if(a in u||(l.type==="exact_optional"||l.type==="optional"||l.type==="nullish")&&l.default!==void 0){let y=a in u?u[a]:me(l),f=l["~run"]({value:y},o);if(f.issues){let h={type:"object",origin:"value",input:u,key:a,value:y};for(let d of f.issues)d.path?d.path.unshift(h):d.path=[h],n.issues?.push(d);if(n.issues||(n.issues=f.issues),o.abortEarly){n.typed=!1;break}}f.typed||(n.typed=!1),n.value[a]=f.value}else if(l.fallback!==void 0)n.value[a]=Je(l);else if(l.type!=="exact_optional"&&l.type!=="optional"&&l.type!=="nullish"&&(x(this,"key",n,o,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:u,key:a,value:u[a]}]}),o.abortEarly))break}if(!n.issues||!o.abortEarly)for(let a in u)Ze(u,a)&&!Object.prototype.hasOwnProperty.call(this.entries,a)&&(n.value[a]=u[a])}else x(this,"type",n,o);return n}})}i(Fe,"looseObject");function Ue(e){return I({kind:"schema",type:"never",reference:Ue,expects:"never",async:!1,message:e,"~run"(t,n){return x(this,"type",t,n),t}})}i(Ue,"never");function C(e,t){return I({kind:"schema",type:"nullable",reference:C,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,"~run"(n,o){return n.value===null&&(this.default!==void 0&&(n.value=me(this,n,o)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,o)}})}i(C,"nullable");function U(e,t){return I({kind:"schema",type:"nullish",reference:U,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,"~run"(n,o){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=me(this,n,o)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,o)}})}i(U,"nullish");function A(e){return I({kind:"schema",type:"number",reference:A,expects:"number",async:!1,message:e,"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:x(this,"type",t,n),t}})}i(A,"number");function p(e,t){return I({kind:"schema",type:"object",reference:p,expects:"Object",async:!1,entries:e,message:t,"~run"(n,o){let u=n.value;if(u&&typeof u=="object"){n.typed=!0,n.value={};for(let a in this.entries){let l=this.entries[a];if(a in u||(l.type==="exact_optional"||l.type==="optional"||l.type==="nullish")&&l.default!==void 0){let y=a in u?u[a]:me(l),f=l["~run"]({value:y},o);if(f.issues){let h={type:"object",origin:"value",input:u,key:a,value:y};for(let d of f.issues)d.path?d.path.unshift(h):d.path=[h],n.issues?.push(d);if(n.issues||(n.issues=f.issues),o.abortEarly){n.typed=!1;break}}f.typed||(n.typed=!1),n.value[a]=f.value}else if(l.fallback!==void 0)n.value[a]=Je(l);else if(l.type!=="exact_optional"&&l.type!=="optional"&&l.type!=="nullish"&&(x(this,"key",n,o,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:u,key:a,value:u[a]}]}),o.abortEarly))break}}else x(this,"type",n,o);return n}})}i(p,"object");function s(e,t){return I({kind:"schema",type:"optional",reference:s,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(n,o){return n.value===void 0&&(this.default!==void 0&&(n.value=me(this,n,o)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,o)}})}i(s,"optional");function b(e,t){return I({kind:"schema",type:"picklist",reference:b,expects:Pe(e.map(X),"|"),async:!1,options:e,message:t,"~run"(n,o){return this.options.includes(n.value)?n.typed=!0:x(this,"type",n,o),n}})}i(b,"picklist");function E(e,t,n){return I({kind:"schema",type:"record",reference:E,expects:"Object",async:!1,key:e,value:t,message:n,"~run"(o,u){let a=o.value;if(a&&typeof a=="object"){o.typed=!0,o.value={};for(let l in a)if(Ze(a,l)){let y=a[l],f=this.key["~run"]({value:l},u);if(f.issues){let d={type:"object",origin:"key",input:a,key:l,value:y};for(let w of f.issues)w.path=[d],o.issues?.push(w);if(o.issues||(o.issues=f.issues),u.abortEarly){o.typed=!1;break}}let h=this.value["~run"]({value:y},u);if(h.issues){let d={type:"object",origin:"value",input:a,key:l,value:y};for(let w of h.issues)w.path?w.path.unshift(d):w.path=[d],o.issues?.push(w);if(o.issues||(o.issues=h.issues),u.abortEarly){o.typed=!1;break}}(!f.typed||!h.typed)&&(o.typed=!1),f.typed&&(o.value[f.value]=h.value)}}else x(this,"type",o,u);return o}})}i(E,"record");function r(e){return I({kind:"schema",type:"string",reference:r,expects:"string",async:!1,message:e,"~run"(t,n){return typeof t.value=="string"?t.typed=!0:x(this,"type",t,n),t}})}i(r,"string");function $t(e,t){return I({kind:"schema",type:"tuple",reference:$t,expects:"Array",async:!1,items:e,message:t,"~run"(n,o){let u=n.value;if(Array.isArray(u)){n.typed=!0,n.value=[];for(let a=0;a<this.items.length;a++){let l=u[a],y=this.items[a]["~run"]({value:l},o);if(y.issues){let f={type:"array",origin:"value",input:u,key:a,value:l};for(let h of y.issues)h.path?h.path.unshift(f):h.path=[f],n.issues?.push(h);if(n.issues||(n.issues=y.issues),o.abortEarly){n.typed=!1;break}}y.typed||(n.typed=!1),n.value.push(y.value)}}else x(this,"type",n,o);return n}})}i($t,"tuple");function Xe(e){let t;if(e)for(let n of e)if(t)for(let o of n.issues)t.push(o);else t=n.issues;return t}i(Xe,"_subIssues");function J(e,t){return I({kind:"schema",type:"union",reference:J,expects:Pe(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,"~run"(n,o){let u,a,l;for(let y of this.options){let f=y["~run"]({value:n.value},o);if(f.typed)if(f.issues)a?a.push(f):a=[f];else{u=f;break}else l?l.push(f):l=[f]}if(u)return u;if(a){if(a.length===1)return a[0];x(this,"type",n,o,{issues:Xe(a)}),n.typed=!0}else{if(l?.length===1)return l[0];x(this,"type",n,o,{issues:Xe(l)})}return n}})}i(J,"union");function P(){return I({kind:"schema",type:"unknown",reference:P,expects:"unknown",async:!1,"~run"(e){return e.typed=!0,e}})}i(P,"unknown");function ge(e,t,n){return I({kind:"schema",type:"variant",reference:ge,expects:"Object",async:!1,key:e,options:t,message:n,"~run"(o,u){let a=o.value;if(a&&typeof a=="object"){let l,y=0,f=this.key,h=[],d=i((w,D)=>{for(let G of w.options){if(G.type==="variant")d(G,new Set(D).add(G.key));else{let he=!0,te=0;for(let k of D){let R=G.entries[k];if(k in a?R["~run"]({typed:!1,value:a[k]},Vt).issues:R.type!=="exact_optional"&&R.type!=="optional"&&R.type!=="nullish"){he=!1,f!==k&&(y<te||y===te&&k in a&&!(f in a))&&(y=te,f=k,h=[]),f===k&&h.push(G.entries[k].expects);break}te++}if(he){let k=G["~run"]({value:a},u);(!l||!l.typed&&k.typed)&&(l=k)}}if(l&&!l.issues)break}},"parseOptions");if(d(this,new Set([this.key])),l)return l;x(this,"type",o,u,{input:a[f],expected:Pe(h,"|"),path:[{type:"object",origin:"value",input:a,key:f,value:a[f]}]})}else x(this,"type",o,u);return o}})}i(ge,"variant");function Qe(e,t,n){let o=e["~run"]({value:t},Oe(n));if(o.issues)throw new xe(o.issues);return o.value}i(Qe,"parse");function c(...e){return I({...e[0],pipe:e,"~run"(t,n){for(let o of e)if(o.kind!=="metadata"){if(t.issues&&(o.kind==="schema"||o.kind==="transformation")){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=o["~run"](t,n))}return t}})}i(c,"pipe");function W(e,t,n){let o=e["~run"]({value:t},Oe(n));return{typed:o.typed,success:!o.issues,output:o.value,issues:o.issues}}i(W,"safeParse");var et=p({role:b([be.USER,be.ASSISTANT,be.SYSTEM]),content:c(r(),m(1)),id:s(r()),createdAt:s(r())}),Me=Ne(()=>p({type:b(["string","number","boolean","array","object"]),description:s(r()),enum:s(v(r())),items:s(Me),properties:s(E(r(),Me)),required:s(v(r()))})),Gt=p({description:c(r(),m(1)),parameters:p({type:F("object"),properties:E(r(),Me),required:s(v(r()))})}),Ht=p({id:r(),name:r(),args:E(r(),P())}),Wt=p({messages:c(v(et),m(1)),provider:s(b([q.ANTHROPIC,q.OPENAI,q.GOOGLE])),model:s(r()),maxTokens:s(c(A(),ne(),_(1))),temperature:s(c(A(),_(0),B(2))),systemPrompt:s(r()),stream:s(S()),tools:s(E(r(),Gt))}),Kt=p({promptTokens:A(),completionTokens:A(),totalTokens:A()}),ar=p({message:et,usage:s(Kt),finishReason:s(r()),toolCalls:s(v(Ht))}),ur=p({provider:b([q.ANTHROPIC,q.OPENAI,q.GOOGLE]),model:s(r()),maxTokens:s(c(A(),ne(),_(1))),temperature:s(c(A(),_(0),B(2))),systemPrompt:s(r())});function lr(e){return W(Wt,e)}i(lr,"validateAIChatRequest");var K={GUEST:"guest",USER:"user",ADMIN:"admin",SUPER:"super"};var tt={FREE:"free",PRO:"pro",PREMIUM:"premium"};var nt={BASIC_ACCESS:"basic_access",ADVANCED_FEATURES:"advanced_features",API_ACCESS:"api_access",PRIORITY_SUPPORT:"priority_support"};var rt={READ_PUBLIC:"read_public",READ_OWN_DATA:"read_own_data",WRITE_OWN_DATA:"write_own_data",READ_ALL_DATA:"read_all_data",MANAGE_USERS:"manage_users"};var ye={ACTIVE:"active",CANCELED:"canceled",INCOMPLETE:"incomplete",INCOMPLETE_EXPIRED:"incomplete_expired",PAST_DUE:"past_due",TRIALING:"trialing",UNPAID:"unpaid"};var Le={PAYMENT:"payment",SUBSCRIPTION:"subscription"};var vr={tier:"free",subscriptionId:null,customerId:"",status:"active",subscriptionEnd:null,cancelAtPeriodEnd:!1,updatedAt:new Date().toISOString(),isDefault:!0};function $(e){let[t,...n]=Object.values(e);if(t===void 0)throw new Error("picklistOptions: constant map has no values");return[t,...n]}i($,"picklistOptions");var it=100,zt=p({productId:c(r(),m(1),V(200)),quantity:c(A(),ne(),_(1),B(1e4))}),Tr=c(p({billingConfigKey:s(c(r(),m(1))),lineItems:s(c(v(zt),m(1,"At least one line item is required"),V(it,`At most ${it} line items`))),successUrl:c(r(),N()),cancelUrl:c(r(),N()),customerEmail:s(c(r(),L())),metadata:s(E(r(),r())),allowPromotionCodes:s(S()),userId:s(r()),productId:s(r()),priceId:s(r()),currency:s(c(r(),re(3,"Currency must be 3-letter ISO code"))),userEmail:s(c(r(),L())),mode:s(b([Le.PAYMENT,Le.SUBSCRIPTION]))}),De(({dataset:e,addIssue:t,NEVER:n})=>{let o=e.value,u=o.billingConfigKey||o.metadata?.billingConfigKey;return u?{...o,billingConfigKey:u,lineItems:o.lineItems??[{productId:u,quantity:1}]}:(t({message:"billingConfigKey is required"}),n)})),Rr=p({sessionId:r(),sessionUrl:C(c(r(),N()))}),Ir=p({userId:r(),tier:r(),status:b($(ye)),subscriptionId:C(r()),customerId:r(),subscriptionEnd:C(c(r(),j())),cancelAtPeriodEnd:S(),updatedAt:c(r(),j())}),Cr=p({tier:r(),subscriptionId:C(r()),customerId:r(),status:b($(ye)),subscriptionEnd:C(c(r(),j())),cancelAtPeriodEnd:S(),updatedAt:c(r(),j()),isDefault:s(S())}),wr=p({id:r(),type:r(),data:p({object:Z()}),created:c(r(),j())}),Or=Fe({userId:s(r()),firebaseUid:s(r()),productType:s(r())});var Yt=p({type:F("StripePayment"),name:c(r(),m(1,"Product name is required")),description:s(r()),price:r(),currency:s(c(r(),re(3,"Currency must be 3-letter ISO code")),"EUR"),priceId:s(c(r(),m(1,"Stripe price ID is required"))),tier:c(r(),m(1,"Tier is required")),duration:c(r(),m(1,"Duration is required")),allowPromotionCodes:s(S()),metadata:s(E(r(),r()))}),Xt=p({type:F("StripeSubscription"),name:c(r(),m(1,"Product name is required")),description:s(r()),price:r(),currency:s(c(r(),re(3,"Currency must be 3-letter ISO code")),"EUR"),priceId:c(r(),m(1,"Stripe price ID is required")),tier:c(r(),m(1,"Tier is required")),duration:b(["1month","3months","6months","1year","2years","lifetime"]),allowPromotionCodes:s(S()),metadata:s(E(r(),r()))}),Zt=ge("type",[Yt,Xt]),Pr=E(r(),Zt),Dr=E(r(),p({name:r(),price:r(),currency:r(),description:s(r()),features:s(v(r())),priceId:s(r()),allowPromotionCodes:s(S())})),ot={name:r(),price:A(),currency:r(),priceId:s(r()),tier:r(),duration:r(),description:s(r()),metadata:s(E(r(),r())),allowPromotionCodes:s(S())},Jt=ge("mode",[p({mode:F("manual"),taxRateIds:c(v(c(r(),m(1))),m(1))}),p({mode:F("automatic")})]),st=5,Qt=p({allowedCountries:c(v(c(r(),ie(/^[A-Z]{2}$/,"allowedCountries: uppercase ISO 3166-1 alpha-2 code expected (e.g. FR)"))),m(1)),shippingRateIds:s(c(v(c(r(),m(1))),V(st,`shippingRateIds: at most ${st} (Stripe limit)`)))}),en=p({type:F("StripeOrder"),name:r(),currency:c(r(),re(3)),description:s(r()),metadata:s(E(r(),r())),allowPromotionCodes:s(S()),tax:Jt,taxIdCollection:b(["disabled","optional","required"]),billingAddressCollection:b(["auto","required"]),shipping:s(Qt),customerCreation:b(["always","if_required"]),invoiceCreation:S(),paymentMethodConfiguration:s(c(r(),m(1)))}),tn=E(r(),ge("type",[p({type:F("StripePayment"),...ot}),p({type:F("StripeSubscription"),...ot}),en]));function _r(e){return Qe(tn,e)}i(_r,"validateStripeBackConfig");var $r=p({id:r(),email:s(C(c(r(),L()))),displayName:s(C(r())),photoURL:s(C(c(r(),N()))),emailVerified:s(S()),lastLoginAt:s(r()),providerData:s(v(p({providerId:r(),uid:r(),email:s(C(c(r(),L()))),displayName:s(C(r())),photoURL:s(C(c(r(),N()))),phoneNumber:s(C(r()))}))),role:s(b($(K))),customClaims:s(E(r(),Z()))}),nn=p({userId:r(),tier:b($(tt)),status:b($(ye)),isActive:s(S()),features:s(v(r())),subscriptionId:C(r()),customerId:r(),subscriptionEnd:C(c(r(),j())),cancelAtPeriodEnd:S(),updatedAt:c(r(),j())}),Gr=p({role:s(b($(K))),subscription:s(nn),features:s(v(b($(nt)))),permissions:s(v(b($(rt)))),githubAccess:s(p({username:s(r()),teamAccess:s(v(r())),repoAccess:s(v(r()))}))});var Be={TRUE:!0,FALSE:!1,USER:"user",ADMIN:"admin",SUPER:"super",CREATE_ONLY:"create-only",GENERATED:"generated",COMPUTED:"computed"};var Q={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">=",IN:"in",NOT_IN:"not-in",ARRAY_CONTAINS:"array-contains",ARRAY_CONTAINS_ANY:"array-contains-any"};var ri={EQ:Q.EQ,NEQ:Q.NEQ,LT:Q.LT,LTE:Q.LTE,GT:Q.GT,GTE:Q.GTE};var at=class extends Error{static{i(this,"BulkCollisionError")}collidingIds;where;constructor(t,n){super(`BulkCollisionError: ${t.length} id(s) appear in both "${n.replace("-",'" and "')}" \u2014 ${t.join(", ")}`),this.name="BulkCollisionError",this.collidingIds=t,this.where=n}};var pi=p({collection:c(r(),m(1,"Collection name is required")),data:E(r(),P()),idempotencyKey:s(r())}),di=p({collection:c(r(),m(1,"Collection name is required")),id:c(r(),m(1,"Entity ID is required"))}),fi=p({collection:c(r(),m(1,"Collection name is required")),id:c(r(),m(1,"Entity ID is required")),data:E(r(),P()),merge:s(S(),!1)}),mi=p({collection:c(r(),m(1,"Collection name is required")),id:c(r(),m(1,"Entity ID is required"))}),gi=p({collection:c(r(),m(1,"Collection name is required")),limit:s(c(A(),_(1),B(1e3)),1e3),offset:s(c(A(),_(0)),0),orderBy:s(r()),orderDirection:s(b(["asc","desc"]),"desc"),where:s(v(p({field:r(),operator:b(["==","!=","<","<=",">",">=","array-contains","in","not-in"]),value:P()})))});var on=p({templateId:c(r(),m(1)),to:c(r(),L()),data:E(r(),P()),locale:s(c(r(),m(2),V(5)),"fr"),from:s(r()),replyTo:s(r())}),Ii=p({success:S(),messageId:s(r()),error:s(r())});function Ci(e){return W(on,e)}i(Ci,"validateSendEmailRequest");var ut=["pull","push","admin","maintain","triage"];var qe=p({owner:c(r(),m(1,"Repository owner is required")),repo:c(r(),m(1,"Repository name is required"))}),sn=b([...ut]),mo=p({userId:c(r(),m(1,"User ID is required")),githubUsername:c(r(),m(1,"GitHub username is required")),repoConfig:qe,permission:s(sn,"push"),customClaims:s(E(r(),Z()))}),go=p({userId:c(r(),m(1,"User ID is required")),githubUsername:c(r(),m(1,"GitHub username is required")),repoConfig:qe}),yo=p({userId:c(r(),m(1,"User ID is required")),githubUsername:c(r(),m(1,"GitHub username is required")),repoConfig:qe}),ho=p({provider:r(),purpose:b(["authentication","api-access"]),code:c(r(),m(1,"Authorization code is required")),redirectUri:c(r(),N("Valid redirect URI is required")),codeVerifier:s(r()),state:s(r()),instance:s(c(r(),N()))}),vo=p({provider:r(),refreshToken:c(r(),m(1,"Refresh token is required")),redirectUri:c(r(),N("Valid redirect URI is required"))}),bo=p({provider:r()}),Eo=p({userId:c(r(),m(1,"User ID is required"))});var lt=p({name:r(),color:r(),icon:r(),customParameters:s(E(r(),r())),button:p({backgroundColor:r(),textColor:r(),borderColor:r(),hoverBackgroundColor:r(),focusOutlineColor:r(),fontWeight:s(r(),"500"),textKey:s(r())})}),an=p({...lt.entries,type:b(["auth","both"]),scopes:s(v(r())),firebaseProviderId:s(r())}),Se=J([F(""),c(r(),N())]),un=p({authUrl:Se,tokenUrl:Se,profileUrl:Se,revokeUrl:s(Se)}),ln=p({authentication:s(v(r())),"api-access":v(r())}),cn=s(p({pkce:s(S(),!1),codeChallengeMethod:s(b(["S256","plain"]),"S256")})),pn=p({...lt.entries,type:b(["oauth","both"]),scopes:ln,endpoints:un,capabilities:cn});var Io={google:{name:"Google",color:"#4285F4",icon:"google",type:"both",scopes:{authentication:["openid","profile","email"],"api-access":["https://www.googleapis.com/auth/drive.readonly","https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/calendar.readonly","https://www.googleapis.com/auth/gmail.readonly"]},endpoints:{authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",profileUrl:"https://www.googleapis.com/oauth2/v3/userinfo",revokeUrl:"https://oauth2.googleapis.com/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},github:{name:"GitHub",color:"#24292E",icon:"github",type:"both",scopes:{authentication:["read:user","user:email"],"api-access":["repo","user","read:org","gist","notifications"]},endpoints:{authUrl:"https://github.com/login/oauth/authorize",tokenUrl:"https://github.com/login/oauth/access_token",profileUrl:"https://api.github.com/user",revokeUrl:"https://api.github.com/applications/CLIENT_ID/token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},discord:{name:"Discord",color:"#5865F2",icon:"discord",type:"both",scopes:{authentication:["identify","email"],"api-access":["guilds","guilds.members.read","bot","messages.read"]},endpoints:{authUrl:"https://discord.com/api/oauth2/authorize",tokenUrl:"https://discord.com/api/oauth2/token",profileUrl:"https://discord.com/api/users/@me",revokeUrl:"https://discord.com/api/oauth2/token/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},spotify:{name:"Spotify",color:"#1DB954",icon:"spotify",type:"both",scopes:{authentication:["user-read-email","user-read-private"],"api-access":["user-read-playback-state","user-modify-playback-state","user-read-currently-playing","playlist-read-private","playlist-modify-public","user-library-read"]},endpoints:{authUrl:"https://accounts.spotify.com/authorize",tokenUrl:"https://accounts.spotify.com/api/token",profileUrl:"https://api.spotify.com/v1/me",revokeUrl:"https://accounts.spotify.com/api/token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},twitch:{name:"Twitch",color:"#9146FF",icon:"twitch",type:"both",scopes:{authentication:["user:read:email"],"api-access":["channel:read:subscriptions","bits:read","channel:manage:broadcast","channel:read:stream_key","user:read:follows"]},endpoints:{authUrl:"https://id.twitch.tv/oauth2/authorize",tokenUrl:"https://id.twitch.tv/oauth2/token",profileUrl:"https://api.twitch.tv/helix/users",revokeUrl:"https://id.twitch.tv/oauth2/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},reddit:{name:"Reddit",color:"#FF4500",icon:"reddit",type:"both",scopes:{authentication:["identity"],"api-access":["read","submit","vote","mysubreddits","subscribe"]},endpoints:{authUrl:"https://www.reddit.com/api/v1/authorize",tokenUrl:"https://www.reddit.com/api/v1/access_token",profileUrl:"https://oauth.reddit.com/api/v1/me",revokeUrl:"https://www.reddit.com/api/v1/revoke_token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},linkedin:{name:"LinkedIn",color:"#0077B5",icon:"linkedin",type:"oauth",scopes:{"api-access":["r_liteprofile","r_emailaddress","w_member_social","r_organization_social"]},endpoints:{authUrl:"https://www.linkedin.com/oauth/v2/authorization",tokenUrl:"https://www.linkedin.com/oauth/v2/accessToken",profileUrl:"https://api.linkedin.com/v2/me",revokeUrl:"https://www.linkedin.com/oauth/v2/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},slack:{name:"Slack",color:"#E01E5A",icon:"slack",type:"oauth",scopes:{"api-access":["channels:read","chat:write","users:read","files:read","im:read"]},endpoints:{authUrl:"https://slack.com/oauth/v2/authorize",tokenUrl:"https://slack.com/api/oauth.v2.access",profileUrl:"https://slack.com/api/users.identity",revokeUrl:"https://slack.com/api/auth.revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},notion:{name:"Notion",color:"#000000",icon:"notion",type:"oauth",scopes:{"api-access":["read","write"]},endpoints:{authUrl:"https://api.notion.com/v1/oauth/authorize",tokenUrl:"https://api.notion.com/v1/oauth/token",profileUrl:"https://api.notion.com/v1/users/me",revokeUrl:"https://api.notion.com/v1/oauth/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},medium:{name:"Medium",color:"#000000",icon:"medium",type:"oauth",scopes:{"api-access":["basicProfile","publishPost","listPublications"]},endpoints:{authUrl:"https://medium.com/m/oauth/authorize",tokenUrl:"https://medium.com/v1/tokens",profileUrl:"https://medium.com/v1/me",revokeUrl:"https://medium.com/v1/tokens/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},twitter:{name:"X",color:"#000000",icon:"twitter",type:"oauth",scopes:{"api-access":["tweet.read","users.read","follows.read","tweet.write","like.write"]},endpoints:{authUrl:"https://twitter.com/i/oauth2/authorize",tokenUrl:"https://api.twitter.com/2/oauth2/token",profileUrl:"https://api.twitter.com/2/users/me",revokeUrl:"https://api.twitter.com/2/oauth2/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},mastodon:{name:"Mastodon",color:"#6364FF",icon:"mastodon",type:"oauth",scopes:{"api-access":["read","write","follow","push"]},endpoints:{authUrl:"",tokenUrl:"",profileUrl:"",revokeUrl:""},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},youtube:{name:"YouTube",color:"#FF0000",icon:"youtube",type:"oauth",scopes:{"api-access":["https://www.googleapis.com/auth/youtube.readonly","https://www.googleapis.com/auth/youtube.upload","https://www.googleapis.com/auth/youtube.force-ssl"]},endpoints:{authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",profileUrl:"https://www.googleapis.com/youtube/v3/channels",revokeUrl:"https://oauth2.googleapis.com/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},supabase:{name:"Supabase",color:"#3ECF8E",icon:"supabase",type:"oauth",scopes:{"api-access":["auth:read","auth:write","database:read","database:write","domains:read","domains:write","edge_functions:read","edge_functions:write","environment:read","environment:write","organizations:read","projects:read","projects:write","rest:read","rest:write","secrets:read","secrets:write","storage:read"]},endpoints:{authUrl:"https://api.supabase.com/v1/oauth/authorize",tokenUrl:"https://api.supabase.com/v1/oauth/token",profileUrl:"",revokeUrl:""},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#F1F3F5",textColor:"#11181C",borderColor:"#E6E8EB",hoverBackgroundColor:"#E6E8EB",focusOutlineColor:"#3ECF8E",fontWeight:"500"}},vercel:{name:"Vercel",color:"#000000",icon:"vercel",type:"oauth",scopes:{authentication:["openid","email","profile","offline_access"],"api-access":["project","project-env-vars","deployment","team","user"]},endpoints:{authUrl:"https://vercel.com/oauth/authorize",tokenUrl:"https://api.vercel.com/login/oauth/token",profileUrl:"https://api.vercel.com/login/oauth/userinfo",revokeUrl:"https://api.vercel.com/login/oauth/token/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}}},Co=E(r(),an),wo=E(r(),pn);var ct={NECESSARY:"necessary",FUNCTIONAL:"functional",ANALYTICS:"analytics",MARKETING:"marketing"};var qo={auth:{requiresConsent:null},oauth:{requiresConsent:null},billing:{requiresConsent:null},analytics:{requiresConsent:ct.ANALYTICS},marketing:{requiresConsent:ct.MARKETING}};function pt(e){return e instanceof Error&&"source"in e&&typeof e.source=="string"?e.source:typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("auth/")?"auth":typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("oauth/")?"oauth":typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&["permission-denied","unavailable","not-found","already-exists","unauthenticated","invalid-argument","failed-precondition","resource-exhausted"].includes(e.code)?"firebase":typeof e=="object"&&e!==null&&"issues"in e&&Array.isArray(e.issues)&&"name"in e&&e.name==="ValiError"?"validation":e instanceof Error&&e.name==="EntityHookError"?"entity":typeof e=="object"&&e!==null&&("response"in e||"status"in e||"statusText"in e)?"api":typeof e=="object"&&e!==null&&"componentStack"in e?"ui":"unknown"}i(pt,"detectErrorSource");function H(e){return(t,n)=>{if(t instanceof O)return t;if(typeof t!="object"||t===null){let y=typeof t=="string"?t:e.defaultErrorMessage;return new O(n||y,e.defaultErrorCode,{details:{originalError:t},source:e.errorSource})}let o;e.extractErrorCode?o=e.extractErrorCode(t):"code"in t&&typeof t.code=="string"&&(o=t.code);let u=e.defaultErrorCode;o&&e.errorCodeMapping&&o in e.errorCodeMapping&&(u=e.errorCodeMapping[o]);let a;e.extractErrorMessage?a=e.extractErrorMessage(t):("message"in t&&typeof t.message=="string"||t instanceof Error)&&(a=t.message),o&&e.friendlyMessageMapping&&o in e.friendlyMessageMapping&&(a=e.friendlyMessageMapping[o]),a||(a=e.defaultErrorMessage);let l;return e.processMetadata?l=e.processMetadata(t):(l={originalError:t},o&&(l.originalCode=o)),"originalError"in l||(l.originalError=t),new O(n||a,u,{details:l,source:e.errorSource})}}i(H,"createErrorHandler");var ke={"permission-denied":"permission-denied",unavailable:"unavailable","not-found":"not-found","already-exists":"already-exists",unauthenticated:"unauthenticated","invalid-argument":"invalid-argument","failed-precondition":"invalid-argument","resource-exhausted":"rate-limit-exceeded","deadline-exceeded":"timeout",cancelled:"cancelled","not-implemented":"unimplemented"};var oe={"already-exists":"The resource already exists.",cancelled:"The operation was cancelled.","deadline-exceeded":"The operation timed out.",DELETE_ACCOUNT_REQUIRES_SERVER:"Account deletion requires a server endpoint. Configure a callable provider or deploy a delete-account Edge Function.",internal:"An internal error occurred.","invalid-argument":"Invalid argument provided.","not-found":"The requested resource was not found.","permission-denied":"You do not have permission to perform this action.","rate-limit-exceeded":"Too many requests. Please try again later.",timeout:"The operation timed out.",unauthenticated:"Authentication is required for this action.",unavailable:"The service is currently unavailable.",unimplemented:"This feature is not implemented.",unknown:"An unknown error occurred.","validation-failed":"Validation failed."},dn={400:"invalid-argument",401:"unauthenticated",403:"permission-denied",404:"not-found",409:"already-exists",422:"validation-failed",429:"rate-limit-exceeded",500:"internal",501:"unimplemented",502:"unavailable",503:"unavailable",504:"timeout"},je={INTERNAL_ERROR:"internal",VALIDATION_ERROR:"validation-failed",PERMISSION_DENIED:"permission-denied",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",NETWORK_ERROR:"unavailable"};function fn(e){return e in je}i(fn,"isEntityHookErrorType");var z={auth:{errorSource:"auth",defaultErrorCode:"unknown",defaultErrorMessage:"An authentication error occurred",errorCodeMapping:{"auth/user-not-found":"not-found","auth/wrong-password":"invalid-argument","auth/email-already-in-use":"already-exists","auth/weak-password":"validation-failed","auth/invalid-email":"validation-failed","auth/account-exists-with-different-credential":"already-exists","auth/credential-already-in-use":"already-exists","auth/requires-recent-login":"unauthenticated","auth/user-disabled":"permission-denied","auth/too-many-requests":"rate-limit-exceeded","auth/network-request-failed":"unavailable","auth/popup-blocked":"unavailable","auth/popup-closed-by-user":"invalid-argument","auth/cancelled-popup-request":"invalid-argument","auth/operation-not-allowed":"unimplemented","auth/invalid-credential":"invalid-argument","auth/invalid-verification-code":"invalid-argument","auth/captcha-check-failed":"validation-failed","auth/invalid-phone-number":"validation-failed","auth/missing-phone-number":"invalid-argument","auth/quota-exceeded":"rate-limit-exceeded","auth/timeout":"unavailable","auth/web-storage-unsupported":"unavailable","auth/unauthorized-domain":"permission-denied","auth/internal-error":"internal","auth/invalid-action-code":"invalid-argument","auth/invalid-continue-uri":"invalid-argument","auth/missing-continue-uri":"invalid-argument","auth/missing-ios-bundle-id":"invalid-argument","auth/missing-android-pkg-name":"invalid-argument","auth/unauthorized-continue-uri":"permission-denied","auth/invalid-dynamic-link-domain":"invalid-argument","auth/invalid-tenant-id":"invalid-argument","auth/tenant-id-mismatch":"invalid-argument","auth/provider-already-linked":"already-exists","auth/invalid-persistence-type":"invalid-argument","auth/unsupported-persistence-type":"unimplemented","auth/invalid-provider":"invalid-argument","auth/invalid-client-id":"invalid-argument","oauth/unauthorized-app":"permission-denied","auth/provider-not-enabled":"unimplemented","auth/unknown-provider":"invalid-argument","auth/missing-provider":"invalid-argument","auth/no-user-signed-in":"unauthenticated",DELETE_ACCOUNT_REQUIRES_SERVER:"DELETE_ACCOUNT_REQUIRES_SERVER",...ke},friendlyMessageMapping:{"auth/user-not-found":"No account found with this email address.","auth/wrong-password":"Incorrect password. Please try again.","auth/email-already-in-use":"An account with this email already exists.","auth/weak-password":"Password is too weak. It should be at least 6 characters.","auth/invalid-email":"Please enter a valid email address.","auth/account-exists-with-different-credential":"An account already exists with the same email but different sign-in method.","auth/credential-already-in-use":"This credential is already associated with a different user account.","auth/requires-recent-login":"This operation requires you to sign in again for security reasons.","auth/user-disabled":"This account has been disabled.","auth/too-many-requests":"Too many sign-in attempts. Please try again later.","auth/network-request-failed":"Network connection error. Please check your internet connection.","auth/popup-blocked":"Sign-in popup was blocked. Please allow popups for this site.","auth/popup-closed-by-user":"Sign-in popup was closed before completion.","auth/operation-not-allowed":"This sign-in method is not enabled for this project.","auth/internal-error":"An internal authentication error occurred. Please try again.","auth/invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","auth/invalid-continue-uri":"The continue URL provided is invalid.","auth/missing-continue-uri":"A continue URL must be provided in the request.","auth/missing-ios-bundle-id":"An iOS Bundle ID must be provided in the request.","auth/missing-android-pkg-name":"An Android package name must be provided in the request.","auth/unauthorized-continue-uri":"The domain of the continue URL is not allowlisted.","auth/invalid-dynamic-link-domain":"The provided dynamic link domain is not authorized.","auth/invalid-tenant-id":"The provided tenant ID is invalid.","auth/tenant-id-mismatch":"The tenant ID of the provider does not match the tenant ID of the current user.","auth/provider-already-linked":"This authentication provider is already linked to the account.","auth/invalid-persistence-type":"The specified persistence type is invalid.","auth/unsupported-persistence-type":"The current environment does not support the specified persistence type.","auth/invalid-provider":"The specified authentication provider is invalid.","auth/invalid-client-id":"The authentication client ID provided is invalid.","oauth/unauthorized-app":"This application is not authorized to use OAuth with the provided client ID.","auth/provider-not-enabled":"This authentication provider is not enabled.","auth/unknown-provider":"Unknown authentication provider.","auth/missing-provider":"No authentication provider specified in the request.","auth/no-user-signed-in":"No user is currently signed in."}},oauth:{errorSource:"oauth",defaultErrorCode:"unknown",defaultErrorMessage:"An OAuth error occurred",errorCodeMapping:{"oauth/invalid-request":"invalid-argument","oauth/invalid-client":"invalid-argument","oauth/invalid-grant":"invalid-argument","oauth/unauthorized-client":"permission-denied","oauth/unsupported-grant-type":"unimplemented","oauth/invalid-scope":"invalid-argument","oauth/insufficient-scope":"permission-denied","oauth/invalid-token":"unauthenticated","oauth/expired-token":"unauthenticated","oauth/redirect-uri-mismatch":"invalid-argument","oauth/access-denied":"permission-denied","oauth/server-error":"unavailable","oauth/temporarily-unavailable":"unavailable","oauth/state-mismatch":"invalid-argument","oauth/invalid-callback":"invalid-argument","oauth/client-secret-mismatch":"permission-denied","oauth/unauthorized-scope":"permission-denied","oauth/rate-limit-exceeded":"rate-limit-exceeded","oauth/token-expired":"unauthenticated","oauth/missing-token":"invalid-argument","oauth/invalid-code":"invalid-argument","oauth/invalid-redirect":"invalid-argument","oauth/provider-error":"unavailable","oauth/invalid-response":"unavailable","oauth/unauthorized-access":"permission-denied",...ke},friendlyMessageMapping:{"oauth/invalid-request":"The OAuth request was invalid or missing parameters.","oauth/invalid-client":"Client authentication failed.","oauth/invalid-grant":"The provided authorization grant is invalid.","oauth/unauthorized-client":"The client is not authorized to use this grant type.","oauth/unsupported-grant-type":"The requested grant type is not supported.","oauth/invalid-scope":"The requested scope is invalid or unknown.","oauth/insufficient-scope":"The token does not have the required scope for this resource.","oauth/invalid-token":"The access token is invalid.","oauth/expired-token":"The access token has expired.","oauth/redirect-uri-mismatch":"The redirect URI does not match the registered URI.","oauth/access-denied":"The resource owner denied the request.","oauth/server-error":"The authorization server encountered an unexpected error.","oauth/temporarily-unavailable":"The authorization server is temporarily unavailable.","oauth/state-mismatch":"Invalid state parameter. This could be a security issue.","oauth/invalid-callback":"The callback URL is invalid or not registered.","oauth/client-secret-mismatch":"The client secret does not match the registered secret.","oauth/unauthorized-scope":"The requested scope is not authorized for this client.","oauth/rate-limit-exceeded":"Too many requests. Please try again later.","oauth/token-expired":"The OAuth token has expired and needs to be refreshed.","oauth/missing-token":"No OAuth token was provided in the request.","oauth/invalid-code":"The authorization code is invalid or expired.","oauth/invalid-redirect":"The redirect URL is invalid or does not match the registered redirect URL.","oauth/provider-error":"The OAuth provider returned an error.","oauth/invalid-response":"The response from the OAuth provider was invalid.","oauth/unauthorized-access":"Unauthorized access to OAuth resources."}},api:{errorSource:"api",defaultErrorCode:"unknown",defaultErrorMessage:"API request failed",errorCodeMapping:Object.fromEntries(Object.entries(dn).map(([e,t])=>[e,t])),friendlyMessageMapping:{},extractErrorCode:i(e=>{if(typeof e!="object"||e===null)return;let t;return"response"in e&&e.response&&"status"in e.response?t=e.response.status:"status"in e&&typeof e.status=="number"&&(t=e.status),t?.toString()},"extractErrorCode"),processMetadata:i(e=>{let t={originalError:e};if(typeof e!="object"||e===null)return t;if("response"in e&&e.response){let n=e.response;"status"in n&&(t.statusCode=n.status),"data"in n&&(t.responseData=n.data)}else"status"in e&&(t.statusCode=e.status);return t},"processMetadata")},firebase:{errorSource:"firebase",defaultErrorCode:"unknown",defaultErrorMessage:"A Firebase error occurred",errorCodeMapping:ke,friendlyMessageMapping:{}},ui:{errorSource:"ui",defaultErrorCode:"internal",defaultErrorMessage:oe.internal,errorCodeMapping:{},friendlyMessageMapping:{},processMetadata:i(e=>{let t={originalError:e};return typeof e=="object"&&e!==null&&"componentStack"in e&&(t.componentStack=e.componentStack),t},"processMetadata")},validation:{errorSource:"validation",defaultErrorCode:"validation-failed",defaultErrorMessage:oe["validation-failed"],errorCodeMapping:{},friendlyMessageMapping:{}},entity:{errorSource:"entity",defaultErrorCode:"unknown",defaultErrorMessage:"An entity operation error occurred",errorCodeMapping:{},friendlyMessageMapping:{}},unknown:{errorSource:"unknown",defaultErrorCode:"unknown",defaultErrorMessage:oe.unknown,errorCodeMapping:{TypeError:"invalid-argument",ReferenceError:"internal",RangeError:"invalid-argument"},friendlyMessageMapping:{},extractErrorCode:i(e=>{if(e instanceof Error)return e.name},"extractErrorCode")}},mn=i(e=>e instanceof xe?new O(oe["validation-failed"],"validation-failed",{details:{validationErrors:e.issues.map(t=>({path:t.path.join("."),message:t.message})),originalError:e},source:"validation"}):H(z.validation)(e),"handleValidationError"),gn=i(e=>{if(e instanceof Error&&"type"in e&&typeof e.type=="string"&&fn(e.type)){let t=je[e.type]||"unknown";return new O(e.message||oe[t],t,{details:{originalError:e},source:"entity"})}if(typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&we[e.code]){let t=we[e.code];if(t){let n=je[t.type]||"unknown";return new O(t.message||oe[n],n,{details:{originalCode:e.code,originalError:e},source:"entity"})}}return H(z.entity)(e)},"handleEntityError"),dt={auth:H(z.auth),oauth:H(z.oauth),api:H(z.api),firebase:H(z.firebase),ui:H(z.ui),validation:mn,entity:gn,unknown:H(z.unknown)};function Ae(e,t,n){return e instanceof O?e:(dt[t]||dt.unknown)(e,n)}i(Ae,"mapToDoNotDevError");function ft(e,t,n={}){let o=globalThis.Sentry;o&&o.withScope(u=>{u.setTag("errorSource",t),u.setTag("errorCode",e.code),e.details&&Object.entries(e.details).forEach(([a,l])=>{if(typeof l!="function"&&a!=="originalError")try{u.setExtra(a,l)}catch{u.setExtra(a,`[${typeof l}]`)}}),Object.entries(n).forEach(([a,l])=>{if(typeof l!="function")try{u.setExtra(`context.${a}`,l)}catch{u.setExtra(`context.${a}`,`[${typeof l}]`)}}),(e.details?.userId||n.userId)&&u.setUser({id:e.details?.userId||n.userId,email:e.details?.userEmail||n.userEmail}),o.captureException(e)})}i(ft,"captureErrorToSentry");function yn(){return typeof import.meta<"u"&&import.meta.env&&(import.meta.env.DEV===!0||import.meta.env.MODE&&import.meta.env.MODE!=="production")?!0:typeof process<"u"&&process.env?"production".toLowerCase()!=="production":!1}i(yn,"isDev");function Te(e,t){let n=typeof t=="string"?{userMessage:t}:t||{},{userMessage:o,context:u={},log:a=!0,reportToSentry:l=!0,showNotification:y=!1,severity:f="error"}=n,h=pt(e),d=e instanceof O?e:Ae(e,h,o);if(o&&!d.userMessageProvided&&(d.message.includes("Error")||d.message.includes("Failed")||d.message.length<10?d=new O(o,d.code,{details:{...d.details,originalMessage:d.message},source:h,userMessageProvided:!0}):d=new O(d.message,d.code,{details:{...d.details,userMessage:o},source:h,userMessageProvided:!0})),a){let w=yn()||typeof window<"u"&&window.__DNDEV_DEBUG,D={code:d.code,message:d.message,source:h};switch(f){case"warning":console.warn(`[DoNotDev] ${d.code}: ${d.message}`,w?{...D,details:d.details}:D);break;case"info":console.info(`[DoNotDev] ${d.code}: ${d.message}`,w?{...D,details:d.details}:D);break;case"success":console.log(`[DoNotDev] ${d.code}: ${d.message}`,w?{...D,details:d.details}:D);break;default:console.error(`[DoNotDev] ${d.code}: ${d.message}`,w?{...D,details:d.details,stack:d.stack}:D)}}return l&&ft(d,h,u),y&&typeof window<"u"&&console.warn("[handleError] showNotification requires client-side toast setup"),d}i(Te,"handleError");function Gs(e,t,n,o){let u=o?` ${JSON.stringify(o)}`:"",a=`${t}.${n}(${u})`,l=Ae(e,"auth",`${a}: ${hn(e)}`);return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&l.code==="unknown"&&e.code!=="unknown"?new O(l.message,l.code,{details:{...l.details,originalCode:e.code},source:l.source}):l}i(Gs,"wrapAuthError");function hn(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}i(hn,"getErrorMessage");var mt={[K.GUEST]:0,[K.USER]:1,[K.ADMIN]:2,[K.SUPER]:3};function Ve(e,t){if(!e)return!1;let n=mt[e]??-1,o=mt[t]??1/0;return n>=o}i(Ve,"hasRoleAccess");var gt="__DNDEV_SINGLETONS__";function vn(){if(typeof globalThis<"u"){let e=globalThis,t=e[gt];if(t)return t;let n=new Map;return e[gt]=n,n}return new Map}i(vn,"getSingletonRegistry");function $e(e,t){let n=vn();return n.has(e)||n.set(e,t()),n.get(e)}i($e,"getGlobalSingleton");function Xs(e,...t){let n=null,o=!1;return i(function(){if(n!==null)return n;if(o)throw new Error("Circular dependency detected in singleton initialization");o=!0;try{return typeof e=="function"&&e.prototype?n=new e(...t):n=e(),n}finally{o=!1}},"getInstance")}i(Xs,"createSingleton");function yt(){return $e("providers",()=>({providers:null}))}i(yt,"getProviderState");function ea(e){let{providers:t}=yt();if(!t)throw new Error(`[dndev] Provider "${e}" not available. Call configureProviders() at app startup.`);let n=t[e];if(!n)throw new Error(`[dndev] Provider "${e}" not configured. Pass it to configureProviders().`);return n}i(ea,"getProvider");function ta(e){return!!yt().providers?.[e]}i(ta,"hasProvider");function bn(e){return typeof e=="object"&&e!==null&&"visibility"in e&&typeof e.visibility=="string"}i(bn,"hasVisibility");function En(e){if(bn(e))return e.visibility}i(En,"getFieldVisibility");function xn(e,t){let n=e??"guest";return n==="hidden"?!1:n==="technical"?Ve(t,"admin"):n==="owner"?!1:Ve(t,n)}i(xn,"isFieldVisible");function Sn(e,t,n){for(let o of n.ownerFields)if(e[o]===t)return!0;return!1}i(Sn,"isOwnerVisible");function ht(e,t,n){if(!e||typeof e!="object"||!("entries"in e)||!e.entries)return console.warn("getVisibleFields expects a Valibot object schema (v.object)."),[];let o=e.entries,u=[],{documentData:a,uid:l,ownership:y}=n??{},f=y&&l!=null&&a&&Sn(a,l,y);for(let[h,d]of Object.entries(o)){let w=En(d);if(w==="owner"){f&&u.push(h);continue}xn(w,t)&&u.push(h)}return u}i(ht,"getVisibleFields");function ua(e,t,n,o){if(!e)return{};let u=o?.uid!=null&&o?.ownership!=null?{documentData:o.documentData??e,uid:o.uid,ownership:o.ownership}:void 0,a=ht(t,n,u),l={};for(let y of a)Object.prototype.hasOwnProperty.call(e,y)&&(l[y]=e[y]);return l}i(ua,"filterVisibleFields");function Ge(e){let t=e.listCardFields;if(t){if(Array.isArray(t))return t;let n=t,o=[...n.title??[],...n.subtitle??[],...n.content??[],...n.footer??[]];return[...new Set(o)]}return e.listFields&&e.listFields.length>0?e.listFields:e.fields?Object.keys(e.fields):[]}i(Ge,"getListCardFieldNames");var kn=new Set(["http:","https:","mailto:","tel:","blob:"]);function fa(e){if(!e||typeof e!="string")return"";let t=e.trim();if(/^[/.?#]/.test(t))return t;try{let n=new URL(t);if(kn.has(n.protocol))return t}catch{return t}return""}i(fa,"sanitizeHref");var vt=[{value:"draft",label:"crud:status.draft"},{value:"available",label:"crud:status.available"},{value:"deleted",label:"crud:status.deleted"}],ya="available",ha=["draft","deleted"],bt=["id","createdAt","updatedAt","createdById","updatedById"],va=[...bt,"status"];function Et(e){return bt.some(t=>t===e)}i(Et,"isBackendGeneratedField");var Re={status:{name:"status",type:"select",visibility:"admin",label:"crud:fields.status",editable:"admin",validation:{required:!0,options:[...vt]}},id:{name:"id",type:"text",visibility:"hidden",label:"crud:fields.id",validation:{required:!0}},createdAt:{name:"createdAt",type:"timestamp",visibility:"technical",label:"crud:fields.createdAt",validation:{}},updatedAt:{name:"updatedAt",type:"timestamp",visibility:"technical",label:"crud:fields.updatedAt",validation:{}},createdById:{name:"createdById",type:"reference",visibility:"technical",label:"crud:fields.createdById",validation:{}},updatedById:{name:"updatedById",type:"reference",visibility:"technical",label:"crud:fields.updatedById",validation:{}}};var He=["text","textarea","richtext","field-array"];function xt(e){return`${e}I18n`}i(xt,"i18nFieldName");function Ie(e,t){let n=new Date(e),o=n.getDate();return n.setMonth(n.getMonth()+t),n.getDate()!==o&&n.setDate(0),n}i(Ie,"addMonths");function St(e,t){let n=new Date(e),o=n.getDate();return n.setFullYear(n.getFullYear()+t),n.getDate()!==o&&n.setDate(0),n}i(St,"addYears");function sl(e,t=new Date){if(e==="lifetime")return"2099-12-31T23:59:59.000Z";let n;return e==="1month"?n=Ie(t,1):e==="3months"?n=Ie(t,3):e==="6months"?n=Ie(t,6):e==="1year"?n=St(t,1):e==="2years"?n=St(t,2):n=Ie(t,1),n.toISOString()}i(sl,"calculateSubscriptionEndDate");var It=new Map;function g(e,t){It.set(e,t)}i(g,"registerSchemaGenerator");function T(e,t){return t?e:U(e)}i(T,"applyRequired");var Ce=i(e=>{let t=[];e.validation?.minLength!==void 0&&t.push(m(e.validation.minLength,`Must be at least ${e.validation.minLength} characters`)),e.validation?.maxLength!==void 0&&t.push(V(e.validation.maxLength,`Must be at most ${e.validation.maxLength} characters`)),e.validation?.pattern&&t.push(ie(new RegExp(e.validation.pattern),"Invalid format"));let n=t.length>0?c(r(),...t):r();return T(n,e.validation?.required)},"textSchema"),Tn=i(e=>{let t=c(r(),L("Invalid email address"));return T(t,e.validation?.required)},"emailSchema"),Rn=i(e=>{let t=e.validation?.minLength!==void 0?c(r(),m(e.validation.minLength,`Must be at least ${e.validation.minLength} characters`)):r();return T(t,e.validation?.required)},"passwordSchema"),In=i(e=>{let t=c(r(),N("Invalid URL"));return T(t,e.validation?.required)},"urlSchema"),se=i(e=>{let t=[];e.validation?.min!==void 0&&t.push(_(e.validation.min,`Must be at least ${e.validation.min}`)),e.validation?.max!==void 0&&t.push(B(e.validation.max,`Must be at most ${e.validation.max}`));let n=t.length>0?c(A(),...t):A();return T(n,e.validation?.required)},"numberSchema"),kt=i(e=>{let t=S();return T(t,e.validation?.required)},"booleanSchema"),ae=i(e=>{let t=c(r(),fe(n=>!isNaN(new Date(n).getTime()),"Invalid date format"));return T(t,e.validation?.required)},"dateSchema"),Ct=p({url:r(),filename:r(),size:A(),mimeType:U(r()),uploadedAt:U(r())}),At=i(e=>{let t=C(Ct);return T(t,e.validation?.required)},"fileSchema"),Tt=i(e=>{let t=v(Ct);return T(t,e.validation?.required)},"filesSchema"),wt=p({fullUrl:r(),thumbUrl:r()}),Cn=i(e=>{let t=J([r(),wt]);return T(t,e.validation?.required)},"pictureSchema"),wn=i(e=>{let t=v(J([r(),wt]));return T(t,e.validation?.required)},"picturesSchema"),On=i(e=>{let t=p({lat:A(),lng:A()});return T(t,e.validation?.required)},"geopointSchema"),Pn=i(e=>{let t=p({formatted_address:r(),latitude:A(),longitude:A(),street_number:U(r()),route:U(r()),locality:U(r()),administrative_area_level_1:U(r()),administrative_area_level_2:U(r()),country:U(r()),postal_code:U(r())});return T(t,e.validation?.required)},"addressSchema"),Dn=i(e=>{let t=E(r(),P());return T(t,e.validation?.required)},"mapSchema"),_n=i(e=>{let t=v(P());return T(t,e.validation?.required)},"arraySchema"),We=i(e=>{let t=e.validation?.options;if(Array.isArray(t)&&t.length>0){let o=t.map(a=>a.value),u=b(o);return T(u,e.validation?.required)}let n=J([r(),A()]);return T(n,e.validation?.required)},"selectSchema"),Nn=i(e=>{let t=e.validation?.options;if(Array.isArray(t)&&t.length>0){let o=t.map(a=>a.value),u=v(b(o));return T(u,e.validation?.required)}let n=v(r());return T(n,e.validation?.required)},"multiselectSchema"),Fn=i(e=>{let t=c(r(),m(1,"Invalid ID format"));return T(t,e.validation?.required)},"referenceSchema"),Ke=i(e=>{let t=r();return T(t,e.validation?.required)},"stringSchema"),Un=i(e=>{let t=r();return T(t,e.validation?.required)},"telSchema"),Mn=i(e=>{let t=e.validation?.minLength??15,n=e.validation?.maxLength??34,o=e.validation?.pattern??"^[A-Z]{2}[0-9]{2}[A-Z0-9]{4,34}$",u=[];if(t!==void 0&&u.push(m(t,`IBAN must be at least ${t} characters`)),n!==void 0&&u.push(V(n,`IBAN must not exceed ${n} characters`)),o){let l=typeof o=="string"?new RegExp(o):o;u.push(ie(l,"Invalid IBAN format"))}let a=u.length>0?c(r(),...u):r();return T(a,e.validation?.required)},"ibanSchema"),Rt=i(()=>Ue(),"neverSchema"),Ln=i(e=>{let t=e.options?.fieldSpecific;if(t?.checkedValue&&t?.uncheckedValue){let o=[t.checkedValue,t.uncheckedValue],u=b(o);return T(u,e.validation?.required)}let n=S();return T(n,e.validation?.required)},"switchSchema"),Bn=i(e=>_e(n=>e.validation?.required?typeof n=="object"&&n!==null?"gdprConsent"in n&&n.gdprConsent===!0:!1:n===!1||n===null||n===void 0?!0:typeof n=="object"&&n!==null?"gdprConsent"in n&&n.gdprConsent===!0:!1,"GDPR consent must be given"),"gdprConsentSchema"),qn=i(e=>{let t=p({amount:A(),currency:s(r()),vatIncluded:s(S()),discountPercent:s(c(A(),_(0),B(100)))});return T(t,e.validation?.required)},"priceSchema");function jn(){g("text",Ce),g("textarea",Ce),g("richtext",Ce),g("color",Ce),g("email",Tn),g("password",Rn),g("url",In),g("tel",Un),g("iban",Mn),g("number",se),g("currency",se),g("price",qn),g("range",se),g("year",se),g("rating",se),g("duration",se),g("boolean",kt),g("checkbox",kt),g("gdprConsent",Bn),g("date",ae),g("datetime-local",ae),g("time",ae),g("week",ae),g("month",ae),g("timestamp",ae),g("file",At),g("files",Tt),g("document",At),g("documents",Tt),g("image",Cn),g("images",wn),g("geopoint",On),g("address",Pn),g("map",Dn),g("array",_n),g("select",We),g("multiselect",Nn),g("radio",We),g("combobox",We),g("switch",Ln),g("reference",Fn),g("hidden",Ke),g("avatar",Ke),g("badge",Ke),g("submit",Rt),g("reset",Rt)}i(jn,"registerBuiltinSchemas");jn();function ue(e){if(e.validation?.schema){let o=e.validation.schema;return T(o,e.validation?.required)}let t=It.get(e.type);if(t){let o=t(e);if(o!==null)return o}let n=P();return T(n,e.validation?.required)}i(ue,"getSchemaType");function ze(e,t){return!!(t.visibility==="hidden"||t.editable===Be.GENERATED||Et(e))}i(ze,"isWriteExcluded");function ce(e,t){return Object.assign(e,{visibility:t})}i(ce,"withVisibility");function ee(e,t){return Object.assign(e,{metadata:{collection:t.collection,entity:t.name,...t.uniqueKeys&&{uniqueKeys:t.uniqueKeys},...t.security&&{security:t.security}}})}i(ee,"withMetadata");function Vn(e){let t=ue(e);return ce(t,e.visibility)}i(Vn,"createFieldSchema");function $n(e,t){if(!He.includes(t.type))throw new Error(`Field '${e}' has i18n: true but type '${t.type}'. Translatable types: ${He.join(", ")}.`);let n=ue({...t,validation:{...t.validation,required:!1}});return ce(s(C(E(r(),n))),t.visibility)}i($n,"createTranslationsSchema");function le(e,t){for(let n of Object.keys(e)){let o=t[n];o?.i18n===!0&&(e[xt(n)]=$n(n,o))}return e}i(le,"withTranslations");function Ye(e){let t=ue({...e,validation:{...e.validation,required:!1}});return ce(t,e.visibility)}i(Ye,"createOptionalFieldSchema");function kl(e){let t=e.fields,n={};for(let[k,R]of Object.entries(t))R.visibility!=="hidden"&&(n[k]=Ye(R));let o=ee(p(le({...n},t)),e),u={};for(let[k,R]of Object.entries(t))ze(k,R)||(u[k]=Vn(R));let a=ee(p(le({...u},t)),e),l={};for(let[k,R]of Object.entries(t))if(!ze(k,R))if(k==="status"){let Y=F("draft");l[k]=ce(Y,R.visibility)}else l[k]=Ye(R);let y=ee(p(le({...l},t)),e),f={};for(let[k,R]of Object.entries(t))ze(k,R)||(f[k]=Ye(R));f.id=ce(ue(Re.id),"technical");let h=ee(p(le({...f},t)),e),d;if(e.listFields&&e.listFields.length>0){let k=["id","status"],R=[...new Set([...k,...e.listFields])];d={};for(let Y of R){let pe=n[Y];pe&&(d[Y]=pe)}}else d=n;let w=ee(p(le({...d},t)),e),D,G=Ge(e);if(G.length>0){let k=["id","status"],R=[...new Set([...k,...G])];D={};for(let Y of R){let pe=n[Y];pe&&(D[Y]=pe)}}else D=n;let he=ee(p(le({...D},t)),e),te=ee(p({id:ce(ue(Re.id),"technical")}),e);return{create:a,draft:y,update:h,get:o,list:w,listCard:he,delete:te}}i(kl,"createSchemas");var Gn=E(r(),P()),Hn=p({id:r(),patch:E(r(),P())}),Wn=r(),Rl=p({inserts:s(v(Gn)),updates:s(v(Hn)),deletes:s(v(Wn))}),Il=p({insertedIds:v(r()),updatedIds:v(r()),deletedIds:v(r())});function Cl(e){let t=new Set((e.updates??[]).map(l=>l.id)),n=e.deletes??[],o=[];for(let l of n)t.has(l)&&o.push(l);if(o.length>0)return{collisions:o,where:"updates-deletes"};let u=e.inserts??[],a=[];for(let l of u)typeof l.id=="string"&&t.has(l.id)&&a.push(l.id);return a.length>0?{collisions:a,where:"inserts-updates"}:{collisions:[],where:null}}i(Cl,"detectBulkCollisions");var yc=c(r(),fe(e=>e.startsWith("/proxy/")||e.startsWith("data:image/"),"Image URL must be box-proxied (/proxy/...) or an inline data:image URI.")),Kn=b(["ephemeral","session","persistent"]),zn=p({title:s(r()),pinnable:s(S()),preferredHeight:s(c(A(),_(0)))}),hc=p({id:c(r(),m(1)),kind:c(r(),m(1)),lifetime:s(Kn,"ephemeral"),metadata:s(zn),payload:P()}),vc=p({widgetId:c(r(),m(1)),action:c(r(),m(1)),payload:P()});export{Zn as a,Jn as b,Qn as c,er as d,nr as e,re as f,B as g,m as h,_ as i,ie as j,jt as k,N as l,Z as m,v as n,S as o,_e as p,Fe as q,C as r,A as s,p as t,s as u,b as v,E as w,r as x,$t as y,J as z,P as A,Qe as B,c as C,W as D,Wt as E,lr as F,tt as G,ye as H,Tr as I,_r as J,at as K,on as L,Ci as M,O as N,mo as O,go as P,yo as Q,ho as R,Io as S,Te as T,Gs as U,Ve as V,Xs as W,ea as X,ta as Y,ua as Z,Ge as _,fa as $,sl as aa,ya as ba,ha as ca,kl as da,Rl as ea,Il as fa,Cl as ga};
|
|
22
|
+
//# sourceMappingURL=chunk-W74UL7AY.js.map
|