@hexclave/shared 1.0.0 → 1.0.2

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 (161) hide show
  1. package/dist/ai/llms/llms.d.ts +17 -0
  2. package/dist/ai/llms/llms.d.ts.map +1 -0
  3. package/dist/ai/llms/llms.js +36 -0
  4. package/dist/ai/llms/llms.js.map +1 -0
  5. package/dist/ai/unified-prompts/reminders.js +2 -2
  6. package/dist/ai/unified-prompts/reminders.js.map +1 -1
  7. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
  8. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +3 -1
  9. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
  10. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-index.d.ts +7 -1
  11. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-index.d.ts.map +1 -1
  12. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-index.js +6 -5
  13. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-index.js.map +1 -1
  14. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.d.ts +172 -0
  15. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.d.ts.map +1 -0
  16. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js +280 -0
  17. package/dist/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js.map +1 -0
  18. package/dist/ai/unified-prompts/skill-site-prompt.d.ts +2 -1
  19. package/dist/ai/unified-prompts/skill-site-prompt.d.ts.map +1 -1
  20. package/dist/ai/unified-prompts/skill-site-prompt.js +36 -32
  21. package/dist/ai/unified-prompts/skill-site-prompt.js.map +1 -1
  22. package/dist/config/schema-fuzzer.test.js +1 -0
  23. package/dist/config/schema-fuzzer.test.js.map +1 -1
  24. package/dist/config/schema.d.ts +201 -197
  25. package/dist/config/schema.d.ts.map +1 -1
  26. package/dist/config/schema.js +6 -0
  27. package/dist/config/schema.js.map +1 -1
  28. package/dist/config-authoring.d.ts +5 -1
  29. package/dist/config-authoring.d.ts.map +1 -1
  30. package/dist/config-authoring.js +5 -0
  31. package/dist/config-authoring.js.map +1 -1
  32. package/dist/config-rendering.d.ts +6 -6
  33. package/dist/config-rendering.d.ts.map +1 -1
  34. package/dist/config-rendering.js +25 -17
  35. package/dist/config-rendering.js.map +1 -1
  36. package/dist/esm/ai/llms/llms.d.ts +17 -0
  37. package/dist/esm/ai/llms/llms.d.ts.map +1 -0
  38. package/dist/esm/ai/llms/llms.js +30 -0
  39. package/dist/esm/ai/llms/llms.js.map +1 -0
  40. package/dist/esm/ai/unified-prompts/reminders.js +2 -2
  41. package/dist/esm/ai/unified-prompts/reminders.js.map +1 -1
  42. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
  43. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +3 -1
  44. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
  45. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-index.d.ts +7 -1
  46. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-index.d.ts.map +1 -1
  47. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-index.js +4 -4
  48. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-index.js.map +1 -1
  49. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.d.ts +173 -0
  50. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.d.ts.map +1 -0
  51. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js +279 -0
  52. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.js.map +1 -0
  53. package/dist/esm/ai/unified-prompts/skill-site-prompt.d.ts +2 -1
  54. package/dist/esm/ai/unified-prompts/skill-site-prompt.d.ts.map +1 -1
  55. package/dist/esm/ai/unified-prompts/skill-site-prompt.js +36 -33
  56. package/dist/esm/ai/unified-prompts/skill-site-prompt.js.map +1 -1
  57. package/dist/esm/config/schema-fuzzer.test.js +1 -0
  58. package/dist/esm/config/schema-fuzzer.test.js.map +1 -1
  59. package/dist/esm/config/schema.d.ts +201 -197
  60. package/dist/esm/config/schema.d.ts.map +1 -1
  61. package/dist/esm/config/schema.js +6 -0
  62. package/dist/esm/config/schema.js.map +1 -1
  63. package/dist/esm/config-authoring.d.ts +5 -1
  64. package/dist/esm/config-authoring.d.ts.map +1 -1
  65. package/dist/esm/config-authoring.js +5 -1
  66. package/dist/esm/config-authoring.js.map +1 -1
  67. package/dist/esm/config-rendering.d.ts +6 -6
  68. package/dist/esm/config-rendering.d.ts.map +1 -1
  69. package/dist/esm/config-rendering.js +25 -17
  70. package/dist/esm/config-rendering.js.map +1 -1
  71. package/dist/esm/hooks/use-hover.d.ts +1 -1
  72. package/dist/esm/hooks/use-hover.d.ts.map +1 -1
  73. package/dist/esm/hooks/use-hover.js.map +1 -1
  74. package/dist/esm/interface/admin-interface.js +1 -1
  75. package/dist/esm/interface/admin-metrics.d.ts +8 -8
  76. package/dist/esm/interface/client-interface.js +1 -1
  77. package/dist/esm/interface/conversations.d.ts +32 -32
  78. package/dist/esm/interface/crud/current-user.d.ts +8 -8
  79. package/dist/esm/interface/crud/email-outbox.d.ts +218 -218
  80. package/dist/esm/interface/crud/products.d.ts +20 -20
  81. package/dist/esm/interface/crud/products.d.ts.map +1 -1
  82. package/dist/esm/interface/crud/project-api-keys.d.ts +3 -3
  83. package/dist/esm/interface/crud/projects.d.ts +36 -36
  84. package/dist/esm/interface/crud/team-member-profiles.d.ts +16 -16
  85. package/dist/esm/interface/crud/transactions.d.ts +23 -23
  86. package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
  87. package/dist/esm/interface/crud/users.d.ts +14 -14
  88. package/dist/esm/interface/server-interface.js +1 -1
  89. package/dist/esm/interface/webhooks.d.ts +4 -4
  90. package/dist/esm/known-errors.d.ts +7 -7
  91. package/dist/esm/schema-fields.d.ts +7 -6
  92. package/dist/esm/schema-fields.d.ts.map +1 -1
  93. package/dist/esm/schema-fields.js +5 -1
  94. package/dist/esm/schema-fields.js.map +1 -1
  95. package/dist/esm/stack-config-file.js.map +1 -1
  96. package/dist/esm/utils/cloud-hosts.d.ts +42 -0
  97. package/dist/esm/utils/cloud-hosts.d.ts.map +1 -0
  98. package/dist/esm/utils/cloud-hosts.js +92 -0
  99. package/dist/esm/utils/cloud-hosts.js.map +1 -0
  100. package/dist/esm/utils/errors.d.ts +9 -2
  101. package/dist/esm/utils/errors.d.ts.map +1 -1
  102. package/dist/esm/utils/errors.js +16 -5
  103. package/dist/esm/utils/errors.js.map +1 -1
  104. package/dist/esm/utils/promises.js +1 -1
  105. package/dist/esm/utils/react.d.ts.map +1 -1
  106. package/dist/esm/utils/react.js +4 -4
  107. package/dist/esm/utils/react.js.map +1 -1
  108. package/dist/esm/utils/redirect-urls.d.ts.map +1 -1
  109. package/dist/esm/utils/redirect-urls.js +3 -3
  110. package/dist/esm/utils/redirect-urls.js.map +1 -1
  111. package/dist/esm/utils/urls.d.ts.map +1 -1
  112. package/dist/esm/utils/urls.js +2 -2
  113. package/dist/esm/utils/urls.js.map +1 -1
  114. package/dist/hooks/use-hover.d.ts +1 -1
  115. package/dist/hooks/use-hover.d.ts.map +1 -1
  116. package/dist/hooks/use-hover.js.map +1 -1
  117. package/dist/{index-D9ysacya.d.ts → index-fQbeILq7.d.ts} +1 -1
  118. package/dist/{index-D9ysacya.d.ts.map → index-fQbeILq7.d.ts.map} +1 -1
  119. package/dist/interface/admin-interface.js +1 -1
  120. package/dist/interface/admin-metrics.d.ts +8 -8
  121. package/dist/interface/client-interface.d.ts +1 -1
  122. package/dist/interface/client-interface.js +1 -1
  123. package/dist/interface/conversations.d.ts +32 -32
  124. package/dist/interface/crud/current-user.d.ts +8 -8
  125. package/dist/interface/crud/email-outbox.d.ts +218 -218
  126. package/dist/interface/crud/products.d.ts +20 -20
  127. package/dist/interface/crud/products.d.ts.map +1 -1
  128. package/dist/interface/crud/project-api-keys.d.ts +3 -3
  129. package/dist/interface/crud/projects.d.ts +36 -36
  130. package/dist/interface/crud/team-member-profiles.d.ts +16 -16
  131. package/dist/interface/crud/transactions.d.ts +23 -23
  132. package/dist/interface/crud/transactions.d.ts.map +1 -1
  133. package/dist/interface/crud/users.d.ts +14 -14
  134. package/dist/interface/server-interface.js +1 -1
  135. package/dist/interface/webhooks.d.ts +4 -4
  136. package/dist/known-errors.d.ts +7 -7
  137. package/dist/schema-fields.d.ts +7 -6
  138. package/dist/schema-fields.d.ts.map +1 -1
  139. package/dist/schema-fields.js +5 -0
  140. package/dist/schema-fields.js.map +1 -1
  141. package/dist/stack-config-file.js.map +1 -1
  142. package/dist/utils/cloud-hosts.d.ts +42 -0
  143. package/dist/utils/cloud-hosts.d.ts.map +1 -0
  144. package/dist/utils/cloud-hosts.js +97 -0
  145. package/dist/utils/cloud-hosts.js.map +1 -0
  146. package/dist/utils/errors.d.ts +9 -2
  147. package/dist/utils/errors.d.ts.map +1 -1
  148. package/dist/utils/errors.js +16 -4
  149. package/dist/utils/errors.js.map +1 -1
  150. package/dist/utils/passkey.d.ts +1 -1
  151. package/dist/utils/promises.js +1 -1
  152. package/dist/utils/react.d.ts.map +1 -1
  153. package/dist/utils/react.js +4 -4
  154. package/dist/utils/react.js.map +1 -1
  155. package/dist/utils/redirect-urls.d.ts.map +1 -1
  156. package/dist/utils/redirect-urls.js +3 -3
  157. package/dist/utils/redirect-urls.js.map +1 -1
  158. package/dist/utils/urls.d.ts.map +1 -1
  159. package/dist/utils/urls.js +2 -2
  160. package/dist/utils/urls.js.map +1 -1
  161. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"urls.js","names":[],"sources":["../../../src/utils/urls.tsx"],"sourcesContent":["import { generateSecureRandomString } from \"./crypto\";\nimport { templateIdentity } from \"./strings\";\n\nexport function createUrlIfValid(...args: ConstructorParameters<typeof URL>) {\n try {\n return new URL(...args);\n } catch (e) {\n return null;\n }\n}\nimport.meta.vitest?.test(\"createUrlIfValid\", ({ expect }) => {\n // Test with valid URLs\n expect(createUrlIfValid(\"https://example.com\")).toBeInstanceOf(URL);\n expect(createUrlIfValid(\"https://example.com/path?query=value#hash\")).toBeInstanceOf(URL);\n expect(createUrlIfValid(\"/path\", \"https://example.com\")).toBeInstanceOf(URL);\n\n // Test with invalid URLs\n expect(createUrlIfValid(\"\")).toBeNull();\n expect(createUrlIfValid(\"not a url\")).toBeNull();\n expect(createUrlIfValid(\"http://\")).toBeNull();\n});\n\nexport function isValidUrl(url: string) {\n return !!createUrlIfValid(url);\n}\nimport.meta.vitest?.test(\"isValidUrl\", ({ expect }) => {\n // Test with valid URLs\n expect(isValidUrl(\"https://example.com\")).toBe(true);\n expect(isValidUrl(\"http://localhost:3000\")).toBe(true);\n expect(isValidUrl(\"ftp://example.com\")).toBe(true);\n\n // Test with invalid URLs\n expect(isValidUrl(\"\")).toBe(false);\n expect(isValidUrl(\"not a url\")).toBe(false);\n expect(isValidUrl(\"http://\")).toBe(false);\n});\n\nexport function isValidHostname(hostname: string) {\n // Basic validation\n if (!hostname || hostname.startsWith('.') || hostname.endsWith('.') || hostname.includes('..')) {\n return false;\n }\n\n const url = createUrlIfValid(`https://${hostname}`);\n if (!url) return false;\n return url.hostname === hostname;\n}\nimport.meta.vitest?.test(\"isValidHostname\", ({ expect }) => {\n // Test with valid hostnames\n expect(isValidHostname(\"example.com\")).toBe(true);\n expect(isValidHostname(\"localhost\")).toBe(true);\n expect(isValidHostname(\"sub.domain.example.com\")).toBe(true);\n expect(isValidHostname(\"127.0.0.1\")).toBe(true);\n\n // Test with invalid hostnames\n expect(isValidHostname(\"\")).toBe(false);\n expect(isValidHostname(\"example.com/path\")).toBe(false);\n expect(isValidHostname(\"https://example.com\")).toBe(false);\n expect(isValidHostname(\"example com\")).toBe(false);\n});\n\nexport function isValidHostnameWithWildcards(hostname: string) {\n // Empty hostnames are invalid\n if (!hostname) return false;\n\n // Check if it contains wildcards\n const hasWildcard = hostname.includes('*');\n\n if (!hasWildcard) {\n // If no wildcards, validate as a normal hostname\n return isValidHostname(hostname);\n }\n\n // Basic validation checks that apply even with wildcards\n // - Hostname cannot start or end with a dot\n if (hostname.startsWith('.') || hostname.endsWith('.')) {\n return false;\n }\n\n // - No consecutive dots\n if (hostname.includes('..')) {\n return false;\n }\n\n // For wildcard validation, check that non-wildcard parts contain valid characters\n // Replace wildcards with a valid placeholder to check the rest\n const testHostname = hostname.replace(/\\*+/g, 'wildcard');\n\n // Check if the resulting string would be a valid hostname\n if (!/^[a-zA-Z0-9.-]+$/.test(testHostname)) {\n return false;\n }\n\n // Additional check: ensure the pattern makes sense\n // Check each segment between wildcards\n const segments = hostname.split(/\\*+/);\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n if (segment === '') continue; // Empty segments are OK (consecutive wildcards)\n\n // First segment can't start with dot\n if (i === 0 && segment.startsWith('.')) {\n return false;\n }\n\n // Last segment can't end with dot\n if (i === segments.length - 1 && segment.endsWith('.')) {\n return false;\n }\n\n // No segment should have consecutive dots\n if (segment.includes('..')) {\n return false;\n }\n }\n\n return true;\n}\nimport.meta.vitest?.test(\"isValidHostnameWithWildcards\", ({ expect }) => {\n // Test with valid regular hostnames\n expect(isValidHostnameWithWildcards(\"example.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"localhost\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"sub.domain.example.com\")).toBe(true);\n\n // Test with valid wildcard hostnames\n expect(isValidHostnameWithWildcards(\"*.example.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"a-*.example.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"*.*.org\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"**.example.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"sub.**.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"*-api.*.com\")).toBe(true);\n\n // Test with invalid hostnames\n expect(isValidHostnameWithWildcards(\"\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"example.com/path\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"https://example.com\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"example com\")).toBe(false);\n expect(isValidHostnameWithWildcards(\".example.com\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"example.com.\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"example..com\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"*.example..com\")).toBe(false);\n});\n\nexport function matchHostnamePattern(pattern: string, hostname: string): boolean {\n // If no wildcards, it's an exact match\n if (!pattern.includes('*')) {\n return pattern === hostname;\n }\n\n // Convert the pattern to a regex\n // First, escape all regex special characters except *\n let regexPattern = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n // Use a placeholder for ** to handle it separately from single *\n const doubleWildcardPlaceholder = '\\x00DOUBLE_WILDCARD\\x00';\n regexPattern = regexPattern.replace(/\\*\\*/g, doubleWildcardPlaceholder);\n\n // Replace single * with a pattern that matches anything except dots\n regexPattern = regexPattern.replace(/\\*/g, '[^.]*');\n\n // Replace the double wildcard placeholder with a pattern that matches anything including dots\n regexPattern = regexPattern.replace(new RegExp(doubleWildcardPlaceholder, 'g'), '.*');\n\n // Anchor the pattern to match the entire hostname\n regexPattern = '^' + regexPattern + '$';\n\n try {\n const regex = new RegExp(regexPattern);\n return regex.test(hostname);\n } catch {\n return false;\n }\n}\nimport.meta.vitest?.test(\"matchHostnamePattern\", ({ expect }) => {\n // Test exact matches\n expect(matchHostnamePattern(\"example.com\", \"example.com\")).toBe(true);\n expect(matchHostnamePattern(\"example.com\", \"other.com\")).toBe(false);\n\n // Test single wildcard matches\n expect(matchHostnamePattern(\"*.example.com\", \"api.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"*.example.com\", \"www.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"*.example.com\", \"example.com\")).toBe(false);\n expect(matchHostnamePattern(\"*.example.com\", \"api.v2.example.com\")).toBe(false);\n\n // Test double wildcard matches\n expect(matchHostnamePattern(\"**.example.com\", \"api.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"**.example.com\", \"api.v2.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"**.example.com\", \"a.b.c.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"**.example.com\", \"example.com\")).toBe(false);\n\n // Test complex patterns\n expect(matchHostnamePattern(\"api-*.example.com\", \"api-v1.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"api-*.example.com\", \"api-v2.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"api-*.example.com\", \"api.example.com\")).toBe(false);\n expect(matchHostnamePattern(\"*.*.org\", \"mail.example.org\")).toBe(true);\n expect(matchHostnamePattern(\"*.*.org\", \"example.org\")).toBe(false);\n});\n\nexport function getHardcodedFallbackUrls(primaryBaseUrl: string): string[] {\n if (primaryBaseUrl === \"https://api.hexclave.com\") {\n return [\"https://api1.hexclave.com\", \"https://api2.hexclave.com\"];\n }\n if (primaryBaseUrl === \"https://api.dev.hexclave.com\") {\n return [\"https://api1.dev.hexclave.com\", \"https://api2.dev.hexclave.com\"];\n }\n // Backward-compat: customers with explicit `baseUrl: \"https://api.stack-auth.com\"`\n // (the pre-rebrand canonical) keep the same fallbacks they had before. Both\n // hostnames resolve to the same backend during the deprecation window.\n if (primaryBaseUrl === \"https://api.stack-auth.com\") {\n return [\"https://api1.stack-auth.com\", \"https://api2.stack-auth.com\"];\n }\n if (primaryBaseUrl === \"https://api.dev.stack-auth.com\") {\n return [\"https://api1.dev.stack-auth.com\", \"https://api2.dev.stack-auth.com\"];\n }\n const localhostMatch = primaryBaseUrl.match(/^http:\\/\\/localhost:(\\d+)02$/);\n if (localhostMatch) {\n return [`http://localhost:${localhostMatch[1]}10`];\n }\n return [];\n}\n\nexport function getDefaultApiUrls(primaryBaseUrl: string): string[] {\n return [primaryBaseUrl, ...getHardcodedFallbackUrls(primaryBaseUrl)];\n}\n\nexport function isLocalhost(urlOrString: string | URL) {\n const url = createUrlIfValid(urlOrString);\n if (!url) return false;\n if (url.hostname === \"localhost\" || url.hostname.endsWith(\".localhost\")) return true;\n if (url.hostname.match(/^127\\.\\d+\\.\\d+\\.\\d+$/)) return true;\n if (url.hostname === \"[::1]\" || url.hostname === \"::1\") return true;\n return false;\n}\nimport.meta.vitest?.test(\"isLocalhost\", ({ expect }) => {\n // Test with localhost URLs\n expect(isLocalhost(\"http://localhost\")).toBe(true);\n expect(isLocalhost(\"https://localhost:8080\")).toBe(true);\n expect(isLocalhost(\"http://sub.localhost\")).toBe(true);\n expect(isLocalhost(\"http://127.0.0.1\")).toBe(true);\n expect(isLocalhost(\"http://127.1.2.3\")).toBe(true);\n expect(isLocalhost(\"http://[::1]\")).toBe(true);\n\n // Test with non-localhost URLs\n expect(isLocalhost(\"https://example.com\")).toBe(false);\n expect(isLocalhost(\"http://192.168.1.1\")).toBe(false);\n expect(isLocalhost(\"http://10.0.0.1\")).toBe(false);\n\n // Test with URL objects\n expect(isLocalhost(new URL(\"http://localhost\"))).toBe(true);\n expect(isLocalhost(new URL(\"https://example.com\"))).toBe(false);\n\n // Test with invalid URLs\n expect(isLocalhost(\"not a url\")).toBe(false);\n expect(isLocalhost(\"\")).toBe(false);\n});\n\nexport function isRelative(url: string) {\n const randomDomain = `${generateSecureRandomString()}.stack-auth.example.com`;\n const u = createUrlIfValid(url, `https://${randomDomain}`);\n if (!u) return false;\n if (u.host !== randomDomain) return false;\n if (u.protocol !== \"https:\") return false;\n return true;\n}\nimport.meta.vitest?.test(\"isRelative\", ({ expect }) => {\n // We can't easily mock generateSecureRandomString in this context\n // but we can still test the function's behavior\n\n // Test with relative URLs\n expect(isRelative(\"/\")).toBe(true);\n expect(isRelative(\"/path\")).toBe(true);\n expect(isRelative(\"/path?query=value#hash\")).toBe(true);\n\n // Test with absolute URLs\n expect(isRelative(\"https://example.com\")).toBe(false);\n expect(isRelative(\"http://example.com\")).toBe(false);\n expect(isRelative(\"//example.com\")).toBe(false);\n\n // Note: The implementation treats empty strings and invalid URLs as relative\n // This is because they can be resolved against a base URL\n expect(isRelative(\"\")).toBe(true);\n expect(isRelative(\"not a url\")).toBe(true);\n});\n\nexport function getRelativePart(url: URL) {\n return url.pathname + url.search + url.hash;\n}\nimport.meta.vitest?.test(\"getRelativePart\", ({ expect }) => {\n // Test with various URLs\n expect(getRelativePart(new URL(\"https://example.com\"))).toBe(\"/\");\n expect(getRelativePart(new URL(\"https://example.com/path\"))).toBe(\"/path\");\n expect(getRelativePart(new URL(\"https://example.com/path?query=value\"))).toBe(\"/path?query=value\");\n expect(getRelativePart(new URL(\"https://example.com/path#hash\"))).toBe(\"/path#hash\");\n expect(getRelativePart(new URL(\"https://example.com/path?query=value#hash\"))).toBe(\"/path?query=value#hash\");\n\n // Test with different domains but same paths\n const url1 = new URL(\"https://example.com/path?query=value#hash\");\n const url2 = new URL(\"https://different.com/path?query=value#hash\");\n expect(getRelativePart(url1)).toBe(getRelativePart(url2));\n});\n\n/**\n * A template literal tag that returns a URL.\n *\n * Any values passed are encoded.\n */\nexport function url(strings: TemplateStringsArray | readonly string[], ...values: (string | number | boolean)[]): URL {\n return new URL(urlString(strings, ...values));\n}\nimport.meta.vitest?.test(\"url\", ({ expect }) => {\n // Test with no interpolation\n expect(url`https://example.com`).toBeInstanceOf(URL);\n expect(url`https://example.com`.href).toBe(\"https://example.com/\");\n\n // Test with string interpolation\n expect(url`https://example.com/${\"path\"}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${\"path\"}`.pathname).toBe(\"/path\");\n\n // Test with number interpolation\n expect(url`https://example.com/${42}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${42}`.pathname).toBe(\"/42\");\n\n // Test with boolean interpolation\n expect(url`https://example.com/${true}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${true}`.pathname).toBe(\"/true\");\n\n // Test with special characters in interpolation\n expect(url`https://example.com/${\"path with spaces\"}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${\"path with spaces\"}`.pathname).toBe(\"/path%20with%20spaces\");\n\n // Test with multiple interpolations\n expect(url`https://example.com/${\"path\"}?query=${\"value\"}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${\"path\"}?query=${\"value\"}`.pathname).toBe(\"/path\");\n expect(url`https://example.com/${\"path\"}?query=${\"value\"}`.search).toBe(\"?query=value\");\n});\n\n\n/**\n * A template literal tag that returns a URL string.\n *\n * Any values passed are encoded.\n */\nexport function urlString(strings: TemplateStringsArray | readonly string[], ...values: (string | number | boolean)[]): string {\n return templateIdentity(strings, ...values.map(encodeURIComponent));\n}\nimport.meta.vitest?.test(\"urlString\", ({ expect }) => {\n // Test with no interpolation\n expect(urlString`https://example.com`).toBe(\"https://example.com\");\n\n // Test with string interpolation\n expect(urlString`https://example.com/${\"path\"}`).toBe(\"https://example.com/path\");\n\n // Test with number interpolation\n expect(urlString`https://example.com/${42}`).toBe(\"https://example.com/42\");\n\n // Test with boolean interpolation\n expect(urlString`https://example.com/${true}`).toBe(\"https://example.com/true\");\n\n // Test with special characters in interpolation\n expect(urlString`https://example.com/${\"path with spaces\"}`).toBe(\"https://example.com/path%20with%20spaces\");\n expect(urlString`https://example.com/${\"?&=\"}`).toBe(\"https://example.com/%3F%26%3D\");\n\n // Test with multiple interpolations\n expect(urlString`https://example.com/${\"path\"}?query=${\"value\"}`).toBe(\"https://example.com/path?query=value\");\n expect(urlString`https://example.com/${\"path\"}?query=${\"value with spaces\"}`).toBe(\"https://example.com/path?query=value%20with%20spaces\");\n});\n\nexport function isChildUrl(parentUrl: URL, maybeChildUrl: URL) {\n return parentUrl.origin === maybeChildUrl.origin\n && isChildPath(parentUrl.pathname, maybeChildUrl.pathname)\n && [...parentUrl.searchParams].every(([key, value]) => maybeChildUrl.searchParams.get(key) === value)\n && (!parentUrl.hash || parentUrl.hash === maybeChildUrl.hash);\n}\nimport.meta.vitest?.test(\"isChildUrl\", ({ expect }) => {\n // true\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://abc.com/\"))).toBe(true);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://abc.com/path\"))).toBe(true);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://abc.com/path?query=value\"))).toBe(true);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://abc.com/path?query=value#hash\"))).toBe(true);\n\n // false\n expect(isChildUrl(new URL(\"https://abc.com\"), new URL(\"https://example.com\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://example.com/path\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://example.com/path?query=value\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://example.com/path?query=value#hash\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://example.com\"), new URL(\"https://abc.com/path?query=value#hash\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://example.com?query=value123\"), new URL(\"https://example.com/path?query=value#hash\"))).toBe(false);\n});\n\nexport function isChildPath(parentPath: string, maybeChildPath: string) {\n parentPath = parentPath.endsWith(\"/\") ? parentPath : parentPath + \"/\";\n maybeChildPath = maybeChildPath.endsWith(\"/\") ? maybeChildPath : maybeChildPath + \"/\";\n return maybeChildPath.startsWith(parentPath);\n}\nimport.meta.vitest?.test(\"isSubPath\", ({ expect }) => {\n expect(isChildPath(\"/\", \"/\")).toBe(true);\n expect(isChildPath(\"/\", \"/path\")).toBe(true);\n expect(isChildPath(\"/path\", \"/\")).toBe(false);\n expect(isChildPath(\"/path\", \"/path\")).toBe(true);\n expect(isChildPath(\"/path/\", \"/path\")).toBe(true);\n expect(isChildPath(\"/path\", \"/path/\")).toBe(true);\n expect(isChildPath(\"/path/\", \"/path/\")).toBe(true);\n expect(isChildPath(\"/path\", \"/path/abc\")).toBe(true);\n expect(isChildPath(\"/path/\", \"/path/abc\")).toBe(true);\n expect(isChildPath(\"/path\", \"/path-abc\")).toBe(false);\n expect(isChildPath(\"/path\", \"/path-abc/\")).toBe(false);\n expect(isChildPath(\"/path/\", \"/path-abc\")).toBe(false);\n expect(isChildPath(\"/path/\", \"/path-abc/\")).toBe(false);\n});\n"],"mappings":";;;;AAGA,SAAgB,iBAAiB,GAAG,MAAyC;AAC3E,KAAI;AACF,SAAO,IAAI,IAAI,GAAG,KAAK;UAChB,GAAG;AACV,SAAO;;;CAGX,SAAW,KAAC,qBAAc,EAAA,aAAsB;AAE9C,QAAO,iBAAiB,sBAAsB,CAAC,CAAC,eAAe,IAAI;AACnE,QAAO,iBAAiB,4CAA4C,CAAC,CAAC,eAAe,IAAI;AACzF,QAAO,iBAAiB,SAAS,sBAAsB,CAAC,CAAC,eAAe,IAAI;AAG5E,QAAO,iBAAiB,GAAG,CAAC,CAAC,UAAU;AACvC,QAAO,iBAAiB,YAAY,CAAC,CAAC,UAAU;AAChD,QAAO,iBAAiB,UAAU,CAAC,CAAC,UAAU;EAC9C;AAEF,SAAgB,WAAW,KAAa;AACtC,QAAO,CAAC,CAAC,iBAAiB,IAAI;;CAEhC,SAAW,KAAC,eAAc,EAAA,aAAgB;AAExC,QAAO,WAAW,sBAAsB,CAAC,CAAC,KAAK,KAAK;AACpD,QAAO,WAAW,wBAAwB,CAAC,CAAC,KAAK,KAAK;AACtD,QAAO,WAAW,oBAAoB,CAAC,CAAC,KAAK,KAAK;AAGlD,QAAO,WAAW,GAAG,CAAC,CAAC,KAAK,MAAM;AAClC,QAAO,WAAW,YAAY,CAAC,CAAC,KAAK,MAAM;AAC3C,QAAO,WAAW,UAAU,CAAC,CAAC,KAAK,MAAM;EACzC;AAEF,SAAgB,gBAAgB,UAAkB;AAEhD,KAAI,CAAC,YAAY,SAAS,WAAW,IAAI,IAAI,SAAS,SAAS,IAAI,IAAI,SAAS,SAAS,KAAK,CAC5F,QAAO;CAGT,MAAM,MAAM,iBAA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;AACtD,QAAO,YAAY,UAAU,aAAa,CAAC,CAAC,KAAK,MAAM;EACvD"}
1
+ {"version":3,"file":"urls.js","names":[],"sources":["../../../src/utils/urls.tsx"],"sourcesContent":["import { generateSecureRandomString } from \"./crypto\";\nimport { templateIdentity } from \"./strings\";\n\nexport function createUrlIfValid(...args: ConstructorParameters<typeof URL>) {\n try {\n return new URL(...args);\n } catch (e) {\n return null;\n }\n}\nimport.meta.vitest?.test(\"createUrlIfValid\", ({ expect }) => {\n // Test with valid URLs\n expect(createUrlIfValid(\"https://example.com\")).toBeInstanceOf(URL);\n expect(createUrlIfValid(\"https://example.com/path?query=value#hash\")).toBeInstanceOf(URL);\n expect(createUrlIfValid(\"/path\", \"https://example.com\")).toBeInstanceOf(URL);\n\n // Test with invalid URLs\n expect(createUrlIfValid(\"\")).toBeNull();\n expect(createUrlIfValid(\"not a url\")).toBeNull();\n expect(createUrlIfValid(\"http://\")).toBeNull();\n});\n\nexport function isValidUrl(url: string) {\n return !!createUrlIfValid(url);\n}\nimport.meta.vitest?.test(\"isValidUrl\", ({ expect }) => {\n // Test with valid URLs\n expect(isValidUrl(\"https://example.com\")).toBe(true);\n expect(isValidUrl(\"http://localhost:3000\")).toBe(true);\n expect(isValidUrl(\"ftp://example.com\")).toBe(true);\n\n // Test with invalid URLs\n expect(isValidUrl(\"\")).toBe(false);\n expect(isValidUrl(\"not a url\")).toBe(false);\n expect(isValidUrl(\"http://\")).toBe(false);\n});\n\nexport function isValidHostname(hostname: string) {\n // Basic validation\n if (!hostname || hostname.startsWith('.') || hostname.endsWith('.') || hostname.includes('..')) {\n return false;\n }\n\n const url = createUrlIfValid(`https://${hostname}`);\n if (!url) return false;\n return url.hostname === hostname;\n}\nimport.meta.vitest?.test(\"isValidHostname\", ({ expect }) => {\n // Test with valid hostnames\n expect(isValidHostname(\"example.com\")).toBe(true);\n expect(isValidHostname(\"localhost\")).toBe(true);\n expect(isValidHostname(\"sub.domain.example.com\")).toBe(true);\n expect(isValidHostname(\"127.0.0.1\")).toBe(true);\n\n // Test with invalid hostnames\n expect(isValidHostname(\"\")).toBe(false);\n expect(isValidHostname(\"example.com/path\")).toBe(false);\n expect(isValidHostname(\"https://example.com\")).toBe(false);\n expect(isValidHostname(\"example com\")).toBe(false);\n});\n\nexport function isValidHostnameWithWildcards(hostname: string) {\n // Empty hostnames are invalid\n if (!hostname) return false;\n\n // Check if it contains wildcards\n const hasWildcard = hostname.includes('*');\n\n if (!hasWildcard) {\n // If no wildcards, validate as a normal hostname\n return isValidHostname(hostname);\n }\n\n // Basic validation checks that apply even with wildcards\n // - Hostname cannot start or end with a dot\n if (hostname.startsWith('.') || hostname.endsWith('.')) {\n return false;\n }\n\n // - No consecutive dots\n if (hostname.includes('..')) {\n return false;\n }\n\n // For wildcard validation, check that non-wildcard parts contain valid characters\n // Replace wildcards with a valid placeholder to check the rest\n const testHostname = hostname.replace(/\\*+/g, 'wildcard');\n\n // Check if the resulting string would be a valid hostname\n if (!/^[a-zA-Z0-9.-]+$/.test(testHostname)) {\n return false;\n }\n\n // Additional check: ensure the pattern makes sense\n // Check each segment between wildcards\n const segments = hostname.split(/\\*+/);\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n if (segment === '') continue; // Empty segments are OK (consecutive wildcards)\n\n // First segment can't start with dot\n if (i === 0 && segment.startsWith('.')) {\n return false;\n }\n\n // Last segment can't end with dot\n if (i === segments.length - 1 && segment.endsWith('.')) {\n return false;\n }\n\n // No segment should have consecutive dots\n if (segment.includes('..')) {\n return false;\n }\n }\n\n return true;\n}\nimport.meta.vitest?.test(\"isValidHostnameWithWildcards\", ({ expect }) => {\n // Test with valid regular hostnames\n expect(isValidHostnameWithWildcards(\"example.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"localhost\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"sub.domain.example.com\")).toBe(true);\n\n // Test with valid wildcard hostnames\n expect(isValidHostnameWithWildcards(\"*.example.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"a-*.example.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"*.*.org\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"**.example.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"sub.**.com\")).toBe(true);\n expect(isValidHostnameWithWildcards(\"*-api.*.com\")).toBe(true);\n\n // Test with invalid hostnames\n expect(isValidHostnameWithWildcards(\"\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"example.com/path\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"https://example.com\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"example com\")).toBe(false);\n expect(isValidHostnameWithWildcards(\".example.com\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"example.com.\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"example..com\")).toBe(false);\n expect(isValidHostnameWithWildcards(\"*.example..com\")).toBe(false);\n});\n\nexport function matchHostnamePattern(pattern: string, hostname: string): boolean {\n // If no wildcards, it's an exact match\n if (!pattern.includes('*')) {\n return pattern === hostname;\n }\n\n // Convert the pattern to a regex\n // First, escape all regex special characters except *\n let regexPattern = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n // Use a placeholder for ** to handle it separately from single *\n const doubleWildcardPlaceholder = '\\x00DOUBLE_WILDCARD\\x00';\n regexPattern = regexPattern.replace(/\\*\\*/g, doubleWildcardPlaceholder);\n\n // Replace single * with a pattern that matches anything except dots\n regexPattern = regexPattern.replace(/\\*/g, '[^.]*');\n\n // Replace the double wildcard placeholder with a pattern that matches anything including dots\n regexPattern = regexPattern.replace(new RegExp(doubleWildcardPlaceholder, 'g'), '.*');\n\n // Anchor the pattern to match the entire hostname\n regexPattern = '^' + regexPattern + '$';\n\n try {\n const regex = new RegExp(regexPattern);\n return regex.test(hostname);\n } catch {\n return false;\n }\n}\nimport.meta.vitest?.test(\"matchHostnamePattern\", ({ expect }) => {\n // Test exact matches\n expect(matchHostnamePattern(\"example.com\", \"example.com\")).toBe(true);\n expect(matchHostnamePattern(\"example.com\", \"other.com\")).toBe(false);\n\n // Test single wildcard matches\n expect(matchHostnamePattern(\"*.example.com\", \"api.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"*.example.com\", \"www.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"*.example.com\", \"example.com\")).toBe(false);\n expect(matchHostnamePattern(\"*.example.com\", \"api.v2.example.com\")).toBe(false);\n\n // Test double wildcard matches\n expect(matchHostnamePattern(\"**.example.com\", \"api.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"**.example.com\", \"api.v2.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"**.example.com\", \"a.b.c.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"**.example.com\", \"example.com\")).toBe(false);\n\n // Test complex patterns\n expect(matchHostnamePattern(\"api-*.example.com\", \"api-v1.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"api-*.example.com\", \"api-v2.example.com\")).toBe(true);\n expect(matchHostnamePattern(\"api-*.example.com\", \"api.example.com\")).toBe(false);\n expect(matchHostnamePattern(\"*.*.org\", \"mail.example.org\")).toBe(true);\n expect(matchHostnamePattern(\"*.*.org\", \"example.org\")).toBe(false);\n});\n\nexport function getHardcodedFallbackUrls(primaryBaseUrl: string): string[] {\n // `defaultBaseUrl` in `@stackframe/*` SDK builds is `https://api.stack-auth.com`\n // (see `packages/template/src/lib/stack-app/apps/implementations/common.ts`).\n // The `@hexclave/*` mirror packages will get this rewritten to the hexclave\n // hostname by `scripts/rewrite-packages-to-hexclave.ts` in a follow-up PR; both\n // branches below stay listed so either build resolves its own fallback set.\n if (primaryBaseUrl === \"https://api.stack-auth.com\") {\n return [\"https://api1.stack-auth.com\", \"https://api2.stack-auth.com\"];\n }\n if (primaryBaseUrl === \"https://api.dev.stack-auth.com\") {\n return [\"https://api1.dev.stack-auth.com\", \"https://api2.dev.stack-auth.com\"];\n }\n if (primaryBaseUrl === \"https://api.hexclave.com\") {\n return [\"https://api1.hexclave.com\", \"https://api2.hexclave.com\"];\n }\n if (primaryBaseUrl === \"https://api.dev.hexclave.com\") {\n return [\"https://api1.dev.hexclave.com\", \"https://api2.dev.hexclave.com\"];\n }\n const localhostMatch = primaryBaseUrl.match(/^http:\\/\\/localhost:(\\d+)02$/);\n if (localhostMatch) {\n return [`http://localhost:${localhostMatch[1]}10`];\n }\n return [];\n}\n\nexport function getDefaultApiUrls(primaryBaseUrl: string): string[] {\n return [primaryBaseUrl, ...getHardcodedFallbackUrls(primaryBaseUrl)];\n}\n\nexport function isLocalhost(urlOrString: string | URL) {\n const url = createUrlIfValid(urlOrString);\n if (!url) return false;\n if (url.hostname === \"localhost\" || url.hostname.endsWith(\".localhost\")) return true;\n if (url.hostname.match(/^127\\.\\d+\\.\\d+\\.\\d+$/)) return true;\n if (url.hostname === \"[::1]\" || url.hostname === \"::1\") return true;\n return false;\n}\nimport.meta.vitest?.test(\"isLocalhost\", ({ expect }) => {\n // Test with localhost URLs\n expect(isLocalhost(\"http://localhost\")).toBe(true);\n expect(isLocalhost(\"https://localhost:8080\")).toBe(true);\n expect(isLocalhost(\"http://sub.localhost\")).toBe(true);\n expect(isLocalhost(\"http://127.0.0.1\")).toBe(true);\n expect(isLocalhost(\"http://127.1.2.3\")).toBe(true);\n expect(isLocalhost(\"http://[::1]\")).toBe(true);\n\n // Test with non-localhost URLs\n expect(isLocalhost(\"https://example.com\")).toBe(false);\n expect(isLocalhost(\"http://192.168.1.1\")).toBe(false);\n expect(isLocalhost(\"http://10.0.0.1\")).toBe(false);\n\n // Test with URL objects\n expect(isLocalhost(new URL(\"http://localhost\"))).toBe(true);\n expect(isLocalhost(new URL(\"https://example.com\"))).toBe(false);\n\n // Test with invalid URLs\n expect(isLocalhost(\"not a url\")).toBe(false);\n expect(isLocalhost(\"\")).toBe(false);\n});\n\nexport function isRelative(url: string) {\n const randomDomain = `${generateSecureRandomString()}.stack-auth.example.com`;\n const u = createUrlIfValid(url, `https://${randomDomain}`);\n if (!u) return false;\n if (u.host !== randomDomain) return false;\n if (u.protocol !== \"https:\") return false;\n return true;\n}\nimport.meta.vitest?.test(\"isRelative\", ({ expect }) => {\n // We can't easily mock generateSecureRandomString in this context\n // but we can still test the function's behavior\n\n // Test with relative URLs\n expect(isRelative(\"/\")).toBe(true);\n expect(isRelative(\"/path\")).toBe(true);\n expect(isRelative(\"/path?query=value#hash\")).toBe(true);\n\n // Test with absolute URLs\n expect(isRelative(\"https://example.com\")).toBe(false);\n expect(isRelative(\"http://example.com\")).toBe(false);\n expect(isRelative(\"//example.com\")).toBe(false);\n\n // Note: The implementation treats empty strings and invalid URLs as relative\n // This is because they can be resolved against a base URL\n expect(isRelative(\"\")).toBe(true);\n expect(isRelative(\"not a url\")).toBe(true);\n});\n\nexport function getRelativePart(url: URL) {\n return url.pathname + url.search + url.hash;\n}\nimport.meta.vitest?.test(\"getRelativePart\", ({ expect }) => {\n // Test with various URLs\n expect(getRelativePart(new URL(\"https://example.com\"))).toBe(\"/\");\n expect(getRelativePart(new URL(\"https://example.com/path\"))).toBe(\"/path\");\n expect(getRelativePart(new URL(\"https://example.com/path?query=value\"))).toBe(\"/path?query=value\");\n expect(getRelativePart(new URL(\"https://example.com/path#hash\"))).toBe(\"/path#hash\");\n expect(getRelativePart(new URL(\"https://example.com/path?query=value#hash\"))).toBe(\"/path?query=value#hash\");\n\n // Test with different domains but same paths\n const url1 = new URL(\"https://example.com/path?query=value#hash\");\n const url2 = new URL(\"https://different.com/path?query=value#hash\");\n expect(getRelativePart(url1)).toBe(getRelativePart(url2));\n});\n\n/**\n * A template literal tag that returns a URL.\n *\n * Any values passed are encoded.\n */\nexport function url(strings: TemplateStringsArray | readonly string[], ...values: (string | number | boolean)[]): URL {\n return new URL(urlString(strings, ...values));\n}\nimport.meta.vitest?.test(\"url\", ({ expect }) => {\n // Test with no interpolation\n expect(url`https://example.com`).toBeInstanceOf(URL);\n expect(url`https://example.com`.href).toBe(\"https://example.com/\");\n\n // Test with string interpolation\n expect(url`https://example.com/${\"path\"}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${\"path\"}`.pathname).toBe(\"/path\");\n\n // Test with number interpolation\n expect(url`https://example.com/${42}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${42}`.pathname).toBe(\"/42\");\n\n // Test with boolean interpolation\n expect(url`https://example.com/${true}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${true}`.pathname).toBe(\"/true\");\n\n // Test with special characters in interpolation\n expect(url`https://example.com/${\"path with spaces\"}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${\"path with spaces\"}`.pathname).toBe(\"/path%20with%20spaces\");\n\n // Test with multiple interpolations\n expect(url`https://example.com/${\"path\"}?query=${\"value\"}`).toBeInstanceOf(URL);\n expect(url`https://example.com/${\"path\"}?query=${\"value\"}`.pathname).toBe(\"/path\");\n expect(url`https://example.com/${\"path\"}?query=${\"value\"}`.search).toBe(\"?query=value\");\n});\n\n\n/**\n * A template literal tag that returns a URL string.\n *\n * Any values passed are encoded.\n */\nexport function urlString(strings: TemplateStringsArray | readonly string[], ...values: (string | number | boolean)[]): string {\n return templateIdentity(strings, ...values.map(encodeURIComponent));\n}\nimport.meta.vitest?.test(\"urlString\", ({ expect }) => {\n // Test with no interpolation\n expect(urlString`https://example.com`).toBe(\"https://example.com\");\n\n // Test with string interpolation\n expect(urlString`https://example.com/${\"path\"}`).toBe(\"https://example.com/path\");\n\n // Test with number interpolation\n expect(urlString`https://example.com/${42}`).toBe(\"https://example.com/42\");\n\n // Test with boolean interpolation\n expect(urlString`https://example.com/${true}`).toBe(\"https://example.com/true\");\n\n // Test with special characters in interpolation\n expect(urlString`https://example.com/${\"path with spaces\"}`).toBe(\"https://example.com/path%20with%20spaces\");\n expect(urlString`https://example.com/${\"?&=\"}`).toBe(\"https://example.com/%3F%26%3D\");\n\n // Test with multiple interpolations\n expect(urlString`https://example.com/${\"path\"}?query=${\"value\"}`).toBe(\"https://example.com/path?query=value\");\n expect(urlString`https://example.com/${\"path\"}?query=${\"value with spaces\"}`).toBe(\"https://example.com/path?query=value%20with%20spaces\");\n});\n\nexport function isChildUrl(parentUrl: URL, maybeChildUrl: URL) {\n return parentUrl.origin === maybeChildUrl.origin\n && isChildPath(parentUrl.pathname, maybeChildUrl.pathname)\n && [...parentUrl.searchParams].every(([key, value]) => maybeChildUrl.searchParams.get(key) === value)\n && (!parentUrl.hash || parentUrl.hash === maybeChildUrl.hash);\n}\nimport.meta.vitest?.test(\"isChildUrl\", ({ expect }) => {\n // true\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://abc.com/\"))).toBe(true);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://abc.com/path\"))).toBe(true);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://abc.com/path?query=value\"))).toBe(true);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://abc.com/path?query=value#hash\"))).toBe(true);\n\n // false\n expect(isChildUrl(new URL(\"https://abc.com\"), new URL(\"https://example.com\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://example.com/path\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://example.com/path?query=value\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://abc.com/\"), new URL(\"https://example.com/path?query=value#hash\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://example.com\"), new URL(\"https://abc.com/path?query=value#hash\"))).toBe(false);\n expect(isChildUrl(new URL(\"https://example.com?query=value123\"), new URL(\"https://example.com/path?query=value#hash\"))).toBe(false);\n});\n\nexport function isChildPath(parentPath: string, maybeChildPath: string) {\n parentPath = parentPath.endsWith(\"/\") ? parentPath : parentPath + \"/\";\n maybeChildPath = maybeChildPath.endsWith(\"/\") ? maybeChildPath : maybeChildPath + \"/\";\n return maybeChildPath.startsWith(parentPath);\n}\nimport.meta.vitest?.test(\"isSubPath\", ({ expect }) => {\n expect(isChildPath(\"/\", \"/\")).toBe(true);\n expect(isChildPath(\"/\", \"/path\")).toBe(true);\n expect(isChildPath(\"/path\", \"/\")).toBe(false);\n expect(isChildPath(\"/path\", \"/path\")).toBe(true);\n expect(isChildPath(\"/path/\", \"/path\")).toBe(true);\n expect(isChildPath(\"/path\", \"/path/\")).toBe(true);\n expect(isChildPath(\"/path/\", \"/path/\")).toBe(true);\n expect(isChildPath(\"/path\", \"/path/abc\")).toBe(true);\n expect(isChildPath(\"/path/\", \"/path/abc\")).toBe(true);\n expect(isChildPath(\"/path\", \"/path-abc\")).toBe(false);\n expect(isChildPath(\"/path\", \"/path-abc/\")).toBe(false);\n expect(isChildPath(\"/path/\", \"/path-abc\")).toBe(false);\n expect(isChildPath(\"/path/\", \"/path-abc/\")).toBe(false);\n});\n"],"mappings":";;;;AAGA,SAAgB,iBAAiB,GAAG,MAAyC;AAC3E,KAAI;AACF,SAAO,IAAI,IAAI,GAAG,KAAK;UAChB,GAAG;AACV,SAAO;;;CAGX,SAAW,KAAC,qBAAc,EAAA,aAAsB;AAE9C,QAAO,iBAAiB,sBAAsB,CAAC,CAAC,eAAe,IAAI;AACnE,QAAO,iBAAiB,4CAA4C,CAAC,CAAC,eAAe,IAAI;AACzF,QAAO,iBAAiB,SAAS,sBAAsB,CAAC,CAAC,eAAe,IAAI;AAG5E,QAAO,iBAAiB,GAAG,CAAC,CAAC,UAAU;AACvC,QAAO,iBAAiB,YAAY,CAAC,CAAC,UAAU;AAChD,QAAO,iBAAiB,UAAU,CAAC,CAAC,UAAU;EAC9C;AAEF,SAAgB,WAAW,KAAa;AACtC,QAAO,CAAC,CAAC,iBAAiB,IAAI;;CAEhC,SAAW,KAAC,eAAc,EAAA,aAAgB;AAExC,QAAO,WAAW,sBAAsB,CAAC,CAAC,KAAK,KAAK;AACpD,QAAO,WAAW,wBAAwB,CAAC,CAAC,KAAK,KAAK;AACtD,QAAO,WAAW,oBAAoB,CAAC,CAAC,KAAK,KAAK;AAGlD,QAAO,WAAW,GAAG,CAAC,CAAC,KAAK,MAAM;AAClC,QAAO,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AS,YAAY,CAAC,CAAC,KAAK,KAAK;AACpD,QAAO,YAAY,UAAU,YAAY,CAAC,CAAC,KAAK,KAAK;AACrD,QAAO,YAAY,SAAS,YAAY,CAAC,CAAC,KAAK,MAAM;AACrD,QAAO,YAAY,SAAS,aAAa,CAAC,CAAC,KAAK,MAAM;AACtD,QAAO,YAAY,UAAU,YAAY,CAAC,CAAC,KAAK,MAAM;AACtD,QAAO,YAAY,UAAU,aAAa,CAAC,CAAC,KAAK,MAAM;EACvD"}
@@ -1,5 +1,5 @@
1
1
  //#region src/hooks/use-hover.d.ts
2
- declare function useHover<T extends HTMLElement>(ref: React.RefObject<T>, options?: {
2
+ declare function useHover<T extends HTMLElement | null>(ref: React.RefObject<T>, options?: {
3
3
  onMouseEnter?: () => void;
4
4
  onMouseLeave?: () => void;
5
5
  }): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"use-hover.d.ts","names":[],"sources":["../../src/hooks/use-hover.tsx"],"mappings":";iBAGgB,QAAA,WAAmB,WAAA,CAAA,CACjC,GAAA,EAAK,KAAA,CAAM,SAAA,CAAU,CAAA,GACrB,OAAA;EACE,YAAA;EACA,YAAA;AAAA"}
1
+ {"version":3,"file":"use-hover.d.ts","names":[],"sources":["../../src/hooks/use-hover.tsx"],"mappings":";iBAGgB,QAAA,WAAmB,WAAA,QAAA,CACjC,GAAA,EAAK,KAAA,CAAM,SAAA,CAAU,CAAA,GACrB,OAAA;EACE,YAAA;EACA,YAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-hover.js","names":[],"sources":["../../src/hooks/use-hover.tsx"],"sourcesContent":["import { useLayoutEffect } from \"react\";\nimport { useRefState } from \"../utils/react\";\n\nexport function useHover<T extends HTMLElement>(\n ref: React.RefObject<T>,\n options: {\n onMouseEnter?: () => void,\n onMouseLeave?: () => void,\n } = {},\n): boolean {\n // Internal counter: mouseenter++ / mouseleave-- (isHovering = counter > 0)\n const counter = useRefState(0);\n\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n let incr = 0;\n let prevInside = false;\n\n const contains = (r: DOMRect, x: number, y: number) =>\n x >= r.left && x <= r.right && y >= r.top && y <= r.bottom;\n\n const enter = () => {\n incr++;\n counter.set(c => c + 1);\n if (counter.current === 1) {\n options.onMouseEnter?.();\n }\n };\n\n const leave = () => {\n incr--;\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n counter.set(c => c - 1);\n if (counter.current === 0) {\n options.onMouseLeave?.();\n }\n });\n });\n };\n\n const topMatchesTarget = (x: number, y: number) => {\n const top = document.elementFromPoint(x, y);\n return !!(top && (top === el || el.contains(top)));\n };\n\n const processPoint = (x: number, y: number) => {\n const rect = el.getBoundingClientRect();\n\n // True “hoverability”: inside rect AND not occluded by others\n const inside = contains(rect, x, y) && topMatchesTarget(x, y);\n if (inside && !prevInside) {\n enter();\n } else if (!inside && prevInside) {\n leave();\n }\n prevInside = inside;\n };\n\n const onMove = (e: PointerEvent) => {\n if (e.pointerType !== \"mouse\") return; // keep it hover-only\n // Use coalesced points when available\n const batch = e.getCoalescedEvents();\n if (batch.length) {\n for (let eventIndex = 0; eventIndex < batch.length - 1; eventIndex++) {\n const e1 = batch[eventIndex];\n const e2 = batch[eventIndex + 1];\n const steps = 10;\n for (let i = 0; i <= steps; i++) {\n processPoint(e1.clientX + (e2.clientX - e1.clientX) * i / steps, e1.clientY + (e2.clientY - e1.clientY) * i / steps);\n }\n }\n } else {\n processPoint(e.clientX, e.clientY);\n }\n };\n\n window.addEventListener(\"pointermove\", onMove, { passive: true });\n\n return () => {\n window.removeEventListener(\"pointermove\", onMove);\n counter.set(c => c - incr);\n };\n }, []);\n\n return counter.current > 0;\n}\n"],"mappings":";;;;;;AAGA,SAAgB,SACd,KACA,UAGI,EAAE,EACG;CAET,MAAM,6CAAsB,EAAE;AAE9B,kCAAsB;EACpB,MAAM,KAAK,IAAI;AACf,MAAI,CAAC,GAAI;EACT,IAAI,OAAO;EACX,IAAI,aAAa;EAEjB,MAAM,YAA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,WAAQ,KAAI,MAAK,IAAI,KAAK;;IAE3B,EAAE,CAAC;AAEN,QAAO,QAAQ,UAAU"}
1
+ {"version":3,"file":"use-hover.js","names":[],"sources":["../../src/hooks/use-hover.tsx"],"sourcesContent":["import { useLayoutEffect } from \"react\";\nimport { useRefState } from \"../utils/react\";\n\nexport function useHover<T extends HTMLElement | null>(\n ref: React.RefObject<T>,\n options: {\n onMouseEnter?: () => void,\n onMouseLeave?: () => void,\n } = {},\n): boolean {\n // Internal counter: mouseenter++ / mouseleave-- (isHovering = counter > 0)\n const counter = useRefState(0);\n\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n let incr = 0;\n let prevInside = false;\n\n const contains = (r: DOMRect, x: number, y: number) =>\n x >= r.left && x <= r.right && y >= r.top && y <= r.bottom;\n\n const enter = () => {\n incr++;\n counter.set(c => c + 1);\n if (counter.current === 1) {\n options.onMouseEnter?.();\n }\n };\n\n const leave = () => {\n incr--;\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n counter.set(c => c - 1);\n if (counter.current === 0) {\n options.onMouseLeave?.();\n }\n });\n });\n };\n\n const topMatchesTarget = (x: number, y: number) => {\n const top = document.elementFromPoint(x, y);\n return !!(top && (top === el || el.contains(top)));\n };\n\n const processPoint = (x: number, y: number) => {\n const rect = el.getBoundingClientRect();\n\n // True “hoverability”: inside rect AND not occluded by others\n const inside = contains(rect, x, y) && topMatchesTarget(x, y);\n if (inside && !prevInside) {\n enter();\n } else if (!inside && prevInside) {\n leave();\n }\n prevInside = inside;\n };\n\n const onMove = (e: PointerEvent) => {\n if (e.pointerType !== \"mouse\") return; // keep it hover-only\n // Use coalesced points when available\n const batch = e.getCoalescedEvents();\n if (batch.length) {\n for (let eventIndex = 0; eventIndex < batch.length - 1; eventIndex++) {\n const e1 = batch[eventIndex];\n const e2 = batch[eventIndex + 1];\n const steps = 10;\n for (let i = 0; i <= steps; i++) {\n processPoint(e1.clientX + (e2.clientX - e1.clientX) * i / steps, e1.clientY + (e2.clientY - e1.clientY) * i / steps);\n }\n }\n } else {\n processPoint(e.clientX, e.clientY);\n }\n };\n\n window.addEventListener(\"pointermove\", onMove, { passive: true });\n\n return () => {\n window.removeEventListener(\"pointermove\", onMove);\n counter.set(c => c - incr);\n };\n }, []);\n\n return counter.current > 0;\n}\n"],"mappings":";;;;;;AAGA,SAAgB,SACd,KACA,UAGI,EAAE,EACG;CAET,MAAM,6CAAsB,EAAE;AAE9B,kCAAsB;EACpB,MAAM,KAAK,IAAI;AACf,MAAI,CAAC,GAAI;EACT,IAAI,OAAO;EACX,IAAI,aAAa;EAEjB,MAAM,YAAY,GAAY,GAAW,MACvC,KAAK,EAAE,QAAQ,KAAK,EAAE,SAAS,KAAK,EAAE,OAAO,KAAK,EAAE;EAEtD,MAAM,cAAc;AAClB;AACA,WAAQ,KAAI,MAAK,IAAI,EAAE;AACvB,OAAI,QAAQ,YAAY,EACtB,SAAQ,gBAAgB;;EAI5B,MAAM,cAAc;AAClB;AACA,+BAA4B;AAC1B,gCAA4B;AAC1B,aAAQ,KAAI,MAAK,IAAI,EAAE;AACvB,SAAI,QAAQ,YAAY,EACtB,SAAQ,gBAAgB;MAE1B;KACF;;EAGJ,MAAM,oBAAoB,GAAW,MAAc;GACjD,MAAM,MAAM,SAAS,iBAAiB,GAAG,EAAE;AAC3C,UAAO,CAAC,EAAE,QAAQ,QAAQ,MAAM,GAAG,SAAS,IAAI;;EAGlD,MAAM,gBAAgB,GAAW,MAAc;GAI7C,MAAM,SAAS,SAHF,GAAG,uBAAuB,EAGT,GAAG,EAAE,IAAI,iBAAiB,GAAG,EAAE;AAC7D,OAAI,UAAU,CAAC,WACb,QAAO;YACE,CAAC,UAAU,WACpB,QAAO;AAET,gBAAa;;EAGf,MAAM,UAAU,MAAoB;AAClC,OAAI,EAAE,gBAAgB,QAAS;GAE/B,MAAM,QAAQ,EAAE,oBAAoB;AACpC,OAAI,MAAM,OACR,MAAK,IAAI,aAAa,GAAG,aAAa,MAAM,SAAS,GAAG,cAAc;IACpE,MAAM,KAAK,MAAM;IACjB,MAAM,KAAK,MAAM,aAAa;IAC9B,MAAM,QAAQ;AACd,SAAK,IAAI,IAAI,GAAG,KAAK,OAAO,IAC1B,cAAa,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,IAAI,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,IAAI,MAAM;;OAIxH,cAAa,EAAE,SAAS,EAAE,QAAQ;;AAItC,SAAO,iBAAiB,eAAe,QAAQ,EAAE,SAAS,MAAM,CAAC;AAEjE,eAAa;AACX,UAAO,oBAAoB,eAAe,OAAO;AACjD,WAAQ,KAAI,MAAK,IAAI,KAAK;;IAE3B,EAAE,CAAC;AAEN,QAAO,QAAQ,UAAU"}
@@ -150,4 +150,4 @@ type Base64URLString = string;
150
150
  type AuthenticatorTransportFuture = 'ble' | 'cable' | 'hybrid' | 'internal' | 'nfc' | 'smart-card' | 'usb';
151
151
  //#endregion
152
152
  export { RegistrationResponseJSON as a, PublicKeyCredentialRequestOptionsJSON as i, AuthenticatorAttestationResponseJSON as n, PublicKeyCredentialCreationOptionsJSON as r, AuthenticationResponseJSON as t };
153
- //# sourceMappingURL=index-D9ysacya.d.ts.map
153
+ //# sourceMappingURL=index-fQbeILq7.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-D9ysacya.d.ts","names":["AuthenticatorAssertionResponse","ArrayBuffer","AuthenticatorResponse","authenticatorData","signature","userHandle","AuthenticatorAttestationResponse","COSEAlgorithmIdentifier","attestationObject","getAuthenticatorData","getPublicKey","getPublicKeyAlgorithm","getTransports","AuthenticationExtensionsClientInputs","appid","credProps","hmacCreateSecret","AuthenticationExtensionsClientOutputs","CredentialPropertiesOutput","AuthenticatorSelectionCriteria","AuthenticatorAttachment","ResidentKeyRequirement","UserVerificationRequirement","authenticatorAttachment","requireResidentKey","residentKey","userVerification","Crypto","T","SubtleCrypto","ArrayBufferView","subtle","getRandomValues","array","randomUUID","PublicKeyCredential","Credential","rawId","response","getClientExtensionResults","PublicKeyCredentialCreationOptions","AttestationConveyancePreference","BufferSource","PublicKeyCredentialDescriptor","PublicKeyCredentialParameters","PublicKeyCredentialRpEntity","PublicKeyCredentialUserEntity","attestation","authenticatorSelection","challenge","excludeCredentials","extensions","pubKeyCredParams","rp","timeout","user","AuthenticatorTransport","PublicKeyCredentialType","id","transports","type","alg","PublicKeyCredentialRequestOptions","allowCredentials","rpId","PublicKeyCredentialEntity","displayName","clientDataJSON","rk","AlgorithmIdentifier","RsaOaepParams","AesCtrParams","AesCbcParams","AesGcmParams","CryptoKey","Promise","EcdhKeyDeriveParams","HkdfParams","Pbkdf2Params","AesDerivedKeyParams","HmacImportParams","KeyUsage","JsonWebKey","KeyFormat","Exclude","RsaHashedKeyGenParams","EcKeyGenParams","ReadonlyArray","CryptoKeyPair","AesKeyGenParams","HmacKeyGenParams","RsaHashedImportParams","EcKeyImportParams","AesKeyAlgorithm","RsaPssParams","EcdsaParams","decrypt","algorithm","key","data","deriveBits","baseKey","length","deriveKey","derivedKeyType","extractable","keyUsages","digest","encrypt","exportKey","format","generateKey","importKey","keyData","sign","unwrapKey","wrappedKey","unwrappingKey","unwrapAlgorithm","unwrappedKeyAlgorithm","verify","wrapKey","wrappingKey","wrapAlgorithm","name","Algorithm","label","counter","iv","additionalData","tagLength","KeyAlgorithm","KeyType","usages","public","HashAlgorithmIdentifier","hash","info","salt","iterations","RsaOtherPrimesInfo","crv","d","dp","dq","e","ext","k","key_ops","kty","n","oth","p","q","qi","use","x","y","RsaKeyGenParams","NamedCurve","namedCurve","privateKey","publicKey","saltLength","r","t","BigInteger","modulusLength","publicExponent","Uint8Array","AttestationConveyancePreference","AuthenticationExtensionsClientInputs","AuthenticationExtensionsClientOutputs","AuthenticatorAssertionResponse","AuthenticatorAttachment","AuthenticatorAttestationResponse","AuthenticatorSelectionCriteria","COSEAlgorithmIdentifier","PublicKeyCredential","PublicKeyCredentialCreationOptions","PublicKeyCredentialDescriptor","PublicKeyCredentialParameters","PublicKeyCredentialRequestOptions","PublicKeyCredentialRpEntity","PublicKeyCredentialType","UserVerificationRequirement","AuthenticatorTransport","Crypto","PublicKeyCredentialUserEntity","PublicKeyCredentialCreationOptionsJSON","PublicKeyCredentialUserEntityJSON","Base64URLString","PublicKeyCredentialDescriptorJSON","rp","user","challenge","pubKeyCredParams","timeout","excludeCredentials","authenticatorSelection","attestation","extensions","PublicKeyCredentialRequestOptionsJSON","rpId","allowCredentials","userVerification","AuthenticatorTransportFuture","id","type","transports","name","displayName","RegistrationCredential","AuthenticatorAttestationResponseFuture","PublicKeyCredentialFuture","response","RegistrationResponseJSON","AuthenticatorAttestationResponseJSON","rawId","authenticatorAttachment","clientExtensionResults","AuthenticationCredential","AuthenticationResponseJSON","AuthenticatorAssertionResponseJSON","clientDataJSON","attestationObject","authenticatorData","publicKeyAlgorithm","publicKey","signature","userHandle","WebAuthnCredential","Uint8Array","counter","getTransports","PublicKeyCredentialDescriptorFuture","Omit","PublicKeyCredentialJSON","Promise","isConditionalMediationAvailable","parseCreationOptionsFromJSON","options","parseRequestOptionsFromJSON","toJSON","CredentialDeviceType"],"sources":["../../../node_modules/.pnpm/@simplewebauthn+types@11.0.0/node_modules/@simplewebauthn/types/types/dom.d.ts","../../../node_modules/.pnpm/@simplewebauthn+types@11.0.0/node_modules/@simplewebauthn/types/types/index.d.ts"],"x_google_ignoreList":[0,1],"mappings":";UAgCiBa,oCAAAA;EACbC,KAAAA;EACAC,SAAAA;EACAC,gBAAAA;AAAAA;AAAAA,UAEaC,qCAAAA;EACbH,KAAAA;EACAC,SAAAA,GAAYG,0BAAAA;EACZF,gBAAAA;AAAAA;AAAAA,UAEaG,8BAAAA;EACbI,uBAAAA,GAA0BH,uBAAAA;EAC1BI,kBAAAA;EACAC,WAAAA,GAAcJ,sBAAAA;EACdK,gBAAAA,GAAmBJ,2BAAAA;AAAAA;AAAAA,UAqDNsB,6BAAAA;EACbiB,GAAAA,EAAKtD,uBAAAA;EACLqD,IAAAA,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AAA;;;ADuOV;;;;UCzNiBsC,0BAAAA;EACbf,EAAAA,EAAIhB,eAAAA;EACJ2B,KAAAA,EAAO3B,eAAAA;EACPwB,QAAAA,EAAUQ,kCAAAA;EACVJ,uBAAAA,GAA0B7C,uBAAAA;EAC1B8C,sBAAAA,EAAwBhD,qCAAAA;EACxBoC,IAAAA,EAAMxB,uBAAAA;AAAAA;;AA7EV;;;;;UAqFiBiC,oCAAAA;EACbO,cAAAA,EAAgBjC,eAAAA;EAChBkC,iBAAAA,EAAmBlC,eAAAA;EACnBmC,iBAAAA,GAAoBnC,eAAAA;EACpBkB,UAAAA,GAAaH,4BAAAA;EACbqB,kBAAAA,GAAqBlD,uBAAAA;EACrBmD,SAAAA,GAAYrC,eAAAA;AAAAA;;;;;;;UAQCgC,kCAAAA;EACbC,cAAAA,EAAgBjC,eAAAA;EAChBmC,iBAAAA,EAAmBnC,eAAAA;EACnBsC,SAAAA,EAAWtC,eAAAA;EACXuC,UAAAA,GAAavC,eAAAA;AAAAA;;;;KAcLA,eAAAA;;;;AA3FZ;;KA6GYe,4BAAAA"}
1
+ {"version":3,"file":"index-fQbeILq7.d.ts","names":["AuthenticatorAssertionResponse","ArrayBuffer","AuthenticatorResponse","authenticatorData","signature","userHandle","AuthenticatorAttestationResponse","COSEAlgorithmIdentifier","attestationObject","getAuthenticatorData","getPublicKey","getPublicKeyAlgorithm","getTransports","AuthenticationExtensionsClientInputs","appid","credProps","hmacCreateSecret","AuthenticationExtensionsClientOutputs","CredentialPropertiesOutput","AuthenticatorSelectionCriteria","AuthenticatorAttachment","ResidentKeyRequirement","UserVerificationRequirement","authenticatorAttachment","requireResidentKey","residentKey","userVerification","Crypto","T","SubtleCrypto","ArrayBufferView","subtle","getRandomValues","array","randomUUID","PublicKeyCredential","Credential","rawId","response","getClientExtensionResults","PublicKeyCredentialCreationOptions","AttestationConveyancePreference","BufferSource","PublicKeyCredentialDescriptor","PublicKeyCredentialParameters","PublicKeyCredentialRpEntity","PublicKeyCredentialUserEntity","attestation","authenticatorSelection","challenge","excludeCredentials","extensions","pubKeyCredParams","rp","timeout","user","AuthenticatorTransport","PublicKeyCredentialType","id","transports","type","alg","PublicKeyCredentialRequestOptions","allowCredentials","rpId","PublicKeyCredentialEntity","displayName","clientDataJSON","rk","AlgorithmIdentifier","RsaOaepParams","AesCtrParams","AesCbcParams","AesGcmParams","CryptoKey","Promise","EcdhKeyDeriveParams","HkdfParams","Pbkdf2Params","AesDerivedKeyParams","HmacImportParams","KeyUsage","JsonWebKey","KeyFormat","Exclude","RsaHashedKeyGenParams","EcKeyGenParams","ReadonlyArray","CryptoKeyPair","AesKeyGenParams","HmacKeyGenParams","RsaHashedImportParams","EcKeyImportParams","AesKeyAlgorithm","RsaPssParams","EcdsaParams","decrypt","algorithm","key","data","deriveBits","baseKey","length","deriveKey","derivedKeyType","extractable","keyUsages","digest","encrypt","exportKey","format","generateKey","importKey","keyData","sign","unwrapKey","wrappedKey","unwrappingKey","unwrapAlgorithm","unwrappedKeyAlgorithm","verify","wrapKey","wrappingKey","wrapAlgorithm","name","Algorithm","label","counter","iv","additionalData","tagLength","KeyAlgorithm","KeyType","usages","public","HashAlgorithmIdentifier","hash","info","salt","iterations","RsaOtherPrimesInfo","crv","d","dp","dq","e","ext","k","key_ops","kty","n","oth","p","q","qi","use","x","y","RsaKeyGenParams","NamedCurve","namedCurve","privateKey","publicKey","saltLength","r","t","BigInteger","modulusLength","publicExponent","Uint8Array","AttestationConveyancePreference","AuthenticationExtensionsClientInputs","AuthenticationExtensionsClientOutputs","AuthenticatorAssertionResponse","AuthenticatorAttachment","AuthenticatorAttestationResponse","AuthenticatorSelectionCriteria","COSEAlgorithmIdentifier","PublicKeyCredential","PublicKeyCredentialCreationOptions","PublicKeyCredentialDescriptor","PublicKeyCredentialParameters","PublicKeyCredentialRequestOptions","PublicKeyCredentialRpEntity","PublicKeyCredentialType","UserVerificationRequirement","AuthenticatorTransport","Crypto","PublicKeyCredentialUserEntity","PublicKeyCredentialCreationOptionsJSON","PublicKeyCredentialUserEntityJSON","Base64URLString","PublicKeyCredentialDescriptorJSON","rp","user","challenge","pubKeyCredParams","timeout","excludeCredentials","authenticatorSelection","attestation","extensions","PublicKeyCredentialRequestOptionsJSON","rpId","allowCredentials","userVerification","AuthenticatorTransportFuture","id","type","transports","name","displayName","RegistrationCredential","AuthenticatorAttestationResponseFuture","PublicKeyCredentialFuture","response","RegistrationResponseJSON","AuthenticatorAttestationResponseJSON","rawId","authenticatorAttachment","clientExtensionResults","AuthenticationCredential","AuthenticationResponseJSON","AuthenticatorAssertionResponseJSON","clientDataJSON","attestationObject","authenticatorData","publicKeyAlgorithm","publicKey","signature","userHandle","WebAuthnCredential","Uint8Array","counter","getTransports","PublicKeyCredentialDescriptorFuture","Omit","PublicKeyCredentialJSON","Promise","isConditionalMediationAvailable","parseCreationOptionsFromJSON","options","parseRequestOptionsFromJSON","toJSON","CredentialDeviceType"],"sources":["../../../node_modules/.pnpm/@simplewebauthn+types@11.0.0/node_modules/@simplewebauthn/types/types/dom.d.ts","../../../node_modules/.pnpm/@simplewebauthn+types@11.0.0/node_modules/@simplewebauthn/types/types/index.d.ts"],"x_google_ignoreList":[0,1],"mappings":";UAgCiBa,oCAAAA;EACbC,KAAAA;EACAC,SAAAA;EACAC,gBAAAA;AAAAA;AAAAA,UAEaC,qCAAAA;EACbH,KAAAA;EACAC,SAAAA,GAAYG,0BAAAA;EACZF,gBAAAA;AAAAA;AAAAA,UAEaG,8BAAAA;EACbI,uBAAAA,GAA0BH,uBAAAA;EAC1BI,kBAAAA;EACAC,WAAAA,GAAcJ,sBAAAA;EACdK,gBAAAA,GAAmBJ,2BAAAA;AAAAA;AAAAA,UAqDNsB,6BAAAA;EACbiB,GAAAA,EAAKtD,uBAAAA;EACLqD,IAAAA,EAAMH,uBAAAA;AAAAA;AAAAA,UAuBOvC,0BAAAA;EACbkD,EAAAA;AAAAA;AAAAA,UAiDavB,2BAAAA,SAAoCoB,yBAAAA;EACjDP,EAAAA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AA;EACVJ,uBAAAA,GAA0B7C,uBAAAA;EAC1B8C,sBAAAA,EAAwBhD,qCAAAA;EACxBoC,IAAAA,EAAMxB,uBAAAA;AAAAA;;AA7EV;;;;;UAqFiBiC,oCAAAA;EACbO,cAAAA,EAAgBjC,eAAAA;EAChBkC,iBAAAA,EAAmBlC,eAAAA;EACnBmC,iBAAAA,GAAoBnC,eAAAA;EACpBkB,UAAAA,GAAaH,4BAAAA;EACbqB,kBAAAA,GAAqBlD,uBAAAA;EACrBmD,SAAAA,GAAYrC,eAAAA;AAAAA;;;;;;;UAQCgC,kCAAAA;EACbC,cAAAA,EAAgBjC,eAAAA;EAChBmC,iBAAAA,EAAmBnC,eAAAA;EACnBsC,SAAAA,EAAWtC,eAAAA;EACXuC,UAAAA,GAAavC,eAAAA;AAAAA;;;;KAcLA,eAAAA;;;;AA3FZ;;KA6GYe,4BAAAA"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('../chunk-BE-pF4vm.js');
3
3
  let ___utils_results_js = require("../utils/results.js");
4
- let ___known_errors_js = require("../known-errors.js");
5
4
  let ___utils_urls_js = require("../utils/urls.js");
5
+ let ___known_errors_js = require("../known-errors.js");
6
6
  let __server_interface_js = require("./server-interface.js");
7
7
 
8
8
  //#region src/interface/admin-interface.ts
@@ -150,16 +150,16 @@ declare const MetricsEmailOverviewSchema: yup.ObjectSchema<{
150
150
  activity: number;
151
151
  }[];
152
152
  daily_emails_by_status: {
153
- date: string;
154
153
  ok: number;
155
154
  error: number;
155
+ date: string;
156
156
  in_progress: number;
157
157
  }[];
158
158
  emails_sent: number;
159
159
  recent_emails: {
160
160
  id: string;
161
- subject: string;
162
161
  status: string;
162
+ subject: string;
163
163
  created_at_millis: number;
164
164
  }[];
165
165
  deliverability_status: {
@@ -310,8 +310,8 @@ declare const UserActivityResponseBodySchema: yup.ObjectSchema<{
310
310
  data_points: undefined;
311
311
  }, "">;
312
312
  declare const MetricsActiveUsersByCountrySchema: yup.MixedSchema<Record<string, {
313
- display_name: string | null;
314
313
  id: string;
314
+ display_name: string | null;
315
315
  primary_email: string | null;
316
316
  profile_image_url: string | null;
317
317
  signed_up_at_millis: number;
@@ -330,24 +330,24 @@ declare const MetricsResponseBodySchema: yup.ObjectSchema<{
330
330
  }[];
331
331
  users_by_country: Record<string, number>;
332
332
  active_users_by_country: Record<string, {
333
- display_name: string | null;
334
333
  id: string;
334
+ display_name: string | null;
335
335
  primary_email: string | null;
336
336
  profile_image_url: string | null;
337
337
  signed_up_at_millis: number;
338
338
  last_active_at_millis: number | null;
339
339
  }[]>;
340
340
  recently_registered: {
341
- display_name: string | null;
342
341
  id: string;
342
+ display_name: string | null;
343
343
  primary_email: string | null;
344
344
  profile_image_url: string | null;
345
345
  signed_up_at_millis: number;
346
346
  last_active_at_millis: number | null;
347
347
  }[];
348
348
  recently_active: {
349
- display_name: string | null;
350
349
  id: string;
350
+ display_name: string | null;
351
351
  primary_email: string | null;
352
352
  profile_image_url: string | null;
353
353
  signed_up_at_millis: number;
@@ -422,16 +422,16 @@ declare const MetricsResponseBodySchema: yup.ObjectSchema<{
422
422
  emails_by_status: Record<string, number>;
423
423
  total_emails: number;
424
424
  daily_emails_by_status: {
425
- date: string;
426
425
  ok: number;
427
426
  error: number;
427
+ date: string;
428
428
  in_progress: number;
429
429
  }[];
430
430
  emails_sent: number;
431
431
  recent_emails: {
432
432
  id: string;
433
- subject: string;
434
433
  status: string;
434
+ subject: string;
435
435
  created_at_millis: number;
436
436
  }[];
437
437
  deliverability_status: {
@@ -6,7 +6,7 @@ import { AccessToken, InternalSession, RefreshToken } from "../sessions.js";
6
6
  import { ProjectPermissionsCrud } from "./crud/project-permissions.js";
7
7
  import { AdminUserProjectsCrud, ClientProjectsCrud } from "./crud/projects.js";
8
8
  import { TeamPermissionsCrud } from "./crud/team-permissions.js";
9
- import { a as RegistrationResponseJSON, i as PublicKeyCredentialRequestOptionsJSON, r as PublicKeyCredentialCreationOptionsJSON, t as AuthenticationResponseJSON } from "../index-D9ysacya.js";
9
+ import { a as RegistrationResponseJSON, i as PublicKeyCredentialRequestOptionsJSON, r as PublicKeyCredentialCreationOptionsJSON, t as AuthenticationResponseJSON } from "../index-fQbeILq7.js";
10
10
  import { ConnectedAccountAccessTokenCrud, ConnectedAccountCrud } from "./crud/connected-accounts.js";
11
11
  import { ContactChannelsCrud } from "./crud/contact-channels.js";
12
12
  import { CurrentUserCrud } from "./crud/current-user.js";
@@ -5,8 +5,8 @@ let ___utils_objects_js = require("../utils/objects.js");
5
5
  let ___utils_strings_js = require("../utils/strings.js");
6
6
  let ___utils_oauth_js = require("../utils/oauth.js");
7
7
  let ___utils_results_js = require("../utils/results.js");
8
- let ___known_errors_js = require("../known-errors.js");
9
8
  let ___utils_urls_js = require("../utils/urls.js");
9
+ let ___known_errors_js = require("../known-errors.js");
10
10
  let ___sessions_js = require("../sessions.js");
11
11
  let ___utils_crypto_js = require("../utils/crypto.js");
12
12
  let ___utils_globals_js = require("../utils/globals.js");
@@ -139,8 +139,8 @@ declare const conversationMessageSchema: yup$1.ObjectSchema<{
139
139
  createdAt: string;
140
140
  sender: {
141
141
  type: "user" | "agent" | "system";
142
- displayName: string | null;
143
142
  id: string | null;
143
+ displayName: string | null;
144
144
  primaryEmail: string | null;
145
145
  };
146
146
  }, yup$1.AnyObject, {
@@ -173,19 +173,7 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
173
173
  lastOutboundAt?: string | null | undefined;
174
174
  closedAt?: string | null | undefined;
175
175
  recordMetadata?: {} | null | undefined;
176
- conversationId: string;
177
- userId: string | null;
178
- teamId: string | null;
179
- userDisplayName: string | null;
180
- userPrimaryEmail: string | null;
181
- userProfileImageUrl: string | null;
182
- subject: string;
183
- status: "pending" | "open" | "closed";
184
- priority: "low" | "normal" | "high" | "urgent";
185
176
  source: "email" | "manual" | "chat" | "api";
186
- lastMessageType: "message" | "internal-note" | "status-change";
187
- preview: string | null;
188
- lastActivityAt: string;
189
177
  metadata: {
190
178
  assignedToUserId: string | null;
191
179
  assignedToDisplayName: string | null;
@@ -196,6 +184,18 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
196
184
  lastCustomerReplyAt: string | null;
197
185
  lastAgentReplyAt: string | null;
198
186
  };
187
+ status: "pending" | "open" | "closed";
188
+ subject: string;
189
+ conversationId: string;
190
+ userId: string | null;
191
+ teamId: string | null;
192
+ userDisplayName: string | null;
193
+ userPrimaryEmail: string | null;
194
+ userProfileImageUrl: string | null;
195
+ priority: "low" | "normal" | "high" | "urgent";
196
+ lastMessageType: "message" | "internal-note" | "status-change";
197
+ preview: string | null;
198
+ lastActivityAt: string;
199
199
  }[];
200
200
  hasMore: boolean;
201
201
  }, yup$1.AnyObject, {
@@ -211,19 +211,7 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
211
211
  lastOutboundAt?: string | null | undefined;
212
212
  closedAt?: string | null | undefined;
213
213
  recordMetadata?: {} | null | undefined;
214
- conversationId: string;
215
- userId: string | null;
216
- teamId: string | null;
217
- userDisplayName: string | null;
218
- userPrimaryEmail: string | null;
219
- userProfileImageUrl: string | null;
220
- subject: string;
221
- status: "pending" | "open" | "closed";
222
- priority: "low" | "normal" | "high" | "urgent";
223
214
  source: "email" | "manual" | "chat" | "api";
224
- lastMessageType: "message" | "internal-note" | "status-change";
225
- preview: string | null;
226
- lastActivityAt: string;
227
215
  metadata: {
228
216
  assignedToUserId: string | null;
229
217
  assignedToDisplayName: string | null;
@@ -234,31 +222,43 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
234
222
  lastCustomerReplyAt: string | null;
235
223
  lastAgentReplyAt: string | null;
236
224
  };
225
+ status: "pending" | "open" | "closed";
226
+ subject: string;
227
+ conversationId: string;
228
+ userId: string | null;
229
+ teamId: string | null;
230
+ userDisplayName: string | null;
231
+ userPrimaryEmail: string | null;
232
+ userProfileImageUrl: string | null;
233
+ priority: "low" | "normal" | "high" | "urgent";
234
+ lastMessageType: "message" | "internal-note" | "status-change";
235
+ preview: string | null;
236
+ lastActivityAt: string;
237
237
  };
238
238
  messages: {
239
+ body: string | null;
240
+ source: "email" | "manual" | "chat" | "api";
241
+ metadata: {} | null;
239
242
  id: string;
243
+ status: "pending" | "open" | "closed";
244
+ subject: string;
240
245
  conversationId: string;
241
246
  userId: string | null;
242
247
  teamId: string | null;
243
- subject: string;
244
- status: "pending" | "open" | "closed";
245
248
  priority: "low" | "normal" | "high" | "urgent";
246
- source: "email" | "manual" | "chat" | "api";
247
- metadata: {} | null;
248
249
  createdAt: string;
249
250
  messageType: "message" | "internal-note" | "status-change";
250
- body: string | null;
251
251
  attachments: {}[];
252
252
  sender: {
253
253
  type: "user" | "agent" | "system";
254
- displayName: string | null;
255
254
  id: string | null;
255
+ displayName: string | null;
256
256
  primaryEmail: string | null;
257
257
  };
258
258
  }[];
259
259
  entryPoints: {
260
- id: string;
261
260
  metadata: {} | null;
261
+ id: string;
262
262
  createdAt: string;
263
263
  updatedAt: string;
264
264
  channelType: string;
@@ -11,14 +11,14 @@ declare const currentUserCrud: CrudSchemaFromOptions<{
11
11
  type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
12
12
  } | null;
13
13
  requires_totp_mfa: boolean;
14
- display_name: string | null;
15
- client_metadata: {} | null;
16
- client_read_only_metadata: {} | null;
17
14
  id: string;
15
+ display_name: string | null;
18
16
  primary_email: string | null;
19
- primary_email_verified: boolean;
20
17
  profile_image_url: string | null;
21
18
  signed_up_at_millis: number;
19
+ client_metadata: {} | null;
20
+ client_read_only_metadata: {} | null;
21
+ primary_email_verified: boolean;
22
22
  has_password: boolean;
23
23
  otp_auth_enabled: boolean;
24
24
  passkey_auth_enabled: boolean;
@@ -34,8 +34,8 @@ declare const currentUserCrud: CrudSchemaFromOptions<{
34
34
  selected_team: {
35
35
  client_metadata?: {} | null | undefined;
36
36
  client_read_only_metadata?: {} | null | undefined;
37
- display_name: string;
38
37
  id: string;
38
+ display_name: string;
39
39
  profile_image_url: string | null;
40
40
  } | null;
41
41
  }, yup$1.AnyObject, {
@@ -90,10 +90,10 @@ declare const currentUserCrud: CrudSchemaFromOptions<{
90
90
  client_metadata?: {} | null | undefined;
91
91
  client_read_only_metadata?: {} | null | undefined;
92
92
  server_metadata?: {} | null | undefined;
93
- display_name: string;
94
93
  id: string;
95
- profile_image_url: string | null;
96
94
  created_at_millis: number;
95
+ display_name: string;
96
+ profile_image_url: string | null;
97
97
  } | null;
98
98
  selected_team_id: string | null;
99
99
  profile_image_url: string | null;
@@ -174,9 +174,9 @@ declare const currentUserCrud: CrudSchemaFromOptions<{
174
174
  clientUpdateSchema: yup$1.ObjectSchema<{
175
175
  selected_team_id: string | null | undefined;
176
176
  display_name: string | null | undefined;
177
- client_metadata: {} | null | undefined;
178
177
  primary_email: string | null | undefined;
179
178
  profile_image_url: string | null | undefined;
179
+ client_metadata: {} | null | undefined;
180
180
  otp_auth_enabled: boolean | undefined;
181
181
  passkey_auth_enabled: boolean | undefined;
182
182
  totp_secret_base64: string | null | undefined;