@hexclave/next 1.0.75 → 1.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{admin-app-impl-sTQD2d-3.d.ts → admin-app-impl-CxDpE89P.d.ts} +12 -10
- package/dist/admin-app-impl-CxDpE89P.d.ts.map +1 -0
- package/dist/clickmap/clickmap-core.d.ts +1 -1
- package/dist/clickmap/index.d.ts +1 -1
- package/dist/{client-app-BCT5p_70.d.ts → client-app-wFodsYml.d.ts} +4 -1
- package/dist/client-app-wFodsYml.d.ts.map +1 -0
- package/dist/common-BK_sydxF.d.ts.map +1 -1
- package/dist/components/elements/sidebar-layout.d.ts.map +1 -1
- package/dist/components/elements/sidebar-layout.js +12 -2
- package/dist/components/elements/sidebar-layout.js.map +1 -1
- package/dist/components/selected-team-switcher.d.ts +1 -1
- package/dist/components/team-icon.d.ts +1 -1
- package/dist/components/team-switcher.d.ts +1 -1
- package/dist/components-page/account-settings/payments/payments-page.d.ts +1 -1
- package/dist/components-page/account-settings/teams/leave-team-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-api-keys-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-display-name-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-member-invitation-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-member-list-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-page.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-profile-image-section.d.ts +1 -1
- package/dist/components-page/account-settings/teams/team-profile-user-section.d.ts +1 -1
- package/dist/components-page/hexclave-handler-client.d.ts +1 -1
- package/dist/components-page/hexclave-handler.d.ts +1 -1
- package/dist/components-page/team-invitation-cache.d.ts +5 -0
- package/dist/components-page/team-invitation-cache.d.ts.map +1 -0
- package/dist/components-page/team-invitation-cache.js +12 -0
- package/dist/components-page/team-invitation-cache.js.map +1 -0
- package/dist/components-page/team-invitation-cache.test.d.ts +1 -0
- package/dist/components-page/team-invitation-cache.test.js +23 -0
- package/dist/components-page/team-invitation-cache.test.js.map +1 -0
- package/dist/components-page/team-invitation.js +8 -7
- package/dist/components-page/team-invitation.js.map +1 -1
- package/dist/dev-tool/dev-tool-core.d.ts +1 -1
- package/dist/dev-tool/dev-tool-core.d.ts.map +1 -1
- package/dist/dev-tool/dev-tool-core.js +2 -2
- package/dist/dev-tool/dev-tool-core.js.map +1 -1
- package/dist/dev-tool/index.d.ts +1 -1
- package/dist/dev-tool/index.d.ts.map +1 -1
- package/dist/dev-tool/index.js +2 -8
- package/dist/dev-tool/index.js.map +1 -1
- package/dist/esm/components/elements/sidebar-layout.d.ts.map +1 -1
- package/dist/esm/components/elements/sidebar-layout.js +12 -2
- package/dist/esm/components/elements/sidebar-layout.js.map +1 -1
- package/dist/esm/components-page/team-invitation-cache.d.ts +5 -0
- package/dist/esm/components-page/team-invitation-cache.d.ts.map +1 -0
- package/dist/esm/components-page/team-invitation-cache.js +11 -0
- package/dist/esm/components-page/team-invitation-cache.js.map +1 -0
- package/dist/esm/components-page/team-invitation-cache.test.d.ts +1 -0
- package/dist/esm/components-page/team-invitation-cache.test.js +24 -0
- package/dist/esm/components-page/team-invitation-cache.test.js.map +1 -0
- package/dist/esm/components-page/team-invitation.d.ts.map +1 -1
- package/dist/esm/components-page/team-invitation.js +8 -7
- package/dist/esm/components-page/team-invitation.js.map +1 -1
- package/dist/esm/dev-tool/dev-tool-core.d.ts.map +1 -1
- package/dist/esm/dev-tool/dev-tool-core.js +1 -1
- package/dist/esm/dev-tool/dev-tool-core.js.map +1 -1
- package/dist/esm/dev-tool/index.d.ts.map +1 -1
- package/dist/esm/dev-tool/index.js +2 -8
- package/dist/esm/dev-tool/index.js.map +1 -1
- package/dist/esm/generated/quetzal-translations.d.ts +2 -2
- package/dist/esm/in-page-ui/dev-environment.d.ts +5 -0
- package/dist/esm/in-page-ui/dev-environment.d.ts.map +1 -0
- package/dist/esm/in-page-ui/dev-environment.js +18 -0
- package/dist/esm/in-page-ui/dev-environment.js.map +1 -0
- package/dist/esm/in-page-ui/issue-card.d.ts +52 -0
- package/dist/esm/in-page-ui/issue-card.d.ts.map +1 -0
- package/dist/esm/in-page-ui/issue-card.js +392 -0
- package/dist/esm/in-page-ui/issue-card.js.map +1 -0
- package/dist/esm/in-page-ui/issue-card.test.d.ts +1 -0
- package/dist/esm/in-page-ui/issue-card.test.js +60 -0
- package/dist/esm/in-page-ui/issue-card.test.js.map +1 -0
- package/dist/esm/in-page-ui/logo.d.ts +5 -0
- package/dist/esm/in-page-ui/logo.d.ts.map +1 -0
- package/dist/esm/in-page-ui/logo.js +6 -0
- package/dist/esm/in-page-ui/logo.js.map +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +4 -4
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.automatic-side-effects.test.js +30 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.automatic-side-effects.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +140 -15
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +5 -3
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js +184 -28
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.sign-out.test.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.sign-out.test.js +83 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.sign-out.test.js.map +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.untrusted-redirect-card.test.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.untrusted-redirect-card.test.js +120 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.untrusted-redirect-card.test.js.map +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/common.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js +4 -3
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/index.d.ts +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/index.js +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/redirect-page-urls.test.js +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/redirect-page-urls.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js +1 -1
- package/dist/esm/lib/hexclave-app/teams/index.d.ts +3 -0
- package/dist/esm/lib/hexclave-app/teams/index.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/teams/index.js.map +1 -1
- package/dist/esm/pushed-config-error-overlay/index.d.ts.map +1 -1
- package/dist/esm/pushed-config-error-overlay/index.js +42 -343
- package/dist/esm/pushed-config-error-overlay/index.js.map +1 -1
- package/dist/esm/setup-error-overlay/index.d.ts +16 -0
- package/dist/esm/setup-error-overlay/index.d.ts.map +1 -0
- package/dist/esm/setup-error-overlay/index.js +106 -0
- package/dist/esm/setup-error-overlay/index.js.map +1 -0
- package/dist/esm/setup-error-overlay/index.test.d.ts +1 -0
- package/dist/esm/setup-error-overlay/index.test.js +125 -0
- package/dist/esm/setup-error-overlay/index.test.js.map +1 -0
- package/dist/esm/utils/monkey-patch.d.ts +7 -0
- package/dist/esm/utils/monkey-patch.d.ts.map +1 -0
- package/dist/esm/utils/monkey-patch.js +20 -0
- package/dist/esm/utils/monkey-patch.js.map +1 -0
- package/dist/esm/utils/react.d.ts +17 -0
- package/dist/esm/utils/react.d.ts.map +1 -0
- package/dist/esm/utils/react.js +60 -0
- package/dist/esm/utils/react.js.map +1 -0
- package/dist/generated/quetzal-translations.d.ts +1 -1
- package/dist/{hexclave-provider-BKxi3Vy-.d.ts → hexclave-provider-CMz2mt4I.d.ts} +3 -3
- package/dist/{hexclave-provider-BKxi3Vy-.d.ts.map → hexclave-provider-CMz2mt4I.d.ts.map} +1 -1
- package/dist/{hooks-CUe5bc3s.d.ts → hooks-CUHt4Y9C.d.ts} +2 -2
- package/dist/{hooks-CUe5bc3s.d.ts.map → hooks-CUHt4Y9C.d.ts.map} +1 -1
- package/dist/in-page-ui/dev-environment.d.ts +5 -0
- package/dist/in-page-ui/dev-environment.d.ts.map +1 -0
- package/dist/in-page-ui/dev-environment.js +19 -0
- package/dist/in-page-ui/dev-environment.js.map +1 -0
- package/dist/in-page-ui/issue-card.d.ts +52 -0
- package/dist/in-page-ui/issue-card.d.ts.map +1 -0
- package/dist/in-page-ui/issue-card.js +397 -0
- package/dist/in-page-ui/issue-card.js.map +1 -0
- package/dist/in-page-ui/issue-card.test.d.ts +1 -0
- package/dist/in-page-ui/issue-card.test.js +59 -0
- package/dist/in-page-ui/issue-card.test.js.map +1 -0
- package/dist/in-page-ui/logo.d.ts +5 -0
- package/dist/in-page-ui/logo.d.ts.map +1 -0
- package/dist/in-page-ui/logo.js +7 -0
- package/dist/in-page-ui/logo.js.map +1 -0
- package/dist/{index-CvB7XacB.d.ts → index-fR0LkUK7.d.ts} +2 -2
- package/dist/{index-CvB7XacB.d.ts.map → index-fR0LkUK7.d.ts.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.automatic-side-effects.test.js +29 -0
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.automatic-side-effects.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +140 -15
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +2 -2
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js +182 -25
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.sign-out.test.d.ts +1 -0
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.sign-out.test.js +82 -0
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.sign-out.test.js.map +1 -0
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.untrusted-redirect-card.test.d.ts +1 -0
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.untrusted-redirect-card.test.js +119 -0
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.untrusted-redirect-card.test.js.map +1 -0
- package/dist/lib/hexclave-app/apps/implementations/common.js +4 -3
- package/dist/lib/hexclave-app/apps/implementations/common.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/index.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/index.js +1 -1
- package/dist/lib/hexclave-app/apps/implementations/redirect-page-urls.test.js +1 -0
- package/dist/lib/hexclave-app/apps/implementations/redirect-page-urls.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js +1 -1
- package/dist/lib/hexclave-app/apps/index.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/server-app.d.ts +1 -1
- package/dist/lib/hexclave-app/index.d.ts +1 -1
- package/dist/lib/hexclave-app/projects/index.d.ts +1 -1
- package/dist/lib/hexclave-app/teams/index.d.ts +1 -1
- package/dist/lib/hexclave-app/teams/index.js.map +1 -1
- package/dist/lib/hexclave-app/users/index.d.ts +1 -1
- package/dist/lib/hooks.d.ts +1 -1
- package/dist/providers/hexclave-context.d.ts +1 -1
- package/dist/providers/hexclave-provider-client.d.ts +1 -1
- package/dist/providers/hexclave-provider.d.ts +1 -1
- package/dist/providers/translation-provider.d.ts +1 -1
- package/dist/pushed-config-error-overlay/index.d.ts +1 -1
- package/dist/pushed-config-error-overlay/index.d.ts.map +1 -1
- package/dist/pushed-config-error-overlay/index.js +41 -342
- package/dist/pushed-config-error-overlay/index.js.map +1 -1
- package/dist/{quetzal-translations-XeH3zQ9l.d.ts → quetzal-translations-B2jT2SWm.d.ts} +3 -3
- package/dist/{quetzal-translations-XeH3zQ9l.d.ts.map → quetzal-translations-B2jT2SWm.d.ts.map} +1 -1
- package/dist/setup-error-overlay/index.d.ts +16 -0
- package/dist/setup-error-overlay/index.d.ts.map +1 -0
- package/dist/setup-error-overlay/index.js +108 -0
- package/dist/setup-error-overlay/index.js.map +1 -0
- package/dist/setup-error-overlay/index.test.d.ts +1 -0
- package/dist/setup-error-overlay/index.test.js +124 -0
- package/dist/setup-error-overlay/index.test.js.map +1 -0
- package/dist/team-invitation-B5Ol7vdd.d.ts.map +1 -1
- package/dist/{translation-provider-WOaZXqAz.d.ts → translation-provider-6505O9P2.d.ts} +2 -2
- package/dist/{translation-provider-WOaZXqAz.d.ts.map → translation-provider-6505O9P2.d.ts.map} +1 -1
- package/dist/utils/monkey-patch.d.ts +7 -0
- package/dist/utils/monkey-patch.d.ts.map +1 -0
- package/dist/utils/monkey-patch.js +23 -0
- package/dist/utils/monkey-patch.js.map +1 -0
- package/dist/utils/react.d.ts +17 -0
- package/dist/utils/react.d.ts.map +1 -0
- package/dist/utils/react.js +63 -0
- package/dist/utils/react.js.map +1 -0
- package/package.json +4 -4
- package/src/components/elements/sidebar-layout.tsx +16 -1
- package/src/components-page/team-invitation-cache.test.ts +25 -0
- package/src/components-page/team-invitation-cache.ts +13 -0
- package/src/components-page/team-invitation.tsx +16 -7
- package/src/dev-tool/dev-tool-core.ts +1 -4
- package/src/dev-tool/index.ts +4 -15
- package/src/in-page-ui/dev-environment.ts +33 -0
- package/src/in-page-ui/issue-card.test.ts +67 -0
- package/src/in-page-ui/issue-card.ts +500 -0
- package/src/in-page-ui/logo.ts +8 -0
- package/src/lib/hexclave-app/apps/implementations/client-app-impl.automatic-side-effects.test.ts +38 -1
- package/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts +157 -0
- package/src/lib/hexclave-app/apps/implementations/client-app-impl.sign-out.test.ts +96 -0
- package/src/lib/hexclave-app/apps/implementations/client-app-impl.ts +255 -37
- package/src/lib/hexclave-app/apps/implementations/client-app-impl.untrusted-redirect-card.test.ts +146 -0
- package/src/lib/hexclave-app/apps/implementations/common.ts +2 -1
- package/src/lib/hexclave-app/apps/implementations/redirect-page-urls.test.ts +1 -0
- package/src/lib/hexclave-app/teams/index.ts +3 -0
- package/src/pushed-config-error-overlay/index.ts +45 -386
- package/src/setup-error-overlay/index.test.ts +133 -0
- package/src/setup-error-overlay/index.ts +150 -0
- package/src/utils/monkey-patch.tsx +31 -0
- package/src/utils/react.tsx +93 -0
- package/dist/admin-app-impl-sTQD2d-3.d.ts.map +0 -1
- package/dist/client-app-BCT5p_70.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/setup-error-overlay/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\n\n// Renders an error card on the page when an auth flow dies because of a setup problem in the developer's project (a\n// domain missing from the trusted domains, for example). Those failures used to be logged with captureError only, which\n// meant the flow just quietly stopped: the developer saw a page that never signed anybody in, with the explanation\n// buried in the console or in Sentry. Setup errors are always the developer's to fix and never recoverable at runtime,\n// so they get the same treatment as a broken pushed config: a card that is impossible to miss.\n\nimport { HexclaveSetupError, captureError, errorToNiceString } from \"@hexclave/shared/dist/utils/errors\";\nimport { isLikelyDevelopmentEnvironment } from \"../in-page-ui/dev-environment\";\nimport { canMountIntoDom, getGlobalUiInstance, h, setGlobalUiInstance } from \"../in-page-ui/dom\";\nimport { getIssueCardCSS, renderIssueCard, renderIssuePill, trapFocusInIssueCard, type IssueCardFocusTrap } from \"../in-page-ui/issue-card\";\n\n/** Exported so tests can drop the singleton; every other consumer should go through `showSetupErrorOverlay`. */\nexport const SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY = \"__hexclave-setup-error-overlay\";\n\nconst css = getIssueCardCSS(\".hexclave-setup-error-overlay\");\n\nconst unexpectedErrorHowToFix = [\n \"Check the browser console and your Hexclave dashboard's logs for the full error.\",\n \"Make sure your Hexclave SDK packages are up to date.\",\n \"If the error looks like a bug in Hexclave, report it at https://github.com/hexclave/hexclave/issues.\",\n] as const;\n\ntype SetupIssue = {\n title: string,\n message: string,\n howToFix: readonly string[],\n // Setup errors are known to be fatal for their flow, so the card says so. Anything else may well be transient (a\n // network blip while resolving a session, say), and claiming that nobody can sign in anymore would be misleading.\n isFatal: boolean,\n};\n\nfunction toSetupIssue(error: unknown): SetupIssue {\n if (HexclaveSetupError.isSetupError(error)) {\n return {\n title: error.title,\n message: error.message,\n howToFix: error.howToFix,\n isFatal: true,\n };\n }\n return {\n title: \"Hexclave could not finish an authentication flow\",\n message: errorToNiceString(error),\n howToFix: unexpectedErrorHowToFix,\n isFatal: false,\n };\n}\n\nfunction buildAiPrompt(issue: SetupIssue): string {\n return [\n \"Help me fix this Hexclave setup error.\",\n \"\",\n \"Hexclave reminder:\",\n \"This error was thrown by the Hexclave SDK in the browser while it was resolving an authentication flow, and the flow was aborted because of it. It is a problem with how my project is set up, not something my users can work around. Use your web fetch tool to read https://skill.hexclave.com to learn more about Hexclave.\",\n \"\",\n \"Error message:\",\n issue.message,\n \"\",\n \"Hexclave suggests:\",\n ...issue.howToFix.map((step) => `- ${step}`),\n \"\",\n \"Please explain the likely cause and suggest the smallest safe fix.\",\n ].join(\"\\n\");\n}\n\n/**\n * Shows `error` as an error card on the current page.\n *\n * Setup errors are always shown, because the flow they aborted cannot complete no matter what the end user does, and\n * their messages are written for exactly this purpose. Any other error is only shown while developing — those messages\n * are internal diagnostics, so in production they stay in captureError's hands.\n *\n * Returns a cleanup function that removes the card again.\n */\nexport function showSetupErrorOverlay(error: unknown): () => void {\n if (!canMountIntoDom()) {\n return () => {};\n }\n if (!HexclaveSetupError.isSetupError(error) && !isLikelyDevelopmentEnvironment()) {\n return () => {};\n }\n\n const issue = toSetupIssue(error);\n const existingInstance = getGlobalUiInstance(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY);\n if (existingInstance != null) {\n // A single broken setup usually throws the same error on every page load and sometimes from several flows at once.\n // Stacking cards on top of each other would only hide the first (and most relevant) one, so later errors keep to\n // captureError and leave the card that is already up alone.\n return () => {};\n }\n\n const root = h(\"div\", { className: \"hexclave-setup-error-overlay\" });\n const style = h(\"style\", null, css);\n root.appendChild(style);\n document.body.appendChild(root);\n\n let focusTrap: IssueCardFocusTrap | null = null;\n const render = (minimized: boolean) => {\n focusTrap?.release();\n focusTrap = null;\n root.replaceChildren(style);\n if (minimized) {\n root.appendChild(renderIssuePill({\n kind: \"error\",\n label: \"Setup error\",\n ariaLabel: \"Show Hexclave setup error\",\n onClick: () => render(false),\n }));\n return;\n }\n root.appendChild(renderIssueCard({\n kind: \"error\",\n badge: \"Setup error\",\n title: issue.title,\n bodyText: issue.isFatal\n ? \"Hexclave stopped the authentication flow that ran into this error, so nobody can sign in through it until it is fixed.\"\n : \"Hexclave aborted the authentication flow that ran into this error. Errors like this one may also be transient, in which case retrying the flow works.\",\n messageLabel: \"Error message\",\n message: issue.message,\n howToFix: issue.howToFix,\n footerText: issue.isFatal\n ? \"This card is shown by the Hexclave SDK. Fix the problem above and reload the page to try the flow again.\"\n : \"This card is shown by the Hexclave SDK while developing, and never in production.\",\n ariaLabel: \"Hexclave setup error\",\n aiPrompt: buildAiPrompt(issue),\n onCopyError: (copyError) => captureError(\"setup-error-overlay-copy\", copyError),\n onCopyAiPromptError: (copyError) => captureError(\"setup-error-overlay-copy-ai-prompt\", copyError),\n onMinimize: () => render(true),\n }));\n focusTrap = trapFocusInIssueCard(root);\n };\n render(false);\n\n const cleanup = () => {\n focusTrap?.release();\n focusTrap = null;\n root.remove();\n if (getGlobalUiInstance(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY)?.cleanup === cleanup) {\n setGlobalUiInstance(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, null);\n }\n };\n setGlobalUiInstance(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, { cleanup });\n return cleanup;\n}\n\n"],"mappings":";;;;;;AAiBA,MAAa,0CAA0C;AAEvD,MAAM,MAAM,gBAAgB,+BAA+B;AAE3D,MAAM,0BAA0B;CAC9B;CACA;CACA;AACF;AAWA,SAAS,aAAa,OAA4B;CAChD,IAAI,mBAAmB,aAAa,KAAK,GACvC,OAAO;EACL,OAAO,MAAM;EACb,SAAS,MAAM;EACf,UAAU,MAAM;EAChB,SAAS;CACX;CAEF,OAAO;EACL,OAAO;EACP,SAAS,kBAAkB,KAAK;EAChC,UAAU;EACV,SAAS;CACX;AACF;AAEA,SAAS,cAAc,OAA2B;CAChD,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA,GAAG,MAAM,SAAS,KAAK,SAAS,KAAK,MAAM;EAC3C;EACA;CACF,CAAC,CAAC,KAAK,IAAI;AACb;;;;;;;;;;AAWA,SAAgB,sBAAsB,OAA4B;CAChE,IAAI,CAAC,gBAAgB,GACnB,aAAa,CAAC;CAEhB,IAAI,CAAC,mBAAmB,aAAa,KAAK,KAAK,CAAC,+BAA+B,GAC7E,aAAa,CAAC;CAGhB,MAAM,QAAQ,aAAa,KAAK;CAEhC,IADyB,oBAAA,gCACN,KAAK,MAItB,aAAa,CAAC;CAGhB,MAAM,OAAO,EAAE,OAAO,EAAE,WAAW,+BAA+B,CAAC;CACnE,MAAM,QAAQ,EAAE,SAAS,MAAM,GAAG;CAClC,KAAK,YAAY,KAAK;CACtB,SAAS,KAAK,YAAY,IAAI;CAE9B,IAAI,YAAuC;CAC3C,MAAM,UAAU,cAAuB;EACrC,WAAW,QAAQ;EACnB,YAAY;EACZ,KAAK,gBAAgB,KAAK;EAC1B,IAAI,WAAW;GACb,KAAK,YAAY,gBAAgB;IAC/B,MAAM;IACN,OAAO;IACP,WAAW;IACX,eAAe,OAAO,KAAK;GAC7B,CAAC,CAAC;GACF;EACF;EACA,KAAK,YAAY,gBAAgB;GAC/B,MAAM;GACN,OAAO;GACP,OAAO,MAAM;GACb,UAAU,MAAM,UACZ,2HACA;GACJ,cAAc;GACd,SAAS,MAAM;GACf,UAAU,MAAM;GAChB,YAAY,MAAM,UACd,6GACA;GACJ,WAAW;GACX,UAAU,cAAc,KAAK;GAC7B,cAAc,cAAc,aAAa,4BAA4B,SAAS;GAC9E,sBAAsB,cAAc,aAAa,sCAAsC,SAAS;GAChG,kBAAkB,OAAO,IAAI;EAC/B,CAAC,CAAC;EACF,YAAY,qBAAqB,IAAI;CACvC;CACA,OAAO,KAAK;CAEZ,MAAM,gBAAgB;EACpB,WAAW,QAAQ;EACnB,YAAY;EACZ,KAAK,OAAO;EACZ,IAAI,oBAAA,gCAA2D,CAAC,EAAE,YAAY,SAC5E,oBAAoB,yCAAyC,IAAI;CAErE;CACA,oBAAoB,yCAAyC,EAAE,QAAQ,CAAC;CACxE,OAAO;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { HexclaveSetupError } from "@hexclave/shared/dist/utils/errors";
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, showSetupErrorOverlay } from "./index.js";
|
|
4
|
+
//#region src/setup-error-overlay/index.test.ts
|
|
5
|
+
// @vitest-environment jsdom
|
|
6
|
+
function createSetupError() {
|
|
7
|
+
return new HexclaveSetupError({
|
|
8
|
+
title: "A domain in your authentication flow is not one of your project's trusted domains",
|
|
9
|
+
message: "Nested cross-domain auth callback URL https://demo.example.test/ is not trusted.",
|
|
10
|
+
howToFix: ["Add https://demo.example.test to your project's trusted domains."]
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function overlayRoots() {
|
|
14
|
+
return document.querySelectorAll(".hexclave-setup-error-overlay");
|
|
15
|
+
}
|
|
16
|
+
describe("setup error overlay", () => {
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
vi.unstubAllEnvs();
|
|
19
|
+
for (const root of overlayRoots()) root.remove();
|
|
20
|
+
Reflect.deleteProperty(window, SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY);
|
|
21
|
+
});
|
|
22
|
+
it("renders setup errors with their fix instructions, even outside development", () => {
|
|
23
|
+
vi.stubEnv("NODE_ENV", "production");
|
|
24
|
+
const error = createSetupError();
|
|
25
|
+
const cleanup = showSetupErrorOverlay(error);
|
|
26
|
+
try {
|
|
27
|
+
expect(overlayRoots()).toHaveLength(1);
|
|
28
|
+
const text = document.body.textContent;
|
|
29
|
+
expect(text).toContain(error.title);
|
|
30
|
+
expect(text).toContain(error.message);
|
|
31
|
+
expect(text).toContain(error.howToFix[0]);
|
|
32
|
+
expect(document.querySelector("[role='alertdialog']")).not.toBeNull();
|
|
33
|
+
} finally {
|
|
34
|
+
cleanup();
|
|
35
|
+
}
|
|
36
|
+
expect(overlayRoots()).toHaveLength(0);
|
|
37
|
+
});
|
|
38
|
+
it("minimizes into a pill and back", () => {
|
|
39
|
+
vi.stubEnv("NODE_ENV", "production");
|
|
40
|
+
const cleanup = showSetupErrorOverlay(createSetupError());
|
|
41
|
+
try {
|
|
42
|
+
const minimizeButton = document.querySelector("[aria-label='Minimize Hexclave setup error']");
|
|
43
|
+
expect(minimizeButton).not.toBeNull();
|
|
44
|
+
minimizeButton?.click();
|
|
45
|
+
expect(document.querySelector("[role='alertdialog']")).toBeNull();
|
|
46
|
+
const pill = document.querySelector("[aria-label='Show Hexclave setup error']");
|
|
47
|
+
expect(pill).not.toBeNull();
|
|
48
|
+
pill?.click();
|
|
49
|
+
expect(document.querySelector("[role='alertdialog']")).not.toBeNull();
|
|
50
|
+
} finally {
|
|
51
|
+
cleanup();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
it("keeps keyboard focus inside the card and gives it back afterwards", () => {
|
|
55
|
+
vi.stubEnv("NODE_ENV", "production");
|
|
56
|
+
const pageButton = document.body.appendChild(document.createElement("button"));
|
|
57
|
+
pageButton.focus();
|
|
58
|
+
const cleanup = showSetupErrorOverlay(createSetupError());
|
|
59
|
+
try {
|
|
60
|
+
const card = document.querySelector("[role='alertdialog']");
|
|
61
|
+
expect(document.activeElement).toBe(card);
|
|
62
|
+
const cardButtons = [...card?.querySelectorAll("button") ?? []];
|
|
63
|
+
expect(cardButtons.length).toBeGreaterThan(1);
|
|
64
|
+
cardButtons[cardButtons.length - 1].focus();
|
|
65
|
+
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
66
|
+
key: "Tab",
|
|
67
|
+
bubbles: true,
|
|
68
|
+
cancelable: true
|
|
69
|
+
}));
|
|
70
|
+
expect(document.activeElement).toBe(cardButtons[0]);
|
|
71
|
+
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
72
|
+
key: "Tab",
|
|
73
|
+
bubbles: true,
|
|
74
|
+
cancelable: true,
|
|
75
|
+
shiftKey: true
|
|
76
|
+
}));
|
|
77
|
+
expect(document.activeElement).toBe(cardButtons[cardButtons.length - 1]);
|
|
78
|
+
pageButton.focus();
|
|
79
|
+
document.dispatchEvent(new KeyboardEvent("keydown", {
|
|
80
|
+
key: "Tab",
|
|
81
|
+
bubbles: true,
|
|
82
|
+
cancelable: true
|
|
83
|
+
}));
|
|
84
|
+
expect(document.activeElement).toBe(cardButtons[0]);
|
|
85
|
+
} finally {
|
|
86
|
+
cleanup();
|
|
87
|
+
}
|
|
88
|
+
expect(document.activeElement).toBe(pageButton);
|
|
89
|
+
pageButton.remove();
|
|
90
|
+
});
|
|
91
|
+
it("keeps the first card instead of stacking later errors on top of it", () => {
|
|
92
|
+
vi.stubEnv("NODE_ENV", "production");
|
|
93
|
+
const firstError = createSetupError();
|
|
94
|
+
const cleanup = showSetupErrorOverlay(firstError);
|
|
95
|
+
try {
|
|
96
|
+
showSetupErrorOverlay(new HexclaveSetupError({
|
|
97
|
+
title: "Another setup error",
|
|
98
|
+
message: "Another setup error happened.",
|
|
99
|
+
howToFix: ["Fix the other thing."]
|
|
100
|
+
}))();
|
|
101
|
+
expect(overlayRoots()).toHaveLength(1);
|
|
102
|
+
expect(document.body.textContent).toContain(firstError.message);
|
|
103
|
+
expect(document.body.textContent).not.toContain("Another setup error happened.");
|
|
104
|
+
} finally {
|
|
105
|
+
cleanup();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
it("only shows errors that are not setup errors while developing", () => {
|
|
109
|
+
vi.stubEnv("NODE_ENV", "production");
|
|
110
|
+
showSetupErrorOverlay(/* @__PURE__ */ new Error("Some internal failure."))();
|
|
111
|
+
expect(overlayRoots()).toHaveLength(0);
|
|
112
|
+
vi.stubEnv("NODE_ENV", "development");
|
|
113
|
+
const cleanup = showSetupErrorOverlay(/* @__PURE__ */ new Error("Some internal failure."));
|
|
114
|
+
try {
|
|
115
|
+
expect(overlayRoots()).toHaveLength(1);
|
|
116
|
+
expect(document.body.textContent).toContain("Some internal failure.");
|
|
117
|
+
} finally {
|
|
118
|
+
cleanup();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
//#endregion
|
|
123
|
+
export {};
|
|
124
|
+
|
|
125
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","names":[],"sources":["../../../src/setup-error-overlay/index.test.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\n// @vitest-environment jsdom\n\nimport { HexclaveSetupError } from \"@hexclave/shared/dist/utils/errors\";\nimport { afterEach, describe, expect, it, vi } from \"vitest\";\nimport { SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, showSetupErrorOverlay } from \".\";\n\nfunction createSetupError() {\n return new HexclaveSetupError({\n title: \"A domain in your authentication flow is not one of your project's trusted domains\",\n message: \"Nested cross-domain auth callback URL https://demo.example.test/ is not trusted.\",\n howToFix: [\"Add https://demo.example.test to your project's trusted domains.\"],\n });\n}\n\nfunction overlayRoots() {\n return document.querySelectorAll(\".hexclave-setup-error-overlay\");\n}\n\ndescribe(\"setup error overlay\", () => {\n afterEach(() => {\n vi.unstubAllEnvs();\n for (const root of overlayRoots()) {\n root.remove();\n }\n Reflect.deleteProperty(window, SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY);\n });\n\n it(\"renders setup errors with their fix instructions, even outside development\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n const error = createSetupError();\n\n const cleanup = showSetupErrorOverlay(error);\n try {\n expect(overlayRoots()).toHaveLength(1);\n const text = document.body.textContent;\n expect(text).toContain(error.title);\n expect(text).toContain(error.message);\n expect(text).toContain(error.howToFix[0]);\n expect(document.querySelector(\"[role='alertdialog']\")).not.toBeNull();\n } finally {\n cleanup();\n }\n\n expect(overlayRoots()).toHaveLength(0);\n });\n\n it(\"minimizes into a pill and back\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n const cleanup = showSetupErrorOverlay(createSetupError());\n try {\n const minimizeButton = document.querySelector<HTMLButtonElement>(\"[aria-label='Minimize Hexclave setup error']\");\n expect(minimizeButton).not.toBeNull();\n minimizeButton?.click();\n expect(document.querySelector(\"[role='alertdialog']\")).toBeNull();\n\n const pill = document.querySelector<HTMLButtonElement>(\"[aria-label='Show Hexclave setup error']\");\n expect(pill).not.toBeNull();\n pill?.click();\n expect(document.querySelector(\"[role='alertdialog']\")).not.toBeNull();\n } finally {\n cleanup();\n }\n });\n\n it(\"keeps keyboard focus inside the card and gives it back afterwards\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n const pageButton = document.body.appendChild(document.createElement(\"button\"));\n pageButton.focus();\n\n const cleanup = showSetupErrorOverlay(createSetupError());\n try {\n const card = document.querySelector<HTMLElement>(\"[role='alertdialog']\");\n expect(document.activeElement).toBe(card);\n\n const cardButtons = [...(card?.querySelectorAll(\"button\") ?? [])];\n expect(cardButtons.length).toBeGreaterThan(1);\n cardButtons[cardButtons.length - 1].focus();\n document.dispatchEvent(new KeyboardEvent(\"keydown\", { key: \"Tab\", bubbles: true, cancelable: true }));\n expect(document.activeElement).toBe(cardButtons[0]);\n document.dispatchEvent(new KeyboardEvent(\"keydown\", { key: \"Tab\", bubbles: true, cancelable: true, shiftKey: true }));\n expect(document.activeElement).toBe(cardButtons[cardButtons.length - 1]);\n\n // Tabbing away from the card is what the trap exists to prevent, even when the page itself moves focus.\n pageButton.focus();\n document.dispatchEvent(new KeyboardEvent(\"keydown\", { key: \"Tab\", bubbles: true, cancelable: true }));\n expect(document.activeElement).toBe(cardButtons[0]);\n } finally {\n cleanup();\n }\n\n expect(document.activeElement).toBe(pageButton);\n pageButton.remove();\n });\n\n it(\"keeps the first card instead of stacking later errors on top of it\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n const firstError = createSetupError();\n const cleanup = showSetupErrorOverlay(firstError);\n try {\n const secondCleanup = showSetupErrorOverlay(new HexclaveSetupError({\n title: \"Another setup error\",\n message: \"Another setup error happened.\",\n howToFix: [\"Fix the other thing.\"],\n }));\n secondCleanup();\n\n expect(overlayRoots()).toHaveLength(1);\n expect(document.body.textContent).toContain(firstError.message);\n expect(document.body.textContent).not.toContain(\"Another setup error happened.\");\n } finally {\n cleanup();\n }\n });\n\n it(\"only shows errors that are not setup errors while developing\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n showSetupErrorOverlay(new Error(\"Some internal failure.\"))();\n expect(overlayRoots()).toHaveLength(0);\n\n vi.stubEnv(\"NODE_ENV\", \"development\");\n const cleanup = showSetupErrorOverlay(new Error(\"Some internal failure.\"));\n try {\n expect(overlayRoots()).toHaveLength(1);\n expect(document.body.textContent).toContain(\"Some internal failure.\");\n } finally {\n cleanup();\n }\n });\n});\n"],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/utils/monkey-patch.d.ts
|
|
2
|
+
declare const NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL = "__stack-no-suspense-boundary-error__";
|
|
3
|
+
declare function isNoSuspenseBoundaryError(value: unknown): boolean;
|
|
4
|
+
declare function ensureMonkeyPatch(): void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL, ensureMonkeyPatch, isNoSuspenseBoundaryError };
|
|
7
|
+
//# sourceMappingURL=monkey-patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monkey-patch.d.ts","names":[],"sources":["../../../src/utils/monkey-patch.tsx"],"mappings":";cAMa,mCAAA;AAAA,iBAEG,yBAAA,CAA0B,KAAc;AAAA,iBASxC,iBAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createGlobal } from "@hexclave/shared/dist/utils/globals";
|
|
2
|
+
//#region src/utils/monkey-patch.tsx
|
|
3
|
+
const NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL = "__stack-no-suspense-boundary-error__";
|
|
4
|
+
function isNoSuspenseBoundaryError(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && "__noSuspenseBoundarySentinel" in value && value.__noSuspenseBoundarySentinel === "__stack-no-suspense-boundary-error__";
|
|
6
|
+
}
|
|
7
|
+
function ensureMonkeyPatch() {
|
|
8
|
+
createGlobal("__console-error-monkey-patch__", () => {
|
|
9
|
+
const originalConsoleError = console.error;
|
|
10
|
+
console.error = function(...args) {
|
|
11
|
+
if (args.length === 1 && isNoSuspenseBoundaryError(args[0])) return;
|
|
12
|
+
return originalConsoleError.apply(this, args);
|
|
13
|
+
};
|
|
14
|
+
return true;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL, ensureMonkeyPatch, isNoSuspenseBoundaryError };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=monkey-patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monkey-patch.js","names":[],"sources":["../../../src/utils/monkey-patch.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { createGlobal } from \"@hexclave/shared/dist/utils/globals\";\n\nexport const NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL = \"__stack-no-suspense-boundary-error__\";\n\nexport function isNoSuspenseBoundaryError(value: unknown): boolean {\n return (\n typeof value === \"object\"\n && value !== null\n && \"__noSuspenseBoundarySentinel\" in value\n && value.__noSuspenseBoundarySentinel === NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL\n );\n}\n\nexport function ensureMonkeyPatch() {\n createGlobal(\"__console-error-monkey-patch__\", () => {\n const originalConsoleError = console.error;\n console.error = function (...args: unknown[]) {\n // React's default error handlers log every server error, including the one we intentionally throw to skip SSR.\n // Frameworks that use those defaults (including vanilla React) therefore need this narrow sentinel-based filter.\n if (args.length === 1 && isNoSuspenseBoundaryError(args[0])) {\n return;\n }\n return originalConsoleError.apply(this, args);\n };\n return true;\n });\n}\n"],"mappings":";;AAMA,MAAa,sCAAsC;AAEnD,SAAgB,0BAA0B,OAAyB;CACjE,OACE,OAAO,UAAU,YACd,UAAU,QACV,kCAAkC,SAClC,MAAM,iCAAA;AAEb;AAEA,SAAgB,oBAAoB;CAClC,aAAa,wCAAwC;EACnD,MAAM,uBAAuB,QAAQ;EACrC,QAAQ,QAAQ,SAAU,GAAG,MAAiB;GAG5C,IAAI,KAAK,WAAW,KAAK,0BAA0B,KAAK,EAAE,GACxD;GAEF,OAAO,qBAAqB,MAAM,MAAM,IAAI;EAC9C;EACA,OAAO;CACT,CAAC;AACH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/react.d.ts
|
|
2
|
+
declare function shouldRethrowRenderingError(error: unknown): boolean;
|
|
3
|
+
declare class NoSuspenseBoundaryError extends Error {
|
|
4
|
+
digest: string;
|
|
5
|
+
reason: string;
|
|
6
|
+
__noSuspenseBoundarySentinel: string;
|
|
7
|
+
constructor(options: {
|
|
8
|
+
caller?: string;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Use this in a component or hook to disable SSR. It must be wrapped in a Suspense boundary.
|
|
13
|
+
*/
|
|
14
|
+
declare function suspendIfSsr(caller?: string): void;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { NoSuspenseBoundaryError, shouldRethrowRenderingError, suspendIfSsr };
|
|
17
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","names":[],"sources":["../../../src/utils/react.tsx"],"mappings":";iBAYgB,2BAAA,CAA4B,KAAc;AAAA,cAI7C,uBAAA,SAAgC,KAAK;EAChD,MAAA;EACA,MAAA;EACA,4BAAA;cAEY,OAAA;IAAW,MAAA;EAAA;AAAA;;;;iBA8DT,YAAA,CAAa,MAAe"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { deindent } from "@hexclave/shared/dist/utils/strings";
|
|
3
|
+
import { useSearchParams } from "next/navigation";
|
|
4
|
+
import { isBrowserLike } from "@hexclave/shared/dist/utils/env";
|
|
5
|
+
import { NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL, ensureMonkeyPatch } from "./monkey-patch.js";
|
|
6
|
+
//#region src/utils/react.tsx
|
|
7
|
+
function shouldRethrowRenderingError(error) {
|
|
8
|
+
return !!error && typeof error === "object" && "digest" in error && error.digest === "BAILOUT_TO_CLIENT_SIDE_RENDERING";
|
|
9
|
+
}
|
|
10
|
+
var NoSuspenseBoundaryError = class extends Error {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
ensureMonkeyPatch();
|
|
13
|
+
super(deindent`
|
|
14
|
+
Suspense boundary not found! Read the error message below carefully (or paste it into your AI agent).
|
|
15
|
+
|
|
16
|
+
${options.caller ?? "This code path"} attempted to display a loading indicator, but didn't find a Suspense boundary above it. Please read the error message below carefully.
|
|
17
|
+
|
|
18
|
+
There are several potential causes:
|
|
19
|
+
|
|
20
|
+
1. [Next.js] You are missing a loading.tsx file in your app directory. Fix it by adding a loading.tsx file in your app directory.
|
|
21
|
+
|
|
22
|
+
2. [React] You are missing a <Suspense> boundary in your component. Fix it by wrapping your component (or the entire app) in a <Suspense> component.
|
|
23
|
+
|
|
24
|
+
3. [Next.js] The component is rendered in the root (outermost) layout.tsx or template.tsx file. Next.js does not wrap those files in a Suspense boundary, even if there is a loading.tsx file in the same folder. To fix it, wrap your layout inside a route group like this:
|
|
25
|
+
|
|
26
|
+
- app
|
|
27
|
+
- - layout.tsx // contains <html> and <body>, alongside providers and other components that don't need ${options.caller ?? "this code path"}
|
|
28
|
+
- - loading.tsx // required for suspense
|
|
29
|
+
- - (main)
|
|
30
|
+
- - - layout.tsx // contains the main layout of your app, like a sidebar or a header, and can use ${options.caller ?? "this code path"}
|
|
31
|
+
- - - route.tsx // your actual main page
|
|
32
|
+
- - - the rest of your app
|
|
33
|
+
|
|
34
|
+
For more information on this approach, see Next's documentation on route groups: https://nextjs.org/docs/app/building-your-application/routing/route-groups
|
|
35
|
+
|
|
36
|
+
4. You caught this error with try-catch or a custom error boundary. Fix this by rethrowing the error or not catching it in the first place.
|
|
37
|
+
|
|
38
|
+
5. Your version of Hexclave is too old. Upgrade to the latest version to see if that fixes the issue.
|
|
39
|
+
|
|
40
|
+
See: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
|
|
41
|
+
|
|
42
|
+
More information on SSR and Suspense boundaries: https://react.dev/reference/react/Suspense#providing-a-fallback-for-server-errors-and-client-only-content
|
|
43
|
+
`);
|
|
44
|
+
this.__noSuspenseBoundarySentinel = NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL;
|
|
45
|
+
this.name = "NoSuspenseBoundaryError";
|
|
46
|
+
this.reason = options.caller ?? "suspendIfSsr()";
|
|
47
|
+
this.digest = "BAILOUT_TO_CLIENT_SIDE_RENDERING";
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Use this in a component or hook to disable SSR. It must be wrapped in a Suspense boundary.
|
|
52
|
+
*/
|
|
53
|
+
function suspendIfSsr(caller) {
|
|
54
|
+
useSearchParams();
|
|
55
|
+
if (!isBrowserLike()) throw new NoSuspenseBoundaryError({ caller });
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { NoSuspenseBoundaryError, shouldRethrowRenderingError, suspendIfSsr };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","names":[],"sources":["../../../src/utils/react.tsx"],"sourcesContent":["'use client';\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\n\nimport { isBrowserLike } from \"@hexclave/shared/dist/utils/env\";\nimport { deindent } from \"@hexclave/shared/dist/utils/strings\";\nimport { useSearchParams } from \"next/navigation\"; // THIS_LINE_PLATFORM next\nimport { ensureMonkeyPatch, NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL } from \"./monkey-patch\";\n\nexport function shouldRethrowRenderingError(error: unknown): boolean {\n return !!error && typeof error === \"object\" && \"digest\" in error && error.digest === \"BAILOUT_TO_CLIENT_SIDE_RENDERING\";\n}\n\nexport class NoSuspenseBoundaryError extends Error {\n digest: string;\n reason: string;\n __noSuspenseBoundarySentinel = NO_SUSPENSE_BOUNDARY_ERROR_SENTINEL;\n\n constructor(options: { caller?: string }) {\n ensureMonkeyPatch();\n\n super(deindent`\n Suspense boundary not found! Read the error message below carefully (or paste it into your AI agent).\n\n ${options.caller ?? \"This code path\"} attempted to display a loading indicator, but didn't find a Suspense boundary above it. Please read the error message below carefully.\n \n There are several potential causes:\n \n 1. [Next.js] You are missing a loading.tsx file in your app directory. Fix it by adding a loading.tsx file in your app directory.\n\n 2. [React] You are missing a <Suspense> boundary in your component. Fix it by wrapping your component (or the entire app) in a <Suspense> component.\n\n 3. [Next.js] The component is rendered in the root (outermost) layout.tsx or template.tsx file. Next.js does not wrap those files in a Suspense boundary, even if there is a loading.tsx file in the same folder. To fix it, wrap your layout inside a route group like this:\n\n - app\n - - layout.tsx // contains <html> and <body>, alongside providers and other components that don't need ${options.caller ?? \"this code path\"}\n - - loading.tsx // required for suspense\n - - (main)\n - - - layout.tsx // contains the main layout of your app, like a sidebar or a header, and can use ${options.caller ?? \"this code path\"}\n - - - route.tsx // your actual main page\n - - - the rest of your app\n\n For more information on this approach, see Next's documentation on route groups: https://nextjs.org/docs/app/building-your-application/routing/route-groups\n \n 4. You caught this error with try-catch or a custom error boundary. Fix this by rethrowing the error or not catching it in the first place.\n\n 5. Your version of Hexclave is too old. Upgrade to the latest version to see if that fixes the issue.\n\n See: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout\n\n More information on SSR and Suspense boundaries: https://react.dev/reference/react/Suspense#providing-a-fallback-for-server-errors-and-client-only-content\n `);\n\n this.name = \"NoSuspenseBoundaryError\";\n this.reason = options.caller ?? \"suspendIfSsr()\";\n\n // Next recognizes this digest as an intentional request-time CSR bailout and suppresses its normal error reporting.\n this.digest = \"BAILOUT_TO_CLIENT_SIDE_RENDERING\";\n }\n}\nimport.meta.vitest?.test(\"NoSuspenseBoundaryError\", ({ expect }) => {\n const defaultError = new NoSuspenseBoundaryError({});\n expect(defaultError.name).toBe(\"NoSuspenseBoundaryError\");\n expect(defaultError.reason).toBe(\"suspendIfSsr()\");\n expect(defaultError.digest).toBe(\"BAILOUT_TO_CLIENT_SIDE_RENDERING\");\n expect(defaultError.message).toContain(\"This code path attempted to display a loading indicator\");\n\n const customError = new NoSuspenseBoundaryError({ caller: \"CustomComponent\" });\n expect(customError.name).toBe(\"NoSuspenseBoundaryError\");\n expect(customError.reason).toBe(\"CustomComponent\");\n expect(customError.digest).toBe(\"BAILOUT_TO_CLIENT_SIDE_RENDERING\");\n expect(customError.message).toContain(\"CustomComponent attempted to display a loading indicator\");\n expect(customError.message).toContain(\"loading.tsx\");\n expect(customError.message).toContain(\"route groups\");\n expect(customError.message).toContain(\"https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout\");\n});\n\n/**\n * Use this in a component or hook to disable SSR. It must be wrapped in a Suspense boundary.\n */\nexport function suspendIfSsr(caller?: string) {\n // Next 16.3's Instant Insights is a silly goose! It rejects our deliberate recoverable SSR error during\n // prerender validation, even though React uses the surrounding Suspense fallback correctly. Calling\n // useSearchParams first makes Next create its own recognized `prerender-client` dynamic hole, so prerendering\n // stops before our error while request-time SSR still reaches the error and retries this subtree on the client.\n useSearchParams();\n if (!isBrowserLike()) {\n throw new NoSuspenseBoundaryError({ caller });\n }\n}\n"],"mappings":";;;;;;AAYA,SAAgB,4BAA4B,OAAyB;CACnE,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,YAAY,SAAS,MAAM,WAAW;AACvF;AAEA,IAAa,0BAAb,cAA6C,MAAM;CAKjD,YAAY,SAA8B;EACxC,kBAAkB;EAElB,MAAM,QAAQ;;;QAGV,QAAQ,UAAU,iBAAiB;;;;;;;;;;;kHAWuE,QAAQ,UAAU,iBAAiB;;;6GAGxC,QAAQ,UAAU,iBAAiB;;;;;;;;;;;;;KAa3I;sCAnC4B;EAqC7B,KAAK,OAAO;EACZ,KAAK,SAAS,QAAQ,UAAU;EAGhC,KAAK,SAAS;CAChB;AACF;;;;AAqBA,SAAgB,aAAa,QAAiB;CAK5C,gBAAgB;CAChB,IAAI,CAAC,cAAc,GACjB,MAAM,IAAI,wBAAwB,EAAE,OAAO,CAAC;AAEhD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as quetzalLocales, t as quetzalKeys } from "../quetzal-translations-
|
|
1
|
+
import { n as quetzalLocales, t as quetzalKeys } from "../quetzal-translations-B2jT2SWm.js";
|
|
2
2
|
export { quetzalKeys, quetzalLocales };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as StackAdminApp, a as StackClientApp, z as StackServerApp } from "./client-app-
|
|
2
|
-
import { t as TranslationProvider } from "./translation-provider-
|
|
1
|
+
import { N as StackAdminApp, a as StackClientApp, z as StackServerApp } from "./client-app-wFodsYml.js";
|
|
2
|
+
import { t as TranslationProvider } from "./translation-provider-6505O9P2.js";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/providers/hexclave-provider.d.ts
|
|
@@ -26,4 +26,4 @@ declare const HexclaveProvider: typeof NextStackProvider;
|
|
|
26
26
|
declare const StackProvider: typeof NextStackProvider;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { HexclaveProvider as n, StackProvider as r, ActiveProvider as t };
|
|
29
|
-
//# sourceMappingURL=hexclave-provider-
|
|
29
|
+
//# sourceMappingURL=hexclave-provider-CMz2mt4I.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hexclave-provider-
|
|
1
|
+
{"version":3,"file":"hexclave-provider-CMz2mt4I.d.ts","names":[],"sources":["../src/providers/hexclave-provider.tsx"],"mappings":";;;;;iBASS,iBAAA;EACP,QAAA;EACA,GAAA;EACA,IAAA;EACA;AAAA;EAEA,IAAA,GAAO,KAAA,CAAM,cAAA,QAAsB,mBAAA;;AARwB;;;;;EAe3D,oBAAA,GAAuB,MAAA;EACvB,QAAA,EAAU,KAAA,CAAM,SAAA;EAEhB,GAAA,EAAK,cAAA,SAAuB,cAAA,SAAuB,aAAA;AAAA,gCACpD,GAAA,CAAA,OAAA;AAAA,cAcK,cAAA,SAAc,iBAAoB;AAAA,cAI3B,gBAAA,SAAgB,iBAAiB;;cAEjC,aAAA,SAAa,iBAAiB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as GetCurrentUserOptions } from "./common-B2gkWlXX.js";
|
|
2
|
-
import { a as StackClientApp, ht as CurrentUser, pt as CurrentInternalUser } from "./client-app-
|
|
2
|
+
import { a as StackClientApp, ht as CurrentUser, pt as CurrentInternalUser } from "./client-app-wFodsYml.js";
|
|
3
3
|
//#region src/lib/hooks.d.ts
|
|
4
4
|
type GetUserOptions = GetCurrentUserOptions<true> & {
|
|
5
5
|
projectIdMustMatch?: string;
|
|
@@ -40,4 +40,4 @@ declare function useStackApp<ProjectId extends string>(options?: {
|
|
|
40
40
|
}): StackClientApp<true, ProjectId>;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { useStackApp as n, useUser as r, useHexclaveApp as t };
|
|
43
|
-
//# sourceMappingURL=hooks-
|
|
43
|
+
//# sourceMappingURL=hooks-CUHt4Y9C.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-
|
|
1
|
+
{"version":3,"file":"hooks-CUHt4Y9C.d.ts","names":[],"sources":["../src/lib/hooks.tsx"],"mappings":";;;KAQK,cAAA,GAAiB,qBAAiB;EACrC,kBAAkB;AAAA;;AAHwG;;;;iBAW5G,OAAA,CAAQ,OAAA,EAAS,cAAA;EAAmB,EAAA;EAA0B,kBAAA;AAAA,IAAmC,mBAAmB;AAAA,iBACpH,OAAA,CAAQ,OAAA,EAAS,cAAA;EAAmB,EAAA;AAAA,IAA6B,WAAW;AAAA,iBAC5E,OAAA,CAAQ,OAAA,EAAS,cAAA;EAAmB,kBAAA;AAAA,IAAmC,mBAAmB;AAAA,iBAC1F,OAAA,CAAQ,OAAA,GAAU,cAAA,GAAiB,WAAA,GAAc,mBAAA;AAHmE;AACpI;;;;AADoI,iBAqBpH,cAAA,2BAAyC,OAAA;EAAW,kBAAA,GAAqB,SAAA;AAAA,IAAmB,cAAA,OAAqB,SAAA;;;AApBrC;AAC5F;;;;iBAyCgB,WAAA,2BAAsC,OAAA;EAAW,kBAAA,GAAqB,SAAA;AAAA,IAAmB,cAAA,OAAqB,SAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-environment.d.ts","names":[],"sources":["../../src/in-page-ui/dev-environment.ts"],"mappings":";iBAWgB,8BAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _hexclave_shared_dist_utils_urls = require("@hexclave/shared/dist/utils/urls");
|
|
3
|
+
let ___generated_env_js = require("../generated/env.js");
|
|
4
|
+
//#region src/in-page-ui/dev-environment.ts
|
|
5
|
+
function isLikelyDevelopmentEnvironment() {
|
|
6
|
+
const nodeEnv = ___generated_env_js.envVars.NODE_ENV;
|
|
7
|
+
if (nodeEnv !== void 0) return nodeEnv === "development";
|
|
8
|
+
if (typeof window === "undefined") return false;
|
|
9
|
+
try {
|
|
10
|
+
if (new URL(window.location.href).protocol === "file:") return true;
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return (0, _hexclave_shared_dist_utils_urls.isLocalhost)(window.location.href);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.isLikelyDevelopmentEnvironment = isLikelyDevelopmentEnvironment;
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=dev-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-environment.js","names":["envVars"],"sources":["../../src/in-page-ui/dev-environment.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\n// Shared \"are we in a development-like environment?\" check for Hexclave's in-page UIs. Some of them (eg. surfacing an\n// unexpected internal error) are only appropriate while developing, and the SDK cannot ask the server about it because\n// the check has to work synchronously and before the app is authenticated.\n\nimport { isLocalhost } from \"@hexclave/shared/dist/utils/urls\";\nimport { envVars } from \"../generated/env\";\n\nexport function isLikelyDevelopmentEnvironment(): boolean {\n // NODE_ENV is the most reliable signal, but plenty of bundlers (eg. Vite-based ones) don't define it in the browser\n // bundle at all, so fall back to guessing from the current URL.\n const nodeEnv = envVars.NODE_ENV;\n if (nodeEnv !== undefined) {\n return nodeEnv === \"development\";\n }\n\n if (typeof window === \"undefined\") {\n return false;\n }\n\n try {\n const url = new URL(window.location.href);\n if (url.protocol === \"file:\") {\n return true;\n }\n } catch {\n return false;\n }\n return isLocalhost(window.location.href);\n}\n"],"mappings":";;;;AAWA,SAAgB,iCAA0C;CAGxD,MAAM,UAAUA,oBAAAA,QAAQ;CACxB,IAAI,YAAY,KAAA,GACd,OAAO,YAAY;CAGrB,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,IAAI;EAEF,IAAI,IADY,IAAI,OAAO,SAAS,IAC9B,CAAC,CAAC,aAAa,SACnB,OAAO;CAEX,QAAQ;EACN,OAAO;CACT;CACA,QAAA,GAAA,iCAAA,YAAA,CAAmB,OAAO,SAAS,IAAI;AACzC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/in-page-ui/issue-card.d.ts
|
|
2
|
+
type IssueCardKind = "error" | "warning";
|
|
3
|
+
declare function getIssueCardCSS(scopeSelector: string): string;
|
|
4
|
+
declare function copyTextToClipboard(text: string): Promise<void>;
|
|
5
|
+
type IssueCardOptions = {
|
|
6
|
+
kind: IssueCardKind; /** Short uppercase label in the card's badge, eg. "Config error". */
|
|
7
|
+
badge: string;
|
|
8
|
+
title: string; /** One or two sentences on what this means for the running app. */
|
|
9
|
+
bodyText: string;
|
|
10
|
+
messageLabel: string;
|
|
11
|
+
message: string; /** Concrete steps the developer should take; rendered as a list above the footer. */
|
|
12
|
+
howToFix?: readonly string[];
|
|
13
|
+
footerText: string;
|
|
14
|
+
ariaLabel: string; /** Prompt for the "copy AI prompt" button, ie. the message plus enough context for a coding agent to fix it. */
|
|
15
|
+
aiPrompt: string;
|
|
16
|
+
onCopyError: (error: unknown) => void;
|
|
17
|
+
onCopyAiPromptError: (error: unknown) => void;
|
|
18
|
+
onMinimize: () => void;
|
|
19
|
+
};
|
|
20
|
+
declare function renderIssueCard(options: IssueCardOptions): HTMLElement;
|
|
21
|
+
type IssueCardFocusTrap = {
|
|
22
|
+
/**
|
|
23
|
+
* Whatever had focus before the card first appeared. Callers that rebind the trap to a re-rendered card pass it back
|
|
24
|
+
* in, so focus still returns to where the developer left it once the card is gone for good.
|
|
25
|
+
*/
|
|
26
|
+
previouslyFocused: HTMLElement | null;
|
|
27
|
+
release: (releaseOptions?: {
|
|
28
|
+
restoreFocus?: boolean;
|
|
29
|
+
}) => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Keeps keyboard focus inside a mounted card, which claims to be an `aria-modal` alertdialog and therefore has to behave
|
|
33
|
+
* like one: the flow behind the card is dead until the problem is fixed, so tabbing into it would only let a keyboard
|
|
34
|
+
* user wander through a page that cannot work while the card stays invisible to them.
|
|
35
|
+
*
|
|
36
|
+
* Call right after mounting the card, and release the trap when the card is minimized, replaced or removed. Releasing
|
|
37
|
+
* hands focus back to `previouslyFocused` unless `restoreFocus: false` is passed, which is what a caller that is about
|
|
38
|
+
* to rebind the trap to a freshly rendered card wants.
|
|
39
|
+
*/
|
|
40
|
+
declare function trapFocusInIssueCard(cardRoot: HTMLElement, options?: {
|
|
41
|
+
moveFocusIntoCard?: boolean;
|
|
42
|
+
previouslyFocused?: HTMLElement | null;
|
|
43
|
+
}): IssueCardFocusTrap;
|
|
44
|
+
declare function renderIssuePill(options: {
|
|
45
|
+
kind: IssueCardKind;
|
|
46
|
+
label: string;
|
|
47
|
+
ariaLabel: string;
|
|
48
|
+
onClick: () => void;
|
|
49
|
+
}): HTMLElement;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { IssueCardFocusTrap, IssueCardKind, IssueCardOptions, copyTextToClipboard, getIssueCardCSS, renderIssueCard, renderIssuePill, trapFocusInIssueCard };
|
|
52
|
+
//# sourceMappingURL=issue-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-card.d.ts","names":[],"sources":["../../src/in-page-ui/issue-card.ts"],"mappings":";KAcY,aAAA;AAAA,iBAII,eAAA,CAAgB,aAAqB;AAAA,iBAyP/B,mBAAA,CAAoB,IAAA,WAAe,OAAO;AAAA,KAkEpD,gBAAA;EACV,IAAA,EAAM,aAAa,EAhUI;EAkUvB,KAAA;EACA,KAAA;EAEA,QAAA;EACA,YAAA;EACA,OAAA,UA1EuC;EA4EvC,QAAA;EACA,UAAA;EACA,SAAA,UAZU;EAcV,QAAA;EACA,WAAA,GAAc,KAAA;EACd,mBAAA,GAAsB,KAAA;EACtB,UAAA;AAAA;AAAA,iBAGc,eAAA,CAAgB,OAAA,EAAS,gBAAA,GAAmB,WAAW;AAAA,KA+D3D,kBAAA;EA7EV;;;;EAkFA,iBAAA,EAAmB,WAAW;EAC9B,OAAA,GAAU,cAAA;IAAmB,YAAA;EAAA;AAAA;;;;;AAxEnB;AAGZ;;;;iBAiFgB,oBAAA,CAAqB,QAAA,EAAU,WAAA,EAAa,OAAA;EAC1D,iBAAA;EACA,iBAAA,GAAoB,WAAA;AAAA,IACb,kBAAA;AAAA,iBA6CO,eAAA,CAAgB,OAAA;EAC9B,IAAA,EAAM,aAAA;EACN,KAAA;EACA,SAAA;EACA,OAAA;AAAA,IACE,WAAW"}
|