@wexio/messenger-widget-react 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -0
  3. package/dist/widget-react-AgErOR36.js +325 -0
  4. package/dist/widget-react-AgErOR36.js.map +1 -0
  5. package/dist/widget-react-BAOIDvhV.js +4250 -0
  6. package/dist/widget-react-BAOIDvhV.js.map +1 -0
  7. package/dist/widget-react-BfPdgAQ-.js +5767 -0
  8. package/dist/widget-react-BfPdgAQ-.js.map +1 -0
  9. package/dist/widget-react-BxvW64LH.js +4429 -0
  10. package/dist/widget-react-BxvW64LH.js.map +1 -0
  11. package/dist/widget-react-C5COLy3m.js +23847 -0
  12. package/dist/widget-react-C5COLy3m.js.map +1 -0
  13. package/dist/widget-react-CAWxn8I0.js +247 -0
  14. package/dist/widget-react-CAWxn8I0.js.map +1 -0
  15. package/dist/widget-react-CDPzwV1i.js +11685 -0
  16. package/dist/widget-react-CDPzwV1i.js.map +1 -0
  17. package/dist/widget-react-CPYwD6FR.js +498 -0
  18. package/dist/widget-react-CPYwD6FR.js.map +1 -0
  19. package/dist/widget-react-CUBFPjaV.js +23 -0
  20. package/dist/widget-react-CUBFPjaV.js.map +1 -0
  21. package/dist/widget-react-CUuKGDZN.js +355 -0
  22. package/dist/widget-react-CUuKGDZN.js.map +1 -0
  23. package/dist/widget-react-CZs0xRrr.js +1336 -0
  24. package/dist/widget-react-CZs0xRrr.js.map +1 -0
  25. package/dist/widget-react-Cj_zbk_F.js +325 -0
  26. package/dist/widget-react-Cj_zbk_F.js.map +1 -0
  27. package/dist/widget-react-D-QrEVpv.js +125 -0
  28. package/dist/widget-react-D-QrEVpv.js.map +1 -0
  29. package/dist/widget-react-D8TPnM9r.js +26 -0
  30. package/dist/widget-react-D8TPnM9r.js.map +1 -0
  31. package/dist/widget-react-DE7AVrCo.js +5737 -0
  32. package/dist/widget-react-DE7AVrCo.js.map +1 -0
  33. package/dist/widget-react-DOX6j7_Q.js +30 -0
  34. package/dist/widget-react-DOX6j7_Q.js.map +1 -0
  35. package/dist/widget-react-DSw03RG7.js +262 -0
  36. package/dist/widget-react-DSw03RG7.js.map +1 -0
  37. package/dist/widget-react-Dew7YaLU.js +16 -0
  38. package/dist/widget-react-Dew7YaLU.js.map +1 -0
  39. package/dist/widget-react-DtOeNw5z.js +325 -0
  40. package/dist/widget-react-DtOeNw5z.js.map +1 -0
  41. package/dist/widget-react-DwL_rsx_.js +630 -0
  42. package/dist/widget-react-DwL_rsx_.js.map +1 -0
  43. package/dist/widget-react.d.ts +301 -0
  44. package/dist/widget-react.js +22285 -0
  45. package/dist/widget-react.js.map +1 -0
  46. package/package.json +41 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-react.js","names":["React","React","React","t","o","r","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","__iconNode","React","createSlot","React","Avatar","React","AvatarImage","useCallbackRef","AvatarFallback","Root","createSlot","React","isSlottable","createSlotClone","getElementRef","mergeProps","SLOTTABLE_IDENTIFIER","createContextScope","React","createSlot","useCallbackRef","React","Primitive","useCallbackRef","count","React","useCallbackRef","Primitive","React","useId","computePosition","arrow","flip","hide","offset","shift","limitShift","size","getComputedStyle","offset","offset$1","shift","shift$1","flip","flip$1","size","size$1","hide","hide$1","arrow","arrow$1","limitShift","limitShift$1","React","NAME","Arrow","React","Primitive","React","createContextScope","React","Primitive","CONTENT_NAME","arrow","floatingUIarrow","useCallbackRef","ARROW_NAME","ArrowPrimitive.Root","Root2","PORTAL_NAME","Portal","React","Primitive","React","useInsertionEffect","React","useLayoutEffect","React","React","Primitive","React","React","React","parse","React","React","React","SideCar","createContextScope","Select","React","PopperPrimitive.Root","useId","SelectTrigger","PopperPrimitive.Anchor","Primitive","SelectValue","Fragment","PortalPrimitive","SelectContent","ReactDOM","RemoveScroll","clamp","PopperPrimitive.Content","SelectItem","PopperPrimitive.Arrow","useCallbackRef","metadata","_typeof","_classCallCheck","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","compare","_createForOfIteratorHelperLoose","_unsupportedIterableToArray","_arrayLikeToArray","_createForOfIteratorHelperLoose","_unsupportedIterableToArray","_arrayLikeToArray","USE_NON_GEOGRAPHIC_COUNTRY_CODE","_createForOfIteratorHelperLoose","_unsupportedIterableToArray","_arrayLikeToArray","USE_NON_GEOGRAPHIC_COUNTRY_CODE","_typeof","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_classCallCheck","_defineProperties","_createClass","_toPrimitive","isPossibleNumber","_typeof","_toPropertyKey","_toPrimitive","_unsupportedIterableToArray","_arrayLikeToArray","parsePhoneNumber","_typeof","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","_typeof","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","_typeof","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","isValidPhoneNumber","_isValidPhoneNumber","_react"],"sources":["../node_modules/@apollo/client/react/context/ApolloProvider.js","../node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js","../node_modules/@apollo/client/react/hooks/useLazyQuery.js","../node_modules/next-intl/dist/esm/production/shared/NextIntlClientProvider.js","../lib/ai-assistant.ts","../lib/graphql/queries/generated/messaging.generated.tsx","../lib/graphql/queries/generated/profile.generated.tsx","../lib/sounds.ts","../lib/use-sound-player.ts","../lib/use-theme-mode.ts","../lib/use-visitor-auth.ts","../lib/locales.ts","../lib/runtime-locale.ts","../lib/use-visitor-profile-preferences.ts","../lib/use-visitor-realtime.ts","../dummy/messages.ts","../lib/use-visitor-unread.ts","../lib/widget-route.ts","../node_modules/lucide-react/dist/esm/icons/arrow-right.mjs","../node_modules/lucide-react/dist/esm/icons/bell.mjs","../node_modules/lucide-react/dist/esm/icons/book.mjs","../node_modules/lucide-react/dist/esm/icons/bookmark.mjs","../node_modules/lucide-react/dist/esm/icons/camera.mjs","../node_modules/lucide-react/dist/esm/icons/circle-question-mark.mjs","../node_modules/lucide-react/dist/esm/icons/command.mjs","../node_modules/lucide-react/dist/esm/icons/file-text.mjs","../node_modules/lucide-react/dist/esm/icons/gamepad-2.mjs","../node_modules/lucide-react/dist/esm/icons/hash.mjs","../node_modules/lucide-react/dist/esm/icons/heart.mjs","../node_modules/lucide-react/dist/esm/icons/image-plus.mjs","../node_modules/lucide-react/dist/esm/icons/lightbulb.mjs","../node_modules/lucide-react/dist/esm/icons/lock.mjs","../node_modules/lucide-react/dist/esm/icons/mail.mjs","../node_modules/lucide-react/dist/esm/icons/message-circle-more.mjs","../node_modules/lucide-react/dist/esm/icons/message-circle.mjs","../node_modules/lucide-react/dist/esm/icons/message-square.mjs","../node_modules/lucide-react/dist/esm/icons/monitor.mjs","../node_modules/lucide-react/dist/esm/icons/moon.mjs","../node_modules/lucide-react/dist/esm/icons/paperclip.mjs","../node_modules/lucide-react/dist/esm/icons/phone.mjs","../node_modules/lucide-react/dist/esm/icons/search.mjs","../node_modules/lucide-react/dist/esm/icons/shield.mjs","../node_modules/lucide-react/dist/esm/icons/smile.mjs","../node_modules/lucide-react/dist/esm/icons/sparkles.mjs","../node_modules/lucide-react/dist/esm/icons/star.mjs","../node_modules/lucide-react/dist/esm/icons/sun.mjs","../node_modules/lucide-react/dist/esm/icons/trash-2.mjs","../node_modules/lucide-react/dist/esm/icons/user.mjs","../node_modules/lucide-react/dist/esm/icons/users.mjs","../node_modules/lucide-react/dist/esm/icons/video.mjs","../node_modules/lucide-react/dist/esm/icons/volume-2.mjs","../node_modules/lucide-react/dist/esm/icons/volume-x.mjs","../components/widget/unread-badge.tsx","../components/widget/bottom-nav.tsx","../components/widget/branding-footer.tsx","../components/widget/sound-toggle.tsx","../components/widget/conversation-header.tsx","../components/widget/demo-messages.tsx","../components/widget/help-list-row.tsx","../components/widget/help-category-view.tsx","../lib/strip-html.ts","../components/widget/launcher-peek.tsx","../components/widget/tab-title-header.tsx","../components/widget/tabs/help-tab.tsx","../node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context/dist/index.mjs","../node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive/dist/index.mjs","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../node_modules/use-sync-external-store/shim/index.js","../node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs","../node_modules/@radix-ui/react-avatar/dist/index.mjs","../components/ui/avatar.tsx","../components/widget/home-blocks/blocks/ask-question.tsx","../components/widget/home-blocks/helpers.tsx","../components/widget/home-blocks/blocks/featured-article.tsx","../components/widget/home-blocks/blocks/help-search.tsx","../components/widget/home-blocks/shared.tsx","../components/widget/home-blocks/blocks/news-preview.tsx","../components/widget/home-blocks/blocks/pinned-articles.tsx","../components/widget/icons/brand-icons.tsx","../components/widget/home-blocks/blocks/quick-actions.tsx","../components/widget/icons/wexio-mark.tsx","../components/widget/home-blocks/blocks/recent-message.tsx","../components/widget/home-blocks/blocks/rich-text.tsx","../components/widget/home-blocks/blocks/team-status.tsx","../components/widget/home-blocks/index.tsx","../components/widget/tabs/home-tab.tsx","../lib/file-to-base64.ts","../components/widget/auth/google-sign-in-button.tsx","../node_modules/@simplewebauthn/browser/dist/bundle/index.js","../lib/use-passkey-auth.ts","../components/widget/auth/passkey-sign-in-button.tsx","../components/widget/tabs/messages-tab/composer/attachment-preview.tsx","../components/widget/tabs/messages-tab/composer/emoji-picker.tsx","../components/widget/tabs/messages-tab/composer/morph-send-button.tsx","../components/widget/tabs/messages-tab/dummy-reply.ts","../components/widget/tabs/messages-tab/message/date-separator.tsx","../lib/internal-link.ts","../components/widget/tabs/messages-tab/message/bot-avatar.tsx","../components/widget/tabs/messages-tab/message/message-bubble.tsx","../components/widget/tabs/messages-tab/message/typing-bubble.tsx","../components/widget/tabs/messages-tab/message/unread-divider.tsx","../components/widget/tabs/messages-tab/message/typewriter.tsx","../components/widget/tabs/messages-tab/message/welcome-message.tsx","../components/widget/tabs/messages-tab/message-mapping.ts","../components/widget/tabs/messages-tab/message-rows.ts","../components/ui/input.tsx","../components/widget/tabs/messages-tab/prechat-form/helpers.ts","../components/widget/tabs/messages-tab/prechat-form/composer-fields.tsx","../components/widget/tabs/messages-tab/index.tsx","../components/widget/tabs/profile-tab/avatar-hero.tsx","../components/widget/tabs/profile-tab/switch.tsx","../components/widget/tabs/profile-tab/field-controls/boolean-control.tsx","../components/widget/tabs/profile-tab/helpers.ts","../components/widget/tabs/profile-tab/input-class.ts","../components/widget/tabs/profile-tab/field-controls/date-control.tsx","../components/widget/tabs/profile-tab/field-controls/number-control.tsx","../node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs","../node_modules/@radix-ui/react-collection/dist/index.mjs","../node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs","../node_modules/@radix-ui/react-focus-guards/dist/index.mjs","../node_modules/@radix-ui/react-focus-scope/dist/index.mjs","../node_modules/@radix-ui/react-id/dist/index.mjs","../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs","../node_modules/@radix-ui/react-arrow/dist/index.mjs","../node_modules/@radix-ui/react-use-size/dist/index.mjs","../node_modules/@radix-ui/react-popper/dist/index.mjs","../node_modules/@radix-ui/react-portal/dist/index.mjs","../node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-slot/dist/index.mjs","../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs","../node_modules/@radix-ui/react-use-previous/dist/index.mjs","../node_modules/@radix-ui/react-visually-hidden/dist/index.mjs","../node_modules/aria-hidden/dist/es2015/index.js","../node_modules/react-remove-scroll-bar/dist/es2015/constants.js","../node_modules/use-callback-ref/dist/es2015/assignRef.js","../node_modules/use-callback-ref/dist/es2015/useRef.js","../node_modules/use-callback-ref/dist/es2015/useMergeRef.js","../node_modules/use-sidecar/dist/es2015/medium.js","../node_modules/use-sidecar/dist/es2015/exports.js","../node_modules/react-remove-scroll/dist/es2015/medium.js","../node_modules/react-remove-scroll/dist/es2015/UI.js","../node_modules/get-nonce/dist/es2015/index.js","../node_modules/react-style-singleton/dist/es2015/singleton.js","../node_modules/react-style-singleton/dist/es2015/hook.js","../node_modules/react-style-singleton/dist/es2015/component.js","../node_modules/react-remove-scroll-bar/dist/es2015/utils.js","../node_modules/react-remove-scroll-bar/dist/es2015/component.js","../node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js","../node_modules/react-remove-scroll/dist/es2015/handleScroll.js","../node_modules/react-remove-scroll/dist/es2015/SideEffect.js","../node_modules/react-remove-scroll/dist/es2015/sidecar.js","../node_modules/react-remove-scroll/dist/es2015/Combination.js","../node_modules/@radix-ui/react-select/dist/index.mjs","../components/ui/select.tsx","../components/widget/tabs/profile-tab/system-field-labels.ts","../components/widget/tabs/profile-tab/field-controls/options-control.tsx","../components/widget/tabs/profile-tab/field-controls/string-control.tsx","../components/widget/tabs/profile-tab/field-controls/index.tsx","../components/widget/tabs/profile-tab/field-row.tsx","../components/widget/tabs/profile-tab/section.tsx","../components/widget/tabs/profile-tab/settings-row.tsx","../components/widget/tabs/profile-tab/preferences-section.tsx","../components/widget/tabs/profile-tab/profile-error.ts","../components/widget/tabs/profile-tab/use-apply-pref.ts","../node_modules/libphonenumber-js/metadata.min.json.js","../node_modules/libphonenumber-js/min/exports/withMetadataArgument.js","../node_modules/libphonenumber-js/es6/tools/semver-compare.js","../node_modules/libphonenumber-js/es6/helpers/isObject.js","../node_modules/libphonenumber-js/es6/helpers/isCallingCode.js","../node_modules/libphonenumber-js/es6/metadata.js","../node_modules/libphonenumber-js/es6/helpers/mergeArrays.js","../node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js","../node_modules/libphonenumber-js/es6/isPossible.js","../node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js","../node_modules/libphonenumber-js/es6/helpers/getNumberType.js","../node_modules/libphonenumber-js/es6/isValid.js","../node_modules/libphonenumber-js/es6/helpers/isCountryCode.js","../node_modules/libphonenumber-js/es6/helpers/getCountryAndCallingCodeFromOneOfThem.js","../node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js","../node_modules/libphonenumber-js/es6/constants.js","../node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js","../node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js","../node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js","../node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js","../node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js","../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js","../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js","../node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js","../node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js","../node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js","../node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js","../node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js","../node_modules/libphonenumber-js/es6/helpers/RFC3966.js","../node_modules/libphonenumber-js/es6/format.js","../node_modules/libphonenumber-js/es6/PhoneNumber.js","../node_modules/libphonenumber-js/es6/ParseError.js","../node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js","../node_modules/libphonenumber-js/es6/helpers/parseDigits.js","../node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js","../node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js","../node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js","../node_modules/libphonenumber-js/es6/parse.js","../node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js","../node_modules/libphonenumber-js/es6/normalizeArguments.js","../node_modules/libphonenumber-js/es6/parsePhoneNumber_.js","../node_modules/libphonenumber-js/es6/isValidPhoneNumber.js","../node_modules/libphonenumber-js/min/exports/isValidPhoneNumber.js","../components/widget/tabs/profile-tab/validators.ts","../components/widget/tabs/profile-tab/index.tsx","../components/widget/widget-launcher.tsx","../components/widget/widget-shell/helpers.ts","../components/widget/widget-shell/index.tsx","../node_modules/next/dist/compiled/@edge-runtime/cookies/index.js","../node_modules/next/dist/server/web/spec-extension/cookies.js","../node_modules/next/dist/server/web/spec-extension/adapters/reflect.js","../node_modules/next/dist/server/app-render/async-local-storage.js","../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../node_modules/next/dist/server/app-render/work-async-storage.external.js","../node_modules/next/dist/shared/lib/action-revalidation-kind.js","../node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js","../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../node_modules/next/dist/client/components/app-router-headers.js","../node_modules/next/dist/shared/lib/invariant-error.js","../node_modules/next/dist/shared/lib/promise-with-resolvers.js","../node_modules/next/dist/server/app-render/staged-rendering.js","../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../node_modules/next/dist/client/components/hooks-server-context.js","../node_modules/next/dist/client/components/static-generation-bailout.js","../node_modules/next/dist/server/dynamic-rendering-utils.js","../node_modules/next/dist/lib/framework/boundary-constants.js","../node_modules/next/dist/lib/scheduler.js","../node_modules/next/dist/shared/lib/lazy-dynamic/bailout-to-csr.js","../node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js","../node_modules/next/dist/server/app-render/dynamic-rendering.js","../node_modules/next/dist/server/create-deduped-by-callsite-server-error-logger.js","../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../node_modules/next/dist/server/request/utils.js","../node_modules/next/dist/server/request/cookies.js","../node_modules/next/dist/server/web/spec-extension/adapters/headers.js","../node_modules/next/dist/server/request/headers.js","../node_modules/next/dist/server/request/draft-mode.js","../node_modules/next/headers.js","../node_modules/next-intl/dist/esm/production/server/react-client/index.js","../lib/i18n.ts","../lib/locale-detect.ts","../react-component/styles.css?inline","../react-component/index.tsx"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n var parentContext = React.useContext(ApolloContext);\n var context = React.useMemo(function () {\n return __assign(__assign({}, parentContext), { client: client || parentContext.client });\n }, [parentContext, client]);\n invariant(context.client, 71);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n};\n//# sourceMappingURL=ApolloProvider.js.map","import * as React from \"rehackt\";\nvar Ctx;\nfunction noop() { }\nexport function useRenderGuard() {\n if (!Ctx) {\n // we want the intialization to be lazy because `createContext` would error on import in a RSC\n Ctx = React.createContext(null);\n }\n return React.useCallback(\n /**\n * @returns true if the hook was called during render\n */ function () {\n var orig = console.error;\n try {\n console.error = noop;\n /**\n * `useContext` can be called conditionally during render, so this is safe.\n * (Also, during render we would want to throw as a reaction to this anyways, so it\n * wouldn't even matter if we got the order of hooks mixed up...)\n *\n * They cannot however be called outside of Render, and that's what we're testing here.\n *\n * Different versions of React have different behaviour on an invalid hook call:\n *\n * React 16.8 - 17: throws an error\n * https://github.com/facebook/react/blob/2b93d686e359c7afa299e2ec5cf63160a32a1155/packages/react/src/ReactHooks.js#L18-L26\n *\n * React 18 & 19: `console.error` in development, then `resolveDispatcher` returns `null` and a member access on `null` throws.\n * https://github.com/facebook/react/blob/58e8304483ebfadd02a295339b5e9a989ac98c6e/packages/react/src/ReactHooks.js#L28-L35\n */\n React[\"useContext\" /* hide this from the linter */](Ctx);\n return true;\n }\n catch (e) {\n return false;\n }\n finally {\n console.error = orig;\n }\n }, []);\n}\n//# sourceMappingURL=useRenderGuard.js.map","import { __assign } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { createMakeWatchQueryOptions, getDefaultFetchPolicy, getObsQueryOptions, toQueryResult, useQueryInternals, } from \"./useQuery.js\";\nimport { useIsomorphicLayoutEffect } from \"./internal/useIsomorphicLayoutEffect.js\";\nimport { useWarnRemovedOption } from \"./internal/useWarnRemovedOption.js\";\nimport { invariant } from \"../../utilities/globals/invariantWrappers.js\";\nimport { warnRemovedOption } from \"../../utilities/index.js\";\nimport { useRenderGuard } from \"./internal/index.js\";\n// The following methods, when called will execute the query, regardless of\n// whether the useLazyQuery execute function was called before.\nvar EAGER_METHODS = [\n \"refetch\",\n \"reobserve\",\n \"fetchMore\",\n \"updateQuery\",\n \"startPolling\",\n \"stopPolling\",\n \"subscribeToMore\",\n];\nvar REMOVED_EXECUTE_OPTIONS = [\n \"initialFetchPolicy\",\n \"onCompleted\",\n \"onError\",\n \"defaultOptions\",\n \"partialRefetch\",\n \"canonizeResults\",\n];\nvar DEPRECATED_EXECUTE_OPTIONS = [\n \"query\",\n \"ssr\",\n \"client\",\n \"fetchPolicy\",\n \"nextFetchPolicy\",\n \"refetchWritePolicy\",\n \"errorPolicy\",\n \"pollInterval\",\n \"notifyOnNetworkStatusChange\",\n \"returnPartialData\",\n \"skipPollAttempt\",\n];\n/**\n * A hook for imperatively executing queries in an Apollo application, e.g. in response to user interaction.\n *\n * > Refer to the [Queries - Manual execution with useLazyQuery](https://www.apollographql.com/docs/react/data/queries#manual-execution-with-uselazyquery) section for a more in-depth overview of `useLazyQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useLazyQuery } from \"@apollo/client\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const [loadGreeting, { called, loading, data }] = useLazyQuery(\n * GET_GREETING,\n * { variables: { language: \"english\" } }\n * );\n * if (called && loading) return <p>Loading ...</p>\n * if (!called) {\n * return <button onClick={() => loadGreeting()}>Load greeting</button>\n * }\n * return <h1>Hello {data.greeting.message}!</h1>;\n * }\n * ```\n * @since 3.0.0\n *\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Default options to control how the query is executed.\n * @returns A tuple in the form of `[execute, result]`\n */\nexport function useLazyQuery(query, options) {\n var _a;\n if (globalThis.__DEV__ !== false) {\n /* eslint-disable react-hooks/rules-of-hooks, react-compiler/react-compiler */\n var warnOpts = options || {};\n useWarnRemovedOption(warnOpts, \"canonizeResults\", \"useLazyQuery\");\n useWarnRemovedOption(warnOpts, \"variables\", \"useLazyQuery\", \"Pass all `variables` to the returned `execute` function instead.\");\n useWarnRemovedOption(warnOpts, \"context\", \"useLazyQuery\", \"Pass `context` to the returned `execute` function instead.\");\n useWarnRemovedOption(warnOpts, \"onCompleted\", \"useLazyQuery\", \"If your `onCompleted` callback sets local state, switch to use derived state using `data` returned from the hook instead. Use `useEffect` to perform side-effects as a result of updates to `data`.\");\n useWarnRemovedOption(warnOpts, \"onError\", \"useLazyQuery\", \"If your `onError` callback sets local state, switch to use derived state using `data`, `error` or `errors` returned from the hook instead. Use `useEffect` if you need to perform side-effects as a result of updates to `data`, `error` or `errors`.\");\n useWarnRemovedOption(warnOpts, \"defaultOptions\", \"useLazyQuery\", \"Pass the options directly to the hook instead.\");\n useWarnRemovedOption(warnOpts, \"initialFetchPolicy\", \"useLazyQuery\", \"Use the `fetchPolicy` option instead.\");\n useWarnRemovedOption(warnOpts, \"partialRefetch\", \"useLazyQuery\");\n /* eslint-enable react-hooks/rules-of-hooks, react-compiler/react-compiler */\n }\n var execOptionsRef = React.useRef(void 0);\n var optionsRef = React.useRef(void 0);\n var queryRef = React.useRef(void 0);\n var merged = mergeOptions(options, execOptionsRef.current || {});\n var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query;\n // Use refs to track options and the used query to ensure the `execute`\n // function remains referentially stable between renders.\n optionsRef.current = options;\n queryRef.current = document;\n var queryHookOptions = __assign(__assign({}, merged), { skip: !execOptionsRef.current });\n var _b = useQueryInternals(document, queryHookOptions), obsQueryFields = _b.obsQueryFields, useQueryResult = _b.result, client = _b.client, resultData = _b.resultData, observable = _b.observable, onQueryExecuted = _b.onQueryExecuted;\n var initialFetchPolicy = observable.options.initialFetchPolicy ||\n getDefaultFetchPolicy(queryHookOptions.defaultOptions, client.defaultOptions);\n var forceUpdateState = React.useReducer(function (tick) { return tick + 1; }, 0)[1];\n // We use useMemo here to make sure the eager methods have a stable identity.\n var eagerMethods = React.useMemo(function () {\n var eagerMethods = {};\n var _loop_1 = function (key) {\n var method = obsQueryFields[key];\n eagerMethods[key] = function () {\n if (globalThis.__DEV__ !== false) {\n if (key === \"reobserve\") {\n globalThis.__DEV__ !== false && invariant.warn(79);\n }\n }\n if (!execOptionsRef.current) {\n execOptionsRef.current = Object.create(null);\n // Only the first time populating execOptionsRef.current matters here.\n forceUpdateState();\n }\n // @ts-expect-error this is just too generic to type\n return method.apply(this, arguments);\n };\n };\n for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) {\n var key = EAGER_METHODS_1[_i];\n _loop_1(key);\n }\n return eagerMethods;\n }, [forceUpdateState, obsQueryFields]);\n var called = !!execOptionsRef.current;\n var result = React.useMemo(function () { return (__assign(__assign(__assign({}, useQueryResult), eagerMethods), { called: called })); }, [useQueryResult, eagerMethods, called]);\n var calledDuringRender = useRenderGuard();\n var warnRef = React.useRef(new Set());\n var execute = React.useCallback(function (executeOptions) {\n if (globalThis.__DEV__ !== false) {\n if (calledDuringRender()) {\n globalThis.__DEV__ !== false && invariant.warn(80);\n }\n for (var _i = 0, REMOVED_EXECUTE_OPTIONS_1 = REMOVED_EXECUTE_OPTIONS; _i < REMOVED_EXECUTE_OPTIONS_1.length; _i++) {\n var name_1 = REMOVED_EXECUTE_OPTIONS_1[_i];\n if (!warnRef.current.has(name_1)) {\n warnRemovedOption(executeOptions || {}, name_1, \"useLazyQuery.execute\");\n warnRef.current.add(name_1);\n }\n }\n for (var _a = 0, DEPRECATED_EXECUTE_OPTIONS_1 = DEPRECATED_EXECUTE_OPTIONS; _a < DEPRECATED_EXECUTE_OPTIONS_1.length; _a++) {\n var name_2 = DEPRECATED_EXECUTE_OPTIONS_1[_a];\n if (!warnRef.current.has(name_2)) {\n warnRemovedOption(executeOptions || {}, name_2, \"useLazyQuery.execute\", \"Please pass the option to the `useLazyQuery` hook instead.\");\n warnRef.current.add(name_2);\n }\n }\n }\n execOptionsRef.current =\n executeOptions ? __assign(__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {\n fetchPolicy: initialFetchPolicy,\n };\n var options = mergeOptions(optionsRef.current, __assign({ query: queryRef.current }, execOptionsRef.current));\n var promise = executeQuery(resultData, observable, client, document, __assign(__assign({}, options), { skip: false }), onQueryExecuted).then(function (queryResult) { return Object.assign(queryResult, eagerMethods); });\n // Because the return value of `useLazyQuery` is usually floated, we need\n // to catch the promise to prevent unhandled rejections.\n promise.catch(function () { });\n return promise;\n }, [\n calledDuringRender,\n client,\n document,\n eagerMethods,\n initialFetchPolicy,\n observable,\n resultData,\n onQueryExecuted,\n ]);\n var executeRef = React.useRef(execute);\n useIsomorphicLayoutEffect(function () {\n executeRef.current = execute;\n });\n var stableExecute = React.useCallback(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return executeRef.current.apply(executeRef, args);\n }, []);\n return [stableExecute, result];\n}\nfunction executeQuery(resultData, observable, client, currentQuery, options, onQueryExecuted) {\n var query = options.query || currentQuery;\n var watchQueryOptions = createMakeWatchQueryOptions(client, query, options, false)(observable);\n var concast = observable.reobserveAsConcast(getObsQueryOptions(observable, client, options, watchQueryOptions));\n onQueryExecuted(watchQueryOptions);\n return new Promise(function (resolve) {\n var result;\n // Subscribe to the concast independently of the ObservableQuery in case\n // the component gets unmounted before the promise resolves. This prevents\n // the concast from terminating early and resolving with `undefined` when\n // there are no more subscribers for the concast.\n concast.subscribe({\n next: function (value) {\n result = value;\n },\n error: function () {\n resolve(toQueryResult(observable.getCurrentResult(), resultData.previousData, observable, client));\n },\n complete: function () {\n resolve(toQueryResult(observable[\"maskResult\"](result), resultData.previousData, observable, client));\n },\n });\n });\n}\n//# sourceMappingURL=useLazyQuery.js.map","\"use client\";\nimport{IntlProvider as r}from\"use-intl/react\";import{jsx as o}from\"react/jsx-runtime\";function t({locale:t,...e}){if(!t)throw new Error(void 0);return o(r,{locale:t,...e})}export{t as default};\n","/**\n * Single source of truth for the AI assistant's display name. Used by\n * the message bubbles, launcher peek, typing indicator, recent-message\n * preview, history/SSE relabeling, and the demo data — so the assistant\n * reads as one consistent identity everywhere (and renaming is a\n * one-line change here).\n */\nexport const AI_ASSISTANT_NAME = \"Gaia\";\n","/* eslint-disable */\n/* biome-disable */\n/** Internal type. DO NOT USE DIRECTLY. */\ntype Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\n/** Internal type. DO NOT USE DIRECTLY. */\nexport type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };\nimport * as Types from '@/lib/graphql/generated/types';\n\nimport { gql } from '@apollo/client';\nimport * as Apollo from '@apollo/client';\nconst defaultOptions = {} as const;\nexport type VisitorAnonymousAuthInput = {\n contextSnapshot?: string | null | undefined;\n turnstileToken?: string | null | undefined;\n visitorId: string;\n website?: string | null | undefined;\n};\n\nexport type VisitorIdentifiedAuthInput = {\n contextSnapshot?: string | null | undefined;\n email?: string | null | undefined;\n googleIdToken?: string | null | undefined;\n jwt?: string | null | undefined;\n name?: string | null | undefined;\n phone?: string | null | undefined;\n turnstileToken?: string | null | undefined;\n userHash?: string | null | undefined;\n userId?: string | null | undefined;\n visitorId: string;\n website?: string | null | undefined;\n};\n\nexport type VisitorLocationInputType = {\n address?: string | null | undefined;\n latitude: number;\n longitude: number;\n name?: string | null | undefined;\n};\n\nexport type VisitorPrechatFieldEntryInput = {\n key: string;\n value: string;\n};\n\nexport type VisitorPrechatInput = {\n fields: Array<VisitorPrechatFieldEntryInput>;\n};\n\nexport type VisitorSendMessageInput = {\n location?: VisitorLocationInputType | null | undefined;\n mediaIds?: Array<string> | null | undefined;\n text?: string | null | undefined;\n turnstileToken?: string | null | undefined;\n};\n\nexport type VisitorUploadInputType = {\n dataBase64: string;\n filename: string;\n mimetype: string;\n};\n\nexport type StartAnonymousVisitorMutationVariables = Exact<{\n input: Types.VisitorAnonymousAuthInput;\n}>;\n\n\nexport type StartAnonymousVisitorMutation = { __typename: 'Mutation', startAnonymousVisitor: { __typename: 'VisitorAuthResult', token: string, expiresIn: number, chatId: string, peopleId: string, visitorId: string, kind: string, displayName: string, shortHandle: string } };\n\nexport type StartIdentifiedVisitorMutationVariables = Exact<{\n input: Types.VisitorIdentifiedAuthInput;\n}>;\n\n\nexport type StartIdentifiedVisitorMutation = { __typename: 'Mutation', startIdentifiedVisitor: { __typename: 'VisitorAuthResult', token: string, expiresIn: number, chatId: string, peopleId: string, visitorId: string, kind: string, displayName: string, shortHandle: string } };\n\nexport type SendVisitorMessageMutationVariables = Exact<{\n input: Types.VisitorSendMessageInput;\n}>;\n\n\nexport type SendVisitorMessageMutation = { __typename: 'Mutation', sendVisitorMessage: { __typename: 'VisitorMessageAck', ok: boolean, messageId: string | null } };\n\nexport type MarkVisitorMessageReadMutationVariables = Exact<{\n messageId: string;\n}>;\n\n\nexport type MarkVisitorMessageReadMutation = { __typename: 'Mutation', markVisitorMessageRead: { __typename: 'WebOkResponse', ok: boolean } };\n\nexport type MarkVisitorChatReadMutationVariables = Exact<{\n chatId: string;\n}>;\n\n\nexport type MarkVisitorChatReadMutation = { __typename: 'Mutation', markVisitorChatRead: { __typename: 'VisitorReadResult', count: number } };\n\nexport type VisitorChatUnreadQueryVariables = Exact<{\n chatId: string;\n}>;\n\n\nexport type VisitorChatUnreadQuery = { __typename: 'Query', visitorChatUnread: { __typename: 'VisitorChatUnread', count: number, lastMessage: { __typename: 'VisitorUnreadLastMessage', id: string, text: string | null, buttons: unknown, createdAt: string, sender: { __typename: 'VisitorUnreadSender', kind: string, name: string, avatar: string | null } } | null } };\n\nexport type SignalVisitorTypingMutationVariables = Exact<{ [key: string]: never; }>;\n\n\nexport type SignalVisitorTypingMutation = { __typename: 'Mutation', signalVisitorTyping: { __typename: 'WebOkResponse', ok: boolean } };\n\nexport type UploadVisitorMediaMutationVariables = Exact<{\n input: Types.VisitorUploadInputType;\n}>;\n\n\nexport type UploadVisitorMediaMutation = { __typename: 'Mutation', uploadVisitorMedia: { __typename: 'VisitorUploadResult', url: string, mediaId: string, mimetype: string, size: number } };\n\nexport type RemoveVisitorMediaMutationVariables = Exact<{\n mediaId: string;\n}>;\n\n\nexport type RemoveVisitorMediaMutation = { __typename: 'Mutation', removeVisitorMedia: { __typename: 'WebOkResponse', ok: boolean } };\n\nexport type SubmitVisitorPrechatMutationVariables = Exact<{\n input: Types.VisitorPrechatInput;\n}>;\n\n\nexport type SubmitVisitorPrechatMutation = { __typename: 'Mutation', submitVisitorPrechat: { __typename: 'WebOkResponse', ok: boolean } };\n\nexport type VisitorChatHistoryQueryVariables = Exact<{\n chatId: string;\n before?: string | null | undefined;\n limit?: number | null | undefined;\n}>;\n\n\nexport type VisitorChatHistoryQuery = { __typename: 'Query', visitorChatHistory: unknown };\n\nexport type VisitorChatRecentInboundQueryVariables = Exact<{\n chatId: string;\n}>;\n\n\nexport type VisitorChatRecentInboundQuery = { __typename: 'Query', visitorChatRecentInbound: { __typename: 'VisitorChatRecentInbound', id: string, text: string | null, createdAt: string, sender: { __typename: 'VisitorUnreadSender', kind: string, name: string, avatar: string | null } } | null };\n\n\nexport const StartAnonymousVisitorDocument = gql`\n mutation StartAnonymousVisitor($input: VisitorAnonymousAuthInput!) {\n startAnonymousVisitor(input: $input) {\n token\n expiresIn\n chatId\n peopleId\n visitorId\n kind\n displayName\n shortHandle\n }\n}\n `;\nexport type StartAnonymousVisitorMutationFn = Apollo.MutationFunction<StartAnonymousVisitorMutation, StartAnonymousVisitorMutationVariables>;\n\n/**\n * __useStartAnonymousVisitorMutation__\n *\n * To run a mutation, you first call `useStartAnonymousVisitorMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useStartAnonymousVisitorMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [startAnonymousVisitorMutation, { data, loading, error }] = useStartAnonymousVisitorMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useStartAnonymousVisitorMutation(baseOptions?: Apollo.MutationHookOptions<StartAnonymousVisitorMutation, StartAnonymousVisitorMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<StartAnonymousVisitorMutation, StartAnonymousVisitorMutationVariables>(StartAnonymousVisitorDocument, options);\n }\nexport type StartAnonymousVisitorMutationHookResult = ReturnType<typeof useStartAnonymousVisitorMutation>;\nexport type StartAnonymousVisitorMutationResult = Apollo.MutationResult<StartAnonymousVisitorMutation>;\nexport type StartAnonymousVisitorMutationOptions = Apollo.BaseMutationOptions<StartAnonymousVisitorMutation, StartAnonymousVisitorMutationVariables>;\nexport const StartIdentifiedVisitorDocument = gql`\n mutation StartIdentifiedVisitor($input: VisitorIdentifiedAuthInput!) {\n startIdentifiedVisitor(input: $input) {\n token\n expiresIn\n chatId\n peopleId\n visitorId\n kind\n displayName\n shortHandle\n }\n}\n `;\nexport type StartIdentifiedVisitorMutationFn = Apollo.MutationFunction<StartIdentifiedVisitorMutation, StartIdentifiedVisitorMutationVariables>;\n\n/**\n * __useStartIdentifiedVisitorMutation__\n *\n * To run a mutation, you first call `useStartIdentifiedVisitorMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useStartIdentifiedVisitorMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [startIdentifiedVisitorMutation, { data, loading, error }] = useStartIdentifiedVisitorMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useStartIdentifiedVisitorMutation(baseOptions?: Apollo.MutationHookOptions<StartIdentifiedVisitorMutation, StartIdentifiedVisitorMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<StartIdentifiedVisitorMutation, StartIdentifiedVisitorMutationVariables>(StartIdentifiedVisitorDocument, options);\n }\nexport type StartIdentifiedVisitorMutationHookResult = ReturnType<typeof useStartIdentifiedVisitorMutation>;\nexport type StartIdentifiedVisitorMutationResult = Apollo.MutationResult<StartIdentifiedVisitorMutation>;\nexport type StartIdentifiedVisitorMutationOptions = Apollo.BaseMutationOptions<StartIdentifiedVisitorMutation, StartIdentifiedVisitorMutationVariables>;\nexport const SendVisitorMessageDocument = gql`\n mutation SendVisitorMessage($input: VisitorSendMessageInput!) {\n sendVisitorMessage(input: $input) {\n ok\n messageId\n }\n}\n `;\nexport type SendVisitorMessageMutationFn = Apollo.MutationFunction<SendVisitorMessageMutation, SendVisitorMessageMutationVariables>;\n\n/**\n * __useSendVisitorMessageMutation__\n *\n * To run a mutation, you first call `useSendVisitorMessageMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useSendVisitorMessageMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [sendVisitorMessageMutation, { data, loading, error }] = useSendVisitorMessageMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useSendVisitorMessageMutation(baseOptions?: Apollo.MutationHookOptions<SendVisitorMessageMutation, SendVisitorMessageMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<SendVisitorMessageMutation, SendVisitorMessageMutationVariables>(SendVisitorMessageDocument, options);\n }\nexport type SendVisitorMessageMutationHookResult = ReturnType<typeof useSendVisitorMessageMutation>;\nexport type SendVisitorMessageMutationResult = Apollo.MutationResult<SendVisitorMessageMutation>;\nexport type SendVisitorMessageMutationOptions = Apollo.BaseMutationOptions<SendVisitorMessageMutation, SendVisitorMessageMutationVariables>;\nexport const MarkVisitorMessageReadDocument = gql`\n mutation MarkVisitorMessageRead($messageId: String!) {\n markVisitorMessageRead(messageId: $messageId) {\n ok\n }\n}\n `;\nexport type MarkVisitorMessageReadMutationFn = Apollo.MutationFunction<MarkVisitorMessageReadMutation, MarkVisitorMessageReadMutationVariables>;\n\n/**\n * __useMarkVisitorMessageReadMutation__\n *\n * To run a mutation, you first call `useMarkVisitorMessageReadMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useMarkVisitorMessageReadMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [markVisitorMessageReadMutation, { data, loading, error }] = useMarkVisitorMessageReadMutation({\n * variables: {\n * messageId: // value for 'messageId'\n * },\n * });\n */\nexport function useMarkVisitorMessageReadMutation(baseOptions?: Apollo.MutationHookOptions<MarkVisitorMessageReadMutation, MarkVisitorMessageReadMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<MarkVisitorMessageReadMutation, MarkVisitorMessageReadMutationVariables>(MarkVisitorMessageReadDocument, options);\n }\nexport type MarkVisitorMessageReadMutationHookResult = ReturnType<typeof useMarkVisitorMessageReadMutation>;\nexport type MarkVisitorMessageReadMutationResult = Apollo.MutationResult<MarkVisitorMessageReadMutation>;\nexport type MarkVisitorMessageReadMutationOptions = Apollo.BaseMutationOptions<MarkVisitorMessageReadMutation, MarkVisitorMessageReadMutationVariables>;\nexport const MarkVisitorChatReadDocument = gql`\n mutation MarkVisitorChatRead($chatId: String!) {\n markVisitorChatRead(chatId: $chatId) {\n count\n }\n}\n `;\nexport type MarkVisitorChatReadMutationFn = Apollo.MutationFunction<MarkVisitorChatReadMutation, MarkVisitorChatReadMutationVariables>;\n\n/**\n * __useMarkVisitorChatReadMutation__\n *\n * To run a mutation, you first call `useMarkVisitorChatReadMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useMarkVisitorChatReadMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [markVisitorChatReadMutation, { data, loading, error }] = useMarkVisitorChatReadMutation({\n * variables: {\n * chatId: // value for 'chatId'\n * },\n * });\n */\nexport function useMarkVisitorChatReadMutation(baseOptions?: Apollo.MutationHookOptions<MarkVisitorChatReadMutation, MarkVisitorChatReadMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<MarkVisitorChatReadMutation, MarkVisitorChatReadMutationVariables>(MarkVisitorChatReadDocument, options);\n }\nexport type MarkVisitorChatReadMutationHookResult = ReturnType<typeof useMarkVisitorChatReadMutation>;\nexport type MarkVisitorChatReadMutationResult = Apollo.MutationResult<MarkVisitorChatReadMutation>;\nexport type MarkVisitorChatReadMutationOptions = Apollo.BaseMutationOptions<MarkVisitorChatReadMutation, MarkVisitorChatReadMutationVariables>;\nexport const VisitorChatUnreadDocument = gql`\n query VisitorChatUnread($chatId: String!) {\n visitorChatUnread(chatId: $chatId) {\n count\n lastMessage {\n id\n text\n buttons\n createdAt\n sender {\n kind\n name\n avatar\n }\n }\n }\n}\n `;\n\n/**\n * __useVisitorChatUnreadQuery__\n *\n * To run a query within a React component, call `useVisitorChatUnreadQuery` and pass it any options that fit your needs.\n * When your component renders, `useVisitorChatUnreadQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useVisitorChatUnreadQuery({\n * variables: {\n * chatId: // value for 'chatId'\n * },\n * });\n */\nexport function useVisitorChatUnreadQuery(baseOptions: Apollo.QueryHookOptions<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables> & ({ variables: VisitorChatUnreadQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useQuery<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>(VisitorChatUnreadDocument, options);\n }\nexport function useVisitorChatUnreadLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useLazyQuery<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>(VisitorChatUnreadDocument, options);\n }\n// @ts-ignore\nexport function useVisitorChatUnreadSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>): Apollo.UseSuspenseQueryResult<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>;\nexport function useVisitorChatUnreadSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>): Apollo.UseSuspenseQueryResult<VisitorChatUnreadQuery | undefined, VisitorChatUnreadQueryVariables>;\nexport function useVisitorChatUnreadSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>) {\n const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return Apollo.useSuspenseQuery<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>(VisitorChatUnreadDocument, options);\n }\nexport type VisitorChatUnreadQueryHookResult = ReturnType<typeof useVisitorChatUnreadQuery>;\nexport type VisitorChatUnreadLazyQueryHookResult = ReturnType<typeof useVisitorChatUnreadLazyQuery>;\nexport type VisitorChatUnreadSuspenseQueryHookResult = ReturnType<typeof useVisitorChatUnreadSuspenseQuery>;\nexport type VisitorChatUnreadQueryResult = Apollo.QueryResult<VisitorChatUnreadQuery, VisitorChatUnreadQueryVariables>;\nexport const SignalVisitorTypingDocument = gql`\n mutation SignalVisitorTyping {\n signalVisitorTyping {\n ok\n }\n}\n `;\nexport type SignalVisitorTypingMutationFn = Apollo.MutationFunction<SignalVisitorTypingMutation, SignalVisitorTypingMutationVariables>;\n\n/**\n * __useSignalVisitorTypingMutation__\n *\n * To run a mutation, you first call `useSignalVisitorTypingMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useSignalVisitorTypingMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [signalVisitorTypingMutation, { data, loading, error }] = useSignalVisitorTypingMutation({\n * variables: {\n * },\n * });\n */\nexport function useSignalVisitorTypingMutation(baseOptions?: Apollo.MutationHookOptions<SignalVisitorTypingMutation, SignalVisitorTypingMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<SignalVisitorTypingMutation, SignalVisitorTypingMutationVariables>(SignalVisitorTypingDocument, options);\n }\nexport type SignalVisitorTypingMutationHookResult = ReturnType<typeof useSignalVisitorTypingMutation>;\nexport type SignalVisitorTypingMutationResult = Apollo.MutationResult<SignalVisitorTypingMutation>;\nexport type SignalVisitorTypingMutationOptions = Apollo.BaseMutationOptions<SignalVisitorTypingMutation, SignalVisitorTypingMutationVariables>;\nexport const UploadVisitorMediaDocument = gql`\n mutation UploadVisitorMedia($input: VisitorUploadInputType!) {\n uploadVisitorMedia(input: $input) {\n url\n mediaId\n mimetype\n size\n }\n}\n `;\nexport type UploadVisitorMediaMutationFn = Apollo.MutationFunction<UploadVisitorMediaMutation, UploadVisitorMediaMutationVariables>;\n\n/**\n * __useUploadVisitorMediaMutation__\n *\n * To run a mutation, you first call `useUploadVisitorMediaMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useUploadVisitorMediaMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [uploadVisitorMediaMutation, { data, loading, error }] = useUploadVisitorMediaMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useUploadVisitorMediaMutation(baseOptions?: Apollo.MutationHookOptions<UploadVisitorMediaMutation, UploadVisitorMediaMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<UploadVisitorMediaMutation, UploadVisitorMediaMutationVariables>(UploadVisitorMediaDocument, options);\n }\nexport type UploadVisitorMediaMutationHookResult = ReturnType<typeof useUploadVisitorMediaMutation>;\nexport type UploadVisitorMediaMutationResult = Apollo.MutationResult<UploadVisitorMediaMutation>;\nexport type UploadVisitorMediaMutationOptions = Apollo.BaseMutationOptions<UploadVisitorMediaMutation, UploadVisitorMediaMutationVariables>;\nexport const RemoveVisitorMediaDocument = gql`\n mutation RemoveVisitorMedia($mediaId: ID!) {\n removeVisitorMedia(mediaId: $mediaId) {\n ok\n }\n}\n `;\nexport type RemoveVisitorMediaMutationFn = Apollo.MutationFunction<RemoveVisitorMediaMutation, RemoveVisitorMediaMutationVariables>;\n\n/**\n * __useRemoveVisitorMediaMutation__\n *\n * To run a mutation, you first call `useRemoveVisitorMediaMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useRemoveVisitorMediaMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [removeVisitorMediaMutation, { data, loading, error }] = useRemoveVisitorMediaMutation({\n * variables: {\n * mediaId: // value for 'mediaId'\n * },\n * });\n */\nexport function useRemoveVisitorMediaMutation(baseOptions?: Apollo.MutationHookOptions<RemoveVisitorMediaMutation, RemoveVisitorMediaMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<RemoveVisitorMediaMutation, RemoveVisitorMediaMutationVariables>(RemoveVisitorMediaDocument, options);\n }\nexport type RemoveVisitorMediaMutationHookResult = ReturnType<typeof useRemoveVisitorMediaMutation>;\nexport type RemoveVisitorMediaMutationResult = Apollo.MutationResult<RemoveVisitorMediaMutation>;\nexport type RemoveVisitorMediaMutationOptions = Apollo.BaseMutationOptions<RemoveVisitorMediaMutation, RemoveVisitorMediaMutationVariables>;\nexport const SubmitVisitorPrechatDocument = gql`\n mutation SubmitVisitorPrechat($input: VisitorPrechatInput!) {\n submitVisitorPrechat(input: $input) {\n ok\n }\n}\n `;\nexport type SubmitVisitorPrechatMutationFn = Apollo.MutationFunction<SubmitVisitorPrechatMutation, SubmitVisitorPrechatMutationVariables>;\n\n/**\n * __useSubmitVisitorPrechatMutation__\n *\n * To run a mutation, you first call `useSubmitVisitorPrechatMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useSubmitVisitorPrechatMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [submitVisitorPrechatMutation, { data, loading, error }] = useSubmitVisitorPrechatMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useSubmitVisitorPrechatMutation(baseOptions?: Apollo.MutationHookOptions<SubmitVisitorPrechatMutation, SubmitVisitorPrechatMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<SubmitVisitorPrechatMutation, SubmitVisitorPrechatMutationVariables>(SubmitVisitorPrechatDocument, options);\n }\nexport type SubmitVisitorPrechatMutationHookResult = ReturnType<typeof useSubmitVisitorPrechatMutation>;\nexport type SubmitVisitorPrechatMutationResult = Apollo.MutationResult<SubmitVisitorPrechatMutation>;\nexport type SubmitVisitorPrechatMutationOptions = Apollo.BaseMutationOptions<SubmitVisitorPrechatMutation, SubmitVisitorPrechatMutationVariables>;\nexport const VisitorChatHistoryDocument = gql`\n query VisitorChatHistory($chatId: String!, $before: String, $limit: Int) {\n visitorChatHistory(chatId: $chatId, before: $before, limit: $limit)\n}\n `;\n\n/**\n * __useVisitorChatHistoryQuery__\n *\n * To run a query within a React component, call `useVisitorChatHistoryQuery` and pass it any options that fit your needs.\n * When your component renders, `useVisitorChatHistoryQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useVisitorChatHistoryQuery({\n * variables: {\n * chatId: // value for 'chatId'\n * before: // value for 'before'\n * limit: // value for 'limit'\n * },\n * });\n */\nexport function useVisitorChatHistoryQuery(baseOptions: Apollo.QueryHookOptions<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables> & ({ variables: VisitorChatHistoryQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useQuery<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>(VisitorChatHistoryDocument, options);\n }\nexport function useVisitorChatHistoryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useLazyQuery<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>(VisitorChatHistoryDocument, options);\n }\n// @ts-ignore\nexport function useVisitorChatHistorySuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>): Apollo.UseSuspenseQueryResult<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>;\nexport function useVisitorChatHistorySuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>): Apollo.UseSuspenseQueryResult<VisitorChatHistoryQuery | undefined, VisitorChatHistoryQueryVariables>;\nexport function useVisitorChatHistorySuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>) {\n const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return Apollo.useSuspenseQuery<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>(VisitorChatHistoryDocument, options);\n }\nexport type VisitorChatHistoryQueryHookResult = ReturnType<typeof useVisitorChatHistoryQuery>;\nexport type VisitorChatHistoryLazyQueryHookResult = ReturnType<typeof useVisitorChatHistoryLazyQuery>;\nexport type VisitorChatHistorySuspenseQueryHookResult = ReturnType<typeof useVisitorChatHistorySuspenseQuery>;\nexport type VisitorChatHistoryQueryResult = Apollo.QueryResult<VisitorChatHistoryQuery, VisitorChatHistoryQueryVariables>;\nexport const VisitorChatRecentInboundDocument = gql`\n query VisitorChatRecentInbound($chatId: String!) {\n visitorChatRecentInbound(chatId: $chatId) {\n id\n text\n createdAt\n sender {\n kind\n name\n avatar\n }\n }\n}\n `;\n\n/**\n * __useVisitorChatRecentInboundQuery__\n *\n * To run a query within a React component, call `useVisitorChatRecentInboundQuery` and pass it any options that fit your needs.\n * When your component renders, `useVisitorChatRecentInboundQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useVisitorChatRecentInboundQuery({\n * variables: {\n * chatId: // value for 'chatId'\n * },\n * });\n */\nexport function useVisitorChatRecentInboundQuery(baseOptions: Apollo.QueryHookOptions<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables> & ({ variables: VisitorChatRecentInboundQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useQuery<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>(VisitorChatRecentInboundDocument, options);\n }\nexport function useVisitorChatRecentInboundLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useLazyQuery<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>(VisitorChatRecentInboundDocument, options);\n }\n// @ts-ignore\nexport function useVisitorChatRecentInboundSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>): Apollo.UseSuspenseQueryResult<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>;\nexport function useVisitorChatRecentInboundSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>): Apollo.UseSuspenseQueryResult<VisitorChatRecentInboundQuery | undefined, VisitorChatRecentInboundQueryVariables>;\nexport function useVisitorChatRecentInboundSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>) {\n const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return Apollo.useSuspenseQuery<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>(VisitorChatRecentInboundDocument, options);\n }\nexport type VisitorChatRecentInboundQueryHookResult = ReturnType<typeof useVisitorChatRecentInboundQuery>;\nexport type VisitorChatRecentInboundLazyQueryHookResult = ReturnType<typeof useVisitorChatRecentInboundLazyQuery>;\nexport type VisitorChatRecentInboundSuspenseQueryHookResult = ReturnType<typeof useVisitorChatRecentInboundSuspenseQuery>;\nexport type VisitorChatRecentInboundQueryResult = Apollo.QueryResult<VisitorChatRecentInboundQuery, VisitorChatRecentInboundQueryVariables>;","/* eslint-disable */\n/* biome-disable */\n/** Internal type. DO NOT USE DIRECTLY. */\ntype Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\n/** Internal type. DO NOT USE DIRECTLY. */\nexport type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };\n\nimport { gql } from '@apollo/client';\nimport * as Apollo from '@apollo/client';\nconst defaultOptions = {} as const;\n\n/** Per-field type discriminator returned by the BE. `STRING + options` is\n * collapsed to `ENUM` server-side; `key === \"avatar\"` is forced to AVATAR. */\nexport type VisitorProfileFieldType =\n | \"AVATAR\"\n | \"STRING\"\n | \"NUMBER\"\n | \"BOOLEAN\"\n | \"DATE\"\n | \"ENUM\"\n | \"ARRAY\";\n\n/** One row in the visitor's Profile form — fully hydrated by the BE from\n * `PeopleFieldDefinition` + `PeopleFieldValue` + the operator's allow-list.\n * `value` is ALWAYS string-serialised on the wire; the widget parses /\n * serialises per `type` (see the render switch in `ProfileTab`). */\nexport type VisitorProfileField = {\n /** Foreign key to `PeopleFieldDefinition.key`. Used as the React row key\n * AND the diff key when writing back. */\n key: string;\n /** Operator-configured human label (e.g. \"First name\", \"Workplace\"). */\n label: string;\n type: VisitorProfileFieldType;\n /** Show a `*` asterisk + reject empty values when true. */\n required: boolean;\n /** Rendered DISABLED with a lock icon when true — operator (or the\n * host's identified-visitor handshake) has set the value and the visitor\n * isn't allowed to change it. */\n pinned: boolean;\n /** Option list for `ENUM` (`<select>` choices). Absent / empty for other\n * types. */\n options?: string[] | null;\n /** Current value, string-serialised. The widget parses per `type`:\n * NUMBER → Number(value)\n * BOOLEAN → value === 'true'\n * DATE → new Date(value)\n * ARRAY → JSON.parse(value)\n * others → as-is. */\n value?: string | null;\n};\n\n/** Visitor-controlled UI preferences exposed in the Profile tab. */\nexport type VisitorProfilePreferences = {\n /** Locale code (e.g. `\"en\"`, `\"uk\"`). Falls back to widget default when null. */\n language?: string | null;\n /** Opt-in for `Notification` API surfacing when the widget isn't focused. */\n desktopNotifications?: boolean | null;\n /** `LIGHT` / `DARK` / `AUTO`. Editable only when `themeModeEditable === true`. */\n themeMode?: string | null;\n};\n\n/** Server-resolved profile shape returned by `visitorProfile` and echoed by\n * `updateVisitorProfile` after a write. */\nexport type VisitorProfile = {\n __typename?: 'VisitorProfile';\n /** Operator-allowed fields, in render order. Pinning is per-row. */\n fields: VisitorProfileField[];\n preferences: VisitorProfilePreferences;\n /** When `false`, the theme toggle MUST be disabled and the widget should\n * fall back to `config.theme.themeMode` (ignore any local cached pref). */\n themeModeEditable: boolean;\n};\n\n/** One field-update entry. The BE re-parses `value` per the field's\n * configured `type` and rejects mismatches with `peopleFields.invalidValue`. */\nexport type VisitorProfileFieldUpdate = {\n key: string;\n value: string;\n};\n\n/** Partial-update input for `updateVisitorProfile`. Send only fields the\n * visitor edited; the BE rejects keys outside the operator allow-list with\n * `webProfileFieldNotAllowed` and pinned keys with `webProfileFieldPinned`. */\nexport type UpdateVisitorProfileInput = {\n fields?: VisitorProfileFieldUpdate[];\n preferences?: {\n language?: string | null;\n desktopNotifications?: boolean | null;\n themeMode?: string | null;\n } | null;\n};\n\nexport type VisitorProfileQueryVariables = Exact<Record<string, never>>;\n\nexport type VisitorProfileQuery = {\n __typename?: 'Query';\n visitorProfile: VisitorProfile;\n};\n\n/** Slim prefs-only variant — used by `useVisitorProfilePreferences`\n * to drive theme/language/notifications on EVERY widget mount.\n * Hand-patched per graphql-codegen-handpatch policy. */\nexport type VisitorProfilePreferencesQueryVariables = Exact<Record<string, never>>;\n\nexport type VisitorProfilePreferencesQuery = {\n __typename?: 'Query';\n visitorProfile: Pick<VisitorProfile, '__typename' | 'preferences' | 'themeModeEditable'>;\n};\n\nexport type UpdateVisitorProfileMutationVariables = Exact<{\n input: UpdateVisitorProfileInput;\n}>;\n\nexport type UpdateVisitorProfileMutation = {\n __typename?: 'Mutation';\n updateVisitorProfile: VisitorProfile;\n};\n\nexport const VisitorProfilePreferencesDocument = gql`\n query VisitorProfilePreferences {\n visitorProfile {\n preferences {\n language\n desktopNotifications\n themeMode\n }\n themeModeEditable\n }\n}\n `;\n\n/**\n * __useVisitorProfilePreferencesQuery__\n *\n * Slim prefs-only query. Same `visitorProfile` resolver as the full\n * `VisitorProfile` query — both write into Apollo's parameterless\n * query slot, so opening ProfileTab supersedes the prefs read with\n * the full payload, and ProfileTab's save mutation flips the cache\n * for both consumers in one shot.\n */\nexport function useVisitorProfilePreferencesQuery(baseOptions?: Apollo.QueryHookOptions<VisitorProfilePreferencesQuery, VisitorProfilePreferencesQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useQuery<VisitorProfilePreferencesQuery, VisitorProfilePreferencesQueryVariables>(VisitorProfilePreferencesDocument, options);\n }\nexport type VisitorProfilePreferencesQueryHookResult = ReturnType<typeof useVisitorProfilePreferencesQuery>;\nexport type VisitorProfilePreferencesQueryResult = Apollo.QueryResult<VisitorProfilePreferencesQuery, VisitorProfilePreferencesQueryVariables>;\n\nexport const VisitorProfileDocument = gql`\n query VisitorProfile {\n visitorProfile {\n fields {\n key\n label\n type\n required\n pinned\n options\n value\n }\n preferences {\n language\n desktopNotifications\n themeMode\n }\n themeModeEditable\n }\n}\n `;\n\n/**\n * __useVisitorProfileQuery__\n */\nexport function useVisitorProfileQuery(baseOptions?: Apollo.QueryHookOptions<VisitorProfileQuery, VisitorProfileQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useQuery<VisitorProfileQuery, VisitorProfileQueryVariables>(VisitorProfileDocument, options);\n }\nexport function useVisitorProfileLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<VisitorProfileQuery, VisitorProfileQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useLazyQuery<VisitorProfileQuery, VisitorProfileQueryVariables>(VisitorProfileDocument, options);\n }\nexport type VisitorProfileQueryHookResult = ReturnType<typeof useVisitorProfileQuery>;\nexport type VisitorProfileLazyQueryHookResult = ReturnType<typeof useVisitorProfileLazyQuery>;\nexport type VisitorProfileQueryResult = Apollo.QueryResult<VisitorProfileQuery, VisitorProfileQueryVariables>;\n\nexport const UpdateVisitorProfileDocument = gql`\n mutation UpdateVisitorProfile($input: UpdateVisitorProfileInput!) {\n updateVisitorProfile(input: $input) {\n fields {\n key\n label\n type\n required\n pinned\n options\n value\n }\n preferences {\n language\n desktopNotifications\n themeMode\n }\n themeModeEditable\n }\n}\n `;\nexport type UpdateVisitorProfileMutationFn = Apollo.MutationFunction<UpdateVisitorProfileMutation, UpdateVisitorProfileMutationVariables>;\n\n/**\n * __useUpdateVisitorProfileMutation__\n */\nexport function useUpdateVisitorProfileMutation(baseOptions?: Apollo.MutationHookOptions<UpdateVisitorProfileMutation, UpdateVisitorProfileMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return Apollo.useMutation<UpdateVisitorProfileMutation, UpdateVisitorProfileMutationVariables>(UpdateVisitorProfileDocument, options);\n }\nexport type UpdateVisitorProfileMutationHookResult = ReturnType<typeof useUpdateVisitorProfileMutation>;\nexport type UpdateVisitorProfileMutationResult = Apollo.MutationResult<UpdateVisitorProfileMutation>;\nexport type UpdateVisitorProfileMutationOptions = Apollo.BaseMutationOptions<UpdateVisitorProfileMutation, UpdateVisitorProfileMutationVariables>;\n","/**\n * Sound system constants + helpers.\n *\n * 21 preset notification sounds ship in `public/sounds/wx-nt_*.wav`.\n * Operator picks one for inbound + one for outbound, or uploads a\n * custom file (URL stored on the integration). Visitor's mute\n * preference (localStorage `wexio:sound-muted`) overrides everything.\n */\n\nimport { assetUrl } from \"./asset-url\";\n\nexport const PRESET_SOUND_IDS = Array.from({ length: 21 }, (_, i) => `wx-nt_${i + 1}`);\n\nexport type PresetSoundId = (typeof PRESET_SOUND_IDS)[number];\n\nconst PRESET_PREFIX = \"wx-nt_\";\n\n/**\n * Resolve a sound identifier to a fetchable URL. Preset ids like\n * `\"wx-nt_3\"` map to the bundled WAV at `/sounds/wx-nt_3.wav` — routed\n * through `assetUrl` so cross-origin embeds (the React component on a\n * host page) fetch it from the widget's CDN rather than the host's\n * origin. Fully-qualified URLs (operator-uploaded customs) pass\n * through. Anything else returns `null` so callers can no-op silently.\n */\nexport function resolveSoundUrl(id: string | null | undefined): string | null {\n if (!id) return null;\n if (id.startsWith(\"http://\") || id.startsWith(\"https://\")) {\n return id;\n }\n if (id.startsWith(PRESET_PREFIX)) {\n return assetUrl(`/sounds/${id}.wav`);\n }\n return null;\n}\n\nexport const MUTE_STORAGE_KEY = \"wexio:sound-muted\";\n","\"use client\";\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { MUTE_STORAGE_KEY, resolveSoundUrl } from \"./sounds\";\nimport type { WidgetSounds } from \"./widget-config\";\n\n/**\n * Plays notification sounds for inbound + outbound messages.\n *\n * Audio elements are preloaded once on mount + reused across plays\n * (avoids the cold-start latency of `new Audio(url)` on every event).\n * `playInbound` / `playOutbound` are stable refs — pass them straight\n * to event listeners without `useCallback` gymnastics.\n *\n * **Visitor mute wins.** Visitors who tap the mute toggle persist the\n * preference in `localStorage[\"wexio:sound-muted\"]`. Operator-level\n * `sounds.enabled` is the *default* (audible) but mute always overrides.\n *\n * Browser autoplay policy: most browsers block audio until the user\n * has interacted with the page. The first `play()` call inside a\n * click handler unlocks subsequent silent triggers (e.g. SSE inbound\n * fires after the visitor sent their first message → already\n * unlocked). We swallow `NotAllowedError` instead of crashing.\n */\nexport function useSoundPlayer(sounds: WidgetSounds | null) {\n const [muted, setMuted] = useState(false);\n const inboundRef = useRef<HTMLAudioElement | null>(null);\n const outboundRef = useRef<HTMLAudioElement | null>(null);\n\n // Read persisted mute preference on first mount. Without this the\n // toggle would reset between page reloads — bad UX.\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const stored = localStorage.getItem(MUTE_STORAGE_KEY);\n setMuted(stored === \"1\");\n }, []);\n\n // (Re)preload audio elements whenever the sound config changes.\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n inboundRef.current?.pause();\n outboundRef.current?.pause();\n\n const inboundUrl = resolveSoundUrl(sounds?.inboundSoundId);\n const outboundUrl = resolveSoundUrl(sounds?.outboundSoundId);\n const volume =\n typeof sounds?.volume === \"number\" ? Math.max(0, Math.min(1, sounds.volume)) : 0.5;\n\n inboundRef.current = inboundUrl ? buildAudio(inboundUrl, volume) : null;\n outboundRef.current = outboundUrl ? buildAudio(outboundUrl, volume) : null;\n\n return () => {\n inboundRef.current?.pause();\n outboundRef.current?.pause();\n };\n }, [sounds]);\n\n const toggleMuted = useCallback(() => {\n setMuted((prev) => {\n const next = !prev;\n try {\n localStorage.setItem(MUTE_STORAGE_KEY, next ? \"1\" : \"0\");\n } catch {\n // Privacy mode / quota errors — accept the runtime toggle\n // and skip persistence rather than crashing.\n }\n return next;\n });\n }, []);\n\n const play = useCallback(\n (kind: \"inbound\" | \"outbound\") => {\n if (muted) return;\n if (sounds && sounds.enabled === false) return;\n const ref = kind === \"inbound\" ? inboundRef.current : outboundRef.current;\n if (!ref) return;\n ref.currentTime = 0;\n ref.play().catch(() => {\n // Autoplay blocked or asset failed — swallow. Next user-\n // gesture-triggered call unlocks the policy.\n });\n },\n [muted, sounds],\n );\n\n return {\n muted,\n toggleMuted,\n playInbound: () => play(\"inbound\"),\n playOutbound: () => play(\"outbound\"),\n };\n}\n\nfunction buildAudio(src: string, volume: number): HTMLAudioElement {\n const audio = new Audio(src);\n audio.preload = \"auto\";\n audio.volume = volume;\n return audio;\n}\n","\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { useWidgetEnv } from \"./use-widget-env\";\n\nexport type ThemeMode = \"light\" | \"dark\";\nexport type ThemePreference = ThemeMode | \"auto\";\n\n/** Visitor-side overrides — sourced from the BE profile query when\n * Profile is enabled. Honoured only when `allowed` is `true` (i.e.\n * `themeModeEditable`); when `false`, the operator preference wins\n * outright and the visitor's saved choice is IGNORED — matches the\n * `WEB_PROFILE_TAB.md` contract. */\nexport interface VisitorThemeOpts {\n preference?: ThemePreference | null;\n allowed?: boolean;\n}\n\n/**\n * Resolves the active light/dark mode from (in priority order):\n *\n * 1. `?theme=dark|light|auto` URL param — dashboard preview link\n * 2. `wexio:preview-theme-mode` postMessage — dashboard live edit\n * 3. **visitor profile** (`visitor.preference`) — BE-persisted choice,\n * honoured only when `visitor.allowed !== false`\n * 4. `operatorPreference` (config.themeMode) — operator's saved choice\n * 5. `localStorage[\"wexio:theme\"]` — visitor's sticky pref\n * (only honoured when `visitor.allowed !== false`, so the operator's\n * \"force light/dark\" lock is respected)\n * 6. `prefers-color-scheme` media query — visitor OS preference\n *\n * When `themeModeEditable === false` the visitor layers are skipped\n * entirely — operator wins outright (falls through to OS only if operator\n * is `auto`).\n *\n * Writes `data-theme=\"light|dark\"` on the theme root so the\n * CSS-variable blocks in `globals.css` switch atomically. The theme\n * root is `env.themeRoot` when set (the React-component embed points\n * it at its Shadow DOM portal target, keeping theming self-contained),\n * otherwise `<html>` (iframe / web-component builds).\n */\nexport function useThemeMode(\n operatorPreference?: ThemePreference,\n visitor?: VisitorThemeOpts,\n): ThemeMode {\n const [resolved, setResolved] = useState<ThemeMode>(\"dark\");\n const env = useWidgetEnv();\n const themeRoot = env.themeRoot;\n\n useEffect(() => {\n const url = new URL(window.location.href);\n const urlTheme = url.searchParams.get(\"theme\") as ThemePreference | null;\n const validOperator =\n operatorPreference && isThemePreference(operatorPreference) ? operatorPreference : null;\n const visitorAllowed = visitor?.allowed !== false;\n const validVisitor =\n visitor?.preference && isThemePreference(visitor.preference) ? visitor.preference : null;\n\n // Resolve the active preference. URL/postMessage previews always win\n // for dashboard tooling. Then: visitor's BE-persisted choice (only\n // when `themeModeEditable`) > operator's forced choice > visitor's\n // localStorage cache (only when allowed) > AUTO/OS.\n const pickPreference = (): ThemePreference => {\n if (urlTheme && isThemePreference(urlTheme)) return urlTheme;\n // Visitor's BE preference (skipped entirely when not allowed).\n if (visitorAllowed && validVisitor && validVisitor !== \"auto\") {\n return validVisitor;\n }\n if (validOperator && validOperator !== \"auto\") return validOperator;\n if (visitorAllowed) {\n const cached = localStorage.getItem(\"wexio:theme\") as ThemePreference | null;\n if (cached && isThemePreference(cached)) return cached;\n }\n // Operator's `AUTO` (or unset) — fall through to OS.\n return \"auto\";\n };\n\n let preference: ThemePreference = pickPreference();\n\n const target: HTMLElement = themeRoot ?? document.documentElement;\n\n const apply = () => {\n const mode: ThemeMode =\n preference === \"auto\"\n ? window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\"\n : preference;\n target.dataset.theme = mode;\n setResolved(mode);\n };\n\n apply();\n\n // System pref change — only matters when `preference === \"auto\"`.\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const onMedia = () => preference === \"auto\" && apply();\n media.addEventListener?.(\"change\", onMedia);\n\n // Live preview override from the parent (dashboard).\n const onMessage = (event: MessageEvent) => {\n if (!event.data || typeof event.data !== \"object\") return;\n if (event.data.type !== \"wexio:preview-theme-mode:v1\") return;\n const next = event.data.mode as ThemePreference | undefined;\n if (next && isThemePreference(next)) {\n preference = next;\n apply();\n }\n };\n window.addEventListener(\"message\", onMessage);\n\n return () => {\n media.removeEventListener?.(\"change\", onMedia);\n window.removeEventListener(\"message\", onMessage);\n };\n }, [operatorPreference, themeRoot, visitor?.preference, visitor?.allowed]);\n\n return resolved;\n}\n\nfunction isThemePreference(v: unknown): v is ThemePreference {\n return v === \"light\" || v === \"dark\" || v === \"auto\";\n}\n","\"use client\";\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n getPublicKey,\n setOnVisitorIntegrationMismatch,\n setOnVisitorUnauthorized,\n setVisitorToken,\n} from \"./apollo-client\";\nimport {\n useStartAnonymousVisitorMutation,\n useStartIdentifiedVisitorMutation,\n} from \"./graphql/queries/generated/messaging.generated\";\nimport type { VisitorIdentity, VisitorPrefill, WidgetEnv } from \"./use-widget-env\";\n\n/**\n * Visitor session — calls `startAnonymousVisitor` on first mount and\n * stashes the JWT into `apollo-client`'s module-scoped slot so every\n * subsequent query/mutation stamps `Authorization: Bearer <token>`.\n *\n * **Visitor id is sticky** in `localStorage[\"wexio:visitor-id\"]` so\n * returning visitors land in the same chat across reloads + tabs.\n * Generated as a random uuid on first visit.\n *\n * **Gating**:\n * - Skips entirely when `enabled === false` (demo + preview modes\n * where there's no real BE integration to authenticate against).\n * - One-shot per mount — no auto re-auth here. JWT expiry handling\n * comes in Day 2g (silent renew ~30s before `expiresIn`).\n *\n * **Errors are non-fatal**: a failed handshake leaves the widget in\n * \"anonymous, unauthenticated\" mode — Help + News still work\n * (anonymous-readable), but chat history + send mutations 4xx until\n * the handshake succeeds. Errors are surfaced to the caller; UI\n * decides whether to retry / show banner.\n */\nexport interface VisitorSession {\n token: string | null;\n chatId: string | null;\n peopleId: string | null;\n displayName: string | null;\n isAuthenticating: boolean;\n error: string | null;\n /** `true` once the BE confirms a VERIFIED-identified visitor\n * (`kind === 'identified'`). Sensitive UI should gate on this — never\n * on a passed email. `false` for anonymous / prefilled visitors. */\n verified: boolean;\n}\n\n/** Common subset of the `VisitorAuthResult` both handshakes return. */\ntype HandshakeResult = {\n token: string;\n expiresIn: number;\n chatId: string;\n peopleId: string;\n /** Resolved visitor id — the BE echoes the id it actually used. It no\n * longer rotates (that forked chats); we persist whatever comes back so\n * the widget stays in lockstep if that ever changes again. */\n visitorId: string;\n displayName: string;\n /** `'anonymous' | 'identified'` — drives `VisitorSession.verified`. */\n kind: string;\n};\n\n/** Storage-key generators — every key is scoped by the integration's\n * `publicKey` so two operators embedding the widget on different\n * sites (both iframes load the SAME `widget.wexio.com` origin →\n * shared localStorage) don't see each other's visitor state.\n *\n * Without this scoping, operator A's visitor JWT would be read by\n * operator B's widget on first mount, fail BE validation\n * (publicKey mismatch in the JWT), trigger a 401 recovery, and leak\n * audit-log noise / a brief UX flicker. Same-operator multi-domain\n * setups intentionally still share state (same publicKey → same\n * storage key → SSO across the operator's properties). */\nconst visitorIdKey = (publicKey: string | null) =>\n publicKey ? `wexio:visitor-id:${publicKey}` : \"wexio:visitor-id\";\nconst identifiedSessionKey = (publicKey: string | null) =>\n publicKey ? `wexio:visitor-session:${publicKey}` : \"wexio:visitor-session\";\n\n/** Legacy (pre-publicKey-scoping) keys — read once on first mount and\n * removed so a returning visitor's existing session is preserved for\n * THIS integration but no longer bleeds to others on the same widget\n * origin. */\nconst LEGACY_VISITOR_ID_KEY = \"wexio:visitor-id\";\nconst LEGACY_IDENTIFIED_SESSION_KEY = \"wexio:visitor-session\";\n\ninterface PersistedIdentifiedSession {\n token: string;\n chatId: string;\n peopleId: string;\n displayName: string;\n /** Wall-clock ms when the token expires (mint time + `expiresIn`). */\n expiresAt: number;\n}\n\n/** Persist a freshly-minted identified session so a reload restores it.\n * Exported because the passkey ceremony (a 2-step flow outside the\n * handshake) mints its session out-of-band and hands it to the shell. */\nexport function persistIdentifiedSession(input: {\n token: string;\n chatId: string;\n peopleId: string;\n displayName: string;\n expiresIn: number;\n}): void {\n if (typeof window === \"undefined\") return;\n try {\n const payload: PersistedIdentifiedSession = {\n token: input.token,\n chatId: input.chatId,\n peopleId: input.peopleId,\n displayName: input.displayName,\n expiresAt: Date.now() + input.expiresIn * 1000,\n };\n localStorage.setItem(identifiedSessionKey(getPublicKey()), JSON.stringify(payload));\n } catch {\n /* private mode — session just won't survive reload */\n }\n}\n\n/** Read the persisted identified session if it's still valid (with a\n * small leeway so a near-expired token isn't restored only to 401).\n * Clears + returns null when missing / expired / malformed.\n *\n * Performs a one-time migration of a legacy (pre-publicKey-scoping)\n * global key — moves it under THIS publicKey so the visitor doesn't\n * lose their session, and clears the global key so other operators\n * don't see it on their first read. */\nfunction readPersistedIdentifiedSession(): PersistedIdentifiedSession | null {\n if (typeof window === \"undefined\") return null;\n const pk = getPublicKey();\n try {\n let raw = localStorage.getItem(identifiedSessionKey(pk));\n if (!raw && pk) {\n // Migrate: legacy global key → publicKey-scoped key.\n const legacy = localStorage.getItem(LEGACY_IDENTIFIED_SESSION_KEY);\n if (legacy) {\n localStorage.setItem(identifiedSessionKey(pk), legacy);\n localStorage.removeItem(LEGACY_IDENTIFIED_SESSION_KEY);\n raw = legacy;\n }\n }\n if (!raw) return null;\n const parsed = JSON.parse(raw) as PersistedIdentifiedSession;\n if (\n typeof parsed?.token !== \"string\" ||\n typeof parsed?.expiresAt !== \"number\" ||\n parsed.expiresAt - RENEW_LEEWAY_SECONDS * 1000 <= Date.now()\n ) {\n localStorage.removeItem(identifiedSessionKey(pk));\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction clearPersistedIdentifiedSession(): void {\n if (typeof window === \"undefined\") return;\n try {\n localStorage.removeItem(identifiedSessionKey(getPublicKey()));\n // Belt-and-braces: also clear the legacy global key in case a\n // previous build wrote it before this migration shipped.\n localStorage.removeItem(LEGACY_IDENTIFIED_SESSION_KEY);\n } catch {\n /* nothing to clear */\n }\n}\n\n/** Renew the JWT this many seconds before its declared expiry. Trades\n * some early-renewal overhead for headroom against clock skew between\n * the visitor's machine + the BE. */\nconst RENEW_LEEWAY_SECONDS = 30;\n\n/** Prefix of the per-integration prechat-submitted flags — kept in sync\n * with `prechatStorageKey` in the prechat helpers. Cleared on shutdown\n * so the next visitor on a shared device is asked again. */\nconst PRECHAT_FLAG_PREFIX = \"wexio:prechat-submitted:\";\n\n/**\n * Wipe the stored visitor session — for `shutdown` (logout / shared\n * device). Drops the in-memory token, forgets the sticky `visitorId` (so\n * the next handshake is a fresh identity, NOT the previous user's chat),\n * and clears the prechat-submitted flags. The caller still needs to\n * re-handshake (bump `epoch`) + clear the in-memory chat.\n */\nexport function resetStoredVisitorSession(): void {\n setVisitorToken(null);\n clearPersistedIdentifiedSession();\n if (typeof window === \"undefined\") return;\n try {\n const pk = getPublicKey();\n localStorage.removeItem(visitorIdKey(pk));\n // Also clear the legacy global key (pre-publicKey-scoping).\n localStorage.removeItem(LEGACY_VISITOR_ID_KEY);\n for (let i = localStorage.length - 1; i >= 0; i--) {\n const key = localStorage.key(i);\n if (key?.startsWith(PRECHAT_FLAG_PREFIX)) localStorage.removeItem(key);\n }\n } catch {\n /* private mode — nothing persisted to clear */\n }\n}\n\nexport function useVisitorAuth(opts: {\n enabled: boolean;\n /** Known-user identity from the host. When it carries a `userId` +\n * `userHash`, the handshake routes to `startIdentifiedVisitor` so the\n * visitor lands as a verified, named person; otherwise it stays\n * anonymous. May arrive AFTER mount (the iframe receives it over\n * postMessage) — a late arrival re-handshakes on the same `visitorId`,\n * which the BE transitions anonymous → identified. */\n identity?: VisitorIdentity | null;\n /** Bump to force a fresh handshake — used by `shutdown` after\n * `resetStoredVisitorSession()` has cleared the old `visitorId`, so the\n * re-handshake mints a brand-new anonymous identity. */\n epoch?: number;\n}): VisitorSession {\n const [session, setSession] = useState<VisitorSession>({\n token: null,\n chatId: null,\n peopleId: null,\n displayName: null,\n isAuthenticating: opts.enabled,\n error: null,\n verified: false,\n });\n\n const [startAnonymous] = useStartAnonymousVisitorMutation();\n const [startIdentified] = useStartIdentifiedVisitorMutation();\n // Latest identity, read inside `performHandshake` without making it a\n // dependency (the effect re-fires on `identityKey` instead).\n const identityRef = useRef<VisitorIdentity | null>(opts.identity ?? null);\n identityRef.current = opts.identity ?? null;\n const renewTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n // Absolute wall-clock timestamp (ms) for the next scheduled renew.\n // `setTimeout` pauses while the browser tab is suspended (sleep /\n // backgrounded with throttling), so the timer can be hours behind\n // the real expiry. On `visibilitychange` we compare against this\n // value to decide whether to handshake immediately.\n const nextRenewAt = useRef<number>(0);\n\n // Single handshake function reused for first-load + silent renew.\n // Silent renew reuses the same `visitorId` so the BE returns the\n // same `chatId` + `peopleId` — the visitor's session continuity is\n // preserved across token rotations.\n const performHandshake = useCallback(\n async (cancelled: { current: boolean }) => {\n try {\n const visitorId = ensureVisitorId();\n const identity = identityRef.current;\n // Identity present → verified identified handshake via ONE proof:\n // a Google `id_token` (FedCM), a host-signed `jwt`, or the legacy\n // `userId`+`userHash` HMAC pair. Profile fields ride along; extra\n // attributes go as the `contextSnapshot` JSON. Otherwise anonymous.\n let out: HandshakeResult | undefined;\n if (\n identity &&\n (identity.googleIdToken || identity.jwt || (identity.userId && identity.userHash))\n ) {\n const res = await startIdentified({\n variables: {\n input: {\n visitorId,\n // exactly one proof — precedence: Google → jwt → HMAC.\n ...(identity.googleIdToken\n ? { googleIdToken: identity.googleIdToken }\n : identity.jwt\n ? { jwt: identity.jwt }\n : { userId: identity.userId, userHash: identity.userHash }),\n name: identity.name,\n email: identity.email,\n phone: identity.phone,\n contextSnapshot: identity.attributes\n ? JSON.stringify(identity.attributes)\n : undefined,\n },\n },\n });\n if (cancelled.current) return;\n out = res.data?.startIdentifiedVisitor;\n } else {\n const res = await startAnonymous({\n variables: { input: { visitorId } },\n });\n if (cancelled.current) return;\n out = res.data?.startAnonymousVisitor;\n }\n if (!out) {\n setSession((prev) => ({\n ...prev,\n isAuthenticating: false,\n error: \"handshake_empty_response\",\n }));\n return;\n }\n // Persist the BE-resolved visitorId if it ever differs from what we\n // sent. The BE no longer rotates (it resolves one stable row per\n // visitorId now), so this is normally a no-op — kept as a cheap\n // safety net to stay in lockstep with the server of record.\n if (out.visitorId && out.visitorId !== visitorId) {\n try {\n localStorage.setItem(visitorIdKey(getPublicKey()), out.visitorId);\n } catch {\n /* private mode — best effort */\n }\n }\n setVisitorToken(out.token);\n setSession({\n token: out.token,\n chatId: out.chatId,\n peopleId: out.peopleId,\n displayName: out.displayName,\n isAuthenticating: false,\n error: null,\n // The BE is authoritative — `kind` reflects whether the proof\n // actually verified, not just what we attempted.\n verified: out.kind === \"identified\",\n });\n // Persist a VERIFIED session so a reload restores it (instead of\n // re-handshaking anonymously → sign-in gate). Anonymous sessions\n // clear it so a logged-out reload stays anonymous.\n if (out.kind === \"identified\") {\n persistIdentifiedSession({\n token: out.token,\n chatId: out.chatId,\n peopleId: out.peopleId,\n displayName: out.displayName,\n expiresIn: out.expiresIn,\n });\n } else {\n clearPersistedIdentifiedSession();\n }\n // Schedule silent renew. `expiresIn` is seconds; we fire\n // ~30s before expiry so the new token replaces the old one\n // BEFORE any request 401s. A failed renew leaves the prior\n // token in place — it'll keep working until it actually\n // expires, at which point the session degrades gracefully.\n const renewInMs = Math.max(5_000, (out.expiresIn - RENEW_LEEWAY_SECONDS) * 1000);\n if (renewTimer.current) clearTimeout(renewTimer.current);\n nextRenewAt.current = Date.now() + renewInMs;\n renewTimer.current = setTimeout(() => {\n if (!cancelled.current) performHandshake(cancelled);\n }, renewInMs);\n } catch (err) {\n if (cancelled.current) return;\n setSession({\n token: null,\n chatId: null,\n peopleId: null,\n displayName: null,\n isAuthenticating: false,\n error: (err as Error).message,\n verified: false,\n });\n }\n },\n [startAnonymous, startIdentified],\n );\n\n // Stable key for the identity — flips when a (different) identity\n // arrives so the effect below re-handshakes. `null` while anonymous.\n // Covers every proof: a Google id_token, a signed `jwt`, or the\n // `userId:userHash` pair.\n const id = opts.identity;\n const identityKey = id?.googleIdToken\n ? `google:${id.googleIdToken}`\n : id?.jwt\n ? `jwt:${id.jwt}`\n : id?.userId && id?.userHash\n ? `${id.userId}:${id.userHash}`\n : null;\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: identityKey is a re-fire trigger (read via identityRef inside performHandshake), not used directly in the body\n useEffect(() => {\n if (!opts.enabled) {\n setSession((prev) => ({ ...prev, isAuthenticating: false }));\n return;\n }\n if (typeof window === \"undefined\") return;\n\n const cancelled = { current: false };\n // Restore a persisted VERIFIED session first, so a page reload keeps\n // the visitor signed in (instead of re-handshaking anonymously → the\n // sign-in gate). Skipped when the host supplied a fresh identity —\n // that re-handshakes identified and wins. There's no silent re-proof\n // for passkey/FedCM, so when the restored token expires we fall back\n // to a fresh (anonymous) handshake (the gate returns; re-sign-in).\n const restored = identityRef.current ? null : readPersistedIdentifiedSession();\n if (restored) {\n setVisitorToken(restored.token);\n setSession({\n token: restored.token,\n chatId: restored.chatId,\n peopleId: restored.peopleId,\n displayName: restored.displayName,\n isAuthenticating: false,\n error: null,\n verified: true,\n });\n const expiresInMs = Math.max(0, restored.expiresAt - Date.now());\n nextRenewAt.current = restored.expiresAt;\n if (renewTimer.current) clearTimeout(renewTimer.current);\n renewTimer.current = setTimeout(() => {\n if (cancelled.current) return;\n clearPersistedIdentifiedSession();\n performHandshake(cancelled);\n }, expiresInMs);\n } else {\n // Re-runs when `identityKey` changes — e.g. the iframe receives the\n // host's identity over postMessage after the initial anonymous\n // handshake, upgrading the session to identified on the same chat.\n performHandshake(cancelled);\n }\n\n // Wake-from-sleep recovery — browsers pause `setTimeout` while a\n // tab is suspended (real sleep, OR aggressive background\n // throttling). The scheduled renew may be hours behind real time\n // by the time the user comes back; without this, the next send\n // 401s with `jwt expired` and the visitor sees a generic failure.\n // On `visibilitychange → visible`, if we've passed the scheduled\n // renew time we run a handshake immediately. The handshake itself\n // reschedules the timer.\n const onVisibility = () => {\n if (cancelled.current) return;\n if (typeof document === \"undefined\" || document.hidden) return;\n if (nextRenewAt.current === 0) return; // pre-first-handshake\n if (Date.now() >= nextRenewAt.current) {\n performHandshake(cancelled);\n }\n };\n document.addEventListener(\"visibilitychange\", onVisibility);\n\n return () => {\n cancelled.current = true;\n document.removeEventListener(\"visibilitychange\", onVisibility);\n if (renewTimer.current) {\n clearTimeout(renewTimer.current);\n renewTimer.current = null;\n }\n };\n // `identityKey` re-fires the effect when the host identifies the\n // visitor (or swaps identity); `opts.epoch` re-fires it on shutdown\n // (after the stored visitorId was cleared → fresh anonymous identity).\n // `performHandshake` reads the latest identity from `identityRef`.\n }, [opts.enabled, performHandshake, identityKey, opts.epoch]);\n\n // 401 recovery — Apollo's error link calls this when a NON-handshake\n // request is rejected as Unauthorized (stale / forged / expired /\n // tampered token). We drop the bad token + persisted session and\n // re-handshake: with `requireAuth` that lands on the sign-in gate so\n // the visitor can log in again; otherwise they get a fresh anonymous\n // token and can keep messaging. This is the \"auto-logout on a bad\n // session\" — without it a doctored `wexio:visitor-session` leaves the\n // widget stuck \"verified\" but unable to send OR re-login.\n useEffect(() => {\n if (!opts.enabled || typeof window === \"undefined\") return;\n let recovering = false;\n setOnVisitorUnauthorized(() => {\n if (recovering) return; // collapse a burst of concurrent 401s\n recovering = true;\n clearPersistedIdentifiedSession();\n setVisitorToken(null);\n void performHandshake({ current: false }).finally(() => {\n recovering = false;\n });\n });\n // `webIntegrationMismatch` — distinct from a generic 401. The BE\n // tells us the stored JWT was minted for a different integration\n // (cross-operator visitor whose legacy global localStorage key got\n // eager-migrated into THIS publicKey's slot by `ensureVisitorId` /\n // `readPersistedIdentifiedSession`). Self-heal by clearing the\n // scoped session AND the sticky visitorId for THIS publicKey, then\n // re-handshaking — the next handshake mints fresh, correctly-scoped\n // state. Without this we'd loop: token bad → 401 path drops it →\n // next mount re-migrates the same legacy key → same mismatch.\n setOnVisitorIntegrationMismatch(() => {\n if (recovering) return;\n recovering = true;\n clearPersistedIdentifiedSession();\n setVisitorToken(null);\n try {\n const pk = getPublicKey();\n // Drop the sticky visitorId scoped to THIS publicKey too — the\n // visitorId was likely also migrated from the legacy key and\n // refers to the OTHER operator's People row.\n localStorage.removeItem(visitorIdKey(pk));\n } catch {\n /* private mode — best effort */\n }\n void performHandshake({ current: false }).finally(() => {\n recovering = false;\n });\n });\n return () => {\n setOnVisitorUnauthorized(null);\n setOnVisitorIntegrationMismatch(null);\n };\n }, [opts.enabled, performHandshake]);\n\n return session;\n}\n\n/**\n * Resolve the host-supplied visitor identity for the shell.\n *\n * Embeds (web-component / react-component) set `env.visitorIdentity`\n * directly — they run in the host's JS context. The iframe can't read\n * the host's data, so it receives identity over `postMessage`: this\n * hook announces readiness to the parent (`wexio:widget:ready:v1`) and\n * listens for `wexio:identify:v1`. Returns the env value when present,\n * else whatever arrived over the bridge (`null` until then).\n */\nexport function useHostVisitorData(env: WidgetEnv): {\n identity: VisitorIdentity | null;\n prefill: VisitorPrefill | null;\n} {\n const [received, setReceived] = useState<{\n identity: VisitorIdentity | null;\n prefill: VisitorPrefill | null;\n }>({ identity: null, prefill: null });\n\n useEffect(() => {\n // Embeds pass these inline on `env`; only the iframe needs the bridge.\n if (env.visitorIdentity || env.visitorPrefill) return;\n if (typeof window === \"undefined\") return;\n\n const onMessage = (e: MessageEvent) => {\n const data = e.data;\n if (!data || typeof data !== \"object\") return;\n // Verified identity → identified handshake. Accept EITHER a signed\n // `jwt` (recommended) OR the legacy `userId`+`userHash` pair.\n if (data.type === \"wexio:identify:v1\") {\n const u = data.user;\n if (!u || typeof u !== \"object\") return;\n const hasGoogle = typeof u.googleIdToken === \"string\";\n const hasJwt = typeof u.jwt === \"string\";\n const hasHmac = typeof u.userId === \"string\" && typeof u.userHash === \"string\";\n if (!hasGoogle && !hasJwt && !hasHmac) return;\n setReceived((prev) => ({\n ...prev,\n identity: {\n googleIdToken: hasGoogle ? u.googleIdToken : undefined,\n jwt: hasJwt ? u.jwt : undefined,\n userId: typeof u.userId === \"string\" ? u.userId : undefined,\n userHash: typeof u.userHash === \"string\" ? u.userHash : undefined,\n name: typeof u.name === \"string\" ? u.name : undefined,\n email: typeof u.email === \"string\" ? u.email : undefined,\n phone: typeof u.phone === \"string\" ? u.phone : undefined,\n attributes: u.attributes && typeof u.attributes === \"object\" ? u.attributes : undefined,\n },\n }));\n } else if (data.type === \"wexio:prefill:v1\") {\n // Unverified profile → pre-fill / auto-attach the prechat.\n const p = data.prefill;\n if (!p || typeof p !== \"object\") return;\n setReceived((prev) => ({\n ...prev,\n prefill: {\n name: typeof p.name === \"string\" ? p.name : undefined,\n email: typeof p.email === \"string\" ? p.email : undefined,\n phone: typeof p.phone === \"string\" ? p.phone : undefined,\n },\n }));\n } else if (data.type === \"wexio:shutdown:v1\") {\n // Logout — forget the host-supplied identity/prefill so the\n // re-handshake (driven by the shell's epoch bump) goes anonymous.\n setReceived({ identity: null, prefill: null });\n }\n };\n window.addEventListener(\"message\", onMessage);\n // Tell the loader we're ready so it replies with the host's identity +\n // prefill. (The loader also sends them proactively on iframe load —\n // this is the fast path / retry against a race.)\n window.parent?.postMessage({ type: \"wexio:widget:ready:v1\" }, \"*\");\n return () => window.removeEventListener(\"message\", onMessage);\n }, [env.visitorIdentity, env.visitorPrefill]);\n\n return {\n identity: env.visitorIdentity ?? received.identity,\n prefill: env.visitorPrefill ?? received.prefill,\n };\n}\n\n/**\n * Returns a stable visitor id from localStorage; mints one on first\n * visit. We use a uuid-v4-shaped random string rather than something\n * derived from fingerprinting — operators on privacy-sensitive sites\n * shouldn't see their visitors fingerprinted by the widget.\n *\n * Exported so the passkey sign-in (a separate ceremony, see\n * `usePasskeyAuth`) binds to the SAME sticky visitor id this handshake\n * uses — the BE then attaches the verified passkey to the visitor's\n * existing anonymous contact + chat (anon → identified continuity).\n */\nexport function ensureVisitorId(): string {\n try {\n const pk = getPublicKey();\n const scopedKey = visitorIdKey(pk);\n const existing = localStorage.getItem(scopedKey);\n if (existing) return existing;\n // Migrate from the legacy global key on first read so a returning\n // visitor keeps their identity on the operator that wrote it. The\n // legacy key is removed in the same step so OTHER operators\n // sharing the same widget origin don't inherit it on their first\n // mount (the whole point of the scoping).\n if (pk) {\n const legacy = localStorage.getItem(LEGACY_VISITOR_ID_KEY);\n if (legacy) {\n localStorage.setItem(scopedKey, legacy);\n localStorage.removeItem(LEGACY_VISITOR_ID_KEY);\n return legacy;\n }\n }\n const fresh = generateVisitorId();\n localStorage.setItem(scopedKey, fresh);\n return fresh;\n } catch {\n // Privacy mode / cookies disabled → use an in-memory id. The\n // visitor loses chat continuity across reloads but the widget\n // still works for the current session.\n return generateVisitorId();\n }\n}\n\nfunction generateVisitorId(): string {\n if (typeof crypto !== \"undefined\" && typeof crypto.randomUUID === \"function\") {\n return crypto.randomUUID();\n }\n // Fallback for older browsers — still 32 hex chars of entropy.\n const bytes = new Uint8Array(16);\n if (typeof crypto !== \"undefined\" && crypto.getRandomValues) {\n crypto.getRandomValues(bytes);\n } else {\n for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);\n }\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n","/**\n * Client-safe locale primitives — split out of `lib/i18n.ts` (which\n * imports `next/headers` and is server-only) so client components can\n * pull the supported-locale list / type without dragging the server\n * module into the browser bundle.\n *\n * Adding a new locale is a three-step change:\n *\n * 1. Add the code to `SUPPORTED_LOCALES` below.\n * 2. Drop `messages/<code>.json` with the same key shape as `en.json`.\n * 3. (Optional) extend `lib/locale-detect.ts` if the new locale uses\n * a non-standard `Accept-Language` token that needs aliasing.\n *\n * Keep this list short — every locale ships in the widget bundle.\n */\nexport const SUPPORTED_LOCALES = [\"en\", \"uk\"] as const;\nexport const DEFAULT_LOCALE = \"en\";\n\nexport type SupportedLocale = (typeof SUPPORTED_LOCALES)[number];\n\nexport function isSupportedLocale(value: unknown): value is SupportedLocale {\n return typeof value === \"string\" && (SUPPORTED_LOCALES as readonly string[]).includes(value);\n}\n","/**\n * Client-side runtime locale swap.\n *\n * The widget SSRs with one locale (resolved by middleware from cookie /\n * Accept-Language / config). After mount, the visitor's saved profile\n * preference, or a postMessage from the dashboard, can override that\n * choice WITHOUT a reload — `<RuntimeIntlProvider>` subscribes to this\n * module's signal, dynamically imports the matching messages bundle,\n * and re-renders `NextIntlClientProvider` with the new `locale` +\n * `messages` props so every `useTranslations()` call flips on next\n * render.\n *\n * Keeping the bus as a plain module avoids needing context plumbing\n * just to nudge the provider from a deep child (the ProfileTab fires\n * `setRuntimeLocale()` right after its mutation succeeds).\n */\n\nimport { DEFAULT_LOCALE, isSupportedLocale, type SupportedLocale } from \"./locales\";\n\nexport type MessagesBundle = Record<string, unknown>;\n\ntype Listener = (locale: SupportedLocale) => void;\n\nlet current: SupportedLocale | null = null;\nconst listeners = new Set<Listener>();\n\n/** Current runtime locale, if anyone has set one. `null` means the\n * SSR-resolved locale is still in effect — fall back to that. */\nexport function getRuntimeLocale(): SupportedLocale | null {\n return current;\n}\n\n/** Publish a new locale. Noop when the value matches the current one or\n * isn't in the supported set. */\nexport function setRuntimeLocale(value: unknown): void {\n if (!isSupportedLocale(value)) return;\n if (current === value) return;\n current = value;\n for (const fn of listeners) fn(value);\n}\n\nexport function subscribeRuntimeLocale(fn: Listener): () => void {\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n}\n\n// Static import map — keeps every supported locale in the same chunk\n// graph so the dynamic `import()` resolves predictably under Turbopack\n// + production builds (a literal `import(\\`@/messages/${l}.json\\`) would\n// be inferred as an any-string load and ship every JSON file in the repo).\nconst loaders: Record<SupportedLocale, () => Promise<MessagesBundle>> = {\n en: () => import(\"@/messages/en.json\").then((m) => m.default as MessagesBundle),\n uk: () => import(\"@/messages/uk.json\").then((m) => m.default as MessagesBundle),\n};\n\nexport async function loadMessages(locale: SupportedLocale): Promise<MessagesBundle> {\n const loader = loaders[locale] ?? loaders[DEFAULT_LOCALE];\n return loader();\n}\n","\"use client\";\n\nimport { useEffect } from \"react\";\nimport { useVisitorProfilePreferencesQuery } from \"@/lib/graphql/queries/generated/profile.generated\";\nimport { setRuntimeLocale } from \"./runtime-locale\";\nimport type { ThemePreference } from \"./use-theme-mode\";\n\n/** Subset of `VisitorProfile` the shell needs to apply theme + language +\n * notification preferences. `loaded` is `true` once the BE has answered\n * (or never started, in the demo/unauthed case) so consumers don't apply\n * stale defaults while the query is in flight. */\nexport interface VisitorProfilePreferences {\n themeMode: ThemePreference | null;\n themeModeEditable: boolean;\n language: string | null;\n desktopNotifications: boolean;\n loaded: boolean;\n}\n\nconst EMPTY: VisitorProfilePreferences = {\n themeMode: null,\n themeModeEditable: true,\n language: null,\n desktopNotifications: false,\n loaded: false,\n};\n\n/**\n * Fetches the visitor's profile (when Profile is enabled + the visitor is\n * authed) and surfaces just the preferences slice — used by the shell to\n * apply theme mode, language, and desktop-notification opt-in across the\n * whole widget. Skips entirely when the feature is off or the visitor is\n * anonymous (the BE rejects the query without a visitor JWT).\n *\n * Persists the resolved language to BOTH:\n *\n * 1. the `wexio-locale` cookie — so the NEXT SSR pass / middleware\n * hands back the correct locale without waiting for the query, and\n * 2. the runtime-locale signal — so the active `RuntimeIntlProvider`\n * swaps its messages bundle live in this session (no reload).\n */\nexport function useVisitorProfilePreferences(opts: {\n enabled: boolean;\n}): VisitorProfilePreferences {\n // Slim prefs-only query — drops the heavy `fields[]` payload that\n // ProfileTab needs. Same resolver / same parameterless cache slot,\n // so ProfileTab's full read supersedes this one once that tab\n // opens, and the save mutation flips the cache for both consumers.\n const { data } = useVisitorProfilePreferencesQuery({ skip: !opts.enabled });\n const profile = data?.visitorProfile;\n\n const prefs: VisitorProfilePreferences = profile\n ? {\n themeMode: normaliseTheme(profile.preferences.themeMode),\n themeModeEditable: profile.themeModeEditable,\n language: profile.preferences.language ?? null,\n desktopNotifications: !!profile.preferences.desktopNotifications,\n loaded: true,\n }\n : opts.enabled\n ? EMPTY\n : { ...EMPTY, loaded: true }; // disabled → \"loaded\" so consumers don't wait forever\n\n // Persist the language pref to the cookie (next SSR pass) AND push it\n // to the runtime-locale bus so `RuntimeIntlProvider` swaps the active\n // messages bundle WITHOUT a reload. Idempotent: `setRuntimeLocale` is a\n // no-op when the value matches the current one or isn't in the\n // supported set.\n useEffect(() => {\n if (!prefs.loaded) return;\n if (!prefs.language) return;\n try {\n // biome-ignore lint/suspicious/noDocumentCookie: synchronous one-shot write the next SSR pass reads — Cookie Store API is async and still partial in Safari, so plain document.cookie is the right tool here.\n document.cookie = `wexio-locale=${encodeURIComponent(prefs.language)}; path=/; max-age=${60 * 60 * 24 * 365}; samesite=lax`;\n } catch {}\n setRuntimeLocale(prefs.language);\n }, [prefs.loaded, prefs.language]);\n\n return prefs;\n}\n\n/** Normalise the BE enum to the lowercase set our theme hook + CSS\n * expects. BE validates against `system|light|dark`; legacy values\n * (`AUTO`/uppercase) are accepted for forward-compat. */\nfunction normaliseTheme(value: unknown): ThemePreference | null {\n if (typeof value !== \"string\") return null;\n const v = value.toLowerCase();\n if (v === \"light\" || v === \"dark\") return v;\n if (v === \"auto\" || v === \"system\") return \"auto\";\n return null;\n}\n","\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { apiBase } from \"./api\";\nimport { getPublicKey } from \"./apollo-client\";\n\n/** Sender attribution. BE shape uses `from` (visitor / operator / bot\n * / ai / system). The widget previously read `sender` — keep both\n * for back-compat so a deploy mismatch doesn't blank the avatar\n * line. */\nexport interface RealtimeSender {\n kind: \"operator\" | \"ai\" | \"bot\" | \"system\" | \"visitor\";\n name: string;\n avatar?: string;\n}\n\n/** Quick-reply chip shape on the wire. BE emits `{ label, value, type }`;\n * the widget's button renderer expects `{ text, payload, style }`. The\n * SSE consumer normalises one to the other.\n *\n * `type === \"callback\"` is the only widely-used variant — the value\n * identifies a flow branch the bot routes on. Other types map through\n * unchanged. */\nexport interface RealtimeMessageButton {\n label: string;\n value: string;\n type?: string;\n}\n\nexport interface RealtimeMessageEvent {\n /** Backend message id once persisted; client-temp id while in-flight.\n * For `kind === 'read-receipt'` this is a synthetic `read-<ts>` id\n * the BE mints and the visitor ignores. */\n externalMessageId: string;\n /** Optional — the new BE shape omits `direction` and lets the\n * consumer derive it from `from.kind` (visitor → OUTBOUND, else\n * INBOUND). Kept for back-compat with older event emitters. */\n direction?: \"INBOUND\" | \"OUTBOUND\" | string;\n kind: \"text\" | \"media\" | \"buttons\" | \"location\" | \"typing\" | \"read-receipt\" | string;\n text?: string;\n payload?: unknown;\n /** Quick-reply chips for `kind === 'buttons'` messages. */\n buttons?: RealtimeMessageButton[];\n /** New shape — preferred. */\n from?: RealtimeSender;\n /** Legacy shape — older BE deploys emit this name; keep as a\n * fallback so a deploy mismatch doesn't lose attribution. */\n sender?: RealtimeSender;\n sentAt?: string;\n /** Set on AI typing events — which step of the assistant turn is\n * running: `\"thinking\"` (prep / STT / deciding), `\"searching\"` (RAG\n * knowledge lookup), `\"typing\"` (model producing the answer). Drives\n * the typing-bubble caption. Absent for operator typing. */\n phase?: \"thinking\" | \"searching\" | \"typing\" | string;\n /** Set when `kind === 'read-receipt'`. Carries the exact message\n * ids that flipped to READ — the iframe matches against its\n * local store and upgrades just those bubbles. */\n readReceipt?: {\n messageIds: string[];\n readAt: string;\n };\n}\n\ninterface UseVisitorRealtimeOpts {\n chatId: string | null;\n token: string | null;\n enabled?: boolean;\n onMessage: (event: RealtimeMessageEvent) => void;\n}\n\n/**\n * Opens an SSE stream against the BE's `/api/web/realtime/:chatId`\n * endpoint and fires `onMessage` for each event.\n *\n * **Auth**: the standard browser `EventSource` API doesn't allow\n * custom headers, so the JWT rides on the URL as a `?token=` param.\n * This is fine because (a) the URL never leaves the visitor's\n * browser, (b) the token is short-lived (~10 min), and (c) the BE's\n * `VisitorJwtGuard` accepts it via query in addition to header\n * (small accommodation made for SSE specifically).\n *\n * **Reconnect**: handled by the browser automatically — when the\n * connection drops, `EventSource` retries with backoff. We don't\n * intervene.\n *\n * **Typing events** fire `kind: 'typing'` and don't carry text — the\n * caller renders a \"X is typing…\" indicator until the next non-typing\n * event for the same chat.\n */\nexport function useVisitorRealtime({\n chatId,\n token,\n enabled = true,\n onMessage,\n}: UseVisitorRealtimeOpts): void {\n // Keep the callback in a ref so changes don't reopen the SSE stream\n // — we'd lose events during the reconnect window otherwise.\n const onMessageRef = useRef(onMessage);\n useEffect(() => {\n onMessageRef.current = onMessage;\n }, [onMessage]);\n\n useEffect(() => {\n if (!enabled || !chatId || !token) return;\n if (typeof window === \"undefined\") return;\n\n // `WebOriginGuard` requires the integration's publicKey on every\n // visitor request. `EventSource` can't set custom headers, so we\n // attach it as a query param — the guard accepts it there (it's\n // already a documented fallback for SSE-style transports).\n const publicKey = getPublicKey();\n if (!publicKey) {\n // Without a publicKey the BE would reject with\n // `webMissingPublicKey`; bail before opening the stream rather\n // than burning a reconnect cycle.\n return;\n }\n const url =\n `${apiBase()}/api/web/realtime/${encodeURIComponent(chatId)}` +\n `?token=${encodeURIComponent(token)}` +\n `&publicKey=${encodeURIComponent(publicKey)}`;\n const source = new EventSource(url, { withCredentials: false });\n\n const handle = (event: MessageEvent) => {\n try {\n const parsed = JSON.parse(event.data) as RealtimeMessageEvent;\n onMessageRef.current(parsed);\n } catch {\n // Malformed payload — log + skip. The SSE stream itself\n // remains open; one bad frame doesn't kill the connection.\n // eslint-disable-next-line no-console\n console.warn(\"[wexio] unparseable SSE frame\", event.data);\n }\n };\n\n source.addEventListener(\"message\", handle);\n source.addEventListener(\"messageUpdate\", handle as EventListener);\n\n return () => {\n source.removeEventListener(\"message\", handle);\n source.removeEventListener(\"messageUpdate\", handle as EventListener);\n source.close();\n };\n }, [chatId, token, enabled]);\n}\n","/**\n * Demo-mode conversation thread. Surfaced when the widget runs with\n * `forceDummyData` / `mode=demo` — see `lib/use-widget-env.tsx`.\n *\n * Structure (ids, direction, sender kind, media URLs + mimetypes,\n * button payloads, delivery status) lives here; the translatable text\n * (bubble body, chip labels, media alt text, time labels, visitor name)\n * comes from the `demo.conversation.*` next-intl namespace (both\n * locales), read via `t.raw()`. See `dummy/translator.ts`.\n *\n * The thread exercises every bubble variant (text, quick-reply chips,\n * single + multi-image galleries, video, PDF, voice note).\n */\n\nimport type { WidgetMessengerMessageKind } from \"@/lib/widget-config\";\nimport type { DemoTranslator } from \"./translator\";\n\n/**\n * Demo welcome run painted at the top of the thread. Two kinds:\n * - **SYSTEM** — centred status pill (\"chat started with Gaia\").\n * - **HINT** — bordered tip card with an icon (Intercom-style).\n * Both are always shown — see MessagesTab. (`TEXT` was retired alongside\n * the WEB_VISITOR_VISIT flow trigger; proactive bot greetings now arrive\n * via SSE as runtime messages.) Localised via `demo.messenger.welcome.*`.\n */\nexport function getMockWelcomeMessages(\n t: DemoTranslator,\n): { kind: WidgetMessengerMessageKind; text: string }[] {\n return [\n { kind: \"SYSTEM\", text: t.raw(\"messenger.welcome.system\") as string },\n { kind: \"HINT\", text: t.raw(\"messenger.welcome.hint\") as string },\n ];\n}\n\nexport interface MockMessageButton {\n text: string;\n payload: string;\n}\n\nexport interface MockMessageMedia {\n url: string;\n mimetype: string;\n alt: string;\n}\n\n/**\n * Delivery state shared by inbound + outbound messages. Mirrors the\n * BE's `MessageDeliveryStatus` enum so values map 1:1 in either\n * direction.\n */\nexport type MockMessageDeliveryStatus = \"SENT\" | \"DELIVERED\" | \"READ\" | \"FAILED\";\n\nexport interface MockMessage {\n id: string;\n direction: \"INBOUND\" | \"OUTBOUND\";\n text: string;\n ageLabel: string;\n /** ISO timestamp the message was created. Drives the date-separator\n * grouping. Absent on optimistic/live appends — the row builder treats\n * a missing value as \"now\" (so a just-sent message groups under today). */\n createdAt?: string;\n /** Stable React key for the rendered row. Set at optimistic-append\n * time and PRESERVED across the tmp-id → BE-id swap that happens\n * when the send mutation resolves. Without this, `id` change would\n * flip the `<AnimatePresence>` key and the bubble would unmount +\n * remount → visible re-animation that reads as a \"lag\". History\n * messages don't carry a clientKey; the row builder falls back to\n * `id` for them (which is stable, being the BE-canonical id). */\n clientKey?: string;\n sender: {\n kind: \"operator\" | \"ai\" | \"bot\" | \"visitor\";\n name: string;\n avatar?: string;\n };\n buttons?: MockMessageButton[];\n media?: MockMessageMedia[];\n deliveryStatus?: MockMessageDeliveryStatus;\n}\n\n/** Locale-independent fields, defined once. Sender `name` is set for\n * AI / operator senders (proper names, not translated); visitor\n * bubbles take the localised name from `conversation.visitorName`.\n * Button `payload`s and media URL + mimetype never change across\n * locales. */\ninterface ConvStruct {\n id: string;\n direction: MockMessage[\"direction\"];\n sender: { kind: MockMessage[\"sender\"][\"kind\"]; name?: string };\n buttons?: { payload: string }[];\n media?: { url: string; mimetype: string }[];\n deliveryStatus?: MockMessageDeliveryStatus;\n}\n\nconst CONV_STRUCT: ConvStruct[] = [\n // {\n // id: \"m-demo-1\",\n // direction: \"OUTBOUND\",\n // sender: { kind: \"ai\", name: \"Gaia\" },\n // buttons: [{ payload: \"pricing\" }, { payload: \"gaia-intro\" }, { payload: \"handoff\" }],\n // },\n // {\n // id: \"m-demo-2\",\n // direction: \"INBOUND\",\n // sender: { kind: \"visitor\" },\n // },\n // {\n // id: \"m-demo-3\",\n // direction: \"OUTBOUND\",\n // sender: { kind: \"ai\", name: \"Gaia\" },\n // },\n // {\n // id: \"m-demo-4\",\n // direction: \"OUTBOUND\",\n // sender: { kind: \"ai\", name: \"Gaia\" },\n // media: [\n // {\n // url: \"https://images.unsplash.com/photo-1551434678-e076c223a692?auto=format&fit=crop&w=640&q=70\",\n // mimetype: \"image/jpeg\",\n // },\n // ],\n // },\n // {\n // // Multi-image gallery + caption.\n // id: \"m-demo-gallery-captioned\",\n // direction: \"OUTBOUND\",\n // sender: { kind: \"ai\", name: \"Gaia\" },\n // media: [\n // { url: \"https://picsum.photos/seed/wexio-a/800/600\", mimetype: \"image/jpeg\" },\n // { url: \"https://picsum.photos/seed/wexio-b/800/600\", mimetype: \"image/jpeg\" },\n // { url: \"https://picsum.photos/seed/wexio-c/800/600\", mimetype: \"image/jpeg\" },\n // ],\n // },\n // {\n // // No caption + multi-image — bare media path; inbound side.\n // id: \"m-demo-gallery-bare\",\n // direction: \"INBOUND\",\n // sender: { kind: \"visitor\" },\n // media: [\n // { url: \"https://picsum.photos/seed/wexio-1/600/600\", mimetype: \"image/jpeg\" },\n // { url: \"https://picsum.photos/seed/wexio-2/600/600\", mimetype: \"image/jpeg\" },\n // { url: \"https://picsum.photos/seed/wexio-3/600/600\", mimetype: \"image/jpeg\" },\n // { url: \"https://picsum.photos/seed/wexio-4/600/600\", mimetype: \"image/jpeg\" },\n // ],\n // deliveryStatus: \"READ\",\n // },\n // {\n // id: \"m-demo-5\",\n // direction: \"OUTBOUND\",\n // sender: { kind: \"ai\", name: \"Gaia\" },\n // media: [\n // {\n // url: \"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4\",\n // mimetype: \"video/mp4\",\n // },\n // ],\n // },\n // {\n // id: \"m-demo-6\",\n // direction: \"INBOUND\",\n // sender: { kind: \"visitor\" },\n // },\n // {\n // id: \"m-demo-7\",\n // direction: \"OUTBOUND\",\n // sender: { kind: \"operator\", name: \"Alex\" },\n // media: [\n // {\n // url: \"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf\",\n // mimetype: \"application/pdf\",\n // },\n // ],\n // },\n // {\n // id: \"m-demo-8\",\n // direction: \"OUTBOUND\",\n // sender: { kind: \"operator\", name: \"Alex\" },\n // media: [\n // {\n // // Same-origin asset from `public/sounds/` — third-party CDN\n // // demos ship without `Access-Control-Allow-Origin`, which made\n // // wavesurfer silently fail to load the waveform. Bundling a\n // // local sample sidesteps CORS; the real BE serves uploaded\n // // voice notes with proper CORS so this only matters for the\n // // mock fallback.\n // url: assetUrl(\"/sounds/wx-nt_3.wav\"),\n // mimetype: \"audio/wav\",\n // },\n // ],\n // },\n // {\n // id: \"m-demo-9\",\n // direction: \"INBOUND\",\n // sender: { kind: \"visitor\" },\n // },\n // {\n // id: \"m-demo-10\",\n // direction: \"OUTBOUND\",\n // sender: { kind: \"operator\", name: \"Alex\" },\n // buttons: [\n // { payload: \"sandbox\" },\n // { payload: \"install\" },\n // { payload: \"book-call\" },\n // { payload: \"stay\" },\n // ],\n // },\n];\n\n/**\n * Build the demo conversation from the active `demo` translator. Per-\n * message text / chip labels / media alts come from\n * `demo.conversation.messages.<id>.*`; the visitor's display name from\n * `demo.conversation.visitorName`.\n */\nexport function getMockConversation(t: DemoTranslator): MockMessage[] {\n const visitorName = t.raw(\"conversation.visitorName\") as string;\n return CONV_STRUCT.map((s) => {\n const base = `conversation.messages.${s.id}`;\n const message: MockMessage = {\n id: s.id,\n direction: s.direction,\n text: t.raw(`${base}.text`) as string,\n ageLabel: t.raw(`${base}.ageLabel`) as string,\n sender: {\n kind: s.sender.kind,\n name: s.sender.kind === \"visitor\" ? visitorName : (s.sender.name ?? \"\"),\n },\n };\n if (s.buttons) {\n const labels = t.raw(`${base}.buttons`) as string[];\n message.buttons = s.buttons.map((b, i) => ({ payload: b.payload, text: labels[i] ?? \"\" }));\n }\n if (s.media) {\n const alts = t.raw(`${base}.mediaAlts`) as string[];\n message.media = s.media.map((m, i) => ({ ...m, alt: alts[i] ?? \"\" }));\n }\n if (s.deliveryStatus) message.deliveryStatus = s.deliveryStatus;\n return message;\n });\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { getMockConversation, type MockMessage } from \"@/dummy\";\nimport { useVisitorChatUnreadLazyQuery } from \"@/lib/graphql/queries/generated/messaging.generated\";\nimport type { RealtimeMessageEvent } from \"@/lib/use-visitor-realtime\";\n\nexport interface UnreadPeekButton {\n /** Label rendered on the peek chip. */\n text: string;\n /** Payload sent back to the BE when the visitor taps the chip. */\n payload: string;\n}\n\nexport interface UnreadPeekMessage {\n id: string;\n text: string | null;\n sender: {\n kind: string;\n name: string;\n avatar?: string;\n };\n /** Quick-reply chips attached to the message — rendered inside the\n * peek so the visitor can answer without opening the panel. */\n buttons: UnreadPeekButton[];\n}\n\nexport interface VisitorUnread {\n count: number;\n /** Most recent unread operator message. `null` when the visitor's\n * caught up — peek hides. */\n lastMessage: UnreadPeekMessage | null;\n /** Clear locally — fired when the panel opens to Messages so the\n * badge + peek disappear without waiting for a refetch. */\n clear: () => void;\n /** Apply an inbound realtime event to the local counter. Called by\n * the shell's SSE pump so the badge updates without re-querying\n * `visitorChatUnread` for every frame. */\n noteInbound: (event: RealtimeMessageEvent) => void;\n /** Apply a read-receipt event. Local count drops by the number of\n * newly-read messages (clamped at 0); peek clears when the last\n * unread is acked. */\n noteRead: (messageIds: string[]) => void;\n}\n\ninterface UseVisitorUnreadOpts {\n chatId: string | null;\n isDummy: boolean;\n}\n\n/**\n * Drives the launcher unread badge + peek card.\n *\n * **Real mode** — fetches `visitorChatUnread` ONCE per session\n * (initial seed when `chatId` resolves) and then tracks every\n * inbound / read-receipt event locally. The SSE stream is the\n * realtime source of truth; the initial query is just reconciliation\n * for messages the visitor missed while the widget was closed on\n * previous visits.\n *\n * **Demo mode** — derives from `getMockConversation()`: the last\n * OUTBOUND message with `deliveryStatus !== \"READ\"` drives count + peek.\n * Calling `clear()` flags the message id as locally-read so the peek\n * dismisses; visitor can still see the messages on the panel.\n */\nexport function useVisitorUnread({ chatId, isDummy }: UseVisitorUnreadOpts): VisitorUnread {\n // Demo translator — drives the demo conversation language so the peek\n // preview matches the rest of the localised demo content.\n const tDemo = useTranslations(\"demo\");\n\n // ─── Demo path ────────────────────────────────────────────────────\n // Seed from getMockConversation() — `cleared` flips on the visitor's\n // first visit to Messages and stays sticky for the rest of the\n // session (matches the real-mode behaviour of bulk-read).\n const [demoCleared, setDemoCleared] = useState(false);\n\n // ─── Real path ────────────────────────────────────────────────────\n // Local-only state — seeded once from the BE, then advanced/decremented\n // entirely from SSE events. No `refetch` on inbound — that was the\n // expensive part the user flagged.\n const [count, setCount] = useState(0);\n const [lastMessage, setLastMessage] = useState<UnreadPeekMessage | null>(null);\n // Tracks ids that already incremented our counter — protects against\n // double-counts when the SSE stream reconnects + replays. Using a ref\n // so updates don't force re-renders.\n const countedIdsRef = useRef<Set<string>>(new Set());\n // Whether the initial reconciliation pass has run for this chatId.\n // Resets when `chatId` changes (visitor session rotation).\n const seededChatRef = useRef<string | null>(null);\n // Flips `true` the moment the visitor acknowledges (opens Messages →\n // `clear()`). Guards the initial fetch's response from clobbering an\n // already-cleared state — without this, opening Messages immediately\n // on first paint would race the in-flight `visitorChatUnread` and\n // the badge would flicker back to N before the BE's read ack lands.\n const clearedSinceSeedRef = useRef(false);\n const [runUnread] = useVisitorChatUnreadLazyQuery({\n fetchPolicy: \"network-only\",\n });\n\n useEffect(() => {\n if (isDummy || !chatId) return;\n if (seededChatRef.current === chatId) return;\n seededChatRef.current = chatId;\n // Reset local tracking — new chat session, new accounting.\n countedIdsRef.current = new Set();\n clearedSinceSeedRef.current = false;\n runUnread({ variables: { chatId } })\n .then((res) => {\n // Visitor already acked while the request was in flight —\n // discard the response so we don't overwrite their cleared\n // state with a stale BE snapshot.\n if (clearedSinceSeedRef.current) return;\n const remote = res.data?.visitorChatUnread;\n if (!remote) return;\n setCount(remote.count ?? 0);\n if (remote.lastMessage) {\n const peek: UnreadPeekMessage = {\n id: remote.lastMessage.id,\n text: remote.lastMessage.text ?? null,\n sender: {\n kind: remote.lastMessage.sender.kind,\n name: remote.lastMessage.sender.name,\n avatar: remote.lastMessage.sender.avatar ?? undefined,\n },\n buttons: normaliseButtons(remote.lastMessage.buttons),\n };\n // Seed the dedupe set with the id we just learned about so\n // the SSE replay (if any) doesn't double-count it.\n countedIdsRef.current.add(peek.id);\n setLastMessage(peek);\n } else {\n setLastMessage(null);\n }\n })\n .catch(() => {\n // Soft-fail — the badge stays at 0 until SSE delivers an\n // event. We don't surface this to the visitor; the next\n // chatId change retries.\n });\n }, [chatId, isDummy, runUnread]);\n\n const clear = useCallback(() => {\n if (isDummy) {\n setDemoCleared(true);\n return;\n }\n // Pure local reset. The BE-side `markChatRead` mutation is owned\n // by `MessagesTab` (it has the scroll context to decide *when*\n // the visitor actually saw the message — at the bottom of the\n // list vs. scrolled up reading history). The shell calls this\n // helper after firing the mutation so the launcher peek + badge\n // disappear without waiting for the SSE read-receipt round-trip.\n setCount(0);\n setLastMessage(null);\n clearedSinceSeedRef.current = true;\n // Hold onto countedIds so a late SSE replay of already-read\n // messages can't push the counter back up — the BE has already\n // ack'd these as read on its side.\n }, [isDummy]);\n\n const noteInbound = useCallback(\n (event: RealtimeMessageEvent) => {\n if (isDummy) return;\n // Only real new messages count toward unread. Typing pings,\n // read-receipts, and visitor-echoes are all filtered upstream\n // in the shell — but guard here too in case a caller forgets.\n if (event.kind === \"typing\" || event.kind === \"read-receipt\") return;\n const sender = event.from ?? event.sender;\n if (sender?.kind === \"visitor\") return;\n const id = event.externalMessageId;\n if (!id) return;\n // Dedupe — SSE reconnects can replay the same event id.\n if (countedIdsRef.current.has(id)) return;\n countedIdsRef.current.add(id);\n setCount((prev) => prev + 1);\n const buttons: UnreadPeekButton[] = Array.isArray(event.buttons)\n ? event.buttons.map((b) => ({ text: b.label, payload: b.value }))\n : [];\n setLastMessage({\n id,\n text: event.text ?? null,\n sender: {\n kind: sender?.kind ?? \"operator\",\n name: sender?.name ?? \"\",\n ...(sender?.avatar ? { avatar: sender.avatar } : {}),\n },\n buttons,\n });\n },\n [isDummy],\n );\n\n const noteRead = useCallback(\n (messageIds: string[]) => {\n if (isDummy) return;\n if (messageIds.length === 0) return;\n // Drop the read ids from our dedupe set so we don't keep\n // suppressing them forever, and bring the count down by the\n // size of the overlap with what's currently in the set\n // (we only counted ids we'd previously added).\n let drop = 0;\n for (const id of messageIds) {\n if (countedIdsRef.current.has(id)) {\n countedIdsRef.current.delete(id);\n drop += 1;\n }\n }\n if (drop > 0) {\n setCount((prev) => Math.max(0, prev - drop));\n }\n setLastMessage((prev) => {\n if (!prev) return prev;\n return messageIds.includes(prev.id) ? null : prev;\n });\n },\n [isDummy],\n );\n\n if (isDummy) {\n const peek = demoCleared ? null : derivePeekFromMock(tDemo);\n return {\n count: peek ? 1 : 0,\n lastMessage: peek,\n clear,\n noteInbound,\n noteRead,\n };\n }\n\n return {\n count,\n lastMessage,\n clear,\n noteInbound,\n noteRead,\n };\n}\n\n/**\n * Walks the mock conversation back-to-front and returns the most\n * recent operator/AI message whose buttons (if any) the visitor can\n * still quick-reply with. Returns null when the conversation tail\n * is a visitor message — that means the visitor's caught up.\n */\nfunction derivePeekFromMock(\n t: Parameters<typeof getMockConversation>[0],\n): UnreadPeekMessage | null {\n const conversation = getMockConversation(t);\n for (let i = conversation.length - 1; i >= 0; i--) {\n const m: MockMessage = conversation[i];\n if (m.direction !== \"OUTBOUND\") continue;\n return {\n id: m.id,\n text: m.text,\n sender: {\n kind: m.sender.kind,\n name: m.sender.name,\n },\n buttons: m.buttons?.map((b) => ({ text: b.text, payload: b.payload })) ?? [],\n };\n }\n return null;\n}\n\n/**\n * The BE returns buttons as a raw JSON column — could be shaped as\n * the message-buttons schema (`{ label, value, url, type }`) OR as\n * the simpler `{ text, payload }` shape used by the visitor SDK.\n * Both are flat label/value pairs; we collapse them defensively so\n * the peek doesn't crash on an operator-side variant we didn't anticipate.\n */\nfunction normaliseButtons(raw: unknown): UnreadPeekButton[] {\n if (!Array.isArray(raw)) return [];\n return raw\n .filter((b): b is Record<string, unknown> => typeof b === \"object\" && b !== null)\n .map((b) => {\n const text = pickString(b.text, b.label) ?? \"\";\n const payload = pickString(b.payload, b.value) ?? text;\n return { text, payload };\n })\n .filter((b) => b.text.length > 0);\n}\n\nfunction pickString(...values: unknown[]): string | undefined {\n for (const v of values) {\n if (typeof v === \"string\" && v.length > 0) return v;\n }\n return undefined;\n}\n","/**\n * Shell-level navigation state. The widget has TWO layout modes:\n *\n * - **List view** (`showTabs: true`) — header chrome + tab nav\n * visible. Visitor is browsing an index: home cards, help\n * categories, news feed, profile editor.\n *\n * - **Drill-in** (`showTabs: false`) — sticky header with a back\n * button; bottom nav hidden so the surface feels focused.\n * Visitor is reading an article, in a conversation, or viewing\n * a single news post.\n *\n * Routes are flat values (not nested) so the shell can pattern-match\n * with a single switch. The `fromCategoryId` on `help-article` lets\n * us walk back UP one level to the category-articles view rather\n * than the categories index, matching how the user expects Back to\n * land them where they came from.\n */\n\nimport type { WidgetFeatures, WidgetTab } from \"./widget-config\";\n\nexport type WidgetRoute =\n | { kind: \"home\" }\n | { kind: \"messages\" }\n | { kind: \"help\" }\n | {\n kind: \"help-category\";\n categoryId: string;\n /** Folder display metadata threaded through the route so the\n * drill-in view can render the header (title + description +\n * count) without a per-folder BE round-trip — the parent\n * always has these fields in hand the moment it navigates.\n * Optional so deep-link entries (no parent state) still\n * function — the header just degrades to nothing in that case. */\n categoryName?: string;\n categoryDescription?: string;\n categoryArticleCount?: number;\n }\n | {\n kind: \"help-article\";\n slug: string;\n /** Path the visitor took to land here. Drives where \"Back\"\n * returns to. */\n from: \"search\" | \"category\";\n fromCategoryId?: string;\n /** Locale override for the article query. Set when the visitor\n * picks a different language in the below-article selector —\n * the variant is identified by `slug` + this `locale` (the BE's\n * visitor lookup is keyed on the pair). Falls back to the\n * widget locale when unset. */\n locale?: string;\n }\n | { kind: \"news\" }\n | { kind: \"news-article\"; id: string }\n | { kind: \"profile\" };\n\n/**\n * Map a route to whether the bottom-nav + tab chrome should render.\n * List routes show tabs; drill-ins hide them.\n */\nexport function routeShowsTabs(route: WidgetRoute): boolean {\n return (\n route.kind === \"home\" ||\n route.kind === \"help\" ||\n route.kind === \"news\" ||\n route.kind === \"profile\"\n );\n}\n\n/**\n * Map a drill-in route to the route it should pop back to. The\n * `features` flags decide where Messages-back lands when the\n * operator has disabled the Home tab — falling through to the next\n * available list surface so the back button never points at a\n * disabled destination.\n */\nexport function popRoute(route: WidgetRoute, features: WidgetFeatures): WidgetRoute {\n switch (route.kind) {\n case \"messages\": {\n if (features.home) return { kind: \"home\" };\n if (features.help) return { kind: \"help\" };\n if (features.news) return { kind: \"news\" };\n if (features.profile) return { kind: \"profile\" };\n // Only messenger enabled → there's nowhere to go; stay put.\n return { kind: \"messages\" };\n }\n case \"help-category\":\n return { kind: \"help\" };\n case \"help-article\":\n if (route.from === \"category\" && route.fromCategoryId) {\n return { kind: \"help-category\", categoryId: route.fromCategoryId };\n }\n return { kind: \"help\" };\n case \"news-article\":\n return { kind: \"news\" };\n default:\n return { kind: \"home\" };\n }\n}\n\n/**\n * Map a route back to the tab id that owns it — used by the bottom\n * nav to highlight the right tab when we ARE on a list route, and\n * by the route reducer when the visitor taps a tab.\n */\nexport function routeToTab(route: WidgetRoute): WidgetTab {\n switch (route.kind) {\n case \"home\":\n return \"home\";\n case \"messages\":\n return \"messages\";\n case \"help\":\n case \"help-category\":\n case \"help-article\":\n return \"help\";\n case \"news\":\n case \"news-article\":\n return \"news\";\n case \"profile\":\n return \"profile\";\n }\n}\n\n/**\n * Checks whether a tab is enabled by the operator's feature flags.\n * Maps the `messages` tab id to the `messenger` flag (legacy naming\n * — the flag is named after the channel, the tab after the noun).\n */\nexport function isTabEnabled(tab: WidgetTab, features: WidgetFeatures): boolean {\n if (tab === \"home\") return features.home;\n if (tab === \"messages\") return features.messenger;\n if (tab === \"help\") return features.help;\n if (tab === \"news\") return features.news;\n return !!features.profile;\n}\n\n/**\n * Count of feature-enabled tabs. When this is 1 the widget runs\n * effectively as a single-surface app — shell hides the bottom nav\n * and any back arrow that would otherwise pop \"up\" to a tab the\n * operator has disabled.\n */\nexport function enabledTabCount(features: WidgetFeatures): number {\n return (\n (features.home ? 1 : 0) +\n (features.messenger ? 1 : 0) +\n (features.help ? 1 : 0) +\n (features.news ? 1 : 0) +\n (features.profile ? 1 : 0)\n );\n}\n\n/**\n * Picks the tab the visitor should land on given the operator's\n * `defaultTab` config + `features` flag set:\n *\n * 1. If `defaultTab` is enabled → use it.\n * 2. Otherwise walk the canonical order (home → messages → help\n * → news → profile) and pick the first enabled tab.\n * 3. If NOTHING is enabled (shouldn't happen — at minimum\n * messenger is always on) → fall back to `defaultTab` anyway.\n */\nexport function pickInitialTab(defaultTab: WidgetTab, features: WidgetFeatures): WidgetTab {\n if (isTabEnabled(defaultTab, features)) return defaultTab;\n const order: WidgetTab[] = [\"home\", \"messages\", \"help\", \"news\", \"profile\"];\n for (const t of order) {\n if (isTabEnabled(t, features)) return t;\n }\n return defaultTab;\n}\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M5 12h14\", key: \"1ays0h\" }],\n [\"path\", { d: \"m12 5 7 7-7 7\", key: \"xquz4c\" }]\n];\nconst ArrowRight = createLucideIcon(\"arrow-right\", __iconNode);\n\nexport { __iconNode, ArrowRight as default };\n//# sourceMappingURL=arrow-right.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M10.268 21a2 2 0 0 0 3.464 0\", key: \"vwvbt9\" }],\n [\n \"path\",\n {\n d: \"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326\",\n key: \"11g9vi\"\n }\n ]\n];\nconst Bell = createLucideIcon(\"bell\", __iconNode);\n\nexport { __iconNode, Bell as default };\n//# sourceMappingURL=bell.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20\",\n key: \"k3hazp\"\n }\n ]\n];\nconst Book = createLucideIcon(\"book\", __iconNode);\n\nexport { __iconNode, Book as default };\n//# sourceMappingURL=book.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z\",\n key: \"oz39mx\"\n }\n ]\n];\nconst Bookmark = createLucideIcon(\"bookmark\", __iconNode);\n\nexport { __iconNode, Bookmark as default };\n//# sourceMappingURL=bookmark.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z\",\n key: \"18u6gg\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"13\", r: \"3\", key: \"1vg3eu\" }]\n];\nconst Camera = createLucideIcon(\"camera\", __iconNode);\n\nexport { __iconNode, Camera as default };\n//# sourceMappingURL=camera.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\", key: \"1u773s\" }],\n [\"path\", { d: \"M12 17h.01\", key: \"p32p05\" }]\n];\nconst CircleQuestionMark = createLucideIcon(\"circle-question-mark\", __iconNode);\n\nexport { __iconNode, CircleQuestionMark as default };\n//# sourceMappingURL=circle-question-mark.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n { d: \"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3\", key: \"11bfej\" }\n ]\n];\nconst Command = createLucideIcon(\"command\", __iconNode);\n\nexport { __iconNode, Command as default };\n//# sourceMappingURL=command.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\",\n key: \"1oefj6\"\n }\n ],\n [\"path\", { d: \"M14 2v5a1 1 0 0 0 1 1h5\", key: \"wfsgrz\" }],\n [\"path\", { d: \"M10 9H8\", key: \"b1mrlr\" }],\n [\"path\", { d: \"M16 13H8\", key: \"t4e002\" }],\n [\"path\", { d: \"M16 17H8\", key: \"z1uh3a\" }]\n];\nconst FileText = createLucideIcon(\"file-text\", __iconNode);\n\nexport { __iconNode, FileText as default };\n//# sourceMappingURL=file-text.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"line\", { x1: \"6\", x2: \"10\", y1: \"11\", y2: \"11\", key: \"1gktln\" }],\n [\"line\", { x1: \"8\", x2: \"8\", y1: \"9\", y2: \"13\", key: \"qnk9ow\" }],\n [\"line\", { x1: \"15\", x2: \"15.01\", y1: \"12\", y2: \"12\", key: \"krot7o\" }],\n [\"line\", { x1: \"18\", x2: \"18.01\", y1: \"10\", y2: \"10\", key: \"1lcuu1\" }],\n [\n \"path\",\n {\n d: \"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z\",\n key: \"mfqc10\"\n }\n ]\n];\nconst Gamepad2 = createLucideIcon(\"gamepad-2\", __iconNode);\n\nexport { __iconNode, Gamepad2 as default };\n//# sourceMappingURL=gamepad-2.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"line\", { x1: \"4\", x2: \"20\", y1: \"9\", y2: \"9\", key: \"4lhtct\" }],\n [\"line\", { x1: \"4\", x2: \"20\", y1: \"15\", y2: \"15\", key: \"vyu0kd\" }],\n [\"line\", { x1: \"10\", x2: \"8\", y1: \"3\", y2: \"21\", key: \"1ggp8o\" }],\n [\"line\", { x1: \"16\", x2: \"14\", y1: \"3\", y2: \"21\", key: \"weycgp\" }]\n];\nconst Hash = createLucideIcon(\"hash\", __iconNode);\n\nexport { __iconNode, Hash as default };\n//# sourceMappingURL=hash.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5\",\n key: \"mvr1a0\"\n }\n ]\n];\nconst Heart = createLucideIcon(\"heart\", __iconNode);\n\nexport { __iconNode, Heart as default };\n//# sourceMappingURL=heart.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M16 5h6\", key: \"1vod17\" }],\n [\"path\", { d: \"M19 2v6\", key: \"4bpg5p\" }],\n [\"path\", { d: \"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5\", key: \"1ue2ih\" }],\n [\"path\", { d: \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\", key: \"1xmnt7\" }],\n [\"circle\", { cx: \"9\", cy: \"9\", r: \"2\", key: \"af1f0g\" }]\n];\nconst ImagePlus = createLucideIcon(\"image-plus\", __iconNode);\n\nexport { __iconNode, ImagePlus as default };\n//# sourceMappingURL=image-plus.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\",\n key: \"1gvzjb\"\n }\n ],\n [\"path\", { d: \"M9 18h6\", key: \"x1upvd\" }],\n [\"path\", { d: \"M10 22h4\", key: \"ceow96\" }]\n];\nconst Lightbulb = createLucideIcon(\"lightbulb\", __iconNode);\n\nexport { __iconNode, Lightbulb as default };\n//# sourceMappingURL=lightbulb.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"11\", x: \"3\", y: \"11\", rx: \"2\", ry: \"2\", key: \"1w4ew1\" }],\n [\"path\", { d: \"M7 11V7a5 5 0 0 1 10 0v4\", key: \"fwvmzm\" }]\n];\nconst Lock = createLucideIcon(\"lock\", __iconNode);\n\nexport { __iconNode, Lock as default };\n//# sourceMappingURL=lock.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7\", key: \"132q7q\" }],\n [\"rect\", { x: \"2\", y: \"4\", width: \"20\", height: \"16\", rx: \"2\", key: \"izxlao\" }]\n];\nconst Mail = createLucideIcon(\"mail\", __iconNode);\n\nexport { __iconNode, Mail as default };\n//# sourceMappingURL=mail.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719\",\n key: \"1sd12s\"\n }\n ],\n [\"path\", { d: \"M8 12h.01\", key: \"czm47f\" }],\n [\"path\", { d: \"M12 12h.01\", key: \"1mp3jc\" }],\n [\"path\", { d: \"M16 12h.01\", key: \"1l6xoz\" }]\n];\nconst MessageCircleMore = createLucideIcon(\"message-circle-more\", __iconNode);\n\nexport { __iconNode, MessageCircleMore as default };\n//# sourceMappingURL=message-circle-more.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719\",\n key: \"1sd12s\"\n }\n ]\n];\nconst MessageCircle = createLucideIcon(\"message-circle\", __iconNode);\n\nexport { __iconNode, MessageCircle as default };\n//# sourceMappingURL=message-circle.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\",\n key: \"18887p\"\n }\n ]\n];\nconst MessageSquare = createLucideIcon(\"message-square\", __iconNode);\n\nexport { __iconNode, MessageSquare as default };\n//# sourceMappingURL=message-square.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"20\", height: \"14\", x: \"2\", y: \"3\", rx: \"2\", key: \"48i651\" }],\n [\"line\", { x1: \"8\", x2: \"16\", y1: \"21\", y2: \"21\", key: \"1svkeh\" }],\n [\"line\", { x1: \"12\", x2: \"12\", y1: \"17\", y2: \"21\", key: \"vw1qmm\" }]\n];\nconst Monitor = createLucideIcon(\"monitor\", __iconNode);\n\nexport { __iconNode, Monitor as default };\n//# sourceMappingURL=monitor.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\",\n key: \"kfwtm\"\n }\n ]\n];\nconst Moon = createLucideIcon(\"moon\", __iconNode);\n\nexport { __iconNode, Moon as default };\n//# sourceMappingURL=moon.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\",\n key: \"1miecu\"\n }\n ]\n];\nconst Paperclip = createLucideIcon(\"paperclip\", __iconNode);\n\nexport { __iconNode, Paperclip as default };\n//# sourceMappingURL=paperclip.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384\",\n key: \"9njp5v\"\n }\n ]\n];\nconst Phone = createLucideIcon(\"phone\", __iconNode);\n\nexport { __iconNode, Phone as default };\n//# sourceMappingURL=phone.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"m21 21-4.34-4.34\", key: \"14j7rj\" }],\n [\"circle\", { cx: \"11\", cy: \"11\", r: \"8\", key: \"4ej97u\" }]\n];\nconst Search = createLucideIcon(\"search\", __iconNode);\n\nexport { __iconNode, Search as default };\n//# sourceMappingURL=search.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\",\n key: \"oel41y\"\n }\n ]\n];\nconst Shield = createLucideIcon(\"shield\", __iconNode);\n\nexport { __iconNode, Shield as default };\n//# sourceMappingURL=shield.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"M8 14s1.5 2 4 2 4-2 4-2\", key: \"1y1vjs\" }],\n [\"line\", { x1: \"9\", x2: \"9.01\", y1: \"9\", y2: \"9\", key: \"yxxnd0\" }],\n [\"line\", { x1: \"15\", x2: \"15.01\", y1: \"9\", y2: \"9\", key: \"1p4y9e\" }]\n];\nconst Smile = createLucideIcon(\"smile\", __iconNode);\n\nexport { __iconNode, Smile as default };\n//# sourceMappingURL=smile.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z\",\n key: \"1s2grr\"\n }\n ],\n [\"path\", { d: \"M20 2v4\", key: \"1rf3ol\" }],\n [\"path\", { d: \"M22 4h-4\", key: \"gwowj6\" }],\n [\"circle\", { cx: \"4\", cy: \"20\", r: \"2\", key: \"6kqj1y\" }]\n];\nconst Sparkles = createLucideIcon(\"sparkles\", __iconNode);\n\nexport { __iconNode, Sparkles as default };\n//# sourceMappingURL=sparkles.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\",\n key: \"r04s7s\"\n }\n ]\n];\nconst Star = createLucideIcon(\"star\", __iconNode);\n\nexport { __iconNode, Star as default };\n//# sourceMappingURL=star.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"4\", key: \"4exip2\" }],\n [\"path\", { d: \"M12 2v2\", key: \"tus03m\" }],\n [\"path\", { d: \"M12 20v2\", key: \"1lh1kg\" }],\n [\"path\", { d: \"m4.93 4.93 1.41 1.41\", key: \"149t6j\" }],\n [\"path\", { d: \"m17.66 17.66 1.41 1.41\", key: \"ptbguv\" }],\n [\"path\", { d: \"M2 12h2\", key: \"1t8f8n\" }],\n [\"path\", { d: \"M20 12h2\", key: \"1q8mjw\" }],\n [\"path\", { d: \"m6.34 17.66-1.41 1.41\", key: \"1m8zz5\" }],\n [\"path\", { d: \"m19.07 4.93-1.41 1.41\", key: \"1shlcs\" }]\n];\nconst Sun = createLucideIcon(\"sun\", __iconNode);\n\nexport { __iconNode, Sun as default };\n//# sourceMappingURL=sun.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M10 11v6\", key: \"nco0om\" }],\n [\"path\", { d: \"M14 11v6\", key: \"outv1u\" }],\n [\"path\", { d: \"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\", key: \"miytrc\" }],\n [\"path\", { d: \"M3 6h18\", key: \"d0wm0j\" }],\n [\"path\", { d: \"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\", key: \"e791ji\" }]\n];\nconst Trash2 = createLucideIcon(\"trash-2\", __iconNode);\n\nexport { __iconNode, Trash2 as default };\n//# sourceMappingURL=trash-2.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\", key: \"975kel\" }],\n [\"circle\", { cx: \"12\", cy: \"7\", r: \"4\", key: \"17ys0d\" }]\n];\nconst User = createLucideIcon(\"user\", __iconNode);\n\nexport { __iconNode, User as default };\n//# sourceMappingURL=user.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\", key: \"1yyitq\" }],\n [\"path\", { d: \"M16 3.128a4 4 0 0 1 0 7.744\", key: \"16gr8j\" }],\n [\"path\", { d: \"M22 21v-2a4 4 0 0 0-3-3.87\", key: \"kshegd\" }],\n [\"circle\", { cx: \"9\", cy: \"7\", r: \"4\", key: \"nufk8\" }]\n];\nconst Users = createLucideIcon(\"users\", __iconNode);\n\nexport { __iconNode, Users as default };\n//# sourceMappingURL=users.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5\",\n key: \"ftymec\"\n }\n ],\n [\"rect\", { x: \"2\", y: \"6\", width: \"14\", height: \"12\", rx: \"2\", key: \"158x01\" }]\n];\nconst Video = createLucideIcon(\"video\", __iconNode);\n\nexport { __iconNode, Video as default };\n//# sourceMappingURL=video.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\",\n key: \"uqj9uw\"\n }\n ],\n [\"path\", { d: \"M16 9a5 5 0 0 1 0 6\", key: \"1q6k2b\" }],\n [\"path\", { d: \"M19.364 18.364a9 9 0 0 0 0-12.728\", key: \"ijwkga\" }]\n];\nconst Volume2 = createLucideIcon(\"volume-2\", __iconNode);\n\nexport { __iconNode, Volume2 as default };\n//# sourceMappingURL=volume-2.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z\",\n key: \"uqj9uw\"\n }\n ],\n [\"line\", { x1: \"22\", x2: \"16\", y1: \"9\", y2: \"15\", key: \"1ewh16\" }],\n [\"line\", { x1: \"16\", x2: \"22\", y1: \"9\", y2: \"15\", key: \"5ykzw1\" }]\n];\nconst VolumeX = createLucideIcon(\"volume-x\", __iconNode);\n\nexport { __iconNode, VolumeX as default };\n//# sourceMappingURL=volume-x.mjs.map\n","\"use client\";\n\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { cn } from \"@/lib/utils\";\n\ninterface UnreadBadgeProps {\n /** Unread count. 0 (or less) renders nothing. >99 caps to \"99+\". */\n count: number;\n /** `sm` — tab-icon scale (default); `md` — launcher-FAB scale. */\n size?: \"sm\" | \"md\";\n /** Absolute positioning supplied by the caller (e.g.\n * `\"absolute -top-1.5 -right-2\"`). The badge anchors to the nearest\n * positioned ancestor. */\n className?: string;\n}\n\nconst SIZE_CLASSES: Record<NonNullable<UnreadBadgeProps[\"size\"]>, string> = {\n sm: \"h-3.5 min-w-3.5 px-0.75 text-[8px]\",\n md: \"h-5 min-w-5 px-1.5 text-[10px]\",\n};\n\n/**\n * Shared unread-count badge — a red pill that:\n * - **bounces in** on appear and re-bounces on every count change (a\n * pronounced springy overshoot, re-keyed on `count`),\n * - **pulses** continuously while unread: a constant soft halo plus a\n * blurred disc that expands + fades on a loop (a radiating \"light\",\n * not a hard ring),\n * - **pops out** when the count drops to 0.\n *\n * Used on the bottom-nav messages tab and the launcher FAB so both share\n * one behaviour. The caller positions it via `className` and the parent\n * must NOT be `overflow-hidden` (it would shear the glow — see\n * `bottom-nav.tsx`).\n */\nexport function UnreadBadge({ count, size = \"sm\", className }: UnreadBadgeProps) {\n return (\n <AnimatePresence>\n {count > 0 && (\n // OUTER: positioning + appear/disappear + a pop on each count change\n // (re-keyed so it remounts and replays). Scale here is the pop, so\n // it never fights the pulse below.\n <motion.span\n key={count}\n role=\"status\"\n initial={{ scale: 0 }}\n animate={{ scale: 1 }}\n exit={{ scale: 0 }}\n // Low `damping` → a pronounced springy overshoot (bounce).\n transition={{ type: \"spring\", stiffness: 600, damping: 9 }}\n className={cn(\"inline-flex\", className)}\n aria-label={`${count} unread`}\n >\n {/* Constant soft halo — blurred disc so the badge always reads as\n gently \"lit\", not only during the pulse. */}\n <span\n aria-hidden=\"true\"\n className=\"absolute inset-0 -z-10 rounded-full bg-wx-danger opacity-40 blur-[2px]\"\n />\n {/* PULSE: a blurred red disc that expands + fades on a loop. */}\n <motion.span\n aria-hidden=\"true\"\n initial={false}\n animate={{ opacity: [0.5, 0], scale: [1, 1.55] }}\n transition={{\n duration: 1.6,\n ease: \"easeOut\",\n repeat: Number.POSITIVE_INFINITY,\n repeatDelay: 0.4,\n }}\n className=\"absolute inset-0 -z-10 rounded-full bg-wx-danger blur-[2px]\"\n />\n {/* The crisp badge on top. */}\n <span\n className={cn(\n \"relative flex items-center justify-center\",\n \"rounded-full bg-wx-danger font-bold leading-none text-white\",\n SIZE_CLASSES[size],\n )}\n >\n {count > 99 ? \"99+\" : count}\n </span>\n </motion.span>\n )}\n </AnimatePresence>\n );\n}\n","\"use client\";\n\nimport { HelpCircle, type LucideIcon, Megaphone, User } from \"lucide-react\";\nimport { motion, useAnimation } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { useEffect } from \"react\";\nimport {\n HomeIcon,\n type HomeIconHandle,\n MessageSquareIcon,\n type MessageSquareIconHandle,\n} from \"@/components/widget/icons/animated\";\nimport { UnreadBadge } from \"@/components/widget/unread-badge\";\nimport { useIconHover } from \"@/lib/use-icon-hover\";\nimport { cn } from \"@/lib/utils\";\nimport type { WidgetFeatures, WidgetTab } from \"@/lib/widget-config\";\n\ninterface BottomNavProps {\n active: WidgetTab;\n features: WidgetFeatures;\n onChange: (tab: WidgetTab) => void;\n /** Unread chat count — badged on the messages tab. 0 hides the badge. */\n unreadCount?: number;\n}\n\nconst TAB_ORDER: WidgetTab[] = [\"home\", \"messages\", \"help\", \"news\", \"profile\"];\n\n/**\n * Bottom tab nav — Day 7 refresh.\n *\n * **Floating pill segmented control**: the nav is a rounded card\n * with a glassy backdrop sitting just above the bottom of the\n * panel. The active tab's inner pill **slides between tabs** via\n * Framer Motion's `layoutId`, the active label widens into view\n * while inactive tabs stay icon-only — keeps tap targets large\n * without visual clutter.\n *\n * **Hybrid icons** — `lucide-animated` for Home + Messages (mature\n * animations); `lucide-react` for Help + News (Megaphone &\n * HelpCircle aren't in lucide-animated yet) with a motion-driven\n * `rotate / scale` micro-animation triggered on the **whole pill's**\n * hover, so visitors see motion regardless of where the icon was\n * sourced from.\n */\nexport function BottomNav({ active, features, onChange, unreadCount = 0 }: BottomNavProps) {\n const t = useTranslations(\"tabs\");\n const homeHover = useIconHover<HomeIconHandle>();\n const messagesHover = useIconHover<MessageSquareIconHandle>();\n\n const visibleTabs = TAB_ORDER.filter((id) => featureFor(id, features));\n\n return (\n <div className=\"px-3 pt-2 pb-2\">\n <nav\n // biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: intentional nav-as-tablist — both a navigation landmark AND a tab interface (each tab swaps the panel below); kept on <nav> so AT users keep the landmark while the tablist role drives tab/arrow-key semantics\n role=\"tablist\"\n className={cn(\n // NOTE: intentionally NOT `overflow-hidden` — the unread badge's\n // pulse glow radiates past the nav's top edge, and clipping it\n // sheared the glow flat. The sliding `layoutId` pill is `inset-0`\n // inside each button (inset ~4px by `p-1`), so it never reaches the\n // rounded edge to overflow; `backdrop-blur` still clips to\n // `rounded-full` on its own.\n // Switched grid → flex so the ACTIVE pill expands to fit its label\n // (`Профіль` was clipped to `Профі.` at 5 equal columns); inactive\n // pills stay icon-only and share the remaining space evenly.\n \"relative flex w-full items-center gap-1\",\n \"rounded-full bg-wx-bg-elevated/70 p-1 backdrop-blur-md\",\n \"shadow-[inset_0_0_0_1px_rgb(0_0_0/0.04)]\",\n )}\n >\n {visibleTabs.map((id) => {\n const isActive = id === active;\n if (id === \"home\") {\n return (\n <TabPill\n key={id}\n id={id}\n label={t(id)}\n isActive={isActive}\n onClick={() => onChange(id)}\n parentHandlers={homeHover.parentHandlers}\n icon={<HomeIcon ref={homeHover.iconRef} size={16} />}\n />\n );\n }\n if (id === \"messages\") {\n return (\n <TabPill\n key={id}\n id={id}\n label={t(id)}\n isActive={isActive}\n onClick={() => onChange(id)}\n parentHandlers={messagesHover.parentHandlers}\n icon={<MessageSquareIcon ref={messagesHover.iconRef} size={16} />}\n badgeCount={unreadCount}\n />\n );\n }\n // Help / News / Profile: lucide-react with motion micro-animation\n // triggered by the tab pill's whileHover. (`lucide-animated` has no\n // matching animated glyphs for these yet.)\n const StaticIcon = id === \"help\" ? HelpCircle : id === \"news\" ? Megaphone : User;\n return (\n <StaticIconTabPill\n key={id}\n id={id}\n label={t(id)}\n isActive={isActive}\n onClick={() => onChange(id)}\n Icon={StaticIcon}\n />\n );\n })}\n </nav>\n </div>\n );\n}\n\ninterface TabPillProps {\n id: WidgetTab;\n label: string;\n isActive: boolean;\n onClick: () => void;\n icon: React.ReactNode;\n parentHandlers?: ReturnType<typeof useIconHover>[\"parentHandlers\"];\n /** Unread-count badge on the icon. 0 hides it; >99 caps to \"99+\". */\n badgeCount?: number;\n}\n\nfunction TabPill({\n id: _id,\n label,\n isActive,\n onClick,\n icon,\n parentHandlers,\n badgeCount = 0,\n}: TabPillProps) {\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n onClick={onClick}\n {...parentHandlers}\n className={cn(\n \"relative z-10 flex items-center justify-center gap-1.5 rounded-full px-3 py-2\",\n \"transition-colors duration-150\",\n // Active pill grows to fit its label; inactive pills hug the icon\n // and share the leftover space evenly so the bar stays balanced.\n isActive ? \"flex-[2_2_0%] text-wx-fg\" : \"flex-1 text-wx-fg-muted hover:text-wx-fg\",\n )}\n >\n {isActive && (\n <motion.span\n layoutId=\"bottom-nav-pill\"\n className=\"absolute inset-0 -z-10 rounded-full bg-wx-bg shadow-[0_2px_8px_rgba(0,0,0,0.08)]\"\n transition={{ type: \"spring\", stiffness: 420, damping: 36 }}\n />\n )}\n {/* `inline-flex` (not `flex`) so the wrapper hugs the icon — otherwise\n it's a full-width block and the badge anchors to the button edge,\n detached from the icon. */}\n <span className=\"relative inline-flex shrink-0 items-center justify-center\">\n {icon}\n <UnreadBadge count={badgeCount} size=\"sm\" className=\"absolute -top-1.5 -right-2 z-20\" />\n </span>\n <motion.span\n animate={{\n width: isActive ? \"auto\" : 0,\n opacity: isActive ? 1 : 0,\n marginLeft: isActive ? 0 : -4,\n }}\n initial={false}\n transition={{ duration: 0.2, ease: \"easeOut\" }}\n className=\"overflow-hidden text-[11px] font-semibold tracking-tight whitespace-nowrap\"\n >\n {label}\n </motion.span>\n </button>\n );\n}\n\n/**\n * Variant for static lucide-react icons. Uses a `useAnimation`\n * controls handle + parent `whileHover` to drive a small\n * rotate/scale pulse on the icon, giving feature parity with the\n * lucide-animated ones until the package ships matching glyphs.\n */\nfunction StaticIconTabPill({\n id: _id,\n label,\n isActive,\n onClick,\n Icon,\n}: {\n id: WidgetTab;\n label: string;\n isActive: boolean;\n onClick: () => void;\n Icon: LucideIcon;\n}) {\n const controls = useAnimation();\n useEffect(() => {\n if (isActive) controls.start({ scale: [1, 1.15, 1] });\n }, [isActive, controls]);\n\n return (\n <motion.button\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n onClick={onClick}\n onHoverStart={() => controls.start({ rotate: [0, -10, 10, 0] })}\n className={cn(\n \"relative z-10 flex items-center justify-center gap-1.5 rounded-full px-3 py-2\",\n \"transition-colors duration-150\",\n // Active pill grows to fit its label; inactive pills hug the icon\n // and share the leftover space evenly so the bar stays balanced.\n isActive ? \"flex-[2_2_0%] text-wx-fg\" : \"flex-1 text-wx-fg-muted hover:text-wx-fg\",\n )}\n >\n {isActive && (\n <motion.span\n layoutId=\"bottom-nav-pill\"\n className=\"absolute inset-0 -z-10 rounded-full bg-wx-bg shadow-[0_2px_8px_rgba(0,0,0,0.08)]\"\n transition={{ type: \"spring\", stiffness: 420, damping: 36 }}\n />\n )}\n <motion.span animate={controls} transition={{ duration: 0.4 }}>\n <Icon size={16} strokeWidth={isActive ? 2.2 : 1.8} />\n </motion.span>\n <motion.span\n animate={{\n width: isActive ? \"auto\" : 0,\n opacity: isActive ? 1 : 0,\n marginLeft: isActive ? 0 : -4,\n }}\n initial={false}\n transition={{ duration: 0.2, ease: \"easeOut\" }}\n className=\"overflow-hidden text-[11px] font-semibold tracking-tight whitespace-nowrap\"\n >\n {label}\n </motion.span>\n </motion.button>\n );\n}\n\nfunction featureFor(id: WidgetTab, features: WidgetFeatures): boolean {\n if (id === \"home\") return features.home;\n if (id === \"messages\") return features.messenger;\n if (id === \"help\") return features.help;\n if (id === \"news\") return features.news;\n return !!features.profile;\n}\n","\"use client\";\n\nimport { motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { cn } from \"@/lib/utils\";\n\ninterface BrandingFooterProps {\n className?: string;\n}\n\n/**\n * \"Powered by Wexio\" badge. Tiny, no border, slides up from below\n * with a fade on first paint.\n *\n * **Inline placement** (not absolute) — earlier iterations used\n * absolute positioning so the badge floated over content, but on\n * the Messages tab that hid the composer's bottom edge. Inline\n * means it reserves a small line of layout space at the bottom of\n * the panel, sitting under the bottom nav (list routes) or under\n * the composer (drill-in routes). The motion entry preserves the\n * \"fade up from below\" feel without the overlap.\n *\n * Paid white-label plans hide the badge entirely\n * (`config.branding.hidden`), checked at the shell level — this\n * component just renders.\n */\nexport function BrandingFooter({ className }: BrandingFooterProps) {\n const t = useTranslations(\"branding\");\n return (\n <motion.div\n initial={{ opacity: 0, y: 8 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ duration: 0.32, delay: 0.15, ease: \"easeOut\" }}\n className={cn(\n \"flex items-center justify-center gap-1 bg-wx-bg px-4 py-1.5 text-[10px] font-medium text-wx-fg-subtle\",\n className,\n )}\n >\n <span>{t(\"poweredBy\")}</span>\n <a\n href=\"https://wexio.io?ref=widget\"\n target=\"_blank\"\n rel=\"noopener\"\n className=\"font-semibold text-wx-fg-muted transition-colors hover:text-wx-fg\"\n >\n {t(\"wexio\")}\n </a>\n </motion.div>\n );\n}\n","\"use client\";\n\nimport { Volume2, VolumeX } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport { Button } from \"@/components/ui/button\";\nimport { Icon } from \"@/components/ui/icon\";\n\ninterface SoundToggleProps {\n muted: boolean;\n onToggle: () => void;\n}\n\n/**\n * Mute/unmute affordance — sits in the header next to the close\n * button. Visitor-level preference is persisted by `useSoundPlayer`\n * to `localStorage` so the choice survives reloads + new tabs.\n *\n * Icon swaps between `Volume2` (audible) and `VolumeX` (muted) so the\n * current state reads at a glance. aria-label flips with state for\n * screen readers.\n */\nexport function SoundToggle({ muted, onToggle }: SoundToggleProps) {\n const t = useTranslations(\"sound\");\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={muted ? t(\"unmute\") : t(\"mute\")}\n onClick={onToggle}\n >\n <Icon icon={muted ? VolumeX : Volume2} size={18} />\n </Button>\n );\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n ArrowLeftIcon,\n type ArrowLeftIconHandle,\n XIcon,\n type XIconHandle,\n} from \"@/components/widget/icons/animated\";\nimport { useIconHover } from \"@/lib/use-icon-hover\";\nimport { cn } from \"@/lib/utils\";\nimport { SoundToggle } from \"./sound-toggle\";\n\ninterface ConversationHeaderProps {\n title: string;\n subtitle?: string;\n organizationLogoUrl?: string | null;\n muted: boolean;\n onToggleMute: () => void;\n /** Omit when there's nowhere to go back to (Messages is the only\n * enabled tab) — the back button hides entirely so the visitor\n * doesn't see a dead control. */\n onBack?: () => void;\n onClose: () => void;\n /** Expand toggle — present only on routes where the widget can\n * widen (messages, single article). Omitting it hides the chip. */\n expanded?: boolean;\n onToggleExpand?: () => void;\n}\n\n/**\n * Sticky conversation header for the Messages tab. Back arrow + Wexio\n * mark + sender name & subtitle + close button. Replaces the generic\n * widget chrome while the visitor is in a conversation.\n *\n * Both animated icons (`ArrowLeftIcon`, `XIcon`) animate on the\n * parent button's hover — `useIconHover` propagates the hover signal\n * via ref handles so visitors see motion when they hover a tap\n * target, not when they happen to land on the SVG itself.\n */\nexport function ConversationHeader({\n title,\n subtitle,\n organizationLogoUrl,\n muted,\n onToggleMute,\n onBack,\n onClose,\n expanded,\n onToggleExpand,\n}: ConversationHeaderProps) {\n const t = useTranslations(\"header\");\n const tHeader = useTranslations(\"header\");\n const back = useIconHover<ArrowLeftIconHandle>();\n const close = useIconHover<XIconHandle>();\n\n return (\n <header className={cn(\"flex items-center gap-3 border-b border-wx-border bg-wx-bg px-3 py-3\")}>\n {onBack && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={t(\"back\")}\n onClick={onBack}\n className=\"shrink-0\"\n {...back.parentHandlers}\n >\n <ArrowLeftIcon ref={back.iconRef} size={18} />\n </Button>\n )}\n {organizationLogoUrl && (\n <span className=\"h-9 w-9 shrink-0 overflow-hidden rounded-full\">\n {/* biome-ignore lint/performance/noImgElement: uploaded image of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img src={organizationLogoUrl} alt={title} className=\"h-full w-full object-cover\" />\n </span>\n )}\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-semibold text-wx-fg\">{title}</p>\n {subtitle && <p className=\"truncate text-xs text-wx-fg-muted\">{subtitle}</p>}\n </div>\n <SoundToggle muted={muted} onToggle={onToggleMute} />\n {onToggleExpand && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={expanded ? tHeader(\"collapse\") : tHeader(\"expand\")}\n onClick={onToggleExpand}\n className=\"shrink-0\"\n >\n <ExpandGlyph expanded={!!expanded} />\n </Button>\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={t(\"close\")}\n onClick={onClose}\n className=\"shrink-0\"\n {...close.parentHandlers}\n >\n <XIcon ref={close.iconRef} size={18} />\n </Button>\n </header>\n );\n}\n\n/**\n * Inline Maximize2 / Minimize2 — keeps `ConversationHeader`'s import\n * list tight without pulling another file. Lucide-react ships these\n * as plain SVG components.\n */\nfunction ExpandGlyph({ expanded }: { expanded: boolean }) {\n if (expanded) {\n return (\n // Minimize2\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"4 14 10 14 10 20\" />\n <polyline points=\"20 10 14 10 14 4\" />\n <line x1=\"14\" y1=\"10\" x2=\"21\" y2=\"3\" />\n <line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\" />\n </svg>\n );\n }\n return (\n // Maximize2\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"15 3 21 3 21 9\" />\n <polyline points=\"9 21 3 21 3 15\" />\n <line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\" />\n <line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\" />\n </svg>\n );\n}\n","\"use client\";\n\nimport { NextIntlClientProvider, useLocale, useMessages } from \"next-intl\";\nimport { type ReactNode, useEffect, useState } from \"react\";\nimport { useWidgetConfig } from \"@/lib/use-widget-config\";\n\n/**\n * Demo content lives in separate `messages/demo.{locale}.json` files\n * that are **not** in the always-loaded i18n bundle — production\n * visitors never download them. This wrapper dynamically imports the\n * demo namespace and merges it into the next-intl provider ONLY when\n * the widget runs in demo mode (`isDummy` — the operator dashboard\n * preview / marketing site). In live mode the demo builders are never\n * called, so the namespace isn't needed and nothing extra is fetched.\n */\nexport function DemoMessages({ children }: { children: ReactNode }) {\n const { isDummy } = useWidgetConfig();\n const locale = useLocale();\n const base = useMessages();\n // A caller may already supply the demo namespace (tests, or an SSR\n // path that pre-merged it) — then there's nothing to fetch.\n const baseHasDemo = \"demo\" in (base as Record<string, unknown>);\n const [demo, setDemo] = useState<Record<string, unknown> | null>(null);\n\n useEffect(() => {\n if (!isDummy || baseHasDemo) return;\n let active = true;\n loadDemoMessages(locale).then((m) => {\n if (active) setDemo(m);\n });\n return () => {\n active = false;\n };\n }, [isDummy, baseHasDemo, locale]);\n\n // Live / production, or the namespace is already present — pass\n // through with the lean bundle (no extra fetch).\n if (!isDummy || baseHasDemo) return <>{children}</>;\n // Demo mode, but the lazily-imported namespace hasn't landed yet —\n // hold the tree so builders never read missing keys (e.g. the\n // messages tab seeds its conversation once on mount).\n if (!demo) return null;\n return (\n <NextIntlClientProvider locale={locale} messages={{ ...base, demo }}>\n {children}\n </NextIntlClientProvider>\n );\n}\n\n/** Per-locale dynamic import so each demo bundle is its own chunk,\n * fetched on demand. Unknown locales fall back to English. */\nasync function loadDemoMessages(locale: string): Promise<Record<string, unknown>> {\n switch (locale) {\n case \"uk\":\n return (await import(\"@/messages/demo.uk.json\")).default;\n default:\n return (await import(\"@/messages/demo.en.json\")).default;\n }\n}\n","\"use client\";\n\nimport { ChevronRight } from \"lucide-react\";\nimport { motion } from \"motion/react\";\nimport { AuthorAvatars, type AuthorChip } from \"@/components/widget/author-avatars\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * What this row represents. Drives typography differences — no leading\n * icons (they added clutter and we don't need them when the type\n * differences are visible in weight + density alone).\n *\n * - `folder`: bold title, regular description, small meta line for\n * the article count → reads as a navigational header.\n * - `article`: regular-weight title, lighter description, no meta\n * line → reads as a list item.\n * - `none`: same as folder (default for the root collections list).\n */\nexport type HelpListRowKind = \"folder\" | \"article\" | \"none\";\n\n/**\n * Full-width, divider-separated row used by the Help tab and category\n * drill-in views. Intercom-style list — folder rows render bold with\n * a description + count meta; article rows render lighter and more\n * compact (regular-weight title, smaller description), so a mixed\n * list scans naturally as \"headings > items\" without needing icons.\n *\n * Hover background extends edge-to-edge (no horizontal padding around\n * the button itself) so the visitor's tap target matches the\n * highlight; the inner padding lives on the row's flex container.\n */\nexport function HelpListRow({\n title,\n description,\n meta,\n authors,\n onClick,\n kind = \"none\",\n delay = 0,\n}: {\n title: string;\n description?: string | null;\n /** Small grey line under the description — used for \"Articles: 33\"\n * on collection / subfolder rows. Renders nothing when omitted.\n * Article rows intentionally don't pass it. */\n meta?: string;\n /** Up to a few author avatars on the right. Renders before the\n * chevron when present. */\n authors?: AuthorChip[];\n onClick: () => void;\n kind?: HelpListRowKind;\n delay?: number;\n}) {\n const isArticle = kind === \"article\";\n return (\n <motion.button\n type=\"button\"\n onClick={onClick}\n initial={{ opacity: 0, y: 4 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ duration: 0.18, delay }}\n className={cn(\n \"group flex w-full items-center gap-3 border-wx-border border-b text-left transition-colors\",\n \"hover:bg-wx-bg-elevated/60\",\n \"last:border-b-0\",\n // Article rows are visually denser — tighter vertical rhythm\n // reinforces \"list item\" vs. the folder rows' \"section heading\"\n // feel.\n isArticle ? \"px-5 py-3\" : \"px-5 py-3.5\",\n )}\n >\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span\n className={cn(\n \"text-wx-fg\",\n // Folders / collections read as navigation: bold title at\n // the standard small body size. Articles read as content\n // rows: lighter weight, same size, looks list-y.\n isArticle ? \"font-normal text-sm\" : \"font-semibold text-sm\",\n )}\n >\n {title}\n </span>\n {description && (\n <span\n className={cn(\n \"leading-snug\",\n // Article excerpts are deliberately dimmer + smaller so\n // the whole row reads as a single \"item\" with quiet\n // supporting text; folder descriptions stay at body size\n // so the section header still has weight.\n isArticle ? \"truncate text-[11px] text-wx-fg-subtle\" : \"text-wx-fg-muted text-xs\",\n )}\n >\n {description}\n </span>\n )}\n {meta && <span className=\"text-[11px] text-wx-fg-subtle\">{meta}</span>}\n </span>\n <span className=\"flex shrink-0 items-center gap-2 text-wx-fg-muted\">\n {authors && authors.length > 0 && <AuthorAvatars authors={authors} />}\n <ChevronRight\n size={16}\n className=\"transition-transform group-hover:translate-x-0.5\"\n aria-hidden=\"true\"\n />\n </span>\n </motion.button>\n );\n}\n","\"use client\";\n\nimport { motion } from \"motion/react\";\nimport { useLocale, useTranslations } from \"next-intl\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { Card, CardBody } from \"@/components/ui/card\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { AuthorAvatars, type AuthorChip, toAuthorChips } from \"@/components/widget/author-avatars\";\nimport { HelpListRow } from \"@/components/widget/help-list-row\";\nimport { StickySearchHeader } from \"@/components/widget/sticky-search-header\";\nimport { getMockHelpArticles, getMockHelpCategories } from \"@/dummy\";\nimport {\n useVisitorHelpFoldersQuery,\n useVisitorHelpListQuery,\n} from \"@/lib/graphql/queries/generated/help.generated\";\n\nconst PAGE_SIZE = 10;\nconst LOAD_MORE_THRESHOLD = 240;\n/** How many distinct author avatars stack in the folder header.\n * Anything past this rolls into the \"and N more\" copy. */\nconst HEADER_AUTHOR_LIMIT = 3;\n\ninterface HelpCategoryViewProps {\n /** Folder id (legacy prop name — folders replaced categories on BE,\n * the visitor-surface concept is the same). */\n categoryId: string;\n /** Folder display metadata threaded down from the route so the\n * header renders without a per-folder BE fetch. Optional — when\n * the visitor deep-links into a category the header silently\n * degrades to just the list. */\n categoryName?: string;\n categoryDescription?: string;\n categoryArticleCount?: number;\n isDummy: boolean;\n /** Drill into a subfolder — the shell re-routes to a new\n * `help-category` view targeting that folder. */\n onOpenCategory: (\n categoryId: string,\n meta?: { name?: string; description?: string; articleCount?: number },\n ) => void;\n onOpenArticle: (slug: string) => void;\n}\n\n/**\n * Folder drill-in view (Intercom-style help center). Sticky search at\n * the top, an Intercom-style header card (folder name, description,\n * article count, author byline + avatar stack), then a divider-\n * separated list of subfolders + articles. The visitor can keep\n * drilling: tapping a subfolder routes to another `help-category`\n * view; tapping an article opens the detail.\n *\n * `recursive: false` so articles + subfolders stay in sync — if the\n * recursive flag were on, articles deep in the subtree would render\n * alongside subfolder tiles and the hierarchy collapses visually.\n *\n * Search uses the same `visitorHelpList` consolidated query (just\n * pass `query`); search is global, jumps the visitor out of the\n * folder context until they clear the input.\n *\n * Pagination: `visitorHelpList` returns `{ items, meta }`; we\n * fetchMore with `offset` on bottom-scroll. Same pattern as News.\n */\nexport function HelpCategoryView({\n categoryId,\n categoryName,\n categoryDescription,\n categoryArticleCount,\n isDummy,\n onOpenCategory,\n onOpenArticle,\n}: HelpCategoryViewProps) {\n const t = useTranslations(\"help\");\n const tDemo = useTranslations(\"demo\");\n const locale = useLocale();\n const [query, setQuery] = useState(\"\");\n const debounced = useDebounced(query, 300);\n const isSearching = debounced.length >= 2;\n\n // ─── Subfolders (direct children) ─────────────────────────────\n const { data: subfolderData } = useVisitorHelpFoldersQuery({\n variables: { parentId: categoryId, locale },\n skip: isDummy,\n });\n const subfolders = useMemo(() => subfolderData?.visitorHelpFolders ?? [], [subfolderData]);\n\n // ─── Articles (this folder only, paginated) ───────────────────\n const {\n data: articlesData,\n loading: articlesLoading,\n fetchMore,\n } = useVisitorHelpListQuery({\n variables: {\n args: {\n folderId: categoryId,\n locale,\n recursive: false,\n limit: PAGE_SIZE,\n offset: 0,\n },\n },\n skip: isDummy,\n notifyOnNetworkStatusChange: true,\n });\n\n // ─── Search (consolidated list query with `query` arg) ────────\n const { data: searchData, loading: searchLoading } = useVisitorHelpListQuery({\n variables: { args: { query: debounced, locale, limit: 10 } },\n skip: debounced.length < 2 || isDummy,\n });\n\n const mockCategory = isDummy\n ? getMockHelpCategories(tDemo).find((c) => c.id === categoryId)\n : null;\n const mockArticles = isDummy\n ? getMockHelpArticles(tDemo).filter((a) => a.categoryId === categoryId)\n : [];\n\n const articles: ArticleRowData[] = isDummy\n ? mockArticles.map((a) => ({\n id: a.id,\n slug: a.slug,\n title: a.title,\n excerpt: a.excerpt as string | null,\n authors: toAuthorChips((a as { authors?: unknown }).authors),\n reactionCounts: null,\n }))\n : (articlesData?.visitorHelpList.items ?? []).map((a) => ({\n id: a._id,\n slug: a.slug,\n title: a.title,\n excerpt: a.excerpt ?? null,\n authors: toAuthorChips(a.authors),\n reactionCounts: (a.reactionCounts as Record<string, number> | null | undefined) ?? null,\n }));\n\n const dummySearchResults: ArticleRowData[] = isDummy\n ? getMockHelpArticles(tDemo)\n .filter(\n (a) =>\n a.title.toLowerCase().includes(debounced.toLowerCase()) ||\n a.excerpt.toLowerCase().includes(debounced.toLowerCase()),\n )\n .map((a) => ({\n id: a.id,\n slug: a.slug,\n title: a.title,\n excerpt: a.excerpt as string | null,\n authors: toAuthorChips((a as { authors?: unknown }).authors),\n reactionCounts: null,\n }))\n : [];\n const realSearchResults: ArticleRowData[] = (searchData?.visitorHelpList.items ?? []).map(\n (r) => ({\n id: r._id,\n slug: r.slug,\n title: r.title,\n excerpt: r.excerpt ?? null,\n authors: toAuthorChips(r.authors),\n reactionCounts: (r.reactionCounts as Record<string, number> | null | undefined) ?? null,\n }),\n );\n const searchResults = isDummy ? dummySearchResults : realSearchResults;\n\n const list = isSearching ? searchResults : articles;\n\n // ─── Resolve header metadata — route prop > demo mock > nothing.\n const headerTitle = categoryName ?? mockCategory?.title ?? \"\";\n const headerDescription = categoryDescription ?? mockCategory?.description ?? \"\";\n const headerArticleCount = categoryArticleCount ?? mockCategory?.articleCount ?? articles.length;\n // Author byline = dedupe authors across the articles in this\n // folder. Mirrors the Intercom header where you see who's behind\n // the collection. Limited to the first few unique chips.\n const headerAuthors = useMemo(() => {\n const seen = new Map<string, AuthorChip>();\n for (const a of articles) {\n for (const author of a.authors ?? []) {\n if (!seen.has(author.id)) seen.set(author.id, author);\n }\n }\n return Array.from(seen.values());\n }, [articles]);\n const displayedAuthors = headerAuthors.slice(0, HEADER_AUTHOR_LIMIT);\n const remainingAuthors = Math.max(0, headerAuthors.length - displayedAuthors.length);\n const firstAuthorName = displayedAuthors[0]?.name ?? \"\";\n\n // ─── Load-more ────────────────────────────────────────────────\n const hasMore =\n !isSearching && !isDummy && (articlesData?.visitorHelpList.meta.hasNextPage ?? false);\n\n const [loadingMore, setLoadingMore] = useState(false);\n const loadMore = useCallback(async () => {\n if (!hasMore || loadingMore) return;\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: {\n args: {\n folderId: categoryId,\n locale,\n recursive: false,\n limit: PAGE_SIZE,\n offset: articlesData?.visitorHelpList.items.length ?? 0,\n },\n },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n ...prev,\n visitorHelpList: {\n ...fetchMoreResult.visitorHelpList,\n items: [...prev.visitorHelpList.items, ...fetchMoreResult.visitorHelpList.items],\n },\n };\n },\n });\n } finally {\n setLoadingMore(false);\n }\n }, [hasMore, loadingMore, categoryId, locale, fetchMore, articlesData]);\n\n const handleScroll = useCallback(\n (e: React.UIEvent<HTMLDivElement>) => {\n const el = e.currentTarget;\n const remaining = el.scrollHeight - el.clientHeight - el.scrollTop;\n if (remaining < LOAD_MORE_THRESHOLD) void loadMore();\n },\n [loadMore],\n );\n\n const firstLoad =\n !isDummy && !isSearching && articlesLoading && articles.length === 0 && subfolders.length === 0;\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n <ScrollArea className=\"min-h-0 flex-1\" onScroll={handleScroll}>\n <StickySearchHeader\n value={query}\n onChange={setQuery}\n placeholder={t(\"searchPlaceholder\")}\n />\n\n {!isSearching && headerTitle && (\n <motion.div\n initial={{ opacity: 0, y: 4 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ duration: 0.2 }}\n className=\"border-wx-border border-b px-5 py-5\"\n >\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">\n <h2 className=\"font-semibold text-lg text-wx-fg\">{headerTitle}</h2>\n {headerDescription && (\n <p className=\"text-sm text-wx-fg-muted leading-snug\">{headerDescription}</p>\n )}\n <div className=\"mt-1 flex flex-col gap-0.5 text-wx-fg-subtle text-xs\">\n <span>{t(\"articlesCount\", { count: headerArticleCount })}</span>\n {firstAuthorName && (\n <span>\n {t(\"authorsByline\", {\n first: firstAuthorName,\n remaining: remainingAuthors,\n })}\n </span>\n )}\n </div>\n </div>\n {displayedAuthors.length > 0 && (\n <div className=\"shrink-0\">\n <AuthorAvatars authors={displayedAuthors} />\n </div>\n )}\n </div>\n </motion.div>\n )}\n\n {/* Articles FIRST, subfolders SECOND, all in ONE container so\n the `border-b last:border-b-0` rule on `HelpListRow` only\n suppresses the very last row of the combined list — keeps\n the divider between the last article and the first\n subfolder. Splitting into two containers made the rule fire\n at the end of EACH list and the seam between sections\n dropped. */}\n {firstLoad ? (\n <ListSkeleton />\n ) : list.length === 0 && subfolders.length === 0 ? (\n <div className=\"px-5 py-6\">\n <Card>\n <CardBody className=\"py-8 text-center\">\n <p className=\"text-sm text-wx-fg-muted\">\n {isSearching ? t(\"noResults\") : t(\"emptyTitle\")}\n </p>\n </CardBody>\n </Card>\n </div>\n ) : (\n <div className=\"flex flex-col\">\n {list.map((a, idx) => (\n <HelpListRow\n key={a.id}\n title={a.title}\n description={a.excerpt}\n authors={a.authors}\n kind=\"article\"\n onClick={() => onOpenArticle(a.slug)}\n delay={Math.min(idx, PAGE_SIZE) * 0.03}\n />\n ))}\n {!isSearching &&\n subfolders.map((f, idx) => (\n <HelpListRow\n key={f._id}\n title={f.name}\n description={f.description}\n meta={\n (f.articleCount ?? 0) > 0\n ? t(\"articlesCount\", { count: f.articleCount ?? 0 })\n : undefined\n }\n kind=\"folder\"\n onClick={() =>\n onOpenCategory(f._id, {\n name: f.name,\n description: f.description ?? undefined,\n articleCount: f.articleCount ?? 0,\n })\n }\n delay={(list.length + idx) * 0.03}\n />\n ))}\n {(loadingMore || searchLoading) && (\n <div className=\"flex justify-center py-3\">\n <Skeleton className=\"h-3 w-24\" />\n </div>\n )}\n </div>\n )}\n </ScrollArea>\n </div>\n );\n}\n\ninterface ArticleRowData {\n id: string;\n slug: string;\n title: string;\n excerpt: string | null;\n authors?: AuthorChip[];\n reactionCounts?: Record<string, number> | null;\n}\n\nfunction ListSkeleton() {\n return (\n <div className=\"flex flex-col\">\n {Array.from({ length: 3 }).map((_, idx) => (\n <div\n // biome-ignore lint/suspicious/noArrayIndexKey: static placeholder list\n key={idx}\n className=\"flex items-center gap-3 border-wx-border border-b px-5 py-4 last:border-b-0\"\n >\n <div className=\"flex min-w-0 flex-1 flex-col gap-2\">\n <Skeleton className=\"h-4 w-32 rounded\" />\n <Skeleton className=\"h-3 w-56 rounded\" />\n </div>\n <Skeleton className=\"h-4 w-4 rounded\" />\n </div>\n ))}\n </div>\n );\n}\n\nfunction useDebounced<T>(value: T, ms: number): T {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const id = setTimeout(() => setDebounced(value), ms);\n return () => clearTimeout(id);\n }, [value, ms]);\n return debounced;\n}\n","/**\n * Collapse a (potentially TipTap-authored) HTML string down to plain\n * text suitable for preview chips — launcher peek, recent-message\n * block, browser tab title. Decodes entities and normalises whitespace.\n *\n * Not a sanitizer. Don't use this to defang untrusted HTML for\n * display; the BE-side sanitiser owns that. This helper exists\n * because peek surfaces sit inside `<button>` elements, where\n * rendering block-level HTML (`<p>`, `<ul>`, `<figure>`, …) yields\n * invalid markup. Stripping to a single line keeps the markup valid\n * and the preview readable.\n */\nexport function stripHtml(input: string | null | undefined): string {\n if (!input) return \"\";\n // Quick path — no tag opener present, nothing to strip.\n if (!/[<&]/.test(input)) return input;\n if (typeof document !== \"undefined\") {\n const el = document.createElement(\"div\");\n el.innerHTML = input;\n return (el.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n }\n // SSR / build-time fallback — coarse regex sweep. The widget runs\n // client-only, but `next build` evaluates the module graph during\n // prerender so we avoid throwing on `document`.\n return input\n .replace(/<[^>]*>/g, \"\")\n .replace(/&nbsp;/g, \" \")\n .replace(/&amp;/g, \"&\")\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&quot;/g, '\"')\n .replace(/&#39;/g, \"'\")\n .replace(/\\s+/g, \" \")\n .trim();\n}\n","\"use client\";\n\nimport { X } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { AI_ASSISTANT_NAME } from \"@/lib/ai-assistant\";\nimport { stripHtml } from \"@/lib/strip-html\";\nimport type { UnreadPeekMessage } from \"@/lib/use-visitor-unread\";\nimport { useWidgetConfig } from \"@/lib/use-widget-config\";\nimport { cn } from \"@/lib/utils\";\n\ninterface LauncherPeekProps {\n message: UnreadPeekMessage | null;\n /** Visitor tapped the body of the peek → open the panel directly\n * on the Messages tab. */\n onOpen: () => void;\n /** Visitor dismissed the peek (X chip). Doesn't mark read — just\n * hides until the next inbound. */\n onDismiss: () => void;\n /** Visitor tapped a quick-reply button. The shell sends the\n * payload as a visitor message, then opens the panel so the\n * visitor sees the conversation. */\n onSendButton: (payload: string, text: string) => void;\n /** Which corner the launcher + panel anchor to — the peek pins to\n * the SAME side. Defaults to `\"right\"`. */\n position?: \"left\" | \"right\";\n /** Anchor to the host `<div>` (`absolute`) instead of the viewport\n * (`fixed`). Set by the React-component embed — see `WidgetEnv.embedded`. */\n embedded?: boolean;\n}\n\n/**\n * Floating preview pinned above the closed launcher FAB — surfaces\n * the latest unread operator message so visitors can read & quick-\n * reply without opening the panel.\n *\n * **Composition** is two stacked surfaces (per Day-12 design pass):\n *\n * 1. **Text bubble** — message body, dismiss X. Tapping the body\n * opens the panel on Messages. No avatar, no sender label —\n * visitors recognise messages from the FAB context.\n *\n * 2. **Quick-reply chips** — each chip is its own pill, stacked\n * vertically below the text bubble (NOT inside it). Tap →\n * send the payload as the visitor's reply + open the panel.\n *\n * **Layout**: anchored bottom-right above the launcher, max-width\n * 300. Stacked block lets the buttons read as discrete tap targets\n * rather than a chip row crammed into the bubble.\n */\nexport function LauncherPeek({\n message,\n onOpen,\n onDismiss,\n onSendButton,\n position = \"right\",\n embedded = false,\n}: LauncherPeekProps) {\n const t = useTranslations(\"peek\");\n const onLeft = position === \"left\";\n return (\n <AnimatePresence>\n {message && (\n <motion.div\n key={message.id}\n // Bouncy pop-in from lower + smaller so the peek \"springs up\" from\n // the launcher rather than just fading; low damping = a little\n // overshoot.\n initial={{ opacity: 0, y: 18, scale: 0.88 }}\n animate={{ opacity: 1, y: 0, scale: 1 }}\n exit={{ opacity: 0, y: 8, scale: 0.96 }}\n transition={{ type: \"spring\", stiffness: 440, damping: 20 }}\n className={cn(\n \"bottom-24 z-40 flex w-[300px] flex-col gap-2\",\n embedded ? \"absolute\" : \"fixed\",\n onLeft ? \"left-4\" : \"right-4\",\n )}\n role=\"dialog\"\n aria-label={t(\"newMessage\")}\n >\n {/* Text bubble — message body + dismiss. Tap the body to\n open the panel; X dismisses without marking read.\n TipTap operator content arrives as HTML; the peek isn't\n the right surface for block rendering (it sits inside a\n `<button>`), so we collapse to a plain-text preview. */}\n {message.text && (\n // Lifts on hover to signal it's tappable (opens the panel).\n <motion.div\n whileHover={{ y: -3 }}\n transition={{ type: \"spring\", stiffness: 400, damping: 24 }}\n className={cn(\n \"relative rounded-wx-lg border border-wx-border bg-wx-bg\",\n \"p-4 pr-9 text-wx-fg\",\n \"shadow-[0_16px_40px_rgba(0,0,0,0.16)]\",\n )}\n >\n <button\n type=\"button\"\n onClick={onDismiss}\n aria-label={t(\"dismiss\")}\n className={cn(\n \"absolute top-2 right-2 flex h-6 w-6 items-center justify-center rounded-full\",\n \"text-wx-fg-muted transition-colors hover:bg-wx-bg-elevated hover:text-wx-fg\",\n )}\n >\n <X size={12} />\n </button>\n <button\n type=\"button\"\n onClick={onOpen}\n className={cn(\"block w-full text-left\", \"transition-opacity hover:opacity-90\")}\n >\n <PeekSender sender={message.sender} />\n <span\n className={cn(\n \"mt-1.5 block text-sm leading-relaxed\",\n \"wrap-anywhere\",\n // Cap very long operator messages in the peek — it's a\n // preview, not the full thread. Truncates with an ellipsis\n // after 10 lines; tapping opens the panel to read it all.\n \"line-clamp-10\",\n )}\n >\n {stripHtml(message.text)}\n </span>\n </button>\n </motion.div>\n )}\n\n {/* Quick-reply chips — discrete cards stacked below the\n text bubble. Each is its own tap target with the same\n brand-styled pill we use under chat bubbles. */}\n {message.buttons.length > 0 && (\n <div className={cn(\"flex flex-col gap-1.5\", onLeft ? \"items-start\" : \"items-end\")}>\n {message.buttons.map((btn) => (\n <motion.button\n key={btn.payload}\n type=\"button\"\n onClick={() => onSendButton(btn.payload, btn.text)}\n whileHover={{ y: -1 }}\n whileTap={{ scale: 0.96 }}\n transition={{ type: \"spring\", stiffness: 480, damping: 26 }}\n className={cn(\n // Idle: clean `wx-bg` surface (matches the\n // outgoing-side message bubbles) lifted by a\n // soft shadow so it reads as a tap target.\n // Hover: fills with full brand → text inverts\n // to the primary foreground.\n \"max-w-full rounded-full bg-wx-bg px-3.5 py-2 text-sm font-medium text-wx-primary\",\n \"transition-colors hover:bg-wx-primary hover:text-wx-primary-fg\",\n \"shadow-[0_4px_12px_rgba(0,0,0,0.08)]\",\n )}\n >\n {btn.text}\n </motion.button>\n ))}\n </div>\n )}\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n\n/**\n * Sender header rendered above the peek preview text — avatar +\n * display name + role suffix (when no name is configured). Mirrors\n * the bubble attribution inside the conversation so visitors see who\n * pinged them before they tap to open. Falls back to a neutral\n * monogram if the operator hasn't uploaded an avatar.\n */\nfunction PeekSender({ sender }: { sender: UnreadPeekMessage[\"sender\"] }) {\n const { config } = useWidgetConfig();\n const t = useTranslations(\"peek\");\n const isGaia = sender.kind === \"ai\" || sender.kind === \"bot\";\n // AI / bot ALWAYS reads as AI_ASSISTANT_NAME regardless of what label the BE\n // attached (\"Bot\", \"WEB widget\", an internal handle, …). Matches\n // the in-thread bubble + typing indicator so visitors see one\n // consistent assistant identity. Operator names flow through;\n // empty operator name falls back to the role label.\n const displayName = isGaia ? AI_ASSISTANT_NAME : (sender.name?.trim() ?? \"\");\n const roleLabel = displayName ? null : sender.kind === \"operator\" ? t(\"operator\") : null;\n const aiAvatarUrl = config.messenger?.aiAssistantAvatar ?? null;\n return (\n <span className=\"flex items-center gap-2 text-xs\">\n {isGaia ? (\n // Operator-configured AI assistant avatar wins. When unset, we\n // render no avatar at all (matches the in-thread bubble's\n // explicit-opt-in behaviour — no Wexio brand-mark fallback so\n // the AI doesn't visually advertise the host product).\n aiAvatarUrl ? (\n <span\n role=\"img\"\n aria-label={t(\"aiAssistant\")}\n className=\"relative flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-full bg-wx-bg-elevated shadow-sm\"\n >\n {/* biome-ignore lint/performance/noImgElement: uploaded image of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img\n src={aiAvatarUrl}\n alt=\"\"\n className=\"h-full w-full object-cover\"\n loading=\"eager\"\n decoding=\"async\"\n />\n </span>\n ) : null\n ) : sender.avatar ? (\n // biome-ignore lint/performance/noImgElement: uploaded image of arbitrary host/dimensions; next/image needs known sizes + an allowlist\n <img\n src={sender.avatar}\n alt={displayName || roleLabel || \"\"}\n className=\"h-5 w-5 shrink-0 rounded-full object-cover\"\n />\n ) : (\n <span\n className={cn(\n \"flex h-5 w-5 shrink-0 items-center justify-center rounded-full\",\n \"bg-wx-bg-elevated text-[9px] font-semibold text-wx-fg-muted\",\n )}\n >\n {/* Operator monogram — prefer initials from the operator's\n own name (\"RL\" for \"Ralph J. Lesperance\") over a\n generic role-label first letter. Same logic the message\n bubble's BotAvatar uses, so the peek and the\n in-thread avatar stay visually identical. */}\n {peekInitialsOf(displayName || roleLabel || \"\")}\n </span>\n )}\n <span className=\"font-medium text-wx-fg-muted\">{displayName || roleLabel}</span>\n </span>\n );\n}\n\n/**\n * Compact initials extractor for the peek's monogram fallback.\n * Mirrors `initialsOf` in `messages-tab.tsx`:\n * \"Ralph J. Lesperance\" → \"RL\"\n * \"Operator\" → \"O\"\n * \"\" / \" \" → \"\"\n * Kept local to avoid the launcher peek picking up the messages-tab\n * import graph (Apollo, animated icons, etc) for one function.\n */\nfunction peekInitialsOf(name: string): string {\n const words = name\n .trim()\n .split(/\\s+/)\n .map((w) => w.replace(/[^\\p{L}\\p{N}]/gu, \"\"))\n .filter((w) => w.length > 0);\n if (words.length === 0) return \"\";\n if (words.length === 1) return words[0].charAt(0).toUpperCase();\n return words[0].charAt(0).toUpperCase() + words[words.length - 1].charAt(0).toUpperCase();\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n ArrowLeftIcon,\n type ArrowLeftIconHandle,\n XIcon,\n type XIconHandle,\n} from \"@/components/widget/icons/animated\";\nimport { useIconHover } from \"@/lib/use-icon-hover\";\nimport { cn } from \"@/lib/utils\";\n\ninterface TabTitleHeaderProps {\n title?: string;\n onBack?: () => void;\n onClose: () => void;\n className?: string;\n /** Optional expand chip — only article views pass this; list tabs\n * omit it so the bar stays clean. */\n expanded?: boolean;\n onToggleExpand?: () => void;\n}\n\n/**\n * Sticky title bar for Help / News list + drill-in (article) views.\n * Back + close icons animate on the **button's** hover, not their own\n * — driven via `useIconHover` so visitors see motion when they hover\n * the tap target.\n *\n * **Layout** is a fixed-height (`h-14`) three-zone flex row:\n * [ left zone ] [ centred title ] [ right zone ]\n * The left + right zones are both `flex-1`, so they reserve equal\n * width regardless of how many action buttons each holds. That keeps\n * the title dead-centred in the header whether it's a list tab (close\n * only) or an article view (back + expand + close). The title\n * `truncate`s so long article names ellipsise instead of colliding\n * with the edge buttons. Fixed height means every header — list or\n * article — is exactly the same height.\n */\nexport function TabTitleHeader({\n title,\n onBack,\n onClose,\n className,\n expanded,\n onToggleExpand,\n}: TabTitleHeaderProps) {\n const t = useTranslations(\"header\");\n const back = useIconHover<ArrowLeftIconHandle>();\n const close = useIconHover<XIconHandle>();\n\n return (\n <header\n className={cn(\n \"flex h-14 items-center gap-2 border-b border-wx-border bg-wx-bg px-2\",\n className,\n )}\n >\n {/* Left zone — back affordance (or empty spacer). `flex-1` keeps\n it equal-width to the right zone so the title stays centred. */}\n <div className=\"flex flex-1 items-center justify-start\">\n {onBack && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={t(\"back\")}\n onClick={onBack}\n className=\"shrink-0\"\n {...back.parentHandlers}\n >\n <ArrowLeftIcon ref={back.iconRef} size={18} />\n </Button>\n )}\n </div>\n\n {/* Centre — title. `truncate` ellipsises long article names. */}\n {title && (\n <h2 className=\"min-w-0 shrink truncate text-center text-base font-semibold text-wx-fg\">\n {title}\n </h2>\n )}\n\n {/* Right zone — expand + close. `flex-1 justify-end` mirrors the\n left zone's width so the centre title stays header-centred. */}\n <div className=\"flex flex-1 items-center justify-end gap-0\">\n {onToggleExpand && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={expanded ? t(\"collapse\") : t(\"expand\")}\n onClick={onToggleExpand}\n >\n {expanded ? (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"4 14 10 14 10 20\" />\n <polyline points=\"20 10 14 10 14 4\" />\n <line x1=\"14\" y1=\"10\" x2=\"21\" y2=\"3\" />\n <line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\" />\n </svg>\n ) : (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"15 3 21 3 21 9\" />\n <polyline points=\"9 21 3 21 3 15\" />\n <line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\" />\n <line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\" />\n </svg>\n )}\n </Button>\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={t(\"close\")}\n onClick={onClose}\n {...close.parentHandlers}\n >\n <XIcon ref={close.iconRef} size={18} />\n </Button>\n </div>\n </header>\n );\n}\n","\"use client\";\n\nimport { useLocale, useTranslations } from \"next-intl\";\nimport { useEffect, useState } from \"react\";\nimport { Card, CardBody } from \"@/components/ui/card\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { type AuthorChip, toAuthorChips } from \"@/components/widget/author-avatars\";\nimport { HelpListRow } from \"@/components/widget/help-list-row\";\nimport { StickySearchHeader } from \"@/components/widget/sticky-search-header\";\nimport { getMockHelpArticles, getMockHelpCategories, type MockHelpCategory } from \"@/dummy\";\nimport {\n useVisitorHelpFoldersQuery,\n useVisitorHelpListQuery,\n type VisitorHelpFoldersQuery,\n type VisitorHelpListQuery,\n} from \"@/lib/graphql/queries/generated/help.generated\";\nimport { useScrollRestore } from \"@/lib/use-scroll-restore\";\n\ninterface HelpTabProps {\n isDummy: boolean;\n /** Drill into a collection. The parent already has the folder's\n * display metadata (name / description / article count) from the\n * list fetch — we thread it through so `HelpCategoryView` can\n * paint the header without a second BE round-trip. */\n onOpenCategory: (\n categoryId: string,\n meta?: { name?: string; description?: string; articleCount?: number },\n ) => void;\n onOpenArticle: (slug: string) => void;\n}\n\n/**\n * Help **index** — sticky search at the top, total-count header\n * below, then a divider-separated list of collections. Drill-down\n * state lives in the shell so the bottom nav can hide on drill-ins;\n * this component just emits \"open this category\" / \"open this\n * article\" callbacks.\n *\n * Visual model is the Intercom-style help center: each collection is\n * a full-width row (title + description + \"Articles: N\") with a\n * trailing chevron, separated by hairline dividers — no card chrome,\n * no per-row gaps.\n */\nexport function HelpTab({ isDummy, onOpenCategory, onOpenArticle }: HelpTabProps) {\n const t = useTranslations(\"help\");\n const tDemo = useTranslations(\"demo\");\n const locale = useLocale();\n const [query, setQuery] = useState(\"\");\n const debounced = useDebounced(query, 300);\n\n const { data: folderData, loading: catLoading } = useVisitorHelpFoldersQuery({\n variables: { parentId: null, locale },\n skip: isDummy,\n });\n\n // Root-level articles — operators sometimes publish quick-reference\n // pages directly at the top of the help center rather than inside a\n // collection. `folderId: null` + `recursive: false` returns just\n // those (no subtree walk). Renders BELOW the collections list per\n // the visitor's mental model (browse by section first, fall through\n // to loose articles second). Skipped while searching — the search\n // results query covers everything globally already.\n const { data: rootArticlesData } = useVisitorHelpListQuery({\n variables: {\n args: { folderId: null, locale, recursive: false, limit: 20 },\n },\n skip: isDummy,\n });\n\n const { data: searchData } = useVisitorHelpListQuery({\n variables: { args: { query: debounced, locale, limit: 10 } },\n skip: debounced.length < 2 || isDummy,\n });\n\n const realFolders = useRealFolders(folderData);\n const categories: MockHelpCategory[] = isDummy\n ? getMockHelpCategories(tDemo)\n : (realFolders ?? []);\n\n const isSearching = debounced.length >= 2;\n const realResults = useSearchResults(searchData);\n const dummyResults = isDummy\n ? getMockHelpArticles(tDemo)\n .filter(\n (a) =>\n a.title.toLowerCase().includes(debounced.toLowerCase()) ||\n a.excerpt.toLowerCase().includes(debounced.toLowerCase()),\n )\n .map<SearchResult>((a) => ({\n id: a.id,\n title: a.title,\n excerpt: a.excerpt,\n slug: a.slug,\n authors: toAuthorChips((a as { authors?: unknown }).authors),\n }))\n : [];\n const results: SearchResult[] = isDummy ? dummyResults : realResults;\n\n // Map the BE response to row data. Demo mode skips — the mocks\n // bucket every article into a category, no root-level orphans.\n const rootArticles: SearchResult[] = isDummy\n ? []\n : (rootArticlesData?.visitorHelpList.items ?? []).map((a) => ({\n id: a._id,\n title: a.title,\n excerpt: a.excerpt ?? null,\n slug: a.slug,\n authors: toAuthorChips(a.authors),\n }));\n\n const viewportRef = useScrollRestore(\"help\");\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n <ScrollArea className=\"min-h-0 flex-1\" viewportRef={viewportRef}>\n <StickySearchHeader\n value={query}\n onChange={setQuery}\n placeholder={t(\"searchPlaceholder\")}\n />\n\n {isSearching ? (\n <SearchResults results={results} onOpen={onOpenArticle} />\n ) : catLoading && categories.length === 0 ? (\n <ListSkeleton />\n ) : categories.length > 0 || rootArticles.length > 0 ? (\n <>\n {/* Total collections — quiet header line, no styling weight,\n just orients the visitor on the scope of the library. */}\n {categories.length > 0 && (\n <div className=\"border-wx-border border-b px-5 py-4\">\n <p className=\"font-semibold text-base text-wx-fg\">\n {t(\"collectionsCount\", { count: categories.length })}\n </p>\n </div>\n )}\n {/* Collections FIRST, root articles SECOND — all in one\n container so the `last:border-b-0` rule on `HelpListRow`\n only fires on the very last row of the combined list and\n the seam between sections keeps its divider. */}\n <div className=\"flex flex-col\">\n {categories.map((cat, idx) => (\n <HelpListRow\n key={cat.id}\n title={cat.title}\n description={cat.description}\n meta={\n typeof cat.articleCount === \"number\" && cat.articleCount > 0\n ? t(\"articlesCount\", { count: cat.articleCount })\n : undefined\n }\n kind=\"folder\"\n onClick={() =>\n onOpenCategory(cat.id, {\n name: cat.title,\n description: cat.description,\n articleCount: cat.articleCount,\n })\n }\n delay={idx * 0.03}\n />\n ))}\n {rootArticles.map((a, idx) => (\n <HelpListRow\n key={a.id}\n title={a.title}\n description={a.excerpt}\n authors={a.authors}\n kind=\"article\"\n onClick={() => onOpenArticle(a.slug)}\n delay={(categories.length + idx) * 0.03}\n />\n ))}\n </div>\n </>\n ) : (\n <div className=\"px-5 py-6\">\n <Card>\n <CardBody className=\"py-8 text-center\">\n <p className=\"font-semibold text-sm text-wx-fg\">{t(\"emptyTitle\")}</p>\n <p className=\"mt-1 text-wx-fg-muted text-xs\">{t(\"emptyBody\")}</p>\n </CardBody>\n </Card>\n </div>\n )}\n </ScrollArea>\n </div>\n );\n}\n\ninterface SearchResult {\n id: string;\n title: string;\n excerpt: string | null;\n slug: string;\n authors?: AuthorChip[];\n reactionCounts?: Record<string, number> | null;\n}\n\nfunction SearchResults({\n results,\n onOpen,\n}: {\n results: SearchResult[];\n onOpen: (slug: string) => void;\n}) {\n const t = useTranslations(\"help\");\n if (results.length === 0) {\n return (\n <div className=\"px-5 py-6\">\n <Card>\n <CardBody className=\"py-8 text-center\">\n <p className=\"text-sm text-wx-fg-muted\">{t(\"noResults\")}</p>\n </CardBody>\n </Card>\n </div>\n );\n }\n return (\n <div className=\"flex flex-col\">\n {results.map((r, idx) => (\n <HelpListRow\n key={r.id}\n title={r.title}\n description={r.excerpt}\n authors={r.authors}\n onClick={() => onOpen(r.slug)}\n delay={idx * 0.03}\n />\n ))}\n </div>\n );\n}\n\nfunction ListSkeleton() {\n return (\n <div className=\"flex flex-col\">\n {Array.from({ length: 4 }).map((_, idx) => (\n <div\n // biome-ignore lint/suspicious/noArrayIndexKey: static placeholder list\n key={idx}\n className=\"flex items-center gap-3 border-wx-border border-b px-5 py-4 last:border-b-0\"\n >\n <div className=\"flex min-w-0 flex-1 flex-col gap-2\">\n <Skeleton className=\"h-4 w-32 rounded\" />\n <Skeleton className=\"h-3 w-56 rounded\" />\n <Skeleton className=\"h-3 w-20 rounded\" />\n </div>\n <Skeleton className=\"h-4 w-4 rounded\" />\n </div>\n ))}\n </div>\n );\n}\n\nfunction useDebounced<T>(value: T, ms: number): T {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const id = setTimeout(() => setDebounced(value), ms);\n return () => clearTimeout(id);\n }, [value, ms]);\n return debounced;\n}\n\nfunction useRealFolders(\n data: VisitorHelpFoldersQuery | null | undefined,\n): MockHelpCategory[] | null {\n if (!data) return null;\n return data.visitorHelpFolders.map((f) => ({\n id: f._id,\n title: f.name,\n description: f.description ?? \"\",\n articleCount: f.articleCount ?? 0,\n }));\n}\n\nfunction useSearchResults(data: VisitorHelpListQuery | null | undefined): SearchResult[] {\n if (!data) return [];\n return data.visitorHelpList.items.map((r) => ({\n id: r._id,\n title: r.title,\n excerpt: r.excerpt ?? null,\n slug: r.slug,\n authors: toAuthorChips(r.authors),\n reactionCounts: (r.reactionCounts as Record<string, number> | null | undefined) ?? null,\n }));\n}\n","// src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n Context.displayName = rootComponentName + \"Context\";\n const Provider = (props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName) {\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n}\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n BaseContext.displayName = rootComponentName + \"Context\";\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope) {\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n }\n const createScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n };\n };\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = () => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\nexport {\n createContext2 as createContext,\n createContextScope\n};\n//# sourceMappingURL=index.mjs.map\n","// src/primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","// src/use-is-hydrated.tsx\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\";\nfunction useIsHydrated() {\n return useSyncExternalStore(\n subscribe,\n () => true,\n () => false\n );\n}\nfunction subscribe() {\n return () => {\n };\n}\nexport {\n useIsHydrated\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/avatar.tsx\nimport * as React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useIsHydrated } from \"@radix-ui/react-use-is-hydrated\";\nimport { jsx } from \"react/jsx-runtime\";\nvar AVATAR_NAME = \"Avatar\";\nvar [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME);\nvar [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);\nvar Avatar = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeAvatar, ...avatarProps } = props;\n const [imageLoadingStatus, setImageLoadingStatus] = React.useState(\"idle\");\n return /* @__PURE__ */ jsx(\n AvatarProvider,\n {\n scope: __scopeAvatar,\n imageLoadingStatus,\n onImageLoadingStatusChange: setImageLoadingStatus,\n children: /* @__PURE__ */ jsx(Primitive.span, { ...avatarProps, ref: forwardedRef })\n }\n );\n }\n);\nAvatar.displayName = AVATAR_NAME;\nvar IMAGE_NAME = \"AvatarImage\";\nvar AvatarImage = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeAvatar, src, onLoadingStatusChange = () => {\n }, ...imageProps } = props;\n const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);\n const imageLoadingStatus = useImageLoadingStatus(src, imageProps);\n const handleLoadingStatusChange = useCallbackRef((status) => {\n onLoadingStatusChange(status);\n context.onImageLoadingStatusChange(status);\n });\n useLayoutEffect(() => {\n if (imageLoadingStatus !== \"idle\") {\n handleLoadingStatusChange(imageLoadingStatus);\n }\n }, [imageLoadingStatus, handleLoadingStatusChange]);\n return imageLoadingStatus === \"loaded\" ? /* @__PURE__ */ jsx(Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;\n }\n);\nAvatarImage.displayName = IMAGE_NAME;\nvar FALLBACK_NAME = \"AvatarFallback\";\nvar AvatarFallback = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeAvatar, delayMs, ...fallbackProps } = props;\n const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);\n const [canRender, setCanRender] = React.useState(delayMs === void 0);\n React.useEffect(() => {\n if (delayMs !== void 0) {\n const timerId = window.setTimeout(() => setCanRender(true), delayMs);\n return () => window.clearTimeout(timerId);\n }\n }, [delayMs]);\n return canRender && context.imageLoadingStatus !== \"loaded\" ? /* @__PURE__ */ jsx(Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;\n }\n);\nAvatarFallback.displayName = FALLBACK_NAME;\nfunction resolveLoadingStatus(image, src) {\n if (!image) {\n return \"idle\";\n }\n if (!src) {\n return \"error\";\n }\n if (image.src !== src) {\n image.src = src;\n }\n return image.complete && image.naturalWidth > 0 ? \"loaded\" : \"loading\";\n}\nfunction useImageLoadingStatus(src, { referrerPolicy, crossOrigin }) {\n const isHydrated = useIsHydrated();\n const imageRef = React.useRef(null);\n const image = (() => {\n if (!isHydrated) return null;\n if (!imageRef.current) {\n imageRef.current = new window.Image();\n }\n return imageRef.current;\n })();\n const [loadingStatus, setLoadingStatus] = React.useState(\n () => resolveLoadingStatus(image, src)\n );\n useLayoutEffect(() => {\n setLoadingStatus(resolveLoadingStatus(image, src));\n }, [image, src]);\n useLayoutEffect(() => {\n const updateStatus = (status) => () => {\n setLoadingStatus(status);\n };\n if (!image) return;\n const handleLoad = updateStatus(\"loaded\");\n const handleError = updateStatus(\"error\");\n image.addEventListener(\"load\", handleLoad);\n image.addEventListener(\"error\", handleError);\n if (referrerPolicy) {\n image.referrerPolicy = referrerPolicy;\n }\n if (typeof crossOrigin === \"string\") {\n image.crossOrigin = crossOrigin;\n }\n return () => {\n image.removeEventListener(\"load\", handleLoad);\n image.removeEventListener(\"error\", handleError);\n };\n }, [image, crossOrigin, referrerPolicy]);\n return loadingStatus;\n}\nvar Root = Avatar;\nvar Image = AvatarImage;\nvar Fallback = AvatarFallback;\nexport {\n Avatar,\n AvatarFallback,\n AvatarImage,\n Fallback,\n Image,\n Root,\n createAvatarScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Radix-backed avatar with a fallback layer. The fallback only paints\n * after the image network request fails or doesn't resolve within\n * `delayMs`, so operators with slow CDNs don't see an FoUC flash on\n * every render.\n */\nexport const Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(\"relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full\", className)}\n {...props}\n />\n));\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nexport const AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n className={cn(\"aspect-square h-full w-full object-cover\", className)}\n {...props}\n />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nexport const AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n delayMs={300}\n className={cn(\n \"flex h-full w-full items-center justify-center bg-wx-bg-elevated-2 text-xs font-medium text-wx-fg-muted\",\n className,\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\ninterface AvatarStackProps {\n avatars: { src: string; alt: string }[];\n /** Max avatars to render — extras collapse into a `+N` badge. */\n max?: number;\n size?: \"sm\" | \"md\";\n /** Ring colour — matches the surface the stack sits on, so the\n * -space-x overlap reads as separation, not muddle. */\n ringClass?: string;\n /** Outer-wrapper class — caller-controlled spacing/positioning. */\n className?: string;\n}\n\n/**\n * Stack composition over `Avatar` — header + Home-tab CTA both render\n * the same affordance. `max` capped at 3 by default; the +N badge\n * uses the same dimensions so the stack width is predictable.\n */\nexport function AvatarStack({\n avatars,\n max = 3,\n size = \"md\",\n ringClass = \"ring-wx-bg\",\n className,\n}: AvatarStackProps) {\n const visible = avatars.slice(0, max);\n const overflow = avatars.length - visible.length;\n const dim = size === \"sm\" ? \"h-7 w-7\" : \"h-8 w-8\";\n\n return (\n <div className={cn(\"flex -space-x-2\", className)}>\n {visible.map((avatar) => (\n <Avatar key={avatar.src} className={cn(dim, \"ring-2\", ringClass)}>\n <AvatarImage src={avatar.src} alt={avatar.alt} />\n <AvatarFallback>{initials(avatar.alt)}</AvatarFallback>\n </Avatar>\n ))}\n {overflow > 0 && (\n <Avatar className={cn(dim, \"ring-2\", ringClass)}>\n <AvatarFallback>+{overflow}</AvatarFallback>\n </Avatar>\n )}\n </div>\n );\n}\n\nfunction initials(name: string): string {\n return name\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => part[0]?.toUpperCase() ?? \"\")\n .join(\"\");\n}\n","\"use client\";\n\nimport { ArrowRight } from \"lucide-react\";\nimport { motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { AvatarStack } from \"@/components/ui/avatar\";\nimport type { HomeBlock, WidgetConfig, WidgetTab } from \"@/lib/widget-config\";\n\nexport function AskQuestionBlock({\n block,\n config,\n onOpenTab,\n}: {\n block: Extract<HomeBlock, { kind: \"ask-question\" }>;\n config: WidgetConfig;\n onOpenTab: (tab: WidgetTab) => void;\n}) {\n const t = useTranslations(\"home\");\n const target = block.action ?? \"open-messenger\";\n const tab: WidgetTab =\n target === \"open-help\" ? \"help\" : target === \"open-news\" ? \"news\" : \"messages\";\n return (\n <motion.button\n type=\"button\"\n onClick={() => onOpenTab(tab)}\n whileHover={{ y: -1 }}\n whileTap={{ scale: 0.99 }}\n transition={{ type: \"spring\", stiffness: 360, damping: 26 }}\n className=\"flex w-full items-center gap-3 rounded-wx-lg bg-wx-bg-elevated px-4 py-3.5 text-left transition-colors hover:bg-wx-bg-elevated-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary\"\n >\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-base font-semibold text-wx-fg\">\n {block.title?.trim() || t(\"askTitle\")}\n </p>\n <p className=\"mt-0.5 truncate text-sm text-wx-fg-muted\">\n {block.subtitle?.trim() || t(\"askSubtitle\")}\n </p>\n </div>\n {config.operatorAvatars.length > 0 && (\n <AvatarStack avatars={config.operatorAvatars} size=\"sm\" ringClass=\"ring-wx-bg-elevated\" />\n )}\n <ArrowRight size={16} className=\"shrink-0 text-wx-fg-muted\" />\n </motion.button>\n );\n}\n","import type { ReactNode } from \"react\";\n\n/**\n * Pure helpers for the Home blocks — payload projection, title\n * extraction, relative-time formatting, and the inline-markdown\n * renderer. Kept out of the block components so the components stay\n * presentation-only and these stay unit-testable.\n */\n\n/** Shape a raw `visitorNewsPost` payload into the fields the\n * featured-article hero needs. The BE returns the post as `JSON`\n * (Apollo unknown); we defensively extract strings + the populated\n * Media `url`. */\nexport function extractFeaturedPost(raw: unknown): {\n id: string;\n title: string;\n excerpt: string;\n coverImageUrl?: string;\n} | null {\n if (!raw || typeof raw !== \"object\") return null;\n const o = raw as Record<string, unknown>;\n const id = String(o._id ?? o.id ?? \"\");\n if (!id) return null;\n // Cover image — prefer the operator-uploaded Media (`coverImageUrl.url`)\n // and fall back to the externally-pulled URL field that the ingest\n // pipeline mirrors onto the post for RSS/webhook posts.\n const mediaCover = (o.coverImageUrl as Record<string, unknown> | undefined)?.url;\n const externalCover = o.externalCoverImageUrl;\n const cover =\n typeof mediaCover === \"string\"\n ? mediaCover\n : typeof externalCover === \"string\"\n ? externalCover\n : undefined;\n return {\n id,\n title: typeof o.title === \"string\" ? o.title : \"\",\n excerpt: typeof o.excerpt === \"string\" ? o.excerpt : \"\",\n coverImageUrl: cover,\n };\n}\n\n/** Read titles from the operator's dashboard-prefetched news array. */\nexport function extractTitlesFromRaw(raw: unknown[] | undefined): string[] {\n if (!Array.isArray(raw)) return [];\n return raw\n .map((item) =>\n typeof item === \"object\" && item !== null && \"title\" in item\n ? String((item as { title?: unknown }).title ?? \"\")\n : \"\",\n )\n .filter((s) => s.length > 0);\n}\n\n/** Read titles from the typed `visitorNewsList.items` payload. */\nexport function extractTitlesFromList(\n items: ReadonlyArray<{ title: string }> | null | undefined,\n error: unknown,\n): string[] {\n if (error || !items) return [];\n return items\n .map((item) => (typeof item.title === \"string\" ? item.title : \"\"))\n .filter((s) => s.length > 0);\n}\n\n/** Compact relative time for the recent-message timestamp — \"4h\" /\n * \"2d\" / \"Just now\". Avoids pulling in a full date-fns dependency.\n * NOTE: \"Just now\" is English-only; localizing it is a follow-up. */\nexport function formatRelativeTime(iso: string): string {\n const ts = Date.parse(iso);\n if (Number.isNaN(ts)) return \"\";\n const diffMs = Date.now() - ts;\n const m = Math.floor(diffMs / 60_000);\n if (m < 1) return \"Just now\";\n if (m < 60) return `${m}m`;\n const h = Math.floor(m / 60);\n if (h < 24) return `${h}h`;\n const d = Math.floor(h / 24);\n if (d < 7) return `${d}d`;\n return new Date(ts).toLocaleDateString();\n}\n\n/**\n * Lightweight inline-markdown renderer for the rich-text block — bold /\n * italic / links / line breaks only (the BE doc allowlist), so the Home\n * tab doesn't pull in the full markdown stack.\n */\nexport function renderInlineMarkdown(md: string): ReactNode {\n return md.split(/\\n{2,}/).map((para, pi) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: markdown paragraphs are split deterministically and order-stable\n <p key={pi} className={pi > 0 ? \"mt-2\" : undefined}>\n {para.split(\"\\n\").map((line, li) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: lines are split deterministically and order-stable\n <span key={li}>\n {li > 0 && <br />}\n {inlineTokens(line)}\n </span>\n ))}\n </p>\n ));\n}\n\nfunction inlineTokens(line: string): ReactNode[] {\n // `[text](url)`, `**bold**`, `*italic*` — order matters.\n const out: ReactNode[] = [];\n const re = /\\[([^\\]]+)\\]\\(([^)]+)\\)|\\*\\*([^*]+)\\*\\*|\\*([^*]+)\\*/g;\n let last = 0;\n let m: RegExpExecArray | null;\n let key = 0;\n // biome-ignore lint/suspicious/noAssignInExpressions: standard regex walk\n while ((m = re.exec(line))) {\n if (m.index > last) out.push(line.slice(last, m.index));\n if (m[1] && m[2]) {\n const href = /^https?:\\/\\//.test(m[2]) ? m[2] : \"#\";\n out.push(\n <a key={key++} href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {m[1]}\n </a>,\n );\n } else if (m[3]) {\n out.push(\n <strong key={key++} className=\"font-semibold text-wx-fg\">\n {m[3]}\n </strong>,\n );\n } else if (m[4]) {\n out.push(<em key={key++}>{m[4]}</em>);\n }\n last = m.index + m[0].length;\n }\n if (last < line.length) out.push(line.slice(last));\n return out;\n}\n","\"use client\";\n\nimport { ChevronRight } from \"lucide-react\";\nimport { motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { useVisitorNewsPostCardQuery } from \"@/lib/graphql/queries/generated/news.generated\";\nimport { useWidgetEnv } from \"@/lib/use-widget-env\";\nimport type { HomeBlock, WidgetTab } from \"@/lib/widget-config\";\nimport { extractFeaturedPost } from \"../helpers\";\n\n/** Single hero card for a featured news post.\n * - **Live mode**: `newsId` set → hydrate via `visitorNewsPost({ id })`,\n * render the post's cover + title + excerpt with the operator's\n * `ctaLabel` (or i18n default) underneath. No id / not-found →\n * paint a gradient placeholder.\n * - **Demo mode**: hardcoded Pioneer \"Save the date\" preview so the\n * dashboard's demo toggle shows the populated look operators are\n * designing toward.\n */\nexport function FeaturedArticleBlock({\n block,\n onOpenTab,\n onOpenNewsArticle,\n isDummy,\n}: {\n block: Extract<HomeBlock, { kind: \"featured-article\" }>;\n onOpenTab: (tab: WidgetTab) => void;\n onOpenNewsArticle?: (id: string) => void;\n isDummy: boolean;\n}) {\n const t = useTranslations(\"home\");\n const env = useWidgetEnv();\n\n // Dashboard-prefetched lookup takes precedence — the preview pane\n // already has the operator-side post loaded, so we render that\n // instead of round-tripping through the visitor surface.\n const previewPost =\n !isDummy && block.newsId ? env.previewData?.newsPostsById?.[block.newsId] : undefined;\n const hasPreview = previewPost !== undefined;\n\n // Real-data path — `visitorNewsPost({ id })` returns the post or\n // `null` for unpublished / cross-integration / missing ids. Uses the\n // slim card-only selection (no `contentMarkdown` / joins); the full\n // post hydrates lazily inside the article-detail view.\n const { data, loading } = useVisitorNewsPostCardQuery({\n variables: { args: { id: block.newsId ?? \"\" } },\n skip: isDummy || hasPreview || !block.newsId,\n });\n\n if (isDummy) {\n return (\n <motion.button\n type=\"button\"\n // The demo hero IS the Pioneer 2026 post (`demo-news-1`) — open\n // it directly so the CTA reads as \"see this article\", not \"go\n // to the news list\". Falls back to the news tab if the shell\n // didn't wire article navigation.\n onClick={() => (onOpenNewsArticle ? onOpenNewsArticle(\"demo-news-1\") : onOpenTab(\"news\"))}\n whileHover={{ y: -2 }}\n whileTap={{ scale: 0.99 }}\n transition={{ type: \"spring\", stiffness: 360, damping: 26 }}\n className=\"block w-full overflow-hidden rounded-wx-xl bg-wx-bg-elevated text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary\"\n >\n {/* Hero: gradient cover + centered eyebrow / headline / subline */}\n <div\n className=\"relative w-full\"\n style={{\n aspectRatio: \"16 / 11\",\n backgroundImage: \"linear-gradient(135deg, #1e1f3b 0%, #1a1a2e 55%, #3a1e2b 100%)\",\n }}\n >\n <div className=\"absolute inset-0 flex flex-col items-center justify-center gap-1.5 px-6 text-center text-white\">\n <p className=\"text-[11px] font-semibold tracking-[0.22em] uppercase opacity-80\">\n {t(\"featuredArticleDemoEyebrow\")}\n </p>\n <p className=\"text-2xl leading-tight font-bold\">{t(\"featuredArticleDemoHeadline\")}</p>\n <p className=\"text-sm opacity-85\">{t(\"featuredArticleDemoSubline\")}</p>\n </div>\n </div>\n {/* Footer CTA row — tonal background, separates from the hero */}\n <div className=\"flex items-center justify-between gap-2 px-4 py-3\">\n <span className=\"truncate text-sm font-semibold text-wx-fg\">\n {t(\"featuredArticleDemoCta\")}\n </span>\n <ChevronRight size={16} className=\"shrink-0 text-wx-fg-subtle\" />\n </div>\n </motion.button>\n );\n }\n\n // ─── Live mode ───────────────────────────────────────────────\n // No id → placeholder. Loading / not-found → placeholder. Both\n // states render the gradient hero so the block is never blank.\n const post = extractFeaturedPost(hasPreview ? previewPost : data?.visitorNewsPost);\n const interactive = !!post;\n const ctaLabel = block.ctaLabel?.trim() || t(\"featuredArticleTap\");\n const onClick = interactive\n ? () => (onOpenNewsArticle ? onOpenNewsArticle(post.id) : onOpenTab(\"news\"))\n : undefined;\n const coverImage = post?.coverImageUrl;\n\n if (!block.newsId || (!loading && !post)) {\n return (\n <motion.button\n type=\"button\"\n onClick={() => onOpenTab(\"news\")}\n whileHover={{ y: -1 }}\n whileTap={{ scale: 0.99 }}\n transition={{ type: \"spring\", stiffness: 360, damping: 26 }}\n className=\"block w-full overflow-hidden rounded-wx-xl bg-wx-bg-elevated text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary\"\n >\n <div\n className=\"relative w-full\"\n style={{\n aspectRatio: \"16 / 11\",\n backgroundImage: \"linear-gradient(135deg, #1e1f3b 0%, #1a1a2e 55%, #3a1e2b 100%)\",\n }}\n >\n <div className=\"absolute inset-0 flex flex-col items-center justify-center gap-1 px-6 text-center text-white\">\n <p className=\"text-2xl leading-tight font-bold\">\n {block.newsId ? t(\"featuredArticleLoading\") : t(\"featuredArticleEmpty\")}\n </p>\n <p className=\"text-sm opacity-80\">{block.newsId ? \"\" : t(\"featuredArticleSetUp\")}</p>\n </div>\n </div>\n </motion.button>\n );\n }\n\n return (\n <motion.button\n type=\"button\"\n onClick={onClick}\n whileHover={interactive ? { y: -2 } : undefined}\n whileTap={interactive ? { scale: 0.99 } : undefined}\n transition={{ type: \"spring\", stiffness: 360, damping: 26 }}\n disabled={!interactive}\n className=\"block w-full overflow-hidden rounded-wx-xl bg-wx-bg-elevated text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary\"\n >\n <div\n className=\"relative w-full\"\n style={{\n aspectRatio: \"16 / 11\",\n backgroundImage: coverImage\n ? `linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.65) 100%), url(${coverImage})`\n : \"linear-gradient(135deg, #1e1f3b 0%, #1a1a2e 55%, #3a1e2b 100%)\",\n backgroundSize: \"cover\",\n backgroundPosition: \"center\",\n }}\n >\n <div className=\"absolute inset-0 flex flex-col items-center justify-center gap-1.5 px-6 text-center text-white\">\n <p className=\"text-2xl leading-tight font-bold\">{post?.title}</p>\n {post?.excerpt && <p className=\"text-sm opacity-85 line-clamp-2\">{post.excerpt}</p>}\n </div>\n </div>\n <div className=\"flex items-center justify-between gap-2 px-4 py-3\">\n <span className=\"truncate text-sm font-semibold text-wx-fg\">{ctaLabel}</span>\n <ChevronRight size={16} className=\"shrink-0 text-wx-fg-subtle\" />\n </div>\n </motion.button>\n );\n}\n","\"use client\";\n\nimport { Search } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport type { HomeBlock, WidgetTab } from \"@/lib/widget-config\";\n\nexport function HelpSearchBlock({\n block,\n onOpenTab,\n}: {\n block: Extract<HomeBlock, { kind: \"help-search\" }>;\n onOpenTab: (tab: WidgetTab) => void;\n}) {\n const t = useTranslations(\"home\");\n return (\n <button\n type=\"button\"\n onClick={() => onOpenTab(\"help\")}\n className=\"flex w-full items-center gap-2.5 rounded-wx-lg border border-wx-border bg-wx-bg-elevated px-3.5 py-3 text-left transition-colors hover:bg-wx-bg-elevated-2\"\n >\n <Search size={16} className=\"shrink-0 text-wx-fg-muted\" />\n <span className=\"text-sm text-wx-fg-muted\">\n {block.placeholder?.trim() || t(\"searchPlaceholder\")}\n </span>\n </button>\n );\n}\n","import { ChevronRight } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Titled card shell with a header + \"see all\" affordance — used by the\n * list-style Home blocks (pinned-articles, news-preview).\n */\nexport function BlockCard({\n title,\n onOpenAll,\n children,\n}: {\n title: string;\n onOpenAll: () => void;\n children: ReactNode;\n}) {\n return (\n <div className=\"overflow-hidden rounded-wx-lg border border-wx-border bg-wx-bg-elevated\">\n <div className=\"flex items-center justify-between px-3.5 pt-3 pb-1.5\">\n <p className=\"text-xs font-semibold tracking-wide text-wx-fg-muted uppercase\">{title}</p>\n <button\n type=\"button\"\n onClick={onOpenAll}\n className=\"text-xs font-medium text-wx-primary hover:underline\"\n >\n <ChevronRight size={14} />\n </button>\n </div>\n {children}\n </div>\n );\n}\n","\"use client\";\n\nimport { ChevronRight, Sparkles } from \"lucide-react\";\nimport { useLocale, useTranslations } from \"next-intl\";\nimport { getMockNewsItems } from \"@/dummy\";\nimport { useVisitorNewsListQuery } from \"@/lib/graphql/queries/generated/news.generated\";\nimport { useWidgetEnv } from \"@/lib/use-widget-env\";\nimport type { HomeBlock, WidgetTab } from \"@/lib/widget-config\";\nimport { extractTitlesFromList, extractTitlesFromRaw } from \"../helpers\";\nimport { BlockCard } from \"../shared\";\n\nexport function NewsPreviewBlock({\n block,\n onOpenTab,\n isDummy,\n}: {\n block: Extract<HomeBlock, { kind: \"news-preview\" }>;\n onOpenTab: (tab: WidgetTab) => void;\n isDummy: boolean;\n}) {\n const t = useTranslations(\"home\");\n const tDemo = useTranslations(\"demo\");\n const locale = useLocale();\n const env = useWidgetEnv();\n const max = Math.max(1, Math.min(6, block.maxItems ?? 3));\n\n // Same prefetch short-circuit as the News tab — render the\n // dashboard-supplied list instead of hitting the visitor feed when\n // the preview pane has already loaded the operator's posts.\n // Empty arrays don't count (still-loading edge case) — fall through\n // to the BE query so the block doesn't render permanently empty.\n const previewFeed = !isDummy ? env.previewData?.newsPosts : undefined;\n const hasPreview = Array.isArray(previewFeed) && previewFeed.length > 0;\n\n // Real path queries the consolidated `visitorNewsList` the News\n // tab uses. Skipped in dummy mode — we render bundled\n // getMockNewsItems() instead so the dashboard preview's \"demo\" toggle\n // gets a populated card.\n const { data, error, loading } = useVisitorNewsListQuery({\n variables: { args: { locale, limit: max } },\n skip: isDummy || hasPreview,\n });\n\n const titles = isDummy\n ? getMockNewsItems(tDemo)\n .slice(0, max)\n .map((n) => n.title)\n : hasPreview\n ? extractTitlesFromRaw(previewFeed).slice(0, max)\n : extractTitlesFromList(data?.visitorNewsList.items, error).slice(0, max);\n\n // Live mode + no items → hide the card entirely rather than showing a\n // header with nothing under it. Loading shows the header but no rows so\n // the layout doesn't jump when items arrive.\n if (!isDummy && !loading && titles.length === 0) return null;\n\n return (\n <BlockCard\n title={block.title?.trim() || t(\"newsPreviewTitle\")}\n onOpenAll={() => onOpenTab(\"news\")}\n >\n <ul className=\"flex flex-col\">\n {titles.map((title, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: list is order-stable\n <li key={i}>\n <button\n type=\"button\"\n onClick={() => onOpenTab(\"news\")}\n className=\"flex w-full items-center gap-2 px-3.5 py-2.5 text-left transition-colors hover:bg-wx-bg-elevated-2\"\n >\n <Sparkles size={14} className=\"shrink-0 text-wx-fg-muted\" />\n <span className=\"min-w-0 flex-1 truncate text-sm text-wx-fg\">{title}</span>\n <ChevronRight size={14} className=\"shrink-0 text-wx-fg-subtle\" />\n </button>\n </li>\n ))}\n </ul>\n </BlockCard>\n );\n}\n","\"use client\";\n\nimport { Book, ChevronRight } from \"lucide-react\";\nimport { useLocale, useTranslations } from \"next-intl\";\nimport { getMockHelpArticles } from \"@/dummy\";\nimport { useVisitorHelpArticlesByIdsQuery } from \"@/lib/graphql/queries/generated/help.generated\";\nimport { useWidgetEnv } from \"@/lib/use-widget-env\";\nimport type { HomeBlock, WidgetTab } from \"@/lib/widget-config\";\nimport { BlockCard } from \"../shared\";\n\nexport function PinnedArticlesBlock({\n block,\n onOpenTab,\n onOpenArticle,\n isDummy,\n}: {\n block: Extract<HomeBlock, { kind: \"pinned-articles\" }>;\n onOpenTab: (tab: WidgetTab) => void;\n /** Tap on a pinned row → drill into the article. Falls back to\n * opening the help index when undefined. */\n onOpenArticle?: (slug: string) => void;\n isDummy: boolean;\n}) {\n const t = useTranslations(\"home\");\n const tDemo = useTranslations(\"demo\");\n const env = useWidgetEnv();\n const locale = useLocale();\n\n const ids = (block.articleIds ?? []).slice(0, 5);\n const count = ids.length;\n\n // Dashboard preview short-circuit — read titles from the operator-\n // prefetched lookup instead of round-tripping through the visitor\n // surface. Production embeds fall through to the real query.\n const previewLookup = !isDummy ? env.previewData?.helpArticlesById : null;\n const usePreview = !!previewLookup;\n\n // Hydrate real titles via `visitorHelpArticlesByIds(ids)` — BE\n // returns the rows in the same order they were requested, so we\n // can iterate `ids` and look up by index. Demo / preview / empty\n // skip the network. Declared up here (before the demo early-return)\n // so the hook order stays stable across renders.\n const { data } = useVisitorHelpArticlesByIdsQuery({\n variables: { ids, locale },\n skip: isDummy || usePreview || ids.length === 0,\n });\n\n // Demo mode: the demo config pins no specific ids, so surface the\n // most-viewed demo help articles as a \"Popular articles\" list. Real\n // titles + working drill-in, no network.\n if (isDummy) {\n const popular = getMockHelpArticles(tDemo)\n .slice()\n .sort((a, b) => b.viewCount - a.viewCount)\n .slice(0, 4);\n return (\n <BlockCard\n title={block.title?.trim() || t(\"popularArticlesTitle\")}\n onOpenAll={() => onOpenTab(\"help\")}\n >\n <ul className=\"flex flex-col\">\n {popular.map((a) => (\n <li key={a.id}>\n <button\n type=\"button\"\n onClick={() => (onOpenArticle ? onOpenArticle(a.slug) : onOpenTab(\"help\"))}\n className=\"flex w-full items-center gap-2 px-3.5 py-2.5 text-left transition-colors hover:bg-wx-bg-elevated-2\"\n >\n <Book size={14} className=\"shrink-0 text-wx-fg-muted\" />\n <span className=\"min-w-0 flex-1 truncate text-sm text-wx-fg\">{a.title}</span>\n <ChevronRight size={14} className=\"shrink-0 text-wx-fg-subtle\" />\n </button>\n </li>\n ))}\n </ul>\n </BlockCard>\n );\n }\n\n if (count === 0) return null;\n\n // Build an id-keyed lookup. Some ids may resolve to `null` (deleted,\n // unpublished, cross-integration) — those rows fall back to the\n // placeholder copy rather than disappearing, so the operator's\n // pinned-count matches what they configured.\n const titlesById = new Map<string, { title: string; slug: string }>();\n if (usePreview && previewLookup) {\n for (const id of ids) {\n const raw = previewLookup[id];\n if (raw && typeof raw === \"object\") {\n const r = raw as { title?: unknown; slug?: unknown };\n if (typeof r.title === \"string\" && typeof r.slug === \"string\") {\n titlesById.set(id, { title: r.title, slug: r.slug });\n }\n }\n }\n } else {\n for (const row of data?.visitorHelpArticlesByIds ?? []) {\n titlesById.set(row._id, { title: row.title, slug: row.slug });\n }\n }\n\n return (\n <BlockCard\n title={block.title?.trim() || t(\"pinnedArticlesTitle\")}\n onOpenAll={() => onOpenTab(\"help\")}\n >\n <ul className=\"flex flex-col\">\n {ids.map((id, i) => {\n const hit = titlesById.get(id);\n return (\n <li key={id}>\n <button\n type=\"button\"\n onClick={() => {\n if (hit && onOpenArticle) onOpenArticle(hit.slug);\n else onOpenTab(\"help\");\n }}\n className=\"flex w-full items-center gap-2 px-3.5 py-2.5 text-left transition-colors hover:bg-wx-bg-elevated-2\"\n >\n <Book size={14} className=\"shrink-0 text-wx-fg-muted\" />\n <span className=\"min-w-0 flex-1 truncate text-sm text-wx-fg\">\n {hit ? hit.title : t(\"pinnedArticleRow\", { n: i + 1 })}\n </span>\n <ChevronRight size={14} className=\"shrink-0 text-wx-fg-subtle\" />\n </button>\n </li>\n );\n })}\n </ul>\n </BlockCard>\n );\n}\n","\"use client\";\n\nimport type { ComponentType, SVGProps } from \"react\";\n\n/**\n * Real brand SVG marks for channel-switcher inline tiles. lucide-react\n * doesn't ship brand icons (trademarks), so we inline the canonical\n * Simple Icons paths for the few channels operators actually use.\n *\n * Each component takes `size` (square px) + `className` so it slots\n * into the same call sites as `lucide-react` glyphs. `fill=\"currentColor\"`\n * means the tile's text colour controls the mark — operators get\n * tinted brand marks when their palette overrides `--wx-fg`.\n */\n\ninterface BrandIconProps {\n size?: number;\n className?: string;\n}\n\nfunction svgProps(size: number, className?: string): SVGProps<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: size,\n height: size,\n viewBox: \"0 0 24 24\",\n fill: \"currentColor\",\n \"aria-hidden\": \"true\",\n className,\n };\n}\n\nexport function WhatsAppIcon({ size = 18, className }: BrandIconProps) {\n return (\n <svg {...svgProps(size, className)}>\n <title>WhatsApp</title>\n <path d=\"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413Z\" />\n </svg>\n );\n}\n\nexport function TelegramIcon({ size = 18, className }: BrandIconProps) {\n return (\n <svg {...svgProps(size, className)}>\n <title>Telegram</title>\n <path d=\"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.149-.056-.211s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z\" />\n </svg>\n );\n}\n\nexport function InstagramIcon({ size = 18, className }: BrandIconProps) {\n return (\n <svg {...svgProps(size, className)}>\n <title>Instagram</title>\n <path d=\"M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z\" />\n </svg>\n );\n}\n\nexport function MessengerIcon({ size = 18, className }: BrandIconProps) {\n return (\n <svg {...svgProps(size, className)}>\n <title>Messenger</title>\n <path d=\"M.001 11.639C.001 4.949 5.241 0 12.001 0S24 4.95 24 11.639c0 6.689-5.24 11.638-12 11.638-1.21 0-2.38-.16-3.47-.46a.96.96 0 00-.64.05l-2.39 1.05a.96.96 0 01-1.35-.85l-.07-2.14a.97.97 0 00-.32-.68A11.39 11.39 0 010 11.639zm8.32-2.19l-3.52 5.6c-.35.53.32 1.139.82.75l3.79-2.87c.26-.2.6-.2.87 0l2.8 2.1c.84.63 2.04.4 2.6-.48l3.52-5.6c.35-.53-.32-1.13-.82-.75l-3.79 2.87c-.25.2-.6.2-.86 0l-2.81-2.1a1.86 1.86 0 00-2.6.48z\" />\n </svg>\n );\n}\n\nexport function ViberIcon({ size = 18, className }: BrandIconProps) {\n return (\n <svg {...svgProps(size, className)}>\n <title>Viber</title>\n <path d=\"M11.4 0C9.473.028 5.333.344 3.018 2.467 1.298 4.187.696 6.7.633 9.817c-.062 3.116-.136 8.95 5.488 10.533v2.42s-.038.978.609 1.177c.781.243 1.24-.502 1.986-1.305.41-.441.973-1.09 1.4-1.587 3.85.324 6.8-.418 7.143-.529 1.072-.345 6.49-.95 7.245-9.388.36-3.66-.143-7.23-3.245-9.875-.96-.838-2.984-2.293-7.245-2.317 0 0-.246-.011-.61-.012zm.149 1.625c1.073 0 5.184.103 7.18 1.92 2.546 2.236 2.972 5.36 2.668 8.47-.55 7.058-4.825 7.55-5.73 7.838-.288.111-2.85.794-6.092.581 0 0-2.408 2.926-3.158 3.69-.117.122-.255.171-.347.144-.13-.034-.165-.193-.165-.428l.02-3.99c-4.756-1.302-4.482-6.293-4.43-8.895.054-2.602.547-4.735 1.996-6.176 1.948-1.788 5.485-2.05 7.196-2.054.43-.001.642-.05.862-.05zm-.135 2.5c-.143.001-.247.118-.222.262.024.142.143.245.286.245 1.86.041 3.385.685 4.555 1.975.555.617.836 1.27 1.045 2.06.21.789.275 1.638.245 2.475-.005.144.099.265.243.272s.265-.103.272-.247c.032-.876-.038-1.768-.262-2.617-.224-.847-.554-1.601-1.183-2.298-1.27-1.396-2.97-2.117-4.928-2.16-.018-.001-.034.001-.05.033zm-1.5 1.282c-.196.005-.452.038-.711.232-.413.31-1.262 1.328-1.293 2.078-.031.787 1.293 3.013 1.293 3.013l.025.026s1.044 1.706 2.075 3c1.027 1.297 2.075 2.187 2.075 2.187s1.293.992 2.078 1.231c.788.244 1.293-.025 1.605-.451.31-.413 1.328-1.231 1.328-2.018 0-.788-2.018-1.832-2.481-1.953-.464-.122-.866 0-.991.213-.213.366-.5.732-1.062.488-1.013-.46-1.628-1.013-2.018-1.487-.46-.5-.91-1.013-1.413-2.018-.25-.535.119-.825.488-1.038.213-.122.366-.524.244-.988-.122-.464-1.166-2.481-1.953-2.481-.094-.024-.207-.034-.31-.034zm2.293 1.187a.265.265 0 00-.262.262c0 .143.122.262.262.262.594.014 1.072.21 1.428.594.34.39.5.879.518 1.534a.265.265 0 00.262.262c.143 0 .262-.122.262-.262-.018-.79-.244-1.453-.659-1.928-.488-.5-1.044-.733-1.751-.733zm-.072 1.5a.255.255 0 00-.244.262c0 .143.122.262.262.262.453.043.622.213.65.66 0 .143.122.262.262.262a.265.265 0 00.262-.262c-.018-.595-.34-1.013-.952-1.184-.06-.012-.158 0-.218 0z\" />\n </svg>\n );\n}\n\n/** Brand-name → component lookup. Channels not in this map fall back\n * to the lucide glyph from `NAMED_ICON` in the home-blocks renderer. */\nexport const BRAND_ICON: Partial<\n Record<string, ComponentType<{ size?: number; className?: string }>>\n> = {\n whatsapp: WhatsAppIcon,\n telegram: TelegramIcon,\n instagram: InstagramIcon,\n messenger: MessengerIcon,\n viber: ViberIcon,\n};\n","\"use client\";\n\nimport {\n ArrowRight,\n Bell,\n Book,\n Bookmark,\n Camera,\n Gamepad2,\n Hash,\n Heart,\n HelpCircle,\n Lock,\n Mail,\n MessageCircle,\n MessageCircleMore,\n MessageSquare,\n Phone,\n Send,\n Shield,\n Star,\n User,\n Users,\n Video,\n} from \"lucide-react\";\nimport { motion } from \"motion/react\";\nimport type { ComponentType } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\nimport type {\n HomeBlock,\n HomeNamedIcon,\n HomeQuickActionButton,\n WidgetTab,\n} from \"@/lib/widget-config\";\nimport { BRAND_ICON } from \"../../icons/brand-icons\";\n\n/** Curated `quick-actions` icon names → a bundled lucide glyph. Brand\n * channels map to visually-distinct lucide glyphs (no brand SVGs in\n * the bundle yet — the channel name picks the closest semantic icon\n * so the picker doesn't collapse all brands to one shape). */\nconst NAMED_ICON: Record<HomeNamedIcon, ComponentType<{ size?: number; className?: string }>> = {\n telegram: Send,\n whatsapp: MessageSquare,\n viber: Phone,\n instagram: Camera,\n messenger: MessageCircleMore,\n discord: Gamepad2,\n slack: Hash,\n chat: MessageCircle,\n email: Mail,\n phone: Phone,\n \"video-call\": Video,\n help: HelpCircle,\n book: Book,\n bell: Bell,\n star: Star,\n heart: Heart,\n bookmark: Bookmark,\n \"arrow-right\": ArrowRight,\n lock: Lock,\n shield: Shield,\n user: User,\n users: Users,\n};\n\nexport function QuickActionsBlock({\n block,\n onOpenTab,\n}: {\n block: Extract<HomeBlock, { kind: \"quick-actions\" }>;\n onOpenTab: (tab: WidgetTab) => void;\n}) {\n const runAction = (btn: HomeQuickActionButton) => {\n switch (btn.action) {\n case \"open-messenger\":\n return onOpenTab(\"messages\");\n case \"open-help\":\n return onOpenTab(\"help\");\n case \"open-news\":\n return onOpenTab(\"news\");\n case \"open-url\":\n if (btn.url) window.open(btn.url, \"_blank\", \"noopener,noreferrer\");\n return;\n }\n };\n\n // Inline layout — up to 4 square icon tiles in a row. Labels render\n // beneath each tile (clamped to one line) so a \"WhatsApp\" tile still\n // self-identifies, but the dominant visual is the channel mark.\n if (block.layout === \"inline\") {\n const tiles = block.buttons.slice(0, 4);\n return (\n <div\n className={cn(\n \"grid gap-2\",\n tiles.length === 1 && \"grid-cols-1\",\n tiles.length === 2 && \"grid-cols-2\",\n tiles.length === 3 && \"grid-cols-3\",\n tiles.length >= 4 && \"grid-cols-4\",\n )}\n >\n {tiles.map((btn, i) => (\n <QuickActionInlineTile\n // biome-ignore lint/suspicious/noArrayIndexKey: button list is operator-ordered and order-stable\n key={`${btn.action}-${i}`}\n btn={btn}\n onClick={() => runAction(btn)}\n />\n ))}\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col gap-2\">\n {block.buttons.map((btn, i) => (\n <QuickActionButtonView\n // biome-ignore lint/suspicious/noArrayIndexKey: button list is operator-ordered and order-stable\n key={`${btn.action}-${i}`}\n btn={btn}\n onClick={() => runAction(btn)}\n />\n ))}\n </div>\n );\n}\n\n/** One inline-layout tile — square icon button with a clamped caption\n * below. Prefers the real brand SVG over the lucide approximation when\n * available; long labels stay readable via `truncate` + the native\n * `title` tooltip on hover. */\nfunction QuickActionInlineTile({\n btn,\n onClick,\n}: {\n btn: HomeQuickActionButton;\n onClick: () => void;\n}) {\n // Prefer real brand SVG when the icon name matches a known channel\n // (whatsapp / telegram / instagram / messenger / viber). Fall back to\n // the lucide approximation for everything else.\n const namedKey = btn.icon?.kind === \"named\" ? btn.icon.name : null;\n const BrandGlyph = namedKey ? BRAND_ICON[namedKey] : null;\n const LucideGlyph = namedKey ? (NAMED_ICON[namedKey] ?? MessageCircle) : MessageCircle;\n const Glyph = BrandGlyph ?? LucideGlyph;\n\n return (\n <motion.button\n type=\"button\"\n onClick={onClick}\n whileHover={{ y: -2, scale: 1.02 }}\n whileTap={{ scale: 0.96 }}\n transition={{ type: \"spring\", stiffness: 420, damping: 24 }}\n title={btn.label}\n className=\"group flex aspect-square flex-col items-center justify-center gap-1.5 rounded-wx-lg bg-wx-bg-elevated px-2 py-3 text-wx-fg transition-colors hover:bg-wx-bg-elevated-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary\"\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-wx-bg transition-transform group-hover:scale-110\">\n {btn.icon?.kind === \"media\" ? (\n // biome-ignore lint/performance/noImgElement: operator-uploaded channel icon of arbitrary host/dimensions; next/image needs known sizes + an allowlist\n <img src={btn.icon.url} alt=\"\" className=\"h-5 w-5 object-contain\" />\n ) : (\n <Glyph size={18} className=\"text-wx-fg\" />\n )}\n </span>\n {btn.label && (\n <span className=\"block w-full truncate text-center text-[11px] leading-tight font-medium\">\n {btn.label}\n </span>\n )}\n </motion.button>\n );\n}\n\nfunction QuickActionButtonView({\n btn,\n onClick,\n}: {\n btn: HomeQuickActionButton;\n onClick: () => void;\n}) {\n // Image-only button → render the uploaded media as a tappable card.\n if (!btn.label && btn.icon?.kind === \"media\") {\n return (\n <motion.button\n type=\"button\"\n onClick={onClick}\n whileHover={{ y: -2 }}\n whileTap={{ scale: 0.985 }}\n transition={{ type: \"spring\", stiffness: 360, damping: 26 }}\n className=\"block w-full overflow-hidden rounded-wx-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary\"\n >\n {/* biome-ignore lint/performance/noImgElement: operator-uploaded button media of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img src={btn.icon.url} alt=\"\" className=\"w-full object-cover\" />\n </motion.button>\n );\n }\n\n const variant = btn.style === \"primary\" ? \"solid\" : btn.style === \"ghost\" ? \"ghost\" : \"tonal\";\n const icon =\n btn.icon?.kind === \"named\" ? (\n (() => {\n // Prefer the real brand SVG; fall back to the lucide glyph.\n const Glyph = BRAND_ICON[btn.icon.name] ?? NAMED_ICON[btn.icon.name] ?? MessageCircle;\n return <Glyph size={16} className=\"shrink-0\" />;\n })()\n ) : btn.icon?.kind === \"media\" ? (\n // biome-ignore lint/performance/noImgElement: operator-uploaded button icon of arbitrary host/dimensions; next/image needs known sizes + an allowlist\n <img src={btn.icon.url} alt=\"\" className=\"h-4 w-4 shrink-0 object-contain\" />\n ) : null;\n\n return (\n <Button\n type=\"button\"\n variant={variant}\n size=\"lg\"\n onClick={onClick}\n className=\"justify-start gap-2.5\"\n >\n {icon}\n {btn.label && <span className=\"text-sm font-medium\">{btn.label}</span>}\n </Button>\n );\n}\n","\"use client\";\n\nimport { assetUrl } from \"@/lib/asset-url\";\nimport { cn } from \"@/lib/utils\";\n\ninterface WexioMarkProps {\n /** Pixel size of the rendered square. */\n size?: number;\n className?: string;\n}\n\n/**\n * Wexio brand mark. Used in:\n * - Header chrome (top-left of the widget panel)\n * - Recent-message preview avatar (AI/bot senders without a custom avatar)\n * - Bot-authored chat bubbles\n *\n * Theme-aware: ships two assets that swap via Tailwind's `dark:`\n * variant (which the widget routes through `[data-theme=\"dark\"]`\n * via `@custom-variant dark`).\n * • `logo-dark.png` — dark glyph for light surfaces (light theme)\n * • `logo-light.png` — light glyph for dark surfaces (dark theme)\n * No JS / state — the panel root's `data-theme` attribute drives\n * visibility, so flipping theme mid-session swaps the mark instantly.\n *\n * Plain `<img>` (not `next/image`): the widget ships as a Vite\n * library bundle with no Next runtime, and the asset path routes\n * through `assetUrl` so the React-component embed loads the logo\n * from the widget's CDN instead of the host page's origin.\n */\nexport function WexioMark({ size = 24, className }: WexioMarkProps) {\n return (\n <span\n style={{ width: size, height: size }}\n className={cn(\"relative inline-block\", className)}\n role=\"img\"\n aria-label=\"Wexio\"\n >\n {/* biome-ignore lint/performance/noImgElement: bundled brand asset; next/image's loader isn't available in the web-component / iframe embeds */}\n <img\n src={assetUrl(\"/logo-dark.png\")}\n alt=\"\"\n width={size}\n height={size}\n className=\"block h-full w-full dark:hidden\"\n />\n {/* biome-ignore lint/performance/noImgElement: bundled brand asset; next/image's loader isn't available in the web-component / iframe embeds */}\n <img\n src={assetUrl(\"/logo-light.png\")}\n alt=\"\"\n width={size}\n height={size}\n className=\"hidden h-full w-full dark:block\"\n />\n </span>\n );\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { AI_ASSISTANT_NAME } from \"@/lib/ai-assistant\";\nimport { useVisitorChatRecentInboundQuery } from \"@/lib/graphql/queries/generated/messaging.generated\";\nimport { stripHtml } from \"@/lib/strip-html\";\nimport type { HomeBlock, WidgetConfig, WidgetTab } from \"@/lib/widget-config\";\nimport { WexioMark } from \"../../icons/wexio-mark\";\nimport { formatRelativeTime } from \"../helpers\";\n\nexport function RecentMessageBlock({\n block,\n onOpenTab,\n isDummy,\n chatId,\n config,\n}: {\n block: Extract<HomeBlock, { kind: \"recent-message\" }>;\n onOpenTab: (tab: WidgetTab) => void;\n isDummy: boolean;\n chatId: string | null;\n config: WidgetConfig;\n}) {\n const t = useTranslations(\"home\");\n\n // Live mode — fetch the visitor's latest inbound (operator/bot/AI)\n // message. Skip the query when there's no chat yet (anonymous visitor\n // hasn't authed) and hide the block to avoid the empty rectangle.\n const { data, loading } = useVisitorChatRecentInboundQuery({\n variables: { chatId: chatId ?? \"\" },\n skip: isDummy || !chatId,\n // cache-first via the apollo defaults — the shell-level SSE pump\n // writes new inbounds straight into this query's cache slot, so\n // there's no need to re-fetch on every block mount.\n });\n\n if (!isDummy) {\n if (!chatId || loading) return null;\n const msg = data?.visitorChatRecentInbound;\n if (!msg) return null;\n\n // AI / bot senders display as AI_ASSISTANT_NAME regardless of what the BE\n // labels them (\"Bot\", \"WEB widget\", an internal handle, …) — same\n // convention used in the conversation bubble + typing indicator.\n // Operator senders flow through unchanged. Avatar for AI/bot uses\n // the operator-configured `messenger.aiAssistantAvatar`; when\n // unset, render no avatar at all (no \"B\" monogram fallback for\n // bot — that read as broken).\n const isAi = msg.sender?.kind === \"ai\" || msg.sender?.kind === \"bot\";\n const displayName = isAi\n ? AI_ASSISTANT_NAME\n : msg.sender?.name?.trim() || t(\"recentMessageFromFallback\");\n const avatarUrl = isAi\n ? (config.messenger?.aiAssistantAvatar ?? null)\n : (msg.sender?.avatar ?? null);\n\n return (\n <button\n type=\"button\"\n onClick={() => onOpenTab(\"messages\")}\n className=\"flex w-full flex-col gap-3 rounded-wx-lg bg-wx-bg-elevated px-4 py-3.5 text-left transition-colors hover:bg-wx-bg-elevated-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary\"\n >\n <p className=\"text-sm text-wx-fg-muted\">{block.title?.trim() || t(\"recentMessageTitle\")}</p>\n <div className=\"flex items-start gap-3\">\n {avatarUrl ? (\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-full bg-wx-bg\">\n {/* biome-ignore lint/performance/noImgElement: operator/sender avatar of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img\n src={avatarUrl}\n alt={displayName}\n className=\"h-9 w-9 rounded-full object-cover\"\n />\n </span>\n ) : isAi ? // AI/bot with no operator-configured avatar → reserve no\n // gutter so the text reads flush, matching the\n // explicit-opt-in shape used elsewhere for AI avatars.\n null : (\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-full bg-wx-bg\">\n <span className=\"text-sm font-semibold text-wx-fg-muted\">\n {displayName.charAt(0).toUpperCase()}\n </span>\n </span>\n )}\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <p className=\"truncate text-sm font-semibold text-wx-fg\">{displayName}</p>\n <span className=\"shrink-0 text-xs text-wx-fg-subtle\">\n {formatRelativeTime(msg.createdAt)}\n </span>\n </div>\n <p className=\"mt-0.5 line-clamp-2 text-sm text-wx-fg-muted\">{stripHtml(msg.text)}</p>\n </div>\n </div>\n </button>\n );\n }\n\n // Demo mode — bundled sample.\n return (\n <button\n type=\"button\"\n onClick={() => onOpenTab(\"messages\")}\n className=\"flex w-full flex-col gap-3 rounded-wx-lg bg-wx-bg-elevated px-4 py-3.5 text-left transition-colors hover:bg-wx-bg-elevated-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary\"\n >\n <p className=\"text-sm text-wx-fg-muted\">{block.title?.trim() || t(\"recentMessageTitle\")}</p>\n <div className=\"flex items-start gap-3\">\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-full bg-wx-bg\">\n <WexioMark size={36} />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <p className=\"truncate text-sm font-semibold text-wx-fg\">\n {t(\"recentMessageFromFallback\")}\n </p>\n <span className=\"shrink-0 text-xs text-wx-fg-subtle\">{t(\"recentMessageAgo\")}</span>\n </div>\n <p className=\"mt-0.5 line-clamp-2 text-sm text-wx-fg-muted\">{t(\"recentMessageSample\")}</p>\n </div>\n </div>\n </button>\n );\n}\n","import type { HomeBlock } from \"@/lib/widget-config\";\nimport { renderInlineMarkdown } from \"../helpers\";\n\nexport function RichTextBlock({ block }: { block: Extract<HomeBlock, { kind: \"rich-text\" }> }) {\n // Lightweight inline render — bold / italic / links / line breaks.\n // The operator editor sanitises on save; this is a minimal subset\n // renderer (no headings / images / scripts, matching the BE doc's\n // allowlist) so the Home tab doesn't pull the full markdown stack.\n return (\n <div className=\"px-2 text-sm leading-relaxed text-wx-fg-muted [&_a]:text-wx-primary [&_a]:underline\">\n {renderInlineMarkdown(block.markdown)}\n </div>\n );\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { AvatarStack } from \"@/components/ui/avatar\";\nimport type { HomeBlock, WidgetConfig } from \"@/lib/widget-config\";\n\nexport function TeamStatusBlock({\n block,\n config,\n}: {\n block: Extract<HomeBlock, { kind: \"team-status\" }>;\n config: WidgetConfig;\n}) {\n const t = useTranslations(\"home\");\n return (\n <div className=\"flex items-center gap-3 rounded-wx-lg bg-wx-bg-elevated px-3.5 py-3\">\n <span aria-hidden=\"true\" className=\"h-2 w-2 shrink-0 rounded-full bg-wx-success\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold text-wx-fg\">{t(\"teamStatusOnline\")}</p>\n {block.showResponseTime && (\n <p className=\"text-xs text-wx-fg-muted\">{t(\"teamStatusReplyTime\")}</p>\n )}\n </div>\n {block.showOperatorAvatars && config.operatorAvatars.length > 0 && (\n <AvatarStack avatars={config.operatorAvatars} size=\"sm\" ringClass=\"ring-wx-bg-elevated\" />\n )}\n </div>\n );\n}\n","\"use client\";\n\nimport { motion } from \"motion/react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type { HomeBlock, WidgetConfig, WidgetTab } from \"@/lib/widget-config\";\nimport { AskQuestionBlock } from \"./blocks/ask-question\";\nimport { FeaturedArticleBlock } from \"./blocks/featured-article\";\nimport { HelpSearchBlock } from \"./blocks/help-search\";\nimport { NewsPreviewBlock } from \"./blocks/news-preview\";\nimport { PinnedArticlesBlock } from \"./blocks/pinned-articles\";\nimport { QuickActionsBlock } from \"./blocks/quick-actions\";\nimport { RecentMessageBlock } from \"./blocks/recent-message\";\nimport { RichTextBlock } from \"./blocks/rich-text\";\nimport { TeamStatusBlock } from \"./blocks/team-status\";\n\n/**\n * Home-tab block renderer.\n *\n * The Home tab is an operator-configured ordered list of `HomeBlock`s\n * (see `WidgetConfig.homeLayout` / `DEFAULT_HOME_LAYOUT`). This file\n * dispatches that list — one block component per `kind` (see `blocks/`).\n * Unknown kinds are skipped so a newer dashboard can't break an older\n * bundle.\n *\n * Navigation-only v1: blocks that reference Help / News / Messenger\n * content render their structure + a working entry point into the\n * relevant tab. Live per-block data hydration (recent conversations,\n * pinned-article previews, real news rows) is a Phase-2 data layer.\n */\ninterface HomeBlocksProps {\n blocks: HomeBlock[];\n config: WidgetConfig;\n /** Open a top-level tab. v1 Home blocks are navigation-only entry\n * points — they route into Help / News / Messenger rather than\n * hydrating per-block content inline. */\n onOpenTab: (tab: WidgetTab) => void;\n /** Drill into a specific news article by id — used by `featured-article`\n * to open the post detail rather than dumping the visitor on the\n * news list. */\n onOpenNewsArticle?: (id: string) => void;\n /** Drill into a specific help article by slug — used by\n * `pinned-articles` so the visitor lands on the article rather than\n * the help index. */\n onOpenHelpArticle?: (slug: string) => void;\n /** Demo data mode. When `true`, content-rendering blocks (news,\n * conversations) fill with bundled samples so the operator dashboard\n * preview shows a populated widget. When `false`, they fetch real\n * data and hide / show an empty state when none exists. */\n isDummy: boolean;\n /** Authenticated visitor chat id — needed by `recent-message` to query\n * the visitor's latest inbound. `null` when the visitor hasn't auth'd\n * yet (the block hides itself in that state). */\n chatId: string | null;\n}\n\nexport function HomeBlocks({\n blocks,\n config,\n onOpenTab,\n onOpenNewsArticle,\n onOpenHelpArticle,\n isDummy,\n chatId,\n}: HomeBlocksProps) {\n return (\n <div className=\"flex flex-col gap-3 px-4 pb-2\">\n {blocks.map((block, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: blocks are operator-ordered and order-stable\n <Stagger key={`${block.kind}-${i}`} delay={Math.min(i, 6) * 0.05}>\n <HomeBlockView\n block={block}\n config={config}\n onOpenTab={onOpenTab}\n onOpenNewsArticle={onOpenNewsArticle}\n onOpenHelpArticle={onOpenHelpArticle}\n isDummy={isDummy}\n chatId={chatId}\n />\n </Stagger>\n ))}\n </div>\n );\n}\n\nfunction HomeBlockView({\n block,\n config,\n onOpenTab,\n onOpenNewsArticle,\n onOpenHelpArticle,\n isDummy,\n chatId,\n}: {\n block: HomeBlock;\n config: WidgetConfig;\n onOpenTab: (tab: WidgetTab) => void;\n onOpenNewsArticle?: (id: string) => void;\n /** Drill into a specific help article by slug — used by\n * `pinned-articles` so the visitor lands on the article rather than\n * the help index. */\n onOpenHelpArticle?: (slug: string) => void;\n isDummy: boolean;\n chatId: string | null;\n}) {\n switch (block.kind) {\n case \"quick-actions\":\n return <QuickActionsBlock block={block} onOpenTab={onOpenTab} />;\n case \"help-search\":\n return <HelpSearchBlock block={block} onOpenTab={onOpenTab} />;\n case \"pinned-articles\":\n return (\n <PinnedArticlesBlock\n block={block}\n onOpenTab={onOpenTab}\n onOpenArticle={onOpenHelpArticle}\n isDummy={isDummy}\n />\n );\n case \"news-preview\":\n return <NewsPreviewBlock block={block} onOpenTab={onOpenTab} isDummy={isDummy} />;\n case \"team-status\":\n return <TeamStatusBlock block={block} config={config} />;\n case \"rich-text\":\n return <RichTextBlock block={block} />;\n case \"divider\":\n return <hr className=\"my-1 border-wx-border\" />;\n case \"ask-question\":\n return <AskQuestionBlock block={block} config={config} onOpenTab={onOpenTab} />;\n case \"recent-message\":\n return (\n <RecentMessageBlock\n block={block}\n onOpenTab={onOpenTab}\n isDummy={isDummy}\n chatId={chatId}\n config={config}\n />\n );\n case \"featured-article\":\n return (\n <FeaturedArticleBlock\n block={block}\n onOpenTab={onOpenTab}\n onOpenNewsArticle={onOpenNewsArticle}\n isDummy={isDummy}\n />\n );\n default:\n // Unknown kind from a newer dashboard — skip gracefully.\n return null;\n }\n}\n\nfunction Stagger({\n delay,\n children,\n className,\n}: {\n delay: number;\n children: ReactNode;\n className?: string;\n}) {\n return (\n <motion.div\n initial={{ opacity: 0, y: 8 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ duration: 0.24, delay, ease: \"easeOut\" }}\n className={cn(className)}\n >\n {children}\n </motion.div>\n );\n}\n\n/**\n * Drop blocks that depend on a disabled feature — `help-search` /\n * `pinned-articles` when Help is off, `news-preview` when News is off.\n * Keeps the operator from shipping dead entry points.\n */\nexport function filterHomeBlocks(\n blocks: HomeBlock[],\n features: WidgetConfig[\"features\"],\n): HomeBlock[] {\n return blocks.filter((b) => {\n if ((b.kind === \"help-search\" || b.kind === \"pinned-articles\") && !features.help) {\n return false;\n }\n if (b.kind === \"news-preview\" && !features.news) return false;\n return true;\n });\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { AvatarStack } from \"@/components/ui/avatar\";\nimport { Button } from \"@/components/ui/button\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport { XIcon, type XIconHandle } from \"@/components/widget/icons/animated\";\nimport { useIconHover } from \"@/lib/use-icon-hover\";\nimport { DEFAULT_HOME_LAYOUT, type WidgetConfig, type WidgetTab } from \"@/lib/widget-config\";\nimport { filterHomeBlocks, HomeBlocks } from \"../home-blocks\";\nimport { WexioMark } from \"../icons/wexio-mark\";\n\ninterface HomeTabProps {\n config: WidgetConfig;\n /** Operator logo, already resolved to a single URL by the shell\n * (`config.organizationLogo` is per-mode; the shell collapses it\n * against the active theme mode). `null` → framed Wexio mark. */\n organizationLogoUrl: string | null;\n onClose: () => void;\n /** Open a top-level tab — Home blocks route into Messenger / Help /\n * News rather than hydrating their content inline. */\n onOpenTab: (tab: WidgetTab) => void;\n /** Demo data mode — threaded to content-rendering blocks (news, etc.)\n * so they pick between bundled samples and real BE data. */\n isDummy: boolean;\n /** Authenticated visitor chat id. `null` when the visitor hasn't\n * auth'd yet — chat-bound blocks (`recent-message`) hide in that\n * state. */\n chatId: string | null;\n /** Drill into a specific news article — `featured-article` calls this\n * when the operator-picked post resolves. */\n onOpenNewsArticle?: (id: string) => void;\n /** Drill into a specific help article by slug — `pinned-articles`\n * calls this when the operator-picked row resolves. */\n onOpenHelpArticle?: (slug: string) => void;\n}\n\n/**\n * Home tab — an operator-configured ordered list of blocks\n * (`config.homeLayout`, falling back to `DEFAULT_HOME_LAYOUT`).\n *\n * The header (logo + operator avatars + close) is fixed chrome and\n * scrolls away with content; everything below it is block-driven and\n * rendered by `<HomeBlocks>`. Blocks that depend on a disabled feature\n * are dropped via `filterHomeBlocks`.\n */\nexport function HomeTab({\n config,\n organizationLogoUrl,\n onClose,\n onOpenTab,\n isDummy,\n chatId,\n onOpenNewsArticle,\n onOpenHelpArticle,\n}: HomeTabProps) {\n const tHeader = useTranslations(\"header\");\n const closeHover = useIconHover<XIconHandle>();\n\n const blocks = filterHomeBlocks(config.homeLayout ?? DEFAULT_HOME_LAYOUT, config.features);\n\n // Greeting can be omitted entirely (operator set both lines empty).\n // Mirror the Greeting component's render guard here so we can lift\n // the first block off the header chrome — without the greeting the\n // blocks otherwise sit flush under the close/avatar row.\n // Demo always shows the localised default greeting; real mode only\n // when the operator configured a line. Mirror the `Greeting` guard.\n const hasGreeting =\n isDummy || !!config.greeting?.headline?.trim() || !!config.greeting?.subheadline?.trim();\n\n return (\n <ScrollArea className=\"flex-1\">\n <div className=\"flex flex-col pb-6\">\n {/* Inline header — scrolls away with content. The Wexio mark is\n ONLY a demo-mode placeholder so the marketing/Storybook view\n never paints a blank left chrome; in live mode an empty logo\n slot stays empty (operator hasn't uploaded one yet). */}\n <div className=\"flex items-center justify-between px-5 pt-5 pb-3\">\n {organizationLogoUrl ? (\n // biome-ignore lint/performance/noImgElement: uploaded image of arbitrary host/dimensions; next/image needs known sizes + an allowlist\n <img\n src={organizationLogoUrl}\n alt={config.messenger?.title ?? \"\"}\n className=\"h-9 w-auto max-w-[140px] object-contain\"\n />\n ) : isDummy ? (\n <WexioMark size={28} />\n ) : (\n <span className=\"h-9\" aria-hidden=\"true\" />\n )}\n <div className=\"flex items-center gap-1\">\n {config.operatorAvatars.length > 0 && (\n <AvatarStack\n avatars={config.operatorAvatars}\n ringClass=\"ring-wx-bg-elevated/60\"\n className=\"mr-2\"\n />\n )}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={tHeader(\"close\")}\n onClick={onClose}\n {...closeHover.parentHandlers}\n >\n <XIcon ref={closeHover.iconRef} size={18} />\n </Button>\n </div>\n </div>\n\n {/* Greeting — driven by the operator's `greeting.{headline,\n subheadline}` config. When the operator has set NEITHER\n field, the section is omitted entirely (no i18n placeholder\n fallback) so an unconfigured home tab doesn't surface a\n generic \"Hi there 👋 / How can we help?\" as if it were the\n operator's copy. */}\n <Greeting config={config} isDummy={isDummy} />\n\n <div className={hasGreeting ? undefined : \"pt-4\"}>\n <HomeBlocks\n blocks={blocks}\n config={config}\n onOpenTab={onOpenTab}\n onOpenNewsArticle={onOpenNewsArticle}\n onOpenHelpArticle={onOpenHelpArticle}\n isDummy={isDummy}\n chatId={chatId}\n />\n </div>\n </div>\n </ScrollArea>\n );\n}\n\nfunction Greeting({ config, isDummy }: { config: WidgetConfig; isDummy: boolean }) {\n const t = useTranslations(\"home\");\n // Demo: show the LOCALISED default greeting (the demo config's\n // hardcoded English is only a placeholder, so it followed the widget\n // locale into Ukrainian etc.). Real: the operator's configured\n // greeting, or nothing when they set neither line.\n const headline = isDummy ? t(\"greetingHeadline\") : (config.greeting?.headline?.trim() ?? \"\");\n const subheadline = isDummy\n ? t(\"greetingSubheadline\")\n : (config.greeting?.subheadline?.trim() ?? \"\");\n // Operator hasn't configured either line — render nothing so the\n // home tab doesn't show a generic placeholder as if it were their\n // copy. The home gradient backdrop already carries enough visual\n // weight to anchor the top of the panel without the heading.\n if (!headline && !subheadline) return null;\n return (\n <section className=\"px-5 pt-2 pb-4\">\n {headline && <p className=\"text-3xl leading-tight font-bold text-wx-fg-muted\">{headline}</p>}\n {subheadline && (\n <p className=\"mt-1 text-3xl leading-tight font-bold text-wx-fg\">{subheadline}</p>\n )}\n </section>\n );\n}\n","/**\n * Convert a `File` to a base64-encoded string suitable for the BE's\n * `uploadVisitorMedia` mutation. Strips the `data:<mime>;base64,`\n * prefix the FileReader emits — the BE wants raw base64 bytes only.\n *\n * Returns the decoded byte count alongside the payload so the\n * caller can check it against `WEB_UPLOAD_MAX_BYTES` (10 MB on the\n * BE) BEFORE invoking the mutation. A short-circuit at the FE saves\n * a 1 MB+ network round-trip on oversized files.\n */\nexport async function fileToBase64(file: File): Promise<{\n base64: string;\n size: number;\n}> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n const result = reader.result;\n if (typeof result !== \"string\") {\n reject(new Error(\"FileReader returned non-string result\"));\n return;\n }\n // `result` is `data:<mime>;base64,<payload>` — strip the prefix.\n const comma = result.indexOf(\",\");\n const payload = comma >= 0 ? result.slice(comma + 1) : result;\n resolve({ base64: payload, size: file.size });\n };\n reader.onerror = () => reject(reader.error ?? new Error(\"File read failed\"));\n reader.readAsDataURL(file);\n });\n}\n\n/** Mime allowlist — must match the BE's `WebUploadService.ALLOWED_MIMES`.\n * Keeping these in lockstep prevents the FE from picking a file the\n * BE will reject. */\nexport const ALLOWED_UPLOAD_MIMES = new Set<string>([\n \"image/png\",\n \"image/jpeg\",\n \"image/gif\",\n \"image/webp\",\n \"audio/mpeg\",\n \"audio/ogg\",\n \"audio/webm\",\n \"video/mp4\",\n \"application/pdf\",\n]);\n\n/** 10 MB — matches the BE's `MAX_UPLOAD_BYTES`. */\nexport const MAX_UPLOAD_BYTES = 10 * 1024 * 1024;\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { useEffect, useRef } from \"react\";\n\nconst GIS_SCRIPT_SRC = \"https://accounts.google.com/gsi/client\";\n\n/**\n * Minimal subset of the Google Identity Services API the widget uses.\n * Typed inline so we don't take a dependency on `@types/google.accounts`\n * just for two function signatures.\n */\ninterface GoogleCredentialResponse {\n credential: string;\n select_by?: string;\n clientId?: string;\n}\ninterface GoogleIdConfiguration {\n client_id: string;\n callback: (resp: GoogleCredentialResponse) => void;\n auto_select?: boolean;\n cancel_on_tap_outside?: boolean;\n ux_mode?: \"popup\" | \"redirect\";\n}\ninterface GoogleButtonOptions {\n type?: \"standard\" | \"icon\";\n theme?: \"outline\" | \"filled_blue\" | \"filled_black\";\n size?: \"large\" | \"medium\" | \"small\";\n text?: \"signin_with\" | \"signup_with\" | \"continue_with\" | \"signin\";\n shape?: \"rectangular\" | \"pill\" | \"circle\" | \"square\";\n width?: string | number;\n}\ndeclare global {\n interface Window {\n google?: {\n accounts: {\n id: {\n initialize: (config: GoogleIdConfiguration) => void;\n renderButton: (parent: HTMLElement, options: GoogleButtonOptions) => void;\n prompt: () => void;\n cancel: () => void;\n };\n };\n };\n }\n}\n\ninterface GoogleSignInButtonProps {\n /** Operator's Google OAuth client_id — PUBLIC by design (same one\n * the operator embeds on their main-site Google login). The BE\n * verifies `id_token.aud === clientId` on `startIdentifiedVisitor`,\n * so a leaked clientId can't be abused (Google's allowlist + BE\n * audience check are the actual security boundaries). */\n clientId: string;\n /** Called with the Google `id_token` when the visitor completes the\n * popup. Caller routes it through `Wexio('identify',\n * { googleIdToken })` → `startIdentifiedVisitor`. */\n onCredential: (idToken: string) => void;\n}\n\n/**\n * \"Sign in with Google\" — custom-styled button that triggers the\n * native Google Identity Services popup under the hood.\n *\n * We can't render a TRULY-custom OAuth flow for ID Tokens (Google\n * doesn't expose `initTokenClient` for id_tokens — only access\n * tokens), so the standard pattern is:\n *\n * 1. Initialise GIS with the operator's `clientId` + a callback.\n * 2. Render Google's own `renderButton` into an OFFSCREEN mount.\n * Visitor never sees it; the DOM node + handlers exist.\n * 3. Our visible button (styled to match the passkey button so the\n * auth gate looks coherent) `click()`s the offscreen GIS button\n * programmatically. GIS runs its full popup flow → id_token\n * back through our callback.\n *\n * Gives us full visual control over the gate while keeping all the\n * GIS auth UX (popup, account chooser, FedCM, cancellation) intact.\n * Lazy-loads `accounts.google.com/gsi/client` on first mount so\n * non-Google-enabled embeds pay zero network cost.\n */\nexport function GoogleSignInButton({ clientId, onCredential }: GoogleSignInButtonProps) {\n const t = useTranslations(\"messages\");\n const hiddenMountRef = useRef<HTMLDivElement | null>(null);\n // Latest callback in a ref so the GIS initialize closure stays\n // wired to the CURRENT onCredential even if the parent re-renders.\n const onCredentialRef = useRef(onCredential);\n useEffect(() => {\n onCredentialRef.current = onCredential;\n }, [onCredential]);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n let cancelled = false;\n\n const initAndRender = () => {\n if (cancelled) return;\n const g = window.google?.accounts?.id;\n const mount = hiddenMountRef.current;\n if (!g || !mount) return;\n g.initialize({\n client_id: clientId,\n callback: (resp) => {\n if (resp?.credential) onCredentialRef.current(resp.credential);\n },\n auto_select: false,\n cancel_on_tap_outside: true,\n ux_mode: \"popup\",\n });\n // Clear any prior render (clientId change across HMR cycles).\n mount.replaceChildren();\n g.renderButton(mount, {\n type: \"standard\",\n theme: \"outline\",\n size: \"large\",\n // Width is required for renderButton to actually emit the\n // inner div[role=\"button\"] our click-proxy targets below.\n width: 200,\n });\n };\n\n if (window.google?.accounts?.id) {\n initAndRender();\n return () => {\n cancelled = true;\n };\n }\n\n const existing = document.querySelector<HTMLScriptElement>(`script[src=\"${GIS_SCRIPT_SRC}\"]`);\n if (existing) {\n existing.addEventListener(\"load\", initAndRender, { once: true });\n return () => {\n cancelled = true;\n existing.removeEventListener(\"load\", initAndRender);\n };\n }\n\n const script = document.createElement(\"script\");\n script.src = GIS_SCRIPT_SRC;\n script.async = true;\n script.defer = true;\n script.onload = initAndRender;\n document.head.appendChild(script);\n\n return () => {\n cancelled = true;\n script.onload = null;\n };\n }, [clientId]);\n\n const handleClick = () => {\n const mount = hiddenMountRef.current;\n if (!mount) return;\n // GIS renders an interactive div[role=\"button\"] inside the mount.\n // Proxy our visible-button click to it so the visitor sees our\n // brand-tokenised UI while Google's popup flow runs as it would\n // from its own button.\n const gisButton = mount.querySelector<HTMLElement>('div[role=\"button\"]');\n gisButton?.click();\n };\n\n return (\n <>\n <button\n type=\"button\"\n onClick={handleClick}\n className=\"flex w-full items-center justify-center gap-2 rounded-wx border border-wx-border bg-wx-bg-elevated px-4 py-2 text-sm font-medium text-wx-fg transition-colors hover:bg-wx-bg-elevated-2\"\n >\n <GoogleGlyph />\n <span>{t(\"googleSignIn\")}</span>\n </button>\n {/* Offscreen mount for the real GIS button — kept out of the\n accessibility tree and the layout flow. Visually-hidden\n pattern (not `display:none`, which prevents GIS from\n measuring + rendering). */}\n <div\n ref={hiddenMountRef}\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n width: 1,\n height: 1,\n overflow: \"hidden\",\n clip: \"rect(0 0 0 0)\",\n clipPath: \"inset(50%)\",\n whiteSpace: \"nowrap\",\n }}\n />\n </>\n );\n}\n\n/** Inline SVG of Google's \"G\" mark — keeps the button self-contained\n * (no extra image fetch, no bundle hit beyond a handful of paths). */\nfunction GoogleGlyph() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 18 18\" aria-hidden=\"true\">\n <path\n d=\"M17.64 9.205c0-.639-.057-1.252-.164-1.841H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.258h2.908c1.702-1.567 2.684-3.875 2.684-6.614z\"\n fill=\"#4285F4\"\n />\n <path\n d=\"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18z\"\n fill=\"#34A853\"\n />\n <path\n d=\"M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z\"\n fill=\"#FBBC05\"\n />\n <path\n d=\"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z\"\n fill=\"#EA4335\"\n />\n </svg>\n );\n}\n","/* [@simplewebauthn/browser@9.0.1] */\nfunction utf8StringToBuffer(value) {\n return new TextEncoder().encode(value);\n}\n\nfunction bufferToBase64URLString(buffer) {\n const bytes = new Uint8Array(buffer);\n let str = '';\n for (const charCode of bytes) {\n str += String.fromCharCode(charCode);\n }\n const base64String = btoa(str);\n return base64String.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n}\n\nfunction base64URLStringToBuffer(base64URLString) {\n const base64 = base64URLString.replace(/-/g, '+').replace(/_/g, '/');\n const padLength = (4 - (base64.length % 4)) % 4;\n const padded = base64.padEnd(base64.length + padLength, '=');\n const binary = atob(padded);\n const buffer = new ArrayBuffer(binary.length);\n const bytes = new Uint8Array(buffer);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return buffer;\n}\n\nfunction browserSupportsWebAuthn() {\n return (window?.PublicKeyCredential !== undefined &&\n typeof window.PublicKeyCredential === 'function');\n}\n\nfunction toPublicKeyCredentialDescriptor(descriptor) {\n const { id } = descriptor;\n return {\n ...descriptor,\n id: base64URLStringToBuffer(id),\n transports: descriptor.transports,\n };\n}\n\nfunction isValidDomain(hostname) {\n return (hostname === 'localhost' ||\n /^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}$/i.test(hostname));\n}\n\nclass WebAuthnError extends Error {\n constructor({ message, code, cause, name, }) {\n super(message, { cause });\n this.name = name ?? cause.name;\n this.code = code;\n }\n}\n\nfunction identifyRegistrationError({ error, options, }) {\n const { publicKey } = options;\n if (!publicKey) {\n throw Error('options was missing required publicKey property');\n }\n if (error.name === 'AbortError') {\n if (options.signal instanceof AbortSignal) {\n return new WebAuthnError({\n message: 'Registration ceremony was sent an abort signal',\n code: 'ERROR_CEREMONY_ABORTED',\n cause: error,\n });\n }\n }\n else if (error.name === 'ConstraintError') {\n if (publicKey.authenticatorSelection?.requireResidentKey === true) {\n return new WebAuthnError({\n message: 'Discoverable credentials were required but no available authenticator supported it',\n code: 'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',\n cause: error,\n });\n }\n else if (publicKey.authenticatorSelection?.userVerification === 'required') {\n return new WebAuthnError({\n message: 'User verification was required but no available authenticator supported it',\n code: 'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',\n cause: error,\n });\n }\n }\n else if (error.name === 'InvalidStateError') {\n return new WebAuthnError({\n message: 'The authenticator was previously registered',\n code: 'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',\n cause: error,\n });\n }\n else if (error.name === 'NotAllowedError') {\n return new WebAuthnError({\n message: error.message,\n code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',\n cause: error,\n });\n }\n else if (error.name === 'NotSupportedError') {\n const validPubKeyCredParams = publicKey.pubKeyCredParams.filter((param) => param.type === 'public-key');\n if (validPubKeyCredParams.length === 0) {\n return new WebAuthnError({\n message: 'No entry in pubKeyCredParams was of type \"public-key\"',\n code: 'ERROR_MALFORMED_PUBKEYCREDPARAMS',\n cause: error,\n });\n }\n return new WebAuthnError({\n message: 'No available authenticator supported any of the specified pubKeyCredParams algorithms',\n code: 'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',\n cause: error,\n });\n }\n else if (error.name === 'SecurityError') {\n const effectiveDomain = window.location.hostname;\n if (!isValidDomain(effectiveDomain)) {\n return new WebAuthnError({\n message: `${window.location.hostname} is an invalid domain`,\n code: 'ERROR_INVALID_DOMAIN',\n cause: error,\n });\n }\n else if (publicKey.rp.id !== effectiveDomain) {\n return new WebAuthnError({\n message: `The RP ID \"${publicKey.rp.id}\" is invalid for this domain`,\n code: 'ERROR_INVALID_RP_ID',\n cause: error,\n });\n }\n }\n else if (error.name === 'TypeError') {\n if (publicKey.user.id.byteLength < 1 || publicKey.user.id.byteLength > 64) {\n return new WebAuthnError({\n message: 'User ID was not between 1 and 64 characters',\n code: 'ERROR_INVALID_USER_ID_LENGTH',\n cause: error,\n });\n }\n }\n else if (error.name === 'UnknownError') {\n return new WebAuthnError({\n message: 'The authenticator was unable to process the specified options, or could not create a new credential',\n code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',\n cause: error,\n });\n }\n return error;\n}\n\nclass BaseWebAuthnAbortService {\n createNewAbortSignal() {\n if (this.controller) {\n const abortError = new Error('Cancelling existing WebAuthn API call for new one');\n abortError.name = 'AbortError';\n this.controller.abort(abortError);\n }\n const newController = new AbortController();\n this.controller = newController;\n return newController.signal;\n }\n cancelCeremony() {\n if (this.controller) {\n const abortError = new Error('Manually cancelling existing WebAuthn API call');\n abortError.name = 'AbortError';\n this.controller.abort(abortError);\n this.controller = undefined;\n }\n }\n}\nconst WebAuthnAbortService = new BaseWebAuthnAbortService();\n\nconst attachments = ['cross-platform', 'platform'];\nfunction toAuthenticatorAttachment(attachment) {\n if (!attachment) {\n return;\n }\n if (attachments.indexOf(attachment) < 0) {\n return;\n }\n return attachment;\n}\n\nasync function startRegistration(creationOptionsJSON) {\n if (!browserSupportsWebAuthn()) {\n throw new Error('WebAuthn is not supported in this browser');\n }\n const publicKey = {\n ...creationOptionsJSON,\n challenge: base64URLStringToBuffer(creationOptionsJSON.challenge),\n user: {\n ...creationOptionsJSON.user,\n id: utf8StringToBuffer(creationOptionsJSON.user.id),\n },\n excludeCredentials: creationOptionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor),\n };\n const options = { publicKey };\n options.signal = WebAuthnAbortService.createNewAbortSignal();\n let credential;\n try {\n credential = (await navigator.credentials.create(options));\n }\n catch (err) {\n throw identifyRegistrationError({ error: err, options });\n }\n if (!credential) {\n throw new Error('Registration was not completed');\n }\n const { id, rawId, response, type } = credential;\n let transports = undefined;\n if (typeof response.getTransports === 'function') {\n transports = response.getTransports();\n }\n let responsePublicKeyAlgorithm = undefined;\n if (typeof response.getPublicKeyAlgorithm === 'function') {\n try {\n responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();\n }\n catch (error) {\n warnOnBrokenImplementation('getPublicKeyAlgorithm()', error);\n }\n }\n let responsePublicKey = undefined;\n if (typeof response.getPublicKey === 'function') {\n try {\n const _publicKey = response.getPublicKey();\n if (_publicKey !== null) {\n responsePublicKey = bufferToBase64URLString(_publicKey);\n }\n }\n catch (error) {\n warnOnBrokenImplementation('getPublicKey()', error);\n }\n }\n let responseAuthenticatorData;\n if (typeof response.getAuthenticatorData === 'function') {\n try {\n responseAuthenticatorData = bufferToBase64URLString(response.getAuthenticatorData());\n }\n catch (error) {\n warnOnBrokenImplementation('getAuthenticatorData()', error);\n }\n }\n return {\n id,\n rawId: bufferToBase64URLString(rawId),\n response: {\n attestationObject: bufferToBase64URLString(response.attestationObject),\n clientDataJSON: bufferToBase64URLString(response.clientDataJSON),\n transports,\n publicKeyAlgorithm: responsePublicKeyAlgorithm,\n publicKey: responsePublicKey,\n authenticatorData: responseAuthenticatorData,\n },\n type,\n clientExtensionResults: credential.getClientExtensionResults(),\n authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),\n };\n}\nfunction warnOnBrokenImplementation(methodName, cause) {\n console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.\\n`, cause);\n}\n\nfunction bufferToUTF8String(value) {\n return new TextDecoder('utf-8').decode(value);\n}\n\nfunction browserSupportsWebAuthnAutofill() {\n const globalPublicKeyCredential = window\n .PublicKeyCredential;\n if (globalPublicKeyCredential.isConditionalMediationAvailable === undefined) {\n return new Promise((resolve) => resolve(false));\n }\n return globalPublicKeyCredential.isConditionalMediationAvailable();\n}\n\nfunction identifyAuthenticationError({ error, options, }) {\n const { publicKey } = options;\n if (!publicKey) {\n throw Error('options was missing required publicKey property');\n }\n if (error.name === 'AbortError') {\n if (options.signal instanceof AbortSignal) {\n return new WebAuthnError({\n message: 'Authentication ceremony was sent an abort signal',\n code: 'ERROR_CEREMONY_ABORTED',\n cause: error,\n });\n }\n }\n else if (error.name === 'NotAllowedError') {\n return new WebAuthnError({\n message: error.message,\n code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',\n cause: error,\n });\n }\n else if (error.name === 'SecurityError') {\n const effectiveDomain = window.location.hostname;\n if (!isValidDomain(effectiveDomain)) {\n return new WebAuthnError({\n message: `${window.location.hostname} is an invalid domain`,\n code: 'ERROR_INVALID_DOMAIN',\n cause: error,\n });\n }\n else if (publicKey.rpId !== effectiveDomain) {\n return new WebAuthnError({\n message: `The RP ID \"${publicKey.rpId}\" is invalid for this domain`,\n code: 'ERROR_INVALID_RP_ID',\n cause: error,\n });\n }\n }\n else if (error.name === 'UnknownError') {\n return new WebAuthnError({\n message: 'The authenticator was unable to process the specified options, or could not create a new assertion signature',\n code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',\n cause: error,\n });\n }\n return error;\n}\n\nasync function startAuthentication(requestOptionsJSON, useBrowserAutofill = false) {\n if (!browserSupportsWebAuthn()) {\n throw new Error('WebAuthn is not supported in this browser');\n }\n let allowCredentials;\n if (requestOptionsJSON.allowCredentials?.length !== 0) {\n allowCredentials = requestOptionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor);\n }\n const publicKey = {\n ...requestOptionsJSON,\n challenge: base64URLStringToBuffer(requestOptionsJSON.challenge),\n allowCredentials,\n };\n const options = {};\n if (useBrowserAutofill) {\n if (!(await browserSupportsWebAuthnAutofill())) {\n throw Error('Browser does not support WebAuthn autofill');\n }\n const eligibleInputs = document.querySelectorAll('input[autocomplete$=\\'webauthn\\']');\n if (eligibleInputs.length < 1) {\n throw Error('No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected');\n }\n options.mediation = 'conditional';\n publicKey.allowCredentials = [];\n }\n options.publicKey = publicKey;\n options.signal = WebAuthnAbortService.createNewAbortSignal();\n let credential;\n try {\n credential = (await navigator.credentials.get(options));\n }\n catch (err) {\n throw identifyAuthenticationError({ error: err, options });\n }\n if (!credential) {\n throw new Error('Authentication was not completed');\n }\n const { id, rawId, response, type } = credential;\n let userHandle = undefined;\n if (response.userHandle) {\n userHandle = bufferToUTF8String(response.userHandle);\n }\n return {\n id,\n rawId: bufferToBase64URLString(rawId),\n response: {\n authenticatorData: bufferToBase64URLString(response.authenticatorData),\n clientDataJSON: bufferToBase64URLString(response.clientDataJSON),\n signature: bufferToBase64URLString(response.signature),\n userHandle,\n },\n type,\n clientExtensionResults: credential.getClientExtensionResults(),\n authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),\n };\n}\n\nfunction platformAuthenticatorIsAvailable() {\n if (!browserSupportsWebAuthn()) {\n return new Promise((resolve) => resolve(false));\n }\n return PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();\n}\n\nexport { WebAuthnAbortService, WebAuthnError, base64URLStringToBuffer, browserSupportsWebAuthn, browserSupportsWebAuthnAutofill, bufferToBase64URLString, platformAuthenticatorIsAvailable, startAuthentication, startRegistration };\n","\"use client\";\n\nimport { gql, useMutation } from \"@apollo/client\";\nimport {\n browserSupportsWebAuthn,\n startAuthentication,\n startRegistration,\n} from \"@simplewebauthn/browser\";\nimport { useCallback, useState } from \"react\";\nimport { setVisitorToken } from \"./apollo-client\";\n\n/**\n * Visitor passkey (WebAuthn) sign-in — the public-site counterpart to\n * the host-token / Google flows in {@link useVisitorAuth}.\n *\n * **Why this lives outside `useVisitorAuth`.** Passkey is a TWO-STEP\n * ceremony (options → browser prompt → verify), not a single identity\n * token, and the BE's verify mutation already returns a full visitor\n * session. So we run the whole ceremony here and, on success, stamp the\n * returned token into Apollo's auth slot ({@link setVisitorToken}) and\n * hand the session up to the shell — which adopts it as a verified\n * session override. (The renewal story matches Google's: the proof is\n * spent once; a silent re-handshake can't replay a WebAuthn assertion,\n * so the session degrades to anonymous on expiry until the visitor\n * signs in again. Tracked as renewal hardening in WEB_AUTHENTICATION.md.)\n *\n * **GraphQL inline, not codegen.** The four passkey mutations are\n * declared with `gql` here rather than in `*.graphql` so they don't\n * require a codegen run (which needs a live BE) to ship — the rest of\n * the widget's typed operations stay codegen-driven.\n *\n * **RP = the embedding origin.** We pass `window.location.origin`; the\n * BE validates it against the integration's allow-list and derives the\n * RP id from it. Works in the in-page embeds (web-component /\n * react-component share the host origin); the cross-origin iframe embed\n * needs the host to delegate the `publickey-credentials-*` permission\n * policy (see WEB_AUTHENTICATION.md).\n */\n\n/** The visitor session a verified passkey ceremony yields — same shape\n * the host-token / Google handshakes return. */\nexport interface PasskeySessionResult {\n token: string;\n expiresIn: number;\n chatId: string;\n peopleId: string;\n displayName: string;\n /** `'identified'` on success — drives the shell's `verified` UI. */\n kind: string;\n}\n\n// Exported for the hook's unit test (MockedProvider matches on the\n// parsed document); not part of the public API otherwise.\nexport const PASSKEY_REG_OPTIONS = gql`\n mutation VisitorPasskeyRegistrationOptions($input: VisitorPasskeyOptionsInput!) {\n visitorPasskeyRegistrationOptions(input: $input) {\n sessionId\n optionsJson\n }\n }\n`;\n\nexport const PASSKEY_REG_VERIFY = gql`\n mutation VerifyVisitorPasskeyRegistration($input: VisitorPasskeyVerifyInput!) {\n verifyVisitorPasskeyRegistration(input: $input) {\n token\n expiresIn\n chatId\n peopleId\n kind\n displayName\n shortHandle\n }\n }\n`;\n\nexport const PASSKEY_AUTH_OPTIONS = gql`\n mutation VisitorPasskeyAuthenticationOptions($input: VisitorPasskeyOptionsInput!) {\n visitorPasskeyAuthenticationOptions(input: $input) {\n sessionId\n optionsJson\n }\n }\n`;\n\nexport const PASSKEY_AUTH_VERIFY = gql`\n mutation VerifyVisitorPasskeyAuthentication($input: VisitorPasskeyVerifyInput!) {\n verifyVisitorPasskeyAuthentication(input: $input) {\n token\n expiresIn\n chatId\n peopleId\n kind\n displayName\n shortHandle\n }\n }\n`;\n\ntype OptionsResult = { sessionId: string; optionsJson: string };\n\nexport type PasskeyStatus = \"idle\" | \"busy\" | \"error\";\n\nexport interface UsePasskeyAuth {\n /** Sign in with an EXISTING passkey (returning visitor / new device). */\n authenticate: () => Promise<PasskeySessionResult | null>;\n /** Create a NEW passkey (first-time visitor on this site). */\n register: () => Promise<PasskeySessionResult | null>;\n status: PasskeyStatus;\n error: string | null;\n /** `false` when the browser has no WebAuthn — hide the buttons. */\n supported: boolean;\n}\n\nexport function usePasskeyAuth(opts: {\n visitorId: string;\n /** Embedding page origin — `window.location.origin`. */\n origin: string;\n}): UsePasskeyAuth {\n const [status, setStatus] = useState<PasskeyStatus>(\"idle\");\n const [error, setError] = useState<string | null>(null);\n\n const [regOptions] = useMutation<{ visitorPasskeyRegistrationOptions: OptionsResult }>(\n PASSKEY_REG_OPTIONS,\n );\n const [regVerify] = useMutation<{ verifyVisitorPasskeyRegistration: PasskeySessionResult }>(\n PASSKEY_REG_VERIFY,\n );\n const [authOptions] = useMutation<{ visitorPasskeyAuthenticationOptions: OptionsResult }>(\n PASSKEY_AUTH_OPTIONS,\n );\n const [authVerify] = useMutation<{ verifyVisitorPasskeyAuthentication: PasskeySessionResult }>(\n PASSKEY_AUTH_VERIFY,\n );\n\n // Shared ceremony runner: fetch options → drive the browser prompt →\n // verify. Both register + authenticate funnel through here; only the\n // option/verify mutations + the `startX` browser call differ.\n const run = useCallback(\n async (kind: \"register\" | \"authenticate\"): Promise<PasskeySessionResult | null> => {\n setStatus(\"busy\");\n setError(null);\n try {\n const input = { visitorId: opts.visitorId, origin: opts.origin };\n // 1. Options + challenge from the BE.\n const opt =\n kind === \"register\"\n ? (await regOptions({ variables: { input } })).data?.visitorPasskeyRegistrationOptions\n : (await authOptions({ variables: { input } })).data\n ?.visitorPasskeyAuthenticationOptions;\n if (!opt) throw new Error(\"passkey_options_failed\");\n\n const options = JSON.parse(opt.optionsJson);\n\n // 2. Browser prompt (Touch ID / Face ID / security key). Throws\n // on user-cancel or no-credential — surfaced as `error`.\n const response =\n kind === \"register\"\n ? await startRegistration(options)\n : await startAuthentication(options);\n\n // 3. Verify the signed response → a full visitor session.\n const verifyInput = {\n visitorId: opts.visitorId,\n sessionId: opt.sessionId,\n responseJson: JSON.stringify(response),\n };\n const session =\n kind === \"register\"\n ? (await regVerify({ variables: { input: verifyInput } })).data\n ?.verifyVisitorPasskeyRegistration\n : (await authVerify({ variables: { input: verifyInput } })).data\n ?.verifyVisitorPasskeyAuthentication;\n if (!session) throw new Error(\"passkey_verify_failed\");\n\n // Stamp the token so every subsequent Apollo call is authed as\n // the now-verified visitor; the shell adopts the rest for UI.\n setVisitorToken(session.token);\n setStatus(\"idle\");\n return session;\n } catch (err) {\n setStatus(\"error\");\n setError((err as Error).message || \"passkey_failed\");\n return null;\n }\n },\n [opts.visitorId, opts.origin, regOptions, regVerify, authOptions, authVerify],\n );\n\n const authenticate = useCallback(() => run(\"authenticate\"), [run]);\n const register = useCallback(() => run(\"register\"), [run]);\n\n return {\n authenticate,\n register,\n status,\n error,\n supported: typeof window !== \"undefined\" && browserSupportsWebAuthn(),\n };\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { useMemo, useState } from \"react\";\nimport { type PasskeySessionResult, usePasskeyAuth } from \"@/lib/use-passkey-auth\";\nimport { ensureVisitorId } from \"@/lib/use-visitor-auth\";\n\ninterface PasskeySignInButtonProps {\n /** Called with the verified visitor session once the ceremony\n * succeeds — the shell adopts it (token already stamped into Apollo\n * by the hook). */\n onSession?: (session: PasskeySessionResult) => void;\n}\n\n/**\n * Passkey (WebAuthn) sign-in for the auth gate. Two explicit actions —\n * a returning visitor (or a new device with a synced passkey) taps\n * \"Sign in\"; a first-timer taps \"Set up\". We don't auto-detect because\n * a silent \"authenticate, fall back to register\" flow double-prompts\n * the OS dialog, which reads as broken.\n *\n * Renders nothing when the browser has no WebAuthn — the gate then\n * falls through to its other method (Google) or the \"host must\n * identify\" hint. The live ceremony needs a real authenticator + an\n * origin in the integration's allow-list; verify in demo/real.\n */\nexport function PasskeySignInButton({ onSession }: PasskeySignInButtonProps) {\n const t = useTranslations(\"messages\");\n const visitorId = useMemo(() => ensureVisitorId(), []);\n const origin = typeof window !== \"undefined\" ? window.location.origin : \"\";\n const { authenticate, register, status, supported } = usePasskeyAuth({\n visitorId,\n origin,\n });\n // Which action last failed — drives the guidance copy. A failed\n // *sign-in* almost always means \"no passkey on this device yet\" (the\n // browser's \"no passkeys available\"), so we steer first-timers to the\n // Set-up action rather than showing a dead-end \"couldn't sign in\".\n const [failedAction, setFailedAction] = useState<\"signIn\" | \"register\" | null>(null);\n\n if (!supported) return null;\n\n const run = async (\n kind: \"signIn\" | \"register\",\n action: () => Promise<PasskeySessionResult | null>,\n ) => {\n setFailedAction(null);\n const session = await action();\n if (session) onSession?.(session);\n else setFailedAction(kind);\n };\n\n const busy = status === \"busy\";\n\n return (\n <div className=\"flex w-full flex-col items-center gap-1.5\">\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => run(\"signIn\", authenticate)}\n className=\"flex w-full items-center justify-center gap-2 rounded-wx border border-wx-border bg-wx-bg-elevated px-4 py-2 text-sm font-medium text-wx-fg transition-colors hover:bg-wx-bg-elevated-2 disabled:opacity-60\"\n >\n <PasskeyGlyph />\n {t(\"passkeySignIn\")}\n </button>\n <button\n type=\"button\"\n disabled={busy}\n // After a failed sign-in (no credential), promote Set-up so the\n // first-timer's obvious next tap creates a passkey.\n onClick={() => run(\"register\", register)}\n className={\n failedAction === \"signIn\"\n ? \"flex w-full items-center justify-center gap-2 rounded-wx border border-wx-primary bg-wx-bg-elevated px-4 py-2 text-sm font-medium text-wx-primary transition-colors hover:bg-wx-bg-elevated-2 disabled:opacity-60\"\n : \"text-xs text-wx-fg-muted underline-offset-2 hover:underline disabled:opacity-60\"\n }\n >\n {t(\"passkeyRegister\")}\n </button>\n {failedAction === \"signIn\" && (\n <p className=\"text-center text-xs text-wx-fg-subtle\">{t(\"passkeyNoCredential\")}</p>\n )}\n {failedAction === \"register\" && (\n <p className=\"text-center text-xs text-wx-danger\">{t(\"passkeyError\")}</p>\n )}\n </div>\n );\n}\n\n/** Minimal key/fingerprint mark — no external icon dep for the gate. */\nfunction PasskeyGlyph() {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <circle cx=\"8\" cy=\"9\" r=\"4\" />\n <path d=\"M10.5 12.5 21 23l-1.5-3 2-1-2-1.5L21 14l-4-1\" />\n </svg>\n );\n}\n","\"use client\";\n\nimport { FileText, Pause, Play, X } from \"lucide-react\";\nimport { useTranslations } from \"next-intl\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type { LightboxItem } from \"../message/media-lightbox\";\nimport type { AttachmentChip } from \"../types\";\n\ninterface AttachmentPreviewProps {\n attachments: AttachmentChip[];\n /** Drop a chip from the staged list (cancels mid-upload too — the in-flight\n * upload's resolved handler is a no-op once the chip is gone). */\n onRemove: (tempId: string) => void;\n /** Open the existing `MediaLightbox` on the tapped image/video/PDF. The\n * caller owns the lightbox state — we hand it the previewable subset so\n * left/right nav walks across all previewable attachments. */\n onOpenLightbox: (items: LightboxItem[], index: number) => void;\n}\n\nconst isImage = (m: string) => m.startsWith(\"image/\");\nconst isVideo = (m: string) => m.startsWith(\"video/\");\nconst isAudio = (m: string) => m.startsWith(\"audio/\");\nconst isPdf = (m: string) => m === \"application/pdf\";\n\n/**\n * Staged attachment row above the composer. EVERY chip is a 64×64 square so\n * the row stays neat regardless of filename length — the filename is the\n * tile's hover tooltip (`title`). Tile bodies vary by mimetype:\n * - image → thumbnail, tap opens the `MediaLightbox`\n * - video → first-frame + play badge, tap opens the lightbox\n * - audio → tap to play/pause INLINE (one audio at a time)\n * - PDF → tap opens the lightbox (iframe-rendered)\n * - other → document icon (no tap action)\n *\n * A spinner overlay marks any chip whose upload is still in flight; the\n * remove (×) is always available so the visitor can cancel mid-upload.\n *\n * Extracted as its own component (same shape as `EmojiPicker`) so the\n * preview + playback logic isn't tangled with the composer's state machine.\n */\nexport function AttachmentPreview({\n attachments,\n onRemove,\n onOpenLightbox,\n}: AttachmentPreviewProps) {\n const t = useTranslations(\"messages\");\n\n // Inline audio playback. One audio element at a time — tapping a second\n // chip stops the first (one playback channel, no overlapping streams).\n const audioRef = useRef<HTMLAudioElement | null>(null);\n const [playingTempId, setPlayingTempId] = useState<string | null>(null);\n\n // Stop playback if the currently-playing chip is removed (or sent) so the\n // audio doesn't keep playing in the background after its chip is gone.\n useEffect(() => {\n if (!playingTempId) return;\n if (attachments.some((a) => a.tempId === playingTempId)) return;\n audioRef.current?.pause();\n audioRef.current = null;\n setPlayingTempId(null);\n }, [attachments, playingTempId]);\n // Tear down on unmount so a stray audio doesn't outlive the tab.\n useEffect(\n () => () => {\n audioRef.current?.pause();\n audioRef.current = null;\n },\n [],\n );\n\n const toggleAudio = (chip: AttachmentChip) => {\n if (!chip.url) return;\n // Same chip → pause.\n if (playingTempId === chip.tempId) {\n audioRef.current?.pause();\n setPlayingTempId(null);\n return;\n }\n // Different (or no) chip → stop any current playback, start the new one.\n audioRef.current?.pause();\n const audio = new Audio(chip.url);\n audio.onended = () => {\n setPlayingTempId((cur) => (cur === chip.tempId ? null : cur));\n };\n audio.play().catch(() => setPlayingTempId(null));\n audioRef.current = audio;\n setPlayingTempId(chip.tempId);\n };\n\n // Lightbox-previewable subset (image / video / PDF). Each tap opens the\n // lightbox at the tapped item's index within THIS list so left/right\n // navigates only across previewable attachments (skipping audio/other).\n const previewable = attachments.filter(\n (a) => !!a.url && (isImage(a.mimetype) || isVideo(a.mimetype) || isPdf(a.mimetype)),\n );\n const previewableItems: LightboxItem[] = previewable.map((a) => ({\n url: a.url as string,\n mimetype: a.mimetype,\n alt: a.filename,\n }));\n const openFor = (chip: AttachmentChip) => {\n const idx = previewable.findIndex((a) => a.tempId === chip.tempId);\n if (idx < 0) return;\n onOpenLightbox(previewableItems, idx);\n };\n\n return (\n <div className=\"flex flex-wrap gap-2\">\n {attachments.map((a) => {\n const uploading = a.mediaId === null;\n const removeLabel = t(\"removeAttachment\");\n\n // IMAGE — thumbnail, opens lightbox.\n if (isImage(a.mimetype) && a.url) {\n return (\n <Tile\n key={a.tempId}\n uploading={uploading}\n onRemove={() => onRemove(a.tempId)}\n removeLabel={removeLabel}\n title={a.filename}\n >\n <button\n type=\"button\"\n onClick={() => openFor(a)}\n className=\"block h-16 w-16 overflow-hidden rounded-wx-sm bg-wx-bg-elevated\"\n aria-label={t(\"openPreview\")}\n >\n {/* biome-ignore lint/performance/noImgElement: visitor-uploaded image of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img src={a.url} alt={a.filename} className=\"h-full w-full object-cover\" />\n </button>\n </Tile>\n );\n }\n\n // VIDEO — first-frame + play badge, opens lightbox.\n if (isVideo(a.mimetype) && a.url) {\n return (\n <Tile\n key={a.tempId}\n uploading={uploading}\n onRemove={() => onRemove(a.tempId)}\n removeLabel={removeLabel}\n title={a.filename}\n >\n <button\n type=\"button\"\n onClick={() => openFor(a)}\n className=\"relative block h-16 w-16 overflow-hidden rounded-wx-sm bg-wx-bg-elevated\"\n aria-label={t(\"openPreview\")}\n >\n <video\n src={a.url}\n className=\"h-full w-full object-cover\"\n muted\n playsInline\n preload=\"metadata\"\n />\n <span className=\"absolute inset-0 flex items-center justify-center bg-black/30 text-white\">\n <Play size={16} fill=\"currentColor\" />\n </span>\n </button>\n </Tile>\n );\n }\n\n // AUDIO — square chip; tap toggles inline playback. The chip flips\n // to the brand surface while playing so it's obvious which file is on.\n if (isAudio(a.mimetype) && a.url) {\n const playing = playingTempId === a.tempId;\n const Glyph = playing ? Pause : Play;\n return (\n <Tile\n key={a.tempId}\n uploading={uploading}\n onRemove={() => onRemove(a.tempId)}\n removeLabel={removeLabel}\n title={a.filename}\n >\n <button\n type=\"button\"\n onClick={() => toggleAudio(a)}\n aria-label={playing ? t(\"pause\") : t(\"play\")}\n className={cn(\n \"flex h-16 w-16 items-center justify-center rounded-wx-sm transition-colors\",\n playing\n ? \"bg-wx-primary text-wx-primary-fg\"\n : \"bg-wx-bg-elevated text-wx-fg-muted hover:text-wx-fg\",\n )}\n >\n <Glyph size={22} fill=\"currentColor\" strokeWidth={0} />\n </button>\n </Tile>\n );\n }\n\n // PDF — square chip, opens lightbox iframe. Falls back to a static\n // icon if the upload is still in flight (no url yet).\n if (isPdf(a.mimetype) && a.url) {\n return (\n <Tile\n key={a.tempId}\n uploading={uploading}\n onRemove={() => onRemove(a.tempId)}\n removeLabel={removeLabel}\n title={a.filename}\n >\n <button\n type=\"button\"\n onClick={() => openFor(a)}\n aria-label={t(\"openPreview\")}\n className={cn(\n \"flex h-16 w-16 items-center justify-center rounded-wx-sm\",\n \"bg-wx-bg-elevated text-wx-fg-muted transition-colors hover:text-wx-fg\",\n )}\n >\n <FileText size={22} aria-hidden=\"true\" />\n </button>\n </Tile>\n );\n }\n\n // OTHER (any unknown doc, or PDF still uploading) — static square\n // tile with the document icon. Filename surfaces on hover.\n return (\n <Tile\n key={a.tempId}\n uploading={uploading}\n onRemove={() => onRemove(a.tempId)}\n removeLabel={removeLabel}\n title={a.filename}\n >\n <div className=\"flex h-16 w-16 items-center justify-center rounded-wx-sm bg-wx-bg-elevated text-wx-fg-muted\">\n <FileText size={22} aria-hidden=\"true\" />\n </div>\n </Tile>\n );\n })}\n </div>\n );\n}\n\n/** Square 64×64 tile wrapper — owns the remove (×) corner button, the\n * upload-in-flight spinner overlay, and the filename hover tooltip. Every\n * preview kind composes the same chrome around its body. */\nfunction Tile({\n children,\n uploading,\n onRemove,\n removeLabel,\n title,\n}: {\n children: React.ReactNode;\n uploading: boolean;\n onRemove: () => void;\n removeLabel: string;\n title?: string;\n}) {\n return (\n <div className=\"relative\" title={title}>\n {children}\n {uploading && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 flex items-center justify-center\",\n \"rounded-wx-sm bg-black/30\",\n )}\n >\n <span className=\"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent\" />\n </span>\n )}\n <button\n type=\"button\"\n onClick={onRemove}\n aria-label={removeLabel}\n className={cn(\n \"absolute -top-1.5 -right-1.5 flex h-5 w-5 items-center justify-center\",\n \"rounded-full bg-wx-bg text-wx-fg-muted shadow ring-1 ring-wx-border\",\n \"transition-colors hover:text-wx-fg\",\n )}\n >\n <X size={11} />\n </button>\n </div>\n );\n}\n","\"use client\";\n\nimport type { EmojiClickData, EmojiStyle } from \"emoji-picker-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { type CSSProperties, lazy, Suspense, useEffect, useRef } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n// `emoji-picker-react` is ~420 KB — by far the widget's heaviest\n// dependency, and the visitor only ever needs it if they open the\n// picker. `lazy()` splits it into its own chunk that's fetched on\n// first open; `EMOJI_STYLE_NATIVE` lets us reference the enum value\n// without a runtime import of the whole module.\nconst EmojiPickerReact = lazy(() => import(\"emoji-picker-react\"));\nconst EMOJI_STYLE_NATIVE = \"native\" as EmojiStyle;\n\ninterface EmojiPickerProps {\n open: boolean;\n onClose: () => void;\n onSelect: (emoji: string) => void;\n /** Optional anchor — clicks outside this element close the picker. */\n anchorRef?: React.RefObject<HTMLElement | null>;\n}\n\n/**\n * `emoji-picker-react` exposes its surface via `--epr-*` CSS vars.\n * We remap them to the widget's own `--wx-*` tokens so the picker\n * inherits brand background, foreground, border, primary, etc., and\n * flips dark/light alongside the rest of the chrome (the wx tokens\n * already pivot off `[data-theme=\"dark\"]`) — no JS theme switch.\n *\n * **Why apply via the lib's own `style` prop (not the wrapper)**:\n * the lib injects its own stylesheet that sets the `--epr-*`\n * defaults directly on the `.EmojiPickerReact` element. CSS vars\n * defined on the element itself ALWAYS beat inherited ones from a\n * parent — so setting them on our `motion.div` wrapper had no\n * effect. Setting them via `style` lands them on `.EmojiPickerReact`\n * itself, where they actually win.\n */\nconst EMOJI_PICKER_TOKENS: CSSProperties = {\n // Surface\n \"--epr-bg-color\": \"var(--wx-bg)\",\n \"--epr-category-label-bg-color\": \"var(--wx-bg)\",\n \"--epr-reactions-bg-color\": \"var(--wx-bg-elevated)\",\n \"--epr-picker-border-color\": \"var(--wx-border)\",\n \"--epr-picker-border-radius\": \"var(--wx-radius-lg, 12px)\",\n // Text\n \"--epr-text-color\": \"var(--wx-fg)\",\n \"--epr-category-label-text-color\": \"var(--wx-fg-muted)\",\n // Hover / focus\n \"--epr-hover-bg-color\": \"var(--wx-bg-elevated)\",\n \"--epr-focus-bg-color\": \"var(--wx-bg-elevated-2)\",\n \"--epr-highlight-color\": \"var(--wx-primary)\",\n \"--epr-category-icon-active-color\": \"var(--wx-primary)\",\n // Search input\n \"--epr-search-input-bg-color\": \"var(--wx-bg-elevated)\",\n \"--epr-search-input-bg-color-active\": \"var(--wx-bg-elevated)\",\n \"--epr-search-input-text-color\": \"var(--wx-fg)\",\n \"--epr-search-input-placeholder-color\": \"var(--wx-fg-muted)\",\n \"--epr-search-border-color\": \"var(--wx-border)\",\n \"--epr-search-border-color-active\": \"var(--wx-primary)\",\n \"--epr-search-input-border-radius\": \"var(--wx-radius, 8px)\",\n // Sizing — `--epr-category-navigation-button-size` is the lever\n // for the category-nav icon row (the lib uses it for both the\n // button width AND the sprite background-size + crop offsets, so\n // the icons scale proportionally instead of getting misaligned).\n \"--epr-emoji-size\": \"22px\",\n \"--epr-emoji-fullsize\": \"30px\",\n \"--epr-emoji-padding\": \"4px\",\n \"--epr-category-padding\": \"4px\",\n \"--epr-category-navigation-button-size\": \"22px\",\n \"--epr-category-label-height\": \"26px\",\n \"--epr-header-padding\": \"6px\",\n \"--epr-search-input-height\": \"30px\",\n // Left padding clears the absolutely-positioned search icon (which\n // sits at `left: var(--epr-search-bar-inner-padding)` + its own\n // 14-ish px width) plus a small breathing gap. Right padding\n // leaves room for the clear-button chip during search.\n \"--epr-search-input-padding\": \"0 32px 0 34px\",\n \"--epr-horizontal-padding\": \"8px\",\n} as CSSProperties;\n\nexport function EmojiPicker({ open, onClose, onSelect, anchorRef }: EmojiPickerProps) {\n const t = useTranslations(\"messages\");\n const pickerRef = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n if (!open) return;\n const onDoc = (e: MouseEvent) => {\n const target = e.target as Node;\n if (pickerRef.current?.contains(target)) return;\n if (anchorRef?.current?.contains(target)) return;\n onClose();\n };\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onClose();\n };\n document.addEventListener(\"mousedown\", onDoc);\n document.addEventListener(\"keydown\", onKey);\n return () => {\n document.removeEventListener(\"mousedown\", onDoc);\n document.removeEventListener(\"keydown\", onKey);\n };\n }, [open, onClose, anchorRef]);\n\n return (\n <AnimatePresence>\n {open && (\n <motion.div\n ref={pickerRef}\n initial={{ opacity: 0, y: 6, scale: 0.96 }}\n animate={{ opacity: 1, y: 0, scale: 1 }}\n exit={{ opacity: 0, y: 6, scale: 0.96 }}\n transition={{ duration: 0.14, ease: \"easeOut\" }}\n className={cn(\n \"absolute bottom-full left-3 z-20 mb-2 origin-bottom-left\",\n \"overflow-hidden rounded-wx-lg shadow-lg\",\n // The lib's default `--epr-hover-bg-color` (#e5f0fa, pale\n // blue) leaks through on the search-clear chip — it sits\n // on top of the elevated input so visitors see a contrast\n // disc that doesn't match the rest of the picker. Force\n // the hover/focus chrome to inherit the input's surface\n // so the clear button reads as a subtle ghost.\n \"[&_.epr-btn-clear-search:hover]:!bg-wx-bg-elevated-2\",\n \"[&_.epr-btn-clear-search:focus]:!bg-wx-bg-elevated-2\",\n )}\n role=\"dialog\"\n aria-label={t(\"emojiPicker\")}\n >\n <Suspense\n fallback={\n <div\n className=\"bg-wx-bg flex items-center justify-center\"\n style={{ width: 320, height: 360 }}\n >\n <div className=\"border-wx-border border-t-wx-primary h-5 w-5 animate-spin rounded-full border-2\" />\n </div>\n }\n >\n <EmojiPickerReact\n onEmojiClick={(d: EmojiClickData) => onSelect(d.emoji)}\n width={320}\n height={360}\n emojiStyle={EMOJI_STYLE_NATIVE}\n previewConfig={{ showPreview: false }}\n skinTonesDisabled\n lazyLoadEmojis\n searchPlaceHolder={t(\"emojiSearch\")}\n style={EMOJI_PICKER_TOKENS}\n />\n </Suspense>\n </motion.div>\n )}\n </AnimatePresence>\n );\n}\n","\"use client\";\n\nimport { Loader2, Send } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { MicIcon, type MicIconHandle } from \"@/components/widget/icons/animated\";\nimport { useIconHover } from \"@/lib/use-icon-hover\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Single-button surface that morphs between mic / send / stop. The\n * button stays in the same position so taps don't jump as the\n * draft fills up.\n */\nexport function MorphSendButton({\n kind,\n disabled,\n onSend,\n onMic,\n ariaLabels,\n}: {\n kind: \"mic\" | \"send\";\n disabled: boolean;\n onSend: () => void;\n onMic: () => void;\n ariaLabels: { send: string; mic: string };\n}) {\n const onClick = kind === \"send\" ? onSend : onMic;\n const ariaLabel = ariaLabels[kind];\n const micHover = useIconHover<MicIconHandle>();\n return (\n <motion.button\n type=\"button\"\n onClick={onClick}\n disabled={disabled && kind === \"send\"}\n aria-label={ariaLabel}\n whileHover={{ scale: 1.08 }}\n whileTap={{ scale: 0.9 }}\n transition={{ type: \"spring\", stiffness: 400, damping: 22 }}\n {...(kind === \"mic\" ? micHover.parentHandlers : {})}\n className={cn(\n \"flex h-8 w-8 items-center justify-center rounded-full transition-colors\",\n \"bg-wx-primary text-wx-primary-fg hover:bg-wx-primary-hover\",\n \"disabled:opacity-50\",\n )}\n >\n <AnimatePresence mode=\"wait\" initial={false}>\n {/* Spinner takes priority over the send glyph — when the\n mutation is in flight, swap to `Loader2` so the visitor\n sees the request is being processed. */}\n {kind === \"send\" && disabled && (\n <motion.span\n key=\"sending\"\n initial={{ opacity: 0, scale: 0.6 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.6 }}\n transition={{ duration: 0.14 }}\n >\n <Loader2 size={14} className=\"animate-spin\" />\n </motion.span>\n )}\n {kind === \"send\" && !disabled && (\n <motion.span\n key=\"send\"\n initial={{ opacity: 0, scale: 0.6, rotate: -30 }}\n animate={{ opacity: 1, scale: 1, rotate: 0 }}\n exit={{ opacity: 0, scale: 0.6, rotate: 30 }}\n transition={{ duration: 0.14 }}\n >\n <Send size={14} />\n </motion.span>\n )}\n {kind === \"mic\" && (\n <motion.span\n key=\"mic\"\n initial={{ opacity: 0, scale: 0.6 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.6 }}\n transition={{ duration: 0.14 }}\n >\n <MicIcon ref={micHover.iconRef} size={14} />\n </motion.span>\n )}\n </AnimatePresence>\n </motion.button>\n );\n}\n","import type { MockMessageButton } from \"@/dummy\";\nimport type { DemoTranslator } from \"@/dummy/translator\";\n\n/**\n * Picks a canned AI reply for demo mode. Pattern-matches the visitor's\n * text against a few intents; falls back to a generic \"let me check\"\n * line. Returned reply may carry follow-up quick-reply buttons so the\n * conversation can keep going without typing.\n *\n * Reply text + button labels are localised via the demo `messenger.replies.*`\n * namespace (read off the passed `DemoTranslator`). The intent *keywords*\n * are still English-only — non-Latin / localised input falls through to\n * the (localised) fallback reply, which is acceptable for the demo.\n */\nexport function pickDummyReply(\n text: string,\n t: DemoTranslator,\n): { text: string; buttons?: MockMessageButton[] } {\n const lower = text.toLowerCase();\n if (lower.includes(\"pric\")) {\n return {\n text: t.raw(\"messenger.replies.pricing.text\") as string,\n buttons: [\n { text: t.raw(\"messenger.replies.pricing.planBtn\") as string, payload: \"plans\" },\n { text: t.raw(\"messenger.replies.pricing.salesBtn\") as string, payload: \"sales\" },\n ],\n };\n }\n if (lower.includes(\"gaia\") || lower.includes(\"ai\")) {\n return {\n text: t.raw(\"messenger.replies.gaia.text\") as string,\n buttons: [\n { text: t.raw(\"messenger.replies.gaia.handoffBtn\") as string, payload: \"handoff-flow\" },\n ],\n };\n }\n if (lower.includes(\"human\") || lower.includes(\"chat with\") || lower.includes(\"operator\")) {\n return { text: t.raw(\"messenger.replies.human.text\") as string };\n }\n return { text: t.raw(\"messenger.replies.fallback.text\") as string };\n}\n","/**\n * Centered date chip between messages from different calendar days\n * (\"Today\" / \"Yesterday\" / \"17 Apr\"). Same muted-pill treatment as the\n * runtime SYSTEM rows so the thread reads as a single timeline.\n */\nexport function DateSeparator({ label }: { label: string }) {\n return (\n // `sticky` pins the chip to the top of the scroll viewport while its day\n // is in view; the next day's chip scrolls up and takes over. `z-10` keeps\n // it above the message bubbles passing underneath.\n <div className=\"sticky top-2 z-10 flex justify-center py-1\">\n <span className=\"rounded-full bg-wx-bg-elevated px-3 py-1 text-[11px] font-medium text-wx-fg-muted shadow-sm\">\n {label}\n </span>\n </div>\n );\n}\n","/**\n * Resolve \"is this href a widget-internal navigation target?\" for\n * links embedded in operator / AI-authored message HTML.\n *\n * The AI assistant sometimes ends replies with a link to a help\n * article (`/help/{folderSlug}/{articleSlug}?locale=en`) under the\n * assumption the visitor is on the operator's site. The widget runs\n * on its own origin (`widget.wexio.com` in production, `localhost:3002`\n * in dev), so following the link with default browser navigation\n * lands on a 404 — the widget app has no `/help/...` page.\n *\n * Parse these patterns here and let the click handler in the message\n * body route them through `setRoute(...)` instead, opening the\n * article in the widget's own viewer.\n *\n * What counts as \"internal\":\n *\n * - Same-origin link (the widget's host or `localhost`)\n * - Path matches `/help/.../<slug>` or `/news/<slug>`\n *\n * Cross-origin URLs are always treated as external — even if the path\n * looks like `/help/...`, the visitor probably wants the operator's\n * marketing site, not the widget's internal article view.\n */\n\nexport type InternalLink =\n | { kind: \"help-article\"; slug: string; locale?: string }\n | { kind: \"news-article\"; slug: string; locale?: string };\n\nexport function parseInternalLink(href: string, base?: string): InternalLink | null {\n if (!href) return null;\n // Skip bare fragments / non-navigational anchors — `<a href=\"#section\">`\n // should scroll to the target inside the bubble, not route the widget.\n if (href.startsWith(\"#\")) return null;\n // Skip non-http(s) protocols (mailto:, tel:, sms:, javascript:, …).\n if (/^[a-z][a-z0-9+\\-.]*:/i.test(href) && !/^https?:/i.test(href)) {\n return null;\n }\n\n // Resolve against the caller-supplied base when present (tests use\n // this to pin a deterministic origin); fall back to the widget's own\n // origin at runtime.\n const resolvedBase =\n base ?? (typeof window !== \"undefined\" ? window.location.origin : \"http://localhost\");\n\n let url: URL;\n try {\n url = new URL(href, resolvedBase);\n } catch {\n return null;\n }\n\n // Same-origin gate against the SAME base we resolved against — a\n // relative path always passes (URL inherits the base's origin); an\n // absolute external URL doesn't (different origin even though the\n // path looks internal).\n try {\n const baseOrigin = new URL(resolvedBase).origin;\n if (url.origin !== baseOrigin) return null;\n } catch {\n /* malformed base — skip the gate, parse anyway */\n }\n\n const segments = url.pathname.split(\"/\").filter(Boolean);\n if (segments.length < 2) return null;\n\n const [section, ...rest] = segments;\n // Slug is the FULL path after the section, joined back with `/`.\n // Help articles are keyed by slugs that may themselves contain\n // slashes (`webhooks/history` is one slug, not \"folder webhooks +\n // article history\"). The BE looks the article up by exactly this\n // string — losing the prefix segments here would mismatch and\n // return null.\n const slug = rest.join(\"/\");\n if (!slug) return null;\n\n const locale = url.searchParams.get(\"locale\") ?? undefined;\n\n if (section === \"help\") return { kind: \"help-article\", slug, locale };\n // News articles ship under either `/news/<slug>` (the in-widget\n // route convention) or `/article/<slug>` (the operator's public\n // marketing site convention) — accept both.\n if (section === \"news\" || section === \"article\") {\n return { kind: \"news-article\", slug, locale };\n }\n return null;\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Bot/AI/operator message avatar. The visitor sees this circle next\n * to every outbound bubble + the typing indicator.\n *\n * Three rendering modes, picked in order:\n * 1. **Gaia (AI/bot)** — wexio-branded gradient circle. Identifies\n * the AI assistant regardless of operator branding, so visitors\n * always know when they're talking to a bot vs. a human.\n * 2. **Operator logo** — the org's uploaded mark, filling the circle.\n * 3. **Monogram fallback** — first letter of the org name. Used when\n * the operator hasn't supplied a logo (would rather not surface\n * the host product's mark inside message bubbles).\n */\nexport function BotAvatar({\n size,\n senderKind,\n senderName,\n senderAvatarUrl,\n aiAssistantAvatarUrl,\n organizationLogoUrl,\n organizationName,\n className,\n}: {\n size: number;\n /** Drives the AI branch. `ai` + `bot` resolve to either the\n * operator-configured `aiAssistantAvatarUrl` (if any) or\n * *nothing* — the previous Wexio-mark fallback is gone so the\n * operator explicitly opts into surfacing a bot identity by\n * uploading an avatar. */\n senderKind?: string;\n /** Operator's display name. Used for the monogram fallback when\n * the operator has no personal avatar — visitors see \"RL\" for\n * \"Ralph J. Lesperance\" instead of the org's first initial,\n * which would otherwise read like the same \"W\" for every human\n * in a multi-operator team. */\n senderName?: string;\n /** Per-sender avatar URL — operator who uploaded a personal photo.\n * Wins over the org logo when present. AI/bot senders never carry\n * a personal avatar; the AI branch above handles them. */\n senderAvatarUrl?: string;\n /** Operator-uploaded AI assistant avatar. Plumbed from\n * `config.messenger.aiAssistantAvatar`. When `null` / `undefined`,\n * AI bubbles render *without* an avatar (caller is expected to\n * collapse the avatar slot in its layout). */\n aiAssistantAvatarUrl?: string | null;\n organizationLogoUrl?: string | null;\n organizationName?: string;\n className?: string;\n}) {\n const t = useTranslations(\"messages\");\n const sizeStyle = { width: size, height: size };\n\n // AI / bot branch.\n // - If the operator uploaded an AI assistant avatar via the\n // dashboard's messenger settings, render it.\n // - If not, return `null`. Caller is expected to *omit* the\n // avatar from its layout (the message bubble's flex row\n // should drop the column entirely so the bubble doesn't\n // leave an empty slot). This is the explicit-opt-in shape\n // the operator brief asked for.\n if (senderKind === \"ai\" || senderKind === \"bot\") {\n if (!aiAssistantAvatarUrl) {\n // Empty AI/bot avatar slot — keep the column width so the bubble\n // and meta line stay aligned with messages that DO render an\n // avatar (operator avatar / org logo on inbound).\n return <span style={sizeStyle} className={cn(\"shrink-0\", className)} aria-hidden=\"true\" />;\n }\n return (\n <span\n style={sizeStyle}\n className={cn(\n \"relative flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-wx-bg-elevated shadow-sm\",\n className,\n )}\n role=\"img\"\n aria-label={t(\"aiAssistant\")}\n >\n {/* biome-ignore lint/performance/noImgElement: operator-uploaded avatar of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img\n src={aiAssistantAvatarUrl}\n alt=\"\"\n className=\"h-full w-full object-cover\"\n loading=\"eager\"\n decoding=\"async\"\n />\n </span>\n );\n }\n\n if (senderAvatarUrl) {\n return (\n <span style={sizeStyle} className={cn(\"shrink-0 overflow-hidden rounded-full\", className)}>\n {/* biome-ignore lint/performance/noImgElement: operator-uploaded avatar of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img src={senderAvatarUrl} alt=\"\" className=\"h-full w-full object-cover\" />\n </span>\n );\n }\n\n // Monogram fallback. Prefer the *operator's* name initials (one\n // or two characters drawn from the leading word + the surname,\n // e.g. \"RL\" for \"Ralph J. Lesperance\") over the org name. The\n // previous version always painted the org's first letter, so\n // every human on a multi-operator team showed up as the same\n // \"W\" / \"A\" / etc — making them visually indistinguishable. The\n // org logo is still a stronger anchor than a 1-letter monogram,\n // so we only fall back to the org-logo branch if the message\n // has no usable sender name attached.\n const operatorInitials = senderName ? initialsOf(senderName) : \"\";\n if (!operatorInitials && organizationLogoUrl) {\n return (\n <span style={sizeStyle} className={cn(\"shrink-0 overflow-hidden rounded-full\", className)}>\n {/* biome-ignore lint/performance/noImgElement: org logo of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img\n src={organizationLogoUrl}\n alt={organizationName ?? \"\"}\n className=\"h-full w-full object-cover\"\n />\n </span>\n );\n }\n const initials = operatorInitials || (organizationName ?? \"\").trim().charAt(0).toUpperCase();\n return (\n <span\n style={sizeStyle}\n className={cn(\n \"flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-wx-bg-elevated text-[0.7em] font-semibold text-wx-fg-muted\",\n className,\n )}\n >\n {initials || \"\"}\n </span>\n );\n}\n\n/**\n * Compact initials extractor for the monogram avatar. Picks the\n * first letter of the *first* word and the first letter of the\n * *last* word — handles middle names + initials gracefully:\n * \"Ralph J. Lesperance\" → \"RL\"\n * \"John Doe\" → \"JD\"\n * \"Cher\" → \"C\"\n * \" \" → \"\"\n * Always returned uppercase. Drops anything non-alphanumeric.\n */\nfunction initialsOf(name: string): string {\n const words = name\n .trim()\n .split(/\\s+/)\n .map((w) => w.replace(/[^\\p{L}\\p{N}]/gu, \"\"))\n .filter((w) => w.length > 0);\n if (words.length === 0) return \"\";\n if (words.length === 1) return words[0].charAt(0).toUpperCase();\n return words[0].charAt(0).toUpperCase() + words[words.length - 1].charAt(0).toUpperCase();\n}\n","\"use client\";\n\nimport { motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { lazy, Suspense, useCallback } from \"react\";\nimport type { MockMessage, MockMessageButton, MockMessageMedia } from \"@/dummy\";\nimport { AI_ASSISTANT_NAME } from \"@/lib/ai-assistant\";\nimport { type InternalLink, parseInternalLink } from \"@/lib/internal-link\";\nimport { cn } from \"@/lib/utils\";\nimport { BotAvatar } from \"./bot-avatar\";\nimport type { LightboxItem } from \"./media-lightbox\";\n\n// `wavesurfer.js` is only needed for voice-note bubbles — split it out\n// of the initial payload and fetch on demand. See `Media` below.\nconst AudioBubblePlayer = lazy(() =>\n import(\"./audio-bubble-player\").then((m) => ({\n default: m.AudioBubblePlayer,\n })),\n);\n\nexport function MessageBubble({\n message,\n organizationLogoUrl,\n organizationName,\n aiAssistantAvatarUrl,\n buttonsActive,\n onButtonClick,\n onOpenLightbox,\n onInternalLink,\n}: {\n message: MockMessage;\n organizationLogoUrl?: string | null;\n organizationName?: string;\n /** Operator-uploaded AI assistant avatar URL — surfaced on AI/bot\n * bubbles when present. When `null` / `undefined`, AI bubbles\n * render without an avatar (the column collapses). */\n aiAssistantAvatarUrl?: string | null;\n /** When `true`, the bubble's `buttons` render as clickable chips\n * (latest outbound run); otherwise they're hidden. */\n buttonsActive?: boolean;\n onButtonClick?: (button: MockMessageButton) => void;\n /** Opens the full-screen gallery overlay starting at the given\n * index inside the message's visual media batch. */\n onOpenLightbox?: (items: LightboxItem[], index: number) => void;\n /** Called when the visitor taps a widget-internal link inside the\n * message body (e.g. AI reply pointing at `/help/foo/bar`). The\n * shell wires it to `setRoute(...)` so the article opens inside\n * the widget instead of triggering a browser navigation to the\n * widget's own origin (which would 404). */\n onInternalLink?: (link: InternalLink) => void;\n}) {\n const t = useTranslations(\"messages\");\n const isOutbound = message.direction === \"OUTBOUND\";\n // AI / bot ALWAYS reads as AI_ASSISTANT_NAME regardless of whatever label the\n // BE attached (\"Bot\", \"WEB widget\", an internal handle, …). The\n // history mapper + SSE consumer already pre-relabel, but bubble-\n // shaped messages from other entry points (preview pane, demo) may\n // not — re-assert here as a safety net so a stray \"Bot\" can't leak.\n // Operator names flow through; empty operator name falls back to\n // the role label below.\n const displayName =\n message.sender.kind === \"ai\" || message.sender.kind === \"bot\"\n ? AI_ASSISTANT_NAME\n : message.sender.name?.trim() || \"\";\n // Only show a role suffix when there's no name AND we couldn't\n // brand-default to Gaia — i.e. the sender's `kind` is `operator` or\n // unknown. Keeps the meta line clean when AI_ASSISTANT_NAME already conveys\n // the role.\n const senderRoleLabel = displayName\n ? null\n : message.sender.kind === \"operator\"\n ? t(\"operator\")\n : null;\n return (\n <motion.div\n layout=\"position\"\n // `data-message-id` is the lookup the tab's scroll effect uses to find\n // a newly-arrived bubble (querying by id) so it can scroll the TOP of\n // long operator/AI messages into view, instead of pinning the bottom.\n data-message-id={message.id}\n // Directional entrance: received (operator/AI, left) bubbles slide\n // in from the left; the visitor's own (right) bubbles from the\n // right — a short, subtle \"conversation coming alive\" feel.\n initial={{ opacity: 0, x: isOutbound ? -16 : 16 }}\n animate={{ opacity: 1, x: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.24, ease: \"easeOut\" }}\n className={cn(\"flex flex-col gap-1.5\", isOutbound ? \"items-start\" : \"items-end\")}\n >\n <div\n className={cn(\n \"flex max-w-[85%] items-start gap-2\",\n isOutbound ? \"flex-row\" : \"flex-row-reverse\",\n )}\n >\n {isOutbound && (\n <BotAvatar\n size={28}\n senderKind={message.sender.kind}\n senderName={message.sender.name}\n senderAvatarUrl={message.sender.avatar}\n aiAssistantAvatarUrl={aiAssistantAvatarUrl}\n organizationLogoUrl={organizationLogoUrl}\n organizationName={organizationName}\n className=\"mt-0.5\"\n />\n )}\n {(() => {\n // Split media into VISUAL (image / video) vs NON-VISUAL\n // (audio / document). Visual renders FULL-BLEED at the top\n // of the bubble; caption + non-visual media sit padded\n // below. When neither caption nor non-visual content\n // exists, the bubble background drops away and only the\n // rounded visual remains — matches modern messenger UIs\n // (Telegram / Intercom).\n const allMedia = message.media ?? [];\n // PDFs are previewable in the lightbox (iframe-rendered), so they\n // join image/video at the FULL-BLEED top of the bubble instead of\n // sitting inset in the padded section. Audio + other docs still\n // render inside the padded `nonVisual` block below.\n const isVisual = (m: MockMessageMedia) =>\n m.mimetype.startsWith(\"image/\") ||\n m.mimetype.startsWith(\"video/\") ||\n m.mimetype === \"application/pdf\";\n const visual = allMedia.filter(isVisual);\n const nonVisual = allMedia.filter((m) => !isVisual(m));\n const hasCaption = !!message.text;\n const hasNonVisual = nonVisual.length > 0;\n const showBubbleBg = hasCaption || hasNonVisual;\n return (\n <div\n className={cn(\n \"max-w-full overflow-hidden rounded-wx-lg\",\n showBubbleBg &&\n (isOutbound\n ? \"bg-wx-bg-elevated text-wx-fg\"\n : \"bg-wx-primary text-wx-primary-fg\"),\n )}\n >\n {visual.length > 0 && (\n <VisualMediaBlock items={visual} onOpenLightbox={onOpenLightbox} />\n )}\n {(hasCaption || hasNonVisual) && (\n <div\n className={cn(\n \"flex flex-col gap-2 px-4 py-2.5 text-sm\",\n // Tighter top padding when visual media sits\n // above — keeps caption read as a label on the\n // image, not a free-floating bubble.\n visual.length > 0 && \"pt-2\",\n )}\n >\n {hasCaption && (\n <MessageBody\n text={message.text}\n isOutbound={isOutbound}\n onInternalLink={onInternalLink}\n />\n )}\n {nonVisual.map((m, idx) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: per-message media is fixed-order and never reordered\n <Media key={idx} media={m} onDark={!isOutbound} />\n ))}\n </div>\n )}\n </div>\n );\n })()}\n </div>\n {/* Sender + time meta line. Indents to match the bubble's\n left edge (after the avatar) on outbound; right-aligns\n flush with the visitor bubble on inbound. */}\n {(displayName || message.ageLabel) && (\n <p\n className={cn(\n \"flex items-center gap-1.5 text-[11px] text-wx-fg-subtle\",\n isOutbound ? \"ml-9\" : \"mr-1\",\n )}\n >\n {isOutbound && displayName && (\n <span className=\"font-medium text-wx-fg-muted\">{displayName}</span>\n )}\n {isOutbound && senderRoleLabel && (\n <>\n <span aria-hidden=\"true\">·</span>\n <span>{senderRoleLabel}</span>\n </>\n )}\n {message.ageLabel && (\n <>\n {(isOutbound && displayName) || (isOutbound && senderRoleLabel) ? (\n <span aria-hidden=\"true\">·</span>\n ) : null}\n <span>{message.ageLabel}</span>\n </>\n )}\n </p>\n )}\n {buttonsActive && message.buttons && message.buttons.length > 0 && (\n <motion.div\n initial={{ opacity: 0, y: 4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.18, ease: \"easeOut\" }}\n className={cn(\n \"flex flex-wrap gap-1\",\n isOutbound ? \"ml-9 max-w-[85%]\" : \"mr-1 justify-end\",\n )}\n >\n {message.buttons.map((btn) => (\n <motion.button\n key={btn.payload}\n type=\"button\"\n onClick={() => onButtonClick?.(btn)}\n whileHover={{ y: -1 }}\n whileTap={{ scale: 0.96 }}\n transition={{ type: \"spring\", stiffness: 480, damping: 26 }}\n className={cn(\n // Inside the conversation the chips read as\n // satellites of the operator bubble — so they take\n // the SAME `bg-wx-bg-elevated` surface as the\n // bubble itself (the launcher peek uses bare\n // `bg-wx-bg` because it sits on the host page, not\n // inside a panel). Hover fills with full brand.\n \"rounded-full bg-wx-bg-elevated px-2.5 py-1 text-xs font-medium text-wx-primary\",\n \"transition-colors hover:bg-wx-primary hover:text-wx-primary-fg\",\n )}\n >\n {btn.text}\n </motion.button>\n ))}\n </motion.div>\n )}\n </motion.div>\n );\n}\n\n/**\n * Renders message body text. Detects HTML by looking for a leading\n * tag opener — operator messages composed in the dashboard's TipTap\n * editor arrive as serialised HTML (`<p class=\"tiptap-paragraph\">…`)\n * and need to be parsed, not displayed literally. Plain-text replies\n * (bot, visitor input, AI handoff intros) keep the existing pre-wrap\n * paragraph styling.\n *\n * The HTML branch uses `dangerouslySetInnerHTML` — operator content\n * is sanitised on the BE before persistence (the operator editor's\n * allowlist matches the visitor renderer's allowlist). The widget's\n * `prose`-style ruleset clamps headings / list spacing to the bubble\n * geometry so a paragraph from the editor doesn't blow out the chat\n * width.\n */\nfunction MessageBody({\n text,\n isOutbound,\n onInternalLink,\n}: {\n text: string;\n isOutbound: boolean;\n onInternalLink?: (link: InternalLink) => void;\n}) {\n // Delegate click handling on the bubble body so any `<a>` embedded\n // by the operator / AI reply gets a chance to route through the\n // widget instead of letting the browser navigate. Modifier-clicks\n // (cmd / ctrl / shift / middle button) fall through to default\n // behaviour — those are explicit \"open elsewhere\" gestures and the\n // visitor's intent already overrides ours.\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n if (!onInternalLink) return;\n if (event.defaultPrevented) return;\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;\n if (event.button !== 0) return;\n const anchor = (event.target as HTMLElement | null)?.closest?.(\"a\");\n if (!anchor) return;\n const href = anchor.getAttribute(\"href\");\n if (!href) return;\n const internal = parseInternalLink(href);\n if (!internal) return;\n event.preventDefault();\n onInternalLink(internal);\n },\n [onInternalLink],\n );\n\n const isHtml = /^\\s*<[a-z][a-z0-9]*(\\s|>|\\/)/i.test(text);\n if (!isHtml) {\n return <p className=\"whitespace-pre-wrap leading-relaxed\">{text}</p>;\n }\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: click is a delegating dispatcher — the underlying `<a>` is keyboard-activatable natively, the wrapper just intercepts mouse-driven default navigation\n <div\n onClick={handleClick}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: BE-sanitised\n dangerouslySetInnerHTML={{ __html: text }}\n className={cn(\n \"leading-relaxed\",\n // Tighten editor-spawned block elements to match bubble cadence.\n \"[&>p]:my-0 [&>p+p]:mt-2\",\n \"[&_a]:underline [&_a]:underline-offset-2 [&_a]:opacity-90 [&_a:hover]:opacity-100\",\n \"[&_strong]:font-semibold [&_em]:italic\",\n \"[&_ul]:my-1.5 [&_ul]:list-disc [&_ul]:pl-5\",\n \"[&_ol]:my-1.5 [&_ol]:list-decimal [&_ol]:pl-5\",\n \"[&_li]:my-0.5\",\n \"[&_code]:rounded-sm [&_code]:bg-black/10 [&_code]:px-1 [&_code]:py-0.5 [&_code]:text-[0.85em]\",\n // Inbound bubbles use primary-fg text → keep code/link contrast.\n !isOutbound && \"[&_code]:bg-white/15\",\n )}\n />\n );\n}\n\n/**\n * Renders the visual (image / video) media stack at the top of a\n * message bubble. Single item → full-width tile that triggers the\n * lightbox on tap; multiple items → 2-column grid where each cell\n * crops to a sensible thumbnail and opens the lightbox at the\n * right index. Videos get the inline `<video controls>` for quick\n * preview AND the lightbox click affordance.\n */\nfunction VisualMediaBlock({\n items,\n onOpenLightbox,\n}: {\n items: { url: string; mimetype: string; alt: string }[];\n onOpenLightbox?: (items: LightboxItem[], index: number) => void;\n}) {\n const t = useTranslations(\"messages\");\n if (items.length === 0) return null;\n const multi = items.length > 1;\n return (\n <div\n className={cn(\n \"grid w-full\",\n multi ? \"max-h-[20rem] grid-cols-2 gap-0.5 auto-rows-fr\" : \"grid-cols-1\",\n )}\n >\n {items.map((item, idx) => {\n const handleOpen = () => onOpenLightbox?.(items, idx);\n // PDF — full-bleed clickable card; opens the lightbox (iframe). No\n // inline preview thumbnail (we'd need PDF.js to rasterise the first\n // page) so we show a \"PDF\" badge + filename + mimetype.\n if (item.mimetype === \"application/pdf\") {\n return (\n <button\n type=\"button\"\n // biome-ignore lint/suspicious/noArrayIndexKey: per-message media is fixed-order and never reordered\n key={idx}\n onClick={handleOpen}\n aria-label={item.alt || t(\"openPreview\")}\n className={cn(\n \"group flex w-full cursor-zoom-in items-center gap-3 px-4 py-3 text-left\",\n \"bg-wx-bg-elevated text-wx-fg transition-colors hover:bg-wx-bg-elevated-2\",\n )}\n >\n <span className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-wx-sm bg-wx-bg text-[10px] font-bold tracking-wider text-wx-fg-muted shadow-sm\">\n PDF\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"truncate text-sm font-medium\">{item.alt}</span>\n <span className=\"truncate text-xs text-wx-fg-muted\">{item.mimetype}</span>\n </span>\n </button>\n );\n }\n if (item.mimetype.startsWith(\"video/\")) {\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: per-message media is fixed-order and never reordered\n <div key={idx} className=\"relative w-full\">\n {/* biome-ignore lint/a11y/useMediaCaption: operator-provided */}\n <video\n src={item.url}\n controls\n preload=\"metadata\"\n className={cn(\"block w-full\", multi ? \"h-full object-cover\" : \"max-h-80\")}\n />\n {/* Invisible click target above the video, but only\n in the top-right corner — leaves the native\n controls fully usable while still surfacing a\n lightbox affordance for the rest. Simpler:\n multi-gallery always lightboxes; single video\n lets the visitor play inline. */}\n {multi && (\n <button\n type=\"button\"\n aria-label={item.alt || t(\"openPreview\")}\n onClick={handleOpen}\n className=\"absolute inset-0 cursor-zoom-in\"\n />\n )}\n </div>\n );\n }\n return (\n <button\n type=\"button\"\n // biome-ignore lint/suspicious/noArrayIndexKey: per-message media is fixed-order and never reordered\n key={idx}\n onClick={handleOpen}\n aria-label={item.alt || t(\"openImage\")}\n className={cn(\"group relative block w-full overflow-hidden\", \"cursor-zoom-in\")}\n >\n {/* biome-ignore lint/performance/noImgElement: operator/visitor message media of arbitrary host/dimensions; next/image needs known sizes + an allowlist */}\n <img\n src={item.url}\n alt={item.alt}\n loading=\"lazy\"\n className={cn(\n \"block w-full transition-transform duration-200 group-hover:scale-[1.02]\",\n multi ? \"h-full object-cover\" : \"max-h-80 object-cover\",\n )}\n />\n </button>\n );\n })}\n </div>\n );\n}\n\n/**\n * Renderer for NON-VISUAL message media (audio / documents). Visual\n * media (image / video) is handled upstream by `VisualMediaBlock`\n * so it can sit full-bleed at the top of the bubble; this helper\n * stays focused on the in-bubble item types where the bubble\n * background needs to stick.\n */\nfunction Media({\n media,\n onDark,\n}: {\n media: { url: string; mimetype: string; alt: string };\n /** True when the surrounding bubble uses `bg-wx-primary` (visitor's\n * own message). Forwarded to the audio player so it inverts its\n * palette. */\n onDark?: boolean;\n}) {\n if (media.mimetype.startsWith(\"audio/\")) {\n // `AudioBubblePlayer` pulls in `wavesurfer.js` (~60 KB) — lazy so\n // it only loads for conversations that actually contain a voice\n // note. The fallback keeps the bubble's height stable while the\n // chunk streams in.\n return (\n <Suspense\n fallback={\n <div className=\"h-12 w-56 max-w-full animate-pulse rounded-wx bg-wx-bg-elevated\" />\n }\n >\n <AudioBubblePlayer src={media.url} onDark={onDark} />\n </Suspense>\n );\n }\n return <FileCard media={media} />;\n}\n\n/**\n * Generic file card. Used for documents (PDF, docx, xlsx, txt, etc.)\n * — anything the visitor can't preview inline. The icon hints at\n * mimetype family; tap → open in a new tab.\n */\nfunction FileCard({ media }: { media: { url: string; mimetype: string; alt: string } }) {\n const label = media.alt || media.url.split(\"/\").pop() || media.mimetype || \"File\";\n const typeChip = mimetypeChip(media.mimetype);\n return (\n <a\n href={media.url}\n target=\"_blank\"\n rel=\"noopener\"\n className=\"flex max-w-xs items-center gap-3 rounded-wx-sm bg-wx-bg-elevated/60 px-3 py-2.5 text-xs text-wx-fg transition-colors hover:bg-wx-bg-elevated\"\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-wx-sm bg-wx-bg-elevated-2 text-[10px] font-bold tracking-wider text-wx-fg-muted uppercase\">\n {typeChip}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium text-wx-fg\">{label}</span>\n <span className=\"block truncate text-wx-fg-subtle\">{media.mimetype || \"file\"}</span>\n </span>\n </a>\n );\n}\n\nfunction mimetypeChip(mimetype: string): string {\n if (!mimetype) return \"FILE\";\n if (mimetype.includes(\"pdf\")) return \"PDF\";\n if (mimetype.includes(\"zip\") || mimetype.includes(\"compressed\")) return \"ZIP\";\n if (mimetype.includes(\"spreadsheet\") || mimetype.includes(\"excel\")) return \"XLS\";\n if (mimetype.includes(\"word\") || mimetype.includes(\"document\")) return \"DOC\";\n if (mimetype.startsWith(\"text/\")) return \"TXT\";\n const sub = mimetype.split(\"/\")[1] ?? \"\";\n return sub.slice(0, 4).toUpperCase() || \"FILE\";\n}\n","\"use client\";\n\nimport { motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { BotAvatar } from \"./bot-avatar\";\n\n/**\n * Typing indicator rendered as a real bubble — avatar + bubble with\n * three animated dots inside. Reads as \"this sender is composing\"\n * with the same visual weight as a regular operator message, so\n * it slots cleanly into the conversation flow.\n */\nexport function TypingBubble({\n actorName,\n actorKind,\n actorAvatarUrl,\n actorPhase,\n aiAssistantAvatarUrl,\n organizationLogoUrl,\n organizationName,\n}: {\n actorName: string;\n actorKind?: string;\n /** Operator's own photo from the SSE beat (`from.avatar`). Wins over\n * the initials monogram / org logo for human senders; AI/bot beats\n * ignore it (they use `aiAssistantAvatarUrl`). */\n actorAvatarUrl?: string;\n /** AI turn phase (`\"thinking\"` / `\"searching\"` / `\"typing\"`) — drives\n * the caption beneath the bubble. Defaults to \"typing\" for operators. */\n actorPhase?: string;\n /** Operator-uploaded AI avatar — surfaced on AI/bot typing\n * indicators when the configured `aiAssistantAvatarUrl` is set.\n * When null, the indicator renders without an avatar (column\n * collapses) — matches the no-bot-identity choice on the\n * message-bubble side. */\n aiAssistantAvatarUrl?: string | null;\n organizationLogoUrl?: string | null;\n organizationName?: string;\n}) {\n const t = useTranslations(\"messages\");\n return (\n <motion.div\n layout=\"position\"\n initial={{ opacity: 0, y: 6 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.18 }}\n className=\"flex flex-col items-start gap-1.5\"\n >\n <div className=\"flex max-w-[85%] items-start gap-2\">\n <BotAvatar\n size={28}\n senderKind={actorKind}\n // Threading the actor's name lets BotAvatar paint the\n // operator's initials in the monogram fallback when the\n // SSE typing event omits an avatar URL. Previously the\n // typing indicator showed the org's first letter \"W\"\n // regardless of who was typing.\n senderName={actorName}\n senderAvatarUrl={actorAvatarUrl}\n aiAssistantAvatarUrl={aiAssistantAvatarUrl}\n organizationLogoUrl={organizationLogoUrl}\n organizationName={organizationName}\n className=\"mt-0.5\"\n />\n <div className=\"rounded-wx-lg bg-wx-bg-elevated px-4 py-3 text-sm text-wx-fg\">\n <span className=\"inline-flex items-end gap-1\">\n <span className=\"h-1.5 w-1.5 animate-bounce rounded-full bg-wx-fg-muted [animation-delay:-0.3s]\" />\n <span className=\"h-1.5 w-1.5 animate-bounce rounded-full bg-wx-fg-muted [animation-delay:-0.15s]\" />\n <span className=\"h-1.5 w-1.5 animate-bounce rounded-full bg-wx-fg-muted\" />\n </span>\n </div>\n </div>\n <p className=\"ml-9 text-[11px] text-wx-fg-subtle\">\n {/* Fall back to a generic name when the SSE event lacks a real\n one — the previous `\"…\"` placeholder read as a literal\n ellipsis next to \"typing…\", which looked broken. */}\n <span className=\"font-medium text-wx-fg-muted\">\n {actorName && actorName !== \"…\" ? actorName : t(\"typingSomeone\")}\n </span>\n <span aria-hidden=\"true\"> · </span>\n <span>\n {actorPhase === \"thinking\"\n ? t(\"aiThinking\")\n : actorPhase === \"searching\"\n ? t(\"aiSearching\")\n : t(\"typing\")}\n </span>\n </p>\n </motion.div>\n );\n}\n","import { forwardRef } from \"react\";\n\n/**\n * \"Unread messages\" divider — a hairline rule with a centered label,\n * marking where the visitor's unread run begins. The tab scrolls this into\n * the centre of the viewport on open so the visitor lands on the first\n * thing they haven't seen. Forwards a ref so the tab can drive that scroll.\n */\nexport const UnreadDivider = forwardRef<HTMLDivElement, { label: string }>(({ label }, ref) => (\n <div ref={ref} className=\"flex items-center gap-2 py-1\">\n <span aria-hidden=\"true\" className=\"h-px flex-1 bg-wx-danger/40\" />\n <span className=\"text-[11px] font-semibold text-wx-danger\">{label}</span>\n <span aria-hidden=\"true\" className=\"h-px flex-1 bg-wx-danger/40\" />\n </div>\n));\nUnreadDivider.displayName = \"UnreadDivider\";\n","\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\n\n// Per-character base cadence (ms). Deliberately unhurried — a constant\n// fast tick reads as a machine ticker; this plus the jitter below reads\n// as a person typing.\nconst BASE_CHAR_MS = 42;\n\n/**\n * Humanized delay (ms) BEFORE revealing the next character, derived from\n * the char we just revealed (`prevChar`). Real typing isn't metronomic:\n * keystrokes vary, and people pause at the end of a sentence or clause.\n * - ±40% jitter on every keystroke so no two land on the same beat\n * - a long beat after sentence enders (`. ! ?`)\n * - a shorter beat after clause punctuation (`, ; :`)\n */\nfunction nextDelay(prevChar: string | undefined): number {\n const jitter = 0.6 + Math.random() * 0.8; // 0.6×–1.4×\n let ms = BASE_CHAR_MS * jitter;\n if (prevChar && \".!?\".includes(prevChar)) ms += 380;\n else if (prevChar && \",;:\".includes(prevChar)) ms += 180;\n return ms;\n}\n\n/**\n * Reveals `text` CHARACTER-by-character with a blinking block caret at the\n * head, like a live typing effect (the \"Typewriter 01\" look). The cadence\n * is humanized (jittered, with pauses after punctuation) rather than a\n * constant tick. The caret disappears once the full text is shown.\n *\n * When `startDelayMs > 0`, a brief \"thinking\" beat — three bouncing dots,\n * the same motif as the conversation's TypingBubble — plays first, so the\n * sender reads as composing before the words appear. Restarts (back to the\n * thinking beat) if `text` changes (e.g. a locale switch).\n *\n * Used for the operator's intro messages so they read as being composed\n * live rather than popping in whole.\n */\nexport function Typewriter({\n text,\n startDelayMs = 0,\n onDone,\n}: {\n text: string;\n /** Hold a \"typing…\" loading indicator (bouncing dots) for this long\n * before the first character appears — the sender \"thinks\" first. */\n startDelayMs?: number;\n onDone?: () => void;\n}) {\n // -1 → still in the pre-type \"thinking\" beat (dots showing);\n // 0..length → that many characters revealed.\n const [shown, setShown] = useState(startDelayMs > 0 ? -1 : 0);\n // Keep the latest callback without re-arming the reveal timer.\n const onDoneRef = useRef(onDone);\n onDoneRef.current = onDone;\n\n // Restart the reveal whenever the source text changes — back to the\n // thinking beat so a locale switch re-types from scratch.\n // biome-ignore lint/correctness/useExhaustiveDependencies: resetting on `text` change is the intent\n useEffect(() => setShown(startDelayMs > 0 ? -1 : 0), [text]);\n\n useEffect(() => {\n // Thinking beat → reveal the first character after the hold.\n if (shown < 0) {\n const id = setTimeout(() => setShown(0), startDelayMs);\n return () => clearTimeout(id);\n }\n if (shown >= text.length) {\n onDoneRef.current?.();\n return;\n }\n const id = setTimeout(() => setShown((n) => n + 1), nextDelay(text[shown - 1]));\n return () => clearTimeout(id);\n }, [shown, text, startDelayMs]);\n\n // Pre-type \"thinking\" beat — three bouncing dots in the current text\n // colour, mirroring the TypingBubble indicator so the reveal reads as\n // the sender composing the message.\n if (shown < 0) {\n return (\n <span className=\"inline-flex items-end gap-1 align-middle\" aria-hidden=\"true\">\n <span className=\"h-1.5 w-1.5 animate-bounce rounded-full bg-current opacity-60 [animation-delay:-0.3s]\" />\n <span className=\"h-1.5 w-1.5 animate-bounce rounded-full bg-current opacity-60 [animation-delay:-0.15s]\" />\n <span className=\"h-1.5 w-1.5 animate-bounce rounded-full bg-current opacity-60\" />\n </span>\n );\n }\n\n const done = shown >= text.length;\n return (\n <>\n {text.slice(0, shown)}\n {!done && (\n // Solid block caret — blinks while typing, gone when done.\n <span\n aria-hidden=\"true\"\n className=\"ml-0.5 inline-block h-[1.05em] w-[0.5em] translate-y-[0.15em] animate-pulse rounded-[1px] bg-current align-baseline\"\n />\n )}\n </>\n );\n}\n","import { Lightbulb } from \"lucide-react\";\nimport type { WidgetMessengerConfig } from \"@/lib/widget-config\";\nimport { Typewriter } from \"./typewriter\";\n\n/**\n * Renders one operator-configured welcome message at the top of the\n * messenger thread.\n *\n * Two kinds, two layouts:\n * - **HINT** — centred dim italic strip. Reads as a tip /\n * hint, not a message — same visual weight as\n * the home-tab \"Usually replies in a few minutes\"\n * footer.\n * - **SYSTEM** — centred pill on a muted surface. Matches the\n * runtime SYSTEM messages the BE emits during\n * handoffs / status changes.\n *\n * (`TEXT` was removed when the BE landed the WEB_VISITOR_VISIT flow\n * trigger — proactive bot bubbles now arrive via SSE as runtime\n * messages, not as static config. The `MessageBubble` AI branch is\n * the source of truth for that look.)\n */\nexport function WelcomeMessage({\n kind,\n text,\n typewriter = false,\n typewriterDelayMs = 0,\n}: {\n kind: WidgetMessengerConfig[\"messages\"][number][\"kind\"];\n text: string;\n /** SYSTEM: reveal the body character-by-character with a blinking\n * caret. Off → renders whole. HINT ignores the flag — tips don't\n * type in. */\n typewriter?: boolean;\n /** When `typewriter`: hold a \"typing…\" beat (bouncing dots) for this\n * long before the first character appears. 0 → type immediately. */\n typewriterDelayMs?: number;\n}) {\n if (kind === \"SYSTEM\") {\n return (\n <div className=\"flex justify-center px-2 py-1\">\n <span className=\"text-[11px] text-wx-fg-muted\">\n {typewriter ? <Typewriter text={text} startDelayMs={typewriterDelayMs} /> : text}\n </span>\n </div>\n );\n }\n // HINT — full-width, left-aligned tip card. Icon pinned to the top\n // (`items-start` + `mt-0.5`) so it stays beside the first line when\n // the text wraps to multiple lines.\n return (\n <div className=\"flex w-full items-start gap-2 rounded-wx-sm border border-wx-border bg-wx-bg px-3 py-2.5 text-wx-fg-muted\">\n <Lightbulb size={15} className=\"mt-0.5 shrink-0\" aria-hidden=\"true\" />\n <p className=\"text-xs leading-relaxed italic\">{text}</p>\n </div>\n );\n}\n","import type { MockMessage, MockMessageButton, MockMessageMedia } from \"@/dummy\";\nimport { AI_ASSISTANT_NAME } from \"@/lib/ai-assistant\";\n\n/**\n * Map the BE's `visitorChatHistory` payload into the widget's local\n * `MockMessage` shape. Defensive on every field — history rows arrive\n * as loosely-typed JSON. Reverses the list so the oldest message is\n * first (the BE returns newest-first).\n */\nexport function mapHistoryToMessages(\n data: { visitorChatHistory: unknown } | null | undefined,\n locale: string,\n): MockMessage[] {\n if (!data) return [];\n const raw = data.visitorChatHistory;\n if (!raw || typeof raw !== \"object\") return [];\n const items = (raw as { items?: unknown }).items;\n if (!Array.isArray(items)) return [];\n return items\n .filter((m): m is Record<string, unknown> => typeof m === \"object\" && m !== null)\n .map((m, idx): MockMessage => {\n const sender = (m.sender as { kind?: string; name?: string }) ?? {};\n const deliveryStatus =\n typeof m.deliveryStatus === \"string\"\n ? (m.deliveryStatus as MockMessage[\"deliveryStatus\"])\n : undefined;\n // Quick-reply buttons survive across reloads — the BE persists\n // them on the message row. Previously the mapper dropped this\n // field on the floor, so re-opening the chat after a session\n // refresh showed text bubbles without the chips that were\n // there in the live session.\n // Operator avatar — flows down on the same `sender.avatar`\n // field the SSE-live path uses. Without mapping it here the\n // operator bubbles after a page reload showed the monogram\n // fallback even when the operator had a personal photo set.\n const senderAvatar =\n typeof (sender as { avatar?: unknown }).avatar === \"string\"\n ? (sender as { avatar: string }).avatar\n : undefined;\n const rawButtons = m.buttons;\n const buttons: MockMessageButton[] | undefined = Array.isArray(rawButtons)\n ? rawButtons\n .filter((b): b is Record<string, unknown> => typeof b === \"object\" && b !== null)\n .map((b) => {\n // The BE shape uses `{ label, value }`; the widget's\n // local `MockMessageButton` shape uses `{ text, payload }`.\n const label =\n typeof b.label === \"string\" ? b.label : typeof b.text === \"string\" ? b.text : \"\";\n const value =\n typeof b.value === \"string\"\n ? b.value\n : typeof b.payload === \"string\"\n ? b.payload\n : label;\n return { text: label, payload: value };\n })\n .filter((b) => !!b.text)\n : undefined;\n const senderKind = (sender.kind as MockMessage[\"sender\"][\"kind\"]) ?? \"operator\";\n // Bot / AI senders read as AI_ASSISTANT_NAME in the bubble regardless of\n // what the BE labels them. Operator names flow through\n // untouched so a \"Real human is now here\" handoff still feels\n // human.\n const senderName =\n senderKind === \"ai\" || senderKind === \"bot\" ? AI_ASSISTANT_NAME : (sender.name ?? \"\");\n const media = normalizeBackendMedia(m.media);\n const createdAt = typeof m.createdAt === \"string\" ? m.createdAt : undefined;\n return {\n id: String(m.id ?? `m-${idx}`),\n direction: (m.direction === \"INBOUND\" ? \"INBOUND\" : \"OUTBOUND\") as \"INBOUND\" | \"OUTBOUND\",\n text: typeof m.text === \"string\" ? m.text : \"\",\n ageLabel: formatAge(createdAt, locale),\n // Keep the raw timestamp for date-separator grouping (ageLabel is\n // only the time-of-day string).\n ...(createdAt ? { createdAt } : {}),\n sender: {\n kind: senderKind,\n name: senderName,\n ...(senderAvatar ? { avatar: senderAvatar } : {}),\n },\n ...(media.length > 0 ? { media } : {}),\n ...(buttons && buttons.length > 0 ? { buttons } : {}),\n ...(deliveryStatus ? { deliveryStatus } : {}),\n };\n })\n .reverse();\n}\n\n/**\n * Normalize the BE's media shape into the widget's local\n * `MockMessageMedia` shape. Accepts either:\n * - history rows: `media: [{ url, mimeType, filename, ... }]`\n * - SSE media event: `media: { mediaId: { url, mimeType, filename, ... } }`\n *\n * The BE uses `mimeType` (camelCase) while the widget's renderer\n * (`MessageBubble`, `Media`, `media-lightbox`) all key off `mimetype`\n * (lowercase). Renaming is the one transform we have to do here.\n */\nexport function normalizeBackendMedia(raw: unknown): MockMessageMedia[] {\n if (!raw) return [];\n const items: unknown[] = Array.isArray(raw)\n ? raw\n : typeof raw === \"object\" && raw !== null\n ? [\n // SSE single-attachment event. The CURRENT shape carries the media\n // fields on the object itself: `{ mediaId: string, url, mimeType,\n // filename, thumbnailUrl, caption }`. An older shape nested the\n // whole Media doc under `mediaId` — unwrap that ONLY when it's an\n // object (the new `mediaId` is a bare string id, not the doc).\n typeof (raw as { mediaId?: unknown }).mediaId === \"object\" &&\n (raw as { mediaId?: unknown }).mediaId !== null\n ? (raw as { mediaId: unknown }).mediaId\n : raw,\n ]\n : [];\n return items\n .filter((m): m is Record<string, unknown> => typeof m === \"object\" && m !== null)\n .map((m) => {\n const url = typeof m.url === \"string\" ? m.url : \"\";\n const mimetype =\n typeof m.mimeType === \"string\"\n ? m.mimeType\n : typeof m.mimetype === \"string\"\n ? m.mimetype\n : \"\";\n const alt =\n typeof m.filename === \"string\" ? m.filename : typeof m.alt === \"string\" ? m.alt : \"\";\n return { url, mimetype, alt };\n })\n .filter((m) => !!m.url && !!m.mimetype);\n}\n\n/**\n * Decode the recorder bar's raw base64 payload back into a Blob so\n * the optimistic visitor bubble can play the audio locally — the\n * BE round-trip would otherwise leave the visitor staring at a\n * silent bubble for a beat. Match the recorder's emitted mime type\n * exactly so `<audio>` picks the right decoder.\n */\nexport function base64ToBlob(base64: string, mimetype: string): Blob {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return new Blob([bytes], { type: mimetype });\n}\n\n/** Format a timestamp into a short locale-aware \"h:mm\" age label. */\nfunction formatAge(timestamp: string | undefined, locale: string): string {\n if (!timestamp) return \"\";\n try {\n return new Date(timestamp).toLocaleTimeString(locale, {\n hour: \"numeric\",\n minute: \"2-digit\",\n });\n } catch {\n return \"\";\n }\n}\n","import type { MockMessage } from \"@/dummy\";\n\n/**\n * A rendered row in the thread — either a real message bubble, a date\n * separator chip (\"Today\" / \"Yesterday\" / \"17 Apr\"), or the single\n * \"unread messages\" divider. `buildMessageRows` interleaves the separators\n * and divider into the chronological message list so the renderer can map\n * straight over the result.\n */\nexport type MessageRow =\n | { kind: \"date\"; key: string; label: string }\n | { kind: \"unread\"; key: string }\n | { kind: \"message\"; key: string; message: MockMessage };\n\nexport interface BuildMessageRowsOptions {\n locale: string;\n /** Localised \"Today\" / \"Yesterday\" labels for the relative separators. */\n todayLabel: string;\n yesterdayLabel: string;\n /** Id of the FIRST unread message — an \"unread\" divider row is inserted\n * directly before it. `null` / absent → no divider. */\n unreadAnchorId?: string | null;\n /** Clock used for the today/yesterday comparison. Injectable for tests;\n * defaults to `new Date()`. */\n now?: Date;\n}\n\nconst sameDay = (a: Date, b: Date): boolean =>\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate();\n\n/** A message's timestamp, defaulting a missing `createdAt` to `now` — an\n * optimistic/live append with no timestamp is \"just now\", so it groups\n * under today. */\nfunction timestampOf(m: MockMessage, now: Date): Date {\n if (m.createdAt) {\n const d = new Date(m.createdAt);\n if (!Number.isNaN(d.getTime())) return d;\n }\n return now;\n}\n\n/** Date-separator label: Today / Yesterday / \"17 Apr\" (same year) /\n * \"17 Apr 2024\" (older). */\nfunction dateLabel(d: Date, o: BuildMessageRowsOptions, now: Date): string {\n if (sameDay(d, now)) return o.todayLabel;\n const yesterday = new Date(now);\n yesterday.setDate(now.getDate() - 1);\n if (sameDay(d, yesterday)) return o.yesterdayLabel;\n return d.toLocaleDateString(\n o.locale,\n d.getFullYear() === now.getFullYear()\n ? { day: \"numeric\", month: \"short\" }\n : { day: \"numeric\", month: \"short\", year: \"numeric\" },\n );\n}\n\n/**\n * Interleave date separators + the unread divider into a chronological\n * message list. A date row is emitted whenever the calendar day changes\n * from the previous message; the unread divider is emitted once, directly\n * before the message whose id matches `unreadAnchorId`.\n */\nexport function buildMessageRows(\n messages: MockMessage[],\n o: BuildMessageRowsOptions,\n): MessageRow[] {\n const now = o.now ?? new Date();\n const rows: MessageRow[] = [];\n let lastDayKey: string | null = null;\n\n for (const m of messages) {\n const ts = timestampOf(m, now);\n const dayKey = `${ts.getFullYear()}-${ts.getMonth()}-${ts.getDate()}`;\n if (dayKey !== lastDayKey) {\n lastDayKey = dayKey;\n rows.push({ kind: \"date\", key: `date-${dayKey}`, label: dateLabel(ts, o, now) });\n }\n // The unread divider sits ABOVE its anchor message but BELOW that\n // message's date separator (emitted just above).\n if (o.unreadAnchorId && m.id === o.unreadAnchorId) {\n rows.push({ kind: \"unread\", key: \"unread-divider\" });\n }\n // Prefer `clientKey` when present — it stays stable across the\n // tmp-id → BE-id swap that happens when an optimistic send\n // resolves, so React's `<AnimatePresence>` doesn't see the row\n // as a fresh element and re-play the entrance animation. History\n // messages don't carry one; `id` is the BE-canonical stable id\n // for those.\n rows.push({ kind: \"message\", key: m.clientKey ?? m.id, message: m });\n }\n\n return rows;\n}\n","import * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Text input primitive — used by the Help tab's search box and the\n * (Day 2+) message composer. Tokenised so brand radius/border/bg\n * propagate from operator overrides.\n *\n * Composer-style \"input with leading icon\" usage:\n *\n * <div className=\"relative\">\n * <Search className=\"absolute left-3.5 top-1/2 -translate-y-1/2 …\" />\n * <Input className=\"pl-10\" placeholder=\"Search…\" />\n * </div>\n */\nexport const Input = React.forwardRef<\n HTMLInputElement,\n React.InputHTMLAttributes<HTMLInputElement>\n>(({ className, type, ...props }, ref) => (\n <input\n ref={ref}\n type={type}\n className={cn(\n \"h-11 w-full rounded-wx bg-wx-bg-elevated px-4 text-sm text-wx-fg\",\n \"placeholder:text-wx-fg-muted\",\n \"focus:outline-none focus:ring-2 focus:ring-wx-primary\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n));\nInput.displayName = \"Input\";\n","import type { WidgetPrechatField, WidgetPrechatForm } from \"@/lib/widget-config\";\n\n/** Map a prechat field kind to the matching `<input type>`. */\nexport function inputTypeFor(kind: WidgetPrechatField[\"kind\"]): string {\n if (kind === \"EMAIL\") return \"email\";\n if (kind === \"PHONE\") return \"tel\";\n return \"text\";\n}\n\n/** Map a prechat field kind to a sensible `autocomplete` token. */\nexport function autocompleteFor(kind: WidgetPrechatField[\"kind\"]): string | undefined {\n if (kind === \"NAME\") return \"name\";\n if (kind === \"EMAIL\") return \"email\";\n if (kind === \"PHONE\") return \"tel\";\n return \"off\";\n}\n\n/** localStorage key recording that this integration's prechat form was\n * submitted (so we don't ask the visitor again on return visits). `scope`\n * is the integration's `publicKey` — the stable per-integration id the\n * widget already holds (the visitor config no longer carries an\n * integrationId). */\nexport function prechatStorageKey(scope: string): string {\n return `wexio:prechat-submitted:${scope}`;\n}\n\n/** Whether the visitor already submitted the prechat form for this\n * integration. Defensive against storage being unavailable (private\n * mode / blocked cookies) — treats failure as \"not submitted\". */\nexport function hasSubmittedPrechat(scope: string): boolean {\n try {\n return localStorage.getItem(prechatStorageKey(scope)) === \"1\";\n } catch {\n return false;\n }\n}\n\n/** Record that this integration's prechat was satisfied so the fields\n * don't reappear for the visitor. Swallows storage failures (private\n * mode) — the dismissal is then in-memory for the session only. */\nexport function markPrechatSubmitted(scope: string): void {\n try {\n localStorage.setItem(prechatStorageKey(scope), \"1\");\n } catch {\n /* private mode — accept an in-memory dismissal for this session */\n }\n}\n\n/** Translated copy for the per-kind validation failures. */\nexport interface PrechatErrorMessages {\n required: string;\n invalidEmail: string;\n invalidPhone: string;\n}\n\n/**\n * Validate the prechat field values against the operator's form config.\n * Returns a `{ [fieldKey]: message }` map of the fields that failed —\n * empty when everything's valid. Mirrors the BE's own re-validation\n * (the BE is the source of truth; this is just fast client feedback).\n */\nexport function validatePrechat(\n form: WidgetPrechatForm,\n values: Record<string, string>,\n msgs: PrechatErrorMessages,\n): Record<string, string> {\n const errors: Record<string, string> = {};\n for (const field of form.fields) {\n const value = (values[field.key] ?? \"\").trim();\n if (field.required && !value) {\n errors[field.key] = msgs.required;\n continue;\n }\n if (!value) continue;\n if (field.kind === \"EMAIL\" && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) {\n errors[field.key] = msgs.invalidEmail;\n } else if (field.kind === \"PHONE\" && !/^[+\\d\\s()-]{5,}$/.test(value)) {\n errors[field.key] = msgs.invalidPhone;\n }\n }\n return errors;\n}\n\n/** The populated (non-empty, trimmed) prechat fields, ready to POST. */\nexport function collectPrechatFields(\n form: WidgetPrechatForm,\n values: Record<string, string>,\n): { key: string; value: string }[] {\n return form.fields\n .map((f) => ({ key: f.key, value: (values[f.key] ?? \"\").trim() }))\n .filter((f) => f.value.length > 0);\n}\n\n/**\n * Map host-supplied default profile values onto the form's field keys by\n * kind (`NAME → name`, `EMAIL → email`, `PHONE → phone`). `CUSTOM_TEXT`\n * fields have no source, so they're left for the visitor. Returns a\n * `{ [fieldKey]: value }` map (empty entries dropped) used to pre-fill\n * the prechat — and, when it covers every required field, to attach the\n * details + skip the form entirely.\n */\nexport function prefillToValues(\n form: WidgetPrechatForm,\n prefill: { name?: string; email?: string; phone?: string } | null | undefined,\n): Record<string, string> {\n if (!prefill) return {};\n const out: Record<string, string> = {};\n for (const field of form.fields) {\n const raw =\n field.kind === \"NAME\"\n ? prefill.name\n : field.kind === \"EMAIL\"\n ? prefill.email\n : field.kind === \"PHONE\"\n ? prefill.phone\n : undefined;\n const value = raw?.trim();\n if (value) out[field.key] = value;\n }\n return out;\n}\n","\"use client\";\n\nimport { useTranslations } from \"next-intl\";\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/utils\";\nimport type { WidgetPrechatField, WidgetPrechatForm } from \"@/lib/widget-config\";\nimport { autocompleteFor, inputTypeFor } from \"./helpers\";\n\ninterface PrechatComposerFieldsProps {\n form: WidgetPrechatForm;\n values: Record<string, string>;\n errors: Record<string, string>;\n onChange: (key: string, value: string) => void;\n /** Disable inputs while the combined send (prechat + message) is in flight. */\n disabled?: boolean;\n}\n\n/**\n * Compact prechat fields rendered ABOVE the message editor inside the\n * composer envelope — the visitor fills these once, alongside their\n * first message, and a single send submits both. Distinct from\n * `PrechatForm` (the full / standalone takeover); this variant is just\n * the field stack — no title, no own submit button, no `<form>`. The\n * parent (`MessagesTab`) owns the values, validation, and the combined\n * submit so the prechat write and the message send fire together.\n *\n * Kept deliberately small: the label lives in the placeholder (with a\n * persistent `aria-label` for screen readers), so each field is a\n * single tight row. Errors paint as a red ring + a one-line hint that\n * only takes space when present.\n */\nexport function PrechatComposerFields({\n form,\n values,\n errors,\n onChange,\n disabled = false,\n}: PrechatComposerFieldsProps) {\n const t = useTranslations(\"prechat\");\n\n const labelFor = (field: WidgetPrechatField) => {\n if (field.label.trim()) return field.label;\n switch (field.kind) {\n case \"NAME\":\n return t(\"labelName\");\n case \"EMAIL\":\n return t(\"labelEmail\");\n case \"PHONE\":\n return t(\"labelPhone\");\n case \"CUSTOM_TEXT\":\n return t(\"labelCustom\");\n }\n };\n\n return (\n <div className=\"flex flex-col gap-1.5 border-wx-border border-b px-2.5 pt-2 pb-1.5\">\n {form.fields.map((field) => {\n const label = labelFor(field);\n const err = errors[field.key];\n return (\n <div key={field.key}>\n <Input\n type={inputTypeFor(field.kind)}\n value={values[field.key] ?? \"\"}\n onChange={(e) => onChange(field.key, e.target.value)}\n autoComplete={autocompleteFor(field.kind)}\n disabled={disabled}\n aria-invalid={!!err}\n aria-label={label}\n placeholder={field.required ? `${label} *` : label}\n className={cn(\n \"h-8 rounded-wx-md px-3 text-[13px]\",\n err && \"ring-1 ring-wx-danger placeholder:text-wx-danger/60 focus:ring-wx-danger\",\n )}\n />\n {err && <p className=\"mt-0.5 px-1 text-[10px] text-wx-danger leading-none\">{err}</p>}\n </div>\n );\n })}\n </div>\n );\n}\n","\"use client\";\n\nimport { Command, Paperclip, Smile } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { useLocale, useTranslations } from \"next-intl\";\nimport { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport {\n getMockConversation,\n getMockWelcomeMessages,\n type MockMessage,\n type MockMessageButton,\n} from \"@/dummy\";\nimport { AI_ASSISTANT_NAME } from \"@/lib/ai-assistant\";\nimport { getPublicKey } from \"@/lib/apollo-client\";\nimport { ALLOWED_UPLOAD_MIMES, fileToBase64, MAX_UPLOAD_BYTES } from \"@/lib/file-to-base64\";\nimport {\n useMarkVisitorChatReadMutation,\n useRemoveVisitorMediaMutation,\n useSendVisitorMessageMutation,\n useSignalVisitorTypingMutation,\n useSubmitVisitorPrechatMutation,\n useUploadVisitorMediaMutation,\n useVisitorChatHistoryQuery,\n} from \"@/lib/graphql/queries/generated/messaging.generated\";\nimport type { RealtimeMessageEvent } from \"@/lib/use-visitor-realtime\";\nimport { cn } from \"@/lib/utils\";\nimport type { WidgetPrechatField } from \"@/lib/widget-config\";\nimport { GoogleSignInButton } from \"../../auth/google-sign-in-button\";\nimport { PasskeySignInButton } from \"../../auth/passkey-sign-in-button\";\nimport { AttachmentPreview } from \"./composer/attachment-preview\";\nimport { EmojiPicker } from \"./composer/emoji-picker\";\nimport { MorphSendButton } from \"./composer/morph-send-button\";\nimport type { VoiceRecording } from \"./composer/voice-recorder-bar\";\nimport { pickDummyReply } from \"./dummy-reply\";\nimport { DateSeparator } from \"./message/date-separator\";\nimport { type LightboxItem, MediaLightbox } from \"./message/media-lightbox\";\nimport { MessageBubble } from \"./message/message-bubble\";\nimport { TypingBubble } from \"./message/typing-bubble\";\nimport { UnreadDivider } from \"./message/unread-divider\";\nimport { WelcomeMessage } from \"./message/welcome-message\";\nimport { base64ToBlob, mapHistoryToMessages } from \"./message-mapping\";\nimport { buildMessageRows } from \"./message-rows\";\nimport { PrechatComposerFields } from \"./prechat-form/composer-fields\";\nimport {\n collectPrechatFields,\n hasSubmittedPrechat,\n markPrechatSubmitted,\n prefillToValues,\n validatePrechat,\n} from \"./prechat-form/helpers\";\nimport type { AttachmentChip, MessagesTabProps } from \"./types\";\n\n// Re-exported for `widget-shell`, which normalizes SSE media events\n// through the same transform the history mapper uses.\nexport { normalizeBackendMedia } from \"./message-mapping\";\n\n// Placeholder copy for `validatePrechat` when we only need the\n// pass/fail COUNT (is the prefill complete?), not displayable messages.\nconst PREFILL_PROBE_MSGS = { required: \"r\", invalidEmail: \"e\", invalidPhone: \"p\" };\n\n// `VoiceRecorderBar` statically pulls in `wavesurfer.js` + its record\n// plugin (~60 KB) for the live waveform. Most chat sessions never\n// record a voice note, so lazy-load it: the chunk streams in only when\n// the visitor actually taps the mic (`recording` flips true). Keeps the\n// messages-tab payload — which loads on first panel open — lean.\nconst VoiceRecorderBar = lazy(() =>\n import(\"./composer/voice-recorder-bar\").then((m) => ({\n default: m.VoiceRecorderBar,\n })),\n);\n\n/**\n * Messenger tab. Reworked Day 5 around a single rule: the input area\n * is **adaptive**:\n *\n * 1. Latest inbound message has quick-reply buttons + visitor\n * hasn't picked one yet → the composer is REPLACED by the\n * buttons (click-and-forget; once picked the buttons disappear\n * everywhere). Visitor can't free-type at this stage.\n *\n * 2. Otherwise → a textarea + action toolbar. The toolbar's send\n * button morphs:\n * - empty draft + no attachments → microphone (record)\n * - non-empty / has attachments → paper plane (send)\n * - actively recording → red square (stop)\n * One button, three states, one tap surface.\n *\n * 3. **Demo mode** allows sending — visitor message appends\n * immediately, a canned AI reply lands ~900 ms later so the\n * surface feels alive even with no BE behind it.\n *\n * Motion: bubbles enter with stagger fade; typing dots animate;\n * launcher hover for icons via `lucide-animated`.\n */\nexport function MessagesTab({\n isDummy,\n chatId,\n token,\n prechatForm,\n messenger,\n organizationLogoUrl,\n organizationName,\n isOpen = true,\n onInbound,\n onOutbound,\n registerRealtimeHandler,\n unreadCount = 0,\n clearUnread,\n liveMessages: liveMessagesProp,\n appendLiveMessage,\n replaceLiveMessage,\n initialVisitorMessage,\n onInitialVisitorMessageSent,\n visitorIdentity,\n visitorPrefill,\n security,\n verified = false,\n onGoogleCredential,\n onPasskeySession,\n onInternalLink,\n}: MessagesTabProps) {\n const t = useTranslations(\"messages\");\n const tDemo = useTranslations(\"demo\");\n const tPrechat = useTranslations(\"prechat\");\n const locale = useLocale();\n\n // Per-integration scope for the prechat-dedup localStorage key. The\n // visitor config no longer carries an integrationId — the publicKey the\n // widget already holds is the stable per-integration id. Read at render\n // (the provider stamps it before this tab ever mounts).\n const prechatScope = getPublicKey() ?? \"\";\n\n const [prechatDone, setPrechatDone] = useState<boolean | null>(null);\n useEffect(() => {\n setPrechatDone(hasSubmittedPrechat(prechatScope));\n }, [prechatScope]);\n\n // Prechat values + per-field errors live here (not in a child form)\n // because the prechat now sits ABOVE the editor and submits together\n // with the first message — `handleSend` orchestrates both.\n const [prechatValues, setPrechatValues] = useState<Record<string, string>>({});\n const [prechatErrors, setPrechatErrors] = useState<Record<string, string>>({});\n const [prechatSubmitError, setPrechatSubmitError] = useState<string | null>(null);\n const [submitPrechat, { loading: submittingPrechat }] = useSubmitVisitorPrechatMutation();\n\n const setPrechatField = useCallback((key: string, value: string) => {\n setPrechatValues((prev) => ({ ...prev, [key]: value }));\n setPrechatErrors((prev) => {\n if (!prev[key]) return prev;\n const next = { ...prev };\n delete next[key];\n return next;\n });\n }, []);\n\n // Host-supplied default profile mapped onto the form's field keys\n // (NAME→name, EMAIL→email, PHONE→phone). Drives both the pre-fill and\n // the auto-attach below. `{}` when nothing was passed.\n const prefillValues = useMemo<Record<string, string>>(\n () => (prechatForm ? prefillToValues(prechatForm, visitorPrefill) : {}),\n [prechatForm, visitorPrefill],\n );\n\n // Seed the editable fields from the prefill — but never clobber what\n // the visitor already typed (only fill empties). Re-runs if the prefill\n // arrives late (the iframe receives it over postMessage after mount).\n useEffect(() => {\n if (Object.keys(prefillValues).length === 0) return;\n setPrechatValues((prev) => {\n let changed = false;\n const next = { ...prev };\n for (const [k, v] of Object.entries(prefillValues)) {\n if (!next[k]) {\n next[k] = v;\n changed = true;\n }\n }\n return changed ? next : prev;\n });\n }, [prefillValues]);\n\n // Did the behind-the-scenes prefill attach fail? Then we fall back to\n // showing the (pre-filled) form so the visitor can submit it manually.\n const [prefillAttachFailed, setPrefillAttachFailed] = useState(false);\n\n // A booted known-user (identity) already has name/email/phone on their\n // People row, so a required field the identity covers shouldn't be\n // asked again. CUSTOM_TEXT can't come from identity, so a required\n // custom field still shows. When every required field is covered we\n // treat prechat as satisfied.\n const prechatCoveredByIdentity = useMemo(() => {\n if (!visitorIdentity || !prechatForm?.enabled || prechatForm.fields.length === 0) {\n return false;\n }\n const covers = (kind: WidgetPrechatField[\"kind\"]) => {\n if (kind === \"NAME\") return !!visitorIdentity.name?.trim();\n if (kind === \"EMAIL\") return !!visitorIdentity.email?.trim();\n if (kind === \"PHONE\") return !!visitorIdentity.phone?.trim();\n return false;\n };\n return prechatForm.fields.filter((f) => f.required).every((f) => covers(f.kind));\n }, [visitorIdentity, prechatForm]);\n\n // Does the host-supplied prefill cover every REQUIRED field (with valid\n // formats)? Then we attach it behind the scenes + skip the form. Needs\n // at least one passed value (so an all-optional form isn't auto-skipped\n // on empty prefill). `validatePrechat` returning no errors == every\n // required field present + email/phone formats valid.\n const prechatSatisfiedByPrefill = useMemo(() => {\n if (!prechatForm?.enabled || prechatForm.fields.length === 0) return false;\n if (Object.keys(prefillValues).length === 0) return false;\n return (\n Object.keys(validatePrechat(prechatForm, prefillValues, PREFILL_PROBE_MSGS)).length === 0\n );\n }, [prechatForm, prefillValues]);\n\n // Attach the prefill behind the scenes once auth is ready, then mark the\n // prechat done so the form never shows. On failure, fall back to the\n // (pre-filled) form for a manual submit. Skipped when a verified\n // identity already wrote the profile (its handshake covers it).\n const prefillAttemptedRef = useRef(false);\n useEffect(() => {\n if (!prechatSatisfiedByPrefill || prechatDone !== false) return;\n if (prefillAttachFailed || prefillAttemptedRef.current) return;\n if (prechatCoveredByIdentity || !prechatForm) return;\n if (!isDummy && !token) return; // the real submit needs the visitor JWT\n prefillAttemptedRef.current = true;\n (async () => {\n if (isDummy) {\n markPrechatSubmitted(prechatScope);\n setPrechatDone(true);\n return;\n }\n try {\n await submitPrechat({\n variables: { input: { fields: collectPrechatFields(prechatForm, prefillValues) } },\n });\n markPrechatSubmitted(prechatScope);\n setPrechatDone(true);\n } catch {\n prefillAttemptedRef.current = false;\n setPrefillAttachFailed(true);\n }\n })();\n }, [\n prechatSatisfiedByPrefill,\n prechatDone,\n prefillAttachFailed,\n prechatCoveredByIdentity,\n prechatForm,\n prefillValues,\n isDummy,\n token,\n prechatScope,\n submitPrechat,\n ]);\n\n // Prechat shows when the operator configured it, the visitor hasn't\n // submitted, a known-user identity doesn't already cover the required\n // fields, AND a host prefill isn't covering them (unless that attach\n // failed — then show the pre-filled form). The compact fields render\n // above the editor; the single send submits them with the first message.\n const showPrechat =\n !!prechatForm?.enabled &&\n prechatForm.fields.length > 0 &&\n prechatDone === false &&\n !prechatCoveredByIdentity &&\n !(prechatSatisfiedByPrefill && !prefillAttachFailed);\n\n // Auth gate — when the operator requires a verified identity and the\n // visitor isn't yet verified, the composer is replaced by the sign-in\n // panel (they must authenticate before they can message).\n //\n // In DEMO/preview there's no real auth backend (and `verified` never\n // flips), so we render a PREVIEW gate with mock buttons that\n // fake-complete via `demoAuthed` — letting operators eyeball the\n // gate → composer transition. In production the real Google / passkey\n // buttons drive the actual handshake (which flips `verified`).\n // Persisted to sessionStorage so a demo/preview RELOAD keeps the\n // fake-signed-in state (the demo has no real session to restore — see\n // `useVisitorAuth`'s localStorage persistence for the production path).\n const [demoAuthed, setDemoAuthedState] = useState<boolean>(() => {\n if (typeof window === \"undefined\") return false;\n try {\n return sessionStorage.getItem(\"wexio:demo-authed\") === \"1\";\n } catch {\n return false;\n }\n });\n const setDemoAuthed = (value: boolean) => {\n setDemoAuthedState(value);\n try {\n if (value) sessionStorage.setItem(\"wexio:demo-authed\", \"1\");\n else sessionStorage.removeItem(\"wexio:demo-authed\");\n } catch {\n /* private mode — preview just won't survive reload */\n }\n };\n // Resolved Google clientId — non-null only when the operator both\n // enabled Google AND configured a clientId. The widget runs GIS\n // directly with it (the BE verifies `id_token.aud` server-side so\n // the public clientId is safe on the visitor surface).\n const googleSignIn = security?.google?.enabled ? security.google.clientId : null;\n const passkeySignIn = !!security?.passkey?.enabled;\n // `demoAuthed` only ever suppresses the gate in DEMO mode — in\n // production the gate follows the real `verified` flag, so a stale\n // demo flag (same-tab sessionStorage) can't hide a real sign-in gate.\n const showAuthGate = !!security?.requireAuth && !verified && !(isDummy && demoAuthed);\n\n // Gate any outbound action (text send OR voice note) behind the\n // prechat: validate the fields, then submit them so the People\n // profile is attached before the message. Returns `false` (and shows\n // errors) when the fields are missing/invalid or the submit fails, so\n // the caller aborts. A no-op (`true`) when prechat isn't required —\n // this is what stops a voice recording from bypassing the form.\n const ensurePrechat = useCallback(async (): Promise<boolean> => {\n if (!showPrechat || !prechatForm) return true;\n const errs = validatePrechat(prechatForm, prechatValues, {\n required: tPrechat(\"required\"),\n invalidEmail: tPrechat(\"invalidEmail\"),\n invalidPhone: tPrechat(\"invalidPhone\"),\n });\n if (Object.keys(errs).length > 0) {\n setPrechatErrors(errs);\n return false;\n }\n setPrechatSubmitError(null);\n if (isDummy) {\n // Dummy / preview — no auth'd visitor, so skip the BE mutation\n // and complete locally.\n markPrechatSubmitted(prechatScope);\n setPrechatDone(true);\n return true;\n }\n try {\n await submitPrechat({\n variables: { input: { fields: collectPrechatFields(prechatForm, prechatValues) } },\n });\n markPrechatSubmitted(prechatScope);\n setPrechatDone(true);\n return true;\n } catch (err) {\n setPrechatSubmitError(err instanceof Error ? err.message : tPrechat(\"submitFailed\"));\n return false;\n }\n }, [showPrechat, prechatForm, prechatValues, isDummy, prechatScope, submitPrechat, tPrechat]);\n\n const [draft, setDraft] = useState(\"\");\n const [emojiOpen, setEmojiOpen] = useState(false);\n const [commandsOpen, setCommandsOpen] = useState(false);\n const [recording, setRecording] = useState(false);\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const emojiAnchorRef = useRef<HTMLButtonElement | null>(null);\n const commandsAnchorRef = useRef<HTMLButtonElement | null>(null);\n // Close the commands dropdown on outside click. Lightweight\n // mirror of the EmojiPicker's click-outside handling so the\n // dropdown behaves naturally without its own portal.\n useEffect(() => {\n if (!commandsOpen) return;\n const onMouseDown = (e: MouseEvent) => {\n const target = e.target as Node;\n if (commandsAnchorRef.current?.contains(target)) return;\n // The dropdown's panel carries this data attribute — see the\n // JSX below — so clicks inside it don't close.\n if (target instanceof Element && target.closest(\"[data-wx-commands-panel]\")) {\n return;\n }\n setCommandsOpen(false);\n };\n document.addEventListener(\"mousedown\", onMouseDown);\n return () => document.removeEventListener(\"mousedown\", onMouseDown);\n }, [commandsOpen]);\n\n const insertEmoji = (emoji: string) => {\n const el = textareaRef.current;\n if (!el) {\n setDraft((prev) => prev + emoji);\n return;\n }\n const start = el.selectionStart ?? draft.length;\n const end = el.selectionEnd ?? draft.length;\n const next = draft.slice(0, start) + emoji + draft.slice(end);\n setDraft(next);\n // Restore caret after the inserted glyph on next paint.\n requestAnimationFrame(() => {\n el.focus();\n const pos = start + emoji.length;\n el.setSelectionRange(pos, pos);\n });\n };\n\n // Auto-grow textarea. The composer envelope is 81–160 px TOTAL\n // (textarea + action toolbar). Toolbar takes ~40 px; we cap the\n // textarea at 120 px so total stays within budget. Min 41 keeps\n // total at exactly 81 on first paint.\n // `draft` is the deliberate re-measure trigger (not read in the body,\n // which goes through the ref) — it must stay so the textarea regrows\n // as the visitor types.\n // biome-ignore lint/correctness/useExhaustiveDependencies: draft drives the re-measure, not an unused dep\n useEffect(() => {\n const el = textareaRef.current;\n if (!el) return;\n el.style.height = \"auto\";\n el.style.height = `${Math.min(el.scrollHeight, 120)}px`;\n }, [draft]);\n // Live list. In demo mode we keep the getMockConversation() seed local\n // (the shell doesn't seed it). In real mode the shell owns the\n // session-durable list and feeds it via `liveMessagesProp`; the\n // local fallback below covers the rare case where the prop is\n // omitted (e.g. tab rendered outside the widget shell in tests).\n const [demoMessages, setDemoMessages] = useState<MockMessage[]>(\n isDummy ? getMockConversation(tDemo) : [],\n );\n const liveMessages = isDummy ? demoMessages : (liveMessagesProp ?? []);\n // Wrapper that routes appends to the right backing store —\n // `appendLiveMessage` (shell) for real mode, local `setDemoMessages`\n // for demo. Dedupes by id either way.\n const appendLive = useCallback(\n (msg: MockMessage) => {\n if (isDummy) {\n setDemoMessages((prev) => {\n if (prev.some((m) => m.id === msg.id)) return prev;\n return [...prev, msg];\n });\n return;\n }\n appendLiveMessage?.(msg);\n },\n [isDummy, appendLiveMessage],\n );\n const [consumedButtonIds, setConsumedButtonIds] = useState<Set<string>>(new Set());\n const [typingActor, setTypingActor] = useState<{\n name: string;\n kind?: string;\n /** Operator's photo from the SSE beat (`from.avatar`) — renders the\n * real person instead of an initials monogram. AI/bot beats use the\n * configured assistant avatar instead (handled in `BotAvatar`). */\n avatar?: string;\n /** AI turn phase from the SSE beat (`event.phase`) — `\"thinking\"` /\n * `\"searching\"` / `\"typing\"`. Drives the typing-bubble caption.\n * Absent for operator typing. */\n phase?: string;\n } | null>(null);\n // Auto-dismiss timer for the typing bubble. Held in a ref so each new\n // \"typing\" beat REPLACES the prior timer instead of stacking, and so a\n // real message can cancel it immediately. Cleared on unmount.\n const typingTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(\n () => () => {\n if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);\n },\n [],\n );\n const [attachments, setAttachments] = useState<AttachmentChip[]>([]);\n const [uploadError, setUploadError] = useState<string | null>(null);\n const scrollRef = useRef<HTMLDivElement | null>(null);\n const fileInputRef = useRef<HTMLInputElement | null>(null);\n\n const [uploadFile] = useUploadVisitorMediaMutation();\n const [removeUploadedMedia] = useRemoveVisitorMediaMutation();\n const [markChatRead] = useMarkVisitorChatReadMutation();\n // Tempids of chips the visitor removed while the upload was still in flight\n // — when the upload resolves, we clean up the orphan on the BE.\n const removedDuringUploadRef = useRef<Set<string>>(new Set());\n\n // Visitor's scroll position inside the conversation. Drives both\n // auto-scroll-on-new-message (only if they were already at the\n // bottom — don't yank them away from history they're reading) and\n // the read-ack decision (only mark messages as read when the new\n // bubble is actually on screen). The value lives only on a ref now —\n // the read-ack listener consults live scroll geometry on every event\n // rather than gating on a state flag, and the auto-scroll branch\n // reads `atBottomRef.current` directly. Removing the React state\n // avoided a re-render on every threshold crossing.\n const atBottomRef = useRef(true);\n // \"Pin to bottom\" permission. Goes FALSE when an operator/AI message lands\n // while the visitor was at the bottom — they should stay where they were,\n // not get yanked to the new bottom (long messages must be read from the\n // top). Goes TRUE again only when the visitor actually scrolls to the\n // bottom (acknowledging the new content) or sends their own message.\n // Gates EVERY ambient bottom-scroll path (typing-beat auto-scroll AND the\n // image-load re-pin) so a single source of truth controls the lock.\n const bottomPinAllowedRef = useRef(true);\n\n // Guards against firing `markChatRead` twice for the same ack\n // window. Released when the unread count drops to 0 (either via\n // the BE's read-receipt fanout or our local `clearUnread`).\n const ackingRef = useRef(false);\n useEffect(() => {\n if (unreadCount === 0) ackingRef.current = false;\n }, [unreadCount]);\n\n const ackRead = useCallback(() => {\n if (ackingRef.current) return;\n if (unreadCount === 0) return;\n ackingRef.current = true;\n // Optimistic local clear so the launcher badge / peek vanish\n // immediately. If the BE mutation fails the next page-load's\n // initial `visitorChatUnread` will reconcile.\n clearUnread?.();\n // Demo mode has no chat to ack against — the local clear above is\n // the whole story, so the launcher peek doesn't resurface after the\n // visitor opens the conversation and closes the widget again.\n if (isDummy || !chatId) return;\n markChatRead({ variables: { chatId } }).catch(() => {\n ackingRef.current = false;\n });\n }, [chatId, isDummy, unreadCount, markChatRead, clearUnread]);\n\n // SSE read-receipts upgrade bubbles in realtime — we hold the\n // message ids the BE flipped in a Set, and the bubble renderer\n // forces deliveryStatus=\"READ\" for any id present here. Avoids\n // mutating Apollo's chat-history cache for an in-conversation\n // overlay state.\n const [readMessageIds, setReadMessageIds] = useState<Set<string>>(() => new Set());\n\n // Lightbox state lives at the tab level — any bubble's image/video\n // tap opens the same overlay. `items` carries just the tapped\n // bubble's media (one gallery per message) so navigation stays\n // scoped to that message's batch.\n const [lightbox, setLightbox] = useState<{\n items: LightboxItem[];\n index: number;\n } | null>(null);\n const openLightbox = (items: LightboxItem[], index: number) => setLightbox({ items, index });\n\n // History fetch — only real mode. `refetch()` is used after the\n // visitor sends so Apollo's cache picks up the BE-persisted row\n // (real id, server-stamped createdAt + deliveryStatus). Without\n // this, a Messages → Help → Messages round-trip after a send\n // would serve the stale pre-send cache and lose the bubble.\n const {\n data: historyData,\n loading: historyLoading,\n fetchMore: fetchMoreHistory,\n } = useVisitorChatHistoryQuery({\n // Initial page is 10 messages — enough to fill the panel without\n // a wall of old chat scrolling under the visitor on first open.\n // Older messages stream in as the visitor scrolls up; see the\n // `loadOlder` handler below.\n variables: { chatId: chatId ?? \"\", limit: 10 },\n skip: isDummy || !chatId || !token,\n });\n\n // Pagination cursor — the id of the OLDEST currently-loaded\n // message. The BE's `visitorChatHistory(before: …)` returns\n // messages strictly older than the cursor, so we use the last\n // entry of the raw (newest-first) array. `null` while history\n // is empty or in flight; the scroll-up handler short-circuits.\n const oldestMessageId: string | null = (() => {\n const rawList = (historyData?.visitorChatHistory as { items?: unknown } | undefined)?.items;\n if (!Array.isArray(rawList) || rawList.length === 0) return null;\n const last = rawList[rawList.length - 1] as Record<string, unknown>;\n return typeof last?.id === \"string\" ? last.id : null;\n })();\n // Whether the BE says there's an OLDER page. `nextCursor: null` means the\n // current page was the last one — so we must NOT fire a `before` fetch\n // even though the scroll-up handler triggers on the initial layout (a\n // short thread sits at `scrollTop = 0`). Without this gate, opening a\n // chat with fewer than `limit` messages fired a redundant empty page.\n const historyHasMore = !!(\n historyData?.visitorChatHistory as { nextCursor?: string | null } | undefined\n )?.nextCursor;\n // Track when older-page fetches are in flight so the visitor sees\n // a skeleton strip at the top of the list (and we don't fire\n // overlapping requests if they scroll fast).\n const [loadingOlder, setLoadingOlder] = useState(false);\n // `true` once a fetchMore returns no items — stops further\n // upward-scroll requests so we don't paper the BE with empty\n // pagination calls.\n const [reachedHistoryStart, setReachedHistoryStart] = useState(false);\n\n const loadOlder = useCallback(async () => {\n if (\n isDummy ||\n !chatId ||\n !oldestMessageId ||\n loadingOlder ||\n reachedHistoryStart ||\n !historyHasMore\n ) {\n return;\n }\n setLoadingOlder(true);\n try {\n const res = await fetchMoreHistory({\n variables: { chatId, before: oldestMessageId, limit: 10 },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n const prevList = ((prev.visitorChatHistory as { items?: unknown[] } | undefined)?.items ??\n []) as Record<string, unknown>[];\n const moreList = ((\n fetchMoreResult.visitorChatHistory as { items?: unknown[] } | undefined\n )?.items ?? []) as Record<string, unknown>[];\n // Dedup by id. Same reasoning as the news-tab fetchMore\n // dedup — page boundary races + StrictMode double-mount\n // both lead to overlapping items.\n const seen = new Set(\n prevList\n .map((m) => (typeof m.id === \"string\" ? m.id : null))\n .filter((id): id is string => !!id),\n );\n const merged = [\n ...prevList,\n ...moreList.filter((m) => typeof m.id !== \"string\" || !seen.has(m.id)),\n ];\n return {\n ...prev,\n visitorChatHistory: {\n ...(fetchMoreResult.visitorChatHistory as object),\n items: merged,\n },\n } as typeof prev;\n },\n });\n const moreCount =\n (res.data.visitorChatHistory as { items?: unknown[] } | undefined)?.items?.length ?? 0;\n if (moreCount === 0) setReachedHistoryStart(true);\n } catch {\n // Ignore — the visitor can try again by scrolling up.\n } finally {\n setLoadingOlder(false);\n }\n }, [\n isDummy,\n chatId,\n oldestMessageId,\n loadingOlder,\n reachedHistoryStart,\n historyHasMore,\n fetchMoreHistory,\n ]);\n\n // SSE realtime is owned by the shell now — it keeps one EventSource\n // open across the whole widget lifetime so the launcher peek + home\n // block keep updating even when this tab isn't mounted. We hand the\n // shell a stable callback that re-reads the latest `handleSseEvent`\n // via a ref, so changes to dependencies (locale, isOpen, etc.) don't\n // re-register and don't reopen the upstream stream.\n const handlerRef = useRef<(event: RealtimeMessageEvent) => void>(() => {});\n useEffect(() => {\n handlerRef.current = (event) => handleSseEvent(event);\n });\n useEffect(() => {\n if (!registerRealtimeHandler) return;\n return registerRealtimeHandler((event) => handlerRef.current(event));\n }, [registerRealtimeHandler]);\n\n const [send, { loading: sending }] = useSendVisitorMessageMutation();\n const [signalTyping] = useSignalVisitorTypingMutation();\n\n // Throttle visitor-typing signals — BE relay decays at ~4 s on the\n // operator's chatActivity subscription, so one fire every 3 s keeps\n // the operator's \"Visitor is typing…\" bubble continuously visible\n // without burning a mutation per keystroke. `lastTypingFireRef`\n // is a render-stable timestamp so the throttle survives re-renders\n // triggered by `setDraft`. Swallows errors — typing is cosmetic.\n const lastTypingFireRef = useRef(0);\n const fireTypingSignal = useCallback(() => {\n if (isDummy || !token) return;\n const now = Date.now();\n if (now - lastTypingFireRef.current < 3000) return;\n lastTypingFireRef.current = now;\n signalTyping().catch(() => undefined);\n }, [signalTyping, isDummy, token]);\n\n const handleSseEvent = (event: RealtimeMessageEvent) => {\n // Unify the two BE payload shapes — new emitters use `from`, old\n // ones used `sender`. Pick whichever is set.\n const sender = event.from ?? event.sender;\n const senderKind = sender?.kind;\n const senderName = sender?.name ?? \"\";\n\n if (event.kind === \"typing\") {\n // Always show AI_ASSISTANT_NAME for ai/bot regardless of whatever the BE\n // labels them (\"WEB widget\", \"Bot\", an internal handle, …) so\n // the typing indicator matches the bubble's sender name.\n // Operator names flow through unchanged; the empty-name\n // fallback (\"Someone\") is handled inside `TypingBubble`.\n const displayName =\n senderKind === \"ai\" || senderKind === \"bot\" ? AI_ASSISTANT_NAME : senderName;\n setTypingActor({\n name: displayName,\n kind: senderKind,\n avatar: sender?.avatar,\n phase: event.phase,\n });\n // Replace the prior beat's timer (don't stack) and use 8s — ≥ 2× the\n // server's ~4s typing heartbeat — so a late/jittered beat can't let the\n // bubble blink out between heartbeats. A real message clears it sooner.\n if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);\n typingTimeoutRef.current = setTimeout(() => setTypingActor(null), 8000);\n return;\n }\n if (event.kind === \"read-receipt\") {\n // Operator read the visitor's INBOUND messages — or another\n // tab of the same visitor marked operator OUTBOUND messages\n // as read. Either way we layer the ids into `readMessageIds`;\n // the bubble renderer forces deliveryStatus=READ on match.\n const ids = event.readReceipt?.messageIds ?? [];\n if (ids.length > 0) {\n setReadMessageIds((prev) => {\n const next = new Set(prev);\n for (const id of ids) next.add(id);\n return next;\n });\n }\n return;\n }\n // A real message (text/buttons/media) — or any other non-typing event —\n // ends the typing state NOW: cancel the auto-dismiss timer (so a stale\n // beat timer can't fire later) and drop the bubble immediately rather\n // than letting it linger up to the timeout.\n if (typingTimeoutRef.current) {\n clearTimeout(typingTimeoutRef.current);\n typingTimeoutRef.current = null;\n }\n setTypingActor(null);\n\n // Inbound (non-visitor) content appends + the inbound chime are\n // both owned by the shell now — the chime call moved up there so\n // the launcher / non-Messages tabs still get an audible cue (this\n // tab isn't mounted in those routes). Avoid double-playing by NOT\n // firing `onInbound` here for the SSE path.\n // Ack is gated on (isOpen && atBottom) — the shell's noteInbound\n // bumped `unreadCount`, the ack effect picks it up on the next\n // render and fires `markChatRead` only when the visitor's at the\n // bottom of the list.\n };\n\n // Combined message list (real history + live appends / mock).\n // Dedupe by id so an SSE-delivered message that *also* shows up\n // in a later history fetch (page reload while the bubble was\n // already in `liveMessages`, or BE replaying buffered events on\n // SSE reconnect) doesn't render twice. History first → live\n // entries with matching ids drop out so the visitor sees a\n // single bubble per message.\n // Memoised — `mapHistoryToMessages` walks every history row + builds a\n // Set + filters live entries, all O(n). Without memoisation this ran\n // on every render, including every composer keystroke, and turned into\n // visible typing lag on long threads. Deps are the upstream inputs;\n // identity stability of `historyData` is the gating factor (Apollo\n // returns the same reference until the cache writes).\n const messages: MockMessage[] = useMemo(() => {\n if (isDummy) return liveMessages;\n const history = mapHistoryToMessages(historyData, locale);\n const historyIds = new Set(history.map((m) => m.id));\n const liveDedup = liveMessages.filter((m) => !historyIds.has(m.id));\n return [...history, ...liveDedup];\n }, [isDummy, liveMessages, historyData, locale]);\n\n // ─── Unread divider ───────────────────────────────────────────────\n // A one-time \"unread messages\" divider marking where the visitor's\n // unread run begins, scrolled to the CENTRE of the viewport on open so\n // they land on the first thing they haven't read.\n //\n // Snapshot the unread count at the FIRST render it's known to be > 0 —\n // captured in the render body, BEFORE the auto-ack effect below zeroes\n // it. The shell fetches `visitorChatUnread` on page load, so the count\n // is already populated by the time this tab mounts.\n const snapshotUnreadRef = useRef(0);\n if (snapshotUnreadRef.current === 0 && unreadCount > 0) {\n snapshotUnreadRef.current = unreadCount;\n }\n const [unreadAnchorId, setUnreadAnchorId] = useState<string | null>(null);\n const unreadDividerRef = useRef<HTMLDivElement | null>(null);\n const dividerComputedRef = useRef(false);\n // Ref mirror of the anchor so the bottom-scroll effect's DEFERRED\n // callbacks (rAF / ResizeObserver, which capture a stale closure) read the\n // LATEST value — otherwise a divider that resolves a tick after the effect\n // ran would let those callbacks bottom-scroll right past it.\n const unreadAnchorRef = useRef<string | null>(null);\n unreadAnchorRef.current = unreadAnchorId;\n\n // Compute the anchor ONCE, after the first history page settles. The\n // first unread message is the `snapshotUnread`-th OUTBOUND (operator/ai)\n // message from the end — the visitor's own messages aren't \"unread\".\n useEffect(() => {\n if (dividerComputedRef.current) return;\n if (historyLoading) return;\n dividerComputedRef.current = true;\n const count = snapshotUnreadRef.current;\n if (count > 0 && messages.length > 0) {\n let seen = 0;\n let anchor: string | null = null;\n for (let i = messages.length - 1; i >= 0; i--) {\n if (messages[i].direction === \"OUTBOUND\") {\n anchor = messages[i].id;\n seen += 1;\n if (seen >= count) break;\n }\n }\n if (anchor) setUnreadAnchorId(anchor);\n }\n }, [historyLoading, messages]);\n\n // Center the divider in the viewport ONCE it mounts — its own effect, so\n // the NO-unread path (no anchor) never touches the normal bottom-scroll.\n useEffect(() => {\n if (!unreadAnchorId) return;\n const divider = unreadDividerRef.current;\n if (!divider) return;\n didInitialScrollRef.current = true; // the divider IS the initial position\n divider.scrollIntoView({ block: \"center\", behavior: \"auto\" });\n }, [unreadAnchorId]);\n\n // Auto-dismiss the divider a few seconds after it appears — by then the\n // visitor has seen the unread run (we centre it on open). This is more\n // forgiving than waiting for an exact scroll-to-bottom, which left it\n // stuck when the unread was read mid-scroll without reaching the very\n // end. A new inbound while open never re-adds it (the anchor is computed\n // once) — matching \"don't add a divider while the visitor is reading\".\n useEffect(() => {\n if (!unreadAnchorId) return;\n const t = setTimeout(() => setUnreadAnchorId(null), 4000);\n return () => clearTimeout(t);\n }, [unreadAnchorId]);\n\n // The messenger tab stays MOUNTED across widget open/close (the shell only\n // hides the panel — see `hasOpened`). So the one-shot divider + initial\n // scroll above run only on FIRST mount; on a RE-open, messages that arrived\n // while the widget was closed would otherwise just sit at the bottom with\n // no divider. On each re-open (isOpen false→true) recompute the anchor from\n // the current unread and re-arm the open scroll — the same as a fresh open.\n const wasOpenRef = useRef(isOpen);\n useEffect(() => {\n const reopened = isOpen && !wasOpenRef.current;\n wasOpenRef.current = isOpen;\n if (!reopened) return;\n let anchor: string | null = null;\n if (unreadCount > 0 && messages.length > 0) {\n let seen = 0;\n for (let i = messages.length - 1; i >= 0; i--) {\n if (messages[i].direction === \"OUTBOUND\") {\n anchor = messages[i].id;\n seen += 1;\n if (seen >= unreadCount) break;\n }\n }\n }\n // Sync the ref synchronously so the (same-flush) bottom-scroll effect sees\n // the new anchor and defers to the centering effect — no flash to bottom.\n unreadAnchorRef.current = anchor;\n didInitialScrollRef.current = false; // re-arm the open scroll (center / bottom)\n setUnreadAnchorId(anchor);\n }, [isOpen, unreadCount, messages]);\n\n // Track scroll position so we can:\n // 1. skip the auto-scroll-on-new-message dance when the visitor\n // is reading history (yanking them to the bottom would be\n // hostile), and\n // 2. delay the read-ack until the new bubble is actually in\n // view (visitor at bottom).\n // ~80 px slack — accounts for a partial bubble at the bottom edge\n // still counting as \"in view.\"\n useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n const update = () => {\n const dist = el.scrollHeight - el.scrollTop - el.clientHeight;\n const near = dist < 80;\n atBottomRef.current = near;\n // When the visitor genuinely reaches the bottom (manual scroll, or\n // post-send), re-enable the bottom-pin — they've caught up to any new\n // content that arrived \"behind their back\".\n if (near) bottomPinAllowedRef.current = true;\n // Top-edge detector → trigger a page of older messages. 120-px\n // pre-roll so the fetch starts before the visitor hits the\n // hard top — the prepend completes by the time they actually\n // scroll into the old region. `loadOlder` self-debounces via\n // `loadingOlder` so a fast scroll doesn't spam requests.\n if (el.scrollTop < 120) loadOlder();\n };\n update();\n el.addEventListener(\"scroll\", update, { passive: true });\n // Re-pin to the bottom whenever a media element finishes loading IF the\n // visitor was already at the bottom. The initial-scroll effect's\n // ResizeObserver only watches for ~2 s — a slow image / large video that\n // arrives after that window grew the content and pushed the visitor up.\n // This catches every late media load for the lifetime of the tab.\n // `capture: true` is required: `load` doesn't bubble.\n const onMediaLoad = (e: Event) => {\n const target = e.target;\n if (!(target instanceof HTMLImageElement || target instanceof HTMLVideoElement)) {\n return;\n }\n // Only re-pin if the bottom-pin is ALLOWED. After a new operator/AI\n // message lands while visitor was at bottom, `bottomPinAllowedRef` is\n // false — `atBottomRef` may still be stale-true (no scroll event fired\n // since content grew), but pinning here would silently scroll past the\n // new message. This guard preserves the \"stay where I was\" intent.\n if (!atBottomRef.current || !bottomPinAllowedRef.current) return;\n el.scrollTo({ top: el.scrollHeight, behavior: \"auto\" });\n };\n el.addEventListener(\"load\", onMediaLoad, true);\n return () => {\n el.removeEventListener(\"scroll\", update);\n el.removeEventListener(\"load\", onMediaLoad, true);\n };\n }, [loadOlder]);\n\n // Preserve scroll position when older messages are prepended.\n // Without this the visitor's viewport visibly jumps upward when\n // a new page lands (`scrollTop` stays the same but the content\n // got taller, so the bubble they were reading is now somewhere\n // off-screen). We snapshot the scroll geometry before each\n // fetchMore and restore the offset on the next render.\n const preFetchScrollRef = useRef<{ scrollTop: number; scrollHeight: number } | null>(null);\n useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n if (loadingOlder) {\n preFetchScrollRef.current = {\n scrollTop: el.scrollTop,\n scrollHeight: el.scrollHeight,\n };\n return;\n }\n const snapshot = preFetchScrollRef.current;\n if (!snapshot) return;\n preFetchScrollRef.current = null;\n // The fetch is settled; restore the offset so the previously-\n // visible message stays anchored under the visitor's gaze.\n const delta = el.scrollHeight - snapshot.scrollHeight;\n if (delta > 0) {\n el.scrollTop = snapshot.scrollTop + delta;\n }\n }, [loadingOlder]);\n\n // `false` until the very first auto-scroll has happened, then\n // `true` for the rest of the tab's lifetime. The initial mount\n // ignores `atBottomRef` and *forces* a scroll to the last\n // message — otherwise the bottom-detector that fires on the very\n // first scroll event (triggered by content layout, before any\n // real visitor scroll) flips `atBottom` to false and our\n // \"only auto-scroll if visitor is at the bottom\" guard skips\n // the initial scroll, leaving the visitor mid-conversation.\n const didInitialScrollRef = useRef(false);\n // Tracks the previous render's message count so the scroll effect can tell\n // a NEW arrival from a no-op re-run. When a new operator/AI message lands\n // we scroll to its TOP (not the thread's bottom) so a long message starts\n // at the top of the viewport instead of pinning its tail.\n const prevMessagesLengthRef = useRef(0);\n\n // Auto-scroll bottom on new messages.\n //\n // • First mount (or first messages payload arriving) → ALWAYS\n // scroll to the bottom, regardless of `atBottomRef`. Visitors\n // expect the conversation to open on the latest exchange.\n // • Subsequent updates → only auto-scroll if the visitor was\n // already near the bottom, so we don't yank them out of the\n // history they were reading when a new message lands.\n //\n // Three-stage scroll strategy applies in both cases:\n // 1. Immediate scroll (current frame) — covers text-only\n // messages and the initial commit on tab open.\n // 2. `requestAnimationFrame` retry — picks up the next layout\n // pass after React commits the new bubbles.\n // 3. **ResizeObserver on the content** — async media (images,\n // audio waveforms loading via fetch, video metadata) grow\n // the content AFTER the messages array stops changing.\n // Without this, a peek-tap landing on a fresh conversation\n // parked mid-list because the auto-scroll fired before the\n // images finished loading.\n //\n // `typingActor` is a deliberate re-scroll trigger: when the typing\n // bubble appears/disappears the content height changes, so we re-run\n // the scroll strategy even though the body reads it via refs.\n // biome-ignore lint/correctness/useExhaustiveDependencies: typingActor is an intentional re-scroll trigger, not an unused dep\n useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n const isInitial = !didInitialScrollRef.current && messages.length > 0;\n // Did the messages array grow this render? If the latest is from the\n // operator/AI (not the visitor's own echo) we'll target the TOP of its\n // bubble below, so long messages start at the top of view.\n const prevLen = prevMessagesLengthRef.current;\n const grew = messages.length > prevLen;\n prevMessagesLengthRef.current = messages.length;\n const lastMsg = messages[messages.length - 1];\n const isNewFromOther = grew && !isInitial && !!lastMsg && lastMsg.sender.kind !== \"visitor\";\n // First newly-appended message in this render's growth window — the\n // peek-scroll below uses it as the anchor so multi-message bursts\n // (a flow firing several inbounds in a row) park the visitor at the\n // TOP of the burst, not the tail.\n const firstNewMsg = grew ? messages[prevLen] : null;\n if (!isInitial && !atBottomRef.current) return;\n const content = el.firstElementChild;\n // Initial scroll is `auto` (instant) so the visitor never sees\n // the smooth-scroll animate from the top; subsequent ones use\n // `smooth` so new-message landings feel natural.\n // Did the visitor send this growth? Their own send always re-enables\n // bottom-pin and scrolls (they expect to see their bubble).\n const isVisitorSend = grew && !isInitial && !!lastMsg && lastMsg.sender.kind === \"visitor\";\n const scroll = () => {\n if (!isInitial && !atBottomRef.current) return;\n // Hold off while an unread divider is pending/active — the visitor\n // should land on (and read down from) the divider, NOT the bottom.\n // Reads refs so the deferred rAF/ResizeObserver see the latest state.\n if (\n unreadAnchorRef.current ||\n (snapshotUnreadRef.current > 0 && !dividerComputedRef.current)\n ) {\n return;\n }\n // New operator/AI message — two behaviours depending on bubble\n // size, both gated on \"visitor was at the bottom\":\n //\n // • SHORT bubble (fits comfortably in the viewport) → scroll\n // all the way to the bottom so the whole thing is visible.\n // The visitor was already engaged; a small message\n // materialising in full reads as natural conversation pace.\n //\n // • LONG bubble (taller than the threshold) → peek scroll.\n // Surface ~80 px of the bubble's TOP edge. The visitor sees\n // the message arriving, knows there's more, and scrolls down\n // at their own pace to read it.\n //\n // The threshold is 60% of the viewport — under that, a full-show\n // doesn't drown out prior context above; over that, peeking\n // signals \"more below\" without committing the visitor's eye to\n // re-reading the whole new message from its tail.\n //\n // If the visitor was NOT at the bottom (mid-scroll reading\n // history), leave them exactly where they are.\n //\n // Either branch drops the bottom-pin so ambient triggers (typing\n // beats, avatar/image loads) don't accidentally yank them past\n // the new bubble afterwards.\n if (isNewFromOther) {\n bottomPinAllowedRef.current = false;\n // Stale-but-meaningful: `atBottomRef` reflects the LAST scroll\n // event's position, captured BEFORE this growth landed. If it\n // was true, the visitor was parked at the bottom of the prior\n // content — exactly the case where the peek/full scroll helps.\n if (!atBottomRef.current) return;\n const newBubble = firstNewMsg\n ? (el.querySelector(`[data-message-id=\"${firstNewMsg.id}\"]`) as HTMLElement | null)\n : null;\n if (!newBubble) return;\n const bubbleHeight = newBubble.getBoundingClientRect().height;\n const viewportH = el.clientHeight;\n const FULL_SHOW_RATIO = 0.6;\n if (bubbleHeight <= viewportH * FULL_SHOW_RATIO) {\n // Short — go to the literal bottom of content.\n el.scrollTo({ top: el.scrollHeight - viewportH, behavior: \"smooth\" });\n } else {\n // Long — peek the top 80 px so the visitor sees the message\n // start without being teleported past it.\n const containerRect = el.getBoundingClientRect();\n const bubbleRect = newBubble.getBoundingClientRect();\n const bubbleTopInContent = bubbleRect.top - containerRect.top + el.scrollTop;\n const PEEK_PX = 80;\n const target = bubbleTopInContent - (viewportH - PEEK_PX);\n const clamped = Math.max(0, Math.min(el.scrollHeight - viewportH, target));\n el.scrollTo({ top: clamped, behavior: \"smooth\" });\n }\n return;\n }\n // Visitor's own send → force-enable the pin + scroll to bottom (their\n // explicit action; bubble must be visible).\n if (isVisitorSend) {\n bottomPinAllowedRef.current = true;\n }\n // Any other ambient bottom-scroll (typing beats, periodic re-runs)\n // honours the lock — once a non-visitor message arrived \"behind\" the\n // visitor, nothing else yanks them to the bottom.\n if (!isInitial && !bottomPinAllowedRef.current) return;\n el.scrollTo({\n top: el.scrollHeight,\n behavior: isInitial ? \"auto\" : \"smooth\",\n });\n };\n scroll();\n if (isInitial) {\n didInitialScrollRef.current = true;\n // After the first scroll, sync `atBottomRef` so the next\n // tick's scroll handler doesn't re-flag us as \"not at bottom\"\n // (we just put ourselves there programmatically).\n atBottomRef.current = true;\n }\n const raf = requestAnimationFrame(scroll);\n let ro: ResizeObserver | null = null;\n if (content && typeof ResizeObserver !== \"undefined\") {\n // Stop observing after ~2 s — by then any sensible media has\n // loaded, and we don't want the observer pulling the visitor\n // back to the bottom if they scrolled up to read history.\n ro = new ResizeObserver(scroll);\n ro.observe(content);\n const stopTimer = window.setTimeout(() => ro?.disconnect(), 2000);\n return () => {\n cancelAnimationFrame(raf);\n clearTimeout(stopTimer);\n ro?.disconnect();\n };\n }\n return () => cancelAnimationFrame(raf);\n }, [messages.length, typingActor, unreadAnchorId, isOpen]);\n\n // Fire the BE read-ack when the visitor has actually SEEN the new\n // messages — not just when they were near-bottom before the message\n // arrived. We attach a fresh scroll listener so we see EVERY scroll\n // position, not just the `atBottom` state flip (which trips at the\n // 120 px \"near bottom\" threshold and would miss the final glide down\n // to the literal bottom — read-acks need certainty the visitor saw\n // the content, not just that they were close).\n //\n // Also re-runs on `messages.length` so a freshly-arrived inbound\n // gets an immediate strict-bottom check: visitor was at bottom of\n // OLD content, growth pushes them ~bubble-height above the new\n // bottom, the check fails, message stays unread until they scroll\n // down. The earlier \"ack on stale `atBottom: true`\" bug acked\n // messages before they were seen.\n //\n // Strict threshold (20 px) — tighter than the auto-scroll's 120 px\n // \"near bottom\" tolerance.\n //\n // Guarded by `ackingRef` inside `ackRead` so it only fires once per\n // unread → read transition.\n // biome-ignore lint/correctness/useExhaustiveDependencies: `messages.length` is a deliberate re-trigger — every content commit needs a fresh strict-bottom check (a freshly-arrived inbound puts the visitor `bubbleHeight` below the new bottom, so we re-verify after each render).\n useEffect(() => {\n if (!isOpen) return;\n if (unreadCount === 0) return;\n const el = scrollRef.current;\n if (!el) return;\n const STRICT_BOTTOM_PX = 20;\n const tryAck = () => {\n const dist = el.scrollHeight - el.scrollTop - el.clientHeight;\n if (dist <= STRICT_BOTTOM_PX) ackRead();\n };\n // Immediate check covers the \"already at bottom on mount\" path\n // (peek tap, reload with pending unreads).\n tryAck();\n el.addEventListener(\"scroll\", tryAck, { passive: true });\n return () => el.removeEventListener(\"scroll\", tryAck);\n }, [isOpen, unreadCount, ackRead, messages.length]);\n\n // ID of the latest outbound message whose quick-reply buttons are\n // still actionable. Buttons render UNDER the bubble itself (in the\n // message container) so the visitor sees them attached to the\n // sender's reply, not floating in the composer. Only the latest\n // outbound run shows interactive chips; older runs are hidden via\n // `consumedButtonIds`.\n const activeButtonMessageId: string | null = (() => {\n for (let i = messages.length - 1; i >= 0; i--) {\n const m = messages[i];\n if (m.direction !== \"OUTBOUND\") break; // visitor responded already\n if (m.buttons && m.buttons.length > 0 && !consumedButtonIds.has(m.id)) {\n return m.id;\n }\n }\n return null;\n })();\n\n const sendDummyExchange = (text: string) => {\n const msgId = `tmp-${Date.now()}`;\n appendLive({\n id: msgId,\n direction: \"INBOUND\",\n text,\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"You\" },\n // Optimistic ✓ — flips to ✓✓ when the demo \"operator\"\n // acks the message via the canned reply path below.\n deliveryStatus: \"DELIVERED\",\n });\n onOutbound?.();\n // Canned AI reply ~900ms later — and a synthetic \"operator\n // read\" event ~600ms after that, so the visitor sees ✓ → ✓✓\n // on their own bubble without a real BE round-trip.\n setTimeout(() => {\n const reply = pickDummyReply(text, tDemo);\n appendLive({\n id: `tmp-fin-${Date.now()}`,\n direction: \"OUTBOUND\",\n text: reply.text,\n ageLabel: \"now\",\n sender: { kind: \"ai\", name: AI_ASSISTANT_NAME },\n buttons: reply.buttons,\n });\n setReadMessageIds((prev) => {\n const next = new Set(prev);\n next.add(msgId);\n return next;\n });\n onInbound?.();\n }, 900);\n };\n\n // Demo: a launcher-peek quick-reply the visitor tapped before opening\n // the panel. Replay it as a real send (visitor bubble + canned reply)\n // exactly once, then tell the shell to drop it. Ref-guarded so it\n // fires a single time per mount even though `sendDummyExchange` is a\n // fresh closure each render.\n const peekReplySentRef = useRef(false);\n // biome-ignore lint/correctness/useExhaustiveDependencies: one-shot replay — guarded by the ref, `sendDummyExchange`/`onInitialVisitorMessageSent` deliberately excluded\n useEffect(() => {\n if (!isDummy || !initialVisitorMessage || peekReplySentRef.current) return;\n peekReplySentRef.current = true;\n sendDummyExchange(initialVisitorMessage);\n onInitialVisitorMessageSent?.();\n }, [isDummy, initialVisitorMessage]);\n\n const handleQuickReply = (messageId: string, button: MockMessageButton) => {\n setConsumedButtonIds((prev) => {\n const next = new Set(prev);\n next.add(messageId);\n return next;\n });\n if (isDummy) {\n sendDummyExchange(button.text);\n return;\n }\n // Optimistic visitor bubble. The previous version only fired the\n // mutation, so the chip-click didn't paint a \"You: …\" row until\n // the BE round-trip completed (and only then via the next history\n // refetch or SSE echo) — leaving the visitor staring at a chat\n // that visibly \"ate\" their tap. Append a tmp row now and swap\n // the id with the BE-canonical one on resolve, mirroring the\n // typed-send path.\n const optimisticId = `tmp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n appendLive({\n id: optimisticId,\n // Stable render key — survives the tmp-id → BE-id swap below\n // so React doesn't unmount + remount the bubble (which would\n // re-play the entrance animation when an SSE event triggers\n // the next list render).\n clientKey: optimisticId,\n direction: \"INBOUND\",\n text: button.text,\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"\" },\n deliveryStatus: \"SENT\",\n });\n onOutbound?.();\n send({ variables: { input: { text: button.text } } })\n .then((res) => {\n const ack = res.data?.sendVisitorMessage;\n const realId = ack?.messageId;\n if (realId) {\n replaceLiveMessage?.(optimisticId, {\n id: realId,\n direction: \"INBOUND\",\n text: button.text,\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"\" },\n deliveryStatus: \"DELIVERED\",\n });\n }\n })\n .catch(() => {});\n };\n\n const handleFileChosen = async (file: File) => {\n setUploadError(null);\n if (!ALLOWED_UPLOAD_MIMES.has(file.type)) {\n setUploadError(t(\"fileMimeNotAllowed\"));\n return;\n }\n if (file.size > MAX_UPLOAD_BYTES) {\n setUploadError(t(\"fileTooLarge\"));\n return;\n }\n if (isDummy) {\n // Demo: skip the upload mutation; just append a local chip\n // with a fake media id so the visitor sees their file in the\n // attachment row.\n setAttachments((prev) => [\n ...prev,\n {\n tempId: `upl-${Date.now()}`,\n filename: file.name,\n mimetype: file.type,\n mediaId: \"demo-media\",\n // Local preview URL so the demo bubble actually shows the file.\n url: URL.createObjectURL(file),\n },\n ]);\n return;\n }\n const tempId = `upl-${Date.now()}`;\n // Local preview URL so the image/video tile renders the actual attached\n // file IMMEDIATELY (with the spinner overlay), instead of showing a\n // generic file icon until the S3 upload completes. Captured in a const\n // so the resolved handler can revoke it once the S3 url replaces it.\n const localUrl = URL.createObjectURL(file);\n setAttachments((prev) => [\n ...prev,\n { tempId, filename: file.name, mimetype: file.type, mediaId: null, url: localUrl },\n ]);\n try {\n const { base64 } = await fileToBase64(file);\n const res = await uploadFile({\n variables: {\n input: {\n filename: file.name,\n mimetype: file.type,\n dataBase64: base64,\n },\n },\n });\n const out = res.data?.uploadVisitorMedia;\n if (!out) throw new Error(\"empty upload response\");\n // If the visitor removed the chip while the upload was still in flight,\n // the freshly-minted media is now an orphan on the BE — clean it up.\n // The chip is already gone from state, so the map below is a no-op.\n if (removedDuringUploadRef.current.delete(tempId)) {\n removeUploadedMedia({ variables: { mediaId: out.mediaId } }).catch(() => undefined);\n }\n // Replace the local preview with the canonical S3 url + free the now-\n // orphaned blob so it doesn't pin in memory for the page lifetime.\n if (out.url) URL.revokeObjectURL(localUrl);\n setAttachments((prev) =>\n prev.map((a) =>\n a.tempId === tempId\n ? { ...a, mediaId: out.mediaId, ...(out.url ? { url: out.url } : {}) }\n : a,\n ),\n );\n } catch {\n URL.revokeObjectURL(localUrl);\n setAttachments((prev) => prev.filter((a) => a.tempId !== tempId));\n setUploadError(t(\"uploadFailed\"));\n }\n };\n\n const removeAttachment = (tempId: string) => {\n const chip = attachments.find((a) => a.tempId === tempId);\n // Free the local preview blob (created in `handleFileChosen`) so the\n // browser doesn't pin it for the page lifetime.\n if (chip?.url?.startsWith(\"blob:\")) URL.revokeObjectURL(chip.url);\n if (chip && !isDummy) {\n if (chip.mediaId) {\n // Upload finished — drop the orphan on the BE. Idempotent + rate-\n // limit-guarded, so fire-and-forget on failure.\n removeUploadedMedia({ variables: { mediaId: chip.mediaId } }).catch(() => undefined);\n } else {\n // Upload still in flight — mark so the resolve handler in\n // `handleFileChosen` removes the orphan once the BE mints it.\n removedDuringUploadRef.current.add(tempId);\n }\n }\n setAttachments((prev) => prev.filter((a) => a.tempId !== tempId));\n };\n\n /**\n * Voice recording is owned by `VoiceRecorderBar` (which wraps a\n * `wavesurfer.js` `RecordPlugin` instance). The mic button simply\n * mounts that bar in place of the composer; the bar fires\n * `onComplete` with the encoded blob when the visitor taps send,\n * or `onCancel` when they bail. Either way, we close the recorder\n * surface and the textarea returns.\n */\n const startRecording = async () => {\n setUploadError(null);\n // A voice note must not bypass a required prechat — collect + submit\n // the details first; bail (showing errors) if they're missing.\n if (!(await ensurePrechat())) return;\n setRecording(true);\n };\n\n /**\n * Voice send is single-tap: the recorder bar's Send button hands\n * us an encoded blob, we upload it + ship a visitor message\n * carrying the resulting `mediaId` in one go. Skips the attachment\n * row entirely — visitors expect a voice note to behave like a\n * message, not a draft. Demo mode optimistically appends an\n * inbound bubble that renders the local blob URL so the visitor\n * sees their take in the conversation immediately.\n */\n const handleRecordingComplete = async (rec: VoiceRecording) => {\n setRecording(false);\n if (rec.size > MAX_UPLOAD_BYTES) {\n setUploadError(t(\"fileTooLarge\"));\n return;\n }\n if (isDummy) {\n // Convert the base64 payload back into a Blob URL so the\n // optimistic bubble actually plays back the recording.\n const blob = base64ToBlob(rec.base64, rec.mimetype);\n const url = URL.createObjectURL(blob);\n const msgId = `tmp-voice-${Date.now()}`;\n appendLive({\n id: msgId,\n direction: \"INBOUND\",\n text: \"\",\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"You\" },\n media: [{ url, mimetype: rec.mimetype, alt: rec.filename }],\n deliveryStatus: \"DELIVERED\",\n });\n onOutbound?.();\n // Canned AI reply ~900ms later so the demo conversation feels alive.\n setTimeout(() => {\n appendLive({\n id: `tmp-fin-${Date.now()}`,\n direction: \"OUTBOUND\",\n text: \"Got your voice note - let me check that and circle back.\",\n ageLabel: \"now\",\n sender: { kind: \"ai\", name: AI_ASSISTANT_NAME },\n });\n setReadMessageIds((prev) => {\n const next = new Set(prev);\n next.add(msgId);\n return next;\n });\n onInbound?.();\n }, 900);\n return;\n }\n try {\n const res = await uploadFile({\n variables: {\n input: {\n filename: rec.filename,\n mimetype: rec.mimetype,\n dataBase64: rec.base64,\n },\n },\n });\n const mediaId = res.data?.uploadVisitorMedia?.mediaId;\n if (!mediaId) throw new Error(\"empty upload response\");\n // Optimistic bubble with a local blob URL — flips to the\n // BE-resolved media URL when the next history fetch lands.\n const blob = base64ToBlob(rec.base64, rec.mimetype);\n const localUrl = URL.createObjectURL(blob);\n const optimisticId = `tmp-voice-${Date.now()}`;\n appendLive({\n id: optimisticId,\n clientKey: optimisticId,\n direction: \"INBOUND\",\n text: \"\",\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"\" },\n media: [{ url: localUrl, mimetype: rec.mimetype, alt: rec.filename }],\n deliveryStatus: \"SENT\",\n });\n await send({ variables: { input: { mediaIds: [mediaId] } } });\n onOutbound?.();\n } catch {\n setUploadError(t(\"uploadFailed\"));\n }\n };\n\n const handleRecordingError = (kind: \"denied\" | \"unsupported\" | \"failed\") => {\n setRecording(false);\n setUploadError(\n kind === \"unsupported\"\n ? t(\"voiceUnsupported\")\n : kind === \"denied\"\n ? t(\"voiceDenied\")\n : t(\"uploadFailed\"),\n );\n };\n\n const handleSend = async () => {\n const text = draft.trim();\n const mediaIds = attachments.map((a) => a.mediaId).filter((id): id is string => Boolean(id));\n if ((!text && mediaIds.length === 0) || sending || submittingPrechat) return;\n\n // Renderable media for the visitor's OWN optimistic bubble — without it\n // the just-sent image/file wouldn't show until a later history refetch.\n const optimisticMedia = attachments\n .filter((a): a is AttachmentChip & { url: string } => !!a.mediaId && !!a.url)\n .map((a) => ({ url: a.url, mimetype: a.mimetype, alt: a.filename }));\n\n // Prechat gate — when the operator requires visitor details, the\n // compact fields above the editor are validated + submitted WITH\n // this first message (profile attached before the message). Abort\n // the send if they're missing/invalid.\n if (!(await ensurePrechat())) return;\n\n if (isDummy) {\n setDraft(\"\");\n setAttachments([]);\n sendDummyExchange(text || \"[file]\");\n return;\n }\n\n const optimisticId = `tmp-${Date.now()}`;\n appendLive({\n id: optimisticId,\n clientKey: optimisticId,\n direction: \"INBOUND\",\n text,\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"\" },\n ...(optimisticMedia.length > 0 ? { media: optimisticMedia } : {}),\n // Optimistic SENT — the next history refetch will swap the\n // tmp row with the real one (DELIVERED). SSE read-receipts\n // for the real id then upgrade it to READ.\n deliveryStatus: \"SENT\",\n });\n setDraft(\"\");\n setAttachments([]);\n try {\n const res = await send({\n variables: {\n input: {\n ...(text ? { text } : {}),\n ...(mediaIds.length > 0 ? { mediaIds } : {}),\n },\n },\n });\n onOutbound?.();\n const ack = res.data?.sendVisitorMessage;\n // Reconcile the optimistic tmp-id with the BE's real\n // `messageId`. Keeps the bubble visible the whole time;\n // dedupe against `historyData` now works because both lists\n // refer to the same id.\n const realId = ack?.messageId;\n if (realId) {\n replaceLiveMessage?.(optimisticId, {\n id: realId,\n direction: \"INBOUND\",\n text,\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"\" },\n ...(optimisticMedia.length > 0 ? { media: optimisticMedia } : {}),\n deliveryStatus: \"DELIVERED\",\n });\n }\n // No refetch. The previous version called\n // `refetchHistory({ chatId, limit: 50 })`\n // after every send so Apollo's cache picked up the canonical\n // row. That fired a full chat-history network round-trip on\n // every keystroke-bound send — visibly slowing the bubble\n // appear/settle UX. The combo already in place is enough:\n // 1. `appendLiveMessage(...)` adds the optimistic row to\n // the shell-owned `liveMessages` array.\n // 2. `replaceLiveMessage(...)` swaps the tmp id for the\n // BE-canonical id, so dedupe against the cached history\n // works on the next mount.\n // 3. `liveMessages` lives on the widget shell, not the\n // Messages tab, so it survives Help / News detours\n // without a refetch.\n // 4. SSE delivery / read receipts upgrade `deliveryStatus`\n // on the same in-memory row.\n // The cached `visitorChatHistory` *will* be a beat stale until\n // the next natural refetch (tab focus, app reopen, manual\n // pull-to-refresh), but the UI never displays the cache alone\n // — it always merges with `liveMessages`. So the visitor\n // never sees the stale state.\n } catch {}\n };\n\n // Slash-command chips send their literal text as a message. Same\n // optimistic + id-reconcile path as `handleSend`, and gated by the\n // SAME prechat check so tapping a command can't bypass required\n // details (validates + submits the prechat first, aborts if invalid).\n const sendCommand = async (cmd: string) => {\n setCommandsOpen(false);\n if (!(await ensurePrechat())) return;\n if (isDummy) {\n sendDummyExchange(cmd);\n return;\n }\n const optimisticId = `tmp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n appendLive({\n id: optimisticId,\n clientKey: optimisticId,\n direction: \"INBOUND\",\n text: cmd,\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"\" },\n deliveryStatus: \"SENT\",\n });\n onOutbound?.();\n try {\n const res = await send({ variables: { input: { text: cmd } } });\n const ack = res.data?.sendVisitorMessage;\n const realId = ack?.messageId;\n if (realId) {\n replaceLiveMessage?.(optimisticId, {\n id: realId,\n direction: \"INBOUND\",\n text: cmd,\n ageLabel: \"now\",\n sender: { kind: \"visitor\", name: \"\" },\n deliveryStatus: \"DELIVERED\",\n });\n }\n } catch {}\n };\n\n // Active state of the morphing send/mic button. The \"stop\" state\n // is gone — when recording is active, the entire composer is\n // replaced by the wavesurfer recorder bar, which owns its own\n // stop/send affordances.\n // Show SEND as soon as there's anything to send — text OR any attached\n // file, even if the upload is still in flight. The previous check waited\n // for at least one uploaded `mediaId`, which left the visitor staring at\n // the mic icon after attaching a file. The actual ability to send while an\n // upload is pending is gated separately on `MorphSendButton`'s `disabled`.\n const sendKind: \"mic\" | \"send\" = draft.trim() || attachments.length > 0 ? \"send\" : \"mic\";\n // Disable send while ANY attachment is still uploading — otherwise a tap\n // would fire with `mediaIds=[]` and silently drop the file.\n const uploadingAttachment = attachments.some((a) => a.mediaId === null);\n\n // Operator-configured welcome messages — paint at the top of the\n // thread before any real turn. Each entry is rendered by `kind`:\n // - TEXT → normal bot bubble (AI sender). Uses the configured\n // `aiAssistantAvatar` if set, otherwise hides the\n // avatar slot entirely.\n // - HINT → dim italic affordance pill — sits centered, no\n // avatar. Reads as a \"tip\" not a \"message\".\n // - SYSTEM → centred system row, same style as runtime\n // MessageType.SYSTEM events.\n // Demo surfaces a translated SYSTEM + HINT welcome run (showcasing\n // those kinds); live mode uses the operator's configured messages.\n const welcomeMessages = isDummy ? getMockWelcomeMessages(tDemo) : (messenger?.messages ?? []);\n // SYSTEM messages are operator status notices the visitor must see\n // regardless of auth — shown ALWAYS, even behind the sign-in gate /\n // prechat. HINT (tip card) is conversational chrome, shown only once\n // the visitor can actually converse. `TEXT` was retired alongside the\n // WEB_VISITOR_VISIT flow trigger — proactive bot greetings now arrive\n // via SSE as runtime messages.\n const systemMessages = welcomeMessages.filter((w) => w.kind === \"SYSTEM\");\n const hintMessages = welcomeMessages.filter((w) => w.kind === \"HINT\");\n // The operator's intro (SYSTEM / HINT) belongs at the very START of\n // the thread, so only surface it once there's nothing older — an empty\n // thread, the sign-in gate (no history), or after the visitor has\n // scrolled up and loaded back to the first message (`!historyHasMore`).\n // A long thread with older pages still to load hides the intro until\n // the start is reached.\n const showIntro = isDummy || showAuthGate || (!historyLoading && !historyHasMore);\n // Display toggles plumbed through for future surfaces. None of\n // the three are wired to actual content yet — `showRelatedNews`\n // / `showRelatedHelpArticles` / `showReactionCounts` are reserved\n // for upcoming \"related items\" tiles + aggregate reaction strip\n // under bot bubbles. When those land, gate them on these flags.\n void messenger?.showRelatedNews;\n void messenger?.showRelatedHelpArticles;\n void messenger?.showReactionCounts;\n\n // Interleave date separators + the unread divider into the thread.\n // Memoised for the same reason as `messages` above — without this,\n // every keystroke in the composer ran the full row build (one more\n // O(n) walk with date-key bookkeeping). `t` from next-intl is\n // stable across renders, so referencing it directly is fine.\n const messageRows = useMemo(\n () =>\n buildMessageRows(messages, {\n locale,\n todayLabel: t(\"today\"),\n yesterdayLabel: t(\"yesterday\"),\n unreadAnchorId,\n }),\n [messages, locale, t, unreadAnchorId],\n );\n\n return (\n <div className=\"flex flex-1 flex-col overflow-hidden\">\n <ScrollArea className=\"flex-1\" viewportRef={scrollRef}>\n <div className=\"flex flex-col gap-3 px-4 pt-4 pb-3\">\n {/* SYSTEM messages — ALWAYS shown, even behind the sign-in gate /\n prechat. They're operator status notices the visitor needs\n regardless of whether they can converse yet. */}\n {showIntro && systemMessages.length > 0 && (\n <div className=\"flex flex-col gap-2\">\n {systemMessages.map((wm) => (\n <WelcomeMessage key={`${wm.kind}:${wm.text}`} kind={wm.kind} text={wm.text} />\n ))}\n </div>\n )}\n {/* HINT (tip card): part of the operator's configured intro — shown\n at the START of the thread (empty thread / sign-in gate / once\n scrolled back to the first message), like SYSTEM. */}\n {showIntro && hintMessages.length > 0 && (\n <div className=\"flex flex-col gap-2\">\n {hintMessages.map((wm) => (\n <WelcomeMessage key={`${wm.kind}:${wm.text}`} kind={wm.kind} text={wm.text} />\n ))}\n </div>\n )}\n {/* Conversation. Suppressed entirely while the sign-in gate is up\n — there's no thread to render until auth clears. */}\n {!showAuthGate && (\n <>\n {historyLoading && messages.length === 0 && (\n // Chat-history skeleton — three alternating bubbles\n // (operator + visitor) so the layout doesn't flicker once\n // the real history lands.\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-start gap-2\">\n <Skeleton className=\"h-7 w-7 shrink-0 rounded-full\" />\n <Skeleton className=\"h-10 w-3/4 rounded-wx-lg\" />\n </div>\n <div className=\"flex flex-row-reverse items-start\">\n <Skeleton className=\"h-8 w-2/3 rounded-wx-lg\" />\n </div>\n <div className=\"flex items-start gap-2\">\n <Skeleton className=\"h-7 w-7 shrink-0 rounded-full\" />\n <Skeleton className=\"h-12 w-4/5 rounded-wx-lg\" />\n </div>\n </div>\n )}\n {/* `initial={isDummy}` animates the thread on demo's first\n paint (directional slide-in); real mode keeps its history\n static — no fly-in of 50 history rows. */}\n <AnimatePresence initial={isDummy}>\n {messageRows.map((row) => {\n if (row.kind === \"date\") {\n return <DateSeparator key={row.key} label={row.label} />;\n }\n if (row.kind === \"unread\") {\n return (\n <UnreadDivider\n key={row.key}\n ref={unreadDividerRef}\n label={t(\"unreadMessages\")}\n />\n );\n }\n const msg = row.message;\n // Overlay the realtime read state onto the bubble: if\n // we've heard a read-receipt for this id over SSE,\n // force deliveryStatus=\"READ\" regardless of what the\n // history fetch said. Avoids a refetch just to flip\n // a glyph.\n const overlaid = readMessageIds.has(msg.id)\n ? ({ ...msg, deliveryStatus: \"READ\" } as MockMessage)\n : msg;\n return (\n <MessageBubble\n key={row.key}\n message={overlaid}\n organizationLogoUrl={organizationLogoUrl}\n organizationName={organizationName}\n aiAssistantAvatarUrl={messenger?.aiAssistantAvatar ?? null}\n buttonsActive={msg.id === activeButtonMessageId}\n onButtonClick={(btn) => handleQuickReply(msg.id, btn)}\n onOpenLightbox={openLightbox}\n onInternalLink={onInternalLink}\n />\n );\n })}\n </AnimatePresence>\n </>\n )}\n {!showAuthGate && typingActor && (\n <TypingBubble\n actorName={typingActor.name}\n actorKind={typingActor.kind}\n actorAvatarUrl={typingActor.avatar}\n actorPhase={typingActor.phase}\n aiAssistantAvatarUrl={messenger?.aiAssistantAvatar ?? null}\n organizationLogoUrl={organizationLogoUrl}\n organizationName={organizationName}\n />\n )}\n </div>\n </ScrollArea>\n\n <div className=\"relative bg-wx-bg px-3 pt-2 pb-3\">\n <EmojiPicker\n open={emojiOpen}\n onClose={() => setEmojiOpen(false)}\n onSelect={insertEmoji}\n anchorRef={emojiAnchorRef}\n />\n {uploadError && <p className=\"mb-2 text-xs text-wx-danger\">{uploadError}</p>}\n\n <AnimatePresence mode=\"wait\" initial={false}>\n {showAuthGate ? (\n // Operator requires a verified identity — replace the whole\n // composer with the sign-in panel until the visitor\n // authenticates (then `verified` flips and the composer\n // returns). The handshake runs in the shell off the resulting\n // identity, so there's nothing to wire here beyond the token.\n <motion.div\n key=\"auth-gate\"\n initial={{ opacity: 0, y: 6 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -6 }}\n transition={{ duration: 0.18 }}\n className=\"flex flex-col items-center gap-2 rounded-wx-lg border border-wx-border bg-wx-bg p-4\"\n >\n <p className=\"text-center text-sm text-wx-fg-muted\">{t(\"signInToChat\")}</p>\n {/* Full-width button column. Both methods stretch to fill it:\n the passkey button natively, and the Google (GIS) button via\n the `[data-wx-gis]` override in globals.css that lifts GIS's\n hard 400px cap. */}\n <div className=\"flex w-full flex-col gap-2\">\n {isDummy ? (\n // PREVIEW — no real auth backend; mock buttons fake-complete\n // so the operator sees the gate → composer transition.\n <>\n {security?.google?.enabled && (\n <button\n type=\"button\"\n onClick={() => setDemoAuthed(true)}\n className=\"flex w-full items-center justify-center gap-2 rounded-wx border border-wx-border bg-wx-bg-elevated px-4 py-2 text-sm font-medium text-wx-fg transition-colors hover:bg-wx-bg-elevated-2\"\n >\n {t(\"googleSignInDemo\")}\n </button>\n )}\n {security?.passkey?.enabled && (\n <button\n type=\"button\"\n onClick={() => setDemoAuthed(true)}\n className=\"flex w-full items-center justify-center gap-2 rounded-wx border border-wx-border bg-wx-bg-elevated px-4 py-2 text-sm font-medium text-wx-fg transition-colors hover:bg-wx-bg-elevated-2\"\n >\n {t(\"passkeySignIn\")}\n </button>\n )}\n {!security?.google?.enabled && !security?.passkey?.enabled && (\n <p className=\"text-center text-xs text-wx-fg-subtle\">\n {t(\"signInUnavailable\")}\n </p>\n )}\n </>\n ) : (\n <>\n {/* Google: direct GIS integration. Widget loads\n `accounts.google.com/gsi/client`, renders the\n native button, and pipes the resulting id_token\n through `onGoogleCredential` → `setWidgetIdentity({\n googleIdToken })` in the shell → the identified\n handshake → BE audience check. */}\n {googleSignIn && (\n <GoogleSignInButton\n clientId={googleSignIn}\n onCredential={(idToken) => onGoogleCredential?.(idToken)}\n />\n )}\n {/* Passkey: in-widget WebAuthn ceremony (no host\n bridge). */}\n {passkeySignIn && <PasskeySignInButton onSession={onPasskeySession} />}\n {!googleSignIn && !passkeySignIn && (\n // requireAuth on, but no in-widget method enabled — the\n // host is expected to identify the visitor (props / Wexio).\n <p className=\"text-center text-xs text-wx-fg-subtle\">\n {t(\"signInUnavailable\")}\n </p>\n )}\n </>\n )}\n </div>\n </motion.div>\n ) : recording ? (\n // Fallback matches the recorder bar's height so the composer\n // area doesn't jump while the wavesurfer chunk streams in.\n <Suspense\n key=\"recorder\"\n fallback={\n <div className=\"h-13 w-full animate-pulse rounded-wx-lg bg-wx-bg-elevated\" />\n }\n >\n <VoiceRecorderBar\n onComplete={handleRecordingComplete}\n onCancel={() => setRecording(false)}\n onError={handleRecordingError}\n />\n </Suspense>\n ) : (\n <motion.div\n key=\"composer\"\n initial={{ opacity: 0, y: 6 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -6 }}\n transition={{ duration: 0.18 }}\n className={cn(\n \"flex flex-col rounded-wx-lg border border-wx-border bg-wx-bg\",\n \"focus-within:border-wx-primary focus-within:ring-2 focus-within:ring-wx-primary/20\",\n \"transition-colors\",\n )}\n >\n {/* Staged attachments — INSIDE the composer's bordered card, at\n the top, so the row reads as part of the editor (one card)\n instead of a detached strip floating above it. */}\n {attachments.length > 0 && (\n <div className=\"px-3 pt-3 pb-1\">\n <AttachmentPreview\n attachments={attachments}\n onRemove={removeAttachment}\n onOpenLightbox={openLightbox}\n />\n </div>\n )}\n {/* Prechat — compact fields ABOVE the editor. The visitor\n fills them alongside their first message; the single\n send (below) submits the prechat then the message. They\n disappear once submitted (or when a known-user identity\n already covers the required fields). */}\n {showPrechat && prechatForm && (\n <>\n <PrechatComposerFields\n form={prechatForm}\n values={prechatValues}\n errors={prechatErrors}\n onChange={setPrechatField}\n disabled={submittingPrechat}\n />\n {prechatSubmitError && (\n <p className=\"px-3 pt-1.5 text-[11px] text-wx-danger\">{prechatSubmitError}</p>\n )}\n </>\n )}\n <textarea\n ref={textareaRef}\n name=\"wexio-message\"\n value={draft}\n onChange={(e) => {\n setDraft(e.target.value);\n fireTypingSignal();\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n handleSend();\n }\n }}\n placeholder={t(\"sendCta\")}\n style={{ minHeight: 41, maxHeight: 120 }}\n // Suppress password-manager autofill — composers look\n // form-shaped enough that 1Password / LastPass / Chrome\n // sometimes offer to fill credentials. Belt + braces.\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"sentences\"\n spellCheck={true}\n data-1p-ignore=\"true\"\n data-lpignore=\"true\"\n data-form-type=\"other\"\n className={cn(\n \"w-full resize-none rounded-wx-lg bg-transparent px-4 pt-2.5 pb-1 text-sm text-wx-fg\",\n \"placeholder:text-wx-fg-muted\",\n \"focus:outline-none\",\n )}\n />\n <div className=\"flex items-center justify-between px-1.5 pt-0.5 pb-1.5\">\n <div className=\"flex items-center gap-0.5\">\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={Array.from(ALLOWED_UPLOAD_MIMES).join(\",\")}\n className=\"hidden\"\n onChange={(e) => {\n const file = e.target.files?.[0];\n if (file) handleFileChosen(file);\n e.target.value = \"\";\n }}\n />\n <motion.button\n type=\"button\"\n aria-label={t(\"attach\")}\n onClick={() => fileInputRef.current?.click()}\n whileHover={{ scale: 1.12 }}\n whileTap={{ scale: 0.9 }}\n transition={{ type: \"spring\", stiffness: 400, damping: 20 }}\n className=\"flex h-7 w-7 items-center justify-center rounded-full text-wx-fg-muted transition-colors hover:bg-wx-bg-elevated hover:text-wx-fg\"\n >\n <Paperclip size={14} />\n </motion.button>\n <motion.button\n ref={emojiAnchorRef}\n type=\"button\"\n aria-label={t(\"emoji\")}\n aria-expanded={emojiOpen}\n onClick={() => setEmojiOpen((v) => !v)}\n whileHover={{ scale: 1.12 }}\n whileTap={{ scale: 0.9 }}\n transition={{ type: \"spring\", stiffness: 400, damping: 20 }}\n className={cn(\n \"flex h-7 w-7 items-center justify-center rounded-full transition-colors\",\n emojiOpen\n ? \"bg-wx-bg-elevated text-wx-fg\"\n : \"text-wx-fg-muted hover:bg-wx-bg-elevated hover:text-wx-fg\",\n )}\n >\n <Smile size={14} />\n </motion.button>\n {/* Commands chip dropdown — only rendered when the\n operator has configured at least one command. A\n tap opens a popover with the configured commands;\n picking one sends the literal text as an inbound\n visitor message (same path the typed-send uses). */}\n {(messenger?.commands?.length ?? 0) > 0 && (\n <div className=\"relative\">\n <motion.button\n ref={commandsAnchorRef}\n type=\"button\"\n aria-label={t(\"commands\")}\n aria-expanded={commandsOpen}\n onClick={() => setCommandsOpen((v) => !v)}\n whileHover={{ scale: 1.12 }}\n whileTap={{ scale: 0.9 }}\n transition={{\n type: \"spring\",\n stiffness: 400,\n damping: 20,\n }}\n className={cn(\n \"flex h-7 w-7 items-center justify-center rounded-full transition-colors\",\n commandsOpen\n ? \"bg-wx-bg-elevated text-wx-fg\"\n : \"text-wx-fg-muted hover:bg-wx-bg-elevated hover:text-wx-fg\",\n )}\n >\n <Command size={14} />\n </motion.button>\n <AnimatePresence>\n {commandsOpen && (\n <motion.div\n data-wx-commands-panel\n initial={{ opacity: 0, y: 4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: 4 }}\n transition={{ duration: 0.12 }}\n className=\"absolute bottom-full left-0 z-10 mb-2 w-44 overflow-hidden rounded-lg border border-wx-border bg-wx-bg shadow-lg\"\n >\n <ul className=\"flex flex-col py-1\">\n {messenger?.commands.map((cmd) => (\n <li key={cmd}>\n <button\n type=\"button\"\n onClick={() => sendCommand(cmd)}\n className=\"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs font-mono text-wx-fg hover:bg-wx-bg-elevated\"\n >\n {cmd}\n </button>\n </li>\n ))}\n </ul>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n )}\n </div>\n <MorphSendButton\n kind={sendKind}\n disabled={sending || uploadingAttachment}\n onSend={handleSend}\n onMic={startRecording}\n ariaLabels={{\n send: t(\"sendCta\"),\n mic: t(\"record\"),\n }}\n />\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n\n <MediaLightbox\n items={lightbox?.items ?? []}\n initialIndex={lightbox?.index ?? 0}\n open={!!lightbox}\n onClose={() => setLightbox(null)}\n />\n </div>\n );\n}\n","import { Camera, ImagePlus, Loader2, Lock, Trash2 } from \"lucide-react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport type { VisitorProfileField } from \"@/lib/graphql/queries/generated/profile.generated\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Centered avatar hero — image (or initials fallback) with a soft\n * branded halo on hover. The avatar circle IS the click target —\n * there's no separate \"Change photo\" button under it (the hover\n * overlay + the `aria-label` carry the affordance). A floating\n * trash button clears an existing image; pinned avatars hide both\n * the upload and clear affordances and show a small lock badge.\n */\nexport function AvatarHero({\n field,\n value,\n uploading,\n onPick,\n onClear,\n displayName,\n t,\n}: {\n field: VisitorProfileField;\n value: string | null;\n uploading: boolean;\n onPick: (file: File) => void;\n onClear: () => void;\n displayName: string;\n t: (key: string) => string;\n}) {\n const inputRef = useRef<HTMLInputElement | null>(null);\n // Track per-URL load failure so a 429 / network blip falls back to\n // initials instead of a broken-image glyph. Reset when `value` flips\n // (e.g. visitor re-uploads after the failure) so the new URL gets a\n // fresh attempt rather than staying stuck on the prior error state.\n const [imgFailed, setImgFailed] = useState(false);\n // biome-ignore lint/correctness/useExhaustiveDependencies: `value` is the deliberate reset trigger — we DO want to clear the failure state when the visitor uploads a new URL, even though the effect body doesn't read it.\n useEffect(() => {\n setImgFailed(false);\n }, [value]);\n const initials = displayName\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((s) => s[0]?.toUpperCase() ?? \"\")\n .join(\"\");\n const pinned = field.pinned;\n\n return (\n <div className=\"flex flex-col items-center gap-2.5 pt-4 pb-2\">\n <div className=\"group relative\">\n {/* Soft branded halo behind the avatar — uses the operator's\n primary token so re-skinning the widget recolors it for free. */}\n <span\n aria-hidden=\"true\"\n className=\"absolute -inset-2 rounded-full bg-wx-primary/20 opacity-0 blur-lg transition-opacity duration-300 group-hover:opacity-100\"\n />\n <button\n type=\"button\"\n disabled={pinned || uploading}\n onClick={() => inputRef.current?.click()}\n aria-label={t(\"uploadAvatar\")}\n style={{ height: 88, width: 88 }}\n className={cn(\n \"relative flex items-center justify-center overflow-hidden rounded-full\",\n \"bg-gradient-to-br from-wx-bg-elevated to-wx-bg-elevated-2 text-2xl font-semibold text-wx-fg-muted\",\n \"ring-1 ring-inset ring-wx-border\",\n !pinned &&\n !uploading &&\n \"cursor-pointer transition-transform duration-200 hover:scale-[1.04]\",\n pinned && \"cursor-not-allowed\",\n )}\n >\n {value && !imgFailed ? (\n // biome-ignore lint/performance/noImgElement: visitor-uploaded image of arbitrary host/dimensions; next/image needs known sizes + an allowlist\n <img\n src={value}\n alt=\"\"\n className=\"h-full w-full object-cover\"\n // Google's `lh3.googleusercontent.com` CDN sometimes 429s\n // when accessed with a localhost / non-https Referer.\n // Strip the referer for visitor-uploaded avatars too —\n // there's no analytics reason to send it, and the image\n // host has no use for it. Defensive against 3rd-party CDN\n // rate-limits and tracking-based throttles in general.\n referrerPolicy=\"no-referrer\"\n onError={() => setImgFailed(true)}\n />\n ) : initials ? (\n <span aria-hidden=\"true\">{initials}</span>\n ) : (\n <Camera size={26} aria-hidden=\"true\" />\n )}\n {!pinned && (\n <span className=\"absolute inset-x-0 bottom-0 flex h-7 items-center justify-center bg-black/45 opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100\">\n {uploading ? (\n <Loader2 size={14} className=\"animate-spin text-white\" aria-hidden=\"true\" />\n ) : (\n <ImagePlus size={14} className=\"text-white\" aria-hidden=\"true\" />\n )}\n </span>\n )}\n </button>\n {pinned && (\n <span className=\"absolute right-0 bottom-0 flex h-6 w-6 items-center justify-center rounded-full bg-wx-bg shadow-sm ring-1 ring-wx-border\">\n <Lock size={11} className=\"text-wx-fg-subtle\" aria-hidden=\"true\" />\n </span>\n )}\n {!pinned && value && (\n <button\n type=\"button\"\n onClick={onClear}\n aria-label={t(\"removeAvatar\")}\n className=\"-top-1 -right-1 absolute flex h-7 w-7 items-center justify-center rounded-full border border-wx-border bg-wx-bg text-wx-fg-muted shadow-sm transition-colors hover:bg-wx-bg-elevated hover:text-wx-danger\"\n >\n <Trash2 size={12} aria-hidden=\"true\" />\n </button>\n )}\n <input\n ref={inputRef}\n type=\"file\"\n accept=\"image/png,image/jpeg,image/gif,image/webp\"\n className=\"hidden\"\n onChange={(e) => {\n const file = e.target.files?.[0];\n if (file) onPick(file);\n e.target.value = \"\";\n }}\n />\n </div>\n {displayName && <p className=\"text-[15px] font-semibold text-wx-fg\">{displayName}</p>}\n {pinned && <p className=\"text-[11px] text-wx-fg-subtle\">{t(\"pinnedHint\")}</p>}\n </div>\n );\n}\n","import { cn } from \"@/lib/utils\";\n\n/**\n * Standalone iOS-style switch — the right-hand slot for boolean rows\n * in `SettingsRow`. Kept presentational so the parent can wire its\n * own async permission-prompt flow on `onChange`.\n */\nexport function Switch({\n checked,\n onChange,\n disabled,\n}: {\n checked: boolean;\n onChange: (next: boolean) => void;\n disabled?: boolean;\n}) {\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n disabled={disabled}\n onClick={() => onChange(!checked)}\n className={cn(\n \"relative h-6 w-10 shrink-0 rounded-full transition-colors\",\n checked ? \"bg-wx-primary\" : \"bg-wx-bg-elevated-2\",\n disabled && \"cursor-not-allowed opacity-60\",\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"absolute top-0.5 left-0.5 h-5 w-5 rounded-full bg-white shadow transition-transform\",\n checked && \"translate-x-4\",\n )}\n />\n </button>\n );\n}\n","import { Switch } from \"../switch\";\n\n/** BOOLEAN field — full-width align so the switch lives in the\n * field-row rhythm instead of the SettingsRow rhythm (those two have\n * different visual weights). Stored as the string `\"true\"`/`\"false\"`\n * per the BE's wire contract. */\nexport function BooleanControl({\n id,\n value,\n disabled,\n onChange,\n}: {\n id: string;\n value: string | null;\n disabled?: boolean;\n onChange: (next: string | null) => void;\n}) {\n // Render inside a flex container so the switch hugs the start —\n // matches the other field controls' left-alignment instead of\n // stretching to full-width-blank.\n return (\n <div id={id} className=\"flex\">\n <Switch\n checked={value === \"true\"}\n disabled={disabled}\n onChange={(next) => onChange(next ? \"true\" : \"false\")}\n />\n </div>\n );\n}\n","import type {\n VisitorProfile,\n VisitorProfileField,\n VisitorProfileFieldUpdate,\n} from \"@/lib/graphql/queries/generated/profile.generated\";\n\n/** Seed local edit state from the BE-resolved profile. */\nexport function seedValues(p: VisitorProfile): Record<string, string | null> {\n const out: Record<string, string | null> = {};\n for (const f of p.fields) out[f.key] = f.value ?? null;\n return out;\n}\n\nexport function isEmpty(v: string | null): boolean {\n return v == null || v === \"\" || v.trim() === \"\";\n}\n\n/** Canonical wire-form for a value of a given type — used both when\n * writing the input AND when computing the diff so the two stay in\n * sync. `value` is always string-serialised on the wire. */\nexport function normalise(value: string | null, type: VisitorProfileField[\"type\"]): string | null {\n if (value == null) return null;\n switch (type) {\n case \"STRING\":\n case \"ENUM\":\n case \"AVATAR\":\n return value.trim() === \"\" ? null : value.trim();\n case \"NUMBER\": {\n const trimmed = value.trim();\n if (trimmed === \"\") return null;\n const n = Number(trimmed);\n return Number.isFinite(n) ? String(n) : trimmed;\n }\n case \"BOOLEAN\":\n return value === \"true\" ? \"true\" : \"false\";\n case \"DATE\":\n return value === \"\" ? null : value;\n case \"ARRAY\": {\n const trimmed = value.trim();\n if (trimmed === \"\") return null;\n try {\n const parsed = JSON.parse(trimmed);\n if (Array.isArray(parsed)) return JSON.stringify(parsed.map(String));\n } catch {\n /* fall through — treat as comma-separated literal */\n }\n return JSON.stringify(\n trimmed\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean),\n );\n }\n default:\n return value;\n }\n}\n\n/** Diff visitor's edits against the BE-resolved baseline — returns ONLY\n * the changed fields, in `{key, value}[]` shape the mutation expects.\n * Pinned rows are filtered out so the BE never sees a write attempt\n * for a locked field (it would reject anyway with `webProfileFieldPinned`). */\nexport function diffFields(\n fields: VisitorProfileField[],\n values: Record<string, string | null>,\n): VisitorProfileFieldUpdate[] {\n const updates: VisitorProfileFieldUpdate[] = [];\n for (const f of fields) {\n if (f.pinned) continue;\n const base = normalise(f.value ?? null, f.type);\n const next = normalise(values[f.key] ?? null, f.type);\n if (base === next) continue;\n updates.push({ key: f.key, value: next ?? \"\" });\n }\n return updates;\n}\n\n/** Friendly display name for the avatar hero: prefer the explicit\n * `firstName` + `lastName` pair, then any `name`-ish single field,\n * then fall back to nothing. */\nexport function pickDisplayName(p: VisitorProfile, vals: Record<string, string | null>): string {\n const grab = (key: string) =>\n vals[key]?.trim() || p.fields.find((f) => f.key === key)?.value?.trim() || \"\";\n const first = grab(\"firstName\");\n const last = grab(\"lastName\");\n if (first || last) return `${first} ${last}`.trim();\n return grab(\"name\") || grab(\"displayName\") || \"\";\n}\n\n/** Coerce any BE-supplied date string (`2024-01-15` or full ISO) into\n * the `YYYY-MM-DD` shape `<input type=\"date\">` requires. */\nexport function dateInputValue(v: string | null): string {\n if (!v) return \"\";\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(v)) return v;\n const d = new Date(v);\n if (Number.isNaN(d.getTime())) return \"\";\n return d.toISOString().slice(0, 10);\n}\n\n/** Parse an ARRAY field value (JSON-array on the wire) into a list of\n * strings; returns `[]` for anything malformed. */\nexport function parseArrayValue(v: string | null): string[] {\n if (!v) return [];\n try {\n const parsed = JSON.parse(v);\n if (Array.isArray(parsed)) return parsed.map((x) => String(x));\n } catch {\n /* fall through */\n }\n return [];\n}\n\n/** Title-case a locale display name returned by `Intl.DisplayNames`. */\nexport function localeDisplayName(code: string, in_: string): string {\n try {\n const dn = new Intl.DisplayNames([in_], { type: \"language\" });\n const out = dn.of(code);\n if (out) return out.charAt(0).toUpperCase() + out.slice(1);\n } catch {\n /* fall through */\n }\n return code;\n}\n\n/** Short readable label for a media-only inbound message — used as the\n * desktop-notification body when there's no text. Mirrors the helper\n * in `widget-shell` but lives here so `profile-tab` can reuse it for\n * its own UI affordances later without a circular import. */\nexport function mediaSummary(media: { mimetype: string }[]): string {\n if (media.length === 0) return \"New message\";\n const head = media[0]?.mimetype ?? \"\";\n const kind = head.startsWith(\"image/\")\n ? \"Image\"\n : head.startsWith(\"video/\")\n ? \"Video\"\n : head.startsWith(\"audio/\")\n ? \"Voice message\"\n : \"Attachment\";\n return media.length > 1 ? `${kind} +${media.length - 1}` : kind;\n}\n","import { cn } from \"@/lib/utils\";\n\n/** Shared className for the form-row inputs (text/number/date inputs +\n * inline selects). Centralised so every control row stays visually\n * consistent. */\nexport const inputCls = cn(\n \"w-full rounded-wx-sm border border-wx-border bg-wx-bg px-3 py-2 text-sm text-wx-fg\",\n \"focus:border-wx-primary focus:outline-none focus:ring-2 focus:ring-wx-primary/20\",\n \"read-only:cursor-not-allowed read-only:bg-wx-bg-elevated/60 read-only:text-wx-fg-muted\",\n \"disabled:cursor-not-allowed disabled:bg-wx-bg-elevated/60 disabled:text-wx-fg-muted\",\n);\n","import { dateInputValue } from \"../helpers\";\nimport { inputCls } from \"../input-class\";\n\nexport function DateControl({\n id,\n value,\n disabled,\n onChange,\n}: {\n id: string;\n value: string | null;\n disabled?: boolean;\n onChange: (next: string | null) => void;\n}) {\n return (\n <input\n id={id}\n type=\"date\"\n value={dateInputValue(value)}\n disabled={disabled}\n onChange={(e) => onChange(e.target.value || null)}\n className={inputCls}\n />\n );\n}\n","import { inputCls } from \"../input-class\";\n\nexport function NumberControl({\n id,\n value,\n disabled,\n onChange,\n}: {\n id: string;\n value: string | null;\n disabled?: boolean;\n onChange: (next: string | null) => void;\n}) {\n return (\n <input\n id={id}\n type=\"number\"\n value={value ?? \"\"}\n disabled={disabled}\n inputMode=\"decimal\"\n onChange={(e) => onChange(e.target.value || null)}\n className={inputCls}\n />\n );\n}\n","// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n insert(index, key, value) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i];\n if (keys[i] === key) {\n nextKey = keys[i + 1];\n }\n if (has) {\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1];\n const currentValue = nextValue;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n find(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return void 0;\n }\n findIndex(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n filter(predicate, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new _OrderedDict(entries);\n }\n map(callbackfn, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new _OrderedDict(entries);\n }\n reduce(...args) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0);\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1);\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index);\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index);\n const element = this.get(key);\n reversed.set(key, element);\n }\n return reversed;\n }\n toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\n }\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index);\n const element = this.get(key);\n result.set(key, element);\n }\n return result;\n }\n every(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n some(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n};\nfunction at(array, index) {\n if (\"at\" in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0\n }\n );\n const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\n });\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\n if (a === b) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\") return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === \"childList\") {\n callback();\n return;\n }\n }\n });\n return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-escape-keydown/src/use-escape-keydown.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/dismissable-layer.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DISMISSABLE_LAYER_NAME = \"DismissableLayer\";\nvar CONTEXT_UPDATE = \"dismissableLayer.update\";\nvar POINTER_DOWN_OUTSIDE = \"dismissableLayer.pointerDownOutside\";\nvar FOCUS_OUTSIDE = \"dismissableLayer.focusOutside\";\nvar originalBodyPointerEvents;\nvar DismissableLayerContext = React.createContext({\n layers: /* @__PURE__ */ new Set(),\n layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),\n branches: /* @__PURE__ */ new Set()\n});\nvar DismissableLayer = React.forwardRef(\n (props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target;\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n const focusOutside = useFocusOutside((event) => {\n const target = event.target;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = \"none\";\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...layerProps,\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? \"auto\" : \"none\" : void 0,\n ...props.style\n },\n onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: composeEventHandlers(\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )\n }\n );\n }\n);\nDismissableLayer.displayName = DISMISSABLE_LAYER_NAME;\nvar BRANCH_NAME = \"DismissableLayerBranch\";\nvar DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });\n});\nDismissableLayerBranch.displayName = BRANCH_NAME;\nfunction usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = React.useRef(false);\n const handleClickRef = React.useRef(() => {\n });\n React.useEffect(() => {\n const handlePointerDown = (event) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n let handleAndDispatchPointerDownOutsideEvent2 = function() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n );\n };\n var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;\n const eventDetail = { originalEvent: event };\n if (event.pointerType === \"touch\") {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;\n ownerDocument.addEventListener(\"click\", handleClickRef.current, { once: true });\n } else {\n handleAndDispatchPointerDownOutsideEvent2();\n }\n } else {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n }\n isPointerInsideReactTreeRef.current = false;\n };\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener(\"pointerdown\", handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener(\"pointerdown\", handlePointerDown);\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n };\n }, [ownerDocument, handlePointerDownOutside]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true\n };\n}\nfunction useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {\n const handleFocusOutside = useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = React.useRef(false);\n React.useEffect(() => {\n const handleFocus = (event) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener(\"focusin\", handleFocus);\n return () => ownerDocument.removeEventListener(\"focusin\", handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n return {\n onFocusCapture: () => isFocusInsideReactTreeRef.current = true,\n onBlurCapture: () => isFocusInsideReactTreeRef.current = false\n };\n}\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler, { once: true });\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\nvar Root = DismissableLayer;\nvar Branch = DismissableLayerBranch;\nexport {\n Branch,\n DismissableLayer,\n DismissableLayerBranch,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/focus-guards.tsx\nimport * as React from \"react\";\nvar count = 0;\nfunction FocusGuards(props) {\n useFocusGuards();\n return props.children;\n}\nfunction useFocusGuards() {\n React.useEffect(() => {\n const edgeGuards = document.querySelectorAll(\"[data-radix-focus-guard]\");\n document.body.insertAdjacentElement(\"afterbegin\", edgeGuards[0] ?? createFocusGuard());\n document.body.insertAdjacentElement(\"beforeend\", edgeGuards[1] ?? createFocusGuard());\n count++;\n return () => {\n if (count === 1) {\n document.querySelectorAll(\"[data-radix-focus-guard]\").forEach((node) => node.remove());\n }\n count--;\n };\n }, []);\n}\nfunction createFocusGuard() {\n const element = document.createElement(\"span\");\n element.setAttribute(\"data-radix-focus-guard\", \"\");\n element.tabIndex = 0;\n element.style.outline = \"none\";\n element.style.opacity = \"0\";\n element.style.position = \"fixed\";\n element.style.pointerEvents = \"none\";\n return element;\n}\nexport {\n FocusGuards,\n FocusGuards as Root,\n useFocusGuards\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/focus-scope.tsx\nimport * as React from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { jsx } from \"react/jsx-runtime\";\nvar AUTOFOCUS_ON_MOUNT = \"focusScope.autoFocusOnMount\";\nvar AUTOFOCUS_ON_UNMOUNT = \"focusScope.autoFocusOnUnmount\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar FOCUS_SCOPE_NAME = \"FocusScope\";\nvar FocusScope = React.forwardRef((props, forwardedRef) => {\n const {\n loop = false,\n trapped = false,\n onMountAutoFocus: onMountAutoFocusProp,\n onUnmountAutoFocus: onUnmountAutoFocusProp,\n ...scopeProps\n } = props;\n const [container, setContainer] = React.useState(null);\n const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);\n const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);\n const lastFocusedElementRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));\n const focusScope = React.useRef({\n paused: false,\n pause() {\n this.paused = true;\n },\n resume() {\n this.paused = false;\n }\n }).current;\n React.useEffect(() => {\n if (trapped) {\n let handleFocusIn2 = function(event) {\n if (focusScope.paused || !container) return;\n const target = event.target;\n if (container.contains(target)) {\n lastFocusedElementRef.current = target;\n } else {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }, handleFocusOut2 = function(event) {\n if (focusScope.paused || !container) return;\n const relatedTarget = event.relatedTarget;\n if (relatedTarget === null) return;\n if (!container.contains(relatedTarget)) {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }, handleMutations2 = function(mutations) {\n const focusedElement = document.activeElement;\n if (focusedElement !== document.body) return;\n for (const mutation of mutations) {\n if (mutation.removedNodes.length > 0) focus(container);\n }\n };\n var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;\n document.addEventListener(\"focusin\", handleFocusIn2);\n document.addEventListener(\"focusout\", handleFocusOut2);\n const mutationObserver = new MutationObserver(handleMutations2);\n if (container) mutationObserver.observe(container, { childList: true, subtree: true });\n return () => {\n document.removeEventListener(\"focusin\", handleFocusIn2);\n document.removeEventListener(\"focusout\", handleFocusOut2);\n mutationObserver.disconnect();\n };\n }\n }, [trapped, container, focusScope.paused]);\n React.useEffect(() => {\n if (container) {\n focusScopesStack.add(focusScope);\n const previouslyFocusedElement = document.activeElement;\n const hasFocusedCandidate = container.contains(previouslyFocusedElement);\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n container.dispatchEvent(mountEvent);\n if (!mountEvent.defaultPrevented) {\n focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });\n if (document.activeElement === previouslyFocusedElement) {\n focus(container);\n }\n }\n }\n return () => {\n container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n setTimeout(() => {\n const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n container.dispatchEvent(unmountEvent);\n if (!unmountEvent.defaultPrevented) {\n focus(previouslyFocusedElement ?? document.body, { select: true });\n }\n container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n focusScopesStack.remove(focusScope);\n }, 0);\n };\n }\n }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);\n const handleKeyDown = React.useCallback(\n (event) => {\n if (!loop && !trapped) return;\n if (focusScope.paused) return;\n const isTabKey = event.key === \"Tab\" && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement;\n if (isTabKey && focusedElement) {\n const container2 = event.currentTarget;\n const [first, last] = getTabbableEdges(container2);\n const hasTabbableElementsInside = first && last;\n if (!hasTabbableElementsInside) {\n if (focusedElement === container2) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (loop) focus(first, { select: true });\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (loop) focus(last, { select: true });\n }\n }\n }\n },\n [loop, trapped, focusScope.paused]\n );\n return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });\n});\nFocusScope.displayName = FOCUS_SCOPE_NAME;\nfunction focusFirst(candidates, { select = false } = {}) {\n const previouslyFocusedElement = document.activeElement;\n for (const candidate of candidates) {\n focus(candidate, { select });\n if (document.activeElement !== previouslyFocusedElement) return;\n }\n}\nfunction getTabbableEdges(container) {\n const candidates = getTabbableCandidates(container);\n const first = findVisible(candidates, container);\n const last = findVisible(candidates.reverse(), container);\n return [first, last];\n}\nfunction getTabbableCandidates(container) {\n const nodes = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node) => {\n const isHiddenInput = node.tagName === \"INPUT\" && node.type === \"hidden\";\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n }\n });\n while (walker.nextNode()) nodes.push(walker.currentNode);\n return nodes;\n}\nfunction findVisible(elements, container) {\n for (const element of elements) {\n if (!isHidden(element, { upTo: container })) return element;\n }\n}\nfunction isHidden(node, { upTo }) {\n if (getComputedStyle(node).visibility === \"hidden\") return true;\n while (node) {\n if (upTo !== void 0 && node === upTo) return false;\n if (getComputedStyle(node).display === \"none\") return true;\n node = node.parentElement;\n }\n return false;\n}\nfunction isSelectableInput(element) {\n return element instanceof HTMLInputElement && \"select\" in element;\n}\nfunction focus(element, { select = false } = {}) {\n if (element && element.focus) {\n const previouslyFocusedElement = document.activeElement;\n element.focus({ preventScroll: true });\n if (element !== previouslyFocusedElement && isSelectableInput(element) && select)\n element.select();\n }\n}\nvar focusScopesStack = createFocusScopesStack();\nfunction createFocusScopesStack() {\n let stack = [];\n return {\n add(focusScope) {\n const activeFocusScope = stack[0];\n if (focusScope !== activeFocusScope) {\n activeFocusScope?.pause();\n }\n stack = arrayRemove(stack, focusScope);\n stack.unshift(focusScope);\n },\n remove(focusScope) {\n stack = arrayRemove(stack, focusScope);\n stack[0]?.resume();\n }\n };\n}\nfunction arrayRemove(array, item) {\n const updatedArray = [...array];\n const index = updatedArray.indexOf(item);\n if (index !== -1) {\n updatedArray.splice(index, 1);\n }\n return updatedArray;\n}\nfunction removeLinks(items) {\n return items.filter((item) => item.tagName !== \"A\");\n}\nvar Root = FocusScope;\nexport {\n FocusScope,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/id/src/id.tsx\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nvar useReactId = React[\" useId \".trim().toString()] || (() => void 0);\nvar count = 0;\nfunction useId(deterministicId) {\n const [id, setId] = React.useState(useReactId());\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : \"\");\n}\nexport {\n useId\n};\n//# sourceMappingURL=index.mjs.map\n","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n const firstChar = placement[0];\n return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');\n}\nconst lrPlacement = ['left', 'right'];\nconst rlPlacement = ['right', 'left'];\nconst tbPlacement = ['top', 'bottom'];\nconst btPlacement = ['bottom', 'top'];\nfunction getSideList(side, isStart, rtl) {\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rlPlacement : lrPlacement;\n return isStart ? lrPlacement : rlPlacement;\n case 'left':\n case 'right':\n return isStart ? tbPlacement : btPlacement;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n const side = getSide(placement);\n return oppositeSideMap[side] + placement.slice(side.length);\n}\nfunction expandPaddingObject(padding) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...padding\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n switch (getAlignment(placement)) {\n case 'start':\n coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n case 'end':\n coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n }\n return coords;\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n } : {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n// Maximum number of resets that can occur before bailing to avoid infinite reset loops.\nconst MAX_RESET_COUNT = 50;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const platformWithDetectOverflow = platform.detectOverflow ? platform : {\n ...platform,\n detectOverflow\n };\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let resetCount = 0;\n const middlewareData = {};\n for (let i = 0; i < middleware.length; i++) {\n const currentMiddleware = middleware[i];\n if (!currentMiddleware) {\n continue;\n }\n const {\n name,\n fn\n } = currentMiddleware;\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform: platformWithDetectOverflow,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData[name] = {\n ...middlewareData[name],\n ...data\n };\n if (reset && resetCount < MAX_RESET_COUNT) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min$1 = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min$1, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n if (!ignoreCrossAxisOverflow ||\n // We leave the current main axis only if every placement on that axis\n // overflows the main axis.\n overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects,\n platform\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n const left = minLeft;\n const right = maxRight;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\nconst originSides = /*#__PURE__*/new Set(['left', 'top']);\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = originSides.has(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n platform\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(getSide(placement));\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n if (checkMainAxis) {\n const minSide = mainAxis === 'y' ? 'top' : 'left';\n const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n const min = mainAxisCoord + overflow[minSide];\n const max = mainAxisCoord - overflow[maxSide];\n mainAxisCoord = clamp(min, mainAxisCoord, max);\n }\n if (checkCrossAxis) {\n const minSide = crossAxis === 'y' ? 'top' : 'left';\n const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n const min = crossAxisCoord + overflow[minSide];\n const max = crossAxisCoord - overflow[maxSide];\n crossAxisCoord = clamp(min, crossAxisCoord, max);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawOffset\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = originSides.has(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n var _state$middlewareData, _state$middlewareData2;\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const noShift = !state.middlewareData.shift;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n const xMin = max(overflow.left, 0);\n const xMax = max(overflow.right, 0);\n const yMin = max(overflow.top, 0);\n const yMax = max(overflow.bottom, 0);\n if (isYAxis) {\n availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));\n } else {\n availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","function hasWindow() {\n return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';\n}\nfunction isTableElement(element) {\n return /^(table|td|th)$/.test(getNodeName(element));\n}\nfunction isTopLayer(element) {\n try {\n if (element.matches(':popover-open')) {\n return true;\n }\n } catch (_e) {\n // no-op\n }\n try {\n return element.matches(':modal');\n } catch (_e) {\n return false;\n }\n}\nconst willChangeRe = /transform|translate|scale|rotate|perspective|filter/;\nconst containRe = /paint|layout|strict|content/;\nconst isNotNone = value => !!value && value !== 'none';\nlet isWebKitValue;\nfunction isContainingBlock(elementOrCss) {\n const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n // https://drafts.csswg.org/css-transforms-2/#individual-transforms\n return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else if (isTopLayer(currentNode)) {\n return null;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (isWebKitValue == null) {\n isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');\n }\n return isWebKitValue;\n}\nfunction isLastTraversableNode(node) {\n return /^(html|body|#document)$/.test(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.scrollX,\n scrollTop: element.scrollY\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return node.ownerDocument ? node.ownerDocument.body : node.body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n const frameElement = getFrameElement(win);\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n } else {\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n }\n}\nfunction getFrameElement(win) {\n return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle$1(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {\n return false;\n }\n return isFixed;\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement) {\n const win = getWindow(domElement);\n const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetParent && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle$1(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If <html> has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll) {\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return Array.from(element.getClientRects());\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(element) {\n const html = getDocumentElement(element);\n const scroll = getNodeScroll(element);\n const body = element.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n const y = -scroll.scrollTop;\n if (getComputedStyle$1(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Safety check: ensure the scrollbar space is reasonable in case this\n// calculation is affected by unusual styles.\n// Most scrollbars leave 15-18px of space.\nconst SCROLLBAR_MAX = 25;\nfunction getViewportRect(element, strategy) {\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n const visualViewportBased = isWebKit();\n if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n const windowScrollbarX = getWindowScrollBarX(html);\n // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the\n // visual width of the <html> but this is not considered in the size\n // of `html.clientWidth`.\n if (windowScrollbarX <= 0) {\n const doc = html.ownerDocument;\n const body = doc.body;\n const bodyStyles = getComputedStyle(body);\n const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;\n const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {\n width -= clippingStableScrollbarWidth;\n }\n } else if (windowScrollbarX <= SCROLLBAR_MAX) {\n // If the <body> scrollbar is on the left, the width needs to be extended\n // by the scrollbar amount so there isn't extra space on the right.\n width += windowScrollbarX;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport') {\n rect = getViewportRect(element, strategy);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\nfunction hasFixedPositionAncestor(element, stopNode) {\n const parentNode = getParentNode(element);\n if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {\n return false;\n }\n return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let currentContainingBlockComputedStyle = null;\n const elementIsFixed = getComputedStyle$1(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle$1(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n if (!currentNodeIsContaining && computedStyle.position === 'fixed') {\n currentContainingBlockComputedStyle = null;\n }\n const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // Record last containing block for next iteration.\n currentContainingBlockComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);\n let top = firstRect.top;\n let right = firstRect.right;\n let bottom = firstRect.bottom;\n let left = firstRect.left;\n for (let i = 1; i < clippingAncestors.length; i++) {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);\n top = max(rect.top, top);\n right = min(rect.right, right);\n bottom = min(rect.bottom, bottom);\n left = max(rect.left, left);\n }\n return {\n width: right - left,\n height: bottom - top,\n x: left,\n y: top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n\n // If the <body> scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n function setLeftRTLScrollbarOffset() {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } else if (documentElement) {\n setLeftRTLScrollbarOffset();\n }\n }\n if (isFixed && !isOffsetParentAnElement && documentElement) {\n setLeftRTLScrollbarOffset();\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle$1(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the <html> element as the offsetParent if it's non-static,\n // while Chrome and Safari return the <body> element. The <body> element must\n // be used to perform the correct calculations even if the <html> element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle$1(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const elementRectForRootMargin = element.getBoundingClientRect();\n const {\n left,\n top,\n width,\n height\n } = elementRectForRootMargin;\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped, the ratio is 0. Throttle the refresh\n // to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n // It's possible that even though the ratio is reported as 1, the\n // element is not actually fully within the IntersectionObserver's root\n // area anymore. This can happen under performance constraints. This may\n // be a bug in the browser's IntersectionObserver implementation. To\n // work around this, we compare the element's bounding rect now with\n // what it was at the time we created the IntersectionObserver. If they\n // are not equal then the element moved, so we refresh.\n refresh();\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle <iframe>s\n root: root.ownerDocument\n });\n } catch (_e) {\n io = new IntersectionObserver(handleObserve, options);\n }\n io.observe(element);\n }\n refresh(true);\n return cleanup;\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n if (options === void 0) {\n options = {};\n }\n const {\n ancestorScroll = true,\n ancestorResize = true,\n elementResize = typeof ResizeObserver === 'function',\n layoutShift = typeof IntersectionObserver === 'function',\n animationFrame = false\n } = options;\n const referenceEl = unwrapElement(reference);\n const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.addEventListener('scroll', update, {\n passive: true\n });\n ancestorResize && ancestor.addEventListener('resize', update);\n });\n const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;\n let reobserveFrame = -1;\n let resizeObserver = null;\n if (elementResize) {\n resizeObserver = new ResizeObserver(_ref => {\n let [firstEntry] = _ref;\n if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {\n // Prevent update loops when using the `size` middleware.\n // https://github.com/floating-ui/floating-ui/issues/1740\n resizeObserver.unobserve(floating);\n cancelAnimationFrame(reobserveFrame);\n reobserveFrame = requestAnimationFrame(() => {\n var _resizeObserver;\n (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n });\n }\n update();\n });\n if (referenceEl && !animationFrame) {\n resizeObserver.observe(referenceEl);\n }\n if (floating) {\n resizeObserver.observe(floating);\n }\n }\n let frameId;\n let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n if (animationFrame) {\n frameLoop();\n }\n function frameLoop() {\n const nextRefRect = getBoundingClientRect(reference);\n if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {\n update();\n }\n prevRefRect = nextRefRect;\n frameId = requestAnimationFrame(frameLoop);\n }\n update();\n return () => {\n var _resizeObserver2;\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.removeEventListener('scroll', update);\n ancestorResize && ancestor.removeEventListener('resize', update);\n });\n cleanupIo == null || cleanupIo();\n (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n resizeObserver = null;\n if (animationFrame) {\n cancelAnimationFrame(frameId);\n }\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n // This caches the expensive `getClippingElementAncestors` function so that\n // multiple lifecycle resets re-use the same result. It only lives for a\n // single call. If other functions become expensive, we can add them as well.\n const cache = new Map();\n const mergedOptions = {\n platform,\n ...options\n };\n const platformWithCache = {\n ...mergedOptions.platform,\n _c: cache\n };\n return computePosition$1(reference, floating, {\n ...mergedOptions,\n platform: platformWithCache\n });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => {\n const result = offset$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => {\n const result = shift$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => {\n const result = limitShift$1(options);\n return {\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => {\n const result = flip$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => {\n const result = size$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => {\n const result = autoPlacement$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => {\n const result = hide$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => {\n const result = inline$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => {\n const result = arrow$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n","// src/arrow.tsx\nimport * as React from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NAME = \"Arrow\";\nvar Arrow = React.forwardRef((props, forwardedRef) => {\n const { children, width = 10, height = 5, ...arrowProps } = props;\n return /* @__PURE__ */ jsx(\n Primitive.svg,\n {\n ...arrowProps,\n ref: forwardedRef,\n width,\n height,\n viewBox: \"0 0 30 10\",\n preserveAspectRatio: \"none\",\n children: props.asChild ? children : /* @__PURE__ */ jsx(\"polygon\", { points: \"0,0 30,0 15,10\" })\n }\n );\n});\nArrow.displayName = NAME;\nvar Root = Arrow;\nexport {\n Arrow,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-size/src/use-size.tsx\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nfunction useSize(element) {\n const [size, setSize] = React.useState(void 0);\n useLayoutEffect(() => {\n if (element) {\n setSize({ width: element.offsetWidth, height: element.offsetHeight });\n const resizeObserver = new ResizeObserver((entries) => {\n if (!Array.isArray(entries)) {\n return;\n }\n if (!entries.length) {\n return;\n }\n const entry = entries[0];\n let width;\n let height;\n if (\"borderBoxSize\" in entry) {\n const borderSizeEntry = entry[\"borderBoxSize\"];\n const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;\n width = borderSize[\"inlineSize\"];\n height = borderSize[\"blockSize\"];\n } else {\n width = element.offsetWidth;\n height = element.offsetHeight;\n }\n setSize({ width, height });\n });\n resizeObserver.observe(element, { box: \"border-box\" });\n return () => resizeObserver.unobserve(element);\n } else {\n setSize(void 0);\n }\n }, [element]);\n return size;\n}\nexport {\n useSize\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/popper.tsx\nimport * as React from \"react\";\nimport {\n useFloating,\n autoUpdate,\n offset,\n shift,\n limitShift,\n hide,\n arrow as floatingUIarrow,\n flip,\n size\n} from \"@floating-ui/react-dom\";\nimport * as ArrowPrimitive from \"@radix-ui/react-arrow\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport { useSize } from \"@radix-ui/react-use-size\";\nimport { jsx } from \"react/jsx-runtime\";\nvar SIDE_OPTIONS = [\"top\", \"right\", \"bottom\", \"left\"];\nvar ALIGN_OPTIONS = [\"start\", \"center\", \"end\"];\nvar POPPER_NAME = \"Popper\";\nvar [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);\nvar [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);\nvar Popper = (props) => {\n const { __scopePopper, children } = props;\n const [anchor, setAnchor] = React.useState(null);\n return /* @__PURE__ */ jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });\n};\nPopper.displayName = POPPER_NAME;\nvar ANCHOR_NAME = \"PopperAnchor\";\nvar PopperAnchor = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopper, virtualRef, ...anchorProps } = props;\n const context = usePopperContext(ANCHOR_NAME, __scopePopper);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const anchorRef = React.useRef(null);\n React.useEffect(() => {\n const previousAnchor = anchorRef.current;\n anchorRef.current = virtualRef?.current || ref.current;\n if (previousAnchor !== anchorRef.current) {\n context.onAnchorChange(anchorRef.current);\n }\n });\n return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });\n }\n);\nPopperAnchor.displayName = ANCHOR_NAME;\nvar CONTENT_NAME = \"PopperContent\";\nvar [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);\nvar PopperContent = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopePopper,\n side = \"bottom\",\n sideOffset = 0,\n align = \"center\",\n alignOffset = 0,\n arrowPadding = 0,\n avoidCollisions = true,\n collisionBoundary = [],\n collisionPadding: collisionPaddingProp = 0,\n sticky = \"partial\",\n hideWhenDetached = false,\n updatePositionStrategy = \"optimized\",\n onPlaced,\n ...contentProps\n } = props;\n const context = usePopperContext(CONTENT_NAME, __scopePopper);\n const [content, setContent] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n const [arrow, setArrow] = React.useState(null);\n const arrowSize = useSize(arrow);\n const arrowWidth = arrowSize?.width ?? 0;\n const arrowHeight = arrowSize?.height ?? 0;\n const desiredPlacement = side + (align !== \"center\" ? \"-\" + align : \"\");\n const collisionPadding = typeof collisionPaddingProp === \"number\" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };\n const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];\n const hasExplicitBoundaries = boundary.length > 0;\n const detectOverflowOptions = {\n padding: collisionPadding,\n boundary: boundary.filter(isNotNull),\n // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries\n altBoundary: hasExplicitBoundaries\n };\n const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({\n // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues\n strategy: \"fixed\",\n placement: desiredPlacement,\n whileElementsMounted: (...args) => {\n const cleanup = autoUpdate(...args, {\n animationFrame: updatePositionStrategy === \"always\"\n });\n return cleanup;\n },\n elements: {\n reference: context.anchor\n },\n middleware: [\n offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),\n avoidCollisions && shift({\n mainAxis: true,\n crossAxis: false,\n limiter: sticky === \"partial\" ? limitShift() : void 0,\n ...detectOverflowOptions\n }),\n avoidCollisions && flip({ ...detectOverflowOptions }),\n size({\n ...detectOverflowOptions,\n apply: ({ elements, rects, availableWidth, availableHeight }) => {\n const { width: anchorWidth, height: anchorHeight } = rects.reference;\n const contentStyle = elements.floating.style;\n contentStyle.setProperty(\"--radix-popper-available-width\", `${availableWidth}px`);\n contentStyle.setProperty(\"--radix-popper-available-height\", `${availableHeight}px`);\n contentStyle.setProperty(\"--radix-popper-anchor-width\", `${anchorWidth}px`);\n contentStyle.setProperty(\"--radix-popper-anchor-height\", `${anchorHeight}px`);\n }\n }),\n arrow && floatingUIarrow({ element: arrow, padding: arrowPadding }),\n transformOrigin({ arrowWidth, arrowHeight }),\n hideWhenDetached && hide({ strategy: \"referenceHidden\", ...detectOverflowOptions })\n ]\n });\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n const handlePlaced = useCallbackRef(onPlaced);\n useLayoutEffect(() => {\n if (isPositioned) {\n handlePlaced?.();\n }\n }, [isPositioned, handlePlaced]);\n const arrowX = middlewareData.arrow?.x;\n const arrowY = middlewareData.arrow?.y;\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\n const [contentZIndex, setContentZIndex] = React.useState();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n return /* @__PURE__ */ jsx(\n \"div\",\n {\n ref: refs.setFloating,\n \"data-radix-popper-content-wrapper\": \"\",\n style: {\n ...floatingStyles,\n transform: isPositioned ? floatingStyles.transform : \"translate(0, -200%)\",\n // keep off the page when measuring\n minWidth: \"max-content\",\n zIndex: contentZIndex,\n [\"--radix-popper-transform-origin\"]: [\n middlewareData.transformOrigin?.x,\n middlewareData.transformOrigin?.y\n ].join(\" \"),\n // hide the content if using the hide middleware and should be hidden\n // set visibility to hidden and disable pointer events so the UI behaves\n // as if the PopperContent isn't there at all\n ...middlewareData.hide?.referenceHidden && {\n visibility: \"hidden\",\n pointerEvents: \"none\"\n }\n },\n dir: props.dir,\n children: /* @__PURE__ */ jsx(\n PopperContentProvider,\n {\n scope: __scopePopper,\n placedSide,\n onArrowChange: setArrow,\n arrowX,\n arrowY,\n shouldHideArrow: cannotCenterArrow,\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-side\": placedSide,\n \"data-align\": placedAlign,\n ...contentProps,\n ref: composedRefs,\n style: {\n ...contentProps.style,\n // if the PopperContent hasn't been placed yet (not all measurements done)\n // we prevent animations so that users's animation don't kick in too early referring wrong sides\n animation: !isPositioned ? \"none\" : void 0\n }\n }\n )\n }\n )\n }\n );\n }\n);\nPopperContent.displayName = CONTENT_NAME;\nvar ARROW_NAME = \"PopperArrow\";\nvar OPPOSITE_SIDE = {\n top: \"bottom\",\n right: \"left\",\n bottom: \"top\",\n left: \"right\"\n};\nvar PopperArrow = React.forwardRef(function PopperArrow2(props, forwardedRef) {\n const { __scopePopper, ...arrowProps } = props;\n const contentContext = useContentContext(ARROW_NAME, __scopePopper);\n const baseSide = OPPOSITE_SIDE[contentContext.placedSide];\n return (\n // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)\n // doesn't report size as we'd expect on SVG elements.\n // it reports their bounding box which is effectively the largest path inside the SVG.\n /* @__PURE__ */ jsx(\n \"span\",\n {\n ref: contentContext.onArrowChange,\n style: {\n position: \"absolute\",\n left: contentContext.arrowX,\n top: contentContext.arrowY,\n [baseSide]: 0,\n transformOrigin: {\n top: \"\",\n right: \"0 0\",\n bottom: \"center 0\",\n left: \"100% 0\"\n }[contentContext.placedSide],\n transform: {\n top: \"translateY(100%)\",\n right: \"translateY(50%) rotate(90deg) translateX(-50%)\",\n bottom: `rotate(180deg)`,\n left: \"translateY(50%) rotate(-90deg) translateX(50%)\"\n }[contentContext.placedSide],\n visibility: contentContext.shouldHideArrow ? \"hidden\" : void 0\n },\n children: /* @__PURE__ */ jsx(\n ArrowPrimitive.Root,\n {\n ...arrowProps,\n ref: forwardedRef,\n style: {\n ...arrowProps.style,\n // ensures the element can be measured correctly (mostly for if SVG)\n display: \"block\"\n }\n }\n )\n }\n )\n );\n});\nPopperArrow.displayName = ARROW_NAME;\nfunction isNotNull(value) {\n return value !== null;\n}\nvar transformOrigin = (options) => ({\n name: \"transformOrigin\",\n options,\n fn(data) {\n const { placement, rects, middlewareData } = data;\n const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;\n const isArrowHidden = cannotCenterArrow;\n const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;\n const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;\n const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);\n const noArrowAlign = { start: \"0%\", center: \"50%\", end: \"100%\" }[placedAlign];\n const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;\n const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;\n let x = \"\";\n let y = \"\";\n if (placedSide === \"bottom\") {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${-arrowHeight}px`;\n } else if (placedSide === \"top\") {\n x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;\n y = `${rects.floating.height + arrowHeight}px`;\n } else if (placedSide === \"right\") {\n x = `${-arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n } else if (placedSide === \"left\") {\n x = `${rects.floating.width + arrowHeight}px`;\n y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;\n }\n return { data: { x, y } };\n }\n});\nfunction getSideAndAlignFromPlacement(placement) {\n const [side, align = \"center\"] = placement.split(\"-\");\n return [side, align];\n}\nvar Root2 = Popper;\nvar Anchor = PopperAnchor;\nvar Content = PopperContent;\nvar Arrow = PopperArrow;\nexport {\n ALIGN_OPTIONS,\n Anchor,\n Arrow,\n Content,\n Popper,\n PopperAnchor,\n PopperArrow,\n PopperContent,\n Root2 as Root,\n SIDE_OPTIONS,\n createPopperScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/portal.tsx\nimport * as React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport { jsx } from \"react/jsx-runtime\";\nvar PORTAL_NAME = \"Portal\";\nvar Portal = React.forwardRef((props, forwardedRef) => {\n const { container: containerProp, ...portalProps } = props;\n const [mounted, setMounted] = React.useState(false);\n useLayoutEffect(() => setMounted(true), []);\n const container = containerProp || mounted && globalThis?.document?.body;\n return container ? ReactDOM.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;\n});\nPortal.displayName = PORTAL_NAME;\nvar Root = Portal;\nexport {\n Portal,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n","// src/use-controllable-state.tsx\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nvar useInsertionEffect = React[\" useInsertionEffect \".trim().toString()] || useLayoutEffect;\nfunction useControllableState({\n prop,\n defaultProp,\n onChange = () => {\n },\n caller\n}) {\n const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({\n defaultProp,\n onChange\n });\n const isControlled = prop !== void 0;\n const value = isControlled ? prop : uncontrolledProp;\n if (true) {\n const isControlledRef = React.useRef(prop !== void 0);\n React.useEffect(() => {\n const wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled) {\n const from = wasControlled ? \"controlled\" : \"uncontrolled\";\n const to = isControlled ? \"controlled\" : \"uncontrolled\";\n console.warn(\n `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled, caller]);\n }\n const setValue = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;\n if (value2 !== prop) {\n onChangeRef.current?.(value2);\n }\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, onChangeRef]\n );\n return [value, setValue];\n}\nfunction useUncontrolledState({\n defaultProp,\n onChange\n}) {\n const [value, setValue] = React.useState(defaultProp);\n const prevValueRef = React.useRef(value);\n const onChangeRef = React.useRef(onChange);\n useInsertionEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n onChangeRef.current?.(value);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef]);\n return [value, setValue, onChangeRef];\n}\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\n\n// src/use-controllable-state-reducer.tsx\nimport * as React2 from \"react\";\nimport { useEffectEvent } from \"@radix-ui/react-use-effect-event\";\nvar SYNC_STATE = Symbol(\"RADIX:SYNC_STATE\");\nfunction useControllableStateReducer(reducer, userArgs, initialArg, init) {\n const { prop: controlledState, defaultProp, onChange: onChangeProp, caller } = userArgs;\n const isControlled = controlledState !== void 0;\n const onChange = useEffectEvent(onChangeProp);\n if (true) {\n const isControlledRef = React2.useRef(controlledState !== void 0);\n React2.useEffect(() => {\n const wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled) {\n const from = wasControlled ? \"controlled\" : \"uncontrolled\";\n const to = isControlled ? \"controlled\" : \"uncontrolled\";\n console.warn(\n `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled, caller]);\n }\n const args = [{ ...initialArg, state: defaultProp }];\n if (init) {\n args.push(init);\n }\n const [internalState, dispatch] = React2.useReducer(\n (state2, action) => {\n if (action.type === SYNC_STATE) {\n return { ...state2, state: action.state };\n }\n const next = reducer(state2, action);\n if (isControlled && !Object.is(next.state, state2.state)) {\n onChange(next.state);\n }\n return next;\n },\n ...args\n );\n const uncontrolledState = internalState.state;\n const prevValueRef = React2.useRef(uncontrolledState);\n React2.useEffect(() => {\n if (prevValueRef.current !== uncontrolledState) {\n prevValueRef.current = uncontrolledState;\n if (!isControlled) {\n onChange(uncontrolledState);\n }\n }\n }, [onChange, uncontrolledState, prevValueRef, isControlled]);\n const state = React2.useMemo(() => {\n const isControlled2 = controlledState !== void 0;\n if (isControlled2) {\n return { ...internalState, state: controlledState };\n }\n return internalState;\n }, [internalState, controlledState]);\n React2.useEffect(() => {\n if (isControlled && !Object.is(controlledState, internalState.state)) {\n dispatch({ type: SYNC_STATE, state: controlledState });\n }\n }, [controlledState, internalState.state, isControlled]);\n return [state, dispatch];\n}\nexport {\n useControllableState,\n useControllableStateReducer\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-previous/src/use-previous.tsx\nimport * as React from \"react\";\nfunction usePrevious(value) {\n const ref = React.useRef({ value, previous: value });\n return React.useMemo(() => {\n if (ref.current.value !== value) {\n ref.current.previous = ref.current.value;\n ref.current.value = value;\n }\n return ref.current.previous;\n }, [value]);\n}\nexport {\n usePrevious\n};\n//# sourceMappingURL=index.mjs.map\n","// src/visually-hidden.tsx\nimport * as React from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { jsx } from \"react/jsx-runtime\";\nvar VISUALLY_HIDDEN_STYLES = Object.freeze({\n // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss\n position: \"absolute\",\n border: 0,\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n wordWrap: \"normal\"\n});\nvar NAME = \"VisuallyHidden\";\nvar VisuallyHidden = React.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(\n Primitive.span,\n {\n ...props,\n ref: forwardedRef,\n style: { ...VISUALLY_HIDDEN_STYLES, ...props.style }\n }\n );\n }\n);\nVisuallyHidden.displayName = NAME;\nvar Root = VisuallyHidden;\nexport {\n Root,\n VISUALLY_HIDDEN_STYLES,\n VisuallyHidden\n};\n//# sourceMappingURL=index.mjs.map\n","var getDefaultParent = function (originalTarget) {\n if (typeof document === 'undefined') {\n return null;\n }\n var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;\n return sampleTarget.ownerDocument.body;\n};\nvar counterMap = new WeakMap();\nvar uncontrolledNodes = new WeakMap();\nvar markerMap = {};\nvar lockCount = 0;\nvar unwrapHost = function (node) {\n return node && (node.host || unwrapHost(node.parentNode));\n};\nvar correctTargets = function (parent, targets) {\n return targets\n .map(function (target) {\n if (parent.contains(target)) {\n return target;\n }\n var correctedTarget = unwrapHost(target);\n if (correctedTarget && parent.contains(correctedTarget)) {\n return correctedTarget;\n }\n console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');\n return null;\n })\n .filter(function (x) { return Boolean(x); });\n};\n/**\n * Marks everything except given node(or nodes) as aria-hidden\n * @param {Element | Element[]} originalTarget - elements to keep on the page\n * @param [parentNode] - top element, defaults to document.body\n * @param {String} [markerName] - a special attribute to mark every node\n * @param {String} [controlAttribute] - html Attribute to control\n * @return {Undo} undo command\n */\nvar applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {\n var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);\n if (!markerMap[markerName]) {\n markerMap[markerName] = new WeakMap();\n }\n var markerCounter = markerMap[markerName];\n var hiddenNodes = [];\n var elementsToKeep = new Set();\n var elementsToStop = new Set(targets);\n var keep = function (el) {\n if (!el || elementsToKeep.has(el)) {\n return;\n }\n elementsToKeep.add(el);\n keep(el.parentNode);\n };\n targets.forEach(keep);\n var deep = function (parent) {\n if (!parent || elementsToStop.has(parent)) {\n return;\n }\n Array.prototype.forEach.call(parent.children, function (node) {\n if (elementsToKeep.has(node)) {\n deep(node);\n }\n else {\n try {\n var attr = node.getAttribute(controlAttribute);\n var alreadyHidden = attr !== null && attr !== 'false';\n var counterValue = (counterMap.get(node) || 0) + 1;\n var markerValue = (markerCounter.get(node) || 0) + 1;\n counterMap.set(node, counterValue);\n markerCounter.set(node, markerValue);\n hiddenNodes.push(node);\n if (counterValue === 1 && alreadyHidden) {\n uncontrolledNodes.set(node, true);\n }\n if (markerValue === 1) {\n node.setAttribute(markerName, 'true');\n }\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, 'true');\n }\n }\n catch (e) {\n console.error('aria-hidden: cannot operate on ', node, e);\n }\n }\n });\n };\n deep(parentNode);\n elementsToKeep.clear();\n lockCount++;\n return function () {\n hiddenNodes.forEach(function (node) {\n var counterValue = counterMap.get(node) - 1;\n var markerValue = markerCounter.get(node) - 1;\n counterMap.set(node, counterValue);\n markerCounter.set(node, markerValue);\n if (!counterValue) {\n if (!uncontrolledNodes.has(node)) {\n node.removeAttribute(controlAttribute);\n }\n uncontrolledNodes.delete(node);\n }\n if (!markerValue) {\n node.removeAttribute(markerName);\n }\n });\n lockCount--;\n if (!lockCount) {\n // clear\n counterMap = new WeakMap();\n counterMap = new WeakMap();\n uncontrolledNodes = new WeakMap();\n markerMap = {};\n }\n };\n};\n/**\n * Marks everything except given node(or nodes) as aria-hidden\n * @param {Element | Element[]} originalTarget - elements to keep on the page\n * @param [parentNode] - top element, defaults to document.body\n * @param {String} [markerName] - a special attribute to mark every node\n * @return {Undo} undo command\n */\nexport var hideOthers = function (originalTarget, parentNode, markerName) {\n if (markerName === void 0) { markerName = 'data-aria-hidden'; }\n var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);\n var activeParentNode = parentNode || getDefaultParent(originalTarget);\n if (!activeParentNode) {\n return function () { return null; };\n }\n // we should not hide aria-live elements - https://github.com/theKashey/aria-hidden/issues/10\n // and script elements, as they have no impact on accessibility.\n targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live], script')));\n return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');\n};\n/**\n * Marks everything except given node(or nodes) as inert\n * @param {Element | Element[]} originalTarget - elements to keep on the page\n * @param [parentNode] - top element, defaults to document.body\n * @param {String} [markerName] - a special attribute to mark every node\n * @return {Undo} undo command\n */\nexport var inertOthers = function (originalTarget, parentNode, markerName) {\n if (markerName === void 0) { markerName = 'data-inert-ed'; }\n var activeParentNode = parentNode || getDefaultParent(originalTarget);\n if (!activeParentNode) {\n return function () { return null; };\n }\n return applyAttributeToOthers(originalTarget, activeParentNode, markerName, 'inert');\n};\n/**\n * @returns if current browser supports inert\n */\nexport var supportsInert = function () {\n return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert');\n};\n/**\n * Automatic function to \"suppress\" DOM elements - _hide_ or _inert_ in the best possible way\n * @param {Element | Element[]} originalTarget - elements to keep on the page\n * @param [parentNode] - top element, defaults to document.body\n * @param {String} [markerName] - a special attribute to mark every node\n * @return {Undo} undo command\n */\nexport var suppressOthers = function (originalTarget, parentNode, markerName) {\n if (markerName === void 0) { markerName = 'data-suppressed'; }\n return (supportsInert() ? inertOthers : hideOthers)(originalTarget, parentNode, markerName);\n};\n","export var zeroRightClassName = 'right-scroll-bar-position';\nexport var fullWidthClassName = 'width-before-scroll-bar';\nexport var noScrollbarsClassName = 'with-scroll-bars-hidden';\n/**\n * Name of a CSS variable containing the amount of \"hidden\" scrollbar\n * ! might be undefined ! use will fallback!\n */\nexport var removedBarSizeVariable = '--removed-body-scroll-bar-size';\n","/**\n * Assigns a value for a given ref, no matter of the ref format\n * @param {RefObject} ref - a callback function or ref object\n * @param value - a new value\n *\n * @see https://github.com/theKashey/use-callback-ref#assignref\n * @example\n * const refObject = useRef();\n * const refFn = (ref) => {....}\n *\n * assignRef(refObject, \"refValue\");\n * assignRef(refFn, \"refValue\");\n */\nexport function assignRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n }\n else if (ref) {\n ref.current = value;\n }\n return ref;\n}\n","import { useState } from 'react';\n/**\n * creates a MutableRef with ref change callback\n * @param initialValue - initial ref value\n * @param {Function} callback - a callback to run when value changes\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n *\n * @see https://reactjs.org/docs/hooks-reference.html#useref\n * @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n * @returns {MutableRefObject}\n */\nexport function useCallbackRef(initialValue, callback) {\n var ref = useState(function () { return ({\n // value\n value: initialValue,\n // last callback\n callback: callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n var last = ref.value;\n if (last !== value) {\n ref.value = value;\n ref.callback(value, last);\n }\n },\n },\n }); })[0];\n // update callback\n ref.callback = callback;\n return ref.facade;\n}\n","import * as React from 'react';\nimport { assignRef } from './assignRef';\nimport { useCallbackRef } from './useRef';\nvar useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\nvar currentValues = new WeakMap();\n/**\n * Merges two or more refs together providing a single interface to set their value\n * @param {RefObject|Ref} refs\n * @returns {MutableRefObject} - a new ref, which translates all changes to {refs}\n *\n * @see {@link mergeRefs} a version without buit-in memoization\n * @see https://github.com/theKashey/use-callback-ref#usemergerefs\n * @example\n * const Component = React.forwardRef((props, ref) => {\n * const ownRef = useRef();\n * const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together\n * return <div ref={domRef}>...</div>\n * }\n */\nexport function useMergeRefs(refs, defaultValue) {\n var callbackRef = useCallbackRef(defaultValue || null, function (newValue) {\n return refs.forEach(function (ref) { return assignRef(ref, newValue); });\n });\n // handle refs changes - added or removed\n useIsomorphicLayoutEffect(function () {\n var oldValue = currentValues.get(callbackRef);\n if (oldValue) {\n var prevRefs_1 = new Set(oldValue);\n var nextRefs_1 = new Set(refs);\n var current_1 = callbackRef.current;\n prevRefs_1.forEach(function (ref) {\n if (!nextRefs_1.has(ref)) {\n assignRef(ref, null);\n }\n });\n nextRefs_1.forEach(function (ref) {\n if (!prevRefs_1.has(ref)) {\n assignRef(ref, current_1);\n }\n });\n }\n currentValues.set(callbackRef, refs);\n }, [refs]);\n return callbackRef;\n}\n","import { __assign } from \"tslib\";\nfunction ItoI(a) {\n return a;\n}\nfunction innerCreateMedium(defaults, middleware) {\n if (middleware === void 0) { middleware = ItoI; }\n var buffer = [];\n var assigned = false;\n var medium = {\n read: function () {\n if (assigned) {\n throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');\n }\n if (buffer.length) {\n return buffer[buffer.length - 1];\n }\n return defaults;\n },\n useMedium: function (data) {\n var item = middleware(data, assigned);\n buffer.push(item);\n return function () {\n buffer = buffer.filter(function (x) { return x !== item; });\n };\n },\n assignSyncMedium: function (cb) {\n assigned = true;\n while (buffer.length) {\n var cbs = buffer;\n buffer = [];\n cbs.forEach(cb);\n }\n buffer = {\n push: function (x) { return cb(x); },\n filter: function () { return buffer; },\n };\n },\n assignMedium: function (cb) {\n assigned = true;\n var pendingQueue = [];\n if (buffer.length) {\n var cbs = buffer;\n buffer = [];\n cbs.forEach(cb);\n pendingQueue = buffer;\n }\n var executeQueue = function () {\n var cbs = pendingQueue;\n pendingQueue = [];\n cbs.forEach(cb);\n };\n var cycle = function () { return Promise.resolve().then(executeQueue); };\n cycle();\n buffer = {\n push: function (x) {\n pendingQueue.push(x);\n cycle();\n },\n filter: function (filter) {\n pendingQueue = pendingQueue.filter(filter);\n return buffer;\n },\n };\n },\n };\n return medium;\n}\nexport function createMedium(defaults, middleware) {\n if (middleware === void 0) { middleware = ItoI; }\n return innerCreateMedium(defaults, middleware);\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function createSidecarMedium(options) {\n if (options === void 0) { options = {}; }\n var medium = innerCreateMedium(null);\n medium.options = __assign({ async: true, ssr: false }, options);\n return medium;\n}\n","import { __assign, __rest } from \"tslib\";\nimport * as React from 'react';\nvar SideCar = function (_a) {\n var sideCar = _a.sideCar, rest = __rest(_a, [\"sideCar\"]);\n if (!sideCar) {\n throw new Error('Sidecar: please provide `sideCar` property to import the right car');\n }\n var Target = sideCar.read();\n if (!Target) {\n throw new Error('Sidecar medium not found');\n }\n return React.createElement(Target, __assign({}, rest));\n};\nSideCar.isSideCarExport = true;\nexport function exportSidecar(medium, exported) {\n medium.useMedium(exported);\n return SideCar;\n}\n","import { createSidecarMedium } from 'use-sidecar';\nexport var effectCar = createSidecarMedium();\n","import { __assign, __rest } from \"tslib\";\nimport * as React from 'react';\nimport { fullWidthClassName, zeroRightClassName } from 'react-remove-scroll-bar/constants';\nimport { useMergeRefs } from 'use-callback-ref';\nimport { effectCar } from './medium';\nvar nothing = function () {\n return;\n};\n/**\n * Removes scrollbar from the page and contain the scroll within the Lock\n */\nvar RemoveScroll = React.forwardRef(function (props, parentRef) {\n var ref = React.useRef(null);\n var _a = React.useState({\n onScrollCapture: nothing,\n onWheelCapture: nothing,\n onTouchMoveCapture: nothing,\n }), callbacks = _a[0], setCallbacks = _a[1];\n var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, gapMode = props.gapMode, rest = __rest(props, [\"forwardProps\", \"children\", \"className\", \"removeScrollBar\", \"enabled\", \"shards\", \"sideCar\", \"noRelative\", \"noIsolation\", \"inert\", \"allowPinchZoom\", \"as\", \"gapMode\"]);\n var SideCar = sideCar;\n var containerRef = useMergeRefs([ref, parentRef]);\n var containerProps = __assign(__assign({}, rest), callbacks);\n return (React.createElement(React.Fragment, null,\n enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noRelative: noRelative, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),\n forwardProps ? (React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));\n});\nRemoveScroll.defaultProps = {\n enabled: true,\n removeScrollBar: true,\n inert: false,\n};\nRemoveScroll.classNames = {\n fullWidth: fullWidthClassName,\n zeroRight: zeroRightClassName,\n};\nexport { RemoveScroll };\n","var currentNonce;\nexport var setNonce = function (nonce) {\n currentNonce = nonce;\n};\nexport var getNonce = function () {\n if (currentNonce) {\n return currentNonce;\n }\n if (typeof __webpack_nonce__ !== 'undefined') {\n return __webpack_nonce__;\n }\n return undefined;\n};\n","import { getNonce } from 'get-nonce';\nfunction makeStyleTag() {\n if (!document)\n return null;\n var tag = document.createElement('style');\n tag.type = 'text/css';\n var nonce = getNonce();\n if (nonce) {\n tag.setAttribute('nonce', nonce);\n }\n return tag;\n}\nfunction injectStyles(tag, css) {\n // @ts-ignore\n if (tag.styleSheet) {\n // @ts-ignore\n tag.styleSheet.cssText = css;\n }\n else {\n tag.appendChild(document.createTextNode(css));\n }\n}\nfunction insertStyleTag(tag) {\n var head = document.head || document.getElementsByTagName('head')[0];\n head.appendChild(tag);\n}\nexport var stylesheetSingleton = function () {\n var counter = 0;\n var stylesheet = null;\n return {\n add: function (style) {\n if (counter == 0) {\n if ((stylesheet = makeStyleTag())) {\n injectStyles(stylesheet, style);\n insertStyleTag(stylesheet);\n }\n }\n counter++;\n },\n remove: function () {\n counter--;\n if (!counter && stylesheet) {\n stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);\n stylesheet = null;\n }\n },\n };\n};\n","import * as React from 'react';\nimport { stylesheetSingleton } from './singleton';\n/**\n * creates a hook to control style singleton\n * @see {@link styleSingleton} for a safer component version\n * @example\n * ```tsx\n * const useStyle = styleHookSingleton();\n * ///\n * useStyle('body { overflow: hidden}');\n */\nexport var styleHookSingleton = function () {\n var sheet = stylesheetSingleton();\n return function (styles, isDynamic) {\n React.useEffect(function () {\n sheet.add(styles);\n return function () {\n sheet.remove();\n };\n }, [styles && isDynamic]);\n };\n};\n","import { styleHookSingleton } from './hook';\n/**\n * create a Component to add styles on demand\n * - styles are added when first instance is mounted\n * - styles are removed when the last instance is unmounted\n * - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior\n */\nexport var styleSingleton = function () {\n var useStyle = styleHookSingleton();\n var Sheet = function (_a) {\n var styles = _a.styles, dynamic = _a.dynamic;\n useStyle(styles, dynamic);\n return null;\n };\n return Sheet;\n};\n","export var zeroGap = {\n left: 0,\n top: 0,\n right: 0,\n gap: 0,\n};\nvar parse = function (x) { return parseInt(x || '', 10) || 0; };\nvar getOffset = function (gapMode) {\n var cs = window.getComputedStyle(document.body);\n var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];\n var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];\n var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];\n return [parse(left), parse(top), parse(right)];\n};\nexport var getGapWidth = function (gapMode) {\n if (gapMode === void 0) { gapMode = 'margin'; }\n if (typeof window === 'undefined') {\n return zeroGap;\n }\n var offsets = getOffset(gapMode);\n var documentWidth = document.documentElement.clientWidth;\n var windowWidth = window.innerWidth;\n return {\n left: offsets[0],\n top: offsets[1],\n right: offsets[2],\n gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),\n };\n};\n","import * as React from 'react';\nimport { styleSingleton } from 'react-style-singleton';\nimport { fullWidthClassName, zeroRightClassName, noScrollbarsClassName, removedBarSizeVariable } from './constants';\nimport { getGapWidth } from './utils';\nvar Style = styleSingleton();\nexport var lockAttribute = 'data-scroll-locked';\n// important tip - once we measure scrollBar width and remove them\n// we could not repeat this operation\n// thus we are using style-singleton - only the first \"yet correct\" style will be applied.\nvar getStyles = function (_a, allowRelative, gapMode, important) {\n var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;\n if (gapMode === void 0) { gapMode = 'margin'; }\n return \"\\n .\".concat(noScrollbarsClassName, \" {\\n overflow: hidden \").concat(important, \";\\n padding-right: \").concat(gap, \"px \").concat(important, \";\\n }\\n body[\").concat(lockAttribute, \"] {\\n overflow: hidden \").concat(important, \";\\n overscroll-behavior: contain;\\n \").concat([\n allowRelative && \"position: relative \".concat(important, \";\"),\n gapMode === 'margin' &&\n \"\\n padding-left: \".concat(left, \"px;\\n padding-top: \").concat(top, \"px;\\n padding-right: \").concat(right, \"px;\\n margin-left:0;\\n margin-top:0;\\n margin-right: \").concat(gap, \"px \").concat(important, \";\\n \"),\n gapMode === 'padding' && \"padding-right: \".concat(gap, \"px \").concat(important, \";\"),\n ]\n .filter(Boolean)\n .join(''), \"\\n }\\n \\n .\").concat(zeroRightClassName, \" {\\n right: \").concat(gap, \"px \").concat(important, \";\\n }\\n \\n .\").concat(fullWidthClassName, \" {\\n margin-right: \").concat(gap, \"px \").concat(important, \";\\n }\\n \\n .\").concat(zeroRightClassName, \" .\").concat(zeroRightClassName, \" {\\n right: 0 \").concat(important, \";\\n }\\n \\n .\").concat(fullWidthClassName, \" .\").concat(fullWidthClassName, \" {\\n margin-right: 0 \").concat(important, \";\\n }\\n \\n body[\").concat(lockAttribute, \"] {\\n \").concat(removedBarSizeVariable, \": \").concat(gap, \"px;\\n }\\n\");\n};\nvar getCurrentUseCounter = function () {\n var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10);\n return isFinite(counter) ? counter : 0;\n};\nexport var useLockAttribute = function () {\n React.useEffect(function () {\n document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());\n return function () {\n var newCounter = getCurrentUseCounter() - 1;\n if (newCounter <= 0) {\n document.body.removeAttribute(lockAttribute);\n }\n else {\n document.body.setAttribute(lockAttribute, newCounter.toString());\n }\n };\n }, []);\n};\n/**\n * Removes page scrollbar and blocks page scroll when mounted\n */\nexport var RemoveScrollBar = function (_a) {\n var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b;\n useLockAttribute();\n /*\n gap will be measured on every component mount\n however it will be used only by the \"first\" invocation\n due to singleton nature of <Style\n */\n var gap = React.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);\n return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });\n};\n","var passiveSupported = false;\nif (typeof window !== 'undefined') {\n try {\n var options = Object.defineProperty({}, 'passive', {\n get: function () {\n passiveSupported = true;\n return true;\n },\n });\n // @ts-ignore\n window.addEventListener('test', options, options);\n // @ts-ignore\n window.removeEventListener('test', options, options);\n }\n catch (err) {\n passiveSupported = false;\n }\n}\nexport var nonPassive = passiveSupported ? { passive: false } : false;\n","var alwaysContainsScroll = function (node) {\n // textarea will always _contain_ scroll inside self. It only can be hidden\n return node.tagName === 'TEXTAREA';\n};\nvar elementCanBeScrolled = function (node, overflow) {\n if (!(node instanceof Element)) {\n return false;\n }\n var styles = window.getComputedStyle(node);\n return (\n // not-not-scrollable\n styles[overflow] !== 'hidden' &&\n // contains scroll inside self\n !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));\n};\nvar elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };\nvar elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };\nexport var locationCouldBeScrolled = function (axis, node) {\n var ownerDocument = node.ownerDocument;\n var current = node;\n do {\n // Skip over shadow root\n if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {\n current = current.host;\n }\n var isScrollable = elementCouldBeScrolled(axis, current);\n if (isScrollable) {\n var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];\n if (scrollHeight > clientHeight) {\n return true;\n }\n }\n current = current.parentNode;\n } while (current && current !== ownerDocument.body);\n return false;\n};\nvar getVScrollVariables = function (_a) {\n var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;\n return [\n scrollTop,\n scrollHeight,\n clientHeight,\n ];\n};\nvar getHScrollVariables = function (_a) {\n var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;\n return [\n scrollLeft,\n scrollWidth,\n clientWidth,\n ];\n};\nvar elementCouldBeScrolled = function (axis, node) {\n return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);\n};\nvar getScrollVariables = function (axis, node) {\n return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);\n};\nvar getDirectionFactor = function (axis, direction) {\n /**\n * If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,\n * and then increasingly negative as you scroll towards the end of the content.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft\n */\n return axis === 'h' && direction === 'rtl' ? -1 : 1;\n};\nexport var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {\n var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);\n var delta = directionFactor * sourceDelta;\n // find scrollable target\n var target = event.target;\n var targetInLock = endTarget.contains(target);\n var shouldCancelScroll = false;\n var isDeltaPositive = delta > 0;\n var availableScroll = 0;\n var availableScrollTop = 0;\n do {\n if (!target) {\n break;\n }\n var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];\n var elementScroll = scroll_1 - capacity - directionFactor * position;\n if (position || elementScroll) {\n if (elementCouldBeScrolled(axis, target)) {\n availableScroll += elementScroll;\n availableScrollTop += position;\n }\n }\n var parent_1 = target.parentNode;\n // we will \"bubble\" from ShadowDom in case we are, or just to the parent in normal case\n // this is the same logic used in focus-lock\n target = (parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1);\n } while (\n // portaled content\n (!targetInLock && target !== document.body) ||\n // self content\n (targetInLock && (endTarget.contains(target) || endTarget === target)));\n // handle epsilon around 0 (non standard zoom levels)\n if (isDeltaPositive &&\n ((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))) {\n shouldCancelScroll = true;\n }\n else if (!isDeltaPositive &&\n ((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))) {\n shouldCancelScroll = true;\n }\n return shouldCancelScroll;\n};\n","import { __spreadArray } from \"tslib\";\nimport * as React from 'react';\nimport { RemoveScrollBar } from 'react-remove-scroll-bar';\nimport { styleSingleton } from 'react-style-singleton';\nimport { nonPassive } from './aggresiveCapture';\nimport { handleScroll, locationCouldBeScrolled } from './handleScroll';\nexport var getTouchXY = function (event) {\n return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];\n};\nexport var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };\nvar extractRef = function (ref) {\n return ref && 'current' in ref ? ref.current : ref;\n};\nvar deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };\nvar generateStyle = function (id) { return \"\\n .block-interactivity-\".concat(id, \" {pointer-events: none;}\\n .allow-interactivity-\").concat(id, \" {pointer-events: all;}\\n\"); };\nvar idCounter = 0;\nvar lockStack = [];\nexport function RemoveScrollSideCar(props) {\n var shouldPreventQueue = React.useRef([]);\n var touchStartRef = React.useRef([0, 0]);\n var activeAxis = React.useRef();\n var id = React.useState(idCounter++)[0];\n var Style = React.useState(styleSingleton)[0];\n var lastProps = React.useRef(props);\n React.useEffect(function () {\n lastProps.current = props;\n }, [props]);\n React.useEffect(function () {\n if (props.inert) {\n document.body.classList.add(\"block-interactivity-\".concat(id));\n var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);\n allow_1.forEach(function (el) { return el.classList.add(\"allow-interactivity-\".concat(id)); });\n return function () {\n document.body.classList.remove(\"block-interactivity-\".concat(id));\n allow_1.forEach(function (el) { return el.classList.remove(\"allow-interactivity-\".concat(id)); });\n };\n }\n return;\n }, [props.inert, props.lockRef.current, props.shards]);\n var shouldCancelEvent = React.useCallback(function (event, parent) {\n if (('touches' in event && event.touches.length === 2) || (event.type === 'wheel' && event.ctrlKey)) {\n return !lastProps.current.allowPinchZoom;\n }\n var touch = getTouchXY(event);\n var touchStart = touchStartRef.current;\n var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];\n var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];\n var currentAxis;\n var target = event.target;\n var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';\n // allow horizontal touch move on Range inputs. They will not cause any scroll\n if ('touches' in event && moveDirection === 'h' && target.type === 'range') {\n return false;\n }\n // allow drag selection (iOS); check if selection's anchorNode is the same as target or contains target\n var selection = window.getSelection();\n var anchorNode = selection && selection.anchorNode;\n var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;\n if (isTouchingSelection) {\n return false;\n }\n var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);\n if (!canBeScrolledInMainDirection) {\n return true;\n }\n if (canBeScrolledInMainDirection) {\n currentAxis = moveDirection;\n }\n else {\n currentAxis = moveDirection === 'v' ? 'h' : 'v';\n canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);\n // other axis might be not scrollable\n }\n if (!canBeScrolledInMainDirection) {\n return false;\n }\n if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {\n activeAxis.current = currentAxis;\n }\n if (!currentAxis) {\n return true;\n }\n var cancelingAxis = activeAxis.current || currentAxis;\n return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);\n }, []);\n var shouldPrevent = React.useCallback(function (_event) {\n var event = _event;\n if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {\n // not the last active\n return;\n }\n var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);\n var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); })[0];\n // self event, and should be canceled\n if (sourceEvent && sourceEvent.should) {\n if (event.cancelable) {\n event.preventDefault();\n }\n return;\n }\n // outside or shard event\n if (!sourceEvent) {\n var shardNodes = (lastProps.current.shards || [])\n .map(extractRef)\n .filter(Boolean)\n .filter(function (node) { return node.contains(event.target); });\n var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;\n if (shouldStop) {\n if (event.cancelable) {\n event.preventDefault();\n }\n }\n }\n }, []);\n var shouldCancel = React.useCallback(function (name, delta, target, should) {\n var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };\n shouldPreventQueue.current.push(event);\n setTimeout(function () {\n shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });\n }, 1);\n }, []);\n var scrollTouchStart = React.useCallback(function (event) {\n touchStartRef.current = getTouchXY(event);\n activeAxis.current = undefined;\n }, []);\n var scrollWheel = React.useCallback(function (event) {\n shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));\n }, []);\n var scrollTouchMove = React.useCallback(function (event) {\n shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));\n }, []);\n React.useEffect(function () {\n lockStack.push(Style);\n props.setCallbacks({\n onScrollCapture: scrollWheel,\n onWheelCapture: scrollWheel,\n onTouchMoveCapture: scrollTouchMove,\n });\n document.addEventListener('wheel', shouldPrevent, nonPassive);\n document.addEventListener('touchmove', shouldPrevent, nonPassive);\n document.addEventListener('touchstart', scrollTouchStart, nonPassive);\n return function () {\n lockStack = lockStack.filter(function (inst) { return inst !== Style; });\n document.removeEventListener('wheel', shouldPrevent, nonPassive);\n document.removeEventListener('touchmove', shouldPrevent, nonPassive);\n document.removeEventListener('touchstart', scrollTouchStart, nonPassive);\n };\n }, []);\n var removeScrollBar = props.removeScrollBar, inert = props.inert;\n return (React.createElement(React.Fragment, null,\n inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,\n removeScrollBar ? React.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null));\n}\nfunction getOutermostShadowParent(node) {\n var shadowParent = null;\n while (node !== null) {\n if (node instanceof ShadowRoot) {\n shadowParent = node.host;\n node = node.host;\n }\n node = node.parentNode;\n }\n return shadowParent;\n}\n","import { exportSidecar } from 'use-sidecar';\nimport { RemoveScrollSideCar } from './SideEffect';\nimport { effectCar } from './medium';\nexport default exportSidecar(effectCar, RemoveScrollSideCar);\n","import { __assign } from \"tslib\";\nimport * as React from 'react';\nimport { RemoveScroll } from './UI';\nimport SideCar from './sidecar';\nvar ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });\nReactRemoveScroll.classNames = RemoveScroll.classNames;\nexport default ReactRemoveScroll;\n","\"use client\";\n\n// src/select.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { clamp } from \"@radix-ui/number\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\";\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useId } from \"@radix-ui/react-id\";\nimport * as PopperPrimitive from \"@radix-ui/react-popper\";\nimport { createPopperScope } from \"@radix-ui/react-popper\";\nimport { Portal as PortalPrimitive } from \"@radix-ui/react-portal\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport { usePrevious } from \"@radix-ui/react-use-previous\";\nimport { VISUALLY_HIDDEN_STYLES } from \"@radix-ui/react-visually-hidden\";\nimport { hideOthers } from \"aria-hidden\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nvar OPEN_KEYS = [\" \", \"Enter\", \"ArrowUp\", \"ArrowDown\"];\nvar SELECTION_KEYS = [\" \", \"Enter\"];\nvar SELECT_NAME = \"Select\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME);\nvar [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [\n createCollectionScope,\n createPopperScope\n]);\nvar usePopperScope = createPopperScope();\nvar [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);\nvar [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME);\nvar Select = (props) => {\n const {\n __scopeSelect,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n dir,\n name,\n autoComplete,\n disabled,\n required,\n form\n } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const [trigger, setTrigger] = React.useState(null);\n const [valueNode, setValueNode] = React.useState(null);\n const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);\n const direction = useDirection(dir);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: SELECT_NAME\n });\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n caller: SELECT_NAME\n });\n const triggerPointerDownPosRef = React.useRef(null);\n const isFormControl = trigger ? form || !!trigger.closest(\"form\") : true;\n const [nativeOptionsSet, setNativeOptionsSet] = React.useState(/* @__PURE__ */ new Set());\n const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(\";\");\n return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsxs(\n SelectProvider,\n {\n required,\n scope: __scopeSelect,\n trigger,\n onTriggerChange: setTrigger,\n valueNode,\n onValueNodeChange: setValueNode,\n valueNodeHasChildren,\n onValueNodeHasChildrenChange: setValueNodeHasChildren,\n contentId: useId(),\n value,\n onValueChange: setValue,\n open,\n onOpenChange: setOpen,\n dir: direction,\n triggerPointerDownPosRef,\n disabled,\n children: [\n /* @__PURE__ */ jsx(Collection.Provider, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(\n SelectNativeOptionsProvider,\n {\n scope: props.__scopeSelect,\n onNativeOptionAdd: React.useCallback((option) => {\n setNativeOptionsSet((prev) => new Set(prev).add(option));\n }, []),\n onNativeOptionRemove: React.useCallback((option) => {\n setNativeOptionsSet((prev) => {\n const optionsSet = new Set(prev);\n optionsSet.delete(option);\n return optionsSet;\n });\n }, []),\n children\n }\n ) }),\n isFormControl ? /* @__PURE__ */ jsxs(\n SelectBubbleInput,\n {\n \"aria-hidden\": true,\n required,\n tabIndex: -1,\n name,\n autoComplete,\n value,\n onChange: (event) => setValue(event.target.value),\n disabled,\n form,\n children: [\n value === void 0 ? /* @__PURE__ */ jsx(\"option\", { value: \"\" }) : null,\n Array.from(nativeOptionsSet)\n ]\n },\n nativeSelectKey\n ) : null\n ]\n }\n ) });\n};\nSelect.displayName = SELECT_NAME;\nvar TRIGGER_NAME = \"SelectTrigger\";\nvar SelectTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, disabled = false, ...triggerProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const context = useSelectContext(TRIGGER_NAME, __scopeSelect);\n const isDisabled = context.disabled || disabled;\n const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);\n const getItems = useCollection(__scopeSelect);\n const pointerTypeRef = React.useRef(\"touch\");\n const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {\n const enabledItems = getItems().filter((item) => !item.disabled);\n const currentItem = enabledItems.find((item) => item.value === context.value);\n const nextItem = findNextItem(enabledItems, search, currentItem);\n if (nextItem !== void 0) {\n context.onValueChange(nextItem.value);\n }\n });\n const handleOpen = (pointerEvent) => {\n if (!isDisabled) {\n context.onOpenChange(true);\n resetTypeahead();\n }\n if (pointerEvent) {\n context.triggerPointerDownPosRef.current = {\n x: Math.round(pointerEvent.pageX),\n y: Math.round(pointerEvent.pageY)\n };\n }\n };\n return /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n role: \"combobox\",\n \"aria-controls\": context.contentId,\n \"aria-expanded\": context.open,\n \"aria-required\": context.required,\n \"aria-autocomplete\": \"none\",\n dir: context.dir,\n \"data-state\": context.open ? \"open\" : \"closed\",\n disabled: isDisabled,\n \"data-disabled\": isDisabled ? \"\" : void 0,\n \"data-placeholder\": shouldShowPlaceholder(context.value) ? \"\" : void 0,\n ...triggerProps,\n ref: composedRefs,\n onClick: composeEventHandlers(triggerProps.onClick, (event) => {\n event.currentTarget.focus();\n if (pointerTypeRef.current !== \"mouse\") {\n handleOpen(event);\n }\n }),\n onPointerDown: composeEventHandlers(triggerProps.onPointerDown, (event) => {\n pointerTypeRef.current = event.pointerType;\n const target = event.target;\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n if (event.button === 0 && event.ctrlKey === false && event.pointerType === \"mouse\") {\n handleOpen(event);\n event.preventDefault();\n }\n }),\n onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {\n const isTypingAhead = searchRef.current !== \"\";\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);\n if (isTypingAhead && event.key === \" \") return;\n if (OPEN_KEYS.includes(event.key)) {\n handleOpen();\n event.preventDefault();\n }\n })\n }\n ) });\n }\n);\nSelectTrigger.displayName = TRIGGER_NAME;\nvar VALUE_NAME = \"SelectValue\";\nvar SelectValue = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, className, style, children, placeholder = \"\", ...valueProps } = props;\n const context = useSelectContext(VALUE_NAME, __scopeSelect);\n const { onValueNodeHasChildrenChange } = context;\n const hasChildren = children !== void 0;\n const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);\n useLayoutEffect(() => {\n onValueNodeHasChildrenChange(hasChildren);\n }, [onValueNodeHasChildrenChange, hasChildren]);\n return /* @__PURE__ */ jsx(\n Primitive.span,\n {\n ...valueProps,\n ref: composedRefs,\n style: { pointerEvents: \"none\" },\n children: shouldShowPlaceholder(context.value) ? /* @__PURE__ */ jsx(Fragment, { children: placeholder }) : children\n }\n );\n }\n);\nSelectValue.displayName = VALUE_NAME;\nvar ICON_NAME = \"SelectIcon\";\nvar SelectIcon = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, children, ...iconProps } = props;\n return /* @__PURE__ */ jsx(Primitive.span, { \"aria-hidden\": true, ...iconProps, ref: forwardedRef, children: children || \"\\u25BC\" });\n }\n);\nSelectIcon.displayName = ICON_NAME;\nvar PORTAL_NAME = \"SelectPortal\";\nvar SelectPortal = (props) => {\n return /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, ...props });\n};\nSelectPortal.displayName = PORTAL_NAME;\nvar CONTENT_NAME = \"SelectContent\";\nvar SelectContent = React.forwardRef(\n (props, forwardedRef) => {\n const context = useSelectContext(CONTENT_NAME, props.__scopeSelect);\n const [fragment, setFragment] = React.useState();\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n if (!context.open) {\n const frag = fragment;\n return frag ? ReactDOM.createPortal(\n /* @__PURE__ */ jsx(SelectContentProvider, { scope: props.__scopeSelect, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeSelect, children: /* @__PURE__ */ jsx(\"div\", { children: props.children }) }) }),\n frag\n ) : null;\n }\n return /* @__PURE__ */ jsx(SelectContentImpl, { ...props, ref: forwardedRef });\n }\n);\nSelectContent.displayName = CONTENT_NAME;\nvar CONTENT_MARGIN = 10;\nvar [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME);\nvar CONTENT_IMPL_NAME = \"SelectContentImpl\";\nvar Slot = createSlot(\"SelectContent.RemoveScroll\");\nvar SelectContentImpl = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeSelect,\n position = \"item-aligned\",\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n //\n // PopperContent props\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n //\n ...contentProps\n } = props;\n const context = useSelectContext(CONTENT_NAME, __scopeSelect);\n const [content, setContent] = React.useState(null);\n const [viewport, setViewport] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n const [selectedItem, setSelectedItem] = React.useState(null);\n const [selectedItemText, setSelectedItemText] = React.useState(\n null\n );\n const getItems = useCollection(__scopeSelect);\n const [isPositioned, setIsPositioned] = React.useState(false);\n const firstValidItemFoundRef = React.useRef(false);\n React.useEffect(() => {\n if (content) return hideOthers(content);\n }, [content]);\n useFocusGuards();\n const focusFirst = React.useCallback(\n (candidates) => {\n const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);\n const [lastItem] = restItems.slice(-1);\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate?.scrollIntoView({ block: \"nearest\" });\n if (candidate === firstItem && viewport) viewport.scrollTop = 0;\n if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;\n candidate?.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n },\n [getItems, viewport]\n );\n const focusSelectedItem = React.useCallback(\n () => focusFirst([selectedItem, content]),\n [focusFirst, selectedItem, content]\n );\n React.useEffect(() => {\n if (isPositioned) {\n focusSelectedItem();\n }\n }, [isPositioned, focusSelectedItem]);\n const { onOpenChange, triggerPointerDownPosRef } = context;\n React.useEffect(() => {\n if (content) {\n let pointerMoveDelta = { x: 0, y: 0 };\n const handlePointerMove = (event) => {\n pointerMoveDelta = {\n x: Math.abs(Math.round(event.pageX) - (triggerPointerDownPosRef.current?.x ?? 0)),\n y: Math.abs(Math.round(event.pageY) - (triggerPointerDownPosRef.current?.y ?? 0))\n };\n };\n const handlePointerUp = (event) => {\n if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) {\n event.preventDefault();\n } else {\n if (!content.contains(event.target)) {\n onOpenChange(false);\n }\n }\n document.removeEventListener(\"pointermove\", handlePointerMove);\n triggerPointerDownPosRef.current = null;\n };\n if (triggerPointerDownPosRef.current !== null) {\n document.addEventListener(\"pointermove\", handlePointerMove);\n document.addEventListener(\"pointerup\", handlePointerUp, { capture: true, once: true });\n }\n return () => {\n document.removeEventListener(\"pointermove\", handlePointerMove);\n document.removeEventListener(\"pointerup\", handlePointerUp, { capture: true });\n };\n }\n }, [content, onOpenChange, triggerPointerDownPosRef]);\n React.useEffect(() => {\n const close = () => onOpenChange(false);\n window.addEventListener(\"blur\", close);\n window.addEventListener(\"resize\", close);\n return () => {\n window.removeEventListener(\"blur\", close);\n window.removeEventListener(\"resize\", close);\n };\n }, [onOpenChange]);\n const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => {\n const enabledItems = getItems().filter((item) => !item.disabled);\n const currentItem = enabledItems.find((item) => item.ref.current === document.activeElement);\n const nextItem = findNextItem(enabledItems, search, currentItem);\n if (nextItem) {\n setTimeout(() => nextItem.ref.current.focus());\n }\n });\n const itemRefCallback = React.useCallback(\n (node, value, disabled) => {\n const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;\n const isSelectedItem = context.value !== void 0 && context.value === value;\n if (isSelectedItem || isFirstValidItem) {\n setSelectedItem(node);\n if (isFirstValidItem) firstValidItemFoundRef.current = true;\n }\n },\n [context.value]\n );\n const handleItemLeave = React.useCallback(() => content?.focus(), [content]);\n const itemTextRefCallback = React.useCallback(\n (node, value, disabled) => {\n const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;\n const isSelectedItem = context.value !== void 0 && context.value === value;\n if (isSelectedItem || isFirstValidItem) {\n setSelectedItemText(node);\n }\n },\n [context.value]\n );\n const SelectPosition = position === \"popper\" ? SelectPopperPosition : SelectItemAlignedPosition;\n const popperContentProps = SelectPosition === SelectPopperPosition ? {\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions\n } : {};\n return /* @__PURE__ */ jsx(\n SelectContentProvider,\n {\n scope: __scopeSelect,\n content,\n viewport,\n onViewportChange: setViewport,\n itemRefCallback,\n selectedItem,\n onItemLeave: handleItemLeave,\n itemTextRefCallback,\n focusSelectedItem,\n selectedItemText,\n position,\n isPositioned,\n searchRef,\n children: /* @__PURE__ */ jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx(\n FocusScope,\n {\n asChild: true,\n trapped: context.open,\n onMountAutoFocus: (event) => {\n event.preventDefault();\n },\n onUnmountAutoFocus: composeEventHandlers(onCloseAutoFocus, (event) => {\n context.trigger?.focus({ preventScroll: true });\n event.preventDefault();\n }),\n children: /* @__PURE__ */ jsx(\n DismissableLayer,\n {\n asChild: true,\n disableOutsidePointerEvents: true,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside: (event) => event.preventDefault(),\n onDismiss: () => context.onOpenChange(false),\n children: /* @__PURE__ */ jsx(\n SelectPosition,\n {\n role: \"listbox\",\n id: context.contentId,\n \"data-state\": context.open ? \"open\" : \"closed\",\n dir: context.dir,\n onContextMenu: (event) => event.preventDefault(),\n ...contentProps,\n ...popperContentProps,\n onPlaced: () => setIsPositioned(true),\n ref: composedRefs,\n style: {\n // flex layout so we can place the scroll buttons properly\n display: \"flex\",\n flexDirection: \"column\",\n // reset the outline by default as the content MAY get focused\n outline: \"none\",\n ...contentProps.style\n },\n onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (event.key === \"Tab\") event.preventDefault();\n if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);\n if ([\"ArrowUp\", \"ArrowDown\", \"Home\", \"End\"].includes(event.key)) {\n const items = getItems().filter((item) => !item.disabled);\n let candidateNodes = items.map((item) => item.ref.current);\n if ([\"ArrowUp\", \"End\"].includes(event.key)) {\n candidateNodes = candidateNodes.slice().reverse();\n }\n if ([\"ArrowUp\", \"ArrowDown\"].includes(event.key)) {\n const currentElement = event.target;\n const currentIndex = candidateNodes.indexOf(currentElement);\n candidateNodes = candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n event.preventDefault();\n }\n })\n }\n )\n }\n )\n }\n ) })\n }\n );\n }\n);\nSelectContentImpl.displayName = CONTENT_IMPL_NAME;\nvar ITEM_ALIGNED_POSITION_NAME = \"SelectItemAlignedPosition\";\nvar SelectItemAlignedPosition = React.forwardRef((props, forwardedRef) => {\n const { __scopeSelect, onPlaced, ...popperProps } = props;\n const context = useSelectContext(CONTENT_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(CONTENT_NAME, __scopeSelect);\n const [contentWrapper, setContentWrapper] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n const getItems = useCollection(__scopeSelect);\n const shouldExpandOnScrollRef = React.useRef(false);\n const shouldRepositionRef = React.useRef(true);\n const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;\n const position = React.useCallback(() => {\n if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {\n const triggerRect = context.trigger.getBoundingClientRect();\n const contentRect = content.getBoundingClientRect();\n const valueNodeRect = context.valueNode.getBoundingClientRect();\n const itemTextRect = selectedItemText.getBoundingClientRect();\n if (context.dir !== \"rtl\") {\n const itemTextOffset = itemTextRect.left - contentRect.left;\n const left = valueNodeRect.left - itemTextOffset;\n const leftDelta = triggerRect.left - left;\n const minContentWidth = triggerRect.width + leftDelta;\n const contentWidth = Math.max(minContentWidth, contentRect.width);\n const rightEdge = window.innerWidth - CONTENT_MARGIN;\n const clampedLeft = clamp(left, [\n CONTENT_MARGIN,\n // Prevents the content from going off the starting edge of the\n // viewport. It may still go off the ending edge, but this can be\n // controlled by the user since they may want to manage overflow in a\n // specific way.\n // https://github.com/radix-ui/primitives/issues/2049\n Math.max(CONTENT_MARGIN, rightEdge - contentWidth)\n ]);\n contentWrapper.style.minWidth = minContentWidth + \"px\";\n contentWrapper.style.left = clampedLeft + \"px\";\n } else {\n const itemTextOffset = contentRect.right - itemTextRect.right;\n const right = window.innerWidth - valueNodeRect.right - itemTextOffset;\n const rightDelta = window.innerWidth - triggerRect.right - right;\n const minContentWidth = triggerRect.width + rightDelta;\n const contentWidth = Math.max(minContentWidth, contentRect.width);\n const leftEdge = window.innerWidth - CONTENT_MARGIN;\n const clampedRight = clamp(right, [\n CONTENT_MARGIN,\n Math.max(CONTENT_MARGIN, leftEdge - contentWidth)\n ]);\n contentWrapper.style.minWidth = minContentWidth + \"px\";\n contentWrapper.style.right = clampedRight + \"px\";\n }\n const items = getItems();\n const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;\n const itemsHeight = viewport.scrollHeight;\n const contentStyles = window.getComputedStyle(content);\n const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);\n const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);\n const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);\n const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);\n const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth;\n const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);\n const viewportStyles = window.getComputedStyle(viewport);\n const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);\n const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);\n const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;\n const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;\n const selectedItemHalfHeight = selectedItem.offsetHeight / 2;\n const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;\n const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;\n const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;\n const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;\n if (willAlignWithoutTopOverflow) {\n const isLastItem = items.length > 0 && selectedItem === items[items.length - 1].ref.current;\n contentWrapper.style.bottom = \"0px\";\n const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;\n const clampedTriggerMiddleToBottomEdge = Math.max(\n triggerMiddleToBottomEdge,\n selectedItemHalfHeight + // viewport might have padding bottom, include it to avoid a scrollable viewport\n (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth\n );\n const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;\n contentWrapper.style.height = height + \"px\";\n } else {\n const isFirstItem = items.length > 0 && selectedItem === items[0].ref.current;\n contentWrapper.style.top = \"0px\";\n const clampedTopEdgeToTriggerMiddle = Math.max(\n topEdgeToTriggerMiddle,\n contentBorderTopWidth + viewport.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport\n (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight\n );\n const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;\n contentWrapper.style.height = height + \"px\";\n viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;\n }\n contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`;\n contentWrapper.style.minHeight = minContentHeight + \"px\";\n contentWrapper.style.maxHeight = availableHeight + \"px\";\n onPlaced?.();\n requestAnimationFrame(() => shouldExpandOnScrollRef.current = true);\n }\n }, [\n getItems,\n context.trigger,\n context.valueNode,\n contentWrapper,\n content,\n viewport,\n selectedItem,\n selectedItemText,\n context.dir,\n onPlaced\n ]);\n useLayoutEffect(() => position(), [position]);\n const [contentZIndex, setContentZIndex] = React.useState();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n const handleScrollButtonChange = React.useCallback(\n (node) => {\n if (node && shouldRepositionRef.current === true) {\n position();\n focusSelectedItem?.();\n shouldRepositionRef.current = false;\n }\n },\n [position, focusSelectedItem]\n );\n return /* @__PURE__ */ jsx(\n SelectViewportProvider,\n {\n scope: __scopeSelect,\n contentWrapper,\n shouldExpandOnScrollRef,\n onScrollButtonChange: handleScrollButtonChange,\n children: /* @__PURE__ */ jsx(\n \"div\",\n {\n ref: setContentWrapper,\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n position: \"fixed\",\n zIndex: contentZIndex\n },\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...popperProps,\n ref: composedRefs,\n style: {\n // When we get the height of the content, it includes borders. If we were to set\n // the height without having `boxSizing: 'border-box'` it would be too big.\n boxSizing: \"border-box\",\n // We need to ensure the content doesn't get taller than the wrapper\n maxHeight: \"100%\",\n ...popperProps.style\n }\n }\n )\n }\n )\n }\n );\n});\nSelectItemAlignedPosition.displayName = ITEM_ALIGNED_POSITION_NAME;\nvar POPPER_POSITION_NAME = \"SelectPopperPosition\";\nvar SelectPopperPosition = React.forwardRef((props, forwardedRef) => {\n const {\n __scopeSelect,\n align = \"start\",\n collisionPadding = CONTENT_MARGIN,\n ...popperProps\n } = props;\n const popperScope = usePopperScope(__scopeSelect);\n return /* @__PURE__ */ jsx(\n PopperPrimitive.Content,\n {\n ...popperScope,\n ...popperProps,\n ref: forwardedRef,\n align,\n collisionPadding,\n style: {\n // Ensure border-box for floating-ui calculations\n boxSizing: \"border-box\",\n ...popperProps.style,\n // re-namespace exposed content custom properties\n ...{\n \"--radix-select-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"--radix-select-content-available-width\": \"var(--radix-popper-available-width)\",\n \"--radix-select-content-available-height\": \"var(--radix-popper-available-height)\",\n \"--radix-select-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"--radix-select-trigger-height\": \"var(--radix-popper-anchor-height)\"\n }\n }\n }\n );\n});\nSelectPopperPosition.displayName = POPPER_POSITION_NAME;\nvar [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME, {});\nvar VIEWPORT_NAME = \"SelectViewport\";\nvar SelectViewport = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, nonce, ...viewportProps } = props;\n const contentContext = useSelectContentContext(VIEWPORT_NAME, __scopeSelect);\n const viewportContext = useSelectViewportContext(VIEWPORT_NAME, __scopeSelect);\n const composedRefs = useComposedRefs(forwardedRef, contentContext.onViewportChange);\n const prevScrollTopRef = React.useRef(0);\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n \"style\",\n {\n dangerouslySetInnerHTML: {\n __html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`\n },\n nonce\n }\n ),\n /* @__PURE__ */ jsx(Collection.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-radix-select-viewport\": \"\",\n role: \"presentation\",\n ...viewportProps,\n ref: composedRefs,\n style: {\n // we use position: 'relative' here on the `viewport` so that when we call\n // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport\n // (independent of the scrollUpButton).\n position: \"relative\",\n flex: 1,\n // Viewport should only be scrollable in the vertical direction.\n // This won't work in vertical writing modes, so we'll need to\n // revisit this if/when that is supported\n // https://developer.chrome.com/blog/vertical-form-controls\n overflow: \"hidden auto\",\n ...viewportProps.style\n },\n onScroll: composeEventHandlers(viewportProps.onScroll, (event) => {\n const viewport = event.currentTarget;\n const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;\n if (shouldExpandOnScrollRef?.current && contentWrapper) {\n const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);\n if (scrolledBy > 0) {\n const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;\n const cssMinHeight = parseFloat(contentWrapper.style.minHeight);\n const cssHeight = parseFloat(contentWrapper.style.height);\n const prevHeight = Math.max(cssMinHeight, cssHeight);\n if (prevHeight < availableHeight) {\n const nextHeight = prevHeight + scrolledBy;\n const clampedNextHeight = Math.min(availableHeight, nextHeight);\n const heightDiff = nextHeight - clampedNextHeight;\n contentWrapper.style.height = clampedNextHeight + \"px\";\n if (contentWrapper.style.bottom === \"0px\") {\n viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;\n contentWrapper.style.justifyContent = \"flex-end\";\n }\n }\n }\n }\n prevScrollTopRef.current = viewport.scrollTop;\n })\n }\n ) })\n ] });\n }\n);\nSelectViewport.displayName = VIEWPORT_NAME;\nvar GROUP_NAME = \"SelectGroup\";\nvar [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME);\nvar SelectGroup = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, ...groupProps } = props;\n const groupId = useId();\n return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive.div, { role: \"group\", \"aria-labelledby\": groupId, ...groupProps, ref: forwardedRef }) });\n }\n);\nSelectGroup.displayName = GROUP_NAME;\nvar LABEL_NAME = \"SelectLabel\";\nvar SelectLabel = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, ...labelProps } = props;\n const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);\n return /* @__PURE__ */ jsx(Primitive.div, { id: groupContext.id, ...labelProps, ref: forwardedRef });\n }\n);\nSelectLabel.displayName = LABEL_NAME;\nvar ITEM_NAME = \"SelectItem\";\nvar [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);\nvar SelectItem = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeSelect,\n value,\n disabled = false,\n textValue: textValueProp,\n ...itemProps\n } = props;\n const context = useSelectContext(ITEM_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect);\n const isSelected = context.value === value;\n const [textValue, setTextValue] = React.useState(textValueProp ?? \"\");\n const [isFocused, setIsFocused] = React.useState(false);\n const composedRefs = useComposedRefs(\n forwardedRef,\n (node) => contentContext.itemRefCallback?.(node, value, disabled)\n );\n const textId = useId();\n const pointerTypeRef = React.useRef(\"touch\");\n const handleSelect = () => {\n if (!disabled) {\n context.onValueChange(value);\n context.onOpenChange(false);\n }\n };\n if (value === \"\") {\n throw new Error(\n \"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.\"\n );\n }\n return /* @__PURE__ */ jsx(\n SelectItemContextProvider,\n {\n scope: __scopeSelect,\n value,\n disabled,\n textId,\n isSelected,\n onItemTextChange: React.useCallback((node) => {\n setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? \"\").trim());\n }, []),\n children: /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeSelect,\n value,\n disabled,\n textValue,\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n role: \"option\",\n \"aria-labelledby\": textId,\n \"data-highlighted\": isFocused ? \"\" : void 0,\n \"aria-selected\": isSelected && isFocused,\n \"data-state\": isSelected ? \"checked\" : \"unchecked\",\n \"aria-disabled\": disabled || void 0,\n \"data-disabled\": disabled ? \"\" : void 0,\n tabIndex: disabled ? void 0 : -1,\n ...itemProps,\n ref: composedRefs,\n onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),\n onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),\n onClick: composeEventHandlers(itemProps.onClick, () => {\n if (pointerTypeRef.current !== \"mouse\") handleSelect();\n }),\n onPointerUp: composeEventHandlers(itemProps.onPointerUp, () => {\n if (pointerTypeRef.current === \"mouse\") handleSelect();\n }),\n onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {\n pointerTypeRef.current = event.pointerType;\n }),\n onPointerMove: composeEventHandlers(itemProps.onPointerMove, (event) => {\n pointerTypeRef.current = event.pointerType;\n if (disabled) {\n contentContext.onItemLeave?.();\n } else if (pointerTypeRef.current === \"mouse\") {\n event.currentTarget.focus({ preventScroll: true });\n }\n }),\n onPointerLeave: composeEventHandlers(itemProps.onPointerLeave, (event) => {\n if (event.currentTarget === document.activeElement) {\n contentContext.onItemLeave?.();\n }\n }),\n onKeyDown: composeEventHandlers(itemProps.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef?.current !== \"\";\n if (isTypingAhead && event.key === \" \") return;\n if (SELECTION_KEYS.includes(event.key)) handleSelect();\n if (event.key === \" \") event.preventDefault();\n })\n }\n )\n }\n )\n }\n );\n }\n);\nSelectItem.displayName = ITEM_NAME;\nvar ITEM_TEXT_NAME = \"SelectItemText\";\nvar SelectItemText = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, className, style, ...itemTextProps } = props;\n const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);\n const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);\n const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect);\n const [itemTextNode, setItemTextNode] = React.useState(null);\n const composedRefs = useComposedRefs(\n forwardedRef,\n (node) => setItemTextNode(node),\n itemContext.onItemTextChange,\n (node) => contentContext.itemTextRefCallback?.(node, itemContext.value, itemContext.disabled)\n );\n const textContent = itemTextNode?.textContent;\n const nativeOption = React.useMemo(\n () => /* @__PURE__ */ jsx(\"option\", { value: itemContext.value, disabled: itemContext.disabled, children: textContent }, itemContext.value),\n [itemContext.disabled, itemContext.value, textContent]\n );\n const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;\n useLayoutEffect(() => {\n onNativeOptionAdd(nativeOption);\n return () => onNativeOptionRemove(nativeOption);\n }, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(Primitive.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }),\n itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null\n ] });\n }\n);\nSelectItemText.displayName = ITEM_TEXT_NAME;\nvar ITEM_INDICATOR_NAME = \"SelectItemIndicator\";\nvar SelectItemIndicator = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, ...itemIndicatorProps } = props;\n const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);\n return itemContext.isSelected ? /* @__PURE__ */ jsx(Primitive.span, { \"aria-hidden\": true, ...itemIndicatorProps, ref: forwardedRef }) : null;\n }\n);\nSelectItemIndicator.displayName = ITEM_INDICATOR_NAME;\nvar SCROLL_UP_BUTTON_NAME = \"SelectScrollUpButton\";\nvar SelectScrollUpButton = React.forwardRef((props, forwardedRef) => {\n const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);\n const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);\n const [canScrollUp, setCanScrollUp] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);\n useLayoutEffect(() => {\n if (contentContext.viewport && contentContext.isPositioned) {\n let handleScroll2 = function() {\n const canScrollUp2 = viewport.scrollTop > 0;\n setCanScrollUp(canScrollUp2);\n };\n var handleScroll = handleScroll2;\n const viewport = contentContext.viewport;\n handleScroll2();\n viewport.addEventListener(\"scroll\", handleScroll2);\n return () => viewport.removeEventListener(\"scroll\", handleScroll2);\n }\n }, [contentContext.viewport, contentContext.isPositioned]);\n return canScrollUp ? /* @__PURE__ */ jsx(\n SelectScrollButtonImpl,\n {\n ...props,\n ref: composedRefs,\n onAutoScroll: () => {\n const { viewport, selectedItem } = contentContext;\n if (viewport && selectedItem) {\n viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight;\n }\n }\n }\n ) : null;\n});\nSelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;\nvar SCROLL_DOWN_BUTTON_NAME = \"SelectScrollDownButton\";\nvar SelectScrollDownButton = React.forwardRef((props, forwardedRef) => {\n const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);\n const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);\n const [canScrollDown, setCanScrollDown] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);\n useLayoutEffect(() => {\n if (contentContext.viewport && contentContext.isPositioned) {\n let handleScroll2 = function() {\n const maxScroll = viewport.scrollHeight - viewport.clientHeight;\n const canScrollDown2 = Math.ceil(viewport.scrollTop) < maxScroll;\n setCanScrollDown(canScrollDown2);\n };\n var handleScroll = handleScroll2;\n const viewport = contentContext.viewport;\n handleScroll2();\n viewport.addEventListener(\"scroll\", handleScroll2);\n return () => viewport.removeEventListener(\"scroll\", handleScroll2);\n }\n }, [contentContext.viewport, contentContext.isPositioned]);\n return canScrollDown ? /* @__PURE__ */ jsx(\n SelectScrollButtonImpl,\n {\n ...props,\n ref: composedRefs,\n onAutoScroll: () => {\n const { viewport, selectedItem } = contentContext;\n if (viewport && selectedItem) {\n viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;\n }\n }\n }\n ) : null;\n});\nSelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;\nvar SelectScrollButtonImpl = React.forwardRef((props, forwardedRef) => {\n const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;\n const contentContext = useSelectContentContext(\"SelectScrollButton\", __scopeSelect);\n const autoScrollTimerRef = React.useRef(null);\n const getItems = useCollection(__scopeSelect);\n const clearAutoScrollTimer = React.useCallback(() => {\n if (autoScrollTimerRef.current !== null) {\n window.clearInterval(autoScrollTimerRef.current);\n autoScrollTimerRef.current = null;\n }\n }, []);\n React.useEffect(() => {\n return () => clearAutoScrollTimer();\n }, [clearAutoScrollTimer]);\n useLayoutEffect(() => {\n const activeItem = getItems().find((item) => item.ref.current === document.activeElement);\n activeItem?.ref.current?.scrollIntoView({ block: \"nearest\" });\n }, [getItems]);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"aria-hidden\": true,\n ...scrollIndicatorProps,\n ref: forwardedRef,\n style: { flexShrink: 0, ...scrollIndicatorProps.style },\n onPointerDown: composeEventHandlers(scrollIndicatorProps.onPointerDown, () => {\n if (autoScrollTimerRef.current === null) {\n autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);\n }\n }),\n onPointerMove: composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {\n contentContext.onItemLeave?.();\n if (autoScrollTimerRef.current === null) {\n autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);\n }\n }),\n onPointerLeave: composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {\n clearAutoScrollTimer();\n })\n }\n );\n});\nvar SEPARATOR_NAME = \"SelectSeparator\";\nvar SelectSeparator = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, ...separatorProps } = props;\n return /* @__PURE__ */ jsx(Primitive.div, { \"aria-hidden\": true, ...separatorProps, ref: forwardedRef });\n }\n);\nSelectSeparator.displayName = SEPARATOR_NAME;\nvar ARROW_NAME = \"SelectArrow\";\nvar SelectArrow = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeSelect, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const context = useSelectContext(ARROW_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);\n return context.open && contentContext.position === \"popper\" ? /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;\n }\n);\nSelectArrow.displayName = ARROW_NAME;\nvar BUBBLE_INPUT_NAME = \"SelectBubbleInput\";\nvar SelectBubbleInput = React.forwardRef(\n ({ __scopeSelect, value, ...props }, forwardedRef) => {\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const prevValue = usePrevious(value);\n React.useEffect(() => {\n const select = ref.current;\n if (!select) return;\n const selectProto = window.HTMLSelectElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n selectProto,\n \"value\"\n );\n const setValue = descriptor.set;\n if (prevValue !== value && setValue) {\n const event = new Event(\"change\", { bubbles: true });\n setValue.call(select, value);\n select.dispatchEvent(event);\n }\n }, [prevValue, value]);\n return /* @__PURE__ */ jsx(\n Primitive.select,\n {\n ...props,\n style: { ...VISUALLY_HIDDEN_STYLES, ...props.style },\n ref: composedRefs,\n defaultValue: value\n }\n );\n }\n);\nSelectBubbleInput.displayName = BUBBLE_INPUT_NAME;\nfunction shouldShowPlaceholder(value) {\n return value === \"\" || value === void 0;\n}\nfunction useTypeaheadSearch(onSearchChange) {\n const handleSearchChange = useCallbackRef(onSearchChange);\n const searchRef = React.useRef(\"\");\n const timerRef = React.useRef(0);\n const handleTypeaheadSearch = React.useCallback(\n (key) => {\n const search = searchRef.current + key;\n handleSearchChange(search);\n (function updateSearch(value) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== \"\") timerRef.current = window.setTimeout(() => updateSearch(\"\"), 1e3);\n })(search);\n },\n [handleSearchChange]\n );\n const resetTypeahead = React.useCallback(() => {\n searchRef.current = \"\";\n window.clearTimeout(timerRef.current);\n }, []);\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n return [searchRef, handleTypeaheadSearch, resetTypeahead];\n}\nfunction findNextItem(items, search, currentItem) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;\n let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0));\n const excludeCurrentItem = normalizedSearch.length === 1;\n if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v) => v !== currentItem);\n const nextItem = wrappedItems.find(\n (item) => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase())\n );\n return nextItem !== currentItem ? nextItem : void 0;\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root2 = Select;\nvar Trigger = SelectTrigger;\nvar Value = SelectValue;\nvar Icon = SelectIcon;\nvar Portal = SelectPortal;\nvar Content2 = SelectContent;\nvar Viewport = SelectViewport;\nvar Group = SelectGroup;\nvar Label = SelectLabel;\nvar Item = SelectItem;\nvar ItemText = SelectItemText;\nvar ItemIndicator = SelectItemIndicator;\nvar ScrollUpButton = SelectScrollUpButton;\nvar ScrollDownButton = SelectScrollDownButton;\nvar Separator = SelectSeparator;\nvar Arrow2 = SelectArrow;\nexport {\n Arrow2 as Arrow,\n Content2 as Content,\n Group,\n Icon,\n Item,\n ItemIndicator,\n ItemText,\n Label,\n Portal,\n Root2 as Root,\n ScrollDownButton,\n ScrollUpButton,\n Select,\n SelectArrow,\n SelectContent,\n SelectGroup,\n SelectIcon,\n SelectItem,\n SelectItemIndicator,\n SelectItemText,\n SelectLabel,\n SelectPortal,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n SelectViewport,\n Separator,\n Trigger,\n Value,\n Viewport,\n createSelectScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { Check, ChevronDown } from \"lucide-react\";\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Radix-based Select primitive — shadcn shape, brand-tokenised. Used\n * by the Profile tab's ENUM / ARRAY field controls and the language\n * picker. Keyboard navigation, type-ahead, and roving focus come from\n * Radix; styling here only swaps shadcn's neutral palette for the\n * widget's `wx-*` tokens so re-skinning the widget recolors the\n * dropdown for free.\n *\n * Mounted via `Portal` so the listbox escapes the widget's clipped /\n * rounded surfaces and never gets cut off by overflow boundaries\n * (the widget panel uses `rounded-wx-md` + `overflow-hidden` on\n * several wrappers).\n */\nexport const Select = SelectPrimitive.Root;\nexport const SelectGroup = SelectPrimitive.Group;\nexport const SelectValue = SelectPrimitive.Value;\n\nexport const SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-9 w-full items-center justify-between gap-2 rounded-wx-sm border border-wx-border bg-wx-bg px-3 py-2 text-sm text-wx-fg\",\n \"placeholder:text-wx-fg-subtle\",\n \"focus:border-wx-primary focus:outline-none focus:ring-2 focus:ring-wx-primary/20\",\n \"disabled:cursor-not-allowed disabled:bg-wx-bg-elevated/60 disabled:text-wx-fg-muted\",\n \"[&>span]:line-clamp-1\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDown size={14} className=\"opacity-60\" aria-hidden=\"true\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nexport const SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n // The widget renders inside a fixed-position panel with a high\n // z-index ceiling; the dropdown needs to sit above it.\n className={cn(\n \"relative z-[10000] max-h-72 min-w-[8rem] overflow-hidden rounded-wx-sm border border-wx-border bg-wx-bg text-wx-fg shadow-lg\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n position === \"popper\" && \"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1\",\n position === \"popper\" &&\n \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\",\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 pl-7 text-sm outline-none\",\n \"focus:bg-wx-bg-elevated focus:text-wx-fg\",\n \"data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n \"data-[state=checked]:font-medium\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check size={12} className=\"text-wx-primary\" aria-hidden=\"true\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n","/**\n * Localised labels for BE-defined system fields and their enum options.\n *\n * The BE ships a fixed catalogue of system fields (`SystemFieldKey.*`)\n * with English `name`s baked in (`\"First name\"`, `\"Chat status\"`, …).\n * The widget renders the visitor-facing form in the visitor's UI\n * language, so we shadow those English names with translations from\n * `messages/<locale>.json` whenever the field's key is one of the\n * known system keys. Operator-defined custom fields (anything not in\n * `KNOWN_SYSTEM_FIELDS`) keep the operator-supplied `label` since their\n * names are configurable per integration and not in our string table.\n *\n * Same story for ENUM/ARRAY options: known option lists (chat status,\n * priority, lead status, …) get localised display labels; everything\n * else falls back to `humanise()` of the wire value.\n */\n\nimport { humanise } from \"./field-controls/options-control\";\n\n/** Convert a BE field key — which can be snake_case (`chat_status`) or\n * camelCase (`firstName`) depending on field vintage — to a canonical\n * camelCase form for table lookup. */\nfunction camelize(key: string): string {\n return key.replace(/_([a-z])/g, (_, c) => c.toUpperCase());\n}\n\n/**\n * Every system-field key the BE defines (mirrors `SystemFieldKey.*`\n * in `backend-app`). Used as the allow-list for translation lookup —\n * keys NOT in this set are operator-defined custom fields whose\n * labels we don't own.\n *\n * Keep alphabetical within each group for diff-friendliness.\n */\nconst KNOWN_SYSTEM_FIELDS = new Set([\n // Identity\n \"avatar\",\n \"wexioId\",\n \"telegramId\",\n \"whatsappId\",\n \"viberId\",\n \"instagramId\",\n \"optInWhatsapp\",\n \"webVerified\",\n \"firstName\",\n \"lastName\",\n \"username\",\n \"language\",\n \"email\",\n \"phone\",\n \"company\",\n \"location\",\n \"isValid\",\n // Chat status + context\n \"chatStatus\",\n \"chatCategory\",\n \"priority\",\n // Lead + sales\n \"leadSource\",\n \"leadStatus\",\n \"interestLevel\",\n \"productInterest\",\n \"budgetRange\",\n \"purchaseTimeline\",\n // Communication timestamps\n \"lastMessageSentAt\",\n \"lastMessageReceivedAt\",\n \"lastSeenAt\",\n \"firstMessageReceivedAt\",\n // Status\n \"isBlocked\",\n \"registrationDate\",\n \"aiAvailable\",\n // Metrics\n \"totalMessagesSent\",\n \"totalMessagesReceived\",\n \"totalAiMessagesSent\",\n \"totalBotMessagesSent\",\n \"totalUserMessagesSent\",\n \"flowCompletionRate\",\n \"lastFlowCompleted\",\n \"totalFlowsStarted\",\n \"totalFlowsCompleted\",\n]);\n\n/** Fields whose `options[]` enums we localise. Anything not listed\n * falls back to `humanise()` of the BE wire value, so a new enum\n * field added to the BE still renders sensibly without a widget\n * release. */\nconst KNOWN_SYSTEM_OPTIONS = new Set([\n \"chatStatus\",\n \"chatCategory\",\n \"priority\",\n \"leadStatus\",\n \"interestLevel\",\n]);\n\n/**\n * Translate a field label. Returns the i18n string when `fieldKey`\n * matches a known system field; otherwise returns the BE-supplied\n * `fallback` unchanged (custom fields).\n */\nexport function localizeFieldLabel(\n fieldKey: string,\n fallback: string,\n t: (key: string) => string,\n): string {\n const k = camelize(fieldKey);\n if (!KNOWN_SYSTEM_FIELDS.has(k)) return fallback;\n return t(`systemFields.${k}`);\n}\n\n/**\n * Translate one option value within a known enum field. Falls back to\n * `humanise(value)` (`IN_PROGRESS` → `In progress`) when the field's\n * option list isn't one we curate translations for.\n */\nexport function localizeOptionLabel(\n fieldKey: string,\n optionValue: string,\n t: (key: string) => string,\n): string {\n const k = camelize(fieldKey);\n if (!KNOWN_SYSTEM_OPTIONS.has(k)) return humanise(optionValue);\n return t(`systemFieldOptions.${k}.${optionValue}`);\n}\n","import {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { parseArrayValue } from \"../helpers\";\nimport { localizeOptionLabel } from \"../system-field-labels\";\n\n/**\n * Single-select dropdown for both ENUM and ARRAY fields, built on the\n * shadcn Select primitive (Radix-based). Same humanised labels, same\n * wire-shape difference:\n *\n * - ENUM → value is the picked option string (or `null`)\n * - ARRAY → value is a JSON-stringified single-item array (or `null`).\n * ARRAY is multi-value at the BE schema level, but the\n * widget intentionally exposes it as a one-pick affordance\n * — visitors find a single dropdown far less confusing than\n * a multi-checklist, and operator field semantics (\"Chat\n * status: IN_PROGRESS\") are almost always one-at-a-time in\n * practice. If a future field genuinely needs multi-select\n * we'll surface it as a distinct control rather than\n * overload this one.\n *\n * BE option strings are typically uppercase tokens (`IN_PROGRESS`);\n * `humanise` turns them into sentence case for display while the wire\n * value stays untouched.\n */\nexport function OptionsControl({\n id,\n fieldKey,\n mode,\n options,\n value,\n disabled,\n onChange,\n t,\n}: {\n id: string;\n /** BE field key — drives system-option label lookup (e.g. translating\n * `chatStatus.IN_PROGRESS` → \"In progress\" / \"В процесі\"). Custom\n * fields fall back to `humanise()` of the wire value. */\n fieldKey: string;\n mode: \"single\" | \"multi\";\n options: string[];\n value: string | null;\n disabled?: boolean;\n onChange: (next: string | null) => void;\n t: (key: string) => string;\n}) {\n if (options.length === 0) {\n return (\n <p id={id} className=\"text-[11px] text-wx-fg-subtle italic\">\n No options configured.\n </p>\n );\n }\n\n // Read the current selection: ENUM is stored raw; ARRAY is a JSON\n // single-item array. parseArrayValue returns [] for nulls/invalid.\n const current = mode === \"single\" ? (value ?? \"\") : (parseArrayValue(value)[0] ?? \"\");\n\n const handleChange = (next: string) => {\n // Radix Select emits \"\" only via our `__clear__` sentinel below\n // (it disallows real empty-string values), so a non-empty `next`\n // is always a real pick.\n if (next === \"__clear__\" || !next) {\n onChange(null);\n return;\n }\n onChange(mode === \"single\" ? next : JSON.stringify([next]));\n };\n\n return (\n <Select value={current || undefined} disabled={disabled} onValueChange={handleChange}>\n <SelectTrigger id={id} aria-label=\"Select an option\">\n <SelectValue placeholder=\"—\" />\n </SelectTrigger>\n <SelectContent>\n {/* Clear-sentinel option lets the visitor unset a non-required\n field — Radix disallows a literal empty-string value, so we\n map a known token through `handleChange` to `null`. */}\n <SelectItem value=\"__clear__\">—</SelectItem>\n {options.map((opt) => (\n <SelectItem key={opt} value={opt}>\n {localizeOptionLabel(fieldKey, opt, t)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n}\n\n/**\n * Turn a BE option token (`IN_PROGRESS`, `chat_status`, `nicelyCased`)\n * into sentence-case for display. The wire value is untouched — this\n * is purely a label transform. Acronyms get re-uppercased so `URL` /\n * `ID` / `AI` don't lowercase into `Url` / `Id` / `Ai`.\n */\nconst ACRONYMS = new Set([\"URL\", \"ID\", \"AI\", \"API\", \"VIP\", \"CRM\", \"SMS\"]);\n\nexport function humanise(token: string): string {\n if (!token) return token;\n // Split on snake/kebab boundaries, then on camelCase boundaries.\n const parts = token\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .split(/[\\s_-]+/)\n .filter(Boolean);\n if (parts.length === 0) return token;\n return parts\n .map((part, idx) => {\n const upper = part.toUpperCase();\n if (ACRONYMS.has(upper)) return upper;\n const lower = part.toLowerCase();\n return idx === 0 ? lower.charAt(0).toUpperCase() + lower.slice(1) : lower;\n })\n .join(\" \");\n}\n","import { inputCls } from \"../input-class\";\n\n/** STRING fallback control — also handles `email` / `phone` keys with\n * the matching native input type so mobile keyboards swap to the\n * email / tel layout. */\nexport function StringControl({\n id,\n fieldKey,\n value,\n disabled,\n onChange,\n}: {\n id: string;\n fieldKey: string;\n value: string | null;\n disabled?: boolean;\n onChange: (next: string | null) => void;\n}) {\n const type = fieldKey === \"email\" ? \"email\" : fieldKey === \"phone\" ? \"tel\" : \"text\";\n const autoComplete =\n fieldKey === \"email\"\n ? \"email\"\n : fieldKey === \"phone\"\n ? \"tel\"\n : fieldKey === \"firstName\"\n ? \"given-name\"\n : fieldKey === \"lastName\"\n ? \"family-name\"\n : undefined;\n return (\n <input\n id={id}\n type={type}\n value={value ?? \"\"}\n disabled={disabled}\n autoComplete={autoComplete}\n placeholder={fieldKey === \"phone\" ? \"+1 555 123 4567\" : undefined}\n onChange={(e) => onChange(e.target.value || null)}\n className={inputCls}\n />\n );\n}\n","import type { VisitorProfileField } from \"@/lib/graphql/queries/generated/profile.generated\";\nimport { BooleanControl } from \"./boolean-control\";\nimport { DateControl } from \"./date-control\";\nimport { NumberControl } from \"./number-control\";\nimport { OptionsControl } from \"./options-control\";\nimport { StringControl } from \"./string-control\";\n\n/**\n * Dispatch by `field.type` to the matching control. AVATAR returns\n * `null` here — it's rendered out-of-band by the avatar hero at the\n * top of the form, not as a row in the field list.\n */\nexport function FieldControl({\n id,\n field,\n value,\n onChange,\n t,\n}: {\n id: string;\n field: VisitorProfileField;\n value: string | null;\n onChange: (next: string | null) => void;\n /** Translator threaded down so `OptionsControl` can localise known\n * system-enum values (e.g. `chatStatus.IN_PROGRESS`). String / number\n * / date / boolean controls don't need it. */\n t: (key: string) => string;\n}) {\n const disabled = field.pinned;\n switch (field.type) {\n case \"BOOLEAN\":\n return <BooleanControl id={id} value={value} disabled={disabled} onChange={onChange} />;\n case \"NUMBER\":\n return <NumberControl id={id} value={value} disabled={disabled} onChange={onChange} />;\n case \"DATE\":\n return <DateControl id={id} value={value} disabled={disabled} onChange={onChange} />;\n case \"ENUM\":\n return (\n <OptionsControl\n id={id}\n fieldKey={field.key}\n mode=\"single\"\n options={field.options ?? []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n t={t}\n />\n );\n case \"ARRAY\":\n return (\n <OptionsControl\n id={id}\n fieldKey={field.key}\n mode=\"multi\"\n options={field.options ?? []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n t={t}\n />\n );\n case \"AVATAR\":\n // Rendered by `AvatarHero` at the top of the form.\n return null;\n default:\n return (\n <StringControl\n id={id}\n fieldKey={field.key}\n value={value}\n disabled={disabled}\n onChange={onChange}\n />\n );\n }\n}\n","import { Lock } from \"lucide-react\";\nimport type { VisitorProfileField } from \"@/lib/graphql/queries/generated/profile.generated\";\nimport { FieldControl } from \"./field-controls\";\nimport { localizeFieldLabel } from \"./system-field-labels\";\n\n/**\n * One row in the identity form. Renders the per-type control, a\n * required `*`, a lock icon for pinned rows, and an inline error\n * message under the control (set by the parent on either client-side\n * validation failure or BE-returned `peopleFields.invalidValue`).\n */\nexport function FieldRow({\n field,\n value,\n onChange,\n error,\n t,\n}: {\n field: VisitorProfileField;\n value: string | null;\n onChange: (next: string | null) => void;\n error?: string;\n t: (key: string) => string;\n}) {\n const pinned = field.pinned;\n const id = `wx-profile-${field.key}`;\n return (\n <div className=\"flex flex-col gap-1.5\">\n <label\n htmlFor={id}\n className=\"flex items-baseline justify-between gap-2 text-xs font-medium text-wx-fg-muted\"\n >\n <span className=\"inline-flex items-center gap-1\">\n {localizeFieldLabel(field.key, field.label, t)}\n {field.required && (\n <span className=\"text-wx-danger\" title={t(\"requiredHint\")}>\n *<span className=\"sr-only\">{t(\"requiredHint\")}</span>\n </span>\n )}\n {pinned && <Lock size={11} aria-hidden=\"true\" className=\"text-wx-fg-subtle\" />}\n </span>\n {pinned && (\n <span className=\"text-[10px] font-normal text-wx-fg-subtle\">{t(\"pinnedHint\")}</span>\n )}\n </label>\n <FieldControl id={id} field={field} value={value} onChange={onChange} t={t} />\n {error && <p className=\"text-[11px] text-wx-danger\">{error}</p>}\n </div>\n );\n}\n","/**\n * Flat content section — replaces the boxed Card pattern. A tiny\n * uppercase eyebrow + a hairline divider drawn at the TOP chunks the\n * page without enclosing chrome. The `first:` modifier suppresses\n * both for the very first section under the hero so it doesn't render\n * a leading rule.\n */\nexport function Section({\n eyebrow,\n adornment,\n children,\n}: {\n eyebrow: string;\n /** Right-aligned trailing slot in the section header — used for the\n * \"saving…\" indicator on the preferences section. Optional. */\n adornment?: React.ReactNode;\n children: React.ReactNode;\n}) {\n return (\n <section className=\"mt-6 flex flex-col gap-4 border-wx-border border-t pt-5 first:mt-4 first:border-t-0 first:pt-0\">\n <div className=\"flex items-baseline justify-between gap-2\">\n <h2 className=\"text-[11px] font-semibold tracking-[0.08em] text-wx-fg-subtle uppercase\">\n {eyebrow}\n </h2>\n {adornment}\n </div>\n <div className=\"flex flex-col gap-4\">{children}</div>\n </section>\n );\n}\n","/**\n * iOS-Settings inspired row — label left, control snapped right. Hint\n * text appears under the label when present. Layout primitive only;\n * the control owns its own validation + state.\n */\nexport function SettingsRow({\n label,\n hint,\n children,\n}: {\n label: string;\n hint?: string;\n children: React.ReactNode;\n}) {\n return (\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex min-w-0 flex-col\">\n <span className=\"text-sm font-medium text-wx-fg\">{label}</span>\n {hint && <span className=\"text-[11px] text-wx-fg-muted\">{hint}</span>}\n </div>\n <div className=\"shrink-0\">{children}</div>\n </div>\n );\n}\n","import { Loader2, Monitor, Moon, Sun } from \"lucide-react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport type { VisitorProfile } from \"@/lib/graphql/queries/generated/profile.generated\";\nimport { SUPPORTED_LOCALES } from \"@/lib/locales\";\nimport { cn } from \"@/lib/utils\";\nimport { localeDisplayName } from \"./helpers\";\nimport { Section } from \"./section\";\nimport { SettingsRow } from \"./settings-row\";\nimport { Switch } from \"./switch\";\nimport type { PrefKey, PrefValue } from \"./use-apply-pref\";\n\n/** Wire values for `preferences.themeMode` — must match the BE's\n * `IsIn(['system','light','dark'])` validator. */\nconst THEME_OPTIONS = [\n { value: \"system\", icon: Monitor, labelKey: \"themeAuto\" },\n { value: \"light\", icon: Sun, labelKey: \"themeLight\" },\n { value: \"dark\", icon: Moon, labelKey: \"themeDark\" },\n] as const;\n\n/**\n * Preferences section — language picker, theme segmented control, and\n * desktop-notifications switch. Every control auto-saves on change via\n * `applyPref` (passed down from the parent); no explicit Save button.\n *\n * The language row is hidden entirely when `languageEditable` is false\n * (operator's `localeStrategy === \"DEFAULT\"` pin).\n *\n * Desktop-notifications has a richer turn-on flow than the others: we\n * gate persistence on the browser permission so a \"saved=true but\n * permission=denied\" silent lie is impossible.\n */\nexport function PreferencesSection({\n profile,\n locale,\n languageEditable,\n prefSaving,\n applyPref,\n onNotificationError,\n t,\n}: {\n profile: VisitorProfile;\n locale: string;\n languageEditable: boolean;\n prefSaving: PrefKey | null;\n applyPref: (key: PrefKey, value: PrefValue) => Promise<void>;\n /** Surface inline notifications-permission errors via the parent's\n * shared banner — they're not field-level. */\n onNotificationError: (i18nKey: string | null) => void;\n t: (key: string) => string;\n}) {\n return (\n <Section\n eyebrow={t(\"preferencesHeading\")}\n adornment={\n prefSaving ? (\n <span className=\"inline-flex items-center gap-1 text-[10px] font-normal text-wx-fg-subtle\">\n <Loader2 size={10} className=\"animate-spin\" aria-hidden=\"true\" />\n {t(\"saving\")}\n </span>\n ) : undefined\n }\n >\n {languageEditable && (\n <SettingsRow label={t(\"preferenceLanguage\")}>\n <div className=\"w-40\">\n <Select\n value={profile.preferences.language ?? locale}\n disabled={prefSaving === \"language\"}\n onValueChange={(v) => applyPref(\"language\", v || null)}\n >\n <SelectTrigger aria-label={t(\"preferenceLanguage\")}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {SUPPORTED_LOCALES.map((code) => (\n <SelectItem key={code} value={code}>\n {localeDisplayName(code, locale)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n </SettingsRow>\n )}\n\n <SettingsRow\n label={t(\"preferenceThemeMode\")}\n hint={!profile.themeModeEditable ? t(\"themeLocked\") : undefined}\n >\n <div className=\"inline-flex items-center gap-0.5 rounded-full bg-wx-bg-elevated p-0.5\">\n {THEME_OPTIONS.map(({ value, icon: Icon, labelKey }) => {\n const active = (profile.preferences.themeMode ?? \"system\") === value;\n return (\n <button\n key={value}\n type=\"button\"\n aria-pressed={active}\n aria-label={t(labelKey)}\n title={t(labelKey)}\n disabled={!profile.themeModeEditable || prefSaving === \"themeMode\"}\n onClick={() => applyPref(\"themeMode\", value)}\n className={cn(\n \"flex h-7 w-9 items-center justify-center rounded-full transition-all\",\n active\n ? \"bg-wx-bg text-wx-fg shadow-[0_1px_3px_rgba(0,0,0,0.08)]\"\n : \"text-wx-fg-muted hover:text-wx-fg\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n )}\n >\n <Icon size={13} aria-hidden=\"true\" />\n </button>\n );\n })}\n </div>\n </SettingsRow>\n\n <SettingsRow\n label={t(\"preferenceDesktopNotifications\")}\n hint={t(\"preferenceDesktopNotificationsHint\")}\n >\n <Switch\n checked={\n !!profile.preferences.desktopNotifications &&\n (typeof Notification === \"undefined\" || Notification.permission === \"granted\")\n }\n onChange={async (next) => {\n // Turn-off short-circuits — just persist false. Turn-on\n // must clear the browser gate FIRST so the saved-true\n // state always matches what we can actually deliver\n // (saved=true + permission=denied would be a silent lie).\n if (!next) {\n void applyPref(\"desktopNotifications\", false);\n return;\n }\n if (typeof Notification === \"undefined\") {\n onNotificationError(\"notificationsRequest\");\n return;\n }\n if (Notification.permission === \"denied\") {\n onNotificationError(\"notificationsBlocked\");\n return;\n }\n if (Notification.permission === \"default\") {\n try {\n const result = await Notification.requestPermission();\n if (result !== \"granted\") {\n onNotificationError(\"notificationsBlocked\");\n return;\n }\n } catch {\n onNotificationError(\"notificationsRequest\");\n return;\n }\n }\n void applyPref(\"desktopNotifications\", true);\n }}\n />\n </SettingsRow>\n </Section>\n );\n}\n","import type { ApolloError } from \"@apollo/client\";\n\n/**\n * Symbolic surface of the BE's profile-mutation error codes — every key\n * maps to a deliberately phrased message in the `profile.*` i18n\n * namespace (`errorFieldNotAllowed`, `errorFieldPinned`, `errorThemeLocked`,\n * `errorFeatureDisabled`, or the generic `errorGeneric` fallback).\n *\n * Keep the union in sync with `docs/Channels/Web/WEB_PROFILE_TAB.md`.\n */\nexport type ProfileErrorKind =\n | \"fieldNotAllowed\"\n | \"fieldPinned\"\n | \"themeLocked\"\n | \"featureDisabled\"\n /** Per-field validation failure (bad number, ENUM mismatch, malformed\n * date, etc.) — surface inline on the offending row. */\n | \"fieldInvalid\"\n | \"generic\";\n\n/** Extract the symbolic kind from an Apollo error (or any unknown value) so\n * the caller can render an i18n message without sniffing strings itself. */\nexport function extractProfileErrorKind(err: unknown): ProfileErrorKind {\n const apollo = err as ApolloError | undefined;\n const codes: string[] = [];\n if (apollo?.graphQLErrors) {\n for (const e of apollo.graphQLErrors) {\n const code = (e.extensions as { code?: unknown } | undefined)?.code;\n if (typeof code === \"string\") codes.push(code);\n }\n }\n // Some BE shapes also include `message` strings — accept exact matches.\n if (typeof apollo?.message === \"string\") codes.push(apollo.message);\n for (const c of codes) {\n if (c === \"webProfileFieldNotAllowed\") return \"fieldNotAllowed\";\n if (c === \"webProfileFieldPinned\") return \"fieldPinned\";\n if (c === \"webProfileThemeLocked\") return \"themeLocked\";\n if (c === \"webProfileFeatureDisabled\") return \"featureDisabled\";\n if (c === \"peopleFields.invalidValue\") return \"fieldInvalid\";\n }\n return \"generic\";\n}\n\n/** When the BE returns `peopleFields.invalidValue`, it usually tags the\n * offending field on `extensions` (`field` / `key`). Pull whichever it\n * used so we can surface the error inline on that row. Returns `null` when\n * the hint isn't present (caller will fall back to the top-level banner). */\nexport function extractInvalidFieldKey(err: unknown): string | null {\n const apollo = err as ApolloError | undefined;\n if (!apollo?.graphQLErrors) return null;\n for (const e of apollo.graphQLErrors) {\n const ext = e.extensions as { code?: unknown; field?: unknown; key?: unknown } | undefined;\n if (!ext) continue;\n if (ext.code !== \"peopleFields.invalidValue\") continue;\n if (typeof ext.field === \"string\") return ext.field;\n if (typeof ext.key === \"string\") return ext.key;\n }\n return null;\n}\n\n/** i18n key (in the `profile.*` namespace) for a given error kind. */\nexport function profileErrorI18nKey(kind: ProfileErrorKind): string {\n switch (kind) {\n case \"fieldNotAllowed\":\n return \"errorFieldNotAllowed\";\n case \"fieldPinned\":\n return \"errorFieldPinned\";\n case \"themeLocked\":\n return \"errorThemeLocked\";\n case \"featureDisabled\":\n return \"errorFeatureDisabled\";\n case \"fieldInvalid\":\n return \"errorFieldInvalid\";\n default:\n return \"errorGeneric\";\n }\n}\n","\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport {\n useUpdateVisitorProfileMutation,\n type VisitorProfile,\n VisitorProfileDocument,\n} from \"@/lib/graphql/queries/generated/profile.generated\";\nimport { setRuntimeLocale } from \"@/lib/runtime-locale\";\nimport { extractProfileErrorKind, profileErrorI18nKey } from \"./profile-error\";\n\nexport type PrefKey = \"language\" | \"desktopNotifications\" | \"themeMode\";\nexport type PrefValue = string | boolean | null;\n\n/**\n * Auto-saves a single visitor preference with an Apollo optimistic\n * response so the widget chrome (theme, language) flips THIS tick;\n * the mutation completes in the background and the authoritative\n * reply replaces the optimistic one. On error Apollo rolls the cache\n * back automatically and the returned `error` surfaces an inline\n * i18n message for the caller to display.\n *\n * Returns:\n * - `apply(key, value)` — fire-and-await the auto-save\n * - `saving` — the key currently being saved (or `null`)\n * - `error` — the most recent i18n error key, or `null`\n * - `clearError` — wipe the error state (e.g. when the visitor\n * interacts with another control)\n */\nexport function useApplyPref(profile: VisitorProfile | undefined, t: (key: string) => string) {\n const [update] = useUpdateVisitorProfileMutation();\n const [saving, setSaving] = useState<PrefKey | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n const clearError = useCallback(() => setError(null), []);\n\n const apply = useCallback(\n async (key: PrefKey, value: PrefValue) => {\n if (!profile) return;\n setSaving(key);\n setError(null);\n\n const patch: Record<string, PrefValue> = { [key]: value };\n const optimisticPrefs = {\n __typename: \"VisitorProfilePreferences\" as const,\n ...profile.preferences,\n ...patch,\n };\n try {\n await update({\n variables: { input: { preferences: patch } },\n // Apollo 3 needs `__typename: \"Mutation\"` on the root and a\n // typename on every nested object for the optimistic response\n // to merge into the cache (otherwise it silently drops the\n // optimistic write and the UI doesn't flip until the real\n // reply lands).\n optimisticResponse: {\n __typename: \"Mutation\" as const,\n updateVisitorProfile: {\n __typename: \"VisitorProfile\" as const,\n ...profile,\n preferences: optimisticPrefs,\n },\n },\n // Apollo can't auto-link `Mutation.updateVisitorProfile` with\n // `Query.visitorProfile` without a shared normalised id, and\n // `VisitorProfile` is intentionally id-less on the BE — so we\n // patch the query cache explicitly so the prefs hook + this\n // tab's reads see the change immediately.\n update: (cache, { data: mut }) => {\n const next = mut?.updateVisitorProfile;\n if (!next) return;\n cache.writeQuery({\n query: VisitorProfileDocument,\n data: { visitorProfile: next },\n });\n },\n });\n // Locale lives outside the Apollo graph — the runtime-locale\n // bus is what tells `RuntimeIntlProvider` to swap bundles.\n // (The prefs hook also fires this, but firing here too cuts a\n // tick of perceived latency on the actual click.)\n if (key === \"language\" && typeof value === \"string\") {\n setRuntimeLocale(value);\n }\n } catch (err) {\n const kind = extractProfileErrorKind(err);\n setError(t(profileErrorI18nKey(kind)));\n } finally {\n setSaving(null);\n }\n },\n [profile, t, update],\n );\n\n return { apply, saving, error, clearError };\n}\n","// This file is a workaround for a bug in web browsers' \"native\"\n// ES6 importing system which is uncapable of importing \"*.json\" files.\n// https://github.com/catamphetamine/libphonenumber-js/issues/239\nexport default {\"version\":4,\"country_calling_codes\":{\"1\":[\"US\",\"AG\",\"AI\",\"AS\",\"BB\",\"BM\",\"BS\",\"CA\",\"DM\",\"DO\",\"GD\",\"GU\",\"JM\",\"KN\",\"KY\",\"LC\",\"MP\",\"MS\",\"PR\",\"SX\",\"TC\",\"TT\",\"VC\",\"VG\",\"VI\"],\"7\":[\"RU\",\"KZ\"],\"20\":[\"EG\"],\"27\":[\"ZA\"],\"30\":[\"GR\"],\"31\":[\"NL\"],\"32\":[\"BE\"],\"33\":[\"FR\"],\"34\":[\"ES\"],\"36\":[\"HU\"],\"39\":[\"IT\",\"VA\"],\"40\":[\"RO\"],\"41\":[\"CH\"],\"43\":[\"AT\"],\"44\":[\"GB\",\"GG\",\"IM\",\"JE\"],\"45\":[\"DK\"],\"46\":[\"SE\"],\"47\":[\"NO\",\"SJ\"],\"48\":[\"PL\"],\"49\":[\"DE\"],\"51\":[\"PE\"],\"52\":[\"MX\"],\"53\":[\"CU\"],\"54\":[\"AR\"],\"55\":[\"BR\"],\"56\":[\"CL\"],\"57\":[\"CO\"],\"58\":[\"VE\"],\"60\":[\"MY\"],\"61\":[\"AU\",\"CC\",\"CX\"],\"62\":[\"ID\"],\"63\":[\"PH\"],\"64\":[\"NZ\"],\"65\":[\"SG\"],\"66\":[\"TH\"],\"81\":[\"JP\"],\"82\":[\"KR\"],\"84\":[\"VN\"],\"86\":[\"CN\"],\"90\":[\"TR\"],\"91\":[\"IN\"],\"92\":[\"PK\"],\"93\":[\"AF\"],\"94\":[\"LK\"],\"95\":[\"MM\"],\"98\":[\"IR\"],\"211\":[\"SS\"],\"212\":[\"MA\",\"EH\"],\"213\":[\"DZ\"],\"216\":[\"TN\"],\"218\":[\"LY\"],\"220\":[\"GM\"],\"221\":[\"SN\"],\"222\":[\"MR\"],\"223\":[\"ML\"],\"224\":[\"GN\"],\"225\":[\"CI\"],\"226\":[\"BF\"],\"227\":[\"NE\"],\"228\":[\"TG\"],\"229\":[\"BJ\"],\"230\":[\"MU\"],\"231\":[\"LR\"],\"232\":[\"SL\"],\"233\":[\"GH\"],\"234\":[\"NG\"],\"235\":[\"TD\"],\"236\":[\"CF\"],\"237\":[\"CM\"],\"238\":[\"CV\"],\"239\":[\"ST\"],\"240\":[\"GQ\"],\"241\":[\"GA\"],\"242\":[\"CG\"],\"243\":[\"CD\"],\"244\":[\"AO\"],\"245\":[\"GW\"],\"246\":[\"IO\"],\"247\":[\"AC\"],\"248\":[\"SC\"],\"249\":[\"SD\"],\"250\":[\"RW\"],\"251\":[\"ET\"],\"252\":[\"SO\"],\"253\":[\"DJ\"],\"254\":[\"KE\"],\"255\":[\"TZ\"],\"256\":[\"UG\"],\"257\":[\"BI\"],\"258\":[\"MZ\"],\"260\":[\"ZM\"],\"261\":[\"MG\"],\"262\":[\"RE\",\"YT\"],\"263\":[\"ZW\"],\"264\":[\"NA\"],\"265\":[\"MW\"],\"266\":[\"LS\"],\"267\":[\"BW\"],\"268\":[\"SZ\"],\"269\":[\"KM\"],\"290\":[\"SH\",\"TA\"],\"291\":[\"ER\"],\"297\":[\"AW\"],\"298\":[\"FO\"],\"299\":[\"GL\"],\"350\":[\"GI\"],\"351\":[\"PT\"],\"352\":[\"LU\"],\"353\":[\"IE\"],\"354\":[\"IS\"],\"355\":[\"AL\"],\"356\":[\"MT\"],\"357\":[\"CY\"],\"358\":[\"FI\",\"AX\"],\"359\":[\"BG\"],\"370\":[\"LT\"],\"371\":[\"LV\"],\"372\":[\"EE\"],\"373\":[\"MD\"],\"374\":[\"AM\"],\"375\":[\"BY\"],\"376\":[\"AD\"],\"377\":[\"MC\"],\"378\":[\"SM\"],\"380\":[\"UA\"],\"381\":[\"RS\"],\"382\":[\"ME\"],\"383\":[\"XK\"],\"385\":[\"HR\"],\"386\":[\"SI\"],\"387\":[\"BA\"],\"389\":[\"MK\"],\"420\":[\"CZ\"],\"421\":[\"SK\"],\"423\":[\"LI\"],\"500\":[\"FK\"],\"501\":[\"BZ\"],\"502\":[\"GT\"],\"503\":[\"SV\"],\"504\":[\"HN\"],\"505\":[\"NI\"],\"506\":[\"CR\"],\"507\":[\"PA\"],\"508\":[\"PM\"],\"509\":[\"HT\"],\"590\":[\"GP\",\"BL\",\"MF\"],\"591\":[\"BO\"],\"592\":[\"GY\"],\"593\":[\"EC\"],\"594\":[\"GF\"],\"595\":[\"PY\"],\"596\":[\"MQ\"],\"597\":[\"SR\"],\"598\":[\"UY\"],\"599\":[\"CW\",\"BQ\"],\"670\":[\"TL\"],\"672\":[\"NF\"],\"673\":[\"BN\"],\"674\":[\"NR\"],\"675\":[\"PG\"],\"676\":[\"TO\"],\"677\":[\"SB\"],\"678\":[\"VU\"],\"679\":[\"FJ\"],\"680\":[\"PW\"],\"681\":[\"WF\"],\"682\":[\"CK\"],\"683\":[\"NU\"],\"685\":[\"WS\"],\"686\":[\"KI\"],\"687\":[\"NC\"],\"688\":[\"TV\"],\"689\":[\"PF\"],\"690\":[\"TK\"],\"691\":[\"FM\"],\"692\":[\"MH\"],\"850\":[\"KP\"],\"852\":[\"HK\"],\"853\":[\"MO\"],\"855\":[\"KH\"],\"856\":[\"LA\"],\"880\":[\"BD\"],\"886\":[\"TW\"],\"960\":[\"MV\"],\"961\":[\"LB\"],\"962\":[\"JO\"],\"963\":[\"SY\"],\"964\":[\"IQ\"],\"965\":[\"KW\"],\"966\":[\"SA\"],\"967\":[\"YE\"],\"968\":[\"OM\"],\"970\":[\"PS\"],\"971\":[\"AE\"],\"972\":[\"IL\"],\"973\":[\"BH\"],\"974\":[\"QA\"],\"975\":[\"BT\"],\"976\":[\"MN\"],\"977\":[\"NP\"],\"992\":[\"TJ\"],\"993\":[\"TM\"],\"994\":[\"AZ\"],\"995\":[\"GE\"],\"996\":[\"KG\"],\"998\":[\"UZ\"]},\"countries\":{\"AC\":[\"247\",\"00\",\"(?:[01589]\\\\d|[46])\\\\d{4}\",[5,6]],\"AD\":[\"376\",\"00\",\"(?:1|6\\\\d)\\\\d{7}|[135-9]\\\\d{5}\",[6,8,9],[[\"(\\\\d{3})(\\\\d{3})\",\"$1 $2\",[\"[135-9]\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"1\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"6\"]]]],\"AE\":[\"971\",\"00\",\"(?:[4-7]\\\\d|9[0-689])\\\\d{7}|800\\\\d{2,9}|[2-4679]\\\\d{7}\",[5,6,7,8,9,10,11,12],[[\"(\\\\d{3})(\\\\d{2,9})\",\"$1 $2\",[\"60|8\"]],[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[236]|[479][2-8]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d)(\\\\d{5})\",\"$1 $2 $3\",[\"[479]\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"5\"],\"0$1\"]],\"0\"],\"AF\":[\"93\",\"00\",\"[2-7]\\\\d{8}\",[9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[2-7]\"],\"0$1\"]],\"0\"],\"AG\":[\"1\",\"011\",\"(?:268|[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([457]\\\\d{6})$|1\",\"268$1\",0,\"268\"],\"AI\":[\"1\",\"011\",\"(?:264|[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([2457]\\\\d{6})$|1\",\"264$1\",0,\"264\"],\"AL\":[\"355\",\"00\",\"(?:700\\\\d\\\\d|900)\\\\d{3}|8\\\\d{5,7}|(?:[2-5]|6\\\\d)\\\\d{7}\",[6,7,8,9],[[\"(\\\\d{3})(\\\\d{3,4})\",\"$1 $2\",[\"80|9\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"4[2-6]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[2358][2-5]|4\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"[23578]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"6\"],\"0$1\"]],\"0\"],\"AM\":[\"374\",\"00\",\"(?:[1-489]\\\\d|55|60|77)\\\\d{6}\",[8],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"[89]0\"],\"0 $1\"],[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"2|3[12]\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"1|47\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"[3-9]\"],\"0$1\"]],\"0\"],\"AO\":[\"244\",\"00\",\"[29]\\\\d{8}\",[9],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[29]\"]]]],\"AR\":[\"54\",\"00\",\"(?:11|[89]\\\\d\\\\d)\\\\d{8}|[2368]\\\\d{9}\",[10,11],[[\"(\\\\d{4})(\\\\d{2})(\\\\d{4})\",\"$1 $2-$3\",[\"2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])\",\"2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)\",\"2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]\",\"2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]\"],\"0$1\",1],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2-$3\",[\"1\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1-$2-$3\",[\"[68]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2-$3\",[\"[23]\"],\"0$1\",1],[\"(\\\\d)(\\\\d{4})(\\\\d{2})(\\\\d{4})\",\"$2 15-$3-$4\",[\"9(?:2[2-469]|3[3-578])\",\"9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))\",\"9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)\",\"9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]\",\"9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]\"],\"0$1\",0,\"$1 $2 $3-$4\"],[\"(\\\\d)(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$2 15-$3-$4\",[\"91\"],\"0$1\",0,\"$1 $2 $3-$4\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{5})\",\"$1-$2-$3\",[\"8\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$2 15-$3-$4\",[\"9\"],\"0$1\",0,\"$1 $2 $3-$4\"]],\"0\",0,\"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?\",\"9$1\"],\"AS\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|684|900)\\\\d{7}\",[10],0,\"1\",0,\"([267]\\\\d{6})$|1\",\"684$1\",0,\"684\"],\"AT\":[\"43\",\"00\",\"1\\\\d{3,12}|2\\\\d{6,12}|43(?:(?:0\\\\d|5[02-9])\\\\d{3,9}|2\\\\d{4,5}|[3467]\\\\d{4}|8\\\\d{4,6}|9\\\\d{4,7})|5\\\\d{4,12}|8\\\\d{7,12}|9\\\\d{8,12}|(?:[367]\\\\d|4[0-24-9])\\\\d{4,11}\",[4,5,6,7,8,9,10,11,12,13],[[\"(\\\\d)(\\\\d{3,12})\",\"$1 $2\",[\"1(?:11|[2-9])\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})\",\"$1 $2\",[\"517\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3,5})\",\"$1 $2\",[\"5[079]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3,10})\",\"$1 $2\",[\"(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]\",\"(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3,9})\",\"$1 $2\",[\"[2-467]|5[2-6]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"5\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4,7})\",\"$1 $2 $3\",[\"5\"],\"0$1\"]],\"0\"],\"AU\":[\"61\",\"001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011\",\"1(?:[0-79]\\\\d{7}(?:\\\\d(?:\\\\d{2})?)?|8[0-24-9]\\\\d{7})|[2-478]\\\\d{8}|1\\\\d{4,7}\",[5,6,7,8,9,10,12],[[\"(\\\\d{2})(\\\\d{3,4})\",\"$1 $2\",[\"16\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2,4})\",\"$1 $2 $3\",[\"16\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"14|4\"],\"0$1\"],[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"[2378]\"],\"(0$1)\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"1(?:30|[89])\"]]],\"0\",0,\"(183[12])|0\",0,0,0,[[\"(?:(?:241|349)0\\\\d\\\\d|8(?:51(?:0(?:0[03-9]|[12479]\\\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\\\d|7[89]|9[0-4])|[34]\\\\d\\\\d)|91(?:(?:[0-58]\\\\d|6[0135-9])\\\\d|7(?:0[0-24-9]|[1-9]\\\\d)|9(?:[0-46-9]\\\\d|5[0-79]))))\\\\d{3}|(?:2(?:[0-26-9]\\\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\\\d|2[0-8])|8(?:55|6[0-8]|[78]\\\\d|9[02-9]))\\\\d{6}\",[9]],[\"4(?:79[01]|83[0-36-9]|95[0-3])\\\\d{5}|4(?:[0-36]\\\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\\\d{6}\",[9]],[\"180(?:0\\\\d{3}|2)\\\\d{3}\",[7,10]],[\"190[0-26]\\\\d{6}\",[10]],0,0,0,[\"163\\\\d{2,6}\",[5,6,7,8,9]],[\"14(?:5(?:1[0458]|[23][458])|71\\\\d)\\\\d{4}\",[9]],[\"13(?:00\\\\d{6}(?:\\\\d{2})?|45[0-4]\\\\d{3})|13\\\\d{4}\",[6,8,10,12]]],\"0011\"],\"AW\":[\"297\",\"00\",\"(?:[25-79]\\\\d\\\\d|800)\\\\d{4}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[25-9]\"]]]],\"AX\":[\"358\",\"00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))\",\"2\\\\d{4,9}|35\\\\d{4,5}|(?:60\\\\d\\\\d|800)\\\\d{4,6}|7\\\\d{5,11}|(?:[14]\\\\d|3[0-46-9]|50)\\\\d{4,8}\",[5,6,7,8,9,10,11,12],0,\"0\",0,0,0,0,\"18\",0,\"00\"],\"AZ\":[\"994\",\"00\",\"365\\\\d{6}|(?:[124579]\\\\d|60|88)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"90\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"1[28]|2|365|46\",\"1[28]|2|365[45]|46\",\"1[28]|2|365(?:4|5[02])|46\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[13-9]\"],\"0$1\"]],\"0\"],\"BA\":[\"387\",\"00\",\"6\\\\d{8}|(?:[35689]\\\\d|49|70)\\\\d{6}\",[8,9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"6[1-3]|[7-9]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2-$3\",[\"[3-5]|6[56]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"6\"],\"0$1\"]],\"0\"],\"BB\":[\"1\",\"011\",\"(?:246|[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-9]\\\\d{6})$|1\",\"246$1\",0,\"246\"],\"BD\":[\"880\",\"00\",\"[1-469]\\\\d{9}|8[0-79]\\\\d{7,8}|[2-79]\\\\d{8}|[2-9]\\\\d{7}|[3-9]\\\\d{6}|[57-9]\\\\d{5}\",[6,7,8,9,10],[[\"(\\\\d{2})(\\\\d{4,6})\",\"$1-$2\",[\"31[5-8]|[459]1\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3,7})\",\"$1-$2\",[\"3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3,6})\",\"$1-$2\",[\"[13-9]|2[23]\"],\"0$1\"],[\"(\\\\d)(\\\\d{7,8})\",\"$1-$2\",[\"2\"],\"0$1\"]],\"0\"],\"BE\":[\"32\",\"00\",\"4\\\\d{8}|[1-9]\\\\d{7}\",[8,9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"(?:80|9)0\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[239]|4[23]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[15-8]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"4\"],\"0$1\"]],\"0\"],\"BF\":[\"226\",\"00\",\"[024-7]\\\\d{7}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[024-7]\"]]]],\"BG\":[\"359\",\"00\",\"00800\\\\d{7}|[2-7]\\\\d{6,7}|[89]\\\\d{6,8}|2\\\\d{5}\",[6,7,8,9,12],[[\"(\\\\d)(\\\\d)(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"2\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"43[1-6]|70[1-9]\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"2\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2,3})\",\"$1 $2 $3\",[\"[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"(?:70|8)0\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{2})\",\"$1 $2 $3\",[\"43[1-7]|7\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[48]|9[08]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"9\"],\"0$1\"]],\"0\"],\"BH\":[\"973\",\"00\",\"[136-9]\\\\d{7}\",[8],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[13679]|8[02-4679]\"]]]],\"BI\":[\"257\",\"00\",\"(?:[267]\\\\d|31)\\\\d{6}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[2367]\"]]]],\"BJ\":[\"229\",\"00\",\"(?:01\\\\d|8)\\\\d{7}\",[8,10],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"8\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4 $5\",[\"0\"]]]],\"BL\":[\"590\",\"00\",\"7090\\\\d{5}|(?:[56]9|[89]\\\\d)\\\\d{7}\",[9],0,\"0\",0,0,0,0,0,[[\"(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\\\d)|80[6-9]\\\\d\\\\d)\\\\d{4}\"],[\"(?:69(?:0\\\\d\\\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\\\d{4}\"],[\"80[0-5]\\\\d{6}\"],[\"8[129]\\\\d{7}\"],0,0,0,0,[\"9(?:(?:39[5-7]|76[018])\\\\d|475[0-6])\\\\d{4}\"]]],\"BM\":[\"1\",\"011\",\"(?:441|[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-9]\\\\d{6})$|1\",\"441$1\",0,\"441\"],\"BN\":[\"673\",\"00\",\"[2-578]\\\\d{6}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[2-578]\"]]]],\"BO\":[\"591\",\"00(?:1\\\\d)?\",\"(?:[2-7]\\\\d\\\\d|8001)\\\\d{5}\",[8,9],[[\"(\\\\d)(\\\\d{7})\",\"$1 $2\",[\"[23]|4[46]|50\"]],[\"(\\\\d{8})\",\"$1\",[\"[5-7]\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"8\"]]],\"0\",0,\"0(1\\\\d)?\"],\"BQ\":[\"599\",\"00\",\"(?:[34]1|7\\\\d)\\\\d{5}\",[7],0,0,0,0,0,0,\"[347]\"],\"BR\":[\"55\",\"00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)\",\"[1-467]\\\\d{9,10}|55[0-46-9]\\\\d{8}|[34]\\\\d{7}|55\\\\d{7,8}|(?:5[0-46-9]|[89]\\\\d)\\\\d{7,9}\",[8,9,10,11],[[\"(\\\\d{4})(\\\\d{4})\",\"$1-$2\",[\"300|4(?:0[02]|37|86)\",\"300|4(?:0(?:0|20)|370|864)\"]],[\"(\\\\d{3})(\\\\d{2,3})(\\\\d{4})\",\"$1 $2 $3\",[\"(?:[358]|90)0\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2-$3\",[\"(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]\"],\"($1)\"],[\"(\\\\d{2})(\\\\d{5})(\\\\d{4})\",\"$1 $2-$3\",[\"[16][1-9]|[2-57-9]\"],\"($1)\"]],\"0\",0,\"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\\\d{10,11}))?\",\"$2\"],\"BS\":[\"1\",\"011\",\"(?:242|[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([3-8]\\\\d{6})$|1\",\"242$1\",0,\"242\"],\"BT\":[\"975\",\"00\",\"[178]\\\\d{7}|[2-8]\\\\d{6}\",[7,8],[[\"(\\\\d)(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[2-6]|7[246]|8[2-4]\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"1[67]|[78]\"]]]],\"BW\":[\"267\",\"00\",\"(?:0800|(?:[37]|800)\\\\d)\\\\d{6}|(?:[2-6]\\\\d|90)\\\\d{5}\",[7,8,10],[[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"90\"]],[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[24-6]|3[15-9]\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[37]\"]],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"0\"]],[\"(\\\\d{3})(\\\\d{4})(\\\\d{3})\",\"$1 $2 $3\",[\"8\"]]]],\"BY\":[\"375\",\"810\",\"(?:[12]\\\\d|33|44|902)\\\\d{7}|8(?:0[0-79]\\\\d{5,7}|[1-7]\\\\d{9})|8(?:1[0-489]|[5-79]\\\\d)\\\\d{7}|8[1-79]\\\\d{6,7}|8[0-79]\\\\d{5}|8\\\\d{5}\",[6,7,8,9,10,11],[[\"(\\\\d{3})(\\\\d{3})\",\"$1 $2\",[\"800\"],\"8 $1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2,4})\",\"$1 $2 $3\",[\"800\"],\"8 $1\"],[\"(\\\\d{4})(\\\\d{2})(\\\\d{3})\",\"$1 $2-$3\",[\"1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])\",\"1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])\"],\"8 0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2-$3-$4\",[\"1(?:[56]|7[467])|2[1-3]\"],\"8 0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2-$3-$4\",[\"[1-4]\"],\"8 0$1\"],[\"(\\\\d{3})(\\\\d{3,4})(\\\\d{4})\",\"$1 $2 $3\",[\"[89]\"],\"8 $1\"]],\"8\",0,\"0|80?\",0,0,0,0,\"8~10\"],\"BZ\":[\"501\",\"00\",\"(?:0800\\\\d|[2-8])\\\\d{6}\",[7,11],[[\"(\\\\d{3})(\\\\d{4})\",\"$1-$2\",[\"[2-8]\"]],[\"(\\\\d)(\\\\d{3})(\\\\d{4})(\\\\d{3})\",\"$1-$2-$3-$4\",[\"0\"]]]],\"CA\":[\"1\",\"011\",\"[2-9]\\\\d{9}|3\\\\d{6}\",[7,10],0,\"1\",0,0,0,0,0,[[\"(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\\\d{6}\",[10]],[\"\",[10]],[\"8(?:00|33|44|55|66|77|88)[2-9]\\\\d{6}\",[10]],[\"900[2-9]\\\\d{6}\",[10]],[\"52(?:3(?:[2-46-9][02-9]\\\\d|5(?:[02-46-9]\\\\d|5[0-46-9]))|4(?:[2-478][02-9]\\\\d|5(?:[034]\\\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\\\d)|9(?:[05-9]\\\\d|2[0-5]|49)))\\\\d{4}|52[34][2-9]1[02-9]\\\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\\\d{6}\",[10]],0,[\"310\\\\d{4}\",[7]],0,[\"600[2-9]\\\\d{6}\",[10]]]],\"CC\":[\"61\",\"001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011\",\"1(?:[0-79]\\\\d{8}(?:\\\\d{2})?|8[0-24-9]\\\\d{7})|[148]\\\\d{8}|1\\\\d{5,7}\",[6,7,8,9,10,12],0,\"0\",0,\"([59]\\\\d{7})$|0\",\"8$1\",0,0,[[\"8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\\\d|70[23]|959))\\\\d{3}\",[9]],[\"4(?:79[01]|83[0-36-9]|95[0-3])\\\\d{5}|4(?:[0-36]\\\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\\\d{6}\",[9]],[\"180(?:0\\\\d{3}|2)\\\\d{3}\",[7,10]],[\"190[0-26]\\\\d{6}\",[10]],0,0,0,0,[\"14(?:5(?:1[0458]|[23][458])|71\\\\d)\\\\d{4}\",[9]],[\"13(?:00\\\\d{6}(?:\\\\d{2})?|45[0-4]\\\\d{3})|13\\\\d{4}\",[6,8,10,12]]],\"0011\"],\"CD\":[\"243\",\"00\",\"(?:(?:[189]|5\\\\d)\\\\d|2)\\\\d{7}|[1-68]\\\\d{6}\",[7,8,9,10],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"88\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"[1-6]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"2\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[89]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"5\"],\"0$1\"]],\"0\"],\"CF\":[\"236\",\"00\",\"8776\\\\d{4}|(?:[27]\\\\d|61)\\\\d{6}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[26-8]\"]]]],\"CG\":[\"242\",\"00\",\"222\\\\d{6}|(?:0\\\\d|80)\\\\d{7}\",[9],[[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"8\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[02]\"]]]],\"CH\":[\"41\",\"00\",\"8\\\\d{11}|[2-9]\\\\d{8}\",[9,12],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"8[047]|90\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[2-79]|81\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4 $5\",[\"8\"],\"0$1\"]],\"0\"],\"CI\":[\"225\",\"00\",\"[02]\\\\d{9}\",[10],[[\"(\\\\d{2})(\\\\d{2})(\\\\d)(\\\\d{5})\",\"$1 $2 $3 $4\",[\"2\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3 $4\",[\"0\"]]]],\"CK\":[\"682\",\"00\",\"[2-578]\\\\d{4}\",[5],[[\"(\\\\d{2})(\\\\d{3})\",\"$1 $2\",[\"[2-578]\"]]]],\"CL\":[\"56\",\"(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0\",\"12300\\\\d{6}|6\\\\d{9,10}|[2-9]\\\\d{8}\",[9,10,11],[[\"(\\\\d{5})(\\\\d{4})\",\"$1 $2\",[\"219\",\"2196\"],\"($1)\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"60|809\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"44\"]],[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"2[1-36]\"],\"($1)\"],[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"9(?:10|[2-9])\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-8]|[1-9])\"],\"($1)\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"60|8\"]],[\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"60\"]]]],\"CM\":[\"237\",\"00\",\"[26]\\\\d{8}|88\\\\d{6,7}\",[8,9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"88\"]],[\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4 $5\",[\"[26]|88\"]]]],\"CN\":[\"86\",\"00|1(?:[12]\\\\d|79)\\\\d\\\\d00\",\"(?:(?:1[03-689]|2\\\\d)\\\\d\\\\d|6)\\\\d{8}|1\\\\d{10}|[126]\\\\d{6}(?:\\\\d(?:\\\\d{2})?)?|86\\\\d{5,6}|(?:[3-579]\\\\d|8[0-57-9])\\\\d{5,9}\",[7,8,9,10,11,12],[[\"(\\\\d{2})(\\\\d{5,6})\",\"$1 $2\",[\"(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]\",\"(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\\\d|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1\",\"10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\\\d|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12\",\"10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\\\d|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123\",\"10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\\\d|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{5,6})\",\"$1 $2\",[\"3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]\",\"(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:[17]\\\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\\\d|4[13]|5[1-5]))[19]\",\"85[23](?:10|95)|(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:[17]\\\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\\\d|4[13]|5[1-5]))(?:10|9[56])\",\"85[23](?:100|95)|(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:[17]\\\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\\\d|4[13]|5[1-5]))(?:100|9[56])\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"(?:4|80)0\"]],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"10|2(?:[02-57-9]|1[1-9])\",\"10|2(?:[02-57-9]|1[1-9])\",\"10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{7,8})\",\"$1 $2\",[\"9\"]],[\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"80\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"[3-578]\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"1[3-9]\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3 $4\",[\"[12]\"],\"0$1\",1]],\"0\",0,\"(1(?:[12]\\\\d|79)\\\\d\\\\d)|0\",0,0,0,0,\"00\"],\"CO\":[\"57\",\"00(?:4(?:[14]4|56)|[579])\",\"(?:46|60\\\\d\\\\d)\\\\d{6}|(?:1\\\\d|[39])\\\\d{9}\",[8,10,11],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"46\"]],[\"(\\\\d{3})(\\\\d{7})\",\"$1 $2\",[\"6|90\"],\"($1)\"],[\"(\\\\d{3})(\\\\d{7})\",\"$1 $2\",[\"3[0-357]|9[14]\"]],[\"(\\\\d)(\\\\d{3})(\\\\d{7})\",\"$1-$2-$3\",[\"1\"],\"0$1\",0,\"$1 $2 $3\"]],\"0\",0,\"0([3579]|4(?:[14]4|56))?\"],\"CR\":[\"506\",\"00\",\"(?:8\\\\d|90)\\\\d{8}|(?:[24-8]\\\\d{3}|3005)\\\\d{4}\",[8,10],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[2-7]|8[3-9]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1-$2-$3\",[\"[89]\"]]],0,0,\"(19(?:0[0-2468]|1[09]|20|66|77|99))\"],\"CU\":[\"53\",\"119\",\"(?:[2-7]|8\\\\d\\\\d)\\\\d{7}|[2-47]\\\\d{6}|[34]\\\\d{5}\",[6,7,8,10],[[\"(\\\\d{2})(\\\\d{4,6})\",\"$1 $2\",[\"2[1-4]|[34]\"],\"(0$1)\"],[\"(\\\\d)(\\\\d{6,7})\",\"$1 $2\",[\"7\"],\"(0$1)\"],[\"(\\\\d)(\\\\d{7})\",\"$1 $2\",[\"[56]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{7})\",\"$1 $2\",[\"8\"],\"0$1\"]],\"0\"],\"CV\":[\"238\",\"0\",\"(?:[2-59]\\\\d\\\\d|800)\\\\d{4}\",[7],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"[2-589]\"]]]],\"CW\":[\"599\",\"00\",\"(?:[34]1|60|(?:7|9\\\\d)\\\\d)\\\\d{5}\",[7,8],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[3467]\"]],[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"9[4-8]\"]]],0,0,0,0,0,\"[69]\"],\"CX\":[\"61\",\"001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011\",\"1(?:[0-79]\\\\d{8}(?:\\\\d{2})?|8[0-24-9]\\\\d{7})|[148]\\\\d{8}|1\\\\d{5,7}\",[6,7,8,9,10,12],0,\"0\",0,\"([59]\\\\d{7})$|0\",\"8$1\",0,0,[[\"8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\\\d|7(?:0[01]|1[0-2])|958))\\\\d{3}\",[9]],[\"4(?:79[01]|83[0-36-9]|95[0-3])\\\\d{5}|4(?:[0-36]\\\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\\\d{6}\",[9]],[\"180(?:0\\\\d{3}|2)\\\\d{3}\",[7,10]],[\"190[0-26]\\\\d{6}\",[10]],0,0,0,0,[\"14(?:5(?:1[0458]|[23][458])|71\\\\d)\\\\d{4}\",[9]],[\"13(?:00\\\\d{6}(?:\\\\d{2})?|45[0-4]\\\\d{3})|13\\\\d{4}\",[6,8,10,12]]],\"0011\"],\"CY\":[\"357\",\"00\",\"(?:[279]\\\\d|[58]0)\\\\d{6}\",[8],[[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"[257-9]\"]]]],\"CZ\":[\"420\",\"00\",\"(?:[2-578]\\\\d|60)\\\\d{7}|9\\\\d{8,11}\",[9,10,11,12],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[2-8]|9[015-7]\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"96\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"9\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"9\"]]]],\"DE\":[\"49\",\"00\",\"[2579]\\\\d{5,14}|49(?:[34]0|69|8\\\\d)\\\\d\\\\d?|49(?:37|49|60|7[089]|9\\\\d)\\\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\\\d{1,8}|(?:1|[368]\\\\d|4[0-8])\\\\d{3,13}|49(?:[015]\\\\d|2[13]|31|[46][1-8])\\\\d{1,9}\",[4,5,6,7,8,9,10,11,12,13,14,15],[[\"(\\\\d{2})(\\\\d{3,13})\",\"$1 $2\",[\"3[02]|40|[68]9\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3,12})\",\"$1 $2\",[\"2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1\",\"2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{2,11})\",\"$1 $2\",[\"[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]\",\"[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"138\"],\"0$1\"],[\"(\\\\d{5})(\\\\d{2,10})\",\"$1 $2\",[\"3\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{5,11})\",\"$1 $2\",[\"181\"],\"0$1\"],[\"(\\\\d{3})(\\\\d)(\\\\d{4,10})\",\"$1 $2 $3\",[\"1(?:3|80)|9\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{7,8})\",\"$1 $2\",[\"1[67]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{7,12})\",\"$1 $2\",[\"8\"],\"0$1\"],[\"(\\\\d{5})(\\\\d{6})\",\"$1 $2\",[\"185\",\"1850\",\"18500\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"7\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{7})\",\"$1 $2\",[\"18[68]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{7})\",\"$1 $2\",[\"15[1279]\"],\"0$1\"],[\"(\\\\d{5})(\\\\d{6})\",\"$1 $2\",[\"15[03568]\",\"15(?:[0568]|3[13])\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{8})\",\"$1 $2\",[\"18\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{7,8})\",\"$1 $2 $3\",[\"1(?:6[023]|7)\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{2})(\\\\d{7})\",\"$1 $2 $3\",[\"15[279]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{8})\",\"$1 $2 $3\",[\"15\"],\"0$1\"]],\"0\"],\"DJ\":[\"253\",\"00\",\"(?:2\\\\d|77)\\\\d{6}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[27]\"]]]],\"DK\":[\"45\",\"00\",\"[2-9]\\\\d{7}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[2-9]\"]]]],\"DM\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|767|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-7]\\\\d{6})$|1\",\"767$1\",0,\"767\"],\"DO\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,0,0,0,\"8001|8[024]9\"],\"DZ\":[\"213\",\"00\",\"(?:[1-4]|[5-79]\\\\d|80)\\\\d{7}\",[8,9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[1-4]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"9\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[5-8]\"],\"0$1\"]],\"0\"],\"EC\":[\"593\",\"00\",\"1\\\\d{9,10}|(?:[2-7]|9\\\\d)\\\\d{7}\",[8,9,10,11],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2-$3\",[\"[2-7]\"],\"(0$1)\",0,\"$1-$2-$3\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"9\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"1\"]]],\"0\"],\"EE\":[\"372\",\"00\",\"8\\\\d{9}|[4578]\\\\d{7}|(?:[3-8]\\\\d|90)\\\\d{5}\",[7,8,10],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88\",\"[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88\"]],[\"(\\\\d{4})(\\\\d{3,4})\",\"$1 $2\",[\"[45]|8(?:00|[1-49])\",\"[45]|8(?:00[1-9]|[1-49])\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"7\"]],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"8\"]]]],\"EG\":[\"20\",\"00\",\"[189]\\\\d{8,9}|[24-6]\\\\d{8}|[135]\\\\d{7}\",[8,9,10],[[\"(\\\\d)(\\\\d{7,8})\",\"$1 $2\",[\"[23]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{6,7})\",\"$1 $2\",[\"1[35]|[4-6]|8[2468]|9[235-7]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[89]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{8})\",\"$1 $2\",[\"1\"],\"0$1\"]],\"0\"],\"EH\":[\"212\",\"00\",\"[5-8]\\\\d{8}\",[9],0,\"0\",0,0,0,0,0,[[\"528[89]\\\\d{5}\"],[\"(?:6(?:[0-79]\\\\d|8[0-247-9])|7(?:[016-8]\\\\d|2[0-8]|5[0-5]))\\\\d{6}\"],[\"80[0-7]\\\\d{6}\"],[\"89\\\\d{7}\"],0,0,0,0,[\"(?:592(?:4[0-2]|93)|80[89]\\\\d\\\\d)\\\\d{4}\"]]],\"ER\":[\"291\",\"00\",\"[178]\\\\d{6}\",[7],[[\"(\\\\d)(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[178]\"],\"0$1\"]],\"0\"],\"ES\":[\"34\",\"00\",\"[5-9]\\\\d{8}\",[9],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[89]00\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[5-9]\"]]]],\"ET\":[\"251\",\"00\",\"(?:11|[2-57-9]\\\\d)\\\\d{7}\",[9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[1-57-9]\"],\"0$1\"]],\"0\"],\"FI\":[\"358\",\"00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))\",\"[1-35689]\\\\d{4}|7\\\\d{10,11}|(?:[124-7]\\\\d|3[0-46-9])\\\\d{8}|[1-9]\\\\d{5,8}\",[5,6,7,8,9,10,11,12],[[\"(\\\\d{5})\",\"$1\",[\"20[2-59]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3,7})\",\"$1 $2\",[\"(?:[1-3]0|[68])0|70[07-9]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4,8})\",\"$1 $2\",[\"[14]|2[09]|50|7[135]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{6,10})\",\"$1 $2\",[\"7\"],\"0$1\"],[\"(\\\\d)(\\\\d{4,9})\",\"$1 $2\",[\"(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9\"],\"0$1\"]],\"0\",0,0,0,0,\"1[03-79]|[2-9]\",0,\"00\"],\"FJ\":[\"679\",\"0(?:0|52)\",\"45\\\\d{5}|(?:0800\\\\d|[235-9])\\\\d{6}\",[7,11],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[235-9]|45\"]],[\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"0\"]]],0,0,0,0,0,0,0,\"00\"],\"FK\":[\"500\",\"00\",\"[2-7]\\\\d{4}\",[5]],\"FM\":[\"691\",\"00\",\"(?:[39]\\\\d\\\\d|820)\\\\d{4}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[389]\"]]]],\"FO\":[\"298\",\"00\",\"[2-9]\\\\d{5}\",[6],[[\"(\\\\d{6})\",\"$1\",[\"[2-9]\"]]],0,0,\"(10(?:01|[12]0|88))\"],\"FR\":[\"33\",\"00\",\"[1-9]\\\\d{8}\",[9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"8\"],\"0 $1\"],[\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4 $5\",[\"[1-79]\"],\"0$1\"]],\"0\"],\"GA\":[\"241\",\"00\",\"(?:[067]\\\\d|11)\\\\d{6}|[2-7]\\\\d{6}\",[7,8],[[\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[2-7]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"0\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"11|[67]\"],\"0$1\"]],0,0,\"0(11\\\\d{6}|60\\\\d{6}|61\\\\d{6}|6[256]\\\\d{6}|7[467]\\\\d{6})\",\"$1\"],\"GB\":[\"44\",\"00\",\"[1-357-9]\\\\d{9}|[18]\\\\d{8}|8\\\\d{6}\",[7,9,10],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"800\",\"8001\",\"80011\",\"800111\",\"8001111\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"845\",\"8454\",\"84546\",\"845464\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{6})\",\"$1 $2\",[\"800\"],\"0$1\"],[\"(\\\\d{5})(\\\\d{4,5})\",\"$1 $2\",[\"1(?:38|5[23]|69|76|94)\",\"1(?:(?:38|69)7|5(?:24|39)|768|946)\",\"1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{5,6})\",\"$1 $2\",[\"1(?:[2-69][02-9]|[78])\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"[25]|7(?:0|6[02-9])\",\"[25]|7(?:0|6(?:[03-9]|2[356]))\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{6})\",\"$1 $2\",[\"7\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[1389]\"],\"0$1\"]],\"0\",0,\"0|180020\",0,0,0,[[\"(?:1(?:1(?:3(?:[0-58]\\\\d\\\\d|73[0-5])|4(?:(?:[0-5]\\\\d|70)\\\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\\\d|6(?:[0-4]\\\\d|5[01]))\\\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\\\d)\\\\d|1(?:[0-7]\\\\d|8[0-3]))|(?:3(?:0\\\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\\\d)\\\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\\\d{3})\\\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\\\d)|76\\\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\\\d|7[4-79])|295[5-7]|35[34]\\\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\\\d{3}\",[9,10]],[\"7(?:457[0-57-9]|700[01]|911[028])\\\\d{5}|7(?:[1-3]\\\\d\\\\d|4(?:[0-46-9]\\\\d|5[0-689])|5(?:0[0-8]|[13-9]\\\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\\\d|8[02-9]|9[0-689])|8(?:[014-9]\\\\d|[23][0-8])|9(?:[024-9]\\\\d|1[02-9]|3[0-689]))\\\\d{6}\",[10]],[\"80[08]\\\\d{7}|800\\\\d{6}|8001111\"],[\"(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\\\d|8[2-49]))\\\\d{7}|845464\\\\d\",[7,10]],[\"70\\\\d{8}\",[10]],0,[\"(?:3[0347]|55)\\\\d{8}\",[10]],[\"76(?:464|652)\\\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\\\d{6}\",[10]],[\"56\\\\d{8}\",[10]]],0,\" x\"],\"GD\":[\"1\",\"011\",\"(?:473|[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-9]\\\\d{6})$|1\",\"473$1\",0,\"473\"],\"GE\":[\"995\",\"00\",\"(?:[3-57]\\\\d\\\\d|800)\\\\d{6}\",[9],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"70\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"32\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[57]\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[348]\"],\"0$1\"]],\"0\"],\"GF\":[\"594\",\"00\",\"(?:694\\\\d|7093)\\\\d{5}|(?:59|[89]\\\\d)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[5-7]|80[6-9]|9[47]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[89]\"],\"0$1\"]],\"0\"],\"GG\":[\"44\",\"00\",\"(?:1481|[357-9]\\\\d{3})\\\\d{6}|8\\\\d{6}(?:\\\\d{2})?\",[7,9,10],0,\"0\",0,\"([25-9]\\\\d{5})$|0|180020\",\"1481$1\",0,0,[[\"1481[25-9]\\\\d{5}\",[10]],[\"7(?:(?:781|839)\\\\d|911[17])\\\\d{5}\",[10]],[\"80[08]\\\\d{7}|800\\\\d{6}|8001111\"],[\"(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\\\d|8[0-3]))\\\\d{7}|845464\\\\d\",[7,10]],[\"70\\\\d{8}\",[10]],0,[\"(?:3[0347]|55)\\\\d{8}\",[10]],[\"76(?:464|652)\\\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\\\d{6}\",[10]],[\"56\\\\d{8}\",[10]]]],\"GH\":[\"233\",\"00\",\"[235]\\\\d{8}|800\\\\d{5,6}\",[8,9],[[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"8\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[2358]\"],\"0$1\"]],\"0\"],\"GI\":[\"350\",\"00\",\"(?:[25]\\\\d|60)\\\\d{6}\",[8],[[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"2\"]]]],\"GL\":[\"299\",\"00\",\"(?:19|[2-689]\\\\d|70)\\\\d{4}\",[6],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"19|[2-9]\"]]]],\"GM\":[\"220\",\"00\",\"[2-9]\\\\d{6}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[2-9]\"]]]],\"GN\":[\"224\",\"00\",\"722\\\\d{6}|(?:3|6\\\\d)\\\\d{7}\",[8,9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"3\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[67]\"]]]],\"GP\":[\"590\",\"00\",\"7090\\\\d{5}|(?:[56]9|[89]\\\\d)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[5-79]|80[6-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"8\"],\"0$1\"]],\"0\",0,0,0,0,0,[[\"(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\\\d)|87\\\\d)|80[6-9]\\\\d\\\\d)\\\\d{4}\"],[\"(?:69(?:0\\\\d\\\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\\\d{4}\"],[\"80[0-5]\\\\d{6}\"],[\"8[129]\\\\d{7}\"],0,0,0,0,[\"9(?:(?:39[5-7]|76[018])\\\\d|475[0-6])\\\\d{4}\"]]],\"GQ\":[\"240\",\"00\",\"222\\\\d{6}|(?:3\\\\d|55|[89]0)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[235]\"]],[\"(\\\\d{3})(\\\\d{6})\",\"$1 $2\",[\"[89]\"]]]],\"GR\":[\"30\",\"00\",\"5005000\\\\d{3}|8\\\\d{9,11}|(?:[269]\\\\d|70)\\\\d{8}\",[10,11,12],[[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"21|7\"]],[\"(\\\\d{4})(\\\\d{6})\",\"$1 $2\",[\"2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[2689]\"]],[\"(\\\\d{3})(\\\\d{3,4})(\\\\d{5})\",\"$1 $2 $3\",[\"8\"]]]],\"GT\":[\"502\",\"00\",\"80\\\\d{6}|(?:1\\\\d{3}|[2-7])\\\\d{7}\",[8,11],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[2-8]\"]],[\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"]]]],\"GU\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|671|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-9]\\\\d{6})$|1\",\"671$1\",0,\"671\"],\"GW\":[\"245\",\"00\",\"[49]\\\\d{8}|4\\\\d{6}\",[7,9],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"40\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[49]\"]]]],\"GY\":[\"592\",\"001\",\"(?:[2-8]\\\\d{3}|9008)\\\\d{3}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[2-9]\"]]]],\"HK\":[\"852\",\"00(?:30|5[09]|[126-9]?)\",\"8[0-46-9]\\\\d{6,7}|9\\\\d{4,7}|(?:[2-7]|9\\\\d{3})\\\\d{7}\",[5,6,7,8,9,11],[[\"(\\\\d{3})(\\\\d{2,5})\",\"$1 $2\",[\"900\",\"9003\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[2-7]|8[1-4]|9(?:0[1-9]|[1-8])\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"8\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"9\"]]],0,0,0,0,0,0,0,\"00\"],\"HN\":[\"504\",\"00\",\"8\\\\d{10}|[237-9]\\\\d{7}\",[8,11],[[\"(\\\\d{4})(\\\\d{4})\",\"$1-$2\",[\"[237-9]\"]]]],\"HR\":[\"385\",\"00\",\"[2-69]\\\\d{8}|80\\\\d{5,7}|[1-79]\\\\d{7}|6\\\\d{6}\",[7,8,9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"6[01]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2,3})\",\"$1 $2 $3\",[\"8\"],\"0$1\"],[\"(\\\\d)(\\\\d{4})(\\\\d{3})\",\"$1 $2 $3\",[\"1\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"6|7[245]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"9\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[2-57]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"8\"],\"0$1\"]],\"0\"],\"HT\":[\"509\",\"00\",\"[2-589]\\\\d{7}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"[2-589]\"]]]],\"HU\":[\"36\",\"00\",\"[235-7]\\\\d{8}|[1-9]\\\\d{7}\",[8,9],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"],\"(06 $1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]\"],\"(06 $1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[2-9]\"],\"06 $1\"]],\"06\"],\"ID\":[\"62\",\"00[89]\",\"00[1-9]\\\\d{9,14}|(?:[1-36]|8\\\\d{5})\\\\d{6}|00\\\\d{9}|[1-9]\\\\d{8,10}|[2-9]\\\\d{7}\",[7,8,9,10,11,12,13,14,15,16,17],[[\"(\\\\d)(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"15\"]],[\"(\\\\d{2})(\\\\d{5,9})\",\"$1 $2\",[\"2[124]|[36]1\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{5,7})\",\"$1 $2\",[\"800\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{5,8})\",\"$1 $2\",[\"[2-79]\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{3,4})(\\\\d{3})\",\"$1-$2-$3\",[\"8[1-35-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{6,8})\",\"$1 $2\",[\"1\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"804\"],\"0$1\"],[\"(\\\\d{3})(\\\\d)(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"80\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{4})(\\\\d{4,5})\",\"$1-$2-$3\",[\"8\"],\"0$1\"]],\"0\"],\"IE\":[\"353\",\"00\",\"(?:1\\\\d|[2569])\\\\d{6,8}|4\\\\d{6,9}|7\\\\d{8}|8\\\\d{8,9}\",[7,8,9,10],[[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"2[24-9]|47|58|6[237-9]|9[35-9]\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"[45]0\"],\"(0$1)\"],[\"(\\\\d)(\\\\d{3,4})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[2569]|4[1-69]|7[14]\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"70\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"81\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[78]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"1\"]],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"4\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3 $4\",[\"8\"],\"0$1\"]],\"0\"],\"IL\":[\"972\",\"0(?:0|1[2-9])\",\"1\\\\d{6}(?:\\\\d{3,5})?|[57]\\\\d{8}|[1-489]\\\\d{7}\",[7,8,9,10,11,12],[[\"(\\\\d{4})(\\\\d{3})\",\"$1-$2\",[\"125\"]],[\"(\\\\d{4})(\\\\d{2})(\\\\d{2})\",\"$1-$2-$3\",[\"121\"]],[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1-$2-$3\",[\"[2-489]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1-$2-$3\",[\"[57]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1-$2-$3\",[\"12\"]],[\"(\\\\d{4})(\\\\d{6})\",\"$1-$2\",[\"159\"]],[\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1-$2-$3-$4\",[\"1[7-9]\"]],[\"(\\\\d{3})(\\\\d{1,2})(\\\\d{3})(\\\\d{4})\",\"$1-$2 $3-$4\",[\"15\"]]],\"0\"],\"IM\":[\"44\",\"00\",\"1624\\\\d{6}|(?:[3578]\\\\d|90)\\\\d{8}\",[10],0,\"0\",0,\"([25-8]\\\\d{5})$|0|180020\",\"1624$1\",0,\"74576|(?:16|7[56])24\"],\"IN\":[\"91\",\"00\",\"(?:000800|[2-9]\\\\d\\\\d)\\\\d{7}|1\\\\d{7,12}\",[8,9,10,11,12,13],[[\"(\\\\d{8})\",\"$1\",[\"5(?:0|2[23]|3[03]|[67]1|88)\",\"5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)\",\"5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)\"],0,1],[\"(\\\\d{4})(\\\\d{4,5})\",\"$1 $2\",[\"180\",\"1800\"],0,1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"140\"],0,1],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"11|2[02]|33|4[04]|79[1-7]|80[2-46]\",\"11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])\",\"11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67)[14]\",\"1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31)|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]\",\"1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:3171|5[15][2-6]|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|8(?:16|2[014]|3[126]|6[136]|7[78]|83)(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]\"],\"0$1\",1],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|3[129]|5[29]|6[02-5]|70)|807\",\"1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7(?:[23569]|8[0-57-9])|8[1-6])|7(?:1(?:[013-8]|9[6-9])|3(?:17|2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]\",\"1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|8(?:28[235-7]|3))|73179|807(?:1|9[1-3])|(?:1552|6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578])\\\\d|7(?:[23569]\\\\d|8[0-57-9])|8(?:[14-6]\\\\d|2[0-79]))|7(?:1(?:[013-8]\\\\d|9[6-9])|3(?:2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\\\d|5[0-367])|70[13-7]))[2-7]\"],\"0$1\",1],[\"(\\\\d{5})(\\\\d{5})\",\"$1 $2\",[\"16|[6-9]\"],\"0$1\",1],[\"(\\\\d{4})(\\\\d{2,4})(\\\\d{4})\",\"$1 $2 $3\",[\"18[06]\",\"18[06]0\"],0,1],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"18\"],0,1]],\"0\"],\"IO\":[\"246\",\"00\",\"3\\\\d{6}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"3\"]]]],\"IQ\":[\"964\",\"00\",\"(?:1|7\\\\d\\\\d)\\\\d{7}|[2-6]\\\\d{7,8}\",[8,9,10],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[2-6]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"7\"],\"0$1\"]],\"0\"],\"IR\":[\"98\",\"00\",\"[1-9]\\\\d{9}|(?:[1-8]\\\\d\\\\d|9)\\\\d{3,4}\",[4,5,6,7,10],[[\"(\\\\d{4,5})\",\"$1\",[\"96\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4,5})\",\"$1 $2\",[\"(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"9\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"[1-8]\"],\"0$1\"]],\"0\"],\"IS\":[\"354\",\"00|1(?:0(?:01|[12]0)|100)\",\"(?:38\\\\d|[4-9])\\\\d{6}\",[7,9],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[4-9]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"3\"]]],0,0,0,0,0,0,0,\"00\"],\"IT\":[\"39\",\"00\",\"0\\\\d{5,11}|1\\\\d{8,10}|3(?:[0-8]\\\\d{7,10}|9\\\\d{7,8})|(?:43|55|70)\\\\d{8}|8\\\\d{5}(?:\\\\d{2,4})?\",[6,7,8,9,10,11,12],[[\"(\\\\d{2})(\\\\d{4,6})\",\"$1 $2\",[\"0[26]\"]],[\"(\\\\d{3})(\\\\d{3,6})\",\"$1 $2\",[\"0[13-57-9][0159]|8(?:03|4[17]|9[2-5])\",\"0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))\"]],[\"(\\\\d{4})(\\\\d{2,6})\",\"$1 $2\",[\"0(?:[13-579][2-46-8]|8[236-8])\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"894\"]],[\"(\\\\d{2})(\\\\d{3,4})(\\\\d{4})\",\"$1 $2 $3\",[\"0[26]|5\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"1(?:44|[679])|[378]|43\"]],[\"(\\\\d{3})(\\\\d{3,4})(\\\\d{4})\",\"$1 $2 $3\",[\"0[13-57-9][0159]|14\"]],[\"(\\\\d{2})(\\\\d{4})(\\\\d{5})\",\"$1 $2 $3\",[\"0[26]\"]],[\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"0\"]],[\"(\\\\d{3})(\\\\d{4})(\\\\d{4,5})\",\"$1 $2 $3\",[\"[03]\"]]],0,0,0,0,0,0,[[\"0(?:669[0-79]\\\\d{1,6}|831\\\\d{2,8})|0(?:1(?:[0159]\\\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\\\d\\\\d|3(?:[0159]\\\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\\\d|6[0-8])|7(?:[0159]\\\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\\\d{2,7}\"],[\"3[2-9]\\\\d{7,8}|(?:31|43)\\\\d{8}\",[9,10]],[\"80(?:0\\\\d{3}|3)\\\\d{3}\",[6,9]],[\"(?:0878\\\\d{3}|89(?:2\\\\d|3[04]|4(?:[0-4]|[5-9]\\\\d\\\\d)|5[0-4]))\\\\d\\\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\\\d{6}\",[6,8,9,10]],[\"1(?:78\\\\d|99)\\\\d{6}\",[9,10]],[\"3[2-8]\\\\d{9,10}\",[11,12]],0,0,[\"55\\\\d{8}\",[10]],[\"84(?:[08]\\\\d{3}|[17])\\\\d{3}\",[6,9]]]],\"JE\":[\"44\",\"00\",\"1534\\\\d{6}|(?:[3578]\\\\d|90)\\\\d{8}\",[10],0,\"0\",0,\"([0-24-8]\\\\d{5})$|0|180020\",\"1534$1\",0,0,[[\"1534[0-24-8]\\\\d{5}\"],[\"7(?:(?:(?:50|82)9|937)\\\\d|7(?:00[378]|97\\\\d))\\\\d{5}\"],[\"80(?:07(?:35|81)|8901)\\\\d{4}\"],[\"(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\\\d{4}\"],[\"701511\\\\d{4}\"],0,[\"(?:3(?:0(?:07(?:35|81)|8901)|3\\\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\\\d{4})\\\\d{4}\"],[\"76(?:464|652)\\\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\\\d{6}\"],[\"56\\\\d{8}\"]]],\"JM\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|658|900)\\\\d{7}\",[10],0,\"1\",0,0,0,0,\"658|876\"],\"JO\":[\"962\",\"00\",\"(?:(?:[2689]|7\\\\d)\\\\d|32|427|53)\\\\d{6}\",[8,9],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[2356]|87\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{5,6})\",\"$1 $2\",[\"[89]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{7})\",\"$1 $2\",[\"70\"],\"0$1\"],[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"[47]\"],\"0$1\"]],\"0\"],\"JP\":[\"81\",\"010\",\"00[1-9]\\\\d{6,14}|[25-9]\\\\d{9}|(?:00|[1-9]\\\\d\\\\d)\\\\d{6}\",[8,9,10,11,12,13,14,15,16,17],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1-$2-$3\",[\"(?:12|57|99)0\"],\"0$1\"],[\"(\\\\d{4})(\\\\d)(\\\\d{4})\",\"$1-$2-$3\",[\"1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])\",\"1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]\",\"1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1-$2-$3\",[\"60\"],\"0$1\"],[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1-$2-$3\",[\"3|4(?:2[09]|7[01])|6[1-9]\",\"3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1-$2-$3\",[\"1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])\",\"1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]\",\"1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{4})\",\"$1-$2-$3\",[\"[14]|[289][2-9]|5[3-9]|7[2-4679]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1-$2-$3\",[\"800\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1-$2-$3\",[\"[25-9]\"],\"0$1\"]],\"0\",0,\"(000[2569]\\\\d{4,6})$|(?:(?:003768)0?)|0\",\"$1\"],\"KE\":[\"254\",\"000\",\"(?:[17]\\\\d\\\\d|900)\\\\d{6}|(?:2|80)0\\\\d{6,7}|[4-6]\\\\d{6,8}\",[7,8,9,10],[[\"(\\\\d{2})(\\\\d{5,7})\",\"$1 $2\",[\"[24-6]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{6})\",\"$1 $2\",[\"[17]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[89]\"],\"0$1\"]],\"0\"],\"KG\":[\"996\",\"00\",\"8\\\\d{9}|[235-9]\\\\d{8}\",[9,10],[[\"(\\\\d{4})(\\\\d{5})\",\"$1 $2\",[\"3(?:1[346]|[24-79])\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[235-79]|88\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d)(\\\\d{2,3})\",\"$1 $2 $3 $4\",[\"8\"],\"0$1\"]],\"0\"],\"KH\":[\"855\",\"00[14-9]\",\"1\\\\d{9}|[1-9]\\\\d{7,8}\",[8,9,10],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[1-9]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"1\"]]],\"0\"],\"KI\":[\"686\",\"00\",\"(?:[37]\\\\d|6[0-79])\\\\d{6}|(?:[2-48]\\\\d|50)\\\\d{3}\",[5,8],0,\"0\"],\"KM\":[\"269\",\"00\",\"[3478]\\\\d{6}\",[7],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"[3478]\"]]]],\"KN\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-7]\\\\d{6})$|1\",\"869$1\",0,\"869\"],\"KP\":[\"850\",\"00|99\",\"85\\\\d{6}|(?:19\\\\d|[2-7])\\\\d{7}\",[8,10],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"8\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[2-7]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"],\"0$1\"]],\"0\"],\"KR\":[\"82\",\"00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))\",\"00[1-9]\\\\d{8,11}|(?:[12]|5\\\\d{3})\\\\d{7}|[13-6]\\\\d{9}|(?:[1-6]\\\\d|80)\\\\d{7}|[3-6]\\\\d{4,5}|(?:00|7)0\\\\d{8}\",[5,6,8,9,10,11,12,13,14],[[\"(\\\\d{2})(\\\\d{3,4})\",\"$1-$2\",[\"(?:3[1-3]|[46][1-4]|5[1-5])1\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{4})\",\"$1-$2\",[\"1\"]],[\"(\\\\d)(\\\\d{3,4})(\\\\d{4})\",\"$1-$2-$3\",[\"2\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1-$2-$3\",[\"[36]0|8\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3,4})(\\\\d{4})\",\"$1-$2-$3\",[\"[1346]|5[1-5]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1-$2-$3\",[\"[57]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{5})(\\\\d{4})\",\"$1-$2-$3\",[\"5\"],\"0$1\"]],\"0\",0,\"0(8(?:[1-46-8]|5\\\\d\\\\d))?\"],\"KW\":[\"965\",\"00\",\"18\\\\d{5}|(?:[2569]\\\\d|41)\\\\d{6}\",[7,8],[[\"(\\\\d{4})(\\\\d{3,4})\",\"$1 $2\",[\"[169]|2(?:[235]|4[1-35-9])|52\"]],[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"[245]\"]]]],\"KY\":[\"1\",\"011\",\"(?:345|[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-9]\\\\d{6})$|1\",\"345$1\",0,\"345\"],\"KZ\":[\"7\",\"810\",\"8\\\\d{13}|[78]\\\\d{9}\",[10,14],0,\"8\",0,0,0,0,\"7\",0,\"8~10\"],\"LA\":[\"856\",\"00\",\"[23]\\\\d{9}|3\\\\d{8}|(?:[235-8]\\\\d|41)\\\\d{6}\",[8,9,10],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"2[13]|3[14]|[4-8]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"3\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"[23]\"],\"0$1\"]],\"0\"],\"LB\":[\"961\",\"00\",\"[27-9]\\\\d{7}|[13-9]\\\\d{6}\",[7,8],[[\"(\\\\d)(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[13-69]|7(?:[2-57]|62|8[0-6]|9[04-9])|8[02-9]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[27-9]\"]]],\"0\"],\"LC\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|758|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-8]\\\\d{6})$|1\",\"758$1\",0,\"758\"],\"LI\":[\"423\",\"00\",\"[68]\\\\d{8}|(?:[2378]\\\\d|90)\\\\d{5}\",[7,9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"[2379]|8(?:0[09]|7)\",\"[2379]|8(?:0(?:02|9)|7)\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"8\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"69\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"6\"]]],\"0\",0,\"(1001)|0\"],\"LK\":[\"94\",\"00\",\"[1-9]\\\\d{8}\",[9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"7\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[1-689]\"],\"0$1\"]],\"0\"],\"LR\":[\"231\",\"00\",\"(?:[2457]\\\\d|33|88)\\\\d{7}|(?:2\\\\d|[4-6])\\\\d{6}\",[7,8,9],[[\"(\\\\d)(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"4[67]|[56]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"2\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[2-578]\"],\"0$1\"]],\"0\"],\"LS\":[\"266\",\"00\",\"(?:[256]\\\\d\\\\d|800)\\\\d{5}\",[8],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[2568]\"]]]],\"LT\":[\"370\",\"00\",\"(?:[3469]\\\\d|52|[78]0)\\\\d{6}\",[8],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"52[0-7]\"],\"(0-$1)\",1],[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"[7-9]\"],\"0 $1\",1],[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"37|4(?:[15]|6[1-8])\"],\"(0-$1)\",1],[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"[3-6]\"],\"(0-$1)\",1]],\"0\",0,\"[08]\"],\"LU\":[\"352\",\"00\",\"35[013-9]\\\\d{4,8}|6\\\\d{8}|35\\\\d{2,4}|(?:[2457-9]\\\\d|3[0-46-9])\\\\d{2,9}\",[4,5,6,7,8,9,10,11],[[\"(\\\\d{2})(\\\\d{3})\",\"$1 $2\",[\"2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"20[2-689]\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{1,2})\",\"$1 $2 $3 $4\",[\"20\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{1,5})\",\"$1 $2 $3 $4\",[\"[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"80[01]|90[015]\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"20\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"6\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{1,2})\",\"$1 $2 $3 $4 $5\",[\"20\"]]],0,0,\"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\\\d)\"],\"LV\":[\"371\",\"00\",\"(?:[268]\\\\d|78|90)\\\\d{6}\",[8],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[2679]|8[01]\"]]]],\"LY\":[\"218\",\"00\",\"[2-9]\\\\d{8}\",[9],[[\"(\\\\d{2})(\\\\d{7})\",\"$1-$2\",[\"[2-9]\"],\"0$1\"]],\"0\"],\"MA\":[\"212\",\"00\",\"[5-8]\\\\d{8}\",[9],[[\"(\\\\d{4})(\\\\d{5})\",\"$1-$2\",[\"892\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{7})\",\"$1-$2\",[\"8(?:0[0-7]|9)\"],\"0$1\"],[\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4 $5\",[\"[5-8]\"],\"0$1\"]],\"0\",0,0,0,0,\"[5-8]\"],\"MC\":[\"377\",\"00\",\"(?:[3489]|[67]\\\\d)\\\\d{7}\",[8,9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"4\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[389]\"]],[\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4 $5\",[\"[67]\"],\"0$1\"]],\"0\"],\"MD\":[\"373\",\"00\",\"(?:[235-7]\\\\d|[89]0)\\\\d{6}\",[8],[[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"[89]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"22|3\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"[25-7]\"],\"0$1\"]],\"0\"],\"ME\":[\"382\",\"00\",\"(?:20|[3-79]\\\\d)\\\\d{6}|80\\\\d{6,7}\",[8,9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[2-9]\"],\"0$1\"]],\"0\"],\"MF\":[\"590\",\"00\",\"7090\\\\d{5}|(?:[56]9|[89]\\\\d)\\\\d{7}\",[9],0,\"0\",0,0,0,0,0,[[\"(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\\\d)|80[6-9]\\\\d\\\\d)\\\\d{4}\"],[\"(?:69(?:0\\\\d\\\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\\\d{4}\"],[\"80[0-5]\\\\d{6}\"],[\"8[129]\\\\d{7}\"],0,0,0,0,[\"9(?:(?:39[5-7]|76[018])\\\\d|475[0-6])\\\\d{4}\"]]],\"MG\":[\"261\",\"00\",\"[23]\\\\d{8}\",[9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[23]\"],\"0$1\"]],\"0\",0,\"([24-9]\\\\d{6})$|0\",\"20$1\"],\"MH\":[\"692\",\"011\",\"329\\\\d{4}|(?:[256]\\\\d|45)\\\\d{5}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1-$2\",[\"[2-6]\"]]],\"1\"],\"MK\":[\"389\",\"00\",\"[2-578]\\\\d{7}\",[8],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"2|34[47]|4(?:[37]7|5[47]|64)\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[347]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d)(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[58]\"],\"0$1\"]],\"0\"],\"ML\":[\"223\",\"00\",\"[24-9]\\\\d{7}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[24-9]\"]]]],\"MM\":[\"95\",\"00\",\"1\\\\d{5,7}|95\\\\d{6}|(?:[4-7]|9[0-46-9])\\\\d{6,8}|(?:2|8\\\\d)\\\\d{5,8}\",[6,7,8,9,10],[[\"(\\\\d)(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"16|2\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[12]|452|678|86\",\"[12]|452|6788|86\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[4-7]|8[1-35]\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{4,6})\",\"$1 $2 $3\",[\"9(?:2[0-4]|[35-9]|4[137-9])\"],\"0$1\"],[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"2\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"8\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"92\"],\"0$1\"],[\"(\\\\d)(\\\\d{5})(\\\\d{4})\",\"$1 $2 $3\",[\"9\"],\"0$1\"]],\"0\"],\"MN\":[\"976\",\"001\",\"[12]\\\\d{7,9}|[5-9]\\\\d{7}\",[8,9,10],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"11|2[16]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[5-9]\"]],[\"(\\\\d{3})(\\\\d{5,6})\",\"$1 $2\",[\"[12]2[1-3]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{5,6})\",\"$1 $2\",[\"[12](?:27|3[2-8]|4[2-68]|5[1-4689])\",\"[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]\"],\"0$1\"],[\"(\\\\d{5})(\\\\d{4,5})\",\"$1 $2\",[\"[12]\"],\"0$1\"]],\"0\"],\"MO\":[\"853\",\"00\",\"0800\\\\d{3}|(?:28|[68]\\\\d)\\\\d{6}\",[7,8],[[\"(\\\\d{4})(\\\\d{3})\",\"$1 $2\",[\"0\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[268]\"]]]],\"MP\":[\"1\",\"011\",\"[58]\\\\d{9}|(?:67|90)0\\\\d{7}\",[10],0,\"1\",0,\"([2-9]\\\\d{6})$|1\",\"670$1\",0,\"670\"],\"MQ\":[\"596\",\"00\",\"7091\\\\d{5}|(?:[56]9|[89]\\\\d)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[5-79]|8(?:0[6-9]|[36])\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"8\"],\"0$1\"]],\"0\"],\"MR\":[\"222\",\"00\",\"(?:[2-4]\\\\d\\\\d|800)\\\\d{5}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[2-48]\"]]]],\"MS\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|664|900)\\\\d{7}\",[10],0,\"1\",0,\"([34]\\\\d{6})$|1\",\"664$1\",0,\"664\"],\"MT\":[\"356\",\"00\",\"3550\\\\d{4}|(?:[2579]\\\\d\\\\d|800)\\\\d{5}\",[8],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[2357-9]\"]]]],\"MU\":[\"230\",\"0(?:0|[24-7]0|3[03])\",\"(?:[57]|8\\\\d\\\\d)\\\\d{7}|[2-468]\\\\d{6}\",[7,8,10],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[2-46]|8[013]\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[57]\"]],[\"(\\\\d{5})(\\\\d{5})\",\"$1 $2\",[\"8\"]]],0,0,0,0,0,0,0,\"020\"],\"MV\":[\"960\",\"0(?:0|19)\",\"(?:800|9[0-57-9]\\\\d)\\\\d{7}|[34679]\\\\d{6}\",[7,10],[[\"(\\\\d{3})(\\\\d{4})\",\"$1-$2\",[\"[34679]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[89]\"]]],0,0,0,0,0,0,0,\"00\"],\"MW\":[\"265\",\"00\",\"(?:[1289]\\\\d|31|77)\\\\d{7}|1\\\\d{6}\",[7,9],[[\"(\\\\d)(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"1[2-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"2\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[137-9]\"],\"0$1\"]],\"0\"],\"MX\":[\"52\",\"0[09]\",\"[2-9]\\\\d{9}\",[10],[[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"33|5[56]|81\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[2-9]\"]]],0,0,0,0,0,0,0,\"00\"],\"MY\":[\"60\",\"00\",\"1\\\\d{8,9}|(?:3\\\\d|[4-9])\\\\d{7}\",[8,9,10],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1-$2 $3\",[\"[4-79]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1-$2 $3\",[\"1(?:[02469]|[378][1-9]|53)|8\",\"1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8\"],\"0$1\"],[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1-$2 $3\",[\"3\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{2})(\\\\d{4})\",\"$1-$2-$3-$4\",[\"1(?:[367]|80)\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1-$2 $3\",[\"15\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1-$2 $3\",[\"1\"],\"0$1\"]],\"0\"],\"MZ\":[\"258\",\"00\",\"(?:2|8\\\\d)\\\\d{7}\",[8,9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"2|8[2-79]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"8\"]]]],\"NA\":[\"264\",\"00\",\"[68]\\\\d{7,8}\",[8,9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"88\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"6\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"87\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"8\"],\"0$1\"]],\"0\"],\"NC\":[\"687\",\"00\",\"(?:050|[2-57-9]\\\\d\\\\d)\\\\d{3}\",[6],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1.$2.$3\",[\"[02-57-9]\"]]]],\"NE\":[\"227\",\"00\",\"[027-9]\\\\d{7}\",[8],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"08\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[089]|2[013]|7[0467]\"]]]],\"NF\":[\"672\",\"00\",\"[13]\\\\d{5}\",[6],[[\"(\\\\d{2})(\\\\d{4})\",\"$1 $2\",[\"1[0-3]\"]],[\"(\\\\d)(\\\\d{5})\",\"$1 $2\",[\"[13]\"]]],0,0,\"([0-258]\\\\d{4})$\",\"3$1\"],\"NG\":[\"234\",\"009\",\"(?:20|9\\\\d)\\\\d{8}|[78]\\\\d{9,13}\",[10,11,12,13,14],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[7-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"20[129]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"2\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{4})(\\\\d{4,5})\",\"$1 $2 $3\",[\"[78]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{5})(\\\\d{5,6})\",\"$1 $2 $3\",[\"[78]\"],\"0$1\"]],\"0\"],\"NI\":[\"505\",\"00\",\"(?:1800|[25-8]\\\\d{3})\\\\d{4}\",[8],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[125-8]\"]]]],\"NL\":[\"31\",\"00\",\"(?:[124-7]\\\\d\\\\d|3(?:[02-9]\\\\d|1[0-8]))\\\\d{6}|8\\\\d{6,9}|9\\\\d{6,10}|1\\\\d{4,5}\",[5,6,7,8,9,10,11],[[\"(\\\\d{3})(\\\\d{4,7})\",\"$1 $2\",[\"[89]0\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{7})\",\"$1 $2\",[\"66\"],\"0$1\"],[\"(\\\\d)(\\\\d{8})\",\"$1 $2\",[\"6\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"1[16-8]|2[259]|3[124]|4[17-9]|5[124679]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[1-578]|91\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{5})\",\"$1 $2 $3\",[\"9\"],\"0$1\"]],\"0\"],\"NO\":[\"47\",\"00\",\"(?:0|[2-9]\\\\d{3})\\\\d{4}\",[5,8],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"8\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[2-79]\"]]],0,0,0,0,0,\"[02-689]|7[0-8]\"],\"NP\":[\"977\",\"00\",\"(?:1\\\\d|9)\\\\d{9}|[1-9]\\\\d{7}\",[8,10,11],[[\"(\\\\d)(\\\\d{7})\",\"$1-$2\",[\"1[2-6]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{6})\",\"$1-$2\",[\"1[01]|[2-8]|9(?:[1-59]|[67][2-6])\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{7})\",\"$1-$2\",[\"9\"]]],\"0\"],\"NR\":[\"674\",\"00\",\"(?:222|444|(?:55|8\\\\d)\\\\d|666|777|999)\\\\d{4}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[24-9]\"]]]],\"NU\":[\"683\",\"00\",\"(?:[4-7]|888\\\\d)\\\\d{3}\",[4,7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"8\"]]]],\"NZ\":[\"64\",\"0(?:0|161)\",\"[1289]\\\\d{9}|50\\\\d{5}(?:\\\\d{2,3})?|[27-9]\\\\d{7,8}|(?:[34]\\\\d|6[0-35-9])\\\\d{6}|8\\\\d{4,6}\",[5,6,7,8,9,10],[[\"(\\\\d{2})(\\\\d{3,8})\",\"$1 $2\",[\"8[1-79]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2,3})\",\"$1 $2 $3\",[\"50[036-8]|8|90\",\"50(?:[0367]|88)|8|90\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"24|[346]|7[2-57-9]|9[2-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"2(?:10|74)|[589]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3,4})(\\\\d{4})\",\"$1 $2 $3\",[\"1|2[028]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,5})\",\"$1 $2 $3\",[\"2(?:[169]|7[0-35-9])|7\"],\"0$1\"]],\"0\",0,0,0,0,0,0,\"00\"],\"OM\":[\"968\",\"00\",\"(?:1505|[279]\\\\d{3}|500)\\\\d{4}|800\\\\d{5,6}\",[7,8,9],[[\"(\\\\d{3})(\\\\d{4,6})\",\"$1 $2\",[\"[58]\"]],[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"2\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[179]\"]]]],\"PA\":[\"507\",\"00\",\"(?:00800|8\\\\d{3})\\\\d{6}|[68]\\\\d{7}|[1-57-9]\\\\d{6}\",[7,8,10,11],[[\"(\\\\d{3})(\\\\d{4})\",\"$1-$2\",[\"[1-57-9]\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1-$2\",[\"[68]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"8\"]]]],\"PE\":[\"51\",\"00|19(?:1[124]|77|90)00\",\"(?:[14-8]|9\\\\d)\\\\d{7}\",[8,9],[[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"80\"],\"(0$1)\"],[\"(\\\\d)(\\\\d{7})\",\"$1 $2\",[\"1\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"[4-8]\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"9\"]]],\"0\",0,0,0,0,0,0,\"00\",\" Anexo \"],\"PF\":[\"689\",\"00\",\"4\\\\d{5}(?:\\\\d{2})?|8\\\\d{7,8}\",[6,8,9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"44\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"4|8[7-9]\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"8\"]]]],\"PG\":[\"675\",\"00|140[1-3]\",\"(?:180|[78]\\\\d{3})\\\\d{4}|(?:[2-589]\\\\d|64)\\\\d{5}\",[7,8],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"18|[2-69]|85\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[78]\"]]],0,0,0,0,0,0,0,\"00\"],\"PH\":[\"63\",\"00\",\"(?:[2-7]|9\\\\d)\\\\d{8}|2\\\\d{5}|(?:1800|8)\\\\d{7,9}\",[6,8,9,10,11,12,13],[[\"(\\\\d)(\\\\d{5})\",\"$1 $2\",[\"2\"],\"(0$1)\"],[\"(\\\\d{4})(\\\\d{4,6})\",\"$1 $2\",[\"3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2\",\"3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))\"],\"(0$1)\"],[\"(\\\\d{5})(\\\\d{4})\",\"$1 $2\",[\"346|4(?:27|9[35])|883\",\"3469|4(?:279|9(?:30|56))|8834\"],\"(0$1)\"],[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"2\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[3-7]|8[2-8]\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[89]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"]],[\"(\\\\d{4})(\\\\d{1,2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3 $4\",[\"1\"]]],\"0\"],\"PK\":[\"92\",\"00\",\"122\\\\d{6}|[24-8]\\\\d{10,11}|9(?:[013-9]\\\\d{8,10}|2(?:[01]\\\\d\\\\d|2(?:[06-8]\\\\d|1[01]))\\\\d{7})|(?:[2-8]\\\\d{3}|92(?:[0-7]\\\\d|8[1-9]))\\\\d{6}|[24-9]\\\\d{8}|[89]\\\\d{7}\",[8,9,10,11,12],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{2,7})\",\"$1 $2 $3\",[\"[89]0\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{5})\",\"$1 $2\",[\"1\"]],[\"(\\\\d{3})(\\\\d{6,7})\",\"$1 $2\",[\"2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])\",\"9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{7,8})\",\"$1 $2\",[\"(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]\"],\"(0$1)\"],[\"(\\\\d{5})(\\\\d{5})\",\"$1 $2\",[\"58\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{7})\",\"$1 $2\",[\"3\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"[24-9]\"],\"(0$1)\"]],\"0\"],\"PL\":[\"48\",\"00\",\"(?:6|8\\\\d\\\\d)\\\\d{7}|[1-9]\\\\d{6}(?:\\\\d{2})?|[26]\\\\d{5}\",[6,7,8,9,10],[[\"(\\\\d{5})\",\"$1\",[\"19\"]],[\"(\\\\d{3})(\\\\d{3})\",\"$1 $2\",[\"11|20|64\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1\",\"30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2,3})\",\"$1 $2 $3\",[\"64\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"1[2-8]|[2-7]|8[1-79]|9[145]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"8\"]]]],\"PM\":[\"508\",\"00\",\"[78]\\\\d{8}|[2-9]\\\\d{5}\",[6,9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"[2-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"7\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"8\"],\"0$1\"]],\"0\"],\"PR\":[\"1\",\"011\",\"(?:[589]\\\\d\\\\d|787)\\\\d{7}\",[10],0,\"1\",0,0,0,0,\"787|939\"],\"PS\":[\"970\",\"00\",\"[2489]2\\\\d{6}|(?:1\\\\d|5)\\\\d{8}\",[8,9,10],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[2489]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"5\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"1\"]]],\"0\"],\"PT\":[\"351\",\"00\",\"1693\\\\d{5}|(?:[26-9]\\\\d|30)\\\\d{7}\",[9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"2[12]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"16|[236-9]\"]]]],\"PW\":[\"680\",\"01[12]\",\"(?:[24-8]\\\\d\\\\d|345|900)\\\\d{4}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[2-9]\"]]]],\"PY\":[\"595\",\"00\",\"[36-8]\\\\d{5,8}|4\\\\d{6,8}|59\\\\d{6}|9\\\\d{5,10}|(?:2\\\\d|5[0-8])\\\\d{6,7}\",[6,7,8,9,10,11],[[\"(\\\\d{3})(\\\\d{3,6})\",\"$1 $2\",[\"[2-9]0\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"3[289]|4[246-8]|61|7[1-3]|8[1-36]\"],\"(0$1)\"],[\"(\\\\d{3})(\\\\d{4,5})\",\"$1 $2\",[\"2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"87\"]],[\"(\\\\d{3})(\\\\d{6})\",\"$1 $2\",[\"9(?:[5-79]|8[1-7])\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[2-8]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"9\"]]],\"0\"],\"QA\":[\"974\",\"00\",\"800\\\\d{4}|(?:2|800)\\\\d{6}|(?:0080|[3-7])\\\\d{7}\",[7,8,9,11],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"2[136]|8\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[3-7]\"]]]],\"RE\":[\"262\",\"00\",\"709\\\\d{6}|(?:26|[689]\\\\d)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[26-9]\"],\"0$1\"]],\"0\",0,0,0,0,0,[[\"2631[0-6]\\\\d{4}|26(?:2\\\\d|30|88)\\\\d{5}\"],[\"(?:69(?:2\\\\d\\\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\\\d{4}\"],[\"80\\\\d{7}\"],[\"89[1-37-9]\\\\d{6}\"],0,0,0,0,[\"9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\\\d{4}\"],[\"8(?:1[019]|2[0156]|84|90)\\\\d{6}\"]]],\"RO\":[\"40\",\"00\",\"(?:[236-8]\\\\d|90)\\\\d{7}|[23]\\\\d{5}\",[6,9],[[\"(\\\\d{3})(\\\\d{3})\",\"$1 $2\",[\"2[3-6]\",\"2[3-6]\\\\d9\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})\",\"$1 $2\",[\"219|31\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[23]1\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[236-9]\"],\"0$1\"]],\"0\",0,0,0,0,0,0,0,\" int \"],\"RS\":[\"381\",\"00\",\"38[02-9]\\\\d{6,9}|6\\\\d{7,9}|90\\\\d{4,8}|38\\\\d{5,6}|(?:7\\\\d\\\\d|800)\\\\d{3,9}|(?:[12]\\\\d|3[0-79])\\\\d{5,10}\",[6,7,8,9,10,11,12],[[\"(\\\\d{3})(\\\\d{3,9})\",\"$1 $2\",[\"(?:2[389]|39)0|[7-9]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{5,10})\",\"$1 $2\",[\"[1-36]\"],\"0$1\"]],\"0\"],\"RU\":[\"7\",\"810\",\"8\\\\d{13}|[347-9]\\\\d{9}\",[10,14],[[\"(\\\\d{4})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"7(?:1[0-8]|2[1-9])\",\"7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))\",\"7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2\"],\"8 ($1)\",1],[\"(\\\\d{5})(\\\\d)(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"7(?:1[0-68]|2[1-9])\",\"7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))\",\"7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]\"],\"8 ($1)\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"7\"],\"8 ($1)\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2-$3-$4\",[\"[349]|8(?:[02-7]|1[1-8])\"],\"8 ($1)\",1],[\"(\\\\d{4})(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"8\"],\"8 ($1)\"]],\"8\",0,0,0,0,\"[3489]\",0,\"8~10\"],\"RW\":[\"250\",\"00\",\"(?:06|[27]\\\\d\\\\d|[89]00)\\\\d{6}\",[8,9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"0\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"2\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[7-9]\"],\"0$1\"]],\"0\"],\"SA\":[\"966\",\"00\",\"(?:[15]\\\\d|800|92)\\\\d{7}\",[9,10],[[\"(\\\\d{4})(\\\\d{5})\",\"$1 $2\",[\"9\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"5\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"8\"]]],\"0\"],\"SB\":[\"677\",\"0[01]\",\"[6-9]\\\\d{6}|[1-6]\\\\d{4}\",[5,7],[[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])\"]]]],\"SC\":[\"248\",\"010|0[0-2]\",\"(?:[2489]\\\\d|64)\\\\d{5}\",[7],[[\"(\\\\d)(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[246]|9[57]\"]]],0,0,0,0,0,0,0,\"00\"],\"SD\":[\"249\",\"00\",\"[19]\\\\d{8}\",[9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[19]\"],\"0$1\"]],\"0\"],\"SE\":[\"46\",\"00\",\"(?:[26]\\\\d\\\\d|9)\\\\d{9}|[1-9]\\\\d{8}|[1-689]\\\\d{7}|[1-4689]\\\\d{6}|2\\\\d{5}\",[6,7,8,9,10,12],[[\"(\\\\d{2})(\\\\d{2,3})(\\\\d{2})\",\"$1-$2 $3\",[\"20\"],\"0$1\",0,\"$1 $2 $3\"],[\"(\\\\d{3})(\\\\d{4})\",\"$1-$2\",[\"9(?:00|39|44|9)\"],\"0$1\",0,\"$1 $2\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})\",\"$1-$2 $3\",[\"[12][136]|3[356]|4[0246]|6[03]|90[1-9]\"],\"0$1\",0,\"$1 $2 $3\"],[\"(\\\\d)(\\\\d{2,3})(\\\\d{2})(\\\\d{2})\",\"$1-$2 $3 $4\",[\"8\"],\"0$1\",0,\"$1 $2 $3 $4\"],[\"(\\\\d{3})(\\\\d{2,3})(\\\\d{2})\",\"$1-$2 $3\",[\"1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])\"],\"0$1\",0,\"$1 $2 $3\"],[\"(\\\\d{3})(\\\\d{2,3})(\\\\d{3})\",\"$1-$2 $3\",[\"9(?:00|39|44)\"],\"0$1\",0,\"$1 $2 $3\"],[\"(\\\\d{2})(\\\\d{2,3})(\\\\d{2})(\\\\d{2})\",\"$1-$2 $3 $4\",[\"1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]\"],\"0$1\",0,\"$1 $2 $3 $4\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1-$2 $3 $4\",[\"10|7\"],\"0$1\",0,\"$1 $2 $3 $4\"],[\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{2})\",\"$1-$2 $3 $4\",[\"8\"],\"0$1\",0,\"$1 $2 $3 $4\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1-$2 $3 $4\",[\"[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])\"],\"0$1\",0,\"$1 $2 $3 $4\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{3})\",\"$1-$2 $3 $4\",[\"9\"],\"0$1\",0,\"$1 $2 $3 $4\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1-$2 $3 $4 $5\",[\"[26]\"],\"0$1\",0,\"$1 $2 $3 $4 $5\"]],\"0\"],\"SG\":[\"65\",\"0[0-3]\\\\d\",\"(?:(?:1\\\\d|8)\\\\d\\\\d|7000)\\\\d{7}|[3689]\\\\d{7}\",[8,10,11],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[369]|8(?:0[1-9]|[1-9])\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"8\"]],[\"(\\\\d{4})(\\\\d{4})(\\\\d{3})\",\"$1 $2 $3\",[\"7\"]],[\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"1\"]]]],\"SH\":[\"290\",\"00\",\"(?:[256]\\\\d|8)\\\\d{3}\",[4,5],0,0,0,0,0,0,\"[256]\"],\"SI\":[\"386\",\"00|10(?:22|66|88|99)\",\"[1-7]\\\\d{7}|8\\\\d{4,7}|90\\\\d{4,6}\",[5,6,7,8],[[\"(\\\\d{2})(\\\\d{3,6})\",\"$1 $2\",[\"8[09]|9\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"59|8\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[37][01]|4[0139]|51|6\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[1-57]\"],\"(0$1)\"]],\"0\",0,0,0,0,0,0,\"00\"],\"SJ\":[\"47\",\"00\",\"0\\\\d{4}|(?:[489]\\\\d|79)\\\\d{6}\",[5,8],0,0,0,0,0,0,\"79\"],\"SK\":[\"421\",\"00\",\"[2-689]\\\\d{8}|[2-59]\\\\d{6}|[2-5]\\\\d{5}\",[6,7,9],[[\"(\\\\d)(\\\\d{2})(\\\\d{3,4})\",\"$1 $2 $3\",[\"21\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{2,3})\",\"$1 $2 $3\",[\"[3-5][1-8]1\",\"[3-5][1-8]1[67]\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"2\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[689]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[3-5]\"],\"0$1\"]],\"0\"],\"SL\":[\"232\",\"00\",\"(?:[237-9]\\\\d|66)\\\\d{6}\",[8],[[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"[236-9]\"],\"(0$1)\"]],\"0\"],\"SM\":[\"378\",\"00\",\"(?:0549|[5-7]\\\\d)\\\\d{6}\",[8,10],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[5-7]\"]],[\"(\\\\d{4})(\\\\d{6})\",\"$1 $2\",[\"0\"]]],0,0,\"([89]\\\\d{5})$\",\"0549$1\"],\"SN\":[\"221\",\"00\",\"(?:[378]\\\\d|93)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"8\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[379]\"]]]],\"SO\":[\"252\",\"00\",\"[346-9]\\\\d{8}|[12679]\\\\d{7}|[1-5]\\\\d{6}|[1348]\\\\d{5}\",[6,7,8,9],[[\"(\\\\d{2})(\\\\d{4})\",\"$1 $2\",[\"8[125]\"]],[\"(\\\\d{6})\",\"$1\",[\"[134]\"]],[\"(\\\\d)(\\\\d{6})\",\"$1 $2\",[\"[15]|2[0-79]|3[0-46-8]|4[0-7]\"]],[\"(\\\\d)(\\\\d{7})\",\"$1 $2\",[\"(?:2|90)4|[67]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[348]|64|79|90\"]],[\"(\\\\d{2})(\\\\d{5,7})\",\"$1 $2\",[\"1|28|6[0-35-9]|7[67]|9[2-9]\"]]],\"0\"],\"SR\":[\"597\",\"00\",\"(?:[2-5]|[6-9]\\\\d)\\\\d{5}\",[6,7],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1-$2-$3\",[\"56\"]],[\"(\\\\d{3})(\\\\d{3})\",\"$1-$2\",[\"[2-5]\"]],[\"(\\\\d{3})(\\\\d{4})\",\"$1-$2\",[\"[6-9]\"]]]],\"SS\":[\"211\",\"00\",\"[19]\\\\d{8}\",[9],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[19]\"],\"0$1\"]],\"0\"],\"ST\":[\"239\",\"00\",\"(?:22|9\\\\d)\\\\d{5}\",[7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[29]\"]]]],\"SV\":[\"503\",\"00\",\"[25-7]\\\\d{7}|(?:80\\\\d|900)\\\\d{4}(?:\\\\d{4})?\",[7,8,11],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[89]\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[25-7]\"]],[\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"[89]\"]]]],\"SX\":[\"1\",\"011\",\"7215\\\\d{6}|(?:[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"(5\\\\d{6})$|1\",\"721$1\",0,\"721\"],\"SY\":[\"963\",\"00\",\"[1-359]\\\\d{8}|[1-5]\\\\d{7}\",[8,9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[1-4]|5[1-3]\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[59]\"],\"0$1\",1]],\"0\"],\"SZ\":[\"268\",\"00\",\"0800\\\\d{4}|(?:[237]\\\\d|900)\\\\d{6}\",[8,9],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[0237]\"]],[\"(\\\\d{5})(\\\\d{4})\",\"$1 $2\",[\"9\"]]]],\"TA\":[\"290\",\"00\",\"8\\\\d{3}\",[4],0,0,0,0,0,0,\"8\"],\"TC\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|649|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-479]\\\\d{6})$|1\",\"649$1\",0,\"649\"],\"TD\":[\"235\",\"00|16\",\"(?:22|[3689]\\\\d|77)\\\\d{6}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[236-9]\"]]],0,0,0,0,0,0,0,\"00\"],\"TG\":[\"228\",\"00\",\"[279]\\\\d{7}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[279]\"]]]],\"TH\":[\"66\",\"00[1-9]\",\"(?:001800|[2-57]|[689]\\\\d)\\\\d{7}|1\\\\d{7,9}\",[8,9,10,13],[[\"(\\\\d)(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"2\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[13-9]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"1\"]]],\"0\"],\"TJ\":[\"992\",\"810\",\"(?:[0-57-9]\\\\d|66)\\\\d{7}\",[9],[[\"(\\\\d{6})(\\\\d)(\\\\d{2})\",\"$1 $2 $3\",[\"331\",\"3317\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"44[02-479]|[34]7\"]],[\"(\\\\d{4})(\\\\d)(\\\\d{4})\",\"$1 $2 $3\",[\"3(?:[1245]|3[12])\"]],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"\\\\d\"]]],0,0,0,0,0,0,0,\"8~10\"],\"TK\":[\"690\",\"00\",\"[2-47]\\\\d{3,6}\",[4,5,6,7]],\"TL\":[\"670\",\"00\",\"7\\\\d{7}|(?:[2-47]\\\\d|[89]0)\\\\d{5}\",[7,8],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[2-489]|70\"]],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"7\"]]]],\"TM\":[\"993\",\"810\",\"(?:[1-6]\\\\d|71)\\\\d{6}\",[8],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2-$3-$4\",[\"12\"],\"(8 $1)\"],[\"(\\\\d{3})(\\\\d)(\\\\d{2})(\\\\d{2})\",\"$1 $2-$3-$4\",[\"[1-5]\"],\"(8 $1)\"],[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"[67]\"],\"8 $1\"]],\"8\",0,0,0,0,0,0,\"8~10\"],\"TN\":[\"216\",\"00\",\"[2-57-9]\\\\d{7}\",[8],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[2-57-9]\"]]]],\"TO\":[\"676\",\"00\",\"(?:0800|(?:[5-8]\\\\d\\\\d|999)\\\\d)\\\\d{3}|[2-8]\\\\d{4}\",[5,7],[[\"(\\\\d{2})(\\\\d{3})\",\"$1-$2\",[\"[2-4]|50|6[09]|7[0-24-69]|8[05]\"]],[\"(\\\\d{4})(\\\\d{3})\",\"$1 $2\",[\"0\"]],[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[5-9]\"]]]],\"TR\":[\"90\",\"00\",\"4\\\\d{6}|8\\\\d{11,12}|(?:[2-58]\\\\d\\\\d|900)\\\\d{7}\",[7,10,12,13],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"512|8[01589]|90\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"5[0-79]\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[24][1-8]|3[1-9]\"],\"(0$1)\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{6,7})\",\"$1 $2 $3\",[\"80\"],\"0$1\",1]],\"0\"],\"TT\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-46-8]\\\\d{6})$|1\",\"868$1\",0,\"868\"],\"TV\":[\"688\",\"00\",\"(?:2|7\\\\d\\\\d|90)\\\\d{4}\",[5,6,7],[[\"(\\\\d{2})(\\\\d{3})\",\"$1 $2\",[\"2\"]],[\"(\\\\d{2})(\\\\d{4})\",\"$1 $2\",[\"90\"]],[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"7\"]]]],\"TW\":[\"886\",\"0(?:0[25-79]|19)\",\"[2-689]\\\\d{8}|7\\\\d{9,10}|[2-8]\\\\d{7}|2\\\\d{6}\",[7,8,9,10,11],[[\"(\\\\d{2})(\\\\d)(\\\\d{4})\",\"$1 $2 $3\",[\"202\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"826\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\",\"$1 $2 $3\",[\"83\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"82\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[25]0|37|49|8[09]\"],\"0$1\"],[\"(\\\\d)(\\\\d{3,4})(\\\\d{4})\",\"$1 $2 $3\",[\"[23568]|4(?:0[02-48]|[1-478])|7[1-9]\",\"[23568]|4(?:0[2-48]|[1-478])|(?:400|7)[1-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[49]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4,5})\",\"$1 $2 $3\",[\"7\"],\"0$1\"]],\"0\",0,0,0,0,0,0,0,\"#\"],\"TZ\":[\"255\",\"00[056]\",\"(?:[25-8]\\\\d|41|90)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"[89]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[24]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{7})\",\"$1 $2\",[\"5\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[67]\"],\"0$1\"]],\"0\"],\"UA\":[\"380\",\"00\",\"[89]\\\\d{9}|[3-9]\\\\d{8}\",[9,10],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]\",\"6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{5})\",\"$1 $2\",[\"3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])\",\"3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[3-7]|89|9[1-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[89]\"],\"0$1\"]],\"0\",0,0,0,0,0,0,\"0~0\"],\"UG\":[\"256\",\"00[057]\",\"800\\\\d{6}|(?:[29]0|[347]\\\\d)\\\\d{7}\",[9],[[\"(\\\\d{4})(\\\\d{5})\",\"$1 $2\",[\"202\",\"2024\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{6})\",\"$1 $2\",[\"[27-9]|4(?:6[45]|[7-9])\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{7})\",\"$1 $2\",[\"[34]\"],\"0$1\"]],\"0\"],\"US\":[\"1\",\"011\",\"[2-9]\\\\d{9}|3\\\\d{6}\",[10],[[\"(\\\\d{3})(\\\\d{4})\",\"$1-$2\",[\"310\"],0,1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"($1) $2-$3\",[\"[2-9]\"],0,1,\"$1-$2-$3\"]],\"1\",0,0,0,0,0,[[\"(?:274[27]|(?:472|983)[2-47-9])\\\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\\\d{6}\"],[\"\"],[\"8(?:00|33|44|55|66|77|88)[2-9]\\\\d{6}\"],[\"900[2-9]\\\\d{6}\"],[\"52(?:3(?:[2-46-9][02-9]\\\\d|5(?:[02-46-9]\\\\d|5[0-46-9]))|4(?:[2-478][02-9]\\\\d|5(?:[034]\\\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\\\d)|9(?:[05-9]\\\\d|2[0-5]|49)))\\\\d{4}|52[34][2-9]1[02-9]\\\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\\\d{6}\"]]],\"UY\":[\"598\",\"0(?:0|1[3-9]\\\\d)\",\"0004\\\\d{2,9}|[1249]\\\\d{7}|2\\\\d{3,4}|(?:[49]\\\\d|80)\\\\d{5}\",[4,5,6,7,8,9,10,11,12,13],[[\"(\\\\d{4,5})\",\"$1\",[\"21\"]],[\"(\\\\d{3})(\\\\d{3,4})\",\"$1 $2\",[\"0\"]],[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[49]0|8\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"9\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[124]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{2,4})\",\"$1 $2 $3\",[\"0\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})(\\\\d{2,4})\",\"$1 $2 $3 $4\",[\"0\"]]],\"0\",0,0,0,0,0,0,\"00\",\" int. \"],\"UZ\":[\"998\",\"00\",\"(?:20|33|[5-9]\\\\d)\\\\d{7}\",[9],[[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"[235-9]\"]]]],\"VA\":[\"39\",\"00\",\"0\\\\d{5,10}|3[0-8]\\\\d{7,10}|55\\\\d{8}|8\\\\d{5}(?:\\\\d{2,4})?|(?:1\\\\d|39)\\\\d{7,8}\",[6,7,8,9,10,11,12],0,0,0,0,0,0,\"06698\"],\"VC\":[\"1\",\"011\",\"(?:[58]\\\\d\\\\d|784|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-7]\\\\d{6})$|1\",\"784$1\",0,\"784\"],\"VE\":[\"58\",\"00\",\"[68]00\\\\d{7}|(?:[24]\\\\d|[59]0)\\\\d{8}\",[10],[[\"(\\\\d{3})(\\\\d{7})\",\"$1-$2\",[\"[24-689]\"],\"0$1\"]],\"0\"],\"VG\":[\"1\",\"011\",\"(?:284|[58]\\\\d\\\\d|900)\\\\d{7}\",[10],0,\"1\",0,\"([2-578]\\\\d{6})$|1\",\"284$1\",0,\"284\"],\"VI\":[\"1\",\"011\",\"[58]\\\\d{9}|(?:34|90)0\\\\d{7}\",[10],0,\"1\",0,\"([2-9]\\\\d{6})$|1\",\"340$1\",0,\"340\"],\"VN\":[\"84\",\"00\",\"[12]\\\\d{9}|[135-9]\\\\d{8}|[16]\\\\d{7}|[16-8]\\\\d{6}\",[7,8,9,10],[[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"80\"],\"0$1\",1],[\"(\\\\d{4})(\\\\d{4,6})\",\"$1 $2\",[\"1(?:2[02]|[89])\"],0,1],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"1[26]|6\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[357-9]\"],\"0$1\",1],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"2[48]\"],\"0$1\",1],[\"(\\\\d{3})(\\\\d{4})(\\\\d{3})\",\"$1 $2 $3\",[\"2\"],\"0$1\",1]],\"0\"],\"VU\":[\"678\",\"00\",\"[57-9]\\\\d{6}|(?:[238]\\\\d|48)\\\\d{3}\",[5,7],[[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"[57-9]\"]]]],\"WF\":[\"681\",\"00\",\"(?:40|72|8\\\\d{4})\\\\d{4}|[89]\\\\d{5}\",[6,9],[[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3\",[\"[47-9]\"]],[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\",\"$1 $2 $3 $4\",[\"8\"]]]],\"WS\":[\"685\",\"0\",\"(?:[2-6]|8\\\\d{5})\\\\d{4}|[78]\\\\d{6}|[68]\\\\d{5}\",[5,6,7,10],[[\"(\\\\d{5})\",\"$1\",[\"[2-5]|6[1-9]\"]],[\"(\\\\d{3})(\\\\d{3,7})\",\"$1 $2\",[\"[68]\"]],[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"7\"]]]],\"XK\":[\"383\",\"00\",\"2\\\\d{7,8}|3\\\\d{7,11}|(?:4\\\\d\\\\d|[89]00)\\\\d{5}\",[8,9,10,11,12],[[\"(\\\\d{3})(\\\\d{5})\",\"$1 $2\",[\"[89]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[2-4]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"2|39\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{7,10})\",\"$1 $2\",[\"3\"],\"0$1\"]],\"0\"],\"YE\":[\"967\",\"00\",\"(?:1|7\\\\d)\\\\d{7}|[1-7]\\\\d{6}\",[7,8,9],[[\"(\\\\d)(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"[1-6]|7(?:[24-6]|8[0-7])\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"7\"],\"0$1\"]],\"0\"],\"YT\":[\"262\",\"00\",\"(?:639\\\\d|7093)\\\\d{5}|(?:26|80|9\\\\d)\\\\d{7}\",[9],0,\"0\",0,0,0,0,0,[[\"26(?:89\\\\d|9(?:0[0-467]|15|5[0-4]|6\\\\d|[78]0))\\\\d{4}\"],[\"(?:639(?:0[0-79]|1[019]|[267]\\\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\\\d{4}\"],[\"80\\\\d{7}\"],0,0,0,0,0,[\"9(?:(?:39|47)8[01]|769\\\\d)\\\\d{4}\"]]],\"ZA\":[\"27\",\"00\",\"[1-79]\\\\d{8}|8\\\\d{4,9}\",[5,6,7,8,9,10],[[\"(\\\\d{2})(\\\\d{3,4})\",\"$1 $2\",[\"8[1-4]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{2,3})\",\"$1 $2 $3\",[\"8[1-4]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"860\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"[1-9]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"8\"],\"0$1\"]],\"0\"],\"ZM\":[\"260\",\"00\",\"800\\\\d{6}|(?:21|[579]\\\\d|63)\\\\d{7}\",[9],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[28]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{7})\",\"$1 $2\",[\"[579]\"],\"0$1\"]],\"0\"],\"ZW\":[\"263\",\"00\",\"2(?:[0-57-9]\\\\d{6,8}|6[0-24-9]\\\\d{6,7})|[38]\\\\d{9}|[35-8]\\\\d{8}|[3-6]\\\\d{7}|[1-689]\\\\d{6}|[1-3569]\\\\d{5}|[1356]\\\\d{4}\",[5,6,7,8,9,10],[[\"(\\\\d{3})(\\\\d{3,5})\",\"$1 $2\",[\"2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]\"],\"0$1\"],[\"(\\\\d)(\\\\d{3})(\\\\d{2,4})\",\"$1 $2 $3\",[\"[49]\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{4})\",\"$1 $2\",[\"80\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{7})\",\"$1 $2\",[\"24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2\",\"2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]\"],\"(0$1)\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"7\"],\"0$1\"],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)\",\"2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{6})\",\"$1 $2\",[\"8\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3,5})\",\"$1 $2\",[\"1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]\"],\"0$1\"],[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\",\"$1 $2 $3\",[\"29[013-9]|39|54\"],\"0$1\"],[\"(\\\\d{4})(\\\\d{3,5})\",\"$1 $2\",[\"(?:25|54)8\",\"258|5483\"],\"0$1\"]],\"0\"]},\"nonGeographic\":{\"800\":[\"800\",0,\"(?:00|[1-9]\\\\d)\\\\d{6}\",[8],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"\\\\d\"]]],0,0,0,0,0,0,[0,0,[\"(?:00|[1-9]\\\\d)\\\\d{6}\"]]],\"808\":[\"808\",0,\"[1-9]\\\\d{7}\",[8],[[\"(\\\\d{4})(\\\\d{4})\",\"$1 $2\",[\"[1-9]\"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,[\"[1-9]\\\\d{7}\"]]],\"870\":[\"870\",0,\"7\\\\d{11}|[235-7]\\\\d{8}\",[9,12],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"[235-7]\"]]],0,0,0,0,0,0,[0,[\"(?:[356]|774[45])\\\\d{8}|7[6-8]\\\\d{7}\"],0,0,0,0,0,0,[\"2\\\\d{8}\",[9]]]],\"878\":[\"878\",0,\"10\\\\d{10}\",[12],[[\"(\\\\d{2})(\\\\d{5})(\\\\d{5})\",\"$1 $2 $3\",[\"1\"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,[\"10\\\\d{10}\"]]],\"881\":[\"881\",0,\"6\\\\d{9}|[0-36-9]\\\\d{8}\",[9,10],[[\"(\\\\d)(\\\\d{3})(\\\\d{5})\",\"$1 $2 $3\",[\"[0-37-9]\"]],[\"(\\\\d)(\\\\d{3})(\\\\d{5,6})\",\"$1 $2 $3\",[\"6\"]]],0,0,0,0,0,0,[0,[\"6\\\\d{9}|[0-36-9]\\\\d{8}\"]]],\"882\":[\"882\",0,\"[13]\\\\d{6}(?:\\\\d{2,5})?|[19]\\\\d{7}|(?:[25]\\\\d\\\\d|4)\\\\d{7}(?:\\\\d{2})?\",[7,8,9,10,11,12],[[\"(\\\\d{2})(\\\\d{5})\",\"$1 $2\",[\"16|342\"]],[\"(\\\\d{2})(\\\\d{6})\",\"$1 $2\",[\"49\"]],[\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\",\"$1 $2 $3\",[\"1[36]|9\"]],[\"(\\\\d{2})(\\\\d{4})(\\\\d{3})\",\"$1 $2 $3\",[\"3[23]\"]],[\"(\\\\d{2})(\\\\d{3,4})(\\\\d{4})\",\"$1 $2 $3\",[\"16\"]],[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"10|23|3(?:[15]|4[57])|4|5[12]\"]],[\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"34\"]],[\"(\\\\d{2})(\\\\d{4,5})(\\\\d{5})\",\"$1 $2 $3\",[\"[1-35]\"]]],0,0,0,0,0,0,[0,[\"342\\\\d{4}|(?:337|49)\\\\d{6}|(?:3(?:2|47|7\\\\d{3})|5(?:0\\\\d{3}|2[0-2]))\\\\d{7}\",[7,8,9,10,12]],0,0,0,[\"348[57]\\\\d{7}\",[11]],0,0,[\"1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\\\d{4}|6\\\\d{5,10})|(?:345\\\\d|9[89])\\\\d{6}|(?:10|2(?:3|85\\\\d)|3(?:[15]|[69]\\\\d\\\\d)|4[15-8]|51)\\\\d{8}\"]]],\"883\":[\"883\",0,\"(?:[1-4]\\\\d|51)\\\\d{6,10}\",[8,9,10,11,12],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{2,8})\",\"$1 $2 $3\",[\"[14]|2[24-689]|3[02-689]|51[24-9]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3\",[\"510\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\",\"$1 $2 $3\",[\"21\"]],[\"(\\\\d{4})(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"51[13]\"]],[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})(\\\\d{3})\",\"$1 $2 $3 $4\",[\"[235]\"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,[\"(?:2(?:00\\\\d\\\\d|10)|(?:370[1-9]|51\\\\d0)\\\\d)\\\\d{7}|51(?:00\\\\d{5}|[24-9]0\\\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\\\d{5,9}\"]]],\"888\":[\"888\",0,\"\\\\d{11}\",[11],[[\"(\\\\d{3})(\\\\d{3})(\\\\d{5})\",\"$1 $2 $3\"]],0,0,0,0,0,0,[0,0,0,0,0,0,[\"\\\\d{11}\"]]],\"979\":[\"979\",0,\"[1359]\\\\d{8}\",[9],[[\"(\\\\d)(\\\\d{4})(\\\\d{4})\",\"$1 $2 $3\",[\"[1359]\"]]],0,0,0,0,0,0,[0,0,0,[\"[1359]\\\\d{8}\"]]]}}","// Importing from a \".js\" file is a workaround for Node.js \"ES Modules\"\r\n// importing system which is even uncapable of importing \"*.json\" files.\r\nimport metadata from '../../metadata.min.json.js'\r\n\r\nexport default function withMetadataArgument(func, _arguments) {\r\n\tvar args = Array.prototype.slice.call(_arguments)\r\n\targs.push(metadata)\r\n\treturn func.apply(this, args)\r\n}","// Copy-pasted from:\n// https://github.com/substack/semver-compare/blob/master/index.js\n//\n// Inlining this function because some users reported issues with\n// importing from `semver-compare` in a browser with ES6 \"native\" modules.\n//\n// Fixes `semver-compare` not being able to compare versions with alpha/beta/etc \"tags\".\n// https://github.com/catamphetamine/libphonenumber-js/issues/381\nexport default function (a, b) {\n a = a.split('-');\n b = b.split('-');\n var pa = a[0].split('.');\n var pb = b[0].split('.');\n for (var i = 0; i < 3; i++) {\n var na = Number(pa[i]);\n var nb = Number(pb[i]);\n if (na > nb) return 1;\n if (nb > na) return -1;\n if (!isNaN(na) && isNaN(nb)) return 1;\n if (isNaN(na) && !isNaN(nb)) return -1;\n }\n if (a[1] && b[1]) {\n return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;\n }\n return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;\n}\n//# sourceMappingURL=semver-compare.js.map","var objectConstructor = {}.constructor;\nexport default function isObject(object) {\n return object !== undefined && object !== null && object.constructor === objectConstructor;\n}\n//# sourceMappingURL=isObject.js.map","var CALLING_CODE_REG_EXP = /^\\d+$/;\nexport default function isCallingCode(string) {\n return CALLING_CODE_REG_EXP.test(string);\n}\n//# sourceMappingURL=isCallingCode.js.map","function _readOnlyError(r) { throw new TypeError('\"' + r + '\" is read-only'); }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport compare from './tools/semver-compare.js';\nimport isObject from './helpers/isObject.js';\nimport isCallingCode from './helpers/isCallingCode.js';\n\n// Added \"possibleLengths\" and renamed\n// \"country_phone_code_to_countries\" to \"country_calling_codes\".\nvar V2 = '1.0.18';\n\n// Added \"idd_prefix\" and \"default_idd_prefix\".\nvar V3 = '1.2.0';\n\n// Moved `001` country code to \"nonGeographic\" section of metadata.\nvar V4 = '1.7.35';\nvar DEFAULT_EXT_PREFIX = ' ext. ';\n\n/**\r\n * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md\r\n */\nvar Metadata = /*#__PURE__*/function () {\n /**\r\n * @param {object} metadata — Metadata JSON.\r\n */\n function Metadata(metadata) {\n _classCallCheck(this, Metadata);\n validateMetadata(metadata);\n this.metadata = metadata;\n setVersion.call(this, metadata);\n }\n return _createClass(Metadata, [{\n key: \"getCountries\",\n value: function getCountries() {\n return Object.keys(this.metadata.countries).filter(function (_) {\n return _ !== '001';\n });\n }\n }, {\n key: \"getCountryMetadata\",\n value: function getCountryMetadata(countryCode) {\n return this.metadata.countries[countryCode];\n }\n }, {\n key: \"nonGeographic\",\n value: function nonGeographic() {\n if (this.v1 || this.v2 || this.v3) return;\n // `nonGeographical` was a typo.\n // It's present in metadata generated from `1.7.35` to `1.7.37`.\n // The test case could be found by searching for \"nonGeographical\".\n return this.metadata.nonGeographic || this.metadata.nonGeographical;\n }\n }, {\n key: \"hasCountry\",\n value: function hasCountry(country) {\n return this.getCountryMetadata(country) !== undefined;\n }\n }, {\n key: \"hasCallingCode\",\n value: function hasCallingCode(callingCode) {\n if (this.getCountryCodesForCallingCode(callingCode)) {\n return true;\n }\n if (this.nonGeographic()) {\n if (this.nonGeographic()[callingCode]) {\n return true;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n var countryCodes = this.countryCallingCodes()[callingCode];\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return true;\n }\n }\n }\n }, {\n key: \"isNonGeographicCallingCode\",\n value: function isNonGeographicCallingCode(callingCode) {\n if (this.nonGeographic()) {\n return this.nonGeographic()[callingCode] ? true : false;\n } else {\n return this.getCountryCodesForCallingCode(callingCode) ? false : true;\n }\n }\n\n // Deprecated.\n }, {\n key: \"country\",\n value: function country(countryCode) {\n return this.selectNumberingPlan(countryCode);\n }\n\n /**\r\n * Selects a telephone numbering plan based on either a country code or a calling code.\r\n * @param {string} argument — Country code or calling code.\r\n * @param {string} legacyArgumentCallingCode — Legacy argument: calling code, if the first argument is not passed.\r\n */\n }, {\n key: \"selectNumberingPlan\",\n value: function selectNumberingPlan(argument, legacyArgumentCallingCode) {\n var countryCode;\n var callingCode;\n if (argument) {\n if (isCallingCode(argument)) {\n callingCode = argument;\n } else {\n countryCode = argument;\n }\n }\n // Previously, the signature of this method was: `.selectNumberingPlan(country, callingCode)`.\n // And if `country` argument wasn't passed, it looked into the second argument `callingCode`.\n // Now it's preferred to only pass either `country` or `callingCode` as the first argument.\n if (legacyArgumentCallingCode) {\n callingCode = legacyArgumentCallingCode;\n }\n\n // Select a telephone numbering plan.\n if (countryCode && countryCode !== '001') {\n var countryMetadata = this.getCountryMetadata(countryCode);\n if (!countryMetadata) {\n throw new Error(\"Unknown country: \".concat(countryCode));\n }\n this.numberingPlan = new NumberingPlan(countryMetadata, this);\n } else if (callingCode) {\n if (!this.hasCallingCode(callingCode)) {\n throw new Error(\"Unknown calling code: \".concat(callingCode));\n }\n this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);\n } else {\n this.numberingPlan = undefined;\n }\n return this;\n }\n }, {\n key: \"getCountryCodesForCallingCode\",\n value: function getCountryCodesForCallingCode(callingCode) {\n var countryCodes = this.countryCallingCodes()[callingCode];\n if (countryCodes) {\n // Metadata before V4 included \"non-geographic entity\" calling codes\n // inside `country_calling_codes` (for example, `\"881\":[\"001\"]`).\n // Now the semantics of `country_calling_codes` has changed:\n // it's specifically for \"countries\" now.\n // Older versions of custom metadata will simply skip parsing\n // \"non-geographic entity\" phone numbers with new versions\n // of this library: it's not considered a bug,\n // because such numbers are extremely rare,\n // and developers extremely rarely use custom metadata.\n if (countryCodes.length === 1 && countryCodes[0].length === 3) {\n return;\n }\n return countryCodes;\n }\n }\n }, {\n key: \"getCountryCodeForCallingCode\",\n value: function getCountryCodeForCallingCode(callingCode) {\n var countryCodes = this.getCountryCodesForCallingCode(callingCode);\n if (countryCodes) {\n return countryCodes[0];\n }\n }\n }, {\n key: \"getNumberingPlanMetadata\",\n value: function getNumberingPlanMetadata(callingCode) {\n // If a calling code is specified, choose the telephone numbering plan\n // of the \"default\" country for this calling code.\n // For example, if calling code `1` is passed,\n // the telephone numbering plan of `US` will be selected.\n var countryCode = this.getCountryCodeForCallingCode(callingCode);\n if (countryCode) {\n return this.getCountryMetadata(countryCode);\n }\n if (this.nonGeographic()) {\n var metadata = this.nonGeographic()[callingCode];\n if (metadata) {\n return metadata;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n // In that metadata, there was no concept of \"non-geographic\" metadata\n // so metadata for `001` country code was stored along with other countries.\n // The test case can be found by searching for:\n // \"should work around `nonGeographic` metadata not existing\".\n var countryCodes = this.countryCallingCodes()[callingCode];\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return this.metadata.countries['001'];\n }\n }\n }\n\n // Deprecated.\n }, {\n key: \"countryCallingCode\",\n value: function countryCallingCode() {\n return this.numberingPlan.callingCode();\n }\n\n // Deprecated.\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n return this.numberingPlan.IDDPrefix();\n }\n\n // Deprecated.\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n return this.numberingPlan.defaultIDDPrefix();\n }\n\n // Deprecated.\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n return this.numberingPlan.nationalNumberPattern();\n }\n\n // Deprecated.\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n return this.numberingPlan.possibleLengths();\n }\n\n // Deprecated.\n }, {\n key: \"formats\",\n value: function formats() {\n return this.numberingPlan.formats();\n }\n\n // Deprecated.\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n return this.numberingPlan.nationalPrefixForParsing();\n }\n\n // Deprecated.\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.numberingPlan.nationalPrefixTransformRule();\n }\n\n // Deprecated.\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.numberingPlan.leadingDigits();\n }\n\n // Deprecated.\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n return this.numberingPlan.hasTypes();\n }\n\n // Deprecated.\n }, {\n key: \"type\",\n value: function type(_type) {\n return this.numberingPlan.type(_type);\n }\n\n // Deprecated.\n }, {\n key: \"ext\",\n value: function ext() {\n return this.numberingPlan.ext();\n }\n }, {\n key: \"countryCallingCodes\",\n value: function countryCallingCodes() {\n if (this.v1) return this.metadata.country_phone_code_to_countries;\n return this.metadata.country_calling_codes;\n }\n\n // Deprecated.\n }, {\n key: \"chooseCountryByCountryCallingCode\",\n value: function chooseCountryByCountryCallingCode(callingCode) {\n return this.selectNumberingPlan(callingCode);\n }\n }, {\n key: \"hasSelectedNumberingPlan\",\n value: function hasSelectedNumberingPlan() {\n return this.numberingPlan !== undefined;\n }\n }]);\n}();\nexport { Metadata as default };\nvar NumberingPlan = /*#__PURE__*/function () {\n function NumberingPlan(metadata, globalMetadataObject) {\n _classCallCheck(this, NumberingPlan);\n this.globalMetadataObject = globalMetadataObject;\n this.metadata = metadata;\n setVersion.call(this, globalMetadataObject.metadata);\n }\n return _createClass(NumberingPlan, [{\n key: \"callingCode\",\n value: function callingCode() {\n return this.metadata[0];\n }\n\n // When multiple countries share the same calling code,\n // all phone number formatting rules are included in the metadata\n // of the \"default\" country for that calling code.\n // Any other countries' metdata doesn't include any formatting rules.\n // Google developers said that such storage architecture was chosen for performance reasons.\n //\n // For example, for NANPA region (\"North American Numbering Plan Administration\",\n // which includes USA, Canada, Cayman Islands, Bahamas, etc) all formatting rules\n // are contained in the metadata of `US` country.\n //\n // This is not public API.\n //\n }, {\n key: \"_getDefaultCountryMetadataForThisCallingCode\",\n value: function _getDefaultCountryMetadataForThisCallingCode() {\n return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());\n }\n\n // Deprecated.\n }, {\n key: \"getDefaultCountryMetadataForRegion\",\n value: function getDefaultCountryMetadataForRegion() {\n return this._getDefaultCountryMetadataForThisCallingCode();\n }\n\n // Is always present.\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[1];\n }\n\n // Is only present when a country supports multiple IDD prefixes.\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[12];\n }\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n if (this.v1 || this.v2) return this.metadata[1];\n return this.metadata[2];\n }\n\n // \"possible length\" data is always present in Google's metadata.\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.v1) return;\n return this.metadata[this.v2 ? 2 : 3];\n }\n }, {\n key: \"_getFormats\",\n value: function _getFormats(metadata) {\n return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];\n }\n\n // For countries of the same region (e.g. NANPA)\n // formats are all stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n }, {\n key: \"formats\",\n value: function formats() {\n var _this = this;\n var formats = this._getFormats(this.metadata) || this._getFormats(this._getDefaultCountryMetadataForThisCallingCode()) || [];\n return formats.map(function (_) {\n return new Format(_, _this);\n });\n }\n }, {\n key: \"nationalPrefix\",\n value: function nationalPrefix() {\n return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];\n }\n }, {\n key: \"_getNationalPrefixFormattingRule\",\n value: function _getNationalPrefixFormattingRule(metadata) {\n return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];\n }\n\n // For countries of the same region (e.g. NANPA)\n // national prefix formatting rule is stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this._getDefaultCountryMetadataForThisCallingCode());\n }\n }, {\n key: \"_nationalPrefixForParsing\",\n value: function _nationalPrefixForParsing() {\n return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];\n }\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n // If `national_prefix_for_parsing` is not set explicitly,\n // then infer it from `national_prefix` (if any)\n return this._nationalPrefixForParsing() || this.nationalPrefix();\n }\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];\n }\n }, {\n key: \"_getNationalPrefixIsOptionalWhenFormatting\",\n value: function _getNationalPrefixIsOptionalWhenFormatting() {\n return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];\n }\n\n // For countries of the same region (e.g. NANPA)\n // \"national prefix is optional when formatting\" flag is\n // stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this._getDefaultCountryMetadataForThisCallingCode());\n }\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];\n }\n }, {\n key: \"types\",\n value: function types() {\n return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];\n }\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n // Versions 1.2.0 - 1.2.4: can be `[]`.\n /* istanbul ignore next */\n if (this.types() && this.types().length === 0) {\n return false;\n }\n // Versions <= 1.2.4: can be `undefined`.\n // Version >= 1.2.5: can be `0`.\n return !!this.types();\n }\n }, {\n key: \"type\",\n value: function type(_type2) {\n if (this.hasTypes() && getType(this.types(), _type2)) {\n return new Type(getType(this.types(), _type2), this);\n }\n }\n }, {\n key: \"ext\",\n value: function ext() {\n if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;\n return this.metadata[13] || DEFAULT_EXT_PREFIX;\n }\n }]);\n}();\nvar Format = /*#__PURE__*/function () {\n function Format(format, metadata) {\n _classCallCheck(this, Format);\n this._format = format;\n this.metadata = metadata;\n }\n return _createClass(Format, [{\n key: \"pattern\",\n value: function pattern() {\n return this._format[0];\n }\n }, {\n key: \"format\",\n value: function format() {\n return this._format[1];\n }\n }, {\n key: \"leadingDigitsPatterns\",\n value: function leadingDigitsPatterns() {\n return this._format[2] || [];\n }\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._format[3] || this.metadata.nationalPrefixFormattingRule();\n }\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n }\n }, {\n key: \"nationalPrefixIsMandatoryWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {\n // National prefix is omitted if there's no national prefix formatting rule\n // set for this country, or when the national prefix formatting rule\n // contains no national prefix itself, or when this rule is set but\n // national prefix is optional for this phone number format\n // (and it is not enforced explicitly)\n return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n }\n\n // Checks whether national prefix formatting rule contains national prefix.\n }, {\n key: \"usesNationalPrefix\",\n value: function usesNationalPrefix() {\n return this.nationalPrefixFormattingRule() &&\n // Check that national prefix formatting rule is not a \"dummy\" one.\n !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule())\n // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`\n // when `national_prefix_formatting_rule` is not present.\n // So, `true` or `false` are returned explicitly here, so that\n // `0` number isn't returned.\n ? true : false;\n }\n }, {\n key: \"internationalFormat\",\n value: function internationalFormat() {\n return this._format[5] || this.format();\n }\n }]);\n}();\n/**\r\n * A pattern that is used to determine if the national prefix formatting rule\r\n * has the first group only, i.e., does not start with the national prefix.\r\n * Note that the pattern explicitly allows for unbalanced parentheses.\r\n */\nvar FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\\(?\\$1\\)?$/;\nvar Type = /*#__PURE__*/function () {\n function Type(type, metadata) {\n _classCallCheck(this, Type);\n this.type = type;\n this.metadata = metadata;\n }\n return _createClass(Type, [{\n key: \"pattern\",\n value: function pattern() {\n if (this.metadata.v1) return this.type;\n return this.type[0];\n }\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.metadata.v1) return;\n return this.type[1] || this.metadata.possibleLengths();\n }\n }]);\n}();\nfunction getType(types, type) {\n switch (type) {\n case 'FIXED_LINE':\n return types[0];\n case 'MOBILE':\n return types[1];\n case 'TOLL_FREE':\n return types[2];\n case 'PREMIUM_RATE':\n return types[3];\n case 'PERSONAL_NUMBER':\n return types[4];\n case 'VOICEMAIL':\n return types[5];\n case 'UAN':\n return types[6];\n case 'PAGER':\n return types[7];\n case 'VOIP':\n return types[8];\n case 'SHARED_COST':\n return types[9];\n }\n}\nexport function validateMetadata(metadata) {\n if (!metadata) {\n throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');\n }\n\n // `country_phone_code_to_countries` was renamed to `country_calling_codes` in `1.0.18`.\n // For that reason, it's not used in this detection algorithm.\n // Instead, it detects by `countries: {}` property existence.\n if (!isObject(metadata) || !isObject(metadata.countries)) {\n throw new Error(\"[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got \".concat(isObject(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + typeOf(metadata) + ': ' + metadata, \".\"));\n }\n}\n\n// Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n/* istanbul ignore next */\nvar typeOf = function typeOf(_) {\n return _typeof(_);\n};\n\n/**\r\n * Returns extension prefix for a country.\r\n * @param {string} country\r\n * @param {object} metadata\r\n * @return {string?}\r\n * @example\r\n * // Returns \" ext. \"\r\n * getExtPrefix(\"US\")\r\n */\nexport function getExtPrefix(country, metadataJson) {\n var metadata = new Metadata(metadataJson);\n if (metadata.hasCountry(country)) {\n return metadata.selectNumberingPlan(country).ext();\n }\n return DEFAULT_EXT_PREFIX;\n}\n\n/**\r\n * Returns \"country calling code\" for a country.\r\n * Throws an error if the country doesn't exist or isn't supported by this library.\r\n * @param {string} country\r\n * @param {object} metadataJson\r\n * @return {string}\r\n * @example\r\n * // Returns \"44\"\r\n * getCountryCallingCode(\"GB\")\r\n */\nexport function getCountryCallingCode(country, metadataJson) {\n var metadata = new Metadata(metadataJson);\n if (metadata.hasCountry(country)) {\n return metadata.selectNumberingPlan(country).countryCallingCode();\n }\n throw new Error(\"Unknown country: \".concat(country));\n}\n\n/**\r\n * Tells if a country code is supported.\r\n * @param {string} country\r\n * @param {object} metadataJson\r\n * @return {boolean}\r\n * @example\r\n * // Returns `true`\r\n * isSupportedCountry(\"GB\")\r\n */\nexport function isSupportedCountry(country, metadataJson) {\n // const metadata = new Metadata(metadataJson)\n // return metadata.hasCountry(country)\n return metadataJson.countries.hasOwnProperty(country);\n}\n\n/**\r\n * Sets `v1`/`v2`/`v3`/`v4` properties on `this` object.\r\n * @param {object} metadata — Metadata JSON\r\n */\nfunction setVersion(metadata) {\n var version = metadata.version;\n if (typeof version === 'number') {\n this.v1 = version === 1;\n this.v2 = version === 2;\n this.v3 = version === 3;\n this.v4 = version === 4;\n } else {\n if (!version) {\n this.v1 = true;\n } else if (compare(version, V3) === -1) {\n this.v2 = true;\n } else if (compare(version, V4) === -1) {\n this.v3 = true;\n } else {\n this.v4 = true;\n }\n }\n}\n//# sourceMappingURL=metadata.js.map","function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\n/**\r\n * Merges two arrays.\r\n * @param {*} a\r\n * @param {*} b\r\n * @return {*}\r\n */\nexport default function mergeArrays(a, b) {\n var merged = a.slice();\n for (var _iterator = _createForOfIteratorHelperLoose(b), _step; !(_step = _iterator()).done;) {\n var element = _step.value;\n if (a.indexOf(element) < 0) {\n merged.push(element);\n }\n }\n return merged.sort(function (a, b) {\n return a - b;\n });\n\n // ES6 version, requires Set polyfill.\n // let merged = new Set(a)\n // for (const element of b) {\n // \tmerged.add(i)\n // }\n // return Array.from(merged).sort((a, b) => a - b)\n}\n//# sourceMappingURL=mergeArrays.js.map","import Metadata from '../metadata.js';\nimport mergeArrays from './mergeArrays.js';\n\n/**\r\n * Checks phone number length against the phone numbering plan selected in metadata.\r\n * Optionally, it could be restrained by a specific country.\r\n * @param {string} nationalNumber\r\n * @param {string?} country — Specific country to use rather than the one that is pre-selected in the metadata instance.\r\n * @param {Metadata} metadata — Metadata instance with a selected numbering plan.\r\n * @returns {string}\r\n */\nexport default function checkNumberLength(nationalNumber, country, metadata) {\n return checkNumberLengthForType(nationalNumber, undefined, country, metadata);\n}\n\n/**\r\n * Checks phone number length against the phone numbering plan selected in metadata.\r\n * Optionally, it could be restrained by a specific phone number type or a specific country.\r\n * @param {string} nationalNumber\r\n * @param {string?} type — Specific phone number type.\r\n * @param {string?} country — Specific country to use instead of the one that is pre-selected in the metadata instance.\r\n * @param {Metadata} metadata — Metadata instance with a selected numbering plan.\r\n * @returns {string} See the README on `validatePhoneNumberLength()` function, with an addition of a special case: when phone numbers of type `type` aren't possible in the telephone numbering plan, it will return \"INVALID_LENGTH\".\r\n */\n// Checks whether a number is possible for a certain `country` based on the number length.\n//\n// This function is not supported by metadata generated with ancient versions of\n// `libphonenumber-js` (before version `1.0.18`) which didn't include \"possible lengths\".\n//\n// There was also a known issue with `checkNumberLength()` function:\n// if a number is possible only in a certain `country` among several `countries`\n// that share the same \"country calling code\", that function would check\n// the possibility of the phone number only in the \"main\" `country` for the \"country calling code\"\n// and would not check if it's actually be possible in the speciifc `country`.\n//\n// For example, \"+1310xxxx\" numbers are valid in Canada.\n// However, they are not possible in the US due to being too short.\n// Since Canada and the US share the same country calling code — \"+1\" —\n// `checkNumberLength()` function used to return not \"IS_POSSIBLE\" for \"+1310xxxx\" numbers.\n//\n// In such cases, when using \"/max\" metadata, `isValid()` could output `true`\n// but at the same time `isPossible()` could output `false`, which was contradictory.\n//\n// See https://issuetracker.google.com/issues/335892662 for the discusson in Google's issues.\n//\n// The solution suggested by Google was implemented: an optional `country` argument\n// was added to `checkNumberLength()` function. If present, that `country` will be used\n// to check phone number length for that specific `country` rather than the \"main\" country\n// for the shared \"country calling code\".\n//\nexport function checkNumberLengthForType(nationalNumber, type, country, metadata) {\n if (country) {\n // If a specific `country` is specified, re-create a metadata instance with it.\n metadata = new Metadata(metadata.metadata);\n metadata.selectNumberingPlan(country);\n }\n var type_info = metadata.type(type);\n\n // There should always be \"<possiblePengths/>\" set for every type element.\n // This is declared in the XML schema.\n // For size efficiency, where a sub-description (e.g. fixed-line)\n // has the same \"<possiblePengths/>\" as the \"general description\", this is missing,\n // so we fall back to the \"general description\". Where no numbers of the type\n // exist at all, there is one possible length (-1) which is guaranteed\n // not to match the length of any real phone number.\n var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths();\n // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()\n\n // Metadata before version `1.0.18` didn't contain `possible_lengths`.\n if (!possible_lengths) {\n return 'IS_POSSIBLE';\n }\n if (type === 'FIXED_LINE_OR_MOBILE') {\n // No such country in metadata.\n /* istanbul ignore next */\n if (!metadata.type('FIXED_LINE')) {\n // The rare case has been encountered where no fixedLine data is available\n // (true for some non-geographic entities), so we just check mobile.\n return checkNumberLengthForType(nationalNumber, 'MOBILE', country, metadata);\n }\n var mobile_type = metadata.type('MOBILE');\n if (mobile_type) {\n // Merge the mobile data in if there was any. \"Concat\" creates a new\n // array, it doesn't edit possible_lengths in place, so we don't need a copy.\n // Note that when adding the possible lengths from mobile, we have\n // to again check they aren't empty since if they are this indicates\n // they are the same as the general desc and should be obtained from there.\n possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths());\n // The current list is sorted; we need to merge in the new list and\n // re-sort (duplicates are okay). Sorting isn't so expensive because\n // the lists are very small.\n\n // if (local_lengths) {\n // \tlocal_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())\n // } else {\n // \tlocal_lengths = mobile_type.possibleLengthsLocal()\n // }\n }\n }\n // If the type doesn't exist then return 'INVALID_LENGTH'.\n else if (type && !type_info) {\n return 'INVALID_LENGTH';\n }\n var actual_length = nationalNumber.length;\n\n // In `libphonenumber-js` all \"local-only\" formats are dropped for simplicity.\n // // This is safe because there is never an overlap beween the possible lengths\n // // and the local-only lengths; this is checked at build time.\n // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)\n // {\n // \treturn 'IS_POSSIBLE_LOCAL_ONLY'\n // }\n\n var minimum_length = possible_lengths[0];\n if (minimum_length === actual_length) {\n return 'IS_POSSIBLE';\n }\n if (minimum_length > actual_length) {\n return 'TOO_SHORT';\n }\n if (possible_lengths[possible_lengths.length - 1] < actual_length) {\n return 'TOO_LONG';\n }\n\n // We skip the first element since we've already checked it.\n return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';\n}\n//# sourceMappingURL=checkNumberLength.js.map","import Metadata from './metadata.js';\nimport checkNumberLength from './helpers/checkNumberLength.js';\n\n/**\r\n * Checks if a phone number is \"possible\" (basically just checks its length).\r\n *\r\n * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {object} [options]\r\n * @param {object} metadataJson\r\n * @return {string}\r\n */\nexport default function isPossiblePhoneNumber(input, options, metadataJson) {\n /* istanbul ignore if */\n if (options === undefined) {\n options = {};\n }\n var metadata = new Metadata(metadataJson);\n if (options.v2) {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n metadata.selectNumberingPlan(input.country || input.countryCallingCode);\n } else {\n if (!input.phone) {\n return false;\n }\n if (input.country) {\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n metadata.selectNumberingPlan(input.country);\n } else {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n metadata.selectNumberingPlan(input.countryCallingCode);\n }\n }\n\n // Old (legacy) metadata (< 1.0.18) had no \"possible length\" data.\n // So `isPossibleNumber()` function is supported only for non-legacy metadata.\n if (metadata.possibleLengths()) {\n return isPossibleNumber(input.phone || input.nationalNumber, metadata);\n }\n\n // There was a bug in versions from `1.7.35` to `1.7.37` of `libphonenumber-js`\n // where \"possible_lengths\" property was missing from \"non-geographical\" numbering plans' metadata.\n // After that, the bug was noticed and fixed.\n // So for versions from `1.7.35` to `1.7.37`, just assume that all \"non=geotraphical\" numbers are possible.\n // The reason is that the bug was noticed relatively quickly (within a day or so)\n // and it's unlikely that anyone generated their custom metadata in that short time span.\n // And if they didn't generate any custom metadata then a follow-up package update would've silently fixed the bug.\n if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {\n return true;\n }\n\n // `isPossibleNumber()` function is not supported.\n throw new Error('Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.');\n}\n\n/**\r\n * Tells if a given national (significant) number is possible\r\n * @param {string} nationalNumber\r\n * @param {Metadata} metadata = Metadata instance with a pre-selected telephone numbering plan.\r\n * @returns {boolean}\r\n */\nexport function isPossibleNumber(nationalNumber, metadata) {\n switch (checkNumberLength(nationalNumber, undefined, metadata)) {\n case 'IS_POSSIBLE':\n return true;\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // \treturn !isInternational\n default:\n return false;\n }\n}\n//# sourceMappingURL=isPossible.js.map","/**\r\n * Checks whether the entire input sequence can be matched\r\n * against the regular expression.\r\n * @return {boolean}\r\n */\nexport default function matchesEntirely(text, regularExpressionText) {\n // If the assigning of the `''` default value is moved to the arguments above,\n // the code coverage would decrease for some weird reason.\n text = text || '';\n return new RegExp('^(?:' + regularExpressionText + ')$').test(text);\n}\n//# sourceMappingURL=matchesEntirely.js.map","function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport Metadata from '../metadata.js';\nimport matchesEntirely from './matchesEntirely.js';\nvar NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL'];\n\n// Finds out national phone number type (fixed line, mobile, etc)\nexport default function getNumberType(input, options, metadataJson) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n\n // When `parse()` returns an empty object — `{}` —\n // that means that the phone number is malformed,\n // so it can't possibly be valid.\n if (!input.country && !input.countryCallingCode) {\n return;\n }\n var metadata = new Metadata(metadataJson);\n metadata.selectNumberingPlan(input.country || input.countryCallingCode);\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone;\n\n // The following is copy-pasted from the original function:\n // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835\n\n // Is this national number even valid for this country\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {\n return;\n }\n\n // Is it fixed line number\n if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) {\n // Because duplicate regular expressions are removed\n // to reduce metadata size, if \"mobile\" pattern is \"\"\n // then it means it was removed due to being a duplicate of the fixed-line pattern.\n //\n if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {\n return 'FIXED_LINE_OR_MOBILE';\n }\n\n // `MOBILE` type pattern isn't included if it matched `FIXED_LINE` one.\n // For example, for \"US\" country.\n // Old metadata (< `1.0.18`) had a specific \"types\" data structure\n // that happened to be `undefined` for `MOBILE` in that case.\n // Newer metadata (>= `1.0.18`) has another data structure that is\n // not `undefined` for `MOBILE` in that case (it's just an empty array).\n // So this `if` is just for backwards compatibility with old metadata.\n if (!metadata.type('MOBILE')) {\n return 'FIXED_LINE_OR_MOBILE';\n }\n\n // Check if the number happens to qualify as both fixed line and mobile.\n // (no such country in the minimal metadata set)\n /* istanbul ignore if */\n if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) {\n return 'FIXED_LINE_OR_MOBILE';\n }\n return 'FIXED_LINE';\n }\n for (var _iterator = _createForOfIteratorHelperLoose(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) {\n var type = _step.value;\n if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {\n return type;\n }\n }\n}\nexport function isNumberTypeEqualTo(nationalNumber, type, metadata) {\n var typeDefinition = metadata.type(type);\n if (!typeDefinition || !typeDefinition.pattern()) {\n return false;\n }\n\n // Check if any possible number lengths are present;\n // if so, we use them to avoid checking\n // the validation pattern if they don't match.\n // If they are absent, this means they match\n // the general description, which we have\n // already checked before a specific number type.\n if (typeDefinition.possibleLengths() && typeDefinition.possibleLengths().indexOf(nationalNumber.length) < 0) {\n return false;\n }\n return matchesEntirely(nationalNumber, typeDefinition.pattern());\n}\n//# sourceMappingURL=getNumberType.js.map","import Metadata from './metadata.js';\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport getNumberType from './helpers/getNumberType.js';\n\n/**\r\n * Checks if a given phone number is valid.\r\n *\r\n * isValid(phoneNumberInstance, { ..., v2: true }, metadata)\r\n *\r\n * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)\r\n * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)\r\n *\r\n * If the `number` is a string, it will be parsed to an object,\r\n * but only if it contains only valid phone number characters (including punctuation).\r\n * If the `number` is an object, it is used as is.\r\n *\r\n * The optional `defaultCountry` argument is the default country.\r\n * I.e. it does not restrict to just that country,\r\n * e.g. in those cases where several countries share\r\n * the same phone numbering rules (NANPA, Britain, etc).\r\n * For example, even though the number `07624 369230`\r\n * belongs to the Isle of Man (\"IM\" country code)\r\n * calling `isValidNumber('07624369230', 'GB', metadata)`\r\n * still returns `true` because the country is not restricted to `GB`,\r\n * it's just that `GB` is the default one for the phone numbering rules.\r\n * For restricting the country see `isValidNumberForRegion()`\r\n * though restricting a country might not be a good idea.\r\n * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\r\n *\r\n * Examples:\r\n *\r\n * ```js\r\n * isValidNumber('+78005553535', metadata)\r\n * isValidNumber('8005553535', 'RU', metadata)\r\n * isValidNumber('88005553535', 'RU', metadata)\r\n * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)\r\n * ```\r\n */\nexport default function isValidNumber(input, options, metadataJson) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n var metadata = new Metadata(metadataJson);\n metadata.selectNumberingPlan(input.country || input.countryCallingCode);\n\n // By default, countries only have type regexps when it's required for\n // distinguishing different countries having the same `countryCallingCode`.\n if (metadata.hasTypes()) {\n return getNumberType(input, options, metadata.metadata) !== undefined;\n }\n\n // If there are no type regexps for this country in metadata then use\n // `nationalNumberPattern` as a \"better than nothing\" replacement.\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone;\n return matchesEntirely(nationalNumber, metadata.nationalNumberPattern());\n}\n//# sourceMappingURL=isValid.js.map","var COUNTRY_CODE_REG_EXP = /^[A-Z]{2}$/;\nexport default function isCountryCode(string) {\n return COUNTRY_CODE_REG_EXP.test(string);\n}\n//# sourceMappingURL=isCountryCode.js.map","import Metadata from '../metadata.js';\nimport isCountryCode from './isCountryCode.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\nexport default function getCountryAndCallingCodeFromOneOfThem(countryOrCallingCode, metadataJson) {\n var country;\n var callingCode;\n var metadata = new Metadata(metadataJson);\n // If country code is passed then derive `countryCallingCode` from it.\n // Also store the country code as `.country`.\n if (isCountryCode(countryOrCallingCode)) {\n country = countryOrCallingCode;\n metadata.selectNumberingPlan(country);\n callingCode = metadata.countryCallingCode();\n } else {\n callingCode = countryOrCallingCode;\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(callingCode)) {\n country = '001';\n }\n }\n }\n return {\n country: country,\n callingCode: callingCode\n };\n}\n//# sourceMappingURL=getCountryAndCallingCodeFromOneOfThem.js.map","import Metadata from '../metadata.js';\n\n/**\r\n * Returns a list of countries that the phone number could potentially belong to.\r\n * @param {string} callingCode — Calling code.\r\n * @param {string} nationalNumber — National (significant) number.\r\n * @param {object} metadata — Metadata.\r\n * @return {string[]} A list of possible countries.\r\n */\nexport default function getPossibleCountriesForNumber(callingCode, nationalNumber, metadata) {\n var _metadata = new Metadata(metadata);\n var possibleCountries = _metadata.getCountryCodesForCallingCode(callingCode);\n if (!possibleCountries) {\n return [];\n }\n return possibleCountries.filter(function (country) {\n return couldNationalNumberBelongToCountry(nationalNumber, country, metadata);\n });\n}\nfunction couldNationalNumberBelongToCountry(nationalNumber, country, metadataJson) {\n var metadata = new Metadata(metadataJson);\n metadata.selectNumberingPlan(country);\n return metadata.numberingPlan.possibleLengths().indexOf(nationalNumber.length) >= 0;\n}\n//# sourceMappingURL=getPossibleCountriesForNumber.js.map","// The minimum length of the national significant number.\nexport var MIN_LENGTH_FOR_NSN = 2;\n\n// The ITU says the maximum length should be 15,\n// but one can find longer numbers in Germany.\nexport var MAX_LENGTH_FOR_NSN = 17;\n\n// The maximum length of the country calling code.\nexport var MAX_LENGTH_COUNTRY_CODE = 3;\n\n// Digits accepted in phone numbers\n// (ascii, fullwidth, arabic-indic, and eastern arabic digits).\nexport var VALID_DIGITS = \"0-9\\uFF10-\\uFF19\\u0660-\\u0669\\u06F0-\\u06F9\";\n\n// `DASHES` will be right after the opening square bracket of the \"character class\"\nvar DASHES = \"-\\u2010-\\u2015\\u2212\\u30FC\\uFF0D\";\nvar SLASHES = \"\\uFF0F/\";\nvar DOTS = \"\\uFF0E.\";\nexport var WHITESPACE = \" \\xA0\\xAD\\u200B\\u2060\\u3000\";\nvar BRACKETS = \"()\\uFF08\\uFF09\\uFF3B\\uFF3D\\\\[\\\\]\";\n// export const OPENING_BRACKETS = '(\\uFF08\\uFF3B\\\\\\['\nvar TILDES = \"~\\u2053\\u223C\\uFF5E\";\n\n// Regular expression of acceptable punctuation found in phone numbers. This\n// excludes punctuation found as a leading character only. This consists of dash\n// characters, white space characters, full stops, slashes, square brackets,\n// parentheses and tildes. Full-width variants are also present.\nexport var VALID_PUNCTUATION = \"\".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);\nexport var PLUS_CHARS = \"+\\uFF0B\";\n// const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')\n//# sourceMappingURL=constants.js.map","import Metadata from '../metadata.js';\nimport { VALID_DIGITS } from '../constants.js';\nvar CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');\nexport default function stripIddPrefix(number, country, callingCode, metadataJson) {\n if (!country) {\n return;\n }\n\n // Get the IDD prefix pattern.\n var metadata = new Metadata(metadataJson);\n metadata.selectNumberingPlan(country || callingCode);\n var IDDPrefixPattern = new RegExp(metadata.IDDPrefix());\n\n // Check if the number is IDD-prefixed.\n if (number.search(IDDPrefixPattern) !== 0) {\n return;\n }\n\n // Strip IDD prefix.\n number = number.slice(number.match(IDDPrefixPattern)[0].length);\n\n // If there're any digits after an IDD prefix,\n // then those digits are a country calling code.\n // Since no country code starts with a `0`,\n // the code below validates that the next digit (if present) is not `0`.\n var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);\n if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {\n if (matchedGroups[1] === '0') {\n return;\n }\n }\n return number;\n}\n//# sourceMappingURL=stripIddPrefix.js.map","/**\r\n * Strips any national prefix (such as 0, 1) present in a\r\n * (possibly incomplete) number provided.\r\n * \"Carrier codes\" are only used in Colombia and Brazil,\r\n * and only when dialing within those countries from a mobile phone to a fixed line number.\r\n * Sometimes it won't actually strip national prefix\r\n * and will instead prepend some digits to the `number`:\r\n * for example, when number `2345678` is passed with `VI` country selected,\r\n * it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\r\n * @param {string} number — National number digits.\r\n * @param {object} metadata — Metadata with country selected.\r\n * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not.\r\n */\nexport default function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {\n if (number && metadata.numberingPlan.nationalPrefixForParsing()) {\n // See METADATA.md for the description of\n // `national_prefix_for_parsing` and `national_prefix_transform_rule`.\n // Attempt to parse the first digits as a national prefix.\n var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');\n var prefixMatch = prefixPattern.exec(number);\n if (prefixMatch) {\n var nationalNumber;\n var carrierCode;\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule\n // If a `national_prefix_for_parsing` has any \"capturing groups\"\n // then it means that the national (significant) number is equal to\n // those \"capturing groups\" transformed via `national_prefix_transform_rule`,\n // and nothing could be said about the actual national prefix:\n // what is it and was it even there.\n // If a `national_prefix_for_parsing` doesn't have any \"capturing groups\",\n // then everything it matches is a national prefix.\n // To determine whether `national_prefix_for_parsing` matched any\n // \"capturing groups\", the value of the result of calling `.exec()`\n // is looked at, and if it has non-undefined values where there're\n // \"capturing groups\" in the regular expression, then it means\n // that \"capturing groups\" have been matched.\n // It's not possible to tell whether there'll be any \"capturing gropus\"\n // before the matching process, because a `national_prefix_for_parsing`\n // could exhibit both behaviors.\n var capturedGroupsCount = prefixMatch.length - 1;\n var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];\n if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {\n nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule());\n // If there's more than one captured group,\n // then carrier code is the second one.\n if (capturedGroupsCount > 1) {\n carrierCode = prefixMatch[1];\n }\n }\n // If there're no \"capturing groups\",\n // or if there're \"capturing groups\" but no\n // `national_prefix_transform_rule`,\n // then just strip the national prefix from the number,\n // and possibly a carrier code.\n // Seems like there could be more.\n else {\n // `prefixBeforeNationalNumber` is the whole substring matched by\n // the `national_prefix_for_parsing` regular expression.\n // There seem to be no guarantees that it's just a national prefix.\n // For example, if there's a carrier code, it's gonna be a\n // part of `prefixBeforeNationalNumber` too.\n var prefixBeforeNationalNumber = prefixMatch[0];\n nationalNumber = number.slice(prefixBeforeNationalNumber.length);\n // If there's at least one captured group,\n // then carrier code is the first one.\n if (hasCapturedGroups) {\n carrierCode = prefixMatch[1];\n }\n }\n // Tries to guess whether a national prefix was present in the input.\n // This is not something copy-pasted from Google's library:\n // they don't seem to have an equivalent for that.\n // So this isn't an \"officially approved\" way of doing something like that.\n // But since there seems no other existing method, this library uses it.\n var nationalPrefix;\n if (hasCapturedGroups) {\n var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);\n var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup);\n // Example: an Argentinian (AR) phone number `0111523456789`.\n // `prefixMatch[0]` is `01115`, and `$1` is `11`,\n // and the rest of the phone number is `23456789`.\n // The national number is transformed via `9$1` to `91123456789`.\n // National prefix `0` is detected being present at the start.\n // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {\n if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {\n nationalPrefix = metadata.numberingPlan.nationalPrefix();\n }\n } else {\n nationalPrefix = prefixMatch[0];\n }\n return {\n nationalNumber: nationalNumber,\n nationalPrefix: nationalPrefix,\n carrierCode: carrierCode\n };\n }\n }\n return {\n nationalNumber: number\n };\n}\n//# sourceMappingURL=extractNationalNumberFromPossiblyIncompleteNumber.js.map","function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport Metadata from '../metadata.js';\nimport getNumberType from './getNumberType.js';\n\n/**\r\n * Returns the exact country that a given national (significant) number belongs to\r\n * in case of ambiguity, i.e. when multiple countries share the same \"country calling code\".\r\n * @param {string} [nationalNumber]\r\n * @param {string[]} countries — A list of countries that share the same calling code.\r\n * @param {object} metadata — Metadata JSON.\r\n * @returns {string?} Returns the exact country this number belongs to, or `undefined` if the exact country couldn't be determined.\r\n */\nexport default function getCountryByNationalNumber(nationalNumber, countries, metadataJson) {\n // Create a new `metadata` instance because it will be selecting a `country`.\n var metadata = new Metadata(metadataJson);\n\n // const matchingCountries = []\n\n for (var _iterator = _createForOfIteratorHelperLoose(countries), _step; !(_step = _iterator()).done;) {\n var country = _step.value;\n metadata.selectNumberingPlan(country);\n // \"Leading digits\" patterns are only defined for about 20% of all countries.\n // By definition, matching \"leading digits\" is a sufficient but not a necessary\n // condition for a phone number to belong to a country.\n // The point of \"leading digits\" check is that it's the fastest one to get a match.\n // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits\n // I'd suppose that \"leading digits\" patterns are mutually exclusive for different countries\n // because of the intended use of that feature.\n if (metadata.leadingDigits()) {\n if (nationalNumber && nationalNumber.search(metadata.leadingDigits()) === 0) {\n return country;\n }\n }\n // Else perform full validation with all of those\n // fixed-line/mobile/etc regular expressions.\n else if (getNumberType({\n phone: nationalNumber,\n country: country\n }, undefined, metadata.metadata)) {\n // When multiple countries share the same \"country calling code\",\n // type patterns aren't guaranteed to be unique among them.\n // For example, both `US` and `CA` have the same pattern for `toll_free` numbers.\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417147572\n //\n // That means that this `if` condition could be `true` for multiple countries from the list.\n // Currently, it just returns the first one, which is also the \"main\" country for the \"country calling code\".\n // In an example with `toll_free` numbers above, `\"US\"` would be returned even though\n // it could as well be `\"CA\"`.\n //\n // There was also a time when this attempted to be overly smart\n // and kept track of all such multiple matching countries\n // and then picked the one that matched the `defaultCountry`, if provided.\n // For example, with `toll_free` numbers above, and with `defaultCountry: \"CA\"`,\n // it would've returned `\"CA\"` instead of `\"US\"`.\n // Later it turned out that such \"overly smart\" behavior turned out to be just confusing,\n // so this \"overly smart\" country detection was reverted to returning the \"main\" country\n // for the \"country calling code\".\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/154\n //\n return country;\n //\n // The \"overly smart\" behavior code:\n //\n // if (defaultCountry) {\n // \tif (country === defaultCountry) {\n // \t\treturn country\n // \t} else {\n // \t\tmatchingCountries.push(country)\n // \t}\n // } else {\n // \treturn country\n // }\n }\n }\n\n // // Return the first (\"main\") one of the `matchingCountries`.\n // if (matchingCountries.length > 0) {\n // \treturn matchingCountries[0]\n // }\n}\n//# sourceMappingURL=getCountryByNationalNumber.js.map","import getCountryByNationalNumber from './getCountryByNationalNumber.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\n/**\r\n * Returns the exact country that a given national (significant) number belongs to\r\n * in case of ambiguity, i.e. when multiple countries share the same \"country calling code\".\r\n * @param {string} [callingCode]\r\n * @param {string} [options.nationalNumber] — National (significant) number.\r\n * @param {Metadata} options.metadata — Metadata instance.\r\n * @returns {string?} Returns the most suitable country for this calling code and national (significant) number.\r\n */\nexport default function getCountryByCallingCode(callingCode, _ref) {\n var nationalNumber = _ref.nationalNumber,\n metadata = _ref.metadata;\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(callingCode)) {\n return '001';\n }\n }\n var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);\n if (!possibleCountries) {\n return;\n }\n // If there's just one country corresponding to the country code,\n // then just return it, without further phone number digits validation.\n if (possibleCountries.length === 1) {\n return possibleCountries[0];\n }\n return getCountryByNationalNumber(nationalNumber, possibleCountries, metadata.metadata);\n}\n//# sourceMappingURL=getCountryByCallingCode.js.map","import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport checkNumberLength from './checkNumberLength.js';\nimport getCountryByCallingCode from './getCountryByCallingCode.js';\n\n/**\r\n * Strips national prefix and carrier code from a complete phone number.\r\n * The difference from the non-\"FromCompleteNumber\" function is that\r\n * it won't extract national prefix if the resultant number is too short\r\n * to be a complete number for the selected phone numbering plan.\r\n * @param {string} number — Complete phone number digits.\r\n * @param {string?} country — Specific country to use instead of the one that is pre-selected in the metadata instance.\r\n * @param {Metadata} metadata — Metadata instance with a selected numbering plan.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\nexport default function extractNationalNumber(number, country, metadata) {\n // Parsing national prefixes and carrier codes\n // is only required for local phone numbers\n // but some people don't understand that\n // and sometimes write international phone numbers\n // with national prefixes (or maybe even carrier codes).\n // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n // Google's original library forgives such mistakes\n // and so does this library, because it has been requested:\n // https://github.com/catamphetamine/libphonenumber-js/issues/127\n var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),\n carrierCode = _extractNationalNumbe.carrierCode,\n nationalNumber = _extractNationalNumbe.nationalNumber;\n if (nationalNumber !== number) {\n if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n // Check the national (significant) number length after extracting national prefix and carrier code.\n // Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature,\n // so this `if` will only be executed with newer metadata.\n if (metadata.numberingPlan.possibleLengths()) {\n // If an exact `country` is not specified, attempt to detect it from the assumed national number.\n if (!country) {\n country = getCountryByCallingCode(metadata.numberingPlan.callingCode(), {\n nationalNumber: nationalNumber,\n metadata: metadata\n });\n }\n\n // The number remaining after stripping the national prefix and carrier code\n // should be long enough to have a possible length for the country.\n // Otherwise, don't strip the national prefix and carrier code,\n // since the original number could be a valid number.\n // This check has been copy-pasted \"as is\" from Google's original library:\n // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250\n // It doesn't check for the \"possibility\" of the original `number`.\n // I guess it's fine not checking that one. It works as is anyway.\n if (!isPossibleIncompleteNationalNumber(nationalNumber, country, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n }\n }\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n\n// In some countries, the same digit could be a national prefix\n// or a leading digit of a valid phone number.\n// For example, in Russia, national prefix is `8`,\n// and also `800 555 35 35` is a valid number\n// in which `8` is not a national prefix, but the first digit\n// of a national (significant) number.\n// Same's with Belarus:\n// `82004910060` is a valid national (significant) number,\n// but `2004910060` is not.\n// To support such cases (to prevent the code from always stripping\n// national prefix), a condition is imposed: a national prefix\n// is not extracted when the original number is \"viable\" and the\n// resultant number is not, a \"viable\" national number being the one\n// that matches `national_number_pattern`.\nfunction shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {\n // The equivalent in Google's code is:\n // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004\n if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {\n return false;\n }\n // This \"is possible\" national number (length) check has been commented out\n // because it's superceded by the (effectively) same check done in the\n // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.\n // In other words, why run the same check twice if it could only be run once.\n // // Check the national (significant) number length after extracting national prefix and carrier code.\n // // Fixes a minor \"weird behavior\" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57\n // // (Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature).\n // if (metadata.possibleLengths()) {\n // \tif (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) &&\n // \t\t!isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) {\n // \t\treturn false\n // \t}\n // }\n return true;\n}\n\n/**\r\n * Tells if a given incomplete national number is possible or not.\r\n * @param {string} nationalNumber\r\n * @param {string?} country — Specific country rather than the one that is pre-selected in the metadata instance.\r\n * @param {Metadata} metadata — Metadata instance with a selected numbering plan.\r\n * @returns {boolean}\r\n */\nfunction isPossibleIncompleteNationalNumber(nationalNumber, country, metadata) {\n switch (checkNumberLength(nationalNumber, country, metadata)) {\n case 'TOO_SHORT':\n case 'INVALID_LENGTH':\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n return false;\n default:\n return true;\n }\n}\n//# sourceMappingURL=extractNationalNumber.js.map","import Metadata from '../metadata.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport extractNationalNumber from './extractNationalNumber.js';\nimport checkNumberLength from './checkNumberLength.js';\nimport getCountryCallingCode from '../getCountryCallingCode.js';\n\n/**\r\n * Sometimes some people incorrectly input international phone numbers\r\n * without the leading `+`. This function corrects such input.\r\n * @param {string} number — Phone number digits (only digits, no `+`).\r\n * @param {string} [country] — Exact country of the phone number.\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {object} metadataJson\r\n * @return {object} `{ countryCallingCode: string?, number: string }`, where `countryCallingCode` is the calling code that was extracted from the input `number` string, and `number` is the originally passed `number` without the extracted calling code.\r\n */\nexport default function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadataJson) {\n // Validate arguments.\n // The `number` is known to be in a non-international form\n // because there's no leading \"+\" character.\n // Therefore, there must be either `country` or `defaultCountry` or `defaultCallingCode`.\n // Otherwise, there'd be no source for the calling code to search for in the `number`.\n if (!(country || defaultCountry || defaultCallingCode)) {\n // There's no source for the calling code to search for in the `number`.\n return {\n number: number\n };\n }\n var countryCallingCode = country || defaultCountry ? getCountryCallingCode(country || defaultCountry, metadataJson) : defaultCallingCode;\n if (number.indexOf(countryCallingCode) === 0) {\n var metadata = new Metadata(metadataJson);\n metadata.selectNumberingPlan(country || defaultCountry || defaultCallingCode);\n var possibleShorterNumber = number.slice(countryCallingCode.length);\n var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, undefined, metadata),\n possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;\n var _extractNationalNumbe2 = extractNationalNumber(number, undefined, metadata),\n nationalNumber = _extractNationalNumbe2.nationalNumber;\n\n // If the number was not valid before but is valid now,\n // or if it was too long before, we consider the number\n // with the country calling code stripped to be a better result\n // and keep that instead.\n // For example, in Germany (+49), `49` is a valid area code,\n // so if a number starts with `49`, it could be both a valid\n // national German number or an international number without\n // a leading `+`.\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, undefined, metadata) === 'TOO_LONG') {\n return {\n countryCallingCode: countryCallingCode,\n number: possibleShorterNumber\n };\n }\n }\n return {\n number: number\n };\n}\n//# sourceMappingURL=extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map","import stripIddPrefix from './stripIddPrefix.js';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js';\nimport Metadata from '../metadata.js';\nimport { MAX_LENGTH_COUNTRY_CODE } from '../constants.js';\n\n/**\r\n * Attempts to extract a calling code from a phone number.\r\n * * If the phone number is found to be \"international\":\r\n * * It will attempt to identify the calling code part of it and whether that part is complete and valid.\r\n * * If the calling code part is complete and valid, it will return two properties:\r\n * that calling code part (without `+`) and the rest of the digits.\r\n * * Otherwise, i.e. if the calling code part is incomplete or invalid,\r\n * it will return an empty object.\r\n * * Otherwise, i.e. if the phone number is national, there's no callind code to extract\r\n * so it will just return the originally-passed `number` string as the only property.\r\n * @param {string} number — Phone number digits (possibly with a `+`).\r\n * @param {string} [country] — Country.\r\n * @param {string} [defaultCountry] — Default country.\r\n * @param {string} [defaultCallingCode] — Default calling code (some phone numbering plans are non-geographic).\r\n * @param {object} metadataJson\r\n * @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }`, where `countryCallingCodeSource` tells how the returned calling code was extracted (if it was extracted), `countryCallingCode` is the calling code that was extracted from the input `number` string, and `number` is the originally passed `number` without the extracted calling code (and without a `+`). If the calling code is present but incomplete or invalid, it will return an empty object.\r\n * @example\r\n * // Returns `{ countryCallingCode: \"1\", number: \"2133734253\" }`.\r\n * extractCountryCallingCode('2133734253', 'US', null, null, metadata)\r\n * extractCountryCallingCode('2133734253', null, 'US', null, metadata)\r\n * extractCountryCallingCode('2133734253', null, null, '1', metadata)\r\n * extractCountryCallingCode('+12133734253', null, null, null, metadata)\r\n * extractCountryCallingCode('+12133734253', null, 'RU', null, metadata)\r\n */\nexport default function extractCountryCallingCode(number, country, defaultCountry, defaultCallingCode, metadataJson) {\n if (!number) {\n return {};\n }\n var isNumberWithIddPrefix;\n\n // If this is not an international phone number,\n // then either extract an \"IDD\" prefix, or extract a\n // country calling code from a number by autocorrecting it\n // by prepending a leading `+` in cases when it starts\n // with the country calling code.\n // https://wikitravel.org/en/International_dialling_prefix\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (number[0] !== '+') {\n // Convert an \"out-of-country\" dialing phone number\n // to a proper international phone number.\n var numberWithoutIDD = stripIddPrefix(number, country || defaultCountry, defaultCallingCode, metadataJson);\n // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n if (numberWithoutIDD && numberWithoutIDD !== number) {\n isNumberWithIddPrefix = true;\n number = '+' + numberWithoutIDD;\n } else {\n // Check to see if the number starts with the country calling code\n // for the default country. If so, we remove the country calling code,\n // and do some checks on the validity of the number before and after.\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (country || defaultCountry || defaultCallingCode) {\n var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadataJson),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n shorterNumber = _extractCountryCallin.number;\n if (countryCallingCode) {\n return {\n countryCallingCodeSource: 'FROM_NUMBER_WITHOUT_PLUS_SIGN',\n countryCallingCode: countryCallingCode,\n number: shorterNumber\n };\n }\n }\n return {\n // No need to set it to `UNSPECIFIED`. It can be just `undefined`.\n // countryCallingCodeSource: 'UNSPECIFIED',\n number: number\n };\n }\n }\n\n // `number` can only be international at this point.\n\n // Fast abortion: country codes do not begin with a '0'\n if (number[1] === '0') {\n return {};\n }\n var metadata = new Metadata(metadataJson);\n\n // The thing with country phone codes\n // is that they are orthogonal to each other\n // i.e. there's no such country phone code A\n // for which country phone code B exists\n // where B starts with A.\n // Therefore, while scanning digits,\n // if a valid country code is found,\n // that means that it is the country code.\n //\n var i = 2;\n while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {\n var _countryCallingCode = number.slice(1, i);\n if (metadata.hasCallingCode(_countryCallingCode)) {\n metadata.selectNumberingPlan(_countryCallingCode);\n return {\n countryCallingCodeSource: isNumberWithIddPrefix ? 'FROM_NUMBER_WITH_IDD' : 'FROM_NUMBER_WITH_PLUS_SIGN',\n countryCallingCode: _countryCallingCode,\n number: number.slice(i)\n };\n }\n i++;\n }\n return {};\n}\n\n// The possible values for the returned `countryCallingCodeSource` are:\n//\n// Copy-pasted from:\n// https://github.com/google/libphonenumber/blob/master/resources/phonenumber.proto\n//\n// // The source from which the country_code is derived. This is not set in the\n// // general parsing method, but in the method that parses and keeps raw_input.\n// // New fields could be added upon request.\n// enum CountryCodeSource {\n// // Default value returned if this is not set, because the phone number was\n// // created using parse, not parseAndKeepRawInput. hasCountryCodeSource will\n// // return false if this is the case.\n// UNSPECIFIED = 0;\n//\n// // The country_code is derived based on a phone number with a leading \"+\",\n// // e.g. the French number \"+33 1 42 68 53 00\".\n// FROM_NUMBER_WITH_PLUS_SIGN = 1;\n//\n// // The country_code is derived based on a phone number with a leading IDD,\n// // e.g. the French number \"011 33 1 42 68 53 00\", as it is dialled from US.\n// FROM_NUMBER_WITH_IDD = 5;\n//\n// // The country_code is derived based on a phone number without a leading\n// // \"+\", e.g. the French number \"33 1 42 68 53 00\" when defaultCountry is\n// // supplied as France.\n// FROM_NUMBER_WITHOUT_PLUS_SIGN = 10;\n//\n// // The country_code is derived NOT based on the phone number itself, but\n// // from the defaultCountry parameter provided in the parsing function by the\n// // clients. This happens mostly for numbers written in the national format\n// // (without country code). For example, this would be set when parsing the\n// // French number \"01 42 68 53 00\", when defaultCountry is supplied as\n// // France.\n// FROM_DEFAULT_COUNTRY = 20;\n// }\n//# sourceMappingURL=extractCountryCallingCode.js.map","import { VALID_PUNCTUATION } from '../constants.js';\n\n// Removes brackets and replaces dashes with spaces.\n//\n// E.g. \"(999) 111-22-33\" -> \"999 111 22 33\"\n//\n// For some reason Google's metadata contains `<intlFormat/>`s with brackets and dashes.\n// Meanwhile, there's no single opinion about using punctuation in international phone numbers.\n//\n// For example, Google's `<intlFormat/>` for USA is `+1 213-373-4253`.\n// And here's a quote from WikiPedia's \"North American Numbering Plan\" page:\n// https://en.wikipedia.org/wiki/North_American_Numbering_Plan\n//\n// \"The country calling code for all countries participating in the NANP is 1.\n// In international format, an NANP number should be listed as +1 301 555 01 00,\n// where 301 is an area code (Maryland).\"\n//\n// I personally prefer the international format without any punctuation.\n// For example, brackets are remnants of the old age, meaning that the\n// phone number part in brackets (so called \"area code\") can be omitted\n// if dialing within the same \"area\".\n// And hyphens were clearly introduced for splitting local numbers into memorizable groups.\n// For example, remembering \"5553535\" is difficult but \"555-35-35\" is much simpler.\n// Imagine a man taking a bus from home to work and seeing an ad with a phone number.\n// He has a couple of seconds to memorize that number until it passes by.\n// If it were spaces instead of hyphens the man wouldn't necessarily get it,\n// but with hyphens instead of spaces the grouping is more explicit.\n// I personally think that hyphens introduce visual clutter,\n// so I prefer replacing them with spaces in international numbers.\n// In the modern age all output is done on displays where spaces are clearly distinguishable\n// so hyphens can be safely replaced with spaces without losing any legibility.\n//\nexport default function applyInternationalSeparatorStyle(formattedNumber) {\n return formattedNumber.replace(new RegExp(\"[\".concat(VALID_PUNCTUATION, \"]+\"), 'g'), ' ').trim();\n}\n//# sourceMappingURL=applyInternationalSeparatorStyle.js.map","import applyInternationalSeparatorStyle from './applyInternationalSeparatorStyle.js';\n\n// This was originally set to $1 but there are some countries for which the\n// first group is not used in the national pattern (e.g. Argentina) so the $1\n// group does not match correctly. Therefore, we use `\\d`, so that the first\n// group actually used in the pattern will be matched.\nexport var FIRST_GROUP_PATTERN = /(\\$\\d)/;\nexport default function formatNationalNumberUsingFormat(number, format, _ref) {\n var useInternationalFormat = _ref.useInternationalFormat,\n withNationalPrefix = _ref.withNationalPrefix,\n carrierCode = _ref.carrierCode,\n metadata = _ref.metadata;\n var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() :\n // This library doesn't use `domestic_carrier_code_formatting_rule`,\n // because that one is only used when formatting phone numbers\n // for dialing from a mobile phone, and this is not a dialing library.\n // carrierCode && format.domesticCarrierCodeFormattingRule()\n // \t// First, replace the $CC in the formatting rule with the desired carrier code.\n // \t// Then, replace the $FG in the formatting rule with the first group\n // \t// and the carrier code combined in the appropriate way.\n // \t? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))\n // \t: (\n // \t\twithNationalPrefix && format.nationalPrefixFormattingRule()\n // \t\t\t? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())\n // \t\t\t: format.format()\n // \t)\n withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());\n if (useInternationalFormat) {\n return applyInternationalSeparatorStyle(formattedNumber);\n }\n return formattedNumber;\n}\n//# sourceMappingURL=formatNationalNumberUsingFormat.js.map","import Metadata from '../metadata.js';\n\n/**\r\n * Pattern that makes it easy to distinguish whether a region has a single\r\n * international dialing prefix or not. If a region has a single international\r\n * prefix (e.g. 011 in USA), it will be represented as a string that contains\r\n * a sequence of ASCII digits, and possibly a tilde, which signals waiting for\r\n * the tone. If there are multiple available international prefixes in a\r\n * region, they will be represented as a regex string that always contains one\r\n * or more characters that are not ASCII digits or a tilde.\r\n */\nvar SINGLE_IDD_PREFIX_REG_EXP = /^[\\d]+(?:[~\\u2053\\u223C\\uFF5E][\\d]+)?$/;\n\n// If the `country` supports IDD calling, it returns a preferred IDD prefix.\n// If the `country` doesn't support IDD calling, it returns `undefined`.\nexport default function getIddPrefix(country, callingCode, metadata) {\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country || callingCode);\n if (countryMetadata.defaultIDDPrefix()) {\n return countryMetadata.defaultIDDPrefix();\n }\n if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {\n return countryMetadata.IDDPrefix();\n }\n}\n//# sourceMappingURL=getIddPrefix.js.map","import { VALID_DIGITS } from '../../constants.js';\n\n// The RFC 3966 format for extensions.\nvar RFC3966_EXTN_PREFIX = ';ext=';\n\n/**\r\n * Helper method for constructing regular expressions for parsing. Creates\r\n * an expression that captures up to max_length digits.\r\n * @return {string} RegEx pattern to capture extension digits.\r\n */\nvar getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) {\n return \"([\".concat(VALID_DIGITS, \"]{1,\").concat(maxLength, \"})\");\n};\n\n/**\r\n * Helper initialiser method to create the regular-expression pattern to match\r\n * extensions.\r\n * Copy-pasted from Google's `libphonenumber`:\r\n * https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766\r\n * @return {string} RegEx pattern to capture extensions.\r\n */\nexport default function createExtensionPattern(purpose) {\n // We cap the maximum length of an extension based on the ambiguity of the way\n // the extension is prefixed. As per ITU, the officially allowed length for\n // extensions is actually 40, but we don't support this since we haven't seen real\n // examples and this introduces many false interpretations as the extension labels\n // are not standardized.\n /** @type {string} */\n var extLimitAfterExplicitLabel = '20';\n /** @type {string} */\n var extLimitAfterLikelyLabel = '15';\n /** @type {string} */\n var extLimitAfterAmbiguousChar = '9';\n /** @type {string} */\n var extLimitWhenNotSure = '6';\n\n /** @type {string} */\n var possibleSeparatorsBetweenNumberAndExtLabel = \"[ \\xA0\\\\t,]*\";\n // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas.\n /** @type {string} */\n var possibleCharsAfterExtLabel = \"[:\\\\.\\uFF0E]?[ \\xA0\\\\t,-]*\";\n /** @type {string} */\n var optionalExtnSuffix = \"#?\";\n\n // Here the extension is called out in more explicit way, i.e mentioning it obvious\n // patterns like \"ext.\".\n /** @type {string} */\n var explicitExtLabels = \"(?:e?xt(?:ensi(?:o\\u0301?|\\xF3))?n?|\\uFF45?\\uFF58\\uFF54\\uFF4E?|\\u0434\\u043E\\u0431|anexo)\";\n // One-character symbols that can be used to indicate an extension, and less\n // commonly used or more ambiguous extension labels.\n /** @type {string} */\n var ambiguousExtLabels = \"(?:[x\\uFF58#\\uFF03~\\uFF5E]|int|\\uFF49\\uFF4E\\uFF54)\";\n // When extension is not separated clearly.\n /** @type {string} */\n var ambiguousSeparator = \"[- ]+\";\n // This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching\n // comma as extension label may have it.\n /** @type {string} */\n var possibleSeparatorsNumberExtLabelNoComma = \"[ \\xA0\\\\t]*\";\n // \",,\" is commonly used for auto dialling the extension when connected. First\n // comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do\n // not repeat it here. Semi-colon works in Iphone and Android also to pop up a\n // button with the extension number following.\n /** @type {string} */\n var autoDiallingAndExtLabelsFound = \"(?:,{2}|;)\";\n\n /** @type {string} */\n var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);\n /** @type {string} */\n var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;\n /** @type {string} */\n var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;\n /** @type {string} */\n var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + \"#\";\n\n /** @type {string} */\n var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;\n /** @type {string} */\n var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + \"(?:,)+\" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;\n\n // The first regular expression covers RFC 3966 format, where the extension is added\n // using \";ext=\". The second more generic where extension is mentioned with explicit\n // labels like \"ext:\". In both the above cases we allow more numbers in extension than\n // any other extension labels. The third one captures when single character extension\n // labels or less commonly used labels are used. In such cases we capture fewer\n // extension digits in order to reduce the chance of falsely interpreting two\n // numbers beside each other as a number + extension. The fourth one covers the\n // special case of American numbers where the extension is written with a hash\n // at the end, such as \"- 503#\". The fifth one is exclusively for extension\n // autodialling formats which are used when dialling and in this case we accept longer\n // extensions. The last one is more liberal on the number of commas that acts as\n // extension labels, so we have a strict cap on the number of digits in such extensions.\n return rfcExtn + \"|\" + explicitExtn + \"|\" + ambiguousExtn + \"|\" + americanStyleExtnWithSuffix + \"|\" + autoDiallingExtn + \"|\" + onlyCommasExtn;\n}\n//# sourceMappingURL=createExtensionPattern.js.map","import { MIN_LENGTH_FOR_NSN, VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from '../constants.js';\nimport createExtensionPattern from './extension/createExtensionPattern.js';\n\n// Regular expression of viable phone numbers. This is location independent.\n// Checks we have at least three leading digits, and only valid punctuation,\n// alpha characters and digits in the phone number. Does not include extension\n// data. The symbol 'x' is allowed here as valid punctuation since it is often\n// used as a placeholder for carrier codes, for example in Brazilian phone\n// numbers. We also allow multiple '+' characters at the start.\n//\n// Corresponds to the following:\n// [digits]{minLengthNsn}|\n// plus_sign*\n// (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*\n//\n// The first reg-ex is to allow short numbers (two digits long) to be parsed if\n// they are entered as \"15\" etc, but only if there is no punctuation in them.\n// The second expression restricts the number of digits to three or more, but\n// then allows them to be in international form, and to have alpha-characters\n// and punctuation. We split up the two reg-exes here and combine them when\n// creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it\n// with ^ and append $ to each branch.\n//\n// \"Note VALID_PUNCTUATION starts with a -,\n// so must be the first in the range\" (c) Google devs.\n// (wtf did they mean by saying that; probably nothing)\n//\nvar MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}';\n//\n// And this is the second reg-exp:\n// (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp)\n//\nexport var VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*';\n\n// This regular expression isn't present in Google's `libphonenumber`\n// and is only used to determine whether the phone number being input\n// is too short for it to even consider it a \"valid\" number.\n// This is just a way to differentiate between a really invalid phone\n// number like \"abcde\" and a valid phone number that a user has just\n// started inputting, like \"+1\" or \"1\": both these cases would be\n// considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this\n// library can provide a more detailed error message — whether it's\n// really \"not a number\", or is it just a start of a valid phone number.\nvar VALID_PHONE_NUMBER_START_REG_EXP = new RegExp('^' + '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){1,2}' + '$', 'i');\nexport var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER +\n// Phone number extensions\n'(?:' + createExtensionPattern() + ')?';\n\n// The combined regular expression for valid phone numbers:\n//\nvar VALID_PHONE_NUMBER_PATTERN = new RegExp(\n// Either a short two-digit-only phone number\n'^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' +\n// Or a longer fully parsed phone number (min 3 characters)\n'^' + VALID_PHONE_NUMBER_WITH_EXTENSION + '$', 'i');\n\n// Checks to see if the string of characters could possibly be a phone number at\n// all. At the moment, checks to see that the string begins with at least 2\n// digits, ignoring any punctuation commonly found in phone numbers. This method\n// does not require the number to be normalized in advance - but does assume\n// that leading non-number symbols have been removed, such as by the method\n// `extract_possible_number`.\n//\nexport default function isViablePhoneNumber(number) {\n return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);\n}\n\n// This is just a way to differentiate between a really invalid phone\n// number like \"abcde\" and a valid phone number that a user has just\n// started inputting, like \"+1\" or \"1\": both these cases would be\n// considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this\n// library can provide a more detailed error message — whether it's\n// really \"not a number\", or is it just a start of a valid phone number.\nexport function isViablePhoneNumberStart(number) {\n return VALID_PHONE_NUMBER_START_REG_EXP.test(number);\n}\n//# sourceMappingURL=isViablePhoneNumber.js.map","function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nfunction _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport isViablePhoneNumber from './isViablePhoneNumber.js';\n\n// https://www.ietf.org/rfc/rfc3966.txt\n\n/**\r\n * @param {string} text - Phone URI (RFC 3966).\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\nexport function parseRFC3966(text) {\n var number;\n var ext;\n\n // Replace \"tel:\" with \"tel=\" for parsing convenience.\n text = text.replace(/^tel:/, 'tel=');\n for (var _iterator = _createForOfIteratorHelperLoose(text.split(';')), _step; !(_step = _iterator()).done;) {\n var part = _step.value;\n var _part$split = part.split('='),\n _part$split2 = _slicedToArray(_part$split, 2),\n name = _part$split2[0],\n value = _part$split2[1];\n switch (name) {\n case 'tel':\n number = value;\n break;\n case 'ext':\n ext = value;\n break;\n case 'phone-context':\n // Only \"country contexts\" are supported.\n // \"Domain contexts\" are ignored.\n if (value[0] === '+') {\n number = value + number;\n }\n break;\n }\n }\n\n // If the phone number is not viable, then abort.\n if (!isViablePhoneNumber(number)) {\n return {};\n }\n var result = {\n number: number\n };\n if (ext) {\n result.ext = ext;\n }\n return result;\n}\n\n/**\r\n * @param {object} - `{ ?number, ?extension }`.\r\n * @return {string} Phone URI (RFC 3966).\r\n */\nexport function formatRFC3966(_ref) {\n var number = _ref.number,\n ext = _ref.ext;\n if (!number) {\n return '';\n }\n if (number[0] !== '+') {\n throw new Error(\"\\\"formatRFC3966()\\\" expects \\\"number\\\" to be in E.164 format.\");\n }\n return \"tel:\".concat(number).concat(ext ? ';ext=' + ext : '');\n}\n//# sourceMappingURL=RFC3966.js.map","// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\n\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport formatNationalNumberUsingFormat from './helpers/formatNationalNumberUsingFormat.js';\nimport Metadata, { getCountryCallingCode } from './metadata.js';\nimport getIddPrefix from './helpers/getIddPrefix.js';\nimport { formatRFC3966 } from './helpers/RFC3966.js';\nvar DEFAULT_OPTIONS = {\n formatExtension: function formatExtension(formattedNumber, extension, metadata) {\n return \"\".concat(formattedNumber).concat(metadata.ext()).concat(extension);\n }\n};\n\n/**\r\n * Formats a phone number.\r\n *\r\n * format(phoneNumberInstance, 'INTERNATIONAL', { ..., v2: true }, metadata)\r\n * format(phoneNumberInstance, 'NATIONAL', { ..., v2: true }, metadata)\r\n *\r\n * format({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', { ... }, metadata)\r\n * format({ phone: '8005553535', country: 'RU' }, 'NATIONAL', undefined, metadata)\r\n *\r\n * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.\r\n * @param {string} format\r\n * @param {object} [options]\r\n * @param {object} metadataJson\r\n * @return {string}\r\n */\nexport default function formatNumber(input, format, options, metadataJson) {\n // Apply default options.\n if (options) {\n // Using ES6 \"rest spread\" syntax here didn't work with `babel`/`istanbul`\n // for some weird reason: this line of code would cause the code coverage\n // to show as not 100%. That's because `babel`/`istanbul`, for some weird reason,\n // apparently doesn't know how to properly exclude Babel polyfills from code coverage.\n //\n // options = { ...DEFAULT_OPTIONS, ...options }\n //\n options = merge({}, DEFAULT_OPTIONS, options);\n } else {\n options = DEFAULT_OPTIONS;\n }\n var metadata = new Metadata(metadataJson);\n\n // Normally, the `input` object is supposed to be a `PhoneNumber` class instance.\n // Also, according to the `PhoneNumber` class source code, `country` can't be \"001\".\n // It means that normally `input.country` or `input.countryCallingCode` is supposed\n // to be present because either of the two is always required to exist in a `PhoneNumber` instance.\n // This means that realistically, it's gonna step into either the first `if`\n // or the following `else if`, and normally it won't even reach the legacy-compatibility\n // `else return input.phone || ''` part.\n // So normally, it won't ever return an empty string here.\n if (input.country && input.country !== '001') {\n // Validate `input.country`.\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n metadata.selectNumberingPlan(input.country);\n } else if (input.countryCallingCode) {\n metadata.selectNumberingPlan(input.countryCallingCode);\n } else return input.phone || '';\n var countryCallingCode = metadata.countryCallingCode();\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone;\n\n // This variable should have been declared inside `case`s\n // but Babel has a bug and it says \"duplicate variable declaration\".\n var number;\n switch (format) {\n case 'NATIONAL':\n // Normally, the `input` object is supposed to be a `PhoneNumber` class instance,\n // and a `PhoneNumber` class instance is always required to have a `nationalNumber`.\n // This means that the `if (!nationalNumber)` below is just for legacy-compatibility\n // and it normally can't really happen, so normally it won't ever return an empty string here.\n if (!nationalNumber) {\n return '';\n }\n number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n case 'INTERNATIONAL':\n // Legacy argument support.\n // (`{ country: ..., phone: '' }`)\n if (!nationalNumber) {\n return \"+\".concat(countryCallingCode);\n }\n number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options);\n number = \"+\".concat(countryCallingCode, \" \").concat(number);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n case 'E.164':\n // `E.164` doesn't define \"phone number extensions\".\n return \"+\".concat(countryCallingCode).concat(nationalNumber);\n case 'RFC3966':\n return formatRFC3966({\n number: \"+\".concat(countryCallingCode).concat(nationalNumber),\n ext: input.ext\n });\n\n // For reference, here's Google's IDD formatter:\n // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546\n // Not saying that this IDD formatter replicates it 1:1, but it seems to work.\n // Who would even need to format phone numbers in IDD format anyway?\n case 'IDD':\n // If the required `fromCountry` parameter is not passed, it will return `undefined`.\n if (!options.fromCountry) {\n return;\n // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')\n }\n var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);\n // If the country of the phone number doesn't support IDD calling, it will return `undefined`.\n if (!formattedNumber) {\n return;\n }\n return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);\n default:\n throw new Error(\"Unknown \\\"format\\\" argument passed to \\\"formatNumber()\\\": \\\"\".concat(format, \"\\\"\"));\n }\n}\nfunction formatNationalNumber(number, carrierCode, formatAs, metadata, options) {\n var format = chooseFormatForNumber(metadata.formats(), number);\n if (!format) {\n return number;\n }\n return formatNationalNumberUsingFormat(number, format, {\n useInternationalFormat: formatAs === 'INTERNATIONAL',\n withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,\n carrierCode: carrierCode,\n metadata: metadata\n });\n}\nexport function chooseFormatForNumber(availableFormats, nationalNumber) {\n // Using a `for ... of` loop here didn't work with `babel`/`istanbul`:\n // for some weird reason, it showed code coverage less than 100%.\n // That's because `babel`/`istanbul`, for some weird reason,\n // apparently doesn't know how to properly exclude Babel polyfills from code coverage.\n //\n // for (const format of availableFormats) { ... }\n //\n return pickFirstMatchingElement(availableFormats, function (format) {\n // Validate leading digits.\n // The test case for \"else path\" could be found by searching for\n // \"format.leadingDigitsPatterns().length === 0\".\n if (format.leadingDigitsPatterns().length > 0) {\n // The last leading_digits_pattern is used here, as it is the most detailed\n var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1];\n // If leading digits don't match then move on to the next phone number format\n if (nationalNumber.search(lastLeadingDigitsPattern) !== 0) {\n return false;\n }\n }\n // Check that the national number matches the phone number format regular expression\n return matchesEntirely(nationalNumber, format.pattern());\n });\n}\nfunction addExtension(formattedNumber, ext, metadata, formatExtension) {\n return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;\n}\nfunction formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {\n var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata);\n // When calling within the same country calling code.\n if (fromCountryCallingCode === countryCallingCode) {\n var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata);\n // For NANPA regions, return the national format for these regions\n // but prefix it with the country calling code.\n if (countryCallingCode === '1') {\n return countryCallingCode + ' ' + formattedNumber;\n }\n // If regions share a country calling code, the country calling code need\n // not be dialled. This also applies when dialling within a region, so this\n // if clause covers both these cases. Technically this is the case for\n // dialling from La Reunion to other overseas departments of France (French\n // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover\n // this edge case for now and for those cases return the version including\n // country calling code. Details here:\n // http://www.petitfute.com/voyage/225-info-pratiques-reunion\n //\n return formattedNumber;\n }\n var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata);\n if (iddPrefix) {\n return \"\".concat(iddPrefix, \" \").concat(countryCallingCode, \" \").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata));\n }\n}\nfunction merge() {\n var i = 1;\n for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {\n objects[_key] = arguments[_key];\n }\n while (i < objects.length) {\n if (objects[i]) {\n for (var key in objects[i]) {\n objects[0][key] = objects[i][key];\n }\n }\n i++;\n }\n return objects[0];\n}\nfunction pickFirstMatchingElement(elements, testFunction) {\n var i = 0;\n while (i < elements.length) {\n if (testFunction(elements[i])) {\n return elements[i];\n }\n i++;\n }\n}\n//# sourceMappingURL=format.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport Metadata, { validateMetadata } from './metadata.js';\nimport isPossibleNumber from './isPossible.js';\nimport isValidNumber from './isValid.js';\nimport getNumberType from './helpers/getNumberType.js';\nimport getCountryAndCallingCodeFromOneOfThem from './helpers/getCountryAndCallingCodeFromOneOfThem.js';\nimport getPossibleCountriesForNumber from './helpers/getPossibleCountriesForNumber.js';\nimport extractCountryCallingCode from './helpers/extractCountryCallingCode.js';\nimport isObject from './helpers/isObject.js';\nimport formatNumber from './format.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\nvar PhoneNumber = /*#__PURE__*/function () {\n /**\r\n * @param {string} countryOrCountryCallingCode\r\n * @param {string} nationalNumber\r\n * @param {object} metadata — Metadata JSON\r\n * @return {PhoneNumber}\r\n */\n function PhoneNumber(countryOrCountryCallingCode, nationalNumber, metadata) {\n _classCallCheck(this, PhoneNumber);\n // Validate `countryOrCountryCallingCode` argument.\n if (!countryOrCountryCallingCode) {\n throw new TypeError('First argument is required');\n }\n if (typeof countryOrCountryCallingCode !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n // In case of public API use: `constructor(number, metadata)`.\n // Transform the arguments from `constructor(number, metadata)` to\n // `constructor(countryOrCountryCallingCode, nationalNumber, metadata)`.\n if (countryOrCountryCallingCode[0] === '+' && !nationalNumber) {\n throw new TypeError('`metadata` argument not passed');\n }\n if (isObject(nationalNumber) && isObject(nationalNumber.countries)) {\n metadata = nationalNumber;\n var e164Number = countryOrCountryCallingCode;\n if (!E164_NUMBER_REGEXP.test(e164Number)) {\n throw new Error('Invalid `number` argument passed: must consist of a \"+\" followed by digits');\n }\n var _extractCountryCallin = extractCountryCallingCode(e164Number, undefined, undefined, undefined, metadata),\n _countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number;\n nationalNumber = number;\n countryOrCountryCallingCode = _countryCallingCode;\n if (!nationalNumber) {\n throw new Error('Invalid `number` argument passed: too short');\n }\n }\n\n // Validate `nationalNumber` argument.\n if (!nationalNumber) {\n throw new TypeError('`nationalNumber` argument is required');\n }\n if (typeof nationalNumber !== 'string') {\n throw new TypeError('`nationalNumber` argument must be a string');\n }\n\n // Validate `metadata` argument.\n validateMetadata(metadata);\n\n // Initialize properties.\n var _getCountryAndCalling = getCountryAndCallingCodeFromOneOfThem(countryOrCountryCallingCode, metadata),\n country = _getCountryAndCalling.country,\n countryCallingCode = _getCountryAndCalling.callingCode;\n this.country = country;\n this.countryCallingCode = countryCallingCode;\n this.nationalNumber = nationalNumber;\n this.number = '+' + this.countryCallingCode + this.nationalNumber;\n // Exclude `metadata` property output from `PhoneNumber.toString()`\n // so that it doesn't clutter the console output of Node.js.\n // Previously, when Node.js did `console.log(new PhoneNumber(...))`,\n // it would output the whole internal structure of the `metadata` object.\n this.getMetadata = function () {\n return metadata;\n };\n }\n return _createClass(PhoneNumber, [{\n key: \"setExt\",\n value: function setExt(ext) {\n this.ext = ext;\n }\n }, {\n key: \"getPossibleCountries\",\n value: function getPossibleCountries() {\n if (this.country) {\n return [this.country];\n }\n return getPossibleCountriesForNumber(this.countryCallingCode, this.nationalNumber, this.getMetadata());\n }\n }, {\n key: \"isPossible\",\n value: function isPossible() {\n return isPossibleNumber(this, {\n v2: true\n }, this.getMetadata());\n }\n }, {\n key: \"isValid\",\n value: function isValid() {\n return isValidNumber(this, {\n v2: true\n }, this.getMetadata());\n }\n }, {\n key: \"isNonGeographic\",\n value: function isNonGeographic() {\n var metadata = new Metadata(this.getMetadata());\n return metadata.isNonGeographicCallingCode(this.countryCallingCode);\n }\n }, {\n key: \"isEqual\",\n value: function isEqual(phoneNumber) {\n return this.number === phoneNumber.number && this.ext === phoneNumber.ext;\n }\n\n // `validateLength()` method was originally meant to be an equivalent for `validatePhoneNumberLength()`.\n //\n // Later, it became apparent that it's not really a true equivalent.\n // The reason is that a `PhoneNumber` instance is not created\n // when the phone number string is too short for it to be considered a valid phone number:\n // * When there must be at least 2 national (significant) number digits: `\"1\"`.\n // * When the country calling code part of an international number is incomplete: `\"+12\"`.\n //\n // So leaving this `validateLength()` method here would suggest a hidden anti-pattern\n // of using it instead of `validatePhoneNumberLength()` while ignoring\n // the \"too short to be even possible\" case from phone number length validation.\n // And ignoring that case wouldn't make any sense in a real-world application\n // because it would still be a valid case that should be handled.\n //\n // Because of that, this method was eventually commented out in order to not introduce\n // that kind of an anti-pattern.\n //\n // validateLength() {\n // \tconst result = checkNumberLength(\n // \t\tthis.nationalNumber,\n // \t\tundefined,\n // \t\tthis.getMetadata()\n // \t)\n // \tif (result !== 'IS_POSSIBLE') {\n // \t\treturn result\n // \t}\n // }\n }, {\n key: \"getType\",\n value: function getType() {\n return getNumberType(this, {\n v2: true\n }, this.getMetadata());\n }\n }, {\n key: \"format\",\n value: function format(_format, options) {\n return formatNumber(this, _format, options ? _objectSpread(_objectSpread({}, options), {}, {\n v2: true\n }) : {\n v2: true\n }, this.getMetadata());\n }\n }, {\n key: \"formatNational\",\n value: function formatNational(options) {\n return this.format('NATIONAL', options);\n }\n }, {\n key: \"formatInternational\",\n value: function formatInternational(options) {\n return this.format('INTERNATIONAL', options);\n }\n }, {\n key: \"getURI\",\n value: function getURI(options) {\n return this.format('RFC3966', options);\n }\n }]);\n}();\nexport { PhoneNumber as default };\nvar E164_NUMBER_REGEXP = /^\\+\\d+$/;\n//# sourceMappingURL=PhoneNumber.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _wrapNativeSuper(t) { var r = \"function\" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if (\"function\" != typeof t) throw new TypeError(\"Super expression must either be null or a function\"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }\nfunction _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf(\"[native code]\"); } catch (n) { return \"function\" == typeof t; } }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\n// https://stackoverflow.com/a/46971044/970769\n// \"Breaking changes in Typescript 2.1\"\n// \"Extending built-ins like Error, Array, and Map may no longer work.\"\n// \"As a recommendation, you can manually adjust the prototype immediately after any super(...) calls.\"\n// https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\nvar ParseError = /*#__PURE__*/function (_Error) {\n function ParseError(code) {\n var _this;\n _classCallCheck(this, ParseError);\n _this = _callSuper(this, ParseError, [code]);\n // Set the prototype explicitly.\n // Any subclass of FooError will have to manually set the prototype as well.\n Object.setPrototypeOf(_this, ParseError.prototype);\n _this.name = _this.constructor.name;\n return _this;\n }\n _inherits(ParseError, _Error);\n return _createClass(ParseError);\n}(/*#__PURE__*/_wrapNativeSuper(Error));\nexport { ParseError as default };\n//# sourceMappingURL=ParseError.js.map","import createExtensionPattern from './createExtensionPattern.js';\n\n// Regexp of all known extension prefixes used by different regions followed by\n// 1 or more valid digits, for use when parsing.\nvar EXTN_PATTERN = new RegExp('(?:' + createExtensionPattern() + ')$', 'i');\n\n// Strips any extension (as in, the part of the number dialled after the call is\n// connected, usually indicated with extn, ext, x or similar) from the end of\n// the number, and returns it.\nexport default function extractExtension(number) {\n var start = number.search(EXTN_PATTERN);\n if (start < 0) {\n return {};\n }\n // If we find a potential extension, and the number preceding this is a viable\n // number, we assume it is an extension.\n var numberWithoutExtension = number.slice(0, start);\n var matches = number.match(EXTN_PATTERN);\n var i = 1;\n while (i < matches.length) {\n if (matches[i]) {\n return {\n number: numberWithoutExtension,\n ext: matches[i]\n };\n }\n i++;\n }\n}\n//# sourceMappingURL=extractExtension.js.map","function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\n// These mappings map a character (key) to a specific digit that should\n// replace it for normalization purposes. Non-European digits that\n// may be used in phone numbers are mapped to a European equivalent.\n//\n// E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\n//\nexport var DIGITS = {\n '0': '0',\n '1': '1',\n '2': '2',\n '3': '3',\n '4': '4',\n '5': '5',\n '6': '6',\n '7': '7',\n '8': '8',\n '9': '9',\n \"\\uFF10\": '0',\n // Fullwidth digit 0\n \"\\uFF11\": '1',\n // Fullwidth digit 1\n \"\\uFF12\": '2',\n // Fullwidth digit 2\n \"\\uFF13\": '3',\n // Fullwidth digit 3\n \"\\uFF14\": '4',\n // Fullwidth digit 4\n \"\\uFF15\": '5',\n // Fullwidth digit 5\n \"\\uFF16\": '6',\n // Fullwidth digit 6\n \"\\uFF17\": '7',\n // Fullwidth digit 7\n \"\\uFF18\": '8',\n // Fullwidth digit 8\n \"\\uFF19\": '9',\n // Fullwidth digit 9\n \"\\u0660\": '0',\n // Arabic-indic digit 0\n \"\\u0661\": '1',\n // Arabic-indic digit 1\n \"\\u0662\": '2',\n // Arabic-indic digit 2\n \"\\u0663\": '3',\n // Arabic-indic digit 3\n \"\\u0664\": '4',\n // Arabic-indic digit 4\n \"\\u0665\": '5',\n // Arabic-indic digit 5\n \"\\u0666\": '6',\n // Arabic-indic digit 6\n \"\\u0667\": '7',\n // Arabic-indic digit 7\n \"\\u0668\": '8',\n // Arabic-indic digit 8\n \"\\u0669\": '9',\n // Arabic-indic digit 9\n \"\\u06F0\": '0',\n // Eastern-Arabic digit 0\n \"\\u06F1\": '1',\n // Eastern-Arabic digit 1\n \"\\u06F2\": '2',\n // Eastern-Arabic digit 2\n \"\\u06F3\": '3',\n // Eastern-Arabic digit 3\n \"\\u06F4\": '4',\n // Eastern-Arabic digit 4\n \"\\u06F5\": '5',\n // Eastern-Arabic digit 5\n \"\\u06F6\": '6',\n // Eastern-Arabic digit 6\n \"\\u06F7\": '7',\n // Eastern-Arabic digit 7\n \"\\u06F8\": '8',\n // Eastern-Arabic digit 8\n \"\\u06F9\": '9' // Eastern-Arabic digit 9\n};\nexport function parseDigit(character) {\n return DIGITS[character];\n}\n\n/**\r\n * Parses phone number digits from a string.\r\n * Drops all punctuation leaving only digits.\r\n * Also converts wide-ascii and arabic-indic numerals to conventional numerals.\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n * @param {string} string\r\n * @return {string}\r\n * @example\r\n * ```js\r\n * parseDigits('8 (800) 555')\r\n * // Outputs '8800555'.\r\n * ```\r\n */\nexport default function parseDigits(string) {\n var result = '';\n // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes) but digits\n // (including non-European ones) don't fall into that range\n // so such \"exotic\" characters would be discarded anyway.\n for (var _iterator = _createForOfIteratorHelperLoose(string.split('')), _step; !(_step = _iterator()).done;) {\n var character = _step.value;\n var digit = parseDigit(character);\n if (digit) {\n result += digit;\n }\n }\n return result;\n}\n//# sourceMappingURL=parseDigits.js.map","function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport { parseDigit } from './helpers/parseDigits.js';\n\n/**\r\n * Parses phone number characters from a string.\r\n * Drops all punctuation leaving only digits and the leading `+` sign (if any).\r\n * Also converts wide-ascii and arabic-indic numerals to conventional numerals.\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n * @param {string} string\r\n * @return {string}\r\n * @example\r\n * ```js\r\n * // Outputs '8800555'.\r\n * parseIncompletePhoneNumber('8 (800) 555')\r\n * // Outputs '+7800555'.\r\n * parseIncompletePhoneNumber('+7 800 555')\r\n * ```\r\n */\nexport default function parseIncompletePhoneNumber(string) {\n var result = '';\n // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes) but digits\n // (including non-European ones) don't fall into that range\n // so such \"exotic\" characters would be discarded anyway.\n for (var _iterator = _createForOfIteratorHelperLoose(string.split('')), _step; !(_step = _iterator()).done;) {\n var character = _step.value;\n result += parsePhoneNumberCharacter(character, result) || '';\n }\n return result;\n}\n\n/**\r\n * Parses next character while parsing phone number digits (including a `+`)\r\n * from text: discards everything except `+` and digits, and `+` is only allowed\r\n * at the start of a phone number.\r\n * For example, is used in `react-phone-number-input` where it uses\r\n * [`input-format`](https://gitlab.com/catamphetamine/input-format).\r\n * @param {string} character - Yet another character from raw input string.\r\n * @param {string?} prevParsedCharacters - Previous parsed characters.\r\n * @param {function?} eventListener - An optional \"on event\" function.\r\n * @return {string?} The parsed character.\r\n */\nexport function parsePhoneNumberCharacter(character, prevParsedCharacters, eventListener) {\n // Only allow a leading `+`.\n if (character === '+') {\n // If this `+` is not the first parsed character\n // then discard it.\n if (prevParsedCharacters) {\n // `eventListener` argument was added to this `export`ed function on Dec 26th, 2023.\n // Any 3rd-party code that used to `import` and call this function before that\n // won't be passing any `eventListener` argument.\n //\n // The addition of the `eventListener` argument was to fix the slightly-weird behavior\n // of parsing an input string when the user inputs something like `\"2+7\"\n // https://github.com/catamphetamine/react-phone-number-input/issues/437\n //\n // If the parser encounters an unexpected `+` in a string being parsed\n // then it simply discards that out-of-place `+` and any following characters.\n //\n if (typeof eventListener === 'function') {\n eventListener('end');\n }\n return;\n }\n return '+';\n }\n // Allow digits.\n return parseDigit(character);\n}\n//# sourceMappingURL=parseIncompletePhoneNumber.js.map","// When phone numbers are written in `RFC3966` format — `\"tel:+12133734253\"` —\n// they can have their \"calling code\" part written separately in a `phone-context` parameter.\n// Example: `\"tel:12133734253;phone-context=+1\"`.\n// This function parses the full phone number from the local number and the `phone-context`\n// when the `phone-context` contains a `+` sign.\n\nimport { VALID_DIGITS\n// PLUS_CHARS\n} from '../constants.js';\nexport var PLUS_SIGN = '+';\nvar RFC3966_VISUAL_SEPARATOR_ = '[\\\\-\\\\.\\\\(\\\\)]?';\nvar RFC3966_PHONE_DIGIT_ = '(' + '[' + VALID_DIGITS + ']' + '|' + RFC3966_VISUAL_SEPARATOR_ + ')';\nvar RFC3966_GLOBAL_NUMBER_DIGITS_ = '^' + '\\\\' + PLUS_SIGN + RFC3966_PHONE_DIGIT_ + '*' + '[' + VALID_DIGITS + ']' + RFC3966_PHONE_DIGIT_ + '*' + '$';\n\n/**\r\n * Regular expression of valid global-number-digits for the phone-context\r\n * parameter, following the syntax defined in RFC3966.\r\n */\nvar RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, 'g');\n\n// In this port of Google's library, we don't accept alpha characters in phone numbers.\n// const ALPHANUM_ = VALID_ALPHA_ + VALID_DIGITS\nvar ALPHANUM_ = VALID_DIGITS;\nvar RFC3966_DOMAINLABEL_ = '[' + ALPHANUM_ + ']+((\\\\-)*[' + ALPHANUM_ + '])*';\nvar VALID_ALPHA_ = 'a-zA-Z';\nvar RFC3966_TOPLABEL_ = '[' + VALID_ALPHA_ + ']+((\\\\-)*[' + ALPHANUM_ + '])*';\nvar RFC3966_DOMAINNAME_ = '^(' + RFC3966_DOMAINLABEL_ + '\\\\.)*' + RFC3966_TOPLABEL_ + '\\\\.?$';\n\n/**\r\n * Regular expression of valid domainname for the phone-context parameter,\r\n * following the syntax defined in RFC3966.\r\n */\nvar RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, 'g');\nexport var RFC3966_PREFIX_ = 'tel:';\nexport var RFC3966_PHONE_CONTEXT_ = ';phone-context=';\nexport var RFC3966_ISDN_SUBADDRESS_ = ';isub=';\n\n/**\r\n * Extracts the value of the phone-context parameter of `numberToExtractFrom`,\r\n * following the syntax defined in RFC3966.\r\n *\r\n * @param {string} numberToExtractFrom\r\n * @return {string|null} the extracted string (possibly empty), or `null` if no phone-context parameter is found.\r\n */\nexport default function extractPhoneContext(numberToExtractFrom) {\n var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_);\n // If no phone-context parameter is present\n if (indexOfPhoneContext < 0) {\n return null;\n }\n var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length;\n // If phone-context parameter is empty\n if (phoneContextStart >= numberToExtractFrom.length) {\n return '';\n }\n var phoneContextEnd = numberToExtractFrom.indexOf(';', phoneContextStart);\n // If phone-context is not the last parameter\n if (phoneContextEnd >= 0) {\n return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd);\n } else {\n return numberToExtractFrom.substring(phoneContextStart);\n }\n}\n\n/**\r\n * Returns whether the value of phoneContext follows the syntax defined in RFC3966.\r\n *\r\n * @param {string|null} phoneContext\r\n * @return {boolean}\r\n */\nexport function isPhoneContextValid(phoneContext) {\n if (phoneContext === null) {\n return true;\n }\n if (phoneContext.length === 0) {\n return false;\n }\n\n // Does phone-context value match pattern of global-number-digits or domainname.\n return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);\n}\n//# sourceMappingURL=extractPhoneContext.js.map","import extractPhoneContext, { isPhoneContextValid, PLUS_SIGN, RFC3966_PREFIX_, RFC3966_PHONE_CONTEXT_, RFC3966_ISDN_SUBADDRESS_ } from './extractPhoneContext.js';\nimport ParseError from '../ParseError.js';\n\n/**\r\n * @param {string} numberToParse\r\n * @param {string} nationalNumber\r\n * @return {}\r\n */\nexport default function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) {\n var extractFormattedPhoneNumber = _ref.extractFormattedPhoneNumber;\n var phoneContext = extractPhoneContext(numberToParse);\n if (!isPhoneContextValid(phoneContext)) {\n throw new ParseError('NOT_A_NUMBER');\n }\n var phoneNumberString;\n if (phoneContext === null) {\n // Extract a possible number from the string passed in.\n // (this strips leading characters that could not be the start of a phone number)\n phoneNumberString = extractFormattedPhoneNumber(numberToParse) || '';\n } else {\n phoneNumberString = '';\n\n // If the phone context contains a phone number prefix, we need to capture\n // it, whereas domains will be ignored.\n if (phoneContext.charAt(0) === PLUS_SIGN) {\n phoneNumberString += phoneContext;\n }\n\n // Now append everything between the \"tel:\" prefix and the phone-context.\n // This should include the national number, an optional extension or\n // isdn-subaddress component. Note we also handle the case when \"tel:\" is\n // missing, as we have seen in some of the phone number inputs.\n // In that case, we append everything from the beginning.\n var indexOfRfc3966Prefix = numberToParse.indexOf(RFC3966_PREFIX_);\n var indexOfNationalNumber;\n // RFC 3966 \"tel:\" prefix is preset at this stage because\n // `isPhoneContextValid()` requires it to be present.\n /* istanbul ignore else */\n if (indexOfRfc3966Prefix >= 0) {\n indexOfNationalNumber = indexOfRfc3966Prefix + RFC3966_PREFIX_.length;\n } else {\n indexOfNationalNumber = 0;\n }\n var indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT_);\n phoneNumberString += numberToParse.substring(indexOfNationalNumber, indexOfPhoneContext);\n }\n\n // Delete the isdn-subaddress and everything after it if it is present.\n // Note extension won't appear at the same time with isdn-subaddress\n // according to paragraph 5.3 of the RFC3966 spec.\n var indexOfIsdn = phoneNumberString.indexOf(RFC3966_ISDN_SUBADDRESS_);\n if (indexOfIsdn > 0) {\n phoneNumberString = phoneNumberString.substring(0, indexOfIsdn);\n }\n // If both phone context and isdn-subaddress are absent but other\n // parameters are present, the parameters are left in nationalNumber.\n // This is because we are concerned about deleting content from a potential\n // number string when there is no strong evidence that the number is\n // actually written in RFC3966.\n\n if (phoneNumberString !== '') {\n return phoneNumberString;\n }\n}\n//# sourceMappingURL=extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js.map","// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\n\nimport { VALID_DIGITS, PLUS_CHARS, MIN_LENGTH_FOR_NSN, MAX_LENGTH_FOR_NSN } from './constants.js';\nimport ParseError from './ParseError.js';\nimport Metadata from './metadata.js';\nimport isViablePhoneNumber, { isViablePhoneNumberStart } from './helpers/isViablePhoneNumber.js';\nimport extractExtension from './helpers/extension/extractExtension.js';\nimport parseIncompletePhoneNumber from './parseIncompletePhoneNumber.js';\nimport getCountryCallingCode from './getCountryCallingCode.js';\nimport { isPossibleNumber } from './isPossible.js';\n// import { parseRFC3966 } from './helpers/RFC3966.js'\nimport PhoneNumber from './PhoneNumber.js';\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport extractCountryCallingCode from './helpers/extractCountryCallingCode.js';\nimport extractNationalNumber from './helpers/extractNationalNumber.js';\n// import stripIddPrefix from './helpers/stripIddPrefix.js'\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js';\nimport extractFormattedPhoneNumberFromPossibleRfc3966NumberUri from './helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js';\n\n// We don't allow input strings for parsing to be longer than 250 chars.\n// This prevents malicious input from consuming CPU.\nvar MAX_INPUT_STRING_LENGTH = 250;\n\n// This consists of the plus symbol, digits, and arabic-indic digits.\nvar PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']');\n\n// Regular expression of trailing characters that we want to remove.\n// A trailing `#` is sometimes used when writing phone numbers with extensions in US.\n// Example: \"+1 (645) 123 1234-910#\" number has extension \"910\".\nvar AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + '#' + ']+$');\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\n// Examples:\n//\n// ```js\n// parse('8 (800) 555-35-35', 'RU')\n// parse('8 (800) 555-35-35', 'RU', metadata)\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } })\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)\n// parse('+7 800 555 35 35')\n// parse('+7 800 555 35 35', metadata)\n// ```\n//\n\n/**\r\n * Parses a phone number.\r\n *\r\n * parse('123456789', { defaultCountry: 'RU', v2: true }, metadata)\r\n * parse('123456789', { defaultCountry: 'RU' }, metadata)\r\n * parse('123456789', undefined, metadata)\r\n *\r\n * @param {string} input\r\n * @param {object} [options]\r\n * @param {object} metadataJson\r\n * @return {object|PhoneNumber?} If `options.v2: true` flag is passed, it returns a `PhoneNumber?` instance. Otherwise, returns an object of shape `{ phone: '...', country: '...' }` (or just `{}` if no phone number was parsed).\r\n */\nexport default function parse(text, options, metadataJson) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n var metadata = new Metadata(metadataJson);\n\n // Validate `defaultCountry`.\n if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n throw new Error(\"Unknown country: \".concat(options.defaultCountry));\n }\n\n // Parse the phone number.\n var _parseInput = parseInput(text, options.v2, options.extract),\n formattedPhoneNumber = _parseInput.number,\n ext = _parseInput.ext,\n error = _parseInput.error;\n\n // If the phone number is not viable then return nothing.\n if (!formattedPhoneNumber) {\n if (options.v2) {\n if (error === 'TOO_SHORT') {\n throw new ParseError('TOO_SHORT');\n }\n throw new ParseError('NOT_A_NUMBER');\n }\n return {};\n }\n var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode,\n // If `country` is returned, its numbering plan will also be selected in `metadata`.\n // Otherwise, if `countryCallingCode` is returned, its numbering plan will also be selected in `metadata`.\n // Otherwise, if neither `country` nor `countryCallingCode` are returned, no numbering plan will be selected in `metadata`.\n metadata),\n country = _parsePhoneNumber.country,\n nationalNumber = _parsePhoneNumber.nationalNumber,\n countryCallingCode = _parsePhoneNumber.countryCallingCode,\n countryCallingCodeSource = _parsePhoneNumber.countryCallingCodeSource,\n carrierCode = _parsePhoneNumber.carrierCode;\n if (!metadata.hasSelectedNumberingPlan()) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n return {};\n }\n\n // Validate national (significant) number length.\n if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {\n // Won't throw here because the regexp already demands length > 1.\n /* istanbul ignore if */\n if (options.v2) {\n throw new ParseError('TOO_SHORT');\n }\n // Google's demo just throws an error in this case.\n return {};\n }\n\n // Validate national (significant) number length.\n //\n // A sidenote:\n //\n // They say that sometimes national (significant) numbers\n // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).\n // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36\n // Such numbers will just be discarded.\n //\n if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {\n if (options.v2) {\n throw new ParseError('TOO_LONG');\n }\n // Google's demo just throws an error in this case.\n return {};\n }\n if (options.v2) {\n var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);\n if (country) {\n phoneNumber.country = country;\n }\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n }\n if (ext) {\n phoneNumber.ext = ext;\n }\n phoneNumber.__countryCallingCodeSource = countryCallingCodeSource;\n return phoneNumber;\n }\n\n // Check if national phone number pattern matches the number.\n // National number pattern is different for each country,\n // even for those ones which are part of the \"NANPA\" group.\n var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;\n if (!options.extended) {\n return valid ? result(country, nationalNumber, ext) : {};\n }\n\n // isInternational: countryCallingCode !== undefined\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n carrierCode: carrierCode,\n valid: valid,\n possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false,\n phone: nationalNumber,\n ext: ext\n };\n}\n\n/**\r\n * Extracts a formatted phone number from text.\r\n * Doesn't guarantee that the extracted phone number\r\n * is a valid phone number (for example, doesn't validate its length).\r\n * @param {string} text\r\n * @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number.\r\n * @param {boolean} [throwOnError] — By default, it won't throw if the text is too long.\r\n * @return {string}\r\n * @example\r\n * // Returns \"(213) 373-4253\".\r\n * extractFormattedPhoneNumber(\"Call (213) 373-4253 for assistance.\")\r\n */\nfunction _extractFormattedPhoneNumber(text, extract, throwOnError) {\n if (!text) {\n return;\n }\n if (text.length > MAX_INPUT_STRING_LENGTH) {\n if (throwOnError) {\n throw new ParseError('TOO_LONG');\n }\n return;\n }\n if (extract === false) {\n return text;\n }\n // Attempt to extract a possible number from the string passed in\n var startsAt = text.search(PHONE_NUMBER_START_PATTERN);\n if (startsAt < 0) {\n return;\n }\n return text\n // Trim everything to the left of the phone number\n .slice(startsAt)\n // Remove trailing non-numerical characters\n .replace(AFTER_PHONE_NUMBER_END_PATTERN, '');\n}\n\n/**\r\n * @param {string} text - Input.\r\n * @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag.\r\n * @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number.\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\nfunction parseInput(text, v2, extract) {\n // // Parse RFC 3966 phone number URI.\n // if (text && text.indexOf('tel:') === 0) {\n // \treturn parseRFC3966(text)\n // }\n // let number = extractFormattedPhoneNumber(text, extract, v2)\n var number = extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(text, {\n extractFormattedPhoneNumber: function extractFormattedPhoneNumber(text) {\n return _extractFormattedPhoneNumber(text, extract, v2);\n }\n });\n // If the phone number is not viable, then abort.\n if (!number) {\n return {};\n }\n if (!isViablePhoneNumber(number)) {\n if (isViablePhoneNumberStart(number)) {\n return {\n error: 'TOO_SHORT'\n };\n }\n return {};\n }\n // Attempt to parse extension first, since it doesn't require region-specific\n // data and we want to have the non-normalised number here.\n var withExtensionStripped = extractExtension(number);\n if (withExtensionStripped.ext) {\n return withExtensionStripped;\n }\n return {\n number: number\n };\n}\n\n/**\r\n * Creates `parse()` result object.\r\n */\nfunction result(country, nationalNumber, ext) {\n var result = {\n country: country,\n phone: nationalNumber\n };\n if (ext) {\n result.ext = ext;\n }\n return result;\n}\n\n/**\r\n * Parses a viable phone number.\r\n * @param {string} formattedPhoneNumber — Example: \"(213) 373-4253\".\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {Metadata} metadata — Metadata instance with no pre-selected numbering plan. If `country` is returned, its numbering plan will also be selected in `metadata`. Otherwise, if `countryCallingCode` is returned, its numbering plan will also be selected in `metadata`. Otherwise, if neither `country` nor `countryCallingCode` are returned, no numbering plan will be selected in `metadata`.\r\n * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.\r\n */\nfunction parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {\n // Attempt to extract a calling code from a phone number.\n // * If the phone number is found to be \"international\":\n // * It will attempt to identify the calling code part of it and whether that part is complete and valid.\n // * If the calling code part is complete and valid, it will return two properties:\n // that calling code part (without `+`) and the rest of the digits.\n // * Otherwise, i.e. if the calling code part is incomplete or invalid,\n // it will return an empty object.\n // * Otherwise, i.e. if the phone number is national, there's no callind code to extract\n // so it will just return the originally-passed `number` string as the only property.\n var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), undefined,\n // `defaultCountry` and `defaultCallingCode` are only used to detect\n // if it's an \"international\" phone number or not. They won't be used\n // to derive the resulting `countryCallingCode` from them, or anything like that.\n defaultCountry, defaultCallingCode, metadata.metadata),\n countryCallingCodeSource = _extractCountryCallin.countryCallingCodeSource,\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number;\n\n // The exact country of the phone number\n var country;\n\n // If `formattedPhoneNumber` is passed in \"international\" format,\n // choose a country by `countryCallingCode`.\n if (countryCallingCode) {\n metadata.selectNumberingPlan(countryCallingCode);\n }\n // Else, if `formattedPhoneNumber` is passed in \"national\" format,\n // then `number` is defined and `countryCallingCode` is `undefined`.\n else if (number && (defaultCountry || defaultCallingCode)) {\n if (defaultCountry) {\n country = defaultCountry;\n metadata.selectNumberingPlan(defaultCountry);\n countryCallingCode = metadata.numberingPlan.callingCode();\n } else {\n metadata.selectNumberingPlan(defaultCallingCode);\n countryCallingCode = defaultCallingCode;\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(countryCallingCode)) {\n country = '001';\n }\n }\n }\n } else return {};\n\n // At this point, `country` could be `undefined` but `countryCallingCode` is always defined.\n //\n // Also, if `country` is defined, its numbering plan is selected in `metadata`.\n // Otherwise, the numering plan for the `countryCallingCode` is selected in `metadata`.\n\n if (!number) {\n return {\n countryCallingCodeSource: countryCallingCodeSource,\n countryCallingCode: countryCallingCode\n };\n }\n var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), undefined, metadata),\n nationalNumber = _extractNationalNumbe.nationalNumber,\n carrierCode = _extractNationalNumbe.carrierCode;\n\n // Sometimes there are several countries\n // corresponding to the same country phone code\n // (e.g. NANPA countries all having `1` country phone code).\n // Therefore, to reliably determine the exact country,\n // national (significant) number should have been parsed first.\n //\n // When `metadata.json` is generated, all \"ambiguous\" country phone codes\n // get their countries populated with the full set of\n // \"phone number type\" regular expressions.\n //\n var exactCountry = getCountryByCallingCode(countryCallingCode, {\n nationalNumber: nationalNumber,\n metadata: metadata\n });\n if (exactCountry) {\n country = exactCountry;\n /* istanbul ignore if */\n if (exactCountry === '001') {\n // Can't happen with `USE_NON_GEOGRAPHIC_COUNTRY_CODE` being `false`.\n // If `USE_NON_GEOGRAPHIC_COUNTRY_CODE` is set to `true` for some reason,\n // then remove the \"istanbul ignore if\".\n } else {\n metadata.selectNumberingPlan(country);\n }\n }\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n countryCallingCodeSource: countryCallingCodeSource,\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n//# sourceMappingURL=parse.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport parse from './parse.js';\nexport default function parsePhoneNumberWithError(text, options, metadata) {\n return parse(text, _objectSpread(_objectSpread({}, options), {}, {\n v2: true\n }), metadata);\n}\n//# sourceMappingURL=parsePhoneNumberWithError_.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nimport isObject from './helpers/isObject.js';\n\n// Extracts the following properties from function arguments:\n// * input `text`\n// * `options` object\n// * `metadata` JSON\nexport default function normalizeArguments(args) {\n var _Array$prototype$slic = Array.prototype.slice.call(args),\n _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4),\n arg_1 = _Array$prototype$slic2[0],\n arg_2 = _Array$prototype$slic2[1],\n arg_3 = _Array$prototype$slic2[2],\n arg_4 = _Array$prototype$slic2[3];\n var text;\n var options;\n var metadata;\n\n // If the phone number is passed as a string.\n // `parsePhoneNumber('88005553535', ...)`.\n if (typeof arg_1 === 'string') {\n text = arg_1;\n } else throw new TypeError('A text for parsing must be a string.');\n\n // If \"default country\" argument is being passed then move it to `options`.\n // `parsePhoneNumber('88005553535', 'RU', [options], metadata)`.\n if (!arg_2 || typeof arg_2 === 'string') {\n if (arg_4) {\n options = arg_3;\n metadata = arg_4;\n } else {\n options = undefined;\n metadata = arg_3;\n }\n if (arg_2) {\n options = _objectSpread({\n defaultCountry: arg_2\n }, options);\n }\n }\n // `defaultCountry` is not passed.\n // Example: `parsePhoneNumber('+78005553535', [options], metadata)`.\n else if (isObject(arg_2)) {\n if (arg_3) {\n options = arg_2;\n metadata = arg_3;\n } else {\n metadata = arg_2;\n }\n } else throw new Error(\"Invalid second argument: \".concat(arg_2));\n return {\n text: text,\n options: options,\n metadata: metadata\n };\n}\n//# sourceMappingURL=normalizeArguments.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport parsePhoneNumberWithError from './parsePhoneNumberWithError_.js';\nimport ParseError from './ParseError.js';\nimport { isSupportedCountry } from './metadata.js';\nexport default function parsePhoneNumber(text, options, metadata) {\n // Validate `defaultCountry`.\n if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) {\n options = _objectSpread(_objectSpread({}, options), {}, {\n defaultCountry: undefined\n });\n }\n // Parse phone number.\n try {\n return parsePhoneNumberWithError(text, options, metadata);\n } catch (error) {\n /* istanbul ignore else */\n if (error instanceof ParseError) {\n //\n } else {\n throw error;\n }\n }\n}\n//# sourceMappingURL=parsePhoneNumber_.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport normalizeArguments from './normalizeArguments.js';\nimport parsePhoneNumber from './parsePhoneNumber_.js';\nexport default function isValidPhoneNumber() {\n var _normalizeArguments = normalizeArguments(arguments),\n text = _normalizeArguments.text,\n options = _normalizeArguments.options,\n metadata = _normalizeArguments.metadata;\n options = _objectSpread(_objectSpread({}, options), {}, {\n extract: false\n });\n var phoneNumber = parsePhoneNumber(text, options, metadata);\n return phoneNumber && phoneNumber.isValid() || false;\n}\n//# sourceMappingURL=isValidPhoneNumber.js.map","import withMetadataArgument from './withMetadataArgument.js'\r\nimport { isValidPhoneNumber as _isValidPhoneNumber } from '../../core/index.js'\r\n\r\nexport function isValidPhoneNumber() {\r\n\treturn withMetadataArgument(_isValidPhoneNumber, arguments)\r\n}","import { isValidPhoneNumber } from \"libphonenumber-js/min\";\nimport type { VisitorProfileField } from \"@/lib/graphql/queries/generated/profile.generated\";\n\n/**\n * Per-field value validators surfaced to the ProfileTab. Each returns a\n * symbolic kind (mapped to an i18n key by the caller) or `null` when\n * the value is acceptable. Validators are intentionally NON-fatal for\n * empty input — `required` is enforced separately so the messaging\n * doesn't get crossed (`\"required\"` is a different concern from\n * `\"this email is malformed\"`).\n *\n * Kept as a single dispatch table keyed by `field.key` so adding a new\n * recognised key (e.g. \"url\") is one entry, not a switch sprawl.\n */\nexport type FieldValidationKind = \"invalidEmail\" | \"invalidPhone\";\n\nconst EMAIL_RE = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nexport function validateEmail(value: string): FieldValidationKind | null {\n if (!value) return null;\n return EMAIL_RE.test(value.trim()) ? null : \"invalidEmail\";\n}\n\n/** Accepts E.164 (`+380…`) or national format with a sensible default\n * region. We default to `undefined` so libphonenumber's E.164 mode is\n * enforced — accepting national-only numbers without a region would\n * silently let bad inputs through. */\nexport function validatePhone(value: string): FieldValidationKind | null {\n if (!value) return null;\n const trimmed = value.trim();\n // libphonenumber rejects leading-zero national numbers without a\n // region; require the `+` prefix so we always validate E.164.\n if (!trimmed.startsWith(\"+\")) return \"invalidPhone\";\n return isValidPhoneNumber(trimmed) ? null : \"invalidPhone\";\n}\n\n/** Dispatch a value through the right validator for a BE-typed field.\n * Returns `null` when the value is acceptable (or no validator applies). */\nexport function validateFieldValue(\n field: VisitorProfileField,\n value: string | null,\n): FieldValidationKind | null {\n if (value == null || value === \"\") return null;\n // Match on canonical field keys the BE surfaces for stock identity\n // fields; operator-defined keys fall through and only get the BE's\n // server-side validation.\n if (field.key === \"email\") return validateEmail(value);\n if (field.key === \"phone\") return validatePhone(value);\n return null;\n}\n","\"use client\";\n\nimport { Check, Loader2, X } from \"lucide-react\";\nimport { useLocale, useTranslations } from \"next-intl\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { ALLOWED_UPLOAD_MIMES, fileToBase64, MAX_UPLOAD_BYTES } from \"@/lib/file-to-base64\";\nimport { useUploadVisitorMediaMutation } from \"@/lib/graphql/queries/generated/messaging.generated\";\nimport {\n useUpdateVisitorProfileMutation,\n useVisitorProfileQuery,\n VisitorProfileDocument,\n type VisitorProfileField,\n} from \"@/lib/graphql/queries/generated/profile.generated\";\nimport { useWidgetConfig } from \"@/lib/use-widget-config\";\nimport { cn } from \"@/lib/utils\";\nimport { AvatarHero } from \"./avatar-hero\";\nimport { FieldRow } from \"./field-row\";\nimport { diffFields, isEmpty, pickDisplayName, seedValues } from \"./helpers\";\nimport { PreferencesSection } from \"./preferences-section\";\nimport {\n extractInvalidFieldKey,\n extractProfileErrorKind,\n profileErrorI18nKey,\n} from \"./profile-error\";\nimport { Section } from \"./section\";\nimport { useApplyPref } from \"./use-apply-pref\";\nimport { validateFieldValue } from \"./validators\";\n\ninterface ProfileTabProps {\n /** Demo mode — the visitor-profile query is BE-only; in demo we render\n * an explanatory placeholder so the tab still has *something* to show. */\n isDummy: boolean;\n}\n\n/**\n * Visitor-editable profile + preferences.\n *\n * Field shape + types are dictated by the BE (`visitorProfile.fields[]`).\n * Identity fields (name, email, phone, …) buffer locally and write on\n * \"Save\"; preferences (theme, language, notifications) auto-save with\n * an optimistic cache write so the widget chrome flips this tick.\n *\n * AVATAR is rendered as a centered hero, uploadable via the visitor\n * media service (base64 → `uploadVisitorMedia`); the resulting URL is\n * the value stored back on the profile field.\n *\n * This file is the ORCHESTRATOR — every concern lives in a sibling\n * module so each piece is independently testable:\n *\n * - `avatar-hero.tsx` — the centered avatar widget\n * - `field-row.tsx` — one row in the identity form\n * - `field-controls/` — one file per `VisitorProfileFieldType`\n * - `preferences-section.tsx` — language / theme / notifications\n * - `use-apply-pref.ts` — preference auto-save hook\n * - `helpers.ts` — seed / diff / normalise / display\n * - `validators.ts` — email + phone (libphonenumber-js/min)\n * - `profile-error.ts` — Apollo error → kind + field key\n */\nexport function ProfileTab({ isDummy }: ProfileTabProps) {\n const t = useTranslations(\"profile\");\n const tTabs = useTranslations(\"tabs\");\n const locale = useLocale();\n const { config } = useWidgetConfig();\n\n // Visitors can pick a UI language only when the operator hasn't forced\n // one. `DEFAULT` strategy = operator pin → hide the row entirely.\n const languageEditable = config.localeStrategy !== \"DEFAULT\";\n\n const { data, loading, error: loadError, refetch } = useVisitorProfileQuery({ skip: isDummy });\n const profile = data?.visitorProfile;\n\n const [update, { loading: saving }] = useUpdateVisitorProfileMutation();\n const [uploadMedia, { loading: avatarUploading }] = useUploadVisitorMediaMutation();\n const { apply: applyPref, saving: prefSaving } = useApplyPref(profile, t);\n\n // Identity-field draft buffer. Edits ONLY become part of the mutation\n // when the visitor taps \"Save\" — preferences are auto-saved separately\n // (see `useApplyPref`). Keeping the two paths apart means a half-typed\n // name never sneaks into a theme-flip's payload.\n const [values, setValues] = useState<Record<string, string | null>>({});\n const [hasEdits, setHasEdits] = useState(false);\n const [savedFlash, setSavedFlash] = useState(false);\n const [submitError, setSubmitError] = useState<string | null>(null);\n const [fieldErrors, setFieldErrors] = useState<Record<string, string>>({});\n\n // Seed (or re-seed after a save) when the BE-resolved profile changes\n // and the visitor isn't mid-edit. Preferences are NOT seeded — they\n // read straight off `profile.preferences` (optimistic cache writes\n // flip the cache, so the form always reflects authoritative state\n // without local buffering).\n useEffect(() => {\n if (!profile) return;\n if (hasEdits) return;\n setValues(seedValues(profile));\n }, [profile, hasEdits]);\n\n const { avatarField, regularFields } = useMemo(() => {\n if (!profile) return { avatarField: null as VisitorProfileField | null, regularFields: [] };\n const av = profile.fields.find((f) => f.type === \"AVATAR\") ?? null;\n const rest = profile.fields.filter((f) => f.type !== \"AVATAR\");\n return { avatarField: av, regularFields: rest };\n }, [profile]);\n\n const setFieldValue = useCallback((key: string, value: string | null) => {\n setValues((prev) => ({ ...prev, [key]: value }));\n setHasEdits(true);\n setSavedFlash(false);\n setSubmitError(null);\n setFieldErrors((prev) => {\n if (!prev[key]) return prev;\n const next = { ...prev };\n delete next[key];\n return next;\n });\n }, []);\n\n const handleDiscard = useCallback(() => {\n if (!profile) return;\n setValues(seedValues(profile));\n setHasEdits(false);\n setSubmitError(null);\n setFieldErrors({});\n }, [profile]);\n\n const handleSave = useCallback(async () => {\n if (!profile) return;\n\n // Client-side validation: required + per-field (email/phone) checks.\n // Collect ALL errors before bailing so the visitor sees every bad\n // field at once instead of one-at-a-time whack-a-mole.\n const nextErrors: Record<string, string> = {};\n for (const f of profile.fields) {\n if (f.pinned) continue;\n const v = values[f.key] ?? null;\n if (f.required && isEmpty(v)) {\n nextErrors[f.key] = t(\"requiredHint\");\n continue;\n }\n const kind = validateFieldValue(f, v);\n if (kind) nextErrors[f.key] = t(kind);\n }\n if (Object.keys(nextErrors).length > 0) {\n setFieldErrors(nextErrors);\n setSubmitError(t(\"errorFieldInvalid\"));\n return;\n }\n\n const fieldUpdates = diffFields(profile.fields, values);\n if (fieldUpdates.length === 0) return;\n\n setSubmitError(null);\n setFieldErrors({});\n try {\n const res = await update({\n variables: { input: { fields: fieldUpdates } },\n update: (cache, { data: mut }) => {\n const next = mut?.updateVisitorProfile;\n if (!next) return;\n cache.writeQuery({\n query: VisitorProfileDocument,\n data: { visitorProfile: next },\n });\n },\n });\n const next = res.data?.updateVisitorProfile;\n if (next) {\n setValues(seedValues(next));\n setHasEdits(false);\n setSavedFlash(true);\n setTimeout(() => setSavedFlash(false), 2400);\n }\n } catch (err) {\n const kind = extractProfileErrorKind(err);\n if (kind === \"fieldInvalid\") {\n const fk = extractInvalidFieldKey(err);\n if (fk) setFieldErrors({ [fk]: t(\"errorFieldInvalid\") });\n }\n setSubmitError(t(profileErrorI18nKey(kind)));\n }\n }, [profile, t, update, values]);\n\n const handleAvatarFile = useCallback(\n async (file: File) => {\n if (!avatarField) return;\n setSubmitError(null);\n if (!ALLOWED_UPLOAD_MIMES.has(file.type) || !file.type.startsWith(\"image/\")) {\n setSubmitError(t(\"errorGeneric\"));\n return;\n }\n if (file.size > MAX_UPLOAD_BYTES) {\n setSubmitError(t(\"errorGeneric\"));\n return;\n }\n try {\n const { base64 } = await fileToBase64(file);\n const res = await uploadMedia({\n variables: {\n input: { filename: file.name, mimetype: file.type, dataBase64: base64 },\n },\n });\n const url = res.data?.uploadVisitorMedia?.url;\n if (!url) throw new Error(\"empty upload response\");\n setFieldValue(avatarField.key, url);\n } catch {\n setSubmitError(t(\"errorGeneric\"));\n }\n },\n [avatarField, setFieldValue, t, uploadMedia],\n );\n\n if (isDummy) {\n return (\n <ScrollArea className=\"flex-1\">\n <div className=\"flex flex-col gap-3 px-4 py-6\">\n <h1 className=\"text-lg font-semibold text-wx-fg\">{tTabs(\"profile\")}</h1>\n <p className=\"text-sm text-wx-fg-muted\">{t(\"subtitle\")}</p>\n </div>\n </ScrollArea>\n );\n }\n\n if (loading) {\n return (\n <ScrollArea className=\"flex-1\">\n <div className=\"flex flex-col gap-4 px-5 py-6\" aria-busy=\"true\">\n <div className=\"mx-auto flex flex-col items-center gap-3\">\n <Skeleton className=\"h-24 w-24 rounded-full\" />\n <Skeleton className=\"h-4 w-32 rounded\" />\n </div>\n <Skeleton className=\"h-9 w-full rounded-wx-sm\" />\n <Skeleton className=\"h-9 w-full rounded-wx-sm\" />\n <Skeleton className=\"h-9 w-full rounded-wx-sm\" />\n <span className=\"sr-only\">{t(\"loading\")}</span>\n </div>\n </ScrollArea>\n );\n }\n\n if (loadError || !profile) {\n return (\n <ScrollArea className=\"flex-1\">\n <div className=\"flex flex-col gap-3 px-5 py-6\">\n <p className=\"text-sm text-wx-danger\">{t(\"loadError\")}</p>\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"self-start rounded-full bg-wx-bg-elevated px-3 py-1.5 text-sm text-wx-fg hover:bg-wx-bg-elevated-2\"\n >\n {t(\"retry\")}\n </button>\n </div>\n </ScrollArea>\n );\n }\n\n const avatarValue = avatarField ? (values[avatarField.key] ?? null) : null;\n const avatarHeroName = pickDisplayName(profile, values);\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n <ScrollArea className=\"min-h-0 flex-1\">\n <form\n id=\"wx-profile-form\"\n onSubmit={(e) => {\n e.preventDefault();\n void handleSave();\n }}\n className=\"flex flex-col px-5 pt-2 pb-4\"\n >\n {avatarField && (\n <AvatarHero\n field={avatarField}\n value={avatarValue}\n uploading={avatarUploading}\n onPick={handleAvatarFile}\n onClear={() => setFieldValue(avatarField.key, null)}\n displayName={avatarHeroName}\n t={t}\n />\n )}\n\n {regularFields.length > 0 && (\n <Section eyebrow={t(\"title\")}>\n {regularFields.map((f) => (\n <FieldRow\n key={f.key}\n field={f}\n value={values[f.key] ?? null}\n onChange={(v) => setFieldValue(f.key, v)}\n error={fieldErrors[f.key]}\n t={t}\n />\n ))}\n </Section>\n )}\n\n {!avatarField && regularFields.length === 0 && (\n <p className=\"py-6 text-center text-sm text-wx-fg-muted\">{t(\"noFields\")}</p>\n )}\n\n <PreferencesSection\n profile={profile}\n locale={locale}\n languageEditable={languageEditable}\n prefSaving={prefSaving}\n applyPref={applyPref}\n onNotificationError={(k) => setSubmitError(k ? t(k) : null)}\n t={t}\n />\n\n {submitError && (\n <p className=\"mt-4 flex items-start gap-1.5 rounded-wx-sm bg-wx-danger/10 px-3 py-2 text-xs text-wx-danger\">\n <X size={13} aria-hidden=\"true\" className=\"mt-0.5 shrink-0\" />\n <span>{submitError}</span>\n </p>\n )}\n {savedFlash && !submitError && (\n <p className=\"mt-4 flex items-center gap-1.5 rounded-wx-sm bg-wx-success/10 px-3 py-2 text-xs text-wx-success\">\n <Check size={13} aria-hidden=\"true\" />\n <span>{t(\"saved\")}</span>\n </p>\n )}\n </form>\n </ScrollArea>\n\n {/* Sticky save bar — only shown when identity fields have unsaved\n edits. Preferences auto-save (see `useApplyPref`) and don't\n surface a button here. */}\n {hasEdits && (\n <div className=\"flex items-center gap-2 border-t border-wx-border bg-wx-bg/95 px-4 py-3 backdrop-blur\">\n <button\n type=\"submit\"\n form=\"wx-profile-form\"\n disabled={saving}\n className={cn(\n \"flex flex-1 items-center justify-center gap-1.5 rounded-full bg-wx-primary px-4 py-2 text-sm font-semibold text-wx-primary-fg\",\n \"hover:bg-wx-primary-hover disabled:cursor-not-allowed disabled:opacity-60\",\n )}\n >\n {saving && <Loader2 size={14} className=\"animate-spin\" aria-hidden=\"true\" />}\n {saving ? t(\"saving\") : t(\"save\")}\n </button>\n <button\n type=\"button\"\n onClick={handleDiscard}\n disabled={saving}\n className={cn(\n \"rounded-full bg-wx-bg-elevated px-4 py-2 text-sm font-medium text-wx-fg\",\n \"hover:bg-wx-bg-elevated-2 disabled:cursor-not-allowed disabled:opacity-60\",\n )}\n >\n {t(\"cancel\")}\n </button>\n </div>\n )}\n </div>\n );\n}\n","\"use client\";\n\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport {\n ChevronDownIcon,\n type ChevronDownIconHandle,\n MessageSquareIcon,\n type MessageSquareIconHandle,\n} from \"@/components/widget/icons/animated\";\nimport { UnreadBadge } from \"@/components/widget/unread-badge\";\nimport { useIconHover } from \"@/lib/use-icon-hover\";\nimport { cn } from \"@/lib/utils\";\n\ninterface WidgetLauncherProps {\n isOpen: boolean;\n onToggle: () => void;\n /** Unread count surfaced as a pill on the FAB. Zero hides the\n * badge entirely; 99+ caps to `99+` to keep the pill width bounded. */\n unreadCount?: number;\n /** Which bottom corner the FAB anchors to. Defaults to `\"right\"`. */\n position?: \"left\" | \"right\";\n /** Anchor to the host `<div>` (`absolute`) instead of the viewport\n * (`fixed`). Set by the React-component embed — see `WidgetEnv.embedded`. */\n embedded?: boolean;\n}\n\n/**\n * Floating launcher. Theme-invariant brand surface (`--wx-launcher-bg`)\n * so the FAB reads as a wexio mark on any host page regardless of\n * light/dark preference.\n *\n * Icon morph between chat-bubble (closed) and X (open) via\n * `AnimatePresence`. Each lucide-animated icon's internal animation\n * fires when the **button** is hovered (not the icon itself) — wired\n * via `useIconHover` since the icon receives pointer events through\n * the button.\n */\nexport function WidgetLauncher({\n isOpen,\n onToggle,\n unreadCount = 0,\n position = \"right\",\n embedded = false,\n}: WidgetLauncherProps) {\n const t = useTranslations(\"launcher\");\n const messageHover = useIconHover<MessageSquareIconHandle>();\n const closeHover = useIconHover<ChevronDownIconHandle>();\n const activeHandlers = isOpen ? closeHover.parentHandlers : messageHover.parentHandlers;\n // Hide the badge while the panel is open — the visitor's already\n // looking at the chat. (UnreadBadge handles the 99+ cap itself.)\n const showBadge = !isOpen && unreadCount > 0;\n\n return (\n <motion.button\n type=\"button\"\n onClick={onToggle}\n aria-label={isOpen ? t(\"close\") : t(\"open\")}\n whileHover={{ scale: 1.05 }}\n whileTap={{ scale: 0.92 }}\n transition={{ type: \"spring\", stiffness: 400, damping: 22 }}\n // Drive the icon's hover animation from motion's POINTER-based hover\n // (not React's synthetic `onMouseEnter`). In the react-component's\n // Shadow DOM, synthetic mouse-enter is unreliable — the FAB still\n // scaled (motion's own hover) but the icon never wiggled. `onHoverStart`\n // / `onHoverEnd` are pointer-based and fire in a shadow root. The\n // spread below keeps `onFocus`/`onBlur` for keyboard parity.\n onHoverStart={activeHandlers.onMouseEnter}\n onHoverEnd={activeHandlers.onMouseLeave}\n {...activeHandlers}\n className={cn(\n embedded ? \"absolute\" : \"fixed\",\n \"bottom-4 z-50\",\n position === \"left\" ? \"left-4\" : \"right-4\",\n \"flex h-14 w-14 items-center justify-center rounded-full\",\n \"bg-wx-launcher-bg text-wx-launcher-fg\",\n \"shadow-[0_8px_24px_rgba(0,0,0,0.18)]\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-launcher-bg focus-visible:ring-offset-2 focus-visible:ring-offset-white\",\n )}\n >\n <UnreadBadge\n count={showBadge ? unreadCount : 0}\n size=\"md\"\n className=\"absolute -top-1 -right-1 z-10\"\n />\n <AnimatePresence mode=\"wait\" initial={false}>\n {isOpen ? (\n <motion.span\n key=\"x\"\n initial={{ opacity: 0, rotate: -90, scale: 0.7 }}\n animate={{ opacity: 1, rotate: 0, scale: 1 }}\n exit={{ opacity: 0, rotate: 90, scale: 0.7 }}\n transition={{ duration: 0.18 }}\n >\n <ChevronDownIcon ref={closeHover.iconRef} size={24} />\n </motion.span>\n ) : (\n <motion.span\n key=\"chat\"\n initial={{ opacity: 0, rotate: 90, scale: 0.7 }}\n animate={{ opacity: 1, rotate: 0, scale: 1 }}\n exit={{ opacity: 0, rotate: -90, scale: 0.7 }}\n transition={{ duration: 0.18 }}\n >\n <MessageSquareIcon\n ref={messageHover.iconRef}\n size={24}\n // `lucide-animated` icons render a wrapping <div>\n // (props extend HTMLAttributes<HTMLDivElement>), so\n // plain `fill-*` utilities land on the div and never\n // reach the SVG. Reach in with an arbitrary selector\n // and override the icon's `stroke` too — these glyphs\n // are stroke-only by default, so just setting `fill`\n // gives you a filled outline, not a true silhouette.\n // Light mode → white; dark mode → brand-dark `#121314`\n // (`--wx-bg` in dark; `--wx-primary` flips to white).\n className=\"[&_svg]:fill-wx-launcher-fg [&_svg]:stroke-wx-launcher-fg dark:[&_svg]:fill-wx-bg dark:[&_svg]:stroke-wx-bg\"\n />\n </motion.span>\n )}\n </AnimatePresence>\n </motion.button>\n );\n}\n","import type { WidgetTab } from \"@/lib/widget-config\";\nimport type { WidgetRoute } from \"@/lib/widget-route\";\n\n/**\n * Pure helpers extracted from `WidgetShell` — theme/logo resolution,\n * route ranking, and the route-transition motion variants. Kept out of\n * the shell component so they can be unit-tested in isolation (see\n * `widget-shell-helpers.test.ts`).\n */\n\n/** Normalise the operator's saved theme-mode enum (BE serialises it\n * uppercase) down to the lowercase set the widget's CSS expects. */\nexport function normaliseThemeMode(value: unknown): \"light\" | \"dark\" | \"auto\" {\n if (typeof value !== \"string\") return \"auto\";\n const v = value.toLowerCase();\n if (v === \"light\" || v === \"dark\" || v === \"auto\") return v;\n return \"auto\";\n}\n\n/**\n * Collapse the operator's per-mode `organizationLogo` down to the\n * single URL the header components render.\n *\n * - prefer the resolved theme mode's logo\n * - fall back to the OTHER mode's logo (one logo beats none — an\n * operator who only uploaded a light logo still wants it shown\n * in dark mode rather than the generic Wexio mark)\n * - `null` when neither mode has a logo\n */\nexport function resolveOrgLogo(\n logo: { light: string | null; dark: string | null } | null,\n mode: \"light\" | \"dark\",\n): string | null {\n if (!logo) return null;\n const primary = mode === \"dark\" ? logo.dark : logo.light;\n const fallback = mode === \"dark\" ? logo.light : logo.dark;\n return primary ?? fallback ?? null;\n}\n\nexport function defaultRouteFor(tab: WidgetTab): WidgetRoute {\n if (tab === \"messages\") return { kind: \"messages\" };\n if (tab === \"help\") return { kind: \"help\" };\n if (tab === \"news\") return { kind: \"news\" };\n if (tab === \"profile\") return { kind: \"profile\" };\n return { kind: \"home\" };\n}\n\n/**\n * Stable per-route ranking used to derive transition direction.\n * Higher number = \"deeper\" in the visitor's mental stack. Tabs are\n * 0..3 in their nav order; drill-ins of Help live at 2.5/2.75 so\n * help → category → article reads as forward, then back returns\n * through the same rank scale.\n */\nexport function routeRank(route: WidgetRoute): number {\n switch (route.kind) {\n case \"home\":\n return 0;\n case \"messages\":\n return 1;\n case \"help\":\n return 2;\n case \"help-category\":\n return 2.5;\n case \"help-article\":\n return 2.75;\n case \"news\":\n return 3;\n case \"news-article\":\n return 3.25;\n case \"profile\":\n return 4;\n }\n}\n\nexport function routeKey(route: WidgetRoute): string {\n if (route.kind === \"help-category\") return `help-category:${route.categoryId}`;\n if (route.kind === \"help-article\") return `help-article:${route.slug}`;\n if (route.kind === \"news-article\") return `news-article:${route.id}`;\n return route.kind;\n}\n\n/**\n * Route transition variants — Day-11 rework. Goals:\n * 1. **No height jump.** Anchor exit + enter at `inset-0` and\n * avoid layout-affecting transforms (no scale, no blur). The\n * panel chrome stays put, only the content slides.\n * 2. **Direction-aware slide.** Forward navigation → new view\n * slides in from the right, old slides out to the left;\n * back-nav mirrors. Tab-swap (direction = 0) → crossfade only.\n * 3. **Crisp settle.** Tight spring (high stiffness, high damping)\n * so the slide reads as responsive, not springy/bouncy.\n */\nexport const routeVariants = {\n enter: (direction: number) => ({\n x: direction > 0 ? 28 : direction < 0 ? -28 : 0,\n opacity: 0,\n }),\n center: {\n x: 0,\n opacity: 1,\n },\n exit: (direction: number) => ({\n x: direction > 0 ? -28 : direction < 0 ? 28 : 0,\n opacity: 0,\n }),\n};\n","\"use client\";\n\nimport { useApolloClient } from \"@apollo/client/react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { useLocale, useTranslations } from \"next-intl\";\nimport { lazy, Suspense, startTransition, useCallback, useEffect, useRef, useState } from \"react\";\nimport type { MockMessage, MockMessageButton } from \"@/dummy\";\nimport { AI_ASSISTANT_NAME } from \"@/lib/ai-assistant\";\nimport { assetUrl } from \"@/lib/asset-url\";\nimport {\n useSendVisitorMessageMutation,\n VisitorChatRecentInboundDocument,\n} from \"@/lib/graphql/queries/generated/messaging.generated\";\nimport { VisitorProfileDocument } from \"@/lib/graphql/queries/generated/profile.generated\";\nimport type { PasskeySessionResult } from \"@/lib/use-passkey-auth\";\nimport { useSoundPlayer } from \"@/lib/use-sound-player\";\nimport { useThemeMode } from \"@/lib/use-theme-mode\";\nimport {\n persistIdentifiedSession,\n resetStoredVisitorSession,\n useHostVisitorData,\n useVisitorAuth,\n type VisitorSession,\n} from \"@/lib/use-visitor-auth\";\nimport { useVisitorProfilePreferences } from \"@/lib/use-visitor-profile-preferences\";\nimport { type RealtimeMessageEvent, useVisitorRealtime } from \"@/lib/use-visitor-realtime\";\nimport { useVisitorUnread } from \"@/lib/use-visitor-unread\";\nimport { useWidgetConfig } from \"@/lib/use-widget-config\";\nimport { useWidgetEnv, type VisitorIdentity } from \"@/lib/use-widget-env\";\nimport { cn } from \"@/lib/utils\";\nimport type { WidgetTab } from \"@/lib/widget-config\";\nimport {\n enabledTabCount,\n isTabEnabled,\n pickInitialTab,\n popRoute,\n routeShowsTabs,\n routeToTab,\n type WidgetRoute,\n} from \"@/lib/widget-route\";\nimport { BottomNav } from \"../bottom-nav\";\nimport { BrandingFooter } from \"../branding-footer\";\nimport { ConversationHeader } from \"../conversation-header\";\nimport { DemoMessages } from \"../demo-messages\";\nimport { HelpCategoryView } from \"../help-category-view\";\nimport { LauncherPeek } from \"../launcher-peek\";\nimport { TabTitleHeader } from \"../tab-title-header\";\nimport { HelpTab } from \"../tabs/help-tab\";\nimport { HomeTab } from \"../tabs/home-tab\";\nimport { MessagesTab, normalizeBackendMedia } from \"../tabs/messages-tab\";\nimport { NewsTab } from \"../tabs/news-tab\";\nimport { ProfileTab } from \"../tabs/profile-tab\";\nimport { WidgetLauncher } from \"../widget-launcher\";\nimport {\n defaultRouteFor,\n normaliseThemeMode,\n resolveOrgLogo,\n routeKey,\n routeRank,\n routeVariants,\n} from \"./helpers\";\n\n// The article views render Markdown (`react-markdown` + the\n// micromark/mdast stack, ~80 KB combined). They're drill-in routes\n// behind navigation, so `lazy()` keeps that stack out of the initial\n// payload — it streams in the first time a visitor opens an article.\nconst HelpArticleView = lazy(() =>\n import(\"../help-article-view\").then((m) => ({ default: m.HelpArticleView })),\n);\nconst NewsArticleView = lazy(() =>\n import(\"../news-article-view\").then((m) => ({ default: m.NewsArticleView })),\n);\n\n/** localStorage key for the visitor's panel expand/collapse preference.\n * Persisted (not session) so a visitor who likes the wide panel keeps\n * it across reloads + revisits. */\nconst PANEL_EXPANDED_KEY = \"wexio:panel-expanded\";\n\n/** Viewport margins the panel reserves — mirror the `max-w` / `max-h`\n * Tailwind clamps on the panel (`100vw - 2rem`, `100dvh - 7rem`). Used\n * to clamp the ANIMATION target to the size that actually renders, so\n * width + height settle together instead of the height stopping early\n * at its ceiling. Keep in sync with the className. */\nconst PANEL_MARGIN_X = 32; // 2rem\nconst PANEL_MARGIN_Y = 112; // 7rem\n\n/** Read the persisted expand preference. Defensive against storage being\n * unavailable (private mode) + SSR (no `window`) → defaults collapsed. */\nfunction readExpandedPref(): boolean {\n if (typeof window === \"undefined\") return false;\n try {\n return localStorage.getItem(PANEL_EXPANDED_KEY) === \"1\";\n } catch {\n return false;\n }\n}\n\n/** Render a desktop-notification body from a (possibly Tiptap-HTML)\n * message + its attachments. The Notification API treats `body` as\n * plain text — raw HTML would show literally — so route the message\n * through DOMParser for proper entity decoding + tag stripping.\n * Falls back to a media marker when the visible text is empty. */\nfunction htmlToPlainText(html: string, media: { mimetype: string }[]): string {\n let text = \"\";\n if (html) {\n try {\n // DOMParser is the safest entity-aware HTML → text path. We don't\n // attach the document to the live DOM — just extract textContent.\n const doc = new DOMParser().parseFromString(html, \"text/html\");\n text = (doc.body.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n } catch {\n // Defensive: fall back to a regex strip if DOMParser is somehow\n // unavailable (very old browsers / sandboxed contexts).\n text = html\n .replace(/<[^>]*>/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n }\n }\n if (text) return text;\n if (media.length === 0) return \"New message\";\n const head = media[0]?.mimetype ?? \"\";\n const kind = head.startsWith(\"image/\")\n ? \"Image\"\n : head.startsWith(\"video/\")\n ? \"Video\"\n : head.startsWith(\"audio/\")\n ? \"Voice message\"\n : \"Attachment\";\n return media.length > 1 ? `${kind} +${media.length - 1}` : kind;\n}\n\n/** Shared fallback while a lazily-loaded drill-in view streams in. */\nfunction RouteChunkFallback() {\n return (\n <div className=\"flex flex-1 items-center justify-center\">\n <div className=\"border-wx-border border-t-wx-primary h-5 w-5 animate-spin rounded-full border-2\" />\n </div>\n );\n}\n\n/**\n * Top-level widget shell — owns the navigation stack + decides which\n * surfaces render.\n *\n * **Two layout modes** (route-driven):\n * - **List routes** (`home` / `help` / `news`) — bottom nav\n * + tab-style headers. Visitor is browsing an index.\n * - **Drill-in routes** (`messages` / `help-category` /\n * `help-article`) — no bottom\n * nav. Sticky header with a back button + per-route title.\n *\n * **Home tab is special**: the header chrome (logo + avatars + mute +\n * close) scrolls WITH the hero so the brand gradient backdrop reads\n * as one continuous surface. Other tabs render a sticky strip header.\n *\n * **Motion**: panel slide-in with spring; per-route content crossfades\n * through `AnimatePresence`; launcher icon morph via the FAB.\n */\nexport function WidgetShell() {\n // Demo content (`messages/demo.*.json`) is lazily imported + merged\n // into i18n only in demo mode by `DemoMessages` — it stays out of the\n // production bundle every visitor downloads.\n return (\n <DemoMessages>\n <WidgetShellInner />\n </DemoMessages>\n );\n}\n\nfunction WidgetShellInner() {\n const tHeader = useTranslations(\"header\");\n // Visitor's active language — threaded into article-detail views so\n // their content queries fetch the right locale (was hardcoded \"en\").\n const locale = useLocale();\n const env = useWidgetEnv();\n\n const { mode, config, isDummy } = useWidgetConfig();\n // Operator's saved mode preference flows in here. BE serialises the\n // enum in uppercase (`AUTO` / `LIGHT` / `DARK`); normalise to the\n // lowercase set the widget's CSS / data-theme attribute expects.\n // `useThemeMode` still respects URL + postMessage overrides, the\n // visitor's localStorage pref (when operator allows `auto`), and\n // the visitor's OS preference as fallbacks.\n // Theme + logos are resolved BELOW (after `session` is defined) — the\n // visitor profile query needs `session.token` and we want it threaded into\n // `useThemeMode` directly. See the block right after the `session` const.\n // Which corner the launcher + panel anchor to (operator-configurable;\n // defaults to bottom-right).\n const launcherLeft = config.theme?.launcherPosition === \"LEFT_BOTTOM\";\n // React-component embed → anchor to the host `<div>` (`absolute` +\n // %-based clamps) instead of the viewport (`fixed` + vw/dvh clamps),\n // so the widget stays inside its container. See `WidgetEnv.embedded`.\n const embedded = env.embedded ?? false;\n const { muted, toggleMuted, playInbound, playOutbound } = useSoundPlayer(config.sounds);\n // Host-supplied visitor data (embeds set it on `env`; the iframe\n // receives it over postMessage). `identity` (verified, userHash) routes\n // the handshake to the identified flow; `prefill` (unverified profile)\n // pre-fills / auto-attaches the prechat.\n const { identity: visitorIdentity, prefill: visitorPrefill } = useHostVisitorData(env);\n // Identity the visitor established INSIDE the widget (e.g. tapped the\n // Google sign-in button) — distinct from `visitorIdentity` which the\n // HOST supplies. Host identity wins; this fills in when the host didn't\n // identify and the visitor signs in themselves.\n const [widgetIdentity, setWidgetIdentity] = useState<VisitorIdentity | null>(null);\n // Bumped by `Wexio('shutdown')` (logout / shared device) to force a\n // fresh anonymous handshake after the stored session is wiped.\n const [sessionEpoch, setSessionEpoch] = useState(0);\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const onMessage = (e: MessageEvent) => {\n if (!e.data || e.data.type !== \"wexio:shutdown:v1\") return;\n // Forget the stored visitorId + token + any in-widget sign-in, then\n // re-handshake fresh. The new chatId clears `liveMessages` via the\n // effect below, so the next person on a shared device never sees\n // the prior chat.\n resetStoredVisitorSession();\n setWidgetIdentity(null);\n setPasskeySession(null);\n setSessionEpoch((n) => n + 1);\n };\n window.addEventListener(\"message\", onMessage);\n return () => window.removeEventListener(\"message\", onMessage);\n }, []);\n const baseSession = useVisitorAuth({\n enabled: mode === \"production\" && !isDummy,\n identity: visitorIdentity ?? widgetIdentity,\n epoch: sessionEpoch,\n });\n // Passkey produces a full verified session out-of-band (a 2-step\n // WebAuthn ceremony, not an identity token), so it can't route through\n // `useVisitorAuth`'s identity handshake like Google does. The hook\n // already stamped the token into Apollo; here we adopt the rest as a\n // session OVERRIDE so the UI reads `verified` + the new `chatId`.\n // Cleared on shutdown so the next person falls back to a fresh\n // anonymous handshake.\n const [passkeySession, setPasskeySession] = useState<VisitorSession | null>(null);\n const session = passkeySession ?? baseSession;\n\n // Visitor's BE-persisted profile preferences (theme mode + language +\n // desktop-notifications opt-in). Skipped when Profile is disabled or the\n // visitor isn't authed yet — the query needs a visitor JWT. The language\n // preference is persisted to a cookie inside the hook; mid-session locale\n // change requires a remount which is out of scope.\n const profilePrefs = useVisitorProfilePreferences({\n enabled: !!config.features.profile && !isDummy && !!session.token,\n });\n\n // DevTools helpers exposed on `window`:\n //\n // - `__wexioNotifyDebug()` — dump the state the next inbound will\n // evaluate against (pref + permission + prefs-loaded + session).\n // - `__wexioTestNotify()` — fire `new Notification(...)` DIRECTLY\n // with hard-coded copy, bypassing the entire inbound pipeline.\n // If THIS doesn't show on screen either, the popup is being eaten\n // by macOS / Chrome (Focus mode, alert style = None, Chrome\n // \"quieter notifications\", etc.) — not our code.\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const w = window as unknown as {\n __wexioNotifyDebug?: () => unknown;\n __wexioTestNotify?: () => unknown;\n };\n w.__wexioNotifyDebug = () => {\n const state = {\n prefEnabled: profilePrefs.desktopNotifications,\n permission: typeof Notification !== \"undefined\" ? Notification.permission : \"(unsupported)\",\n prefsLoaded: profilePrefs.loaded,\n featureEnabled: !!config.features.profile,\n sessionToken: !!session.token,\n };\n console.log(\"[wexio] notify state:\", state);\n return state;\n };\n w.__wexioTestNotify = () => {\n if (typeof Notification === \"undefined\") {\n console.warn(\"[wexio] Notification API not available in this context\");\n return \"unsupported\";\n }\n if (Notification.permission !== \"granted\") {\n console.warn(\"[wexio] permission not granted:\", Notification.permission);\n return Notification.permission;\n }\n try {\n const n = new Notification(\"Wexio test\", {\n body: \"If you can see this, notifications work.\",\n tag: \"wexio-test\",\n });\n n.onshow = () => console.log(\"[wexio] test notification: onshow fired\");\n n.onerror = (e) => console.warn(\"[wexio] test notification: onerror\", e);\n n.onclose = () => console.log(\"[wexio] test notification: onclose\");\n console.log(\"[wexio] test notification posted to browser\");\n return \"posted\";\n } catch (err) {\n console.warn(\"[wexio] test notification threw:\", err);\n return err;\n }\n };\n }, [\n profilePrefs.desktopNotifications,\n profilePrefs.loaded,\n config.features.profile,\n session.token,\n ]);\n // Theme — operator preference + visitor profile preference (when\n // `themeModeEditable`). See `useThemeMode` for the full precedence chain.\n const resolvedThemeMode = useThemeMode(normaliseThemeMode(config.themeMode), {\n preference: profilePrefs.themeMode,\n allowed: profilePrefs.themeModeEditable,\n });\n // Resolve the operator's per-mode logo down to a single URL the header\n // components render. Prefer the active mode's logo; fall back to the\n // other mode's (one logo is better than none); `null` when the operator\n // uploaded neither — the header then shows the framed Wexio fallback mark.\n const organizationLogoUrl = resolveOrgLogo(config.organizationLogo, resolvedThemeMode);\n // Conversation-header logo. Demo has no operator logo, so fall back to\n // the theme-matched Wexio mark (`logo-light.png` in light mode,\n // `logo-dark.png` in dark) so the header reads as branded rather than\n // blank. Scoped to the conversation header — the home header keeps its\n // own `WexioMark` placeholder. CDN-aware via `assetUrl`.\n const conversationLogoUrl =\n organizationLogoUrl ?? (isDummy ? assetUrl(`/logo-${resolvedThemeMode}.png`) : null);\n\n const [route, setRoute] = useState<WidgetRoute>(() =>\n // Initial route honours the operator's `defaultTab` AND the\n // features flag set — if `defaultTab` is on a disabled tab\n // (e.g. preview mode patches features after first render),\n // fall back to the first enabled tab.\n defaultRouteFor(pickInitialTab(config.defaultTab, config.features)),\n );\n\n // Snap the route to a valid tab whenever the features flag set\n // OR the `defaultTab` changes — `useState` only runs its\n // initializer ONCE, so a postMessage config patch that lands\n // after mount (preview mode, BE config arriving async) would\n // otherwise leave the visitor stuck on a disabled tab. Effect\n // is no-op when the current tab is already enabled.\n //\n // `route` intentionally excluded — we only need to react to config\n // changes; reading the current `route` inside the effect is enough,\n // and adding it as a dep would re-snap on every navigation.\n // biome-ignore lint/correctness/useExhaustiveDependencies: route is read inside the effect, not a trigger — see note above\n useEffect(() => {\n const currentTab = routeToTab(route);\n if (isTabEnabled(currentTab, config.features)) return;\n const next = pickInitialTab(config.defaultTab, config.features);\n setRoute(defaultRouteFor(next));\n }, [config.features, config.defaultTab]);\n const [isOpen, setIsOpen] = useState(false);\n // Initialised from localStorage so the preference survives reloads /\n // revisits. Safe to read in the initializer (no hydration mismatch):\n // the panel is closed at first paint, so `expanded` doesn't affect any\n // SSR-rendered DOM until the visitor opens + expands it.\n const [expanded, setExpanded] = useState(readExpandedPref);\n // Persist the preference on every change. Writing the initial value\n // back is a harmless no-op (it equals what we just read).\n useEffect(() => {\n try {\n localStorage.setItem(PANEL_EXPANDED_KEY, expanded ? \"1\" : \"0\");\n } catch {\n // Private mode / blocked storage — keep it in-memory this session.\n }\n }, [expanded]);\n // Currently-visible article title — fed by the help/news article\n // views via `onTitleResolved`. Shown in the sticky header for\n // article routes so the bar reads as a breadcrumb (\"← Article\n // name\") instead of the parent tab nameplate (\"News\" / \"Help\").\n // `null` while the article is still loading; the header falls\n // back to the tab title until the article view resolves.\n //\n // We DON'T clear this here on route change. The previous version\n // had a route-watching `useEffect` that scheduled `setArticleTitle(\n // null)` on every nav — but the article view's own `useEffect`\n // (which calls `onTitleResolved`) fires on the same tick when the\n // Apollo cache returns instantly on a re-visit. React's batching\n // could resolve `null` last, dropping the title back to \"News\"\n // permanently. Clearing is now owned by the article view itself\n // via a cleanup function: it sets the title on mount, clears it\n // on unmount. That's deterministic regardless of cache state.\n const [articleTitle, setArticleTitle] = useState<string | null>(null);\n // Stays `true` after the first open. Used to gate the route\n // content — when the panel has never been opened, none of the\n // tab components mount, so their GraphQL queries + SSE\n // subscriptions stay dormant. Only the launcher unread query\n // (and the visitor-auth handshake it depends on) runs while\n // closed.\n const [hasOpened, setHasOpened] = useState(false);\n useEffect(() => {\n if (isOpen) setHasOpened(true);\n }, [isOpen]);\n\n // Unread state for the launcher badge + peek card. Real mode\n // queries `visitorChatUnread`; demo mode derives from getMockConversation().\n const unread = useVisitorUnread({\n chatId: session.chatId,\n isDummy,\n });\n\n // ─── Shell-level SSE pump ─────────────────────────────────────\n // Listens for realtime events across the whole widget lifetime —\n // not just while MessagesTab is mounted — so the launcher peek +\n // home-tab `recent-message` block refresh as soon as an operator /\n // bot / AI message arrives. MessagesTab still handles its own\n // transient state (typing indicator, in-flight composer) but\n // session-durable state (`liveMessages`) lives here so a visitor\n // who switches Help → Messages and back doesn't lose the new\n // bubbles they just saw.\n const apolloClient = useApolloClient();\n const messagesTabHandlerRef = useRef<((e: RealtimeMessageEvent) => void) | null>(null);\n\n // Messages appended in-session (SSE-delivered inbound + visitor's\n // optimistic outbound). Merged with the `visitorChatHistory` query\n // result inside MessagesTab — kept here so route changes don't drop\n // them.\n const [liveMessages, setLiveMessages] = useState<MockMessage[]>([]);\n // Demo-only: a launcher-peek quick-reply tapped before the panel\n // opened. Handed to MessagesTab, which \"sends\" it on mount; cleared\n // once consumed.\n const [pendingPeekReply, setPendingPeekReply] = useState<string | null>(null);\n // Reset on chatId change — new visitor session, new accounting.\n // `session.chatId` is an intentional re-run trigger (not read in the\n // body): when the visitor's chat changes we want the live buffer\n // wiped, so it must stay in the dep array.\n // biome-ignore lint/correctness/useExhaustiveDependencies: chatId is a deliberate reset trigger, not an unused dep\n useEffect(() => {\n setLiveMessages([]);\n }, [session.chatId]);\n\n // Re-fetch the visitor profile whenever the underlying identity\n // changes — anon → identified after a passkey / Google sign-in, or a\n // different identified person on a shared device. Without this the\n // ProfileTab + `useVisitorProfilePreferences` would keep showing the\n // PRIOR session's cached profile (the `VisitorProfile` query takes no\n // variables, so the cache key doesn't move when the auth header does;\n // Apollo happily returns the anon result to an identified session).\n // Keyed off `session.peopleId` since that's the BE-resolved row id —\n // stable per user, flips on every real identity change. Skipped while\n // the feature is off or there's no session yet.\n // biome-ignore lint/correctness/useExhaustiveDependencies: peopleId is the deliberate refetch trigger; apolloClient is a stable instance\n useEffect(() => {\n if (!config.features.profile) return;\n if (!session.peopleId || !session.token) return;\n void apolloClient.refetchQueries({ include: [VisitorProfileDocument] });\n }, [session.peopleId]);\n\n /**\n * Append a message to the in-session live list. Dedupes by id so\n * SSE replays + optimistic-then-confirmed sends don't double up.\n */\n const appendLiveMessage = useCallback((msg: MockMessage) => {\n setLiveMessages((prev) => {\n if (prev.some((m) => m.id === msg.id)) return prev;\n return [...prev, msg];\n });\n }, []);\n\n /**\n * Swap an optimistic tmp-id row for the BE-persisted real row.\n * Used by the visitor's send path — append optimistic with a\n * `tmp-…` id, fire the mutation, replace once the BE returns the\n * canonical message id. Keeps the bubble visible the whole time\n * AND lets history-cache dedupe work on later reads.\n */\n const replaceLiveMessage = useCallback((tmpId: string, msg: MockMessage) => {\n // Preserve the original row's `clientKey` across the swap so\n // React's reconciler treats it as the SAME bubble. Without this\n // the AnimatePresence key flips when `id` changes from tmp-… to\n // the BE-canonical id, the bubble unmounts + remounts, and the\n // visitor sees their just-sent message \"re-animate\" the moment\n // an SSE event triggers a re-render. The caller can still pass\n // an explicit `clientKey` to override (rare).\n setLiveMessages((prev) =>\n prev.map((m) =>\n m.id === tmpId ? { ...msg, clientKey: msg.clientKey ?? m.clientKey ?? tmpId } : m,\n ),\n );\n }, []);\n // Stable register fn — MessagesTab calls this on mount with its\n // handler; the returned cleanup nulls the ref on unmount. Stable\n // identity is critical: a fresh function each render would loop\n // the tab's `useEffect`.\n const registerMessagesRealtimeHandler = useRef((handler: (e: RealtimeMessageEvent) => void) => {\n messagesTabHandlerRef.current = handler;\n return () => {\n if (messagesTabHandlerRef.current === handler) {\n messagesTabHandlerRef.current = null;\n }\n };\n }).current;\n\n useVisitorRealtime({\n chatId: session.chatId,\n token: session.token,\n enabled: !isDummy && mode === \"production\",\n onMessage: (event) => {\n // Forward to the MessagesTab handler (if mounted) so the\n // in-conversation list + typing indicator keep updating.\n messagesTabHandlerRef.current?.(event);\n\n // Read-receipts adjust the unread counter locally — no refetch.\n if (event.kind === \"read-receipt\") {\n unread.noteRead(event.readReceipt?.messageIds ?? []);\n return;\n }\n // Typing pings don't move any counter — they're consumed by\n // the MessagesTab handler above for the typing indicator only.\n if (event.kind === \"typing\") return;\n\n // Visitor's own echoes don't count toward unread / recent.\n const senderKind = (event.from ?? event.sender)?.kind;\n if (senderKind === \"visitor\") return;\n\n // Sound — fire for ANY non-visitor inbound regardless of route.\n // Previously this was wired only through `MessagesTab.onInbound`,\n // which doesn't mount when the visitor is on Home / Profile / the\n // launcher → no audible cue unless they were already on the chat\n // thread. The unread badge + recent-message card update from this\n // same handler, so the sound belongs with them, not inside the\n // tab. (MessagesTab keeps its own `onInbound` call for its\n // optimistic-echo flow — those are local appends, not SSE.)\n playInbound();\n\n // Append the inbound to the shared live list so the bubble\n // survives a Messages → Help → Messages round-trip. Outbound\n // (visitor) messages append from the send path inside\n // MessagesTab; SSE echoes of those are filtered above.\n const sender = event.from ?? event.sender;\n const buttons: MockMessageButton[] | undefined = Array.isArray(event.buttons)\n ? event.buttons.map((b) => ({ text: b.label, payload: b.value }))\n : undefined;\n // AI / bot senders display as AI_ASSISTANT_NAME regardless of the BE\n // label (\"WEB widget\", \"Bot\", etc) — that mirrors how the\n // typing indicator already labels them, and matches what\n // history-mapping does on reload. Operator senders flow\n // through unchanged so a real handoff still feels human.\n const displaySenderName =\n senderKind === \"ai\" || senderKind === \"bot\" ? AI_ASSISTANT_NAME : (sender?.name ?? \"\");\n // Format the message's send time the same way the history\n // mapper does so live + reloaded bubbles read identically.\n // Empty `ageLabel` (the previous value) left the live bubbles\n // missing the time strip — until the visitor reloaded the\n // page and history paint kicked in. `sentAt` falls back to\n // `Date.now()` when the BE forgets to stamp it.\n const sentAtIso = event.sentAt ?? new Date().toISOString();\n const ageLabel = (() => {\n try {\n return new Date(sentAtIso).toLocaleTimeString(undefined, {\n hour: \"numeric\",\n minute: \"2-digit\",\n });\n } catch {\n return \"\";\n }\n })();\n // Media events (`kind === \"media\"`) carry the attachment on\n // `event.media`. Either shape — SSE `{ mediaId: {...} }` singular\n // or array — is accepted by the normaliser, which also renames\n // the BE's `mimeType` to the widget's `mimetype` so the bubble\n // renderer + `<Media>` audio player pick it up.\n const rawMedia = (event as { media?: unknown }).media;\n const media = normalizeBackendMedia(rawMedia);\n // A media message's text rides on `media.caption` (single-attachment\n // SSE shape) — fall back to it when the event has no top-level `text`.\n const caption =\n rawMedia && typeof rawMedia === \"object\" && !Array.isArray(rawMedia)\n ? (rawMedia as { caption?: unknown }).caption\n : undefined;\n appendLiveMessage({\n id: event.externalMessageId,\n direction: \"OUTBOUND\",\n text: event.text || (typeof caption === \"string\" ? caption : \"\"),\n ageLabel,\n sender: {\n kind: (senderKind ?? \"operator\") as MockMessage[\"sender\"][\"kind\"],\n name: displaySenderName,\n ...(sender?.avatar ? { avatar: sender.avatar } : {}),\n },\n ...(media.length > 0 ? { media } : {}),\n ...(buttons ? { buttons } : {}),\n deliveryStatus: \"DELIVERED\" as const,\n });\n\n // Launcher badge + peek card → advance the local counter from\n // the event payload. No `visitorChatUnread` refetch — we seeded\n // once on session start and the SSE stream keeps us in sync.\n // MessagesTab decides when to ack via `markChatRead` (gated on\n // scroll position, see the tab's `ack` logic).\n unread.noteInbound(event);\n\n // Desktop notification — opt-in via profile preference. The ONLY\n // case where we DON'T fire is when the visitor is actively reading\n // the Messages tab in a visible browser window (they'll see the\n // bubble appear inline — a desktop popup would be redundant + a\n // little jarring). Every other state — panel collapsed, tab in\n // background, another sub-tab open (Home/Help/News/Profile) — gets\n // a notification because the new message wouldn't otherwise be\n // visible. Tagged by message id so an SSE reconnect re-pumping the\n // same event doesn't double-notify. Body falls back to a media\n // marker so an image-only reply still surfaces something readable.\n const docVisible = typeof document !== \"undefined\" && !document.hidden;\n const activelyReadingMessages = isOpen && docVisible && route.kind === \"messages\";\n const prefEnabled = profilePrefs.desktopNotifications;\n const permState =\n typeof Notification !== \"undefined\" ? Notification.permission : \"(unsupported)\";\n const permGranted = permState === \"granted\";\n const willNotify = prefEnabled && permGranted && !activelyReadingMessages;\n\n // One-line diagnostic so DevTools shows exactly why a notification\n // did / didn't fire on each inbound. Uses `console.log` rather than\n // `console.debug` because Chrome filters debug-level by default\n // (you'd need to flip the \"Verbose\" level on to see it) — and the\n // whole point of this line is for the user to see it without any\n // DevTools toggling. Cheap noise in dev; ship a feature flag later\n // if it gets annoying.\n console.log(\"[wexio] inbound:\", {\n id: event.externalMessageId,\n kind: event.kind,\n from: displaySenderName,\n prefEnabled,\n permission: permState,\n isOpen,\n docVisible,\n route: route.kind,\n activelyReadingMessages,\n willNotify,\n });\n\n if (prefEnabled && permGranted && !activelyReadingMessages) {\n try {\n const captionText = typeof caption === \"string\" ? caption : \"\";\n // BE sends rich-text inbounds as Tiptap HTML\n // (`<p class=\"tiptap-paragraph\">…</p>`, lists, marks, etc.).\n // The Notification API renders `body` as plain text — raw HTML\n // would show literally — so route through DOMParser to get\n // textContent the browser-native way (handles entities, nested\n // tags, line breaks correctly; no fragile regex).\n const body = htmlToPlainText(event.text || captionText, media);\n // Icon: prefer the sender's own avatar (operator photo / AI\n // mark) — it carries more meaning than the org logo when the\n // visitor sees a notification slide in. Fall back to the\n // operator org logo and then to nothing.\n const notificationIcon = sender?.avatar ?? organizationLogoUrl ?? undefined;\n const n = new Notification(displaySenderName || \"New message\", {\n body,\n tag: event.externalMessageId,\n icon: notificationIcon,\n });\n // Click → focus the existing widget tab + open the panel on\n // the Messages route. Without this Chrome's default behaviour\n // is to open / focus the page's URL in a new tab. The\n // notification auto-closes itself once the visitor has acted.\n n.onclick = () => {\n try {\n window.focus();\n } catch {\n /* some sandboxed contexts disallow focus; ignore */\n }\n setIsOpen(true);\n setRoute({ kind: \"messages\" });\n n.close();\n };\n } catch (err) {\n // Notification API can throw on iOS web / SecurityError contexts;\n // log so the visitor / operator can see what blocked it instead\n // of silently dropping (matches the diagnostic warns above).\n console.warn(\"[wexio] desktop notification failed:\", err);\n }\n } else if (prefEnabled && !permGranted) {\n // Pref says yes but browser permission isn't granted — the toggle\n // should normally keep these in sync (see profile-tab's permission\n // gate), but log here so a permission revoked from chrome://settings\n // doesn't silently swallow notifications.\n console.warn(\n \"[wexio] desktop notifications enabled but browser permission is not granted; current value:\",\n permState,\n );\n }\n\n // Home-tab `recent-message` block → write the new inbound\n // straight into the Apollo cache so subscribers re-render\n // without burning a `visitorChatRecentInbound` round-trip.\n if (session.chatId) {\n apolloClient.writeQuery({\n query: VisitorChatRecentInboundDocument,\n variables: { chatId: session.chatId },\n data: {\n __typename: \"Query\",\n visitorChatRecentInbound: {\n __typename: \"VisitorChatRecentInbound\",\n id: event.externalMessageId,\n text: event.text ?? null,\n createdAt: event.sentAt ?? new Date().toISOString(),\n sender: {\n __typename: \"VisitorUnreadSender\",\n kind: sender?.kind ?? \"operator\",\n name: sender?.name ?? \"\",\n avatar: sender?.avatar ?? null,\n },\n },\n },\n });\n }\n },\n });\n // Quick-reply sender used by the launcher peek. Real mode goes\n // through the existing `sendVisitorMessage` mutation; demo mode\n // is handled inline (no BE) — we just open the panel so the\n // messages tab takes over.\n const [sendVisitor] = useSendVisitorMessageMutation();\n\n // Routes that can widen — visitor benefits from more reading room\n // when they're inside a conversation or a single article. List\n // surfaces (home / help index / news index) stay at the default\n // width so the chrome composition the visitor expects holds.\n // **Persistence**: `expanded` is stored in localStorage\n // (`PANEL_EXPANDED_KEY`), so it survives navigation, reloads, AND\n // revisits — expand on Messages, leave, come back later, still wide.\n // Non-expandable routes simply ignore the flag via `effectiveExpanded`\n // rather than resetting it.\n const expandable =\n route.kind === \"messages\" || route.kind === \"help-article\" || route.kind === \"news-article\";\n const effectiveExpanded = expandable && expanded;\n\n // IDEAL dimensions — the widget wants 420 × 670 (640 × 860 expanded).\n // These are what we REPORT to the host (iframe loader / web-component),\n // which clamps to the host viewport itself.\n const idealW = effectiveExpanded ? 640 : 420;\n // Default-state height is 670 (trimmed 50px from 720) for a more\n // compact panel; the expanded state stays tall.\n const idealH = effectiveExpanded ? 860 : 670;\n\n // Viewport size — tracked so the expand ANIMATION targets the size the\n // panel will actually render at. Without this the spring animates the\n // height toward 860 even when the screen is shorter, so the height\n // meets its `max-h` ceiling and stops while the width is still moving\n // (the \"height finishes first\" the visitor sees, especially on screens\n // under ~860px tall). `null` until mounted → SSR-safe, no hydration gap\n // (panel is closed at first paint).\n const [viewport, setViewport] = useState<{ w: number; h: number } | null>(null);\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const read = () => {\n const w = window.innerWidth;\n const h = window.innerHeight;\n // Bail when the size didn't actually change — `resize` also fires\n // on zoom / mobile keyboard / devtools docking with no delta.\n // Returning the same reference makes React skip the re-render, so\n // the only renders are the ones that genuinely re-fit the panel.\n setViewport((prev) => (prev && prev.w === w && prev.h === h ? prev : { w, h }));\n };\n read();\n window.addEventListener(\"resize\", read);\n return () => window.removeEventListener(\"resize\", read);\n }, []);\n\n // CLAMPED dimensions used by the open/expand animation. Mirrors the CSS\n // `max-w / max-h`, so the spring animates to exactly what renders and\n // both axes settle together. Embedded (host-container) keeps the ideal\n // — the CSS `%` clamps handle it and we can't measure the container as\n // cheaply; the viewport path covers iframe + web-component.\n const panelW = embedded || !viewport ? idealW : Math.min(idealW, viewport.w - PANEL_MARGIN_X);\n const panelH = embedded || !viewport ? idealH : Math.min(idealH, viewport.h - PANEL_MARGIN_Y);\n\n // Track navigation direction so transitions feel like \"going\n // deeper\" (slide left + scale down a touch) or \"going back\"\n // (slide right + scale up). Tab indices give us a natural order;\n // drill-ins use a higher rank than their parent tab.\n const lastRankRef = useRef<number>(routeRank(route));\n const direction = (() => {\n const next = routeRank(route);\n const prev = lastRankRef.current;\n lastRankRef.current = next;\n if (next === prev) return 0;\n return next > prev ? 1 : -1;\n })();\n\n // Resize the embed surface based on open / closed / expanded state.\n // Reports the IDEAL dimensions (NOT the viewport-clamped ones) — the\n // iframe loader's styles + the web-component host clamp to viewport on\n // narrow screens. Reporting ideal here also breaks a feedback loop:\n // inside the iframe `window.innerHeight` IS the iframe height, so\n // reporting the clamped height would shrink the iframe, which would\n // shrink the clamp, and so on.\n useEffect(() => {\n const width = isOpen ? idealW : 72;\n const height = isOpen ? idealH : 72;\n env.onResize(width, height);\n }, [isOpen, idealW, idealH, env]);\n\n const close = () => {\n setIsOpen(false);\n if (mode === \"production\") env.onClose();\n };\n\n // Bulk-read acknowledgement is owned by MessagesTab — it knows\n // whether the new inbound is actually in view (at the bottom of\n // the conversation) vs. scrolled out of sight. The shell exposes\n // `unread.count` + `unread.clear` as props; the tab fires the\n // `markChatRead` mutation at the right moment and then clears\n // local state via `unread.clear` so the peek/badge disappear\n // without waiting for the SSE read-receipt round-trip.\n\n /**\n * Launcher peek → quick-reply tap. In real mode we send the\n * payload via the visitor mutation; in demo mode we just open the\n * panel (the messages tab's existing demo simulator will react to\n * the visitor's reply once they're inside). Both paths open the\n * widget so the visitor sees their reply land.\n */\n const handlePeekButton = async (payload: string, text: string) => {\n if (isDummy) {\n // Demo: hand the reply to the messages tab to \"send\" on mount\n // (visitor bubble + canned response), and clear the peek now so\n // it doesn't resurface after the visitor closes the widget.\n setPendingPeekReply(text);\n unread.clear();\n } else if (session.chatId) {\n try {\n await sendVisitor({ variables: { input: { text } } });\n } catch {\n // Quietly swallow — visitor will retry from inside the\n // panel; surfacing an error toast at the peek level would\n // be more noise than help.\n }\n // Real mode: MessagesTab mounts with `unreadCount > 0`, sees the\n // new message is at the bottom, and acks via `markChatRead` +\n // clearUnread. The peek is hidden by the `isOpen` gate either way.\n }\n setRoute({ kind: \"messages\" });\n setIsOpen(true);\n // Quick-reply tap is the visitor's reply — treat as an outbound\n // signal so the operator dashboard's \"visitor responded\" badge\n // catches it without waiting for the SSE round-trip.\n playOutbound();\n void payload;\n };\n\n const handlePeekOpen = () => {\n setRoute({ kind: \"messages\" });\n setIsOpen(true);\n };\n\n // Branding gate is server-authoritative: `config.branding` is always\n // resolved from the BE by publicKey (the full fetch, or the lite\n // `?view=gate` fetch when presentation is injected — never from\n // host-injected props), and the BE plan-gates `hidden`. So a host can't\n // fake white-label removal.\n const showBrandingFooter = !config.branding?.hidden;\n // When only ONE tab is enabled the bottom nav adds no value (the\n // visitor cannot move \"across\") — hide it. Also hides the\n // Messages-header back arrow downstream, since there is nowhere\n // for it to pop to.\n const tabCount = enabledTabCount(config.features);\n const showTabs = routeShowsTabs(route) && tabCount > 1;\n const isHome = route.kind === \"home\";\n const activeTab = routeToTab(route);\n\n const switchTab = (next: WidgetTab) => {\n // Mark the tab swap as a transition so the incoming tab's content\n // render (Apollo first-paint, list reconciliation) is interruptible\n // and yields to the slide animation's frames — the old tab stays\n // interactive until the new one is ready, then both the nav\n // highlight + the slide commit together. Keeps the route transition\n // off the animation's critical 16ms budget. See the perf notes in\n // the route `AnimatePresence` below (mode=\"sync\").\n startTransition(() => {\n setRoute({ kind: next === \"messages\" ? \"messages\" : next });\n });\n };\n\n return (\n <>\n <motion.div\n aria-hidden={!isOpen}\n initial={false}\n animate={\n // Bottom-right bubble at the desktop dimensions on every\n // viewport. The className's `max-w` shrinks the rendered\n // width on narrow phones without overriding the inline\n // `width: 420` (CSS allows both — `max-width` clamps the\n // declared width regardless of source specificity).\n isOpen\n ? {\n opacity: 1,\n y: 0,\n scale: 1,\n pointerEvents: \"auto\",\n width: panelW,\n height: panelH,\n }\n : {\n opacity: 0,\n y: 16,\n scale: 0.98,\n pointerEvents: \"none\",\n width: panelW,\n height: panelH,\n }\n }\n transition={{\n // Open/close rises gently from the launcher on a soft spring.\n //\n // Width + height share ONE spring with identical physics, so an\n // expand/collapse grows BOTH dimensions in lockstep — smooth and\n // proportional. The previous 140 ms linear-ish tween made the\n // height appear to finish before the width: on a short viewport\n // the expanded height meets its `max-h` clamp partway, so a\n // constant-velocity tween hit that ceiling abruptly while the\n // width kept travelling. A spring decelerates into place, so the\n // clamp reads as a settle rather than a hard cut, and the two\n // axes track together regardless of how far each one moves.\n opacity: { type: \"spring\", stiffness: 320, damping: 30 },\n y: { type: \"spring\", stiffness: 320, damping: 30 },\n scale: { type: \"spring\", stiffness: 320, damping: 30 },\n width: { type: \"spring\", stiffness: 300, damping: 32 },\n height: { type: \"spring\", stiffness: 300, damping: 32 },\n }}\n data-wx-panel\n className={cn(\n // `isolate` (isolation: isolate) makes the panel a PERMANENT\n // stacking context. Without it the panel is only a stacking\n // context while `motion` has a `transform` applied (during the\n // open animation) — once that settles to `transform: none` the\n // home gradient's `-z-10` child escapes to the parent context\n // and gets painted BEHIND the panel's opaque `bg-wx-bg`, so it\n // flashes in then vanishes.\n \"isolate flex flex-col overflow-hidden bg-wx-bg text-wx-fg\",\n // Anchored to the operator's chosen corner (`launcherPosition`),\n // bottom-right by default. `max-w` / `max-h` clamp the bubble\n // with a margin — no `min-width` anywhere so motion's inline\n // `width: 420` can shrink down freely.\n //\n // `embedded` (React-component embed) → anchor to the host\n // `<div>` with `absolute` + %-based clamps so the panel stays\n // inside its container. Otherwise → `fixed` + vw/dvh clamps so\n // it owns the viewport corner (iframe / web-component embeds).\n //\n // `data-wx-panel` opts the element into the theme-aware\n // shadow + frame-glow rules in globals.css (light: drop\n // shadow; dark: hairline ring + radial glow blob + stronger\n // shadow).\n embedded ? \"absolute\" : \"fixed\",\n \"bottom-24 rounded-wx-xl\",\n embedded\n ? \"max-w-[calc(100%-2rem)] max-h-[calc(100%-7rem)]\"\n : \"max-w-[calc(100vw-2rem)] max-h-[calc(100dvh-7rem)]\",\n launcherLeft ? \"left-4\" : \"right-4\",\n )}\n >\n {/* Home gradient backdrop (panel-level so it bleeds under\n anything that overlays it). Base gradient stops on the\n operator-themed `--wx-bg` so the bottom edge dissolves\n cleanly into the panel below the `h-96` band — without\n this the dark mode used hardcoded greys and you'd see a\n seam wherever the operator's theme tinted `--wx-bg` away\n from those greys (e.g. a green-tinged dark palette). Only\n the radial-tint opacity differs between light and dark. */}\n {isHome && (\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-x-0 top-0 -z-10 h-96 bg-[radial-gradient(120%_80%_at_50%_-10%,rgba(99,102,241,0.22),transparent_55%),linear-gradient(to_bottom,var(--wx-bg-elevated-2)_0%,var(--wx-bg-elevated)_40%,var(--wx-bg)_75%)] dark:bg-[radial-gradient(120%_80%_at_50%_-10%,rgba(99,102,241,0.35),transparent_55%),linear-gradient(to_bottom,var(--wx-bg-elevated-2)_0%,var(--wx-bg-elevated)_40%,var(--wx-bg)_75%)]\"\n />\n )}\n\n {/* Per-route sticky header. Home has no sticky header — its\n chrome is rendered inside the scrollable content area. */}\n <RouteHeader\n route={route}\n onPop={() => setRoute(popRoute(route, config.features))}\n onClose={close}\n />\n\n {/* `relative` so the absolutely-anchored route layers stack\n inside the main area. Both exiting and entering routes\n occupy `inset-0` so the panel height never jumps mid-\n transition. */}\n <main className=\"relative flex flex-1 flex-col overflow-hidden\">\n {/* Defer mounting tab content until the visitor has\n opened the panel at least once. The launcher unread\n query + visitor-auth handshake already cover what we\n need while closed; deferring everything else keeps the\n initial page-load footprint to one query (`visitorChatUnread`)\n instead of all four tabs racing to fetch their own\n data. After the first open, `hasOpened` stays true and\n the standard mount/unmount of routed tabs takes over. */}\n {hasOpened && (\n // `mode=\"sync\"` (not `popLayout`): the routes are\n // `absolute inset-0` and cross-slide via a `transform` — there\n // are no siblings to reflow, so popLayout's per-frame FLIP\n // *layout* measurement (the bulk of the animation cost in\n // profiling: ~1.2s of `serviceScriptedAnimations`) was pure\n // overhead, and popLayout kept the *outgoing* heavy tab\n // re-rendering as it exited. `sync` overlaps enter+exit on\n // transform/opacity only — same visual, compositor-driven.\n <AnimatePresence mode=\"sync\" initial={false} custom={direction}>\n <motion.div\n key={routeKey(route)}\n custom={direction}\n variants={routeVariants}\n initial=\"enter\"\n animate=\"center\"\n exit=\"exit\"\n // Tween (not spring) for two reasons:\n // 1. Spring simulators re-render every frame until\n // the velocity settles below threshold — for the\n // visitor that's invisible work paid for *every*\n // route change. A 180 ms ease-out covers the\n // visible distance in fewer integration steps at\n // lower CPU, and the result looks identical at\n // this scale (28 px is too small for spring's\n // overshoot to read).\n // 2. The outgoing route keeps re-rendering as React\n // still owns it during the exit — a heavy tab\n // (Messages with its live query) burns frames while\n // exiting. The short tween caps that exit work to\n // ~11 frames at 60 fps (and `startTransition` on the\n // tab swap keeps the *incoming* render off these\n // frames).\n transition={{\n x: { type: \"tween\", duration: 0.18, ease: [0.32, 0.72, 0, 1] },\n opacity: { duration: 0.14, ease: \"easeOut\" },\n }}\n // `will-change: transform` hoists the slide into its\n // own GPU compositor layer — paints stay off the main\n // thread, which is what makes the slide read as\n // smooth even when the incoming route's first frame\n // is heavy (Apollo first-paint, large lists, etc.).\n style={{ willChange: \"transform, opacity\" }}\n className=\"absolute inset-0 flex flex-col overflow-hidden\"\n >\n {route.kind === \"home\" && (\n <HomeTab\n config={config}\n organizationLogoUrl={organizationLogoUrl}\n onClose={close}\n onOpenTab={(tab) => setRoute({ kind: tab })}\n onOpenNewsArticle={(id) => setRoute({ kind: \"news-article\", id })}\n onOpenHelpArticle={(slug) =>\n setRoute({\n kind: \"help-article\",\n slug,\n from: \"search\",\n })\n }\n isDummy={isDummy}\n chatId={session.chatId ?? null}\n />\n )}\n {route.kind === \"messages\" && (\n <MessagesTab\n isDummy={isDummy}\n chatId={session.chatId}\n token={session.token}\n prechatForm={config.prechatForm}\n messenger={config.messenger}\n organizationLogoUrl={organizationLogoUrl}\n organizationName={config.messenger?.title ?? \"\"}\n isOpen={isOpen}\n onInbound={playInbound}\n onOutbound={playOutbound}\n registerRealtimeHandler={registerMessagesRealtimeHandler}\n unreadCount={unread.count}\n clearUnread={unread.clear}\n liveMessages={liveMessages}\n appendLiveMessage={appendLiveMessage}\n replaceLiveMessage={replaceLiveMessage}\n initialVisitorMessage={pendingPeekReply}\n onInitialVisitorMessageSent={() => setPendingPeekReply(null)}\n visitorIdentity={visitorIdentity}\n visitorPrefill={visitorPrefill}\n security={config.security}\n verified={session.verified}\n onGoogleCredential={(idToken) => setWidgetIdentity({ googleIdToken: idToken })}\n onPasskeySession={(result: PasskeySessionResult) => {\n // Persist so a reload restores this verified session\n // (passkey can't be silently re-proven). Also drive\n // the immediate (pre-reload) UI via the override.\n persistIdentifiedSession(result);\n setPasskeySession({\n token: result.token,\n chatId: result.chatId,\n peopleId: result.peopleId,\n displayName: result.displayName,\n isAuthenticating: false,\n error: null,\n verified: true,\n });\n }}\n onInternalLink={(link) => {\n // AI replies sometimes link to internal articles\n // (`/help/.../slug` or `/news/slug`). Route them\n // through the widget's own viewer instead of\n // following the browser navigation to the widget's\n // origin (where the path doesn't exist).\n if (link.kind === \"help-article\") {\n setRoute({\n kind: \"help-article\",\n slug: link.slug,\n from: \"search\",\n locale: link.locale,\n });\n } else if (link.kind === \"news-article\") {\n // Best-effort fallback: drop the visitor on the\n // news feed. A future improvement is to extend\n // `NewsArticleView` to accept a slug so we can\n // open the specific post directly. For now the\n // visitor lands in the right tab and can find it.\n setRoute({ kind: \"news\" });\n }\n }}\n />\n )}\n {route.kind === \"help\" && (\n <HelpTab\n isDummy={isDummy}\n onOpenCategory={(categoryId, meta) =>\n setRoute({\n kind: \"help-category\",\n categoryId,\n categoryName: meta?.name,\n categoryDescription: meta?.description,\n categoryArticleCount: meta?.articleCount,\n })\n }\n onOpenArticle={(slug) =>\n setRoute({ kind: \"help-article\", slug, from: \"search\" })\n }\n />\n )}\n {route.kind === \"help-category\" && (\n <HelpCategoryView\n categoryId={route.categoryId}\n categoryName={route.categoryName}\n categoryDescription={route.categoryDescription}\n categoryArticleCount={route.categoryArticleCount}\n isDummy={isDummy}\n onOpenCategory={(cid, meta) =>\n setRoute({\n kind: \"help-category\",\n categoryId: cid,\n categoryName: meta?.name,\n categoryDescription: meta?.description,\n categoryArticleCount: meta?.articleCount,\n })\n }\n onOpenArticle={(slug) =>\n setRoute({\n kind: \"help-article\",\n slug,\n from: \"category\",\n fromCategoryId: route.categoryId,\n })\n }\n />\n )}\n {route.kind === \"help-article\" && (\n <Suspense fallback={<RouteChunkFallback />}>\n <HelpArticleView\n slug={route.slug}\n // Honour a language-selector override (slug + the\n // chosen variant's locale); otherwise the widget\n // locale drives the lookup.\n locale={route.locale ?? locale}\n isDummy={isDummy}\n onHandoff={() => setRoute({ kind: \"messages\" })}\n onOpenArticle={(s: string) =>\n setRoute({\n kind: \"help-article\",\n slug: s,\n from: \"search\",\n })\n }\n onOpenTranslation={(s: string, loc: string) =>\n // Switch language in place — keep the same\n // back-nav context so \"Back\" still lands where\n // the visitor came from.\n setRoute({\n kind: \"help-article\",\n slug: s,\n locale: loc,\n from: route.from,\n fromCategoryId: route.fromCategoryId,\n })\n }\n onTitleResolved={setArticleTitle}\n />\n </Suspense>\n )}\n {route.kind === \"news\" && (\n <NewsTab\n isDummy={isDummy}\n onOpenArticle={(id) => setRoute({ kind: \"news-article\", id })}\n />\n )}\n {route.kind === \"news-article\" && (\n <Suspense fallback={<RouteChunkFallback />}>\n <NewsArticleView\n id={route.id}\n isDummy={isDummy}\n onOpenRelated={(rid) => setRoute({ kind: \"news-article\", id: rid })}\n onTitleResolved={setArticleTitle}\n />\n </Suspense>\n )}\n {route.kind === \"profile\" && <ProfileTab isDummy={isDummy} />}\n </motion.div>\n </AnimatePresence>\n )}\n </main>\n\n {showTabs && (\n <BottomNav\n active={activeTab}\n features={config.features}\n onChange={switchTab}\n unreadCount={unread.count}\n />\n )}\n {/* Branding sits inline as the very last line of the panel.\n On list routes it lands under the tab nav; on drill-in\n routes (messages, article, etc.) it sits under the\n composer / content. Always animates up from below on\n mount via motion so it still feels like it \"rises into\n place\" without overlapping the composer's tap surface. */}\n {showBrandingFooter && <BrandingFooter />}\n </motion.div>\n\n <LauncherPeek\n message={!isOpen ? unread.lastMessage : null}\n onOpen={handlePeekOpen}\n onDismiss={unread.clear}\n onSendButton={handlePeekButton}\n position={launcherLeft ? \"left\" : \"right\"}\n embedded={embedded}\n />\n\n <WidgetLauncher\n isOpen={isOpen}\n onToggle={() => setIsOpen((prev) => !prev)}\n unreadCount={unread.count}\n position={launcherLeft ? \"left\" : \"right\"}\n embedded={embedded}\n />\n </>\n );\n\n function RouteHeader({\n route,\n onPop,\n onClose,\n }: {\n route: WidgetRoute;\n onPop: () => void;\n onClose: () => void;\n }) {\n if (route.kind === \"messages\") {\n // Messages is a drill-in route from any list tab — but if the\n // operator only enabled Messenger there is no list tab to pop\n // to, so we omit `onBack` entirely (the header hides the chip\n // rather than rendering a dead control).\n const canPop = tabCount > 1;\n // Operator can override the header title + subtitle via\n // `config.messenger`. Falls back to the org name / i18n\n // subtitle when not configured, so existing embeds without\n // the new config don't change behaviour.\n const messengerTitle = config.messenger?.title?.trim() || AI_ASSISTANT_NAME;\n const messengerSubtitle =\n config.messenger?.description?.trim() || tHeader(\"conversationSubtitle\");\n return (\n <ConversationHeader\n title={messengerTitle}\n subtitle={messengerSubtitle}\n organizationLogoUrl={conversationLogoUrl}\n muted={muted}\n onToggleMute={toggleMuted}\n onBack={canPop ? onPop : undefined}\n onClose={onClose}\n expanded={effectiveExpanded}\n onToggleExpand={() => setExpanded((v) => !v)}\n />\n );\n }\n if (route.kind === \"help\") {\n return <TabTitleHeader title={tHeader(\"helpTitle\")} onClose={onClose} />;\n }\n if (route.kind === \"help-category\") {\n return <TabTitleHeader title={tHeader(\"helpTitle\")} onBack={onPop} onClose={onClose} />;\n }\n if (route.kind === \"help-article\") {\n return (\n <TabTitleHeader\n // Show the article's title once it has loaded — falls back\n // to the parent-tab nameplate while the data is in flight.\n title={articleTitle ?? tHeader(\"helpTitle\")}\n onBack={onPop}\n onClose={onClose}\n expanded={effectiveExpanded}\n onToggleExpand={() => setExpanded((v) => !v)}\n />\n );\n }\n if (route.kind === \"news\") {\n return <TabTitleHeader title={tHeader(\"newsTitle\")} onClose={onClose} />;\n }\n if (route.kind === \"news-article\") {\n return (\n <TabTitleHeader\n title={articleTitle ?? tHeader(\"newsTitle\")}\n onBack={onPop}\n onClose={onClose}\n expanded={effectiveExpanded}\n onToggleExpand={() => setExpanded((v) => !v)}\n />\n );\n }\n return null; // home — no sticky header\n }\n}\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/index.ts\nvar src_exports = {};\n__export(src_exports, {\n RequestCookies: () => RequestCookies,\n ResponseCookies: () => ResponseCookies,\n parseCookie: () => parseCookie,\n parseSetCookie: () => parseSetCookie,\n stringifyCookie: () => stringifyCookie\n});\nmodule.exports = __toCommonJS(src_exports);\n\n// src/serialize.ts\nfunction stringifyCookie(c) {\n var _a;\n const attrs = [\n \"path\" in c && c.path && `Path=${c.path}`,\n \"expires\" in c && (c.expires || c.expires === 0) && `Expires=${(typeof c.expires === \"number\" ? new Date(c.expires) : c.expires).toUTCString()}`,\n \"maxAge\" in c && typeof c.maxAge === \"number\" && `Max-Age=${c.maxAge}`,\n \"domain\" in c && c.domain && `Domain=${c.domain}`,\n \"secure\" in c && c.secure && \"Secure\",\n \"httpOnly\" in c && c.httpOnly && \"HttpOnly\",\n \"sameSite\" in c && c.sameSite && `SameSite=${c.sameSite}`,\n \"partitioned\" in c && c.partitioned && \"Partitioned\",\n \"priority\" in c && c.priority && `Priority=${c.priority}`\n ].filter(Boolean);\n const stringified = `${c.name}=${encodeURIComponent((_a = c.value) != null ? _a : \"\")}`;\n return attrs.length === 0 ? stringified : `${stringified}; ${attrs.join(\"; \")}`;\n}\nfunction parseCookie(cookie) {\n const map = /* @__PURE__ */ new Map();\n for (const pair of cookie.split(/; */)) {\n if (!pair)\n continue;\n const splitAt = pair.indexOf(\"=\");\n if (splitAt === -1) {\n map.set(pair, \"true\");\n continue;\n }\n const [key, value] = [pair.slice(0, splitAt), pair.slice(splitAt + 1)];\n try {\n map.set(key, decodeURIComponent(value != null ? value : \"true\"));\n } catch {\n }\n }\n return map;\n}\nfunction parseSetCookie(setCookie) {\n if (!setCookie) {\n return void 0;\n }\n const [[name, value], ...attributes] = parseCookie(setCookie);\n const {\n domain,\n expires,\n httponly,\n maxage,\n path,\n samesite,\n secure,\n partitioned,\n priority\n } = Object.fromEntries(\n attributes.map(([key, value2]) => [\n key.toLowerCase().replace(/-/g, \"\"),\n value2\n ])\n );\n const cookie = {\n name,\n value: decodeURIComponent(value),\n domain,\n ...expires && { expires: new Date(expires) },\n ...httponly && { httpOnly: true },\n ...typeof maxage === \"string\" && { maxAge: Number(maxage) },\n path,\n ...samesite && { sameSite: parseSameSite(samesite) },\n ...secure && { secure: true },\n ...priority && { priority: parsePriority(priority) },\n ...partitioned && { partitioned: true }\n };\n return compact(cookie);\n}\nfunction compact(t) {\n const newT = {};\n for (const key in t) {\n if (t[key]) {\n newT[key] = t[key];\n }\n }\n return newT;\n}\nvar SAME_SITE = [\"strict\", \"lax\", \"none\"];\nfunction parseSameSite(string) {\n string = string.toLowerCase();\n return SAME_SITE.includes(string) ? string : void 0;\n}\nvar PRIORITY = [\"low\", \"medium\", \"high\"];\nfunction parsePriority(string) {\n string = string.toLowerCase();\n return PRIORITY.includes(string) ? string : void 0;\n}\nfunction splitCookiesString(cookiesString) {\n if (!cookiesString)\n return [];\n var cookiesStrings = [];\n var pos = 0;\n var start;\n var ch;\n var lastComma;\n var nextStart;\n var cookiesSeparatorFound;\n function skipWhitespace() {\n while (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) {\n pos += 1;\n }\n return pos < cookiesString.length;\n }\n function notSpecialChar() {\n ch = cookiesString.charAt(pos);\n return ch !== \"=\" && ch !== \";\" && ch !== \",\";\n }\n while (pos < cookiesString.length) {\n start = pos;\n cookiesSeparatorFound = false;\n while (skipWhitespace()) {\n ch = cookiesString.charAt(pos);\n if (ch === \",\") {\n lastComma = pos;\n pos += 1;\n skipWhitespace();\n nextStart = pos;\n while (pos < cookiesString.length && notSpecialChar()) {\n pos += 1;\n }\n if (pos < cookiesString.length && cookiesString.charAt(pos) === \"=\") {\n cookiesSeparatorFound = true;\n pos = nextStart;\n cookiesStrings.push(cookiesString.substring(start, lastComma));\n start = pos;\n } else {\n pos = lastComma + 1;\n }\n } else {\n pos += 1;\n }\n }\n if (!cookiesSeparatorFound || pos >= cookiesString.length) {\n cookiesStrings.push(cookiesString.substring(start, cookiesString.length));\n }\n }\n return cookiesStrings;\n}\n\n// src/request-cookies.ts\nvar RequestCookies = class {\n constructor(requestHeaders) {\n /** @internal */\n this._parsed = /* @__PURE__ */ new Map();\n this._headers = requestHeaders;\n const header = requestHeaders.get(\"cookie\");\n if (header) {\n const parsed = parseCookie(header);\n for (const [name, value] of parsed) {\n this._parsed.set(name, { name, value });\n }\n }\n }\n [Symbol.iterator]() {\n return this._parsed[Symbol.iterator]();\n }\n /**\n * The amount of cookies received from the client\n */\n get size() {\n return this._parsed.size;\n }\n get(...args) {\n const name = typeof args[0] === \"string\" ? args[0] : args[0].name;\n return this._parsed.get(name);\n }\n getAll(...args) {\n var _a;\n const all = Array.from(this._parsed);\n if (!args.length) {\n return all.map(([_, value]) => value);\n }\n const name = typeof args[0] === \"string\" ? args[0] : (_a = args[0]) == null ? void 0 : _a.name;\n return all.filter(([n]) => n === name).map(([_, value]) => value);\n }\n has(name) {\n return this._parsed.has(name);\n }\n set(...args) {\n const [name, value] = args.length === 1 ? [args[0].name, args[0].value] : args;\n const map = this._parsed;\n map.set(name, { name, value });\n this._headers.set(\n \"cookie\",\n Array.from(map).map(([_, value2]) => stringifyCookie(value2)).join(\"; \")\n );\n return this;\n }\n /**\n * Delete the cookies matching the passed name or names in the request.\n */\n delete(names) {\n const map = this._parsed;\n const result = !Array.isArray(names) ? map.delete(names) : names.map((name) => map.delete(name));\n this._headers.set(\n \"cookie\",\n Array.from(map).map(([_, value]) => stringifyCookie(value)).join(\"; \")\n );\n return result;\n }\n /**\n * Delete all the cookies in the cookies in the request.\n */\n clear() {\n this.delete(Array.from(this._parsed.keys()));\n return this;\n }\n /**\n * Format the cookies in the request as a string for logging\n */\n [Symbol.for(\"edge-runtime.inspect.custom\")]() {\n return `RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`;\n }\n toString() {\n return [...this._parsed.values()].map((v) => `${v.name}=${encodeURIComponent(v.value)}`).join(\"; \");\n }\n};\n\n// src/response-cookies.ts\nvar ResponseCookies = class {\n constructor(responseHeaders) {\n /** @internal */\n this._parsed = /* @__PURE__ */ new Map();\n var _a, _b, _c;\n this._headers = responseHeaders;\n const setCookie = (_c = (_b = (_a = responseHeaders.getSetCookie) == null ? void 0 : _a.call(responseHeaders)) != null ? _b : responseHeaders.get(\"set-cookie\")) != null ? _c : [];\n const cookieStrings = Array.isArray(setCookie) ? setCookie : splitCookiesString(setCookie);\n for (const cookieString of cookieStrings) {\n const parsed = parseSetCookie(cookieString);\n if (parsed)\n this._parsed.set(parsed.name, parsed);\n }\n }\n /**\n * {@link https://wicg.github.io/cookie-store/#CookieStore-get CookieStore#get} without the Promise.\n */\n get(...args) {\n const key = typeof args[0] === \"string\" ? args[0] : args[0].name;\n return this._parsed.get(key);\n }\n /**\n * {@link https://wicg.github.io/cookie-store/#CookieStore-getAll CookieStore#getAll} without the Promise.\n */\n getAll(...args) {\n var _a;\n const all = Array.from(this._parsed.values());\n if (!args.length) {\n return all;\n }\n const key = typeof args[0] === \"string\" ? args[0] : (_a = args[0]) == null ? void 0 : _a.name;\n return all.filter((c) => c.name === key);\n }\n has(name) {\n return this._parsed.has(name);\n }\n /**\n * {@link https://wicg.github.io/cookie-store/#CookieStore-set CookieStore#set} without the Promise.\n */\n set(...args) {\n const [name, value, cookie] = args.length === 1 ? [args[0].name, args[0].value, args[0]] : args;\n const map = this._parsed;\n map.set(name, normalizeCookie({ name, value, ...cookie }));\n replace(map, this._headers);\n return this;\n }\n /**\n * {@link https://wicg.github.io/cookie-store/#CookieStore-delete CookieStore#delete} without the Promise.\n */\n delete(...args) {\n const [name, options] = typeof args[0] === \"string\" ? [args[0]] : [args[0].name, args[0]];\n return this.set({ ...options, name, value: \"\", expires: /* @__PURE__ */ new Date(0) });\n }\n [Symbol.for(\"edge-runtime.inspect.custom\")]() {\n return `ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`;\n }\n toString() {\n return [...this._parsed.values()].map(stringifyCookie).join(\"; \");\n }\n};\nfunction replace(bag, headers) {\n headers.delete(\"set-cookie\");\n for (const [, value] of bag) {\n const serialized = stringifyCookie(value);\n headers.append(\"set-cookie\", serialized);\n }\n}\nfunction normalizeCookie(cookie = { name: \"\", value: \"\" }) {\n if (typeof cookie.expires === \"number\") {\n cookie.expires = new Date(cookie.expires);\n }\n if (cookie.maxAge) {\n cookie.expires = new Date(Date.now() + cookie.maxAge * 1e3);\n }\n if (cookie.path === null || cookie.path === void 0) {\n cookie.path = \"/\";\n }\n return cookie;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n RequestCookies,\n ResponseCookies,\n parseCookie,\n parseSetCookie,\n stringifyCookie\n});\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n RequestCookies: null,\n ResponseCookies: null,\n stringifyCookie: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n RequestCookies: function() {\n return _cookies.RequestCookies;\n },\n ResponseCookies: function() {\n return _cookies.ResponseCookies;\n },\n stringifyCookie: function() {\n return _cookies.stringifyCookie;\n }\n});\nconst _cookies = require(\"next/dist/compiled/@edge-runtime/cookies\");\n\n//# sourceMappingURL=cookies.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"ReflectAdapter\", {\n enumerable: true,\n get: function() {\n return ReflectAdapter;\n }\n});\nclass ReflectAdapter {\n static get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n if (typeof value === 'function') {\n return value.bind(target);\n }\n return value;\n }\n static set(target, prop, value, receiver) {\n return Reflect.set(target, prop, value, receiver);\n }\n static has(target, prop) {\n return Reflect.has(target, prop);\n }\n static deleteProperty(target, prop) {\n return Reflect.deleteProperty(target, prop);\n }\n}\n\n//# sourceMappingURL=reflect.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n bindSnapshot: null,\n createAsyncLocalStorage: null,\n createSnapshot: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n bindSnapshot: function() {\n return bindSnapshot;\n },\n createAsyncLocalStorage: function() {\n return createAsyncLocalStorage;\n },\n createSnapshot: function() {\n return createSnapshot;\n }\n});\nconst sharedAsyncLocalStorageNotAvailableError = Object.defineProperty(new Error('Invariant: AsyncLocalStorage accessed in runtime where it is not available'), \"__NEXT_ERROR_CODE\", {\n value: \"E504\",\n enumerable: false,\n configurable: true\n});\nclass FakeAsyncLocalStorage {\n disable() {\n throw sharedAsyncLocalStorageNotAvailableError;\n }\n getStore() {\n // This fake implementation of AsyncLocalStorage always returns `undefined`.\n return undefined;\n }\n run() {\n throw sharedAsyncLocalStorageNotAvailableError;\n }\n exit() {\n throw sharedAsyncLocalStorageNotAvailableError;\n }\n enterWith() {\n throw sharedAsyncLocalStorageNotAvailableError;\n }\n static bind(fn) {\n return fn;\n }\n}\nconst maybeGlobalAsyncLocalStorage = typeof globalThis !== 'undefined' && globalThis.AsyncLocalStorage;\nfunction createAsyncLocalStorage() {\n if (maybeGlobalAsyncLocalStorage) {\n return new maybeGlobalAsyncLocalStorage();\n }\n return new FakeAsyncLocalStorage();\n}\nfunction bindSnapshot(// WARNING: Don't pass a named function to this argument! See: https://github.com/facebook/react/pull/34911\nfn) {\n if (maybeGlobalAsyncLocalStorage) {\n return maybeGlobalAsyncLocalStorage.bind(fn);\n }\n return FakeAsyncLocalStorage.bind(fn);\n}\nfunction createSnapshot() {\n if (maybeGlobalAsyncLocalStorage) {\n return maybeGlobalAsyncLocalStorage.snapshot();\n }\n return function(fn, ...args) {\n return fn(...args);\n };\n}\n\n//# sourceMappingURL=async-local-storage.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"workAsyncStorageInstance\", {\n enumerable: true,\n get: function() {\n return workAsyncStorageInstance;\n }\n});\nconst _asynclocalstorage = require(\"./async-local-storage\");\nconst workAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();\n\n//# sourceMappingURL=work-async-storage-instance.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"workAsyncStorage\", {\n enumerable: true,\n get: function() {\n return _workasyncstorageinstance.workAsyncStorageInstance;\n }\n});\nconst _workasyncstorageinstance = require(\"./work-async-storage-instance\");\n\n//# sourceMappingURL=work-async-storage.external.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n ActionDidNotRevalidate: null,\n ActionDidRevalidateDynamicOnly: null,\n ActionDidRevalidateStaticAndDynamic: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n ActionDidNotRevalidate: function() {\n return ActionDidNotRevalidate;\n },\n ActionDidRevalidateDynamicOnly: function() {\n return ActionDidRevalidateDynamicOnly;\n },\n ActionDidRevalidateStaticAndDynamic: function() {\n return ActionDidRevalidateStaticAndDynamic;\n }\n});\nconst ActionDidNotRevalidate = 0;\nconst ActionDidRevalidateStaticAndDynamic = 1;\nconst ActionDidRevalidateDynamicOnly = 2;\n\n//# sourceMappingURL=action-revalidation-kind.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n MutableRequestCookiesAdapter: null,\n ReadonlyRequestCookiesError: null,\n RequestCookiesAdapter: null,\n appendMutableCookies: null,\n areCookiesMutableInCurrentPhase: null,\n createCookiesWithMutableAccessCheck: null,\n getModifiedCookieValues: null,\n responseCookiesToRequestCookies: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n MutableRequestCookiesAdapter: function() {\n return MutableRequestCookiesAdapter;\n },\n ReadonlyRequestCookiesError: function() {\n return ReadonlyRequestCookiesError;\n },\n RequestCookiesAdapter: function() {\n return RequestCookiesAdapter;\n },\n appendMutableCookies: function() {\n return appendMutableCookies;\n },\n areCookiesMutableInCurrentPhase: function() {\n return areCookiesMutableInCurrentPhase;\n },\n createCookiesWithMutableAccessCheck: function() {\n return createCookiesWithMutableAccessCheck;\n },\n getModifiedCookieValues: function() {\n return getModifiedCookieValues;\n },\n responseCookiesToRequestCookies: function() {\n return responseCookiesToRequestCookies;\n }\n});\nconst _cookies = require(\"../cookies\");\nconst _reflect = require(\"./reflect\");\nconst _workasyncstorageexternal = require(\"../../../app-render/work-async-storage.external\");\nconst _actionrevalidationkind = require(\"../../../../shared/lib/action-revalidation-kind\");\nclass ReadonlyRequestCookiesError extends Error {\n constructor(){\n super('Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options');\n }\n static callable() {\n throw new ReadonlyRequestCookiesError();\n }\n}\nclass RequestCookiesAdapter {\n static seal(cookies) {\n return new Proxy(cookies, {\n get (target, prop, receiver) {\n switch(prop){\n case 'clear':\n case 'delete':\n case 'set':\n return ReadonlyRequestCookiesError.callable;\n default:\n return _reflect.ReflectAdapter.get(target, prop, receiver);\n }\n }\n });\n }\n}\nconst SYMBOL_MODIFY_COOKIE_VALUES = Symbol.for('next.mutated.cookies');\nfunction getModifiedCookieValues(cookies) {\n const modified = cookies[SYMBOL_MODIFY_COOKIE_VALUES];\n if (!modified || !Array.isArray(modified) || modified.length === 0) {\n return [];\n }\n return modified;\n}\nfunction appendMutableCookies(headers, mutableCookies) {\n const modifiedCookieValues = getModifiedCookieValues(mutableCookies);\n if (modifiedCookieValues.length === 0) {\n return false;\n }\n // Return a new response that extends the response with\n // the modified cookies as fallbacks. `res` cookies\n // will still take precedence.\n const resCookies = new _cookies.ResponseCookies(headers);\n const returnedCookies = resCookies.getAll();\n // Set the modified cookies as fallbacks.\n for (const cookie of modifiedCookieValues){\n resCookies.set(cookie);\n }\n // Set the original cookies as the final values.\n for (const cookie of returnedCookies){\n resCookies.set(cookie);\n }\n return true;\n}\nclass MutableRequestCookiesAdapter {\n static wrap(cookies, onUpdateCookies) {\n const responseCookies = new _cookies.ResponseCookies(new Headers());\n for (const cookie of cookies.getAll()){\n responseCookies.set(cookie);\n }\n let modifiedValues = [];\n const modifiedCookies = new Set();\n const updateResponseCookies = ()=>{\n // TODO-APP: change method of getting workStore\n const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();\n if (workStore) {\n workStore.pathWasRevalidated = _actionrevalidationkind.ActionDidRevalidateStaticAndDynamic;\n }\n const allCookies = responseCookies.getAll();\n modifiedValues = allCookies.filter((c)=>modifiedCookies.has(c.name));\n if (onUpdateCookies) {\n const serializedCookies = [];\n for (const cookie of modifiedValues){\n const tempCookies = new _cookies.ResponseCookies(new Headers());\n tempCookies.set(cookie);\n serializedCookies.push(tempCookies.toString());\n }\n onUpdateCookies(serializedCookies);\n }\n };\n const wrappedCookies = new Proxy(responseCookies, {\n get (target, prop, receiver) {\n switch(prop){\n // A special symbol to get the modified cookie values\n case SYMBOL_MODIFY_COOKIE_VALUES:\n return modifiedValues;\n // TODO: Throw error if trying to set a cookie after the response\n // headers have been set.\n case 'delete':\n return function(...args) {\n modifiedCookies.add(typeof args[0] === 'string' ? args[0] : args[0].name);\n try {\n target.delete(...args);\n return wrappedCookies;\n } finally{\n updateResponseCookies();\n }\n };\n case 'set':\n return function(...args) {\n modifiedCookies.add(typeof args[0] === 'string' ? args[0] : args[0].name);\n try {\n target.set(...args);\n return wrappedCookies;\n } finally{\n updateResponseCookies();\n }\n };\n default:\n return _reflect.ReflectAdapter.get(target, prop, receiver);\n }\n }\n });\n return wrappedCookies;\n }\n}\nfunction createCookiesWithMutableAccessCheck(requestStore) {\n const wrappedCookies = new Proxy(requestStore.mutableCookies, {\n get (target, prop, receiver) {\n switch(prop){\n case 'delete':\n return function(...args) {\n ensureCookiesAreStillMutable(requestStore, 'cookies().delete');\n target.delete(...args);\n return wrappedCookies;\n };\n case 'set':\n return function(...args) {\n ensureCookiesAreStillMutable(requestStore, 'cookies().set');\n target.set(...args);\n return wrappedCookies;\n };\n default:\n return _reflect.ReflectAdapter.get(target, prop, receiver);\n }\n }\n });\n return wrappedCookies;\n}\nfunction areCookiesMutableInCurrentPhase(requestStore) {\n return requestStore.phase === 'action';\n}\n/** Ensure that cookies() starts throwing on mutation\n * if we changed phases and can no longer mutate.\n *\n * This can happen when going:\n * 'render' -> 'after'\n * 'action' -> 'render'\n * */ function ensureCookiesAreStillMutable(requestStore, _callingExpression) {\n if (!areCookiesMutableInCurrentPhase(requestStore)) {\n // TODO: maybe we can give a more precise error message based on callingExpression?\n throw new ReadonlyRequestCookiesError();\n }\n}\nfunction responseCookiesToRequestCookies(responseCookies) {\n const requestCookies = new _cookies.RequestCookies(new Headers());\n for (const cookie of responseCookies.getAll()){\n requestCookies.set(cookie);\n }\n return requestCookies;\n}\n\n//# sourceMappingURL=request-cookies.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"workUnitAsyncStorageInstance\", {\n enumerable: true,\n get: function() {\n return workUnitAsyncStorageInstance;\n }\n});\nconst _asynclocalstorage = require(\"./async-local-storage\");\nconst workUnitAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();\n\n//# sourceMappingURL=work-unit-async-storage-instance.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n ACTION_HEADER: null,\n FLIGHT_HEADERS: null,\n NEXT_ACTION_NOT_FOUND_HEADER: null,\n NEXT_ACTION_REVALIDATED_HEADER: null,\n NEXT_DID_POSTPONE_HEADER: null,\n NEXT_HMR_REFRESH_HASH_COOKIE: null,\n NEXT_HMR_REFRESH_HEADER: null,\n NEXT_HTML_REQUEST_ID_HEADER: null,\n NEXT_INSTANT_PREFETCH_HEADER: null,\n NEXT_INSTANT_TEST_COOKIE: null,\n NEXT_IS_PRERENDER_HEADER: null,\n NEXT_REQUEST_ID_HEADER: null,\n NEXT_REWRITTEN_PATH_HEADER: null,\n NEXT_REWRITTEN_QUERY_HEADER: null,\n NEXT_ROUTER_PREFETCH_HEADER: null,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER: null,\n NEXT_ROUTER_STALE_TIME_HEADER: null,\n NEXT_ROUTER_STATE_TREE_HEADER: null,\n NEXT_RSC_UNION_QUERY: null,\n NEXT_URL: null,\n RSC_CONTENT_TYPE_HEADER: null,\n RSC_HEADER: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n ACTION_HEADER: function() {\n return ACTION_HEADER;\n },\n FLIGHT_HEADERS: function() {\n return FLIGHT_HEADERS;\n },\n NEXT_ACTION_NOT_FOUND_HEADER: function() {\n return NEXT_ACTION_NOT_FOUND_HEADER;\n },\n NEXT_ACTION_REVALIDATED_HEADER: function() {\n return NEXT_ACTION_REVALIDATED_HEADER;\n },\n NEXT_DID_POSTPONE_HEADER: function() {\n return NEXT_DID_POSTPONE_HEADER;\n },\n NEXT_HMR_REFRESH_HASH_COOKIE: function() {\n return NEXT_HMR_REFRESH_HASH_COOKIE;\n },\n NEXT_HMR_REFRESH_HEADER: function() {\n return NEXT_HMR_REFRESH_HEADER;\n },\n NEXT_HTML_REQUEST_ID_HEADER: function() {\n return NEXT_HTML_REQUEST_ID_HEADER;\n },\n NEXT_INSTANT_PREFETCH_HEADER: function() {\n return NEXT_INSTANT_PREFETCH_HEADER;\n },\n NEXT_INSTANT_TEST_COOKIE: function() {\n return NEXT_INSTANT_TEST_COOKIE;\n },\n NEXT_IS_PRERENDER_HEADER: function() {\n return NEXT_IS_PRERENDER_HEADER;\n },\n NEXT_REQUEST_ID_HEADER: function() {\n return NEXT_REQUEST_ID_HEADER;\n },\n NEXT_REWRITTEN_PATH_HEADER: function() {\n return NEXT_REWRITTEN_PATH_HEADER;\n },\n NEXT_REWRITTEN_QUERY_HEADER: function() {\n return NEXT_REWRITTEN_QUERY_HEADER;\n },\n NEXT_ROUTER_PREFETCH_HEADER: function() {\n return NEXT_ROUTER_PREFETCH_HEADER;\n },\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER: function() {\n return NEXT_ROUTER_SEGMENT_PREFETCH_HEADER;\n },\n NEXT_ROUTER_STALE_TIME_HEADER: function() {\n return NEXT_ROUTER_STALE_TIME_HEADER;\n },\n NEXT_ROUTER_STATE_TREE_HEADER: function() {\n return NEXT_ROUTER_STATE_TREE_HEADER;\n },\n NEXT_RSC_UNION_QUERY: function() {\n return NEXT_RSC_UNION_QUERY;\n },\n NEXT_URL: function() {\n return NEXT_URL;\n },\n RSC_CONTENT_TYPE_HEADER: function() {\n return RSC_CONTENT_TYPE_HEADER;\n },\n RSC_HEADER: function() {\n return RSC_HEADER;\n }\n});\nconst RSC_HEADER = 'rsc';\nconst ACTION_HEADER = 'next-action';\nconst NEXT_ROUTER_STATE_TREE_HEADER = 'next-router-state-tree';\nconst NEXT_ROUTER_PREFETCH_HEADER = 'next-router-prefetch';\nconst NEXT_ROUTER_SEGMENT_PREFETCH_HEADER = 'next-router-segment-prefetch';\nconst NEXT_HMR_REFRESH_HEADER = 'next-hmr-refresh';\nconst NEXT_HMR_REFRESH_HASH_COOKIE = '__next_hmr_refresh_hash__';\nconst NEXT_URL = 'next-url';\nconst RSC_CONTENT_TYPE_HEADER = 'text/x-component';\nconst NEXT_INSTANT_PREFETCH_HEADER = 'next-instant-navigation-testing-prefetch';\nconst NEXT_INSTANT_TEST_COOKIE = 'next-instant-navigation-testing';\nconst FLIGHT_HEADERS = [\n RSC_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_HMR_REFRESH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER\n];\nconst NEXT_RSC_UNION_QUERY = '_rsc';\nconst NEXT_ROUTER_STALE_TIME_HEADER = 'x-nextjs-stale-time';\nconst NEXT_DID_POSTPONE_HEADER = 'x-nextjs-postponed';\nconst NEXT_REWRITTEN_PATH_HEADER = 'x-nextjs-rewritten-path';\nconst NEXT_REWRITTEN_QUERY_HEADER = 'x-nextjs-rewritten-query';\nconst NEXT_IS_PRERENDER_HEADER = 'x-nextjs-prerender';\nconst NEXT_ACTION_NOT_FOUND_HEADER = 'x-nextjs-action-not-found';\nconst NEXT_REQUEST_ID_HEADER = 'x-nextjs-request-id';\nconst NEXT_HTML_REQUEST_ID_HEADER = 'x-nextjs-html-request-id';\nconst NEXT_ACTION_REVALIDATED_HEADER = 'x-action-revalidated';\n\nif ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {\n Object.defineProperty(exports.default, '__esModule', { value: true });\n Object.assign(exports.default, exports);\n module.exports = exports.default;\n}\n\n//# sourceMappingURL=app-router-headers.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"InvariantError\", {\n enumerable: true,\n get: function() {\n return InvariantError;\n }\n});\nclass InvariantError extends Error {\n constructor(message, options){\n super(`Invariant: ${message.endsWith('.') ? message : message + '.'} This is a bug in Next.js.`, options);\n this.name = 'InvariantError';\n }\n}\n\n//# sourceMappingURL=invariant-error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"createPromiseWithResolvers\", {\n enumerable: true,\n get: function() {\n return createPromiseWithResolvers;\n }\n});\nfunction createPromiseWithResolvers() {\n // Shim of Stage 4 Promise.withResolvers proposal\n let resolve;\n let reject;\n const promise = new Promise((res, rej)=>{\n resolve = res;\n reject = rej;\n });\n return {\n resolve: resolve,\n reject: reject,\n promise\n };\n}\n\n//# sourceMappingURL=promise-with-resolvers.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n RenderStage: null,\n StagedRenderingController: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n RenderStage: function() {\n return RenderStage;\n },\n StagedRenderingController: function() {\n return StagedRenderingController;\n }\n});\nconst _invarianterror = require(\"../../shared/lib/invariant-error\");\nconst _promisewithresolvers = require(\"../../shared/lib/promise-with-resolvers\");\nvar RenderStage = /*#__PURE__*/ function(RenderStage) {\n RenderStage[RenderStage[\"Before\"] = 1] = \"Before\";\n RenderStage[RenderStage[\"EarlyStatic\"] = 2] = \"EarlyStatic\";\n RenderStage[RenderStage[\"Static\"] = 3] = \"Static\";\n RenderStage[RenderStage[\"EarlyRuntime\"] = 4] = \"EarlyRuntime\";\n RenderStage[RenderStage[\"Runtime\"] = 5] = \"Runtime\";\n RenderStage[RenderStage[\"Dynamic\"] = 6] = \"Dynamic\";\n RenderStage[RenderStage[\"Abandoned\"] = 7] = \"Abandoned\";\n return RenderStage;\n}({});\nclass StagedRenderingController {\n constructor(abortSignal, abandonController, shouldTrackSyncIO){\n this.abortSignal = abortSignal;\n this.abandonController = abandonController;\n this.shouldTrackSyncIO = shouldTrackSyncIO;\n this.currentStage = 1;\n this.syncInterruptReason = null;\n this.staticStageEndTime = Infinity;\n this.runtimeStageEndTime = Infinity;\n this.staticStageListeners = [];\n this.earlyRuntimeStageListeners = [];\n this.runtimeStageListeners = [];\n this.dynamicStageListeners = [];\n this.staticStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();\n this.earlyRuntimeStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();\n this.runtimeStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();\n this.dynamicStagePromise = (0, _promisewithresolvers.createPromiseWithResolvers)();\n if (abortSignal) {\n abortSignal.addEventListener('abort', ()=>{\n // Reject all stage promises that haven't already been resolved.\n // If a promise was already resolved via advanceStage, the reject\n // is a no-op. The ignoreReject handler suppresses unhandled\n // rejection warnings for promises that no one is awaiting.\n const { reason } = abortSignal;\n this.staticStagePromise.promise.catch(ignoreReject);\n this.staticStagePromise.reject(reason);\n this.earlyRuntimeStagePromise.promise.catch(ignoreReject);\n this.earlyRuntimeStagePromise.reject(reason);\n this.runtimeStagePromise.promise.catch(ignoreReject);\n this.runtimeStagePromise.reject(reason);\n this.dynamicStagePromise.promise.catch(ignoreReject);\n this.dynamicStagePromise.reject(reason);\n }, {\n once: true\n });\n }\n if (abandonController) {\n abandonController.signal.addEventListener('abort', ()=>{\n this.abandonRender();\n }, {\n once: true\n });\n }\n }\n onStage(stage, callback) {\n if (this.currentStage >= stage) {\n callback();\n } else if (stage === 3) {\n this.staticStageListeners.push(callback);\n } else if (stage === 4) {\n this.earlyRuntimeStageListeners.push(callback);\n } else if (stage === 5) {\n this.runtimeStageListeners.push(callback);\n } else if (stage === 6) {\n this.dynamicStageListeners.push(callback);\n } else {\n // This should never happen\n throw Object.defineProperty(new _invarianterror.InvariantError(`Invalid render stage: ${stage}`), \"__NEXT_ERROR_CODE\", {\n value: \"E881\",\n enumerable: false,\n configurable: true\n });\n }\n }\n shouldTrackSyncInterrupt() {\n if (!this.shouldTrackSyncIO) {\n return false;\n }\n switch(this.currentStage){\n case 1:\n // If we haven't started the render yet, it can't be interrupted.\n return false;\n case 2:\n case 3:\n return true;\n case 4:\n // EarlyRuntime is for runtime-prefetchable segments. Sync IO\n // should error because it would abort a runtime prefetch.\n return true;\n case 5:\n // Runtime is for non-prefetchable segments. Sync IO is fine there\n // because in practice this segment will never be runtime prefetched\n return false;\n case 6:\n case 7:\n return false;\n default:\n return false;\n }\n }\n syncInterruptCurrentStageWithReason(reason) {\n if (this.currentStage === 1) {\n return;\n }\n // If the render has already been abandoned, there's nothing to interrupt.\n if (this.currentStage === 7) {\n return;\n }\n // If Sync IO occurs during an abandonable render, we trigger the abandon.\n // The abandon listener will call abandonRender which advances through\n // stages to let caches fill before marking as Abandoned.\n if (this.abandonController) {\n this.abandonController.abort();\n return;\n }\n if (this.abortSignal) {\n // If this is an abortable render, we capture the interruption reason and stop advancing.\n // We don't release any more promises.\n // The caller is expected to abort the signal.\n this.syncInterruptReason = reason;\n this.currentStage = 7;\n return;\n }\n // If we're in a non-abandonable & non-abortable render,\n // we need to advance to the Dynamic stage and capture the interruption reason.\n // (in dev, this will be the restarted render)\n switch(this.currentStage){\n case 2:\n case 3:\n case 4:\n {\n // EarlyRuntime is for runtime-prefetchable segments. Sync IO here\n // means the prefetch would be aborted too early.\n this.syncInterruptReason = reason;\n this.advanceStage(6);\n return;\n }\n case 5:\n {\n // canSyncInterrupt returns false for Runtime, so we should\n // never get here. Defensive no-op.\n return;\n }\n case 6:\n default:\n }\n }\n getSyncInterruptReason() {\n return this.syncInterruptReason;\n }\n getStaticStageEndTime() {\n return this.staticStageEndTime;\n }\n getRuntimeStageEndTime() {\n return this.runtimeStageEndTime;\n }\n abandonRender() {\n // In staged rendering, only the initial render is abandonable.\n // We can abandon the initial render if\n // 1. We notice a cache miss, and need to wait for caches to fill\n // 2. A sync IO error occurs, and the render should be interrupted\n // (this might be a lazy intitialization of a module,\n // so we still want to restart in this case and see if it still occurs)\n // In either case, we'll be doing another render after this one,\n // so we only want to unblock the next stage, not Dynamic, because\n // unblocking the dynamic stage would likely lead to wasted (uncached) IO.\n const { currentStage } = this;\n switch(currentStage){\n case 2:\n {\n this.resolveStaticStage();\n }\n // intentional fallthrough\n case 3:\n {\n this.resolveEarlyRuntimeStage();\n }\n // intentional fallthrough\n case 4:\n {\n this.resolveRuntimeStage();\n }\n // intentional fallthrough\n case 5:\n {\n this.currentStage = 7;\n return;\n }\n case 6:\n case 1:\n case 7:\n break;\n default:\n {\n currentStage;\n }\n }\n }\n advanceStage(stage) {\n // If we're already at the target stage or beyond, do nothing.\n // (this can happen e.g. if sync IO advanced us to the dynamic stage)\n if (stage <= this.currentStage) {\n return;\n }\n let currentStage = this.currentStage;\n this.currentStage = stage;\n if (currentStage < 3 && stage >= 3) {\n this.resolveStaticStage();\n }\n if (currentStage < 4 && stage >= 4) {\n this.resolveEarlyRuntimeStage();\n }\n if (currentStage < 5 && stage >= 5) {\n this.staticStageEndTime = performance.now() + performance.timeOrigin;\n this.resolveRuntimeStage();\n }\n if (currentStage < 6 && stage >= 6) {\n this.runtimeStageEndTime = performance.now() + performance.timeOrigin;\n this.resolveDynamicStage();\n return;\n }\n }\n /** Fire the `onStage` listeners for the static stage and unblock any promises waiting for it. */ resolveStaticStage() {\n const staticListeners = this.staticStageListeners;\n for(let i = 0; i < staticListeners.length; i++){\n staticListeners[i]();\n }\n staticListeners.length = 0;\n this.staticStagePromise.resolve();\n }\n /** Fire the `onStage` listeners for the early runtime stage and unblock any promises waiting for it. */ resolveEarlyRuntimeStage() {\n const earlyRuntimeListeners = this.earlyRuntimeStageListeners;\n for(let i = 0; i < earlyRuntimeListeners.length; i++){\n earlyRuntimeListeners[i]();\n }\n earlyRuntimeListeners.length = 0;\n this.earlyRuntimeStagePromise.resolve();\n }\n /** Fire the `onStage` listeners for the runtime stage and unblock any promises waiting for it. */ resolveRuntimeStage() {\n const runtimeListeners = this.runtimeStageListeners;\n for(let i = 0; i < runtimeListeners.length; i++){\n runtimeListeners[i]();\n }\n runtimeListeners.length = 0;\n this.runtimeStagePromise.resolve();\n }\n /** Fire the `onStage` listeners for the dynamic stage and unblock any promises waiting for it. */ resolveDynamicStage() {\n const dynamicListeners = this.dynamicStageListeners;\n for(let i = 0; i < dynamicListeners.length; i++){\n dynamicListeners[i]();\n }\n dynamicListeners.length = 0;\n this.dynamicStagePromise.resolve();\n }\n getStagePromise(stage) {\n switch(stage){\n case 3:\n {\n return this.staticStagePromise.promise;\n }\n case 4:\n {\n return this.earlyRuntimeStagePromise.promise;\n }\n case 5:\n {\n return this.runtimeStagePromise.promise;\n }\n case 6:\n {\n return this.dynamicStagePromise.promise;\n }\n default:\n {\n stage;\n throw Object.defineProperty(new _invarianterror.InvariantError(`Invalid render stage: ${stage}`), \"__NEXT_ERROR_CODE\", {\n value: \"E881\",\n enumerable: false,\n configurable: true\n });\n }\n }\n }\n waitForStage(stage) {\n return this.getStagePromise(stage);\n }\n delayUntilStage(stage, displayName, resolvedValue) {\n const ioTriggerPromise = this.getStagePromise(stage);\n const promise = makeDevtoolsIOPromiseFromIOTrigger(ioTriggerPromise, displayName, resolvedValue);\n // Analogously to `makeHangingPromise`, we might reject this promise if the signal is invoked.\n // (e.g. in the case where we don't want want the render to proceed to the dynamic stage and abort it).\n // We shouldn't consider this an unhandled rejection, so we attach a noop catch handler here to suppress this warning.\n if (this.abortSignal) {\n promise.catch(ignoreReject);\n }\n return promise;\n }\n}\nfunction ignoreReject() {}\n// TODO(restart-on-cache-miss): the layering of `delayUntilStage`,\n// `makeDevtoolsIOPromiseFromIOTrigger` and and `makeDevtoolsIOAwarePromise`\n// is confusing, we should clean it up.\nfunction makeDevtoolsIOPromiseFromIOTrigger(ioTrigger, displayName, resolvedValue) {\n // If we create a `new Promise` and give it a displayName\n // (with no userspace code above us in the stack)\n // React Devtools will use it as the IO cause when determining \"suspended by\".\n // In particular, it should shadow any inner IO that resolved/rejected the promise\n // (in case of staged rendering, this will be the `setTimeout` that triggers the relevant stage)\n const promise = new Promise((resolve, reject)=>{\n ioTrigger.then(resolve.bind(null, resolvedValue), reject);\n });\n if (displayName !== undefined) {\n // @ts-expect-error\n promise.displayName = displayName;\n }\n return promise;\n}\n\n//# sourceMappingURL=staged-rendering.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n getCacheSignal: null,\n getDraftModeProviderForCacheScope: null,\n getHmrRefreshHash: null,\n getPrerenderResumeDataCache: null,\n getRenderResumeDataCache: null,\n getServerComponentsHmrCache: null,\n getStagedRenderingController: null,\n isHmrRefresh: null,\n isInEarlyRenderStage: null,\n throwForMissingRequestStore: null,\n throwInvariantForMissingStore: null,\n workUnitAsyncStorage: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n getCacheSignal: function() {\n return getCacheSignal;\n },\n getDraftModeProviderForCacheScope: function() {\n return getDraftModeProviderForCacheScope;\n },\n getHmrRefreshHash: function() {\n return getHmrRefreshHash;\n },\n getPrerenderResumeDataCache: function() {\n return getPrerenderResumeDataCache;\n },\n getRenderResumeDataCache: function() {\n return getRenderResumeDataCache;\n },\n getServerComponentsHmrCache: function() {\n return getServerComponentsHmrCache;\n },\n getStagedRenderingController: function() {\n return getStagedRenderingController;\n },\n isHmrRefresh: function() {\n return isHmrRefresh;\n },\n isInEarlyRenderStage: function() {\n return isInEarlyRenderStage;\n },\n throwForMissingRequestStore: function() {\n return throwForMissingRequestStore;\n },\n throwInvariantForMissingStore: function() {\n return throwInvariantForMissingStore;\n },\n workUnitAsyncStorage: function() {\n return _workunitasyncstorageinstance.workUnitAsyncStorageInstance;\n }\n});\nconst _workunitasyncstorageinstance = require(\"./work-unit-async-storage-instance\");\nconst _approuterheaders = require(\"../../client/components/app-router-headers\");\nconst _invarianterror = require(\"../../shared/lib/invariant-error\");\nconst _stagedrendering = require(\"./staged-rendering\");\nfunction isInEarlyRenderStage(requestStore) {\n const stagedRendering = requestStore.stagedRendering;\n if (stagedRendering) {\n return stagedRendering.currentStage === _stagedrendering.RenderStage.EarlyStatic || stagedRendering.currentStage === _stagedrendering.RenderStage.EarlyRuntime;\n }\n return false;\n}\nfunction throwForMissingRequestStore(callingExpression) {\n throw Object.defineProperty(new Error(`\\`${callingExpression}\\` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), \"__NEXT_ERROR_CODE\", {\n value: \"E251\",\n enumerable: false,\n configurable: true\n });\n}\nfunction throwInvariantForMissingStore() {\n throw Object.defineProperty(new _invarianterror.InvariantError('Expected workUnitAsyncStorage to have a store.'), \"__NEXT_ERROR_CODE\", {\n value: \"E696\",\n enumerable: false,\n configurable: true\n });\n}\nfunction getPrerenderResumeDataCache(workUnitStore) {\n switch(workUnitStore.type){\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-ppr':\n return workUnitStore.prerenderResumeDataCache;\n case 'prerender-client':\n case 'validation-client':\n // TODO eliminate fetch caching in client scope and stop exposing this data\n // cache during SSR.\n return workUnitStore.prerenderResumeDataCache;\n case 'request':\n {\n // In dev, we might fill caches even during a dynamic request.\n if (workUnitStore.prerenderResumeDataCache) {\n return workUnitStore.prerenderResumeDataCache;\n }\n // fallthrough\n }\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'generate-static-params':\n return null;\n default:\n return workUnitStore;\n }\n}\nfunction getRenderResumeDataCache(workUnitStore) {\n switch(workUnitStore.type){\n case 'request':\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-client':\n case 'validation-client':\n if (workUnitStore.renderResumeDataCache) {\n // If we are in a prerender, we might have a render resume data cache\n // that is used to read from prefilled caches.\n return workUnitStore.renderResumeDataCache;\n }\n // fallthrough\n case 'prerender-ppr':\n // Otherwise we return the mutable resume data cache here as an immutable\n // version of the cache as it can also be used for reading.\n return workUnitStore.prerenderResumeDataCache ?? null;\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'prerender-legacy':\n case 'generate-static-params':\n return null;\n default:\n return workUnitStore;\n }\n}\nfunction getHmrRefreshHash(workUnitStore) {\n if (process.env.__NEXT_DEV_SERVER) {\n switch(workUnitStore.type){\n case 'cache':\n case 'private-cache':\n case 'prerender':\n case 'prerender-runtime':\n return workUnitStore.hmrRefreshHash;\n case 'request':\n var _workUnitStore_cookies_get;\n return (_workUnitStore_cookies_get = workUnitStore.cookies.get(_approuterheaders.NEXT_HMR_REFRESH_HASH_COOKIE)) == null ? void 0 : _workUnitStore_cookies_get.value;\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'unstable-cache':\n case 'generate-static-params':\n break;\n default:\n workUnitStore;\n }\n }\n return undefined;\n}\nfunction isHmrRefresh(workUnitStore) {\n if (process.env.__NEXT_DEV_SERVER) {\n switch(workUnitStore.type){\n case 'cache':\n case 'private-cache':\n case 'request':\n return workUnitStore.isHmrRefresh ?? false;\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'unstable-cache':\n case 'generate-static-params':\n break;\n default:\n workUnitStore;\n }\n }\n return false;\n}\nfunction getServerComponentsHmrCache(workUnitStore) {\n if (process.env.__NEXT_DEV_SERVER) {\n switch(workUnitStore.type){\n case 'cache':\n case 'private-cache':\n case 'request':\n return workUnitStore.serverComponentsHmrCache;\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'unstable-cache':\n case 'generate-static-params':\n break;\n default:\n workUnitStore;\n }\n }\n return undefined;\n}\nfunction getDraftModeProviderForCacheScope(workStore, workUnitStore) {\n if (workStore.isDraftMode) {\n switch(workUnitStore.type){\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'prerender-runtime':\n case 'request':\n return workUnitStore.draftMode;\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'generate-static-params':\n break;\n default:\n workUnitStore;\n }\n }\n return undefined;\n}\nfunction getStagedRenderingController(workUnitStore) {\n switch(workUnitStore.type){\n case 'request':\n case 'prerender-runtime':\n return workUnitStore.stagedRendering ?? null;\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'generate-static-params':\n return null;\n default:\n return workUnitStore;\n }\n}\nfunction getCacheSignal(workUnitStore) {\n switch(workUnitStore.type){\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-runtime':\n return workUnitStore.cacheSignal;\n case 'request':\n {\n // In dev, we might fill caches even during a dynamic request.\n if (workUnitStore.cacheSignal) {\n return workUnitStore.cacheSignal;\n }\n // fallthrough\n }\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'generate-static-params':\n return null;\n default:\n return workUnitStore;\n }\n}\n\n//# sourceMappingURL=work-unit-async-storage.external.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n DynamicServerError: null,\n isDynamicServerError: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n DynamicServerError: function() {\n return DynamicServerError;\n },\n isDynamicServerError: function() {\n return isDynamicServerError;\n }\n});\nconst DYNAMIC_ERROR_CODE = 'DYNAMIC_SERVER_USAGE';\nclass DynamicServerError extends Error {\n constructor(description){\n super(`Dynamic server usage: ${description}`), this.description = description, this.digest = DYNAMIC_ERROR_CODE;\n }\n}\nfunction isDynamicServerError(err) {\n if (typeof err !== 'object' || err === null || !('digest' in err) || typeof err.digest !== 'string') {\n return false;\n }\n return err.digest === DYNAMIC_ERROR_CODE;\n}\n\nif ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {\n Object.defineProperty(exports.default, '__esModule', { value: true });\n Object.assign(exports.default, exports);\n module.exports = exports.default;\n}\n\n//# sourceMappingURL=hooks-server-context.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n StaticGenBailoutError: null,\n isStaticGenBailoutError: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n StaticGenBailoutError: function() {\n return StaticGenBailoutError;\n },\n isStaticGenBailoutError: function() {\n return isStaticGenBailoutError;\n }\n});\nconst NEXT_STATIC_GEN_BAILOUT = 'NEXT_STATIC_GEN_BAILOUT';\nclass StaticGenBailoutError extends Error {\n constructor(...args){\n super(...args), this.code = NEXT_STATIC_GEN_BAILOUT;\n }\n}\nfunction isStaticGenBailoutError(error) {\n if (typeof error !== 'object' || error === null || !('code' in error)) {\n return false;\n }\n return error.code === NEXT_STATIC_GEN_BAILOUT;\n}\n\nif ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {\n Object.defineProperty(exports.default, '__esModule', { value: true });\n Object.assign(exports.default, exports);\n module.exports = exports.default;\n}\n\n//# sourceMappingURL=static-generation-bailout.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n delayUntilRuntimeStage: null,\n getRuntimeStage: null,\n isHangingPromiseRejectionError: null,\n makeDevtoolsIOAwarePromise: null,\n makeHangingPromise: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n delayUntilRuntimeStage: function() {\n return delayUntilRuntimeStage;\n },\n getRuntimeStage: function() {\n return getRuntimeStage;\n },\n isHangingPromiseRejectionError: function() {\n return isHangingPromiseRejectionError;\n },\n makeDevtoolsIOAwarePromise: function() {\n return makeDevtoolsIOAwarePromise;\n },\n makeHangingPromise: function() {\n return makeHangingPromise;\n }\n});\nconst _stagedrendering = require(\"./app-render/staged-rendering\");\nfunction isHangingPromiseRejectionError(err) {\n if (typeof err !== 'object' || err === null || !('digest' in err)) {\n return false;\n }\n return err.digest === HANGING_PROMISE_REJECTION;\n}\nconst HANGING_PROMISE_REJECTION = 'HANGING_PROMISE_REJECTION';\nclass HangingPromiseRejectionError extends Error {\n constructor(route, expression){\n super(`During prerendering, ${expression} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${expression} to a different context by using \\`setTimeout\\`, \\`after\\`, or similar functions you may observe this error and you should handle it in that context. This occurred at route \"${route}\".`), this.route = route, this.expression = expression, this.digest = HANGING_PROMISE_REJECTION;\n }\n}\nconst abortListenersBySignal = new WeakMap();\nfunction makeHangingPromise(signal, route, expression) {\n if (signal.aborted) {\n return Promise.reject(new HangingPromiseRejectionError(route, expression));\n } else {\n const hangingPromise = new Promise((_, reject)=>{\n const boundRejection = reject.bind(null, new HangingPromiseRejectionError(route, expression));\n let currentListeners = abortListenersBySignal.get(signal);\n if (currentListeners) {\n currentListeners.push(boundRejection);\n } else {\n const listeners = [\n boundRejection\n ];\n abortListenersBySignal.set(signal, listeners);\n signal.addEventListener('abort', ()=>{\n for(let i = 0; i < listeners.length; i++){\n listeners[i]();\n }\n }, {\n once: true\n });\n }\n });\n // We are fine if no one actually awaits this promise. We shouldn't consider this an unhandled rejection so\n // we attach a noop catch handler here to suppress this warning. If you actually await somewhere or construct\n // your own promise out of it you'll need to ensure you handle the error when it rejects.\n hangingPromise.catch(ignoreReject);\n return hangingPromise;\n }\n}\nfunction ignoreReject() {}\nfunction makeDevtoolsIOAwarePromise(underlying, requestStore, stage) {\n if (requestStore.stagedRendering) {\n // We resolve each stage in a timeout, so React DevTools will pick this up as IO.\n return requestStore.stagedRendering.delayUntilStage(stage, undefined, underlying);\n }\n // in React DevTools if we resolve in a setTimeout we will observe\n // the promise resolution as something that can suspend a boundary or root.\n return new Promise((resolve)=>{\n // Must use setTimeout to be considered IO React DevTools. setImmediate will not work.\n setTimeout(()=>{\n resolve(underlying);\n }, 0);\n });\n}\nfunction getRuntimeStage(stagedRendering) {\n if (stagedRendering.currentStage === _stagedrendering.RenderStage.EarlyStatic || stagedRendering.currentStage === _stagedrendering.RenderStage.EarlyRuntime) {\n return _stagedrendering.RenderStage.EarlyRuntime;\n }\n return _stagedrendering.RenderStage.Runtime;\n}\nfunction delayUntilRuntimeStage(prerenderStore, result) {\n const { stagedRendering } = prerenderStore;\n if (!stagedRendering) {\n return result;\n }\n return stagedRendering.waitForStage(getRuntimeStage(stagedRendering)).then(()=>result);\n}\n\n//# sourceMappingURL=dynamic-rendering-utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n METADATA_BOUNDARY_NAME: null,\n OUTLET_BOUNDARY_NAME: null,\n ROOT_LAYOUT_BOUNDARY_NAME: null,\n VIEWPORT_BOUNDARY_NAME: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n METADATA_BOUNDARY_NAME: function() {\n return METADATA_BOUNDARY_NAME;\n },\n OUTLET_BOUNDARY_NAME: function() {\n return OUTLET_BOUNDARY_NAME;\n },\n ROOT_LAYOUT_BOUNDARY_NAME: function() {\n return ROOT_LAYOUT_BOUNDARY_NAME;\n },\n VIEWPORT_BOUNDARY_NAME: function() {\n return VIEWPORT_BOUNDARY_NAME;\n }\n});\nconst METADATA_BOUNDARY_NAME = '__next_metadata_boundary__';\nconst VIEWPORT_BOUNDARY_NAME = '__next_viewport_boundary__';\nconst OUTLET_BOUNDARY_NAME = '__next_outlet_boundary__';\nconst ROOT_LAYOUT_BOUNDARY_NAME = '__next_root_layout_boundary__';\n\n//# sourceMappingURL=boundary-constants.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n atLeastOneTask: null,\n scheduleImmediate: null,\n scheduleOnNextTick: null,\n waitAtLeastOneReactRenderTask: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n atLeastOneTask: function() {\n return atLeastOneTask;\n },\n scheduleImmediate: function() {\n return scheduleImmediate;\n },\n scheduleOnNextTick: function() {\n return scheduleOnNextTick;\n },\n waitAtLeastOneReactRenderTask: function() {\n return waitAtLeastOneReactRenderTask;\n }\n});\nconst scheduleOnNextTick = (cb)=>{\n // We use Promise.resolve().then() here so that the operation is scheduled at\n // the end of the promise job queue, we then add it to the next process tick\n // to ensure it's evaluated afterwards.\n //\n // This was inspired by the implementation of the DataLoader interface: https://github.com/graphql/dataloader/blob/d336bd15282664e0be4b4a657cb796f09bafbc6b/src/index.js#L213-L255\n //\n Promise.resolve().then(()=>{\n if (process.env.NEXT_RUNTIME === 'edge') {\n setTimeout(cb, 0);\n } else {\n process.nextTick(cb);\n }\n });\n};\nconst scheduleImmediate = (cb)=>{\n if (process.env.NEXT_RUNTIME === 'edge') {\n setTimeout(cb, 0);\n } else {\n setImmediate(cb);\n }\n};\nfunction atLeastOneTask() {\n return new Promise((resolve)=>scheduleImmediate(resolve));\n}\nfunction waitAtLeastOneReactRenderTask() {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return new Promise((r)=>setTimeout(r, 0));\n } else {\n return new Promise((r)=>setImmediate(r));\n }\n}\n\n//# sourceMappingURL=scheduler.js.map","// This has to be a shared module which is shared between client component error boundary and dynamic component\n\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n BailoutToCSRError: null,\n isBailoutToCSRError: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n BailoutToCSRError: function() {\n return BailoutToCSRError;\n },\n isBailoutToCSRError: function() {\n return isBailoutToCSRError;\n }\n});\nconst BAILOUT_TO_CSR = 'BAILOUT_TO_CLIENT_SIDE_RENDERING';\nclass BailoutToCSRError extends Error {\n constructor(reason){\n super(`Bail out to client-side rendering: ${reason}`), this.reason = reason, this.digest = BAILOUT_TO_CSR;\n }\n}\nfunction isBailoutToCSRError(err) {\n if (typeof err !== 'object' || err === null || !('digest' in err)) {\n return false;\n }\n return err.digest === BAILOUT_TO_CSR;\n}\n\n//# sourceMappingURL=bailout-to-csr.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"INSTANT_VALIDATION_BOUNDARY_NAME\", {\n enumerable: true,\n get: function() {\n return INSTANT_VALIDATION_BOUNDARY_NAME;\n }\n});\nconst INSTANT_VALIDATION_BOUNDARY_NAME = '__next_instant_validation_boundary__';\n\n//# sourceMappingURL=boundary-constants.js.map","/**\n * The functions provided by this module are used to communicate certain properties\n * about the currently running code so that Next.js can make decisions on how to handle\n * the current execution in different rendering modes such as pre-rendering, resuming, and SSR.\n *\n * Today Next.js treats all code as potentially static. Certain APIs may only make sense when dynamically rendering.\n * Traditionally this meant deopting the entire render to dynamic however with PPR we can now deopt parts\n * of a React tree as dynamic while still keeping other parts static. There are really two different kinds of\n * Dynamic indications.\n *\n * The first is simply an intention to be dynamic. unstable_noStore is an example of this where\n * the currently executing code simply declares that the current scope is dynamic but if you use it\n * inside unstable_cache it can still be cached. This type of indication can be removed if we ever\n * make the default dynamic to begin with because the only way you would ever be static is inside\n * a cache scope which this indication does not affect.\n *\n * The second is an indication that a dynamic data source was read. This is a stronger form of dynamic\n * because it means that it is inappropriate to cache this at all. using a dynamic data source inside\n * unstable_cache should error. If you want to use some dynamic data inside unstable_cache you should\n * read that data outside the cache and pass it in as an argument to the cached function.\n */ \"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n DynamicHoleKind: null,\n Postpone: null,\n PreludeState: null,\n abortAndThrowOnSynchronousRequestDataAccess: null,\n abortOnSynchronousPlatformIOAccess: null,\n accessedDynamicData: null,\n annotateDynamicAccess: null,\n consumeDynamicAccess: null,\n createDynamicTrackingState: null,\n createDynamicValidationState: null,\n createHangingInputAbortSignal: null,\n createInstantValidationState: null,\n createRenderInBrowserAbortSignal: null,\n formatDynamicAPIAccesses: null,\n getFirstDynamicReason: null,\n getNavigationDisallowedDynamicReasons: null,\n getStaticShellDisallowedDynamicReasons: null,\n isDynamicPostpone: null,\n isPrerenderInterruptedError: null,\n logDisallowedDynamicError: null,\n markCurrentScopeAsDynamic: null,\n postponeWithTracking: null,\n throwIfDisallowedDynamic: null,\n throwToInterruptStaticGeneration: null,\n trackAllowedDynamicAccess: null,\n trackDynamicDataInDynamicRender: null,\n trackDynamicHoleInNavigation: null,\n trackDynamicHoleInRuntimeShell: null,\n trackDynamicHoleInStaticShell: null,\n trackThrownErrorInNavigation: null,\n useDynamicRouteParams: null,\n useDynamicSearchParams: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n DynamicHoleKind: function() {\n return DynamicHoleKind;\n },\n Postpone: function() {\n return Postpone;\n },\n PreludeState: function() {\n return PreludeState;\n },\n abortAndThrowOnSynchronousRequestDataAccess: function() {\n return abortAndThrowOnSynchronousRequestDataAccess;\n },\n abortOnSynchronousPlatformIOAccess: function() {\n return abortOnSynchronousPlatformIOAccess;\n },\n accessedDynamicData: function() {\n return accessedDynamicData;\n },\n annotateDynamicAccess: function() {\n return annotateDynamicAccess;\n },\n consumeDynamicAccess: function() {\n return consumeDynamicAccess;\n },\n createDynamicTrackingState: function() {\n return createDynamicTrackingState;\n },\n createDynamicValidationState: function() {\n return createDynamicValidationState;\n },\n createHangingInputAbortSignal: function() {\n return createHangingInputAbortSignal;\n },\n createInstantValidationState: function() {\n return createInstantValidationState;\n },\n createRenderInBrowserAbortSignal: function() {\n return createRenderInBrowserAbortSignal;\n },\n formatDynamicAPIAccesses: function() {\n return formatDynamicAPIAccesses;\n },\n getFirstDynamicReason: function() {\n return getFirstDynamicReason;\n },\n getNavigationDisallowedDynamicReasons: function() {\n return getNavigationDisallowedDynamicReasons;\n },\n getStaticShellDisallowedDynamicReasons: function() {\n return getStaticShellDisallowedDynamicReasons;\n },\n isDynamicPostpone: function() {\n return isDynamicPostpone;\n },\n isPrerenderInterruptedError: function() {\n return isPrerenderInterruptedError;\n },\n logDisallowedDynamicError: function() {\n return logDisallowedDynamicError;\n },\n markCurrentScopeAsDynamic: function() {\n return markCurrentScopeAsDynamic;\n },\n postponeWithTracking: function() {\n return postponeWithTracking;\n },\n throwIfDisallowedDynamic: function() {\n return throwIfDisallowedDynamic;\n },\n throwToInterruptStaticGeneration: function() {\n return throwToInterruptStaticGeneration;\n },\n trackAllowedDynamicAccess: function() {\n return trackAllowedDynamicAccess;\n },\n trackDynamicDataInDynamicRender: function() {\n return trackDynamicDataInDynamicRender;\n },\n trackDynamicHoleInNavigation: function() {\n return trackDynamicHoleInNavigation;\n },\n trackDynamicHoleInRuntimeShell: function() {\n return trackDynamicHoleInRuntimeShell;\n },\n trackDynamicHoleInStaticShell: function() {\n return trackDynamicHoleInStaticShell;\n },\n trackThrownErrorInNavigation: function() {\n return trackThrownErrorInNavigation;\n },\n useDynamicRouteParams: function() {\n return useDynamicRouteParams;\n },\n useDynamicSearchParams: function() {\n return useDynamicSearchParams;\n }\n});\nconst _react = /*#__PURE__*/ _interop_require_default(require(\"react\"));\nconst _hooksservercontext = require(\"../../client/components/hooks-server-context\");\nconst _staticgenerationbailout = require(\"../../client/components/static-generation-bailout\");\nconst _workunitasyncstorageexternal = require(\"./work-unit-async-storage.external\");\nconst _workasyncstorageexternal = require(\"../app-render/work-async-storage.external\");\nconst _dynamicrenderingutils = require(\"../dynamic-rendering-utils\");\nconst _boundaryconstants = require(\"../../lib/framework/boundary-constants\");\nconst _scheduler = require(\"../../lib/scheduler\");\nconst _bailouttocsr = require(\"../../shared/lib/lazy-dynamic/bailout-to-csr\");\nconst _invarianterror = require(\"../../shared/lib/invariant-error\");\nconst _boundaryconstants1 = require(\"./instant-validation/boundary-constants\");\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\nconst hasPostpone = typeof _react.default.unstable_postpone === 'function';\nfunction createDynamicTrackingState(isDebugDynamicAccesses) {\n return {\n isDebugDynamicAccesses,\n dynamicAccesses: [],\n syncDynamicErrorWithStack: null\n };\n}\nfunction createDynamicValidationState() {\n return {\n hasSuspenseAboveBody: false,\n hasDynamicMetadata: false,\n dynamicMetadata: null,\n hasDynamicViewport: false,\n hasAllowedDynamic: false,\n dynamicErrors: []\n };\n}\nfunction getFirstDynamicReason(trackingState) {\n var _trackingState_dynamicAccesses_;\n return (_trackingState_dynamicAccesses_ = trackingState.dynamicAccesses[0]) == null ? void 0 : _trackingState_dynamicAccesses_.expression;\n}\nfunction markCurrentScopeAsDynamic(store, workUnitStore, expression) {\n if (workUnitStore) {\n switch(workUnitStore.type){\n case 'cache':\n case 'unstable-cache':\n // Inside cache scopes, marking a scope as dynamic has no effect,\n // because the outer cache scope creates a cache boundary. This is\n // subtly different from reading a dynamic data source, which is\n // forbidden inside a cache scope.\n return;\n case 'private-cache':\n // A private cache scope is already dynamic by definition.\n return;\n case 'prerender-legacy':\n case 'prerender-ppr':\n case 'request':\n case 'generate-static-params':\n break;\n default:\n workUnitStore;\n }\n }\n // If we're forcing dynamic rendering or we're forcing static rendering, we\n // don't need to do anything here because the entire page is already dynamic\n // or it's static and it should not throw or postpone here.\n if (store.forceDynamic || store.forceStatic) return;\n if (store.dynamicShouldError) {\n throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${store.route} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), \"__NEXT_ERROR_CODE\", {\n value: \"E553\",\n enumerable: false,\n configurable: true\n });\n }\n if (workUnitStore) {\n switch(workUnitStore.type){\n case 'prerender-ppr':\n return postponeWithTracking(store.route, expression, workUnitStore.dynamicTracking);\n case 'prerender-legacy':\n workUnitStore.revalidate = 0;\n // We aren't prerendering, but we are generating a static page. We need\n // to bail out of static generation.\n const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), \"__NEXT_ERROR_CODE\", {\n value: \"E550\",\n enumerable: false,\n configurable: true\n });\n store.dynamicUsageDescription = expression;\n store.dynamicUsageStack = err.stack;\n throw err;\n case 'request':\n if (process.env.NODE_ENV !== 'production') {\n workUnitStore.usedDynamic = true;\n }\n break;\n case 'generate-static-params':\n break;\n default:\n workUnitStore;\n }\n }\n}\nfunction throwToInterruptStaticGeneration(expression, store, prerenderStore) {\n // We aren't prerendering but we are generating a static page. We need to bail out of static generation\n const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), \"__NEXT_ERROR_CODE\", {\n value: \"E558\",\n enumerable: false,\n configurable: true\n });\n prerenderStore.revalidate = 0;\n store.dynamicUsageDescription = expression;\n store.dynamicUsageStack = err.stack;\n throw err;\n}\nfunction trackDynamicDataInDynamicRender(workUnitStore) {\n switch(workUnitStore.type){\n case 'cache':\n case 'unstable-cache':\n // Inside cache scopes, marking a scope as dynamic has no effect,\n // because the outer cache scope creates a cache boundary. This is\n // subtly different from reading a dynamic data source, which is\n // forbidden inside a cache scope.\n return;\n case 'private-cache':\n // A private cache scope is already dynamic by definition.\n return;\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-legacy':\n case 'prerender-ppr':\n case 'prerender-client':\n case 'validation-client':\n case 'generate-static-params':\n break;\n case 'request':\n if (process.env.NODE_ENV !== 'production') {\n workUnitStore.usedDynamic = true;\n }\n break;\n default:\n workUnitStore;\n }\n}\nfunction abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore) {\n const reason = `Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`;\n const error = createPrerenderInterruptedError(reason);\n prerenderStore.controller.abort(error);\n const dynamicTracking = prerenderStore.dynamicTracking;\n if (dynamicTracking) {\n dynamicTracking.dynamicAccesses.push({\n // When we aren't debugging, we don't need to create another error for the\n // stack trace.\n stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : undefined,\n expression\n });\n }\n}\nfunction abortOnSynchronousPlatformIOAccess(route, expression, errorWithStack, prerenderStore) {\n const dynamicTracking = prerenderStore.dynamicTracking;\n abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore);\n // It is important that we set this tracking value after aborting. Aborts are executed\n // synchronously except for the case where you abort during render itself. By setting this\n // value late we can use it to determine if any of the aborted tasks are the task that\n // called the sync IO expression in the first place.\n if (dynamicTracking) {\n if (dynamicTracking.syncDynamicErrorWithStack === null) {\n dynamicTracking.syncDynamicErrorWithStack = errorWithStack;\n }\n }\n}\nfunction abortAndThrowOnSynchronousRequestDataAccess(route, expression, errorWithStack, prerenderStore) {\n const prerenderSignal = prerenderStore.controller.signal;\n if (prerenderSignal.aborted === false) {\n // TODO it would be better to move this aborted check into the callsite so we can avoid making\n // the error object when it isn't relevant to the aborting of the prerender however\n // since we need the throw semantics regardless of whether we abort it is easier to land\n // this way. See how this was handled with `abortOnSynchronousPlatformIOAccess` for a closer\n // to ideal implementation\n abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore);\n // It is important that we set this tracking value after aborting. Aborts are executed\n // synchronously except for the case where you abort during render itself. By setting this\n // value late we can use it to determine if any of the aborted tasks are the task that\n // called the sync IO expression in the first place.\n const dynamicTracking = prerenderStore.dynamicTracking;\n if (dynamicTracking) {\n if (dynamicTracking.syncDynamicErrorWithStack === null) {\n dynamicTracking.syncDynamicErrorWithStack = errorWithStack;\n }\n }\n }\n throw createPrerenderInterruptedError(`Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`);\n}\nfunction Postpone({ reason, route }) {\n const prerenderStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();\n const dynamicTracking = prerenderStore && prerenderStore.type === 'prerender-ppr' ? prerenderStore.dynamicTracking : null;\n postponeWithTracking(route, reason, dynamicTracking);\n}\nfunction postponeWithTracking(route, expression, dynamicTracking) {\n assertPostpone();\n if (dynamicTracking) {\n dynamicTracking.dynamicAccesses.push({\n // When we aren't debugging, we don't need to create another error for the\n // stack trace.\n stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : undefined,\n expression\n });\n }\n _react.default.unstable_postpone(createPostponeReason(route, expression));\n}\nfunction createPostponeReason(route, expression) {\n return `Route ${route} needs to bail out of prerendering at this point because it used ${expression}. ` + `React throws this special object to indicate where. It should not be caught by ` + `your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;\n}\nfunction isDynamicPostpone(err) {\n if (typeof err === 'object' && err !== null && typeof err.message === 'string') {\n return isDynamicPostponeReason(err.message);\n }\n return false;\n}\nfunction isDynamicPostponeReason(reason) {\n return reason.includes('needs to bail out of prerendering at this point because it used') && reason.includes('Learn more: https://nextjs.org/docs/messages/ppr-caught-error');\n}\nif (isDynamicPostponeReason(createPostponeReason('%%%', '^^^')) === false) {\n throw Object.defineProperty(new Error('Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js'), \"__NEXT_ERROR_CODE\", {\n value: \"E296\",\n enumerable: false,\n configurable: true\n });\n}\nconst NEXT_PRERENDER_INTERRUPTED = 'NEXT_PRERENDER_INTERRUPTED';\nfunction createPrerenderInterruptedError(message) {\n const error = Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E394\",\n enumerable: false,\n configurable: true\n });\n error.digest = NEXT_PRERENDER_INTERRUPTED;\n return error;\n}\nfunction isPrerenderInterruptedError(error) {\n return typeof error === 'object' && error !== null && error.digest === NEXT_PRERENDER_INTERRUPTED && 'name' in error && 'message' in error && error instanceof Error;\n}\nfunction accessedDynamicData(dynamicAccesses) {\n return dynamicAccesses.length > 0;\n}\nfunction consumeDynamicAccess(serverDynamic, clientDynamic) {\n // We mutate because we only call this once we are no longer writing\n // to the dynamicTrackingState and it's more efficient than creating a new\n // array.\n serverDynamic.dynamicAccesses.push(...clientDynamic.dynamicAccesses);\n return serverDynamic.dynamicAccesses;\n}\nfunction formatDynamicAPIAccesses(dynamicAccesses) {\n return dynamicAccesses.filter((access)=>typeof access.stack === 'string' && access.stack.length > 0).map(({ expression, stack })=>{\n stack = stack.split('\\n')// Remove the \"Error: \" prefix from the first line of the stack trace as\n // well as the first 4 lines of the stack trace which is the distance\n // from the user code and the `new Error().stack` call.\n .slice(4).filter((line)=>{\n // Exclude Next.js internals from the stack trace.\n if (line.includes('node_modules/next/')) {\n return false;\n }\n // Exclude anonymous functions from the stack trace.\n if (line.includes(' (<anonymous>)')) {\n return false;\n }\n // Exclude Node.js internals from the stack trace.\n if (line.includes(' (node:')) {\n return false;\n }\n return true;\n }).join('\\n');\n return `Dynamic API Usage Debug - ${expression}:\\n${stack}`;\n });\n}\nfunction assertPostpone() {\n if (!hasPostpone) {\n throw Object.defineProperty(new Error(`Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js`), \"__NEXT_ERROR_CODE\", {\n value: \"E224\",\n enumerable: false,\n configurable: true\n });\n }\n}\nfunction createRenderInBrowserAbortSignal() {\n const controller = new AbortController();\n controller.abort(Object.defineProperty(new _bailouttocsr.BailoutToCSRError('Render in Browser'), \"__NEXT_ERROR_CODE\", {\n value: \"E721\",\n enumerable: false,\n configurable: true\n }));\n return controller.signal;\n}\nfunction createHangingInputAbortSignal(workUnitStore) {\n switch(workUnitStore.type){\n case 'prerender':\n case 'prerender-runtime':\n const controller = new AbortController();\n if (workUnitStore.cacheSignal) {\n // If we have a cacheSignal it means we're in a prospective render. If\n // the input we're waiting on is coming from another cache, we do want\n // to wait for it so that we can resolve this cache entry too.\n workUnitStore.cacheSignal.inputReady().then(()=>{\n controller.abort();\n });\n } else {\n // Otherwise we're in the final render and we should already have all\n // our caches filled.\n // If the prerender uses stages, we have wait until the runtime stage,\n // at which point all runtime inputs will be resolved.\n // (otherwise, a runtime prerender might consider `cookies()` hanging\n // even though they'd resolve in the next task.)\n //\n // We might still be waiting on some microtasks so we\n // wait one tick before giving up. When we give up, we still want to\n // render the content of this cache as deeply as we can so that we can\n // suspend as deeply as possible in the tree or not at all if we don't\n // end up waiting for the input.\n if (// eslint-disable-next-line no-restricted-syntax -- We are discriminating between two different refined types and don't need an addition exhaustive switch here\n workUnitStore.type === 'prerender-runtime' && workUnitStore.stagedRendering) {\n const { stagedRendering } = workUnitStore;\n stagedRendering.waitForStage((0, _dynamicrenderingutils.getRuntimeStage)(stagedRendering)).then(()=>(0, _scheduler.scheduleOnNextTick)(()=>controller.abort()));\n } else {\n (0, _scheduler.scheduleOnNextTick)(()=>controller.abort());\n }\n }\n return controller.signal;\n case 'prerender-client':\n case 'validation-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case 'generate-static-params':\n return undefined;\n default:\n workUnitStore;\n }\n}\nfunction annotateDynamicAccess(expression, prerenderStore) {\n const dynamicTracking = prerenderStore.dynamicTracking;\n if (dynamicTracking) {\n dynamicTracking.dynamicAccesses.push({\n stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : undefined,\n expression\n });\n }\n}\nfunction useDynamicRouteParams(expression) {\n const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();\n const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();\n if (workStore && workUnitStore) {\n switch(workUnitStore.type){\n case 'prerender-client':\n case 'prerender':\n {\n const fallbackParams = workUnitStore.fallbackRouteParams;\n if (fallbackParams && fallbackParams.size > 0) {\n // We are in a prerender with cacheComponents semantics. We are going to\n // hang here and never resolve. This will cause the currently\n // rendering component to effectively be a dynamic hole.\n _react.default.use((0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, expression));\n }\n break;\n }\n case 'prerender-ppr':\n {\n const fallbackParams = workUnitStore.fallbackRouteParams;\n if (fallbackParams && fallbackParams.size > 0) {\n return postponeWithTracking(workStore.route, expression, workUnitStore.dynamicTracking);\n }\n break;\n }\n case 'validation-client':\n {\n break;\n }\n case 'prerender-runtime':\n throw Object.defineProperty(new _invarianterror.InvariantError(`\\`${expression}\\` was called during a runtime prerender. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E771\",\n enumerable: false,\n configurable: true\n });\n case 'cache':\n case 'private-cache':\n throw Object.defineProperty(new _invarianterror.InvariantError(`\\`${expression}\\` was called inside a cache scope. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E745\",\n enumerable: false,\n configurable: true\n });\n case 'generate-static-params':\n throw Object.defineProperty(new _invarianterror.InvariantError(`\\`${expression}\\` was called in \\`generateStaticParams\\`. Next.js should be preventing ${expression} from being included in server component files statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E1130\",\n enumerable: false,\n configurable: true\n });\n case 'prerender-legacy':\n case 'request':\n case 'unstable-cache':\n break;\n default:\n workUnitStore;\n }\n }\n}\nfunction useDynamicSearchParams(expression) {\n const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();\n const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();\n if (!workStore) {\n // We assume pages router context and just return\n return;\n }\n if (!workUnitStore) {\n (0, _workunitasyncstorageexternal.throwForMissingRequestStore)(expression);\n }\n switch(workUnitStore.type){\n case 'validation-client':\n // During instant validation we try to behave as close to client as possible,\n // so this shouldn't hang during SSR.\n return;\n case 'prerender-client':\n {\n _react.default.use((0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, expression));\n break;\n }\n case 'prerender-legacy':\n case 'prerender-ppr':\n {\n if (workStore.forceStatic) {\n return;\n }\n throw Object.defineProperty(new _bailouttocsr.BailoutToCSRError(expression), \"__NEXT_ERROR_CODE\", {\n value: \"E394\",\n enumerable: false,\n configurable: true\n });\n }\n case 'prerender':\n case 'prerender-runtime':\n throw Object.defineProperty(new _invarianterror.InvariantError(`\\`${expression}\\` was called from a Server Component. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E795\",\n enumerable: false,\n configurable: true\n });\n case 'cache':\n case 'unstable-cache':\n case 'private-cache':\n throw Object.defineProperty(new _invarianterror.InvariantError(`\\`${expression}\\` was called inside a cache scope. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E745\",\n enumerable: false,\n configurable: true\n });\n case 'generate-static-params':\n throw Object.defineProperty(new _invarianterror.InvariantError(`\\`${expression}\\` was called in \\`generateStaticParams\\`. Next.js should be preventing ${expression} from being included in server component files statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E1130\",\n enumerable: false,\n configurable: true\n });\n case 'request':\n return;\n default:\n workUnitStore;\n }\n}\nconst hasSuspenseRegex = /\\n\\s+at Suspense \\(<anonymous>\\)/;\n// Common implicit body tags that React will treat as body when placed directly in html\nconst bodyAndImplicitTags = 'body|div|main|section|article|aside|header|footer|nav|form|p|span|h1|h2|h3|h4|h5|h6';\n// Detects when RootLayoutBoundary (our framework marker component) appears\n// after Suspense in the component stack, indicating the root layout is wrapped\n// within a Suspense boundary. Ensures no body/html/implicit-body components are in between.\n//\n// Example matches:\n// at Suspense (<anonymous>)\n// at __next_root_layout_boundary__ (<anonymous>)\n//\n// Or with other components in between (but not body/html/implicit-body):\n// at Suspense (<anonymous>)\n// at SomeComponent (<anonymous>)\n// at __next_root_layout_boundary__ (<anonymous>)\nconst hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex = new RegExp(`\\\\n\\\\s+at Suspense \\\\(<anonymous>\\\\)(?:(?!\\\\n\\\\s+at (?:${bodyAndImplicitTags}) \\\\(<anonymous>\\\\))[\\\\s\\\\S])*?\\\\n\\\\s+at ${_boundaryconstants.ROOT_LAYOUT_BOUNDARY_NAME} \\\\([^\\\\n]*\\\\)`);\nconst hasMetadataRegex = new RegExp(`\\\\n\\\\s+at ${_boundaryconstants.METADATA_BOUNDARY_NAME}[\\\\n\\\\s]`);\nconst hasViewportRegex = new RegExp(`\\\\n\\\\s+at ${_boundaryconstants.VIEWPORT_BOUNDARY_NAME}[\\\\n\\\\s]`);\nconst hasOutletRegex = new RegExp(`\\\\n\\\\s+at ${_boundaryconstants.OUTLET_BOUNDARY_NAME}[\\\\n\\\\s]`);\nconst hasInstantValidationBoundaryRegex = new RegExp(`\\\\n\\\\s+at ${_boundaryconstants1.INSTANT_VALIDATION_BOUNDARY_NAME}[\\\\n\\\\s]`);\nfunction trackAllowedDynamicAccess(workStore, componentStack, dynamicValidation, clientDynamic) {\n if (hasOutletRegex.test(componentStack)) {\n // We don't need to track that this is dynamic. It is only so when something else is also dynamic.\n return;\n } else if (hasMetadataRegex.test(componentStack)) {\n dynamicValidation.hasDynamicMetadata = true;\n return;\n } else if (hasViewportRegex.test(componentStack)) {\n dynamicValidation.hasDynamicViewport = true;\n return;\n } else if (hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex.test(componentStack)) {\n // For Suspense within body, the prelude wouldn't be empty so it wouldn't violate the empty static shells rule.\n // But if you have Suspense above body, the prelude is empty but we allow that because having Suspense\n // is an explicit signal from the user that they acknowledge the empty shell and want dynamic rendering.\n dynamicValidation.hasAllowedDynamic = true;\n dynamicValidation.hasSuspenseAboveBody = true;\n return;\n } else if (hasSuspenseRegex.test(componentStack)) {\n // this error had a Suspense boundary above it so we don't need to report it as a source\n // of disallowed\n dynamicValidation.hasAllowedDynamic = true;\n return;\n } else if (clientDynamic.syncDynamicErrorWithStack) {\n // This task was the task that called the sync error.\n dynamicValidation.dynamicErrors.push(clientDynamic.syncDynamicErrorWithStack);\n return;\n } else {\n const message = `Route \"${workStore.route}\": Uncached data was accessed outside of ` + '<Suspense>. This delays the entire page from rendering, resulting in a ' + 'slow user experience. Learn more: ' + 'https://nextjs.org/docs/messages/blocking-route';\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1079\",\n enumerable: false,\n configurable: true\n }), componentStack, null);\n dynamicValidation.dynamicErrors.push(error);\n return;\n }\n}\nvar DynamicHoleKind = /*#__PURE__*/ function(DynamicHoleKind) {\n /** We know that this hole is caused by runtime data. */ DynamicHoleKind[DynamicHoleKind[\"Runtime\"] = 1] = \"Runtime\";\n /** We know that this hole is caused by dynamic data. */ DynamicHoleKind[DynamicHoleKind[\"Dynamic\"] = 2] = \"Dynamic\";\n return DynamicHoleKind;\n}({});\nfunction createInstantValidationState(createInstantStack) {\n return {\n hasDynamicMetadata: false,\n hasAllowedClientDynamicAboveBoundary: false,\n dynamicMetadata: null,\n hasDynamicViewport: false,\n hasAllowedDynamic: false,\n dynamicErrors: [],\n validationPreventingErrors: [],\n thrownErrorsOutsideBoundary: [],\n createInstantStack\n };\n}\nfunction trackDynamicHoleInNavigation(workStore, componentStack, dynamicValidation, clientDynamic, kind, boundaryState) {\n if (hasOutletRegex.test(componentStack)) {\n // We don't need to track that this is dynamic. It is only so when something else is also dynamic.\n return;\n }\n if (hasMetadataRegex.test(componentStack)) {\n const usageDescription = kind === 1 ? `Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed inside \\`generateMetadata\\` or you have file-based metadata such as icons that depend on dynamic params segments.` : `Uncached data or \\`connection()\\` was accessed inside \\`generateMetadata\\`.`;\n const message = `Route \"${workStore.route}\": ${usageDescription} Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1076\",\n enumerable: false,\n configurable: true\n }), componentStack, dynamicValidation.createInstantStack);\n dynamicValidation.dynamicMetadata = error;\n return;\n }\n if (hasViewportRegex.test(componentStack)) {\n const usageDescription = kind === 1 ? `Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed inside \\`generateViewport\\`.` : `Uncached data or \\`connection()\\` was accessed inside \\`generateViewport\\`.`;\n const message = `Route \"${workStore.route}\": ${usageDescription} This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1086\",\n enumerable: false,\n configurable: true\n }), componentStack, dynamicValidation.createInstantStack);\n dynamicValidation.dynamicErrors.push(error);\n return;\n }\n const boundaryLocation = hasInstantValidationBoundaryRegex.exec(componentStack);\n if (!boundaryLocation) {\n // We don't see the validation boundary in the component stack,\n // so this hole must be coming from a shared parent.\n // Shared parents are fully resolved and don't have RSC holes,\n // but they can still suspend in a client component during SSR.\n // If we managed to render all the validation boundaries, that means\n // that the client holes aren't blocking validation and we can disregard them.\n // Note that we don't even care whether they have suspense or not.\n if (boundaryState.expectedIds.size === boundaryState.renderedIds.size) {\n dynamicValidation.hasAllowedClientDynamicAboveBoundary = true;\n dynamicValidation.hasAllowedDynamic = true // Holes outside the boundary contribute to allowing dynamic metadata\n ;\n return;\n } else {\n // TODO(instant-validation) TODO(NAR-787)\n // If shared parents blocked us from validating, we should only log\n // the errors from the innermost (segments), i.e. omit layouts whose\n // slots managed to render (because clearly they didn't block validation)\n const message = `Route \"${workStore.route}\": Could not validate \\`unstable_instant\\` because a Client Component in a parent segment prevented the page from rendering.`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1082\",\n enumerable: false,\n configurable: true\n }), componentStack, dynamicValidation.createInstantStack);\n dynamicValidation.validationPreventingErrors.push(error);\n return;\n }\n } else {\n // The hole originates inside the validation boundary.\n //\n // Check if we have a Suspense above the hole, but below the validation boundary.\n // If we do, then this dynamic usage wouldn't block a navigation to this subtree.\n // Conversely, if the nearest suspense is above the validation boundary, then this subtree would block.\n //\n // Note that in the component stack, children come before parents.\n //\n // Valid:\n // ...\n // at Suspense\n // ...\n // at __next_prefetch_validation_boundary__\n //\n // Invalid:\n // ...\n // at __next_prefetch_validation_boundary__\n // ...\n // at Suspense\n //\n const suspenseLocation = hasSuspenseRegex.exec(componentStack);\n if (suspenseLocation) {\n if (suspenseLocation.index < boundaryLocation.index) {\n dynamicValidation.hasAllowedDynamic = true;\n return;\n } else {\n // invalid - fallthrough\n }\n }\n }\n if (clientDynamic.syncDynamicErrorWithStack) {\n // This task was the task that called the sync error.\n const syncError = clientDynamic.syncDynamicErrorWithStack;\n if (dynamicValidation.createInstantStack !== null && syncError.cause === undefined) {\n syncError.cause = dynamicValidation.createInstantStack();\n }\n dynamicValidation.dynamicErrors.push(syncError);\n return;\n }\n const usageDescription = kind === 1 ? `Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed outside of \\`<Suspense>\\`.` : `Uncached data or \\`connection()\\` was accessed outside of \\`<Suspense>\\`.`;\n const message = `Route \"${workStore.route}\": ${usageDescription} This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1078\",\n enumerable: false,\n configurable: true\n }), componentStack, dynamicValidation.createInstantStack);\n dynamicValidation.dynamicErrors.push(error);\n return;\n}\nfunction trackThrownErrorInNavigation(workStore, dynamicValidation, thrownValue, componentStack) {\n const boundaryLocation = hasInstantValidationBoundaryRegex.exec(componentStack);\n if (!boundaryLocation) {\n // There's no validation boundary on the component stack.\n // This error may have blocked a boundary from rendering.\n // Wrap the error to provide component context.\n // This helps for errors from node_modules which would otherwise\n // have no useful stack information due to ignore-listing,\n // e.g. next/dynamic with `ssr: false`.\n const error = addErrorContext(Object.defineProperty(new Error('An error occurred while attempting to validate instant UI. This error may be preventing the validation from completing.', {\n cause: thrownValue\n }), \"__NEXT_ERROR_CODE\", {\n value: \"E1118\",\n enumerable: false,\n configurable: true\n }), componentStack, null);\n dynamicValidation.thrownErrorsOutsideBoundary.push(error);\n } else {\n // There's validation boundary on the component stack,\n // so we know this error didn't block a validation boundary from rendering.\n // However, this error might be hiding be hiding dynamic content that would\n // cause validation to fail.\n const suspenseLocation = hasSuspenseRegex.exec(componentStack);\n if (suspenseLocation) {\n if (suspenseLocation.index < boundaryLocation.index) {\n // There's a Suspense below the validation boundary but above this error's location.\n // This subtree can't fail instant validation because any potential\n // dynamic holes would be guarded by the Suspense anyway,\n // so we can allow this.\n return;\n } else {\n // invalid - fallthrough\n }\n }\n const message = `Route \"${workStore.route}\": Could not validate \\`unstable_instant\\` because an error prevented the target segment from rendering.`;\n const error = addErrorContext(Object.defineProperty(new Error(message, {\n cause: thrownValue\n }), \"__NEXT_ERROR_CODE\", {\n value: \"E1112\",\n enumerable: false,\n configurable: true\n }), componentStack, null // TODO(instant-validation-build): conflicting use of cause\n );\n dynamicValidation.validationPreventingErrors.push(error);\n }\n}\nfunction trackDynamicHoleInRuntimeShell(workStore, componentStack, dynamicValidation, clientDynamic) {\n if (hasOutletRegex.test(componentStack)) {\n // We don't need to track that this is dynamic. It is only so when something else is also dynamic.\n return;\n } else if (hasMetadataRegex.test(componentStack)) {\n const message = `Route \"${workStore.route}\": Uncached data or \\`connection()\\` was accessed inside \\`generateMetadata\\`. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1080\",\n enumerable: false,\n configurable: true\n }), componentStack, null);\n dynamicValidation.dynamicMetadata = error;\n return;\n } else if (hasViewportRegex.test(componentStack)) {\n // TODO(instant-validation): If the page only has holes caused by runtime data,\n // we won't find out if there's a suspense-above-body and error for dynamic viewport\n // even if there is in fact a suspense-above-body\n const message = `Route \"${workStore.route}\": Uncached data or \\`connection()\\` was accessed inside \\`generateViewport\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1077\",\n enumerable: false,\n configurable: true\n }), componentStack, null);\n dynamicValidation.dynamicErrors.push(error);\n return;\n } else if (hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex.test(componentStack)) {\n // For Suspense within body, the prelude wouldn't be empty so it wouldn't violate the empty static shells rule.\n // But if you have Suspense above body, the prelude is empty but we allow that because having Suspense\n // is an explicit signal from the user that they acknowledge the empty shell and want dynamic rendering.\n dynamicValidation.hasAllowedDynamic = true;\n dynamicValidation.hasSuspenseAboveBody = true;\n return;\n } else if (hasSuspenseRegex.test(componentStack)) {\n // this error had a Suspense boundary above it so we don't need to report it as a source\n // of disallowed\n dynamicValidation.hasAllowedDynamic = true;\n return;\n } else if (clientDynamic.syncDynamicErrorWithStack) {\n // This task was the task that called the sync error.\n dynamicValidation.dynamicErrors.push(clientDynamic.syncDynamicErrorWithStack);\n return;\n }\n const message = `Route \"${workStore.route}\": Uncached data or \\`connection()\\` was accessed outside of \\`<Suspense>\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1084\",\n enumerable: false,\n configurable: true\n }), componentStack, null);\n dynamicValidation.dynamicErrors.push(error);\n return;\n}\nfunction trackDynamicHoleInStaticShell(workStore, componentStack, dynamicValidation, clientDynamic) {\n if (hasOutletRegex.test(componentStack)) {\n // We don't need to track that this is dynamic. It is only so when something else is also dynamic.\n return;\n } else if (hasMetadataRegex.test(componentStack)) {\n const message = `Route \"${workStore.route}\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed inside \\`generateMetadata\\` or you have file-based metadata such as icons that depend on dynamic params segments. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1085\",\n enumerable: false,\n configurable: true\n }), componentStack, null);\n dynamicValidation.dynamicMetadata = error;\n return;\n } else if (hasViewportRegex.test(componentStack)) {\n const message = `Route \"${workStore.route}\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed inside \\`generateViewport\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1081\",\n enumerable: false,\n configurable: true\n }), componentStack, null);\n dynamicValidation.dynamicErrors.push(error);\n return;\n } else if (hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex.test(componentStack)) {\n // For Suspense within body, the prelude wouldn't be empty so it wouldn't violate the empty static shells rule.\n // But if you have Suspense above body, the prelude is empty but we allow that because having Suspense\n // is an explicit signal from the user that they acknowledge the empty shell and want dynamic rendering.\n dynamicValidation.hasAllowedDynamic = true;\n dynamicValidation.hasSuspenseAboveBody = true;\n return;\n } else if (hasSuspenseRegex.test(componentStack)) {\n // this error had a Suspense boundary above it so we don't need to report it as a source\n // of disallowed\n dynamicValidation.hasAllowedDynamic = true;\n return;\n } else if (clientDynamic.syncDynamicErrorWithStack) {\n // This task was the task that called the sync error.\n dynamicValidation.dynamicErrors.push(clientDynamic.syncDynamicErrorWithStack);\n return;\n } else {\n const message = `Route \"${workStore.route}\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed outside of \\`<Suspense>\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`;\n const error = addErrorContext(Object.defineProperty(new Error(message), \"__NEXT_ERROR_CODE\", {\n value: \"E1083\",\n enumerable: false,\n configurable: true\n }), componentStack, null);\n dynamicValidation.dynamicErrors.push(error);\n return;\n }\n}\n/**\n * In dev mode, we prefer using the owner stack, otherwise the provided\n * component stack is used.\n *\n * Accepts an already-created Error so the SWC error-code plugin can see the\n * `new Error(...)` call at each call site and auto-assign error codes.\n */ function addErrorContext(error, componentStack, createInstantStack) {\n const ownerStack = process.env.NODE_ENV !== 'production' && _react.default.captureOwnerStack ? _react.default.captureOwnerStack() : null;\n if (createInstantStack !== null) {\n error.cause = createInstantStack();\n }\n // TODO go back to owner stack here if available. This is temporarily using componentStack to get the right\n //\n error.stack = error.name + ': ' + error.message + (ownerStack || componentStack);\n return error;\n}\nvar PreludeState = /*#__PURE__*/ function(PreludeState) {\n PreludeState[PreludeState[\"Full\"] = 0] = \"Full\";\n PreludeState[PreludeState[\"Empty\"] = 1] = \"Empty\";\n PreludeState[PreludeState[\"Errored\"] = 2] = \"Errored\";\n return PreludeState;\n}({});\nfunction logDisallowedDynamicError(workStore, error) {\n console.error(error);\n if (process.env.NODE_ENV !== 'development') {\n console.error(`To get a more detailed stack trace and pinpoint the issue, try one of the following:\n - Start the app in development mode by running \\`next dev\\`, then open \"${workStore.route}\" in your browser to investigate the error.\n - Rerun the production build with \\`next build --debug-prerender\\` to generate better stack traces.`);\n } else if (!process.env.__NEXT_DEV_SERVER) {\n console.error(`To debug the issue, start the app in development mode by running \\`next dev\\`, then open \"${workStore.route}\" in your browser to investigate the error.`);\n }\n}\nfunction throwIfDisallowedDynamic(workStore, prelude, dynamicValidation, serverDynamic) {\n if (serverDynamic.syncDynamicErrorWithStack) {\n logDisallowedDynamicError(workStore, serverDynamic.syncDynamicErrorWithStack);\n throw new _staticgenerationbailout.StaticGenBailoutError();\n }\n if (prelude !== 0) {\n if (dynamicValidation.hasSuspenseAboveBody) {\n // This route has opted into allowing fully dynamic rendering\n // by including a Suspense boundary above the body. In this case\n // a lack of a shell is not considered disallowed so we simply return\n return;\n }\n // We didn't have any sync bailouts but there may be user code which\n // blocked the root. We would have captured these during the prerender\n // and can log them here and then terminate the build/validating render\n const dynamicErrors = dynamicValidation.dynamicErrors;\n if (dynamicErrors.length > 0) {\n for(let i = 0; i < dynamicErrors.length; i++){\n logDisallowedDynamicError(workStore, dynamicErrors[i]);\n }\n throw new _staticgenerationbailout.StaticGenBailoutError();\n }\n // If we got this far then the only other thing that could be blocking\n // the root is dynamic Viewport. If this is dynamic then\n // you need to opt into that by adding a Suspense boundary above the body\n // to indicate your are ok with fully dynamic rendering.\n if (dynamicValidation.hasDynamicViewport) {\n console.error(`Route \"${workStore.route}\" has a \\`generateViewport\\` that depends on Request data (\\`cookies()\\`, etc...) or uncached external data (\\`fetch(...)\\`, etc...) without explicitly allowing fully dynamic rendering. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`);\n throw new _staticgenerationbailout.StaticGenBailoutError();\n }\n if (prelude === 1) {\n // If we ever get this far then we messed up the tracking of invalid dynamic.\n // We still adhere to the constraint that you must produce a shell but invite the\n // user to report this as a bug in Next.js.\n console.error(`Route \"${workStore.route}\" did not produce a static shell and Next.js was unable to determine a reason. This is a bug in Next.js.`);\n throw new _staticgenerationbailout.StaticGenBailoutError();\n }\n } else {\n if (dynamicValidation.hasAllowedDynamic === false && dynamicValidation.hasDynamicMetadata) {\n console.error(`Route \"${workStore.route}\" has a \\`generateMetadata\\` that depends on Request data (\\`cookies()\\`, etc...) or uncached external data (\\`fetch(...)\\`, etc...) when the rest of the route does not. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`);\n throw new _staticgenerationbailout.StaticGenBailoutError();\n }\n }\n}\nfunction getStaticShellDisallowedDynamicReasons(workStore, prelude, dynamicValidation, configAllowsBlocking) {\n if (configAllowsBlocking || dynamicValidation.hasSuspenseAboveBody) {\n // This route has opted into allowing fully dynamic rendering\n // by including a Suspense boundary above the body. In this case\n // a lack of a shell is not considered disallowed so we simply return\n return [];\n }\n if (prelude !== 0) {\n // We didn't have any sync bailouts but there may be user code which\n // blocked the root. We would have captured these during the prerender\n // and can log them here and then terminate the build/validating render\n const dynamicErrors = dynamicValidation.dynamicErrors;\n if (dynamicErrors.length > 0) {\n return dynamicErrors;\n }\n if (prelude === 1) {\n // If we ever get this far then we messed up the tracking of invalid dynamic.\n // We still adhere to the constraint that you must produce a shell but invite the\n // user to report this as a bug in Next.js.\n return [\n Object.defineProperty(new _invarianterror.InvariantError(`Route \"${workStore.route}\" did not produce a static shell and Next.js was unable to determine a reason.`), \"__NEXT_ERROR_CODE\", {\n value: \"E936\",\n enumerable: false,\n configurable: true\n })\n ];\n }\n } else {\n // We have a prelude but we might still have dynamic metadata without any other dynamic access\n if (dynamicValidation.hasAllowedDynamic === false && dynamicValidation.dynamicErrors.length === 0 && dynamicValidation.dynamicMetadata) {\n return [\n dynamicValidation.dynamicMetadata\n ];\n }\n }\n // We had a non-empty prelude and there are no dynamic holes\n return [];\n}\nfunction getNavigationDisallowedDynamicReasons(workStore, prelude, dynamicValidation, validationSampleTracking, boundaryState) {\n // If we have errors related to missing samples, those should take precedence over everything else.\n if (validationSampleTracking) {\n const { missingSampleErrors } = validationSampleTracking;\n if (missingSampleErrors.length > 0) {\n return missingSampleErrors;\n }\n }\n const { validationPreventingErrors } = dynamicValidation;\n if (validationPreventingErrors.length > 0) {\n return validationPreventingErrors;\n }\n if (boundaryState.renderedIds.size < boundaryState.expectedIds.size) {\n const { thrownErrorsOutsideBoundary, createInstantStack } = dynamicValidation;\n if (thrownErrorsOutsideBoundary.length === 0) {\n const message = `Route \"${workStore.route}\": Could not validate \\`unstable_instant\\` because the target segment was prevented from rendering for an unknown reason.`;\n const error = createInstantStack !== null ? createInstantStack() : new Error();\n error.name = 'Error';\n error.message = message;\n return [\n error\n ];\n } else if (thrownErrorsOutsideBoundary.length === 1) {\n const message = `Route \"${workStore.route}\": Could not validate \\`unstable_instant\\` because the target segment was prevented from rendering, likely due to the following error.`;\n const error = createInstantStack !== null ? createInstantStack() : new Error();\n error.name = 'Error';\n error.message = message;\n return [\n error,\n thrownErrorsOutsideBoundary[0]\n ];\n } else {\n const message = `Route \"${workStore.route}\": Could not validate \\`unstable_instant\\` because the target segment was prevented from rendering, likely due to one of the following errors.`;\n const error = createInstantStack !== null ? createInstantStack() : new Error();\n error.name = 'Error';\n error.message = message;\n return [\n error,\n ...thrownErrorsOutsideBoundary\n ];\n }\n }\n // NOTE: We don't care about Suspense above body here,\n // we're only concerned with the validation boundary\n if (prelude !== 0) {\n const dynamicErrors = dynamicValidation.dynamicErrors;\n if (dynamicErrors.length > 0) {\n return dynamicErrors;\n }\n if (prelude === 1) {\n // If a client component suspended prevented us from rendering a shell\n // but didn't block validation, we don't require a prelude.\n if (dynamicValidation.hasAllowedClientDynamicAboveBoundary) {\n return [];\n }\n // If we ever get this far then we messed up the tracking of invalid dynamic.\n return [\n Object.defineProperty(new _invarianterror.InvariantError(`Route \"${workStore.route}\" failed to render during instant validation and Next.js was unable to determine a reason.`), \"__NEXT_ERROR_CODE\", {\n value: \"E1055\",\n enumerable: false,\n configurable: true\n })\n ];\n }\n } else {\n const dynamicErrors = dynamicValidation.dynamicErrors;\n if (dynamicErrors.length > 0) {\n return dynamicErrors;\n }\n if (dynamicValidation.hasAllowedDynamic === false && dynamicValidation.dynamicMetadata) {\n return [\n dynamicValidation.dynamicMetadata\n ];\n }\n }\n // We had a non-empty prelude and there are no dynamic holes\n return [];\n}\n\n//# sourceMappingURL=dynamic-rendering.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"createDedupedByCallsiteServerErrorLoggerDev\", {\n enumerable: true,\n get: function() {\n return createDedupedByCallsiteServerErrorLoggerDev;\n }\n});\nconst _react = /*#__PURE__*/ _interop_require_wildcard(require(\"react\"));\nfunction _getRequireWildcardCache(nodeInterop) {\n if (typeof WeakMap !== \"function\") return null;\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n return (_getRequireWildcardCache = function(nodeInterop) {\n return nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n })(nodeInterop);\n}\nfunction _interop_require_wildcard(obj, nodeInterop) {\n if (!nodeInterop && obj && obj.__esModule) {\n return obj;\n }\n if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") {\n return {\n default: obj\n };\n }\n var cache = _getRequireWildcardCache(nodeInterop);\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n var newObj = {\n __proto__: null\n };\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n for(var key in obj){\n if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n newObj.default = obj;\n if (cache) {\n cache.set(obj, newObj);\n }\n return newObj;\n}\nconst errorRef = {\n current: null\n};\n// React.cache is currently only available in canary/experimental React channels.\nconst cache = typeof _react.cache === 'function' ? _react.cache : (fn)=>fn;\n// When Cache Components is enabled, we record these as errors so that they\n// are captured by the dev overlay as it's more critical to fix these\n// when enabled.\nconst logErrorOrWarn = process.env.__NEXT_CACHE_COMPONENTS ? console.error : console.warn;\n// We don't want to dedupe across requests.\n// The developer might've just attempted to fix the warning so we should warn again if it still happens.\nconst flushCurrentErrorIfNew = cache(// eslint-disable-next-line @typescript-eslint/no-unused-vars -- cache key\n(key)=>{\n try {\n logErrorOrWarn(errorRef.current);\n } finally{\n errorRef.current = null;\n }\n});\nfunction createDedupedByCallsiteServerErrorLoggerDev(getMessage) {\n return function logDedupedError(...args) {\n const message = getMessage(...args);\n if (process.env.NODE_ENV !== 'production') {\n var _stack;\n const callStackFrames = (_stack = new Error().stack) == null ? void 0 : _stack.split('\\n');\n if (callStackFrames === undefined || callStackFrames.length < 4) {\n logErrorOrWarn(message);\n } else {\n // Error:\n // logDedupedError\n // asyncApiBeingAccessedSynchronously\n // <userland callsite>\n // TODO: This breaks if sourcemaps with ignore lists are enabled.\n const key = callStackFrames[4];\n errorRef.current = message;\n flushCurrentErrorIfNew(key);\n }\n } else {\n logErrorOrWarn(message);\n }\n };\n}\n\n//# sourceMappingURL=create-deduped-by-callsite-server-error-logger.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"afterTaskAsyncStorageInstance\", {\n enumerable: true,\n get: function() {\n return afterTaskAsyncStorageInstance;\n }\n});\nconst _asynclocalstorage = require(\"./async-local-storage\");\nconst afterTaskAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();\n\n//# sourceMappingURL=after-task-async-storage-instance.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"afterTaskAsyncStorage\", {\n enumerable: true,\n get: function() {\n return _aftertaskasyncstorageinstance.afterTaskAsyncStorageInstance;\n }\n});\nconst _aftertaskasyncstorageinstance = require(\"./after-task-async-storage-instance\");\n\n//# sourceMappingURL=after-task-async-storage.external.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n isRequestAPICallableInsideAfter: null,\n throwForSearchParamsAccessInUseCache: null,\n throwWithStaticGenerationBailoutErrorWithDynamicError: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n isRequestAPICallableInsideAfter: function() {\n return isRequestAPICallableInsideAfter;\n },\n throwForSearchParamsAccessInUseCache: function() {\n return throwForSearchParamsAccessInUseCache;\n },\n throwWithStaticGenerationBailoutErrorWithDynamicError: function() {\n return throwWithStaticGenerationBailoutErrorWithDynamicError;\n }\n});\nconst _staticgenerationbailout = require(\"../../client/components/static-generation-bailout\");\nconst _aftertaskasyncstorageexternal = require(\"../app-render/after-task-async-storage.external\");\nfunction throwWithStaticGenerationBailoutErrorWithDynamicError(route, expression) {\n throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${route} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), \"__NEXT_ERROR_CODE\", {\n value: \"E543\",\n enumerable: false,\n configurable: true\n });\n}\nfunction throwForSearchParamsAccessInUseCache(workStore, constructorOpt) {\n const error = Object.defineProperty(new Error(`Route ${workStore.route} used \\`searchParams\\` inside \"use cache\". Accessing dynamic request data inside a cache scope is not supported. If you need some search params inside a cached function await \\`searchParams\\` outside of the cached function and pass only the required search params as arguments to the cached function. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), \"__NEXT_ERROR_CODE\", {\n value: \"E842\",\n enumerable: false,\n configurable: true\n });\n Error.captureStackTrace(error, constructorOpt);\n workStore.invalidDynamicUsageError ??= error;\n throw error;\n}\nfunction isRequestAPICallableInsideAfter() {\n const afterTaskStore = _aftertaskasyncstorageexternal.afterTaskAsyncStorage.getStore();\n return (afterTaskStore == null ? void 0 : afterTaskStore.rootTaskSpawnPhase) === 'action';\n}\n\n//# sourceMappingURL=utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"cookies\", {\n enumerable: true,\n get: function() {\n return cookies;\n }\n});\nconst _requestcookies = require(\"../web/spec-extension/adapters/request-cookies\");\nconst _cookies = require(\"../web/spec-extension/cookies\");\nconst _workasyncstorageexternal = require(\"../app-render/work-async-storage.external\");\nconst _workunitasyncstorageexternal = require(\"../app-render/work-unit-async-storage.external\");\nconst _dynamicrendering = require(\"../app-render/dynamic-rendering\");\nconst _staticgenerationbailout = require(\"../../client/components/static-generation-bailout\");\nconst _dynamicrenderingutils = require(\"../dynamic-rendering-utils\");\nconst _creatededupedbycallsiteservererrorlogger = require(\"../create-deduped-by-callsite-server-error-logger\");\nconst _utils = require(\"./utils\");\nconst _invarianterror = require(\"../../shared/lib/invariant-error\");\nconst _stagedrendering = require(\"../app-render/staged-rendering\");\nfunction cookies() {\n const callingExpression = 'cookies';\n const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();\n const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();\n if (workStore) {\n if (workUnitStore && workUnitStore.phase === 'after' && !(0, _utils.isRequestAPICallableInsideAfter)()) {\n throw Object.defineProperty(new Error(// TODO(after): clarify that this only applies to pages?\n `Route ${workStore.route} used \\`cookies()\\` inside \\`after()\\`. This is not supported. If you need this data inside an \\`after()\\` callback, use \\`cookies()\\` outside of the callback. See more info here: https://nextjs.org/docs/canary/app/api-reference/functions/after`), \"__NEXT_ERROR_CODE\", {\n value: \"E843\",\n enumerable: false,\n configurable: true\n });\n }\n if (workStore.forceStatic) {\n // When using forceStatic we override all other logic and always just return an empty\n // cookies object without tracking\n const underlyingCookies = createEmptyCookies();\n return makeUntrackedCookies(underlyingCookies);\n }\n if (workStore.dynamicShouldError) {\n throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${workStore.route} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used \\`cookies()\\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), \"__NEXT_ERROR_CODE\", {\n value: \"E849\",\n enumerable: false,\n configurable: true\n });\n }\n if (workUnitStore) {\n switch(workUnitStore.type){\n case 'cache':\n const error = Object.defineProperty(new Error(`Route ${workStore.route} used \\`cookies()\\` inside \"use cache\". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \\`cookies()\\` outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), \"__NEXT_ERROR_CODE\", {\n value: \"E831\",\n enumerable: false,\n configurable: true\n });\n Error.captureStackTrace(error, cookies);\n workStore.invalidDynamicUsageError ??= error;\n throw error;\n case 'unstable-cache':\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \\`cookies()\\` inside a function cached with \\`unstable_cache()\\`. Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \\`cookies()\\` outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), \"__NEXT_ERROR_CODE\", {\n value: \"E846\",\n enumerable: false,\n configurable: true\n });\n case 'generate-static-params':\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \\`cookies()\\` inside \\`generateStaticParams\\`. This is not supported because \\`generateStaticParams\\` runs at build time without an HTTP request. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), \"__NEXT_ERROR_CODE\", {\n value: \"E1123\",\n enumerable: false,\n configurable: true\n });\n case 'prerender':\n return makeHangingCookies(workStore, workUnitStore);\n case 'prerender-client':\n case 'validation-client':\n const exportName = '`cookies`';\n throw Object.defineProperty(new _invarianterror.InvariantError(`${exportName} must not be used within a Client Component. Next.js should be preventing ${exportName} from being included in Client Components statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E1037\",\n enumerable: false,\n configurable: true\n });\n case 'prerender-ppr':\n // We need track dynamic access here eagerly to keep continuity with\n // how cookies has worked in PPR without cacheComponents.\n return (0, _dynamicrendering.postponeWithTracking)(workStore.route, callingExpression, workUnitStore.dynamicTracking);\n case 'prerender-legacy':\n // We track dynamic access here so we don't need to wrap the cookies\n // in individual property access tracking.\n return (0, _dynamicrendering.throwToInterruptStaticGeneration)(callingExpression, workStore, workUnitStore);\n case 'prerender-runtime':\n return (0, _dynamicrenderingutils.delayUntilRuntimeStage)(workUnitStore, makeUntrackedCookies(workUnitStore.cookies));\n case 'private-cache':\n // Private caches are delayed until the runtime stage in use-cache-wrapper,\n // so we don't need an additional delay here.\n return makeUntrackedCookies(workUnitStore.cookies);\n case 'request':\n (0, _dynamicrendering.trackDynamicDataInDynamicRender)(workUnitStore);\n let underlyingCookies;\n if ((0, _requestcookies.areCookiesMutableInCurrentPhase)(workUnitStore)) {\n // We can't conditionally return different types here based on the context.\n // To avoid confusion, we always return the readonly type here.\n underlyingCookies = workUnitStore.userspaceMutableCookies;\n } else {\n underlyingCookies = workUnitStore.cookies;\n }\n if (process.env.NODE_ENV === 'development') {\n // Semantically we only need the dev tracking when running in `next dev`\n // but since you would never use next dev with production NODE_ENV we use this\n // as a proxy so we can statically exclude this code from production builds.\n return makeUntrackedCookiesWithDevWarnings(workUnitStore, underlyingCookies, workStore == null ? void 0 : workStore.route);\n } else if (workUnitStore.asyncApiPromises) {\n const early = (0, _workunitasyncstorageexternal.isInEarlyRenderStage)(workUnitStore);\n if (underlyingCookies === workUnitStore.mutableCookies) {\n return early ? workUnitStore.asyncApiPromises.earlyMutableCookies : workUnitStore.asyncApiPromises.mutableCookies;\n } else {\n return early ? workUnitStore.asyncApiPromises.earlyCookies : workUnitStore.asyncApiPromises.cookies;\n }\n } else {\n return makeUntrackedCookies(underlyingCookies);\n }\n default:\n workUnitStore;\n }\n }\n }\n // If we end up here, there was no work store or work unit store present.\n (0, _workunitasyncstorageexternal.throwForMissingRequestStore)(callingExpression);\n}\nfunction createEmptyCookies() {\n return _requestcookies.RequestCookiesAdapter.seal(new _cookies.RequestCookies(new Headers({})));\n}\nconst CachedCookies = new WeakMap();\nfunction makeHangingCookies(workStore, prerenderStore) {\n const cachedPromise = CachedCookies.get(prerenderStore);\n if (cachedPromise) {\n return cachedPromise;\n }\n const promise = (0, _dynamicrenderingutils.makeHangingPromise)(prerenderStore.renderSignal, workStore.route, '`cookies()`');\n CachedCookies.set(prerenderStore, promise);\n return promise;\n}\nfunction makeUntrackedCookies(underlyingCookies) {\n const cachedCookies = CachedCookies.get(underlyingCookies);\n if (cachedCookies) {\n return cachedCookies;\n }\n const promise = Promise.resolve(underlyingCookies);\n CachedCookies.set(underlyingCookies, promise);\n return promise;\n}\nfunction makeUntrackedCookiesWithDevWarnings(requestStore, underlyingCookies, route) {\n if (requestStore.asyncApiPromises) {\n const early = (0, _workunitasyncstorageexternal.isInEarlyRenderStage)(requestStore);\n let promise;\n if (underlyingCookies === requestStore.mutableCookies) {\n promise = early ? requestStore.asyncApiPromises.earlyMutableCookies : requestStore.asyncApiPromises.mutableCookies;\n } else if (underlyingCookies === requestStore.cookies) {\n promise = early ? requestStore.asyncApiPromises.earlyCookies : requestStore.asyncApiPromises.cookies;\n } else {\n throw Object.defineProperty(new _invarianterror.InvariantError('Received an underlying cookies object that does not match either `cookies` or `mutableCookies`'), \"__NEXT_ERROR_CODE\", {\n value: \"E890\",\n enumerable: false,\n configurable: true\n });\n }\n return instrumentCookiesPromiseWithDevWarnings(promise, route);\n }\n const cachedCookies = CachedCookies.get(underlyingCookies);\n if (cachedCookies) {\n return cachedCookies;\n }\n const promise = (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(underlyingCookies, requestStore, _stagedrendering.RenderStage.Runtime);\n const proxiedPromise = instrumentCookiesPromiseWithDevWarnings(promise, route);\n CachedCookies.set(underlyingCookies, proxiedPromise);\n return proxiedPromise;\n}\nconst warnForSyncAccess = (0, _creatededupedbycallsiteservererrorlogger.createDedupedByCallsiteServerErrorLoggerDev)(createCookiesAccessError);\nfunction instrumentCookiesPromiseWithDevWarnings(promise, route) {\n Object.defineProperties(promise, {\n [Symbol.iterator]: replaceableWarningDescriptorForSymbolIterator(promise, route),\n size: replaceableWarningDescriptor(promise, 'size', route),\n get: replaceableWarningDescriptor(promise, 'get', route),\n getAll: replaceableWarningDescriptor(promise, 'getAll', route),\n has: replaceableWarningDescriptor(promise, 'has', route),\n set: replaceableWarningDescriptor(promise, 'set', route),\n delete: replaceableWarningDescriptor(promise, 'delete', route),\n clear: replaceableWarningDescriptor(promise, 'clear', route),\n toString: replaceableWarningDescriptor(promise, 'toString', route)\n });\n return promise;\n}\nfunction replaceableWarningDescriptor(target, prop, route) {\n return {\n enumerable: false,\n get () {\n warnForSyncAccess(route, `\\`cookies().${prop}\\``);\n return undefined;\n },\n set (value) {\n Object.defineProperty(target, prop, {\n value,\n writable: true,\n configurable: true\n });\n },\n configurable: true\n };\n}\nfunction replaceableWarningDescriptorForSymbolIterator(target, route) {\n return {\n enumerable: false,\n get () {\n warnForSyncAccess(route, '`...cookies()` or similar iteration');\n return undefined;\n },\n set (value) {\n Object.defineProperty(target, Symbol.iterator, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n },\n configurable: true\n };\n}\nfunction createCookiesAccessError(route, expression) {\n const prefix = route ? `Route \"${route}\" ` : 'This route ';\n return Object.defineProperty(new Error(`${prefix}used ${expression}. ` + `\\`cookies()\\` returns a Promise and must be unwrapped with \\`await\\` or \\`React.use()\\` before accessing its properties. ` + `Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`), \"__NEXT_ERROR_CODE\", {\n value: \"E830\",\n enumerable: false,\n configurable: true\n });\n}\n\n//# sourceMappingURL=cookies.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n0 && (module.exports = {\n HeadersAdapter: null,\n ReadonlyHeadersError: null\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n HeadersAdapter: function() {\n return HeadersAdapter;\n },\n ReadonlyHeadersError: function() {\n return ReadonlyHeadersError;\n }\n});\nconst _reflect = require(\"./reflect\");\nclass ReadonlyHeadersError extends Error {\n constructor(){\n super('Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers');\n }\n static callable() {\n throw new ReadonlyHeadersError();\n }\n}\nclass HeadersAdapter extends Headers {\n constructor(headers){\n // We've already overridden the methods that would be called, so we're just\n // calling the super constructor to ensure that the instanceof check works.\n super();\n this.headers = new Proxy(headers, {\n get (target, prop, receiver) {\n // Because this is just an object, we expect that all \"get\" operations\n // are for properties. If it's a \"get\" for a symbol, we'll just return\n // the symbol.\n if (typeof prop === 'symbol') {\n return _reflect.ReflectAdapter.get(target, prop, receiver);\n }\n const lowercased = prop.toLowerCase();\n // Let's find the original casing of the key. This assumes that there is\n // no mixed case keys (e.g. \"Content-Type\" and \"content-type\") in the\n // headers object.\n const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased);\n // If the original casing doesn't exist, return undefined.\n if (typeof original === 'undefined') return;\n // If the original casing exists, return the value.\n return _reflect.ReflectAdapter.get(target, original, receiver);\n },\n set (target, prop, value, receiver) {\n if (typeof prop === 'symbol') {\n return _reflect.ReflectAdapter.set(target, prop, value, receiver);\n }\n const lowercased = prop.toLowerCase();\n // Let's find the original casing of the key. This assumes that there is\n // no mixed case keys (e.g. \"Content-Type\" and \"content-type\") in the\n // headers object.\n const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased);\n // If the original casing doesn't exist, use the prop as the key.\n return _reflect.ReflectAdapter.set(target, original ?? prop, value, receiver);\n },\n has (target, prop) {\n if (typeof prop === 'symbol') return _reflect.ReflectAdapter.has(target, prop);\n const lowercased = prop.toLowerCase();\n // Let's find the original casing of the key. This assumes that there is\n // no mixed case keys (e.g. \"Content-Type\" and \"content-type\") in the\n // headers object.\n const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased);\n // If the original casing doesn't exist, return false.\n if (typeof original === 'undefined') return false;\n // If the original casing exists, return true.\n return _reflect.ReflectAdapter.has(target, original);\n },\n deleteProperty (target, prop) {\n if (typeof prop === 'symbol') return _reflect.ReflectAdapter.deleteProperty(target, prop);\n const lowercased = prop.toLowerCase();\n // Let's find the original casing of the key. This assumes that there is\n // no mixed case keys (e.g. \"Content-Type\" and \"content-type\") in the\n // headers object.\n const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased);\n // If the original casing doesn't exist, return true.\n if (typeof original === 'undefined') return true;\n // If the original casing exists, delete the property.\n return _reflect.ReflectAdapter.deleteProperty(target, original);\n }\n });\n }\n /**\n * Seals a Headers instance to prevent modification by throwing an error when\n * any mutating method is called.\n */ static seal(headers) {\n return new Proxy(headers, {\n get (target, prop, receiver) {\n switch(prop){\n case 'append':\n case 'delete':\n case 'set':\n return ReadonlyHeadersError.callable;\n default:\n return _reflect.ReflectAdapter.get(target, prop, receiver);\n }\n }\n });\n }\n /**\n * Merges a header value into a string. This stores multiple values as an\n * array, so we need to merge them into a string.\n *\n * @param value a header value\n * @returns a merged header value (a string)\n */ merge(value) {\n if (Array.isArray(value)) return value.join(', ');\n return value;\n }\n /**\n * Creates a Headers instance from a plain object or a Headers instance.\n *\n * @param headers a plain object or a Headers instance\n * @returns a headers instance\n */ static from(headers) {\n if (headers instanceof Headers) return headers;\n return new HeadersAdapter(headers);\n }\n append(name, value) {\n const existing = this.headers[name];\n if (typeof existing === 'string') {\n this.headers[name] = [\n existing,\n value\n ];\n } else if (Array.isArray(existing)) {\n existing.push(value);\n } else {\n this.headers[name] = value;\n }\n }\n delete(name) {\n delete this.headers[name];\n }\n get(name) {\n const value = this.headers[name];\n if (typeof value !== 'undefined') return this.merge(value);\n return null;\n }\n has(name) {\n return typeof this.headers[name] !== 'undefined';\n }\n set(name, value) {\n this.headers[name] = value;\n }\n forEach(callbackfn, thisArg) {\n for (const [name, value] of this.entries()){\n callbackfn.call(thisArg, value, name, this);\n }\n }\n *entries() {\n for (const key of Object.keys(this.headers)){\n const name = key.toLowerCase();\n // We assert here that this is a string because we got it from the\n // Object.keys() call above.\n const value = this.get(name);\n yield [\n name,\n value\n ];\n }\n }\n *keys() {\n for (const key of Object.keys(this.headers)){\n const name = key.toLowerCase();\n yield name;\n }\n }\n *values() {\n for (const key of Object.keys(this.headers)){\n // We assert here that this is a string because we got it from the\n // Object.keys() call above.\n const value = this.get(key);\n yield value;\n }\n }\n [Symbol.iterator]() {\n return this.entries();\n }\n}\n\n//# sourceMappingURL=headers.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"headers\", {\n enumerable: true,\n get: function() {\n return headers;\n }\n});\nconst _headers = require(\"../web/spec-extension/adapters/headers\");\nconst _workasyncstorageexternal = require(\"../app-render/work-async-storage.external\");\nconst _workunitasyncstorageexternal = require(\"../app-render/work-unit-async-storage.external\");\nconst _dynamicrendering = require(\"../app-render/dynamic-rendering\");\nconst _staticgenerationbailout = require(\"../../client/components/static-generation-bailout\");\nconst _dynamicrenderingutils = require(\"../dynamic-rendering-utils\");\nconst _creatededupedbycallsiteservererrorlogger = require(\"../create-deduped-by-callsite-server-error-logger\");\nconst _utils = require(\"./utils\");\nconst _invarianterror = require(\"../../shared/lib/invariant-error\");\nconst _stagedrendering = require(\"../app-render/staged-rendering\");\nfunction headers() {\n const callingExpression = 'headers';\n const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();\n const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();\n if (workStore) {\n if (workUnitStore && workUnitStore.phase === 'after' && !(0, _utils.isRequestAPICallableInsideAfter)()) {\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \\`headers()\\` inside \\`after()\\`. This is not supported. If you need this data inside an \\`after()\\` callback, use \\`headers()\\` outside of the callback. See more info here: https://nextjs.org/docs/canary/app/api-reference/functions/after`), \"__NEXT_ERROR_CODE\", {\n value: \"E839\",\n enumerable: false,\n configurable: true\n });\n }\n if (workStore.forceStatic) {\n // When using forceStatic we override all other logic and always just return an empty\n // headers object without tracking\n const underlyingHeaders = _headers.HeadersAdapter.seal(new Headers({}));\n return makeUntrackedHeaders(underlyingHeaders);\n }\n if (workUnitStore) {\n switch(workUnitStore.type){\n case 'cache':\n {\n const error = Object.defineProperty(new Error(`Route ${workStore.route} used \\`headers()\\` inside \"use cache\". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \\`headers()\\` outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), \"__NEXT_ERROR_CODE\", {\n value: \"E833\",\n enumerable: false,\n configurable: true\n });\n Error.captureStackTrace(error, headers);\n workStore.invalidDynamicUsageError ??= error;\n throw error;\n }\n case 'unstable-cache':\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \\`headers()\\` inside a function cached with \\`unstable_cache()\\`. Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \\`headers()\\` outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), \"__NEXT_ERROR_CODE\", {\n value: \"E838\",\n enumerable: false,\n configurable: true\n });\n case 'generate-static-params':\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \\`headers()\\` inside \\`generateStaticParams\\`. This is not supported because \\`generateStaticParams\\` runs at build time without an HTTP request. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), \"__NEXT_ERROR_CODE\", {\n value: \"E1134\",\n enumerable: false,\n configurable: true\n });\n case 'prerender':\n case 'prerender-client':\n case 'validation-client':\n case 'private-cache':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n break;\n default:\n workUnitStore;\n }\n }\n if (workStore.dynamicShouldError) {\n throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${workStore.route} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used \\`headers()\\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), \"__NEXT_ERROR_CODE\", {\n value: \"E828\",\n enumerable: false,\n configurable: true\n });\n }\n if (workUnitStore) {\n switch(workUnitStore.type){\n case 'prerender':\n return makeHangingHeaders(workStore, workUnitStore);\n case 'prerender-client':\n case 'validation-client':\n const exportName = '`headers`';\n throw Object.defineProperty(new _invarianterror.InvariantError(`${exportName} must not be used within a client component. Next.js should be preventing ${exportName} from being included in client components statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E1017\",\n enumerable: false,\n configurable: true\n });\n case 'prerender-ppr':\n // PPR Prerender (no cacheComponents)\n // We are prerendering with PPR. We need track dynamic access here eagerly\n // to keep continuity with how headers has worked in PPR without cacheComponents.\n // TODO consider switching the semantic to throw on property access instead\n return (0, _dynamicrendering.postponeWithTracking)(workStore.route, callingExpression, workUnitStore.dynamicTracking);\n case 'prerender-legacy':\n // Legacy Prerender\n // We are in a legacy static generation mode while prerendering\n // We track dynamic access here so we don't need to wrap the headers in\n // individual property access tracking.\n return (0, _dynamicrendering.throwToInterruptStaticGeneration)(callingExpression, workStore, workUnitStore);\n case 'prerender-runtime':\n return (0, _dynamicrenderingutils.delayUntilRuntimeStage)(workUnitStore, makeUntrackedHeaders(workUnitStore.headers));\n case 'private-cache':\n // Private caches are delayed until the runtime stage in use-cache-wrapper,\n // so we don't need an additional delay here.\n return makeUntrackedHeaders(workUnitStore.headers);\n case 'request':\n (0, _dynamicrendering.trackDynamicDataInDynamicRender)(workUnitStore);\n if (process.env.NODE_ENV === 'development') {\n // Semantically we only need the dev tracking when running in `next dev`\n // but since you would never use next dev with production NODE_ENV we use this\n // as a proxy so we can statically exclude this code from production builds.\n return makeUntrackedHeadersWithDevWarnings(workUnitStore.headers, workStore == null ? void 0 : workStore.route, workUnitStore);\n } else if (workUnitStore.asyncApiPromises) {\n return (0, _workunitasyncstorageexternal.isInEarlyRenderStage)(workUnitStore) ? workUnitStore.asyncApiPromises.earlyHeaders : workUnitStore.asyncApiPromises.headers;\n } else {\n return makeUntrackedHeaders(workUnitStore.headers);\n }\n break;\n default:\n workUnitStore;\n }\n }\n }\n // If we end up here, there was no work store or work unit store present.\n (0, _workunitasyncstorageexternal.throwForMissingRequestStore)(callingExpression);\n}\nconst CachedHeaders = new WeakMap();\nfunction makeHangingHeaders(workStore, prerenderStore) {\n const cachedHeaders = CachedHeaders.get(prerenderStore);\n if (cachedHeaders) {\n return cachedHeaders;\n }\n const promise = (0, _dynamicrenderingutils.makeHangingPromise)(prerenderStore.renderSignal, workStore.route, '`headers()`');\n CachedHeaders.set(prerenderStore, promise);\n return promise;\n}\nfunction makeUntrackedHeaders(underlyingHeaders) {\n const cachedHeaders = CachedHeaders.get(underlyingHeaders);\n if (cachedHeaders) {\n return cachedHeaders;\n }\n const promise = Promise.resolve(underlyingHeaders);\n CachedHeaders.set(underlyingHeaders, promise);\n return promise;\n}\nfunction makeUntrackedHeadersWithDevWarnings(underlyingHeaders, route, requestStore) {\n if (requestStore.asyncApiPromises) {\n const promise = (0, _workunitasyncstorageexternal.isInEarlyRenderStage)(requestStore) ? requestStore.asyncApiPromises.earlyHeaders : requestStore.asyncApiPromises.headers;\n return instrumentHeadersPromiseWithDevWarnings(promise, route);\n }\n const cachedHeaders = CachedHeaders.get(underlyingHeaders);\n if (cachedHeaders) {\n return cachedHeaders;\n }\n const promise = (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(underlyingHeaders, requestStore, _stagedrendering.RenderStage.Runtime);\n const proxiedPromise = instrumentHeadersPromiseWithDevWarnings(promise, route);\n CachedHeaders.set(underlyingHeaders, proxiedPromise);\n return proxiedPromise;\n}\nconst warnForSyncAccess = (0, _creatededupedbycallsiteservererrorlogger.createDedupedByCallsiteServerErrorLoggerDev)(createHeadersAccessError);\nfunction instrumentHeadersPromiseWithDevWarnings(promise, route) {\n Object.defineProperties(promise, {\n [Symbol.iterator]: replaceableWarningDescriptorForSymbolIterator(promise, route),\n append: replaceableWarningDescriptor(promise, 'append', route),\n delete: replaceableWarningDescriptor(promise, 'delete', route),\n get: replaceableWarningDescriptor(promise, 'get', route),\n has: replaceableWarningDescriptor(promise, 'has', route),\n set: replaceableWarningDescriptor(promise, 'set', route),\n getSetCookie: replaceableWarningDescriptor(promise, 'getSetCookie', route),\n forEach: replaceableWarningDescriptor(promise, 'forEach', route),\n keys: replaceableWarningDescriptor(promise, 'keys', route),\n values: replaceableWarningDescriptor(promise, 'values', route),\n entries: replaceableWarningDescriptor(promise, 'entries', route)\n });\n return promise;\n}\nfunction replaceableWarningDescriptor(target, prop, route) {\n return {\n enumerable: false,\n get () {\n warnForSyncAccess(route, `\\`headers().${prop}\\``);\n return undefined;\n },\n set (value) {\n Object.defineProperty(target, prop, {\n value,\n writable: true,\n configurable: true\n });\n },\n configurable: true\n };\n}\nfunction replaceableWarningDescriptorForSymbolIterator(target, route) {\n return {\n enumerable: false,\n get () {\n warnForSyncAccess(route, '`...headers()` or similar iteration');\n return undefined;\n },\n set (value) {\n Object.defineProperty(target, Symbol.iterator, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n },\n configurable: true\n };\n}\nfunction createHeadersAccessError(route, expression) {\n const prefix = route ? `Route \"${route}\" ` : 'This route ';\n return Object.defineProperty(new Error(`${prefix}used ${expression}. ` + `\\`headers()\\` returns a Promise and must be unwrapped with \\`await\\` or \\`React.use()\\` before accessing its properties. ` + `Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`), \"__NEXT_ERROR_CODE\", {\n value: \"E836\",\n enumerable: false,\n configurable: true\n });\n}\n\n//# sourceMappingURL=headers.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"draftMode\", {\n enumerable: true,\n get: function() {\n return draftMode;\n }\n});\nconst _workunitasyncstorageexternal = require(\"../app-render/work-unit-async-storage.external\");\nconst _workasyncstorageexternal = require(\"../app-render/work-async-storage.external\");\nconst _dynamicrendering = require(\"../app-render/dynamic-rendering\");\nconst _creatededupedbycallsiteservererrorlogger = require(\"../create-deduped-by-callsite-server-error-logger\");\nconst _staticgenerationbailout = require(\"../../client/components/static-generation-bailout\");\nconst _hooksservercontext = require(\"../../client/components/hooks-server-context\");\nconst _invarianterror = require(\"../../shared/lib/invariant-error\");\nconst _dynamicrenderingutils = require(\"../dynamic-rendering-utils\");\nconst _reflect = require(\"../web/spec-extension/adapters/reflect\");\nfunction draftMode() {\n const callingExpression = 'draftMode';\n const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();\n const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();\n if (!workStore || !workUnitStore) {\n (0, _workunitasyncstorageexternal.throwForMissingRequestStore)(callingExpression);\n }\n switch(workUnitStore.type){\n case 'prerender-runtime':\n // TODO(runtime-ppr): does it make sense to delay this? normally it's always microtasky\n return (0, _dynamicrenderingutils.delayUntilRuntimeStage)(workUnitStore, createOrGetCachedDraftMode(workUnitStore.draftMode, workStore));\n case 'request':\n return createOrGetCachedDraftMode(workUnitStore.draftMode, workStore);\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n // Inside of `\"use cache\"` or `unstable_cache`, draft mode is available if\n // the outmost work unit store is a request store (or a runtime prerender),\n // and if draft mode is enabled.\n const draftModeProvider = (0, _workunitasyncstorageexternal.getDraftModeProviderForCacheScope)(workStore, workUnitStore);\n if (draftModeProvider) {\n return createOrGetCachedDraftMode(draftModeProvider, workStore);\n }\n // Otherwise, we fall through to providing an empty draft mode.\n // eslint-disable-next-line no-fallthrough\n case 'prerender':\n case 'prerender-ppr':\n case 'prerender-legacy':\n // Return empty draft mode\n return createOrGetCachedDraftMode(null, workStore);\n case 'prerender-client':\n case 'validation-client':\n {\n const exportName = '`draftMode`';\n throw Object.defineProperty(new _invarianterror.InvariantError(`${exportName} must not be used within a Client Component. Next.js should be preventing ${exportName} from being included in Client Components statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E1046\",\n enumerable: false,\n configurable: true\n });\n }\n case 'generate-static-params':\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \\`${callingExpression}()\\` inside \\`generateStaticParams\\`. This is not supported because \\`generateStaticParams\\` runs at build time without an HTTP request. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), \"__NEXT_ERROR_CODE\", {\n value: \"E1132\",\n enumerable: false,\n configurable: true\n });\n default:\n return workUnitStore;\n }\n}\nfunction createOrGetCachedDraftMode(draftModeProvider, workStore) {\n const cacheKey = draftModeProvider ?? NullDraftMode;\n const cachedDraftMode = CachedDraftModes.get(cacheKey);\n if (cachedDraftMode) {\n return cachedDraftMode;\n }\n if (process.env.NODE_ENV === 'development' && !(workStore == null ? void 0 : workStore.isPrefetchRequest)) {\n const route = workStore == null ? void 0 : workStore.route;\n return createDraftModeWithDevWarnings(draftModeProvider, route);\n } else {\n return Promise.resolve(new DraftMode(draftModeProvider));\n }\n}\nconst NullDraftMode = {};\nconst CachedDraftModes = new WeakMap();\nfunction createDraftModeWithDevWarnings(underlyingProvider, route) {\n const instance = new DraftMode(underlyingProvider);\n const promise = Promise.resolve(instance);\n const proxiedPromise = new Proxy(promise, {\n get (target, prop, receiver) {\n switch(prop){\n case 'isEnabled':\n warnForSyncAccess(route, `\\`draftMode().${prop}\\``);\n break;\n case 'enable':\n case 'disable':\n {\n warnForSyncAccess(route, `\\`draftMode().${prop}()\\``);\n break;\n }\n default:\n {\n // We only warn for well-defined properties of the draftMode object.\n }\n }\n return _reflect.ReflectAdapter.get(target, prop, receiver);\n }\n });\n return proxiedPromise;\n}\nclass DraftMode {\n constructor(provider){\n this._provider = provider;\n }\n get isEnabled() {\n if (this._provider !== null) {\n return this._provider.isEnabled;\n }\n return false;\n }\n enable() {\n // We have a store we want to track dynamic data access to ensure we\n // don't statically generate routes that manipulate draft mode.\n trackDynamicDraftMode('draftMode().enable()', this.enable);\n if (this._provider !== null) {\n this._provider.enable();\n }\n }\n disable() {\n trackDynamicDraftMode('draftMode().disable()', this.disable);\n if (this._provider !== null) {\n this._provider.disable();\n }\n }\n}\nconst warnForSyncAccess = (0, _creatededupedbycallsiteservererrorlogger.createDedupedByCallsiteServerErrorLoggerDev)(createDraftModeAccessError);\nfunction createDraftModeAccessError(route, expression) {\n const prefix = route ? `Route \"${route}\" ` : 'This route ';\n return Object.defineProperty(new Error(`${prefix}used ${expression}. ` + `\\`draftMode()\\` returns a Promise and must be unwrapped with \\`await\\` or \\`React.use()\\` before accessing its properties. ` + `Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`), \"__NEXT_ERROR_CODE\", {\n value: \"E835\",\n enumerable: false,\n configurable: true\n });\n}\nfunction trackDynamicDraftMode(expression, constructorOpt) {\n const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();\n const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();\n if (workStore) {\n // We have a store we want to track dynamic data access to ensure we\n // don't statically generate routes that manipulate draft mode.\n if ((workUnitStore == null ? void 0 : workUnitStore.phase) === 'after') {\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \"${expression}\" inside \\`after()\\`. The enabled status of \\`draftMode()\\` can be read inside \\`after()\\` but you cannot enable or disable \\`draftMode()\\`. See more info here: https://nextjs.org/docs/app/api-reference/functions/after`), \"__NEXT_ERROR_CODE\", {\n value: \"E845\",\n enumerable: false,\n configurable: true\n });\n }\n if (workStore.dynamicShouldError) {\n throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${workStore.route} with \\`dynamic = \"error\"\\` couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), \"__NEXT_ERROR_CODE\", {\n value: \"E553\",\n enumerable: false,\n configurable: true\n });\n }\n if (workUnitStore) {\n switch(workUnitStore.type){\n case 'cache':\n case 'private-cache':\n {\n const error = Object.defineProperty(new Error(`Route ${workStore.route} used \"${expression}\" inside \"use cache\". The enabled status of \\`draftMode()\\` can be read in caches but you must not enable or disable \\`draftMode()\\` inside a cache. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), \"__NEXT_ERROR_CODE\", {\n value: \"E829\",\n enumerable: false,\n configurable: true\n });\n Error.captureStackTrace(error, constructorOpt);\n workStore.invalidDynamicUsageError ??= error;\n throw error;\n }\n case 'unstable-cache':\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \"${expression}\" inside a function cached with \\`unstable_cache()\\`. The enabled status of \\`draftMode()\\` can be read in caches but you must not enable or disable \\`draftMode()\\` inside a cache. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), \"__NEXT_ERROR_CODE\", {\n value: \"E844\",\n enumerable: false,\n configurable: true\n });\n case 'prerender':\n case 'prerender-runtime':\n {\n const error = Object.defineProperty(new Error(`Route ${workStore.route} used ${expression} without first calling \\`await connection()\\`. See more info here: https://nextjs.org/docs/messages/next-prerender-sync-headers`), \"__NEXT_ERROR_CODE\", {\n value: \"E126\",\n enumerable: false,\n configurable: true\n });\n return (0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(workStore.route, expression, error, workUnitStore);\n }\n case 'prerender-client':\n case 'validation-client':\n const exportName = '`draftMode`';\n throw Object.defineProperty(new _invarianterror.InvariantError(`${exportName} must not be used within a Client Component. Next.js should be preventing ${exportName} from being included in Client Components statically, but did not in this case.`), \"__NEXT_ERROR_CODE\", {\n value: \"E1046\",\n enumerable: false,\n configurable: true\n });\n case 'prerender-ppr':\n return (0, _dynamicrendering.postponeWithTracking)(workStore.route, expression, workUnitStore.dynamicTracking);\n case 'prerender-legacy':\n workUnitStore.revalidate = 0;\n const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${workStore.route} couldn't be rendered statically because it used \\`${expression}\\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), \"__NEXT_ERROR_CODE\", {\n value: \"E558\",\n enumerable: false,\n configurable: true\n });\n workStore.dynamicUsageDescription = expression;\n workStore.dynamicUsageStack = err.stack;\n throw err;\n case 'request':\n (0, _dynamicrendering.trackDynamicDataInDynamicRender)(workUnitStore);\n break;\n case 'generate-static-params':\n throw Object.defineProperty(new Error(`Route ${workStore.route} used \\`${expression}\\` inside \\`generateStaticParams\\`. This is not supported because \\`generateStaticParams\\` runs at build time without an HTTP request. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), \"__NEXT_ERROR_CODE\", {\n value: \"E1121\",\n enumerable: false,\n configurable: true\n });\n default:\n workUnitStore;\n }\n }\n }\n}\n\n//# sourceMappingURL=draft-mode.js.map","module.exports.cookies = require('./dist/server/request/cookies').cookies\nmodule.exports.headers = require('./dist/server/request/headers').headers\nmodule.exports.draftMode = require('./dist/server/request/draft-mode').draftMode\n","function e(e){return()=>{throw new Error(`\\`${e}\\` is not supported in Client Components.`)}}function t(...t){return e(\"getRequestConfig\")}const n=e(\"getFormatter\"),o=e(\"getNow\"),r=e(\"getTimeZone\"),s=e(\"getMessages\"),g=e(\"getLocale\"),i=e(\"getExtracted\"),a=e(\"getTranslations\"),u=e(\"setRequestLocale\");export{i as getExtracted,n as getFormatter,g as getLocale,s as getMessages,o as getNow,t as getRequestConfig,r as getTimeZone,a as getTranslations,u as setRequestLocale};\n","import { cookies, headers } from \"next/headers\";\nimport { getRequestConfig } from \"next-intl/server\";\n\n// Client-safe primitives live in `lib/locales.ts` so client components can\n// import them without dragging this server-only module (and `next/headers`)\n// into the browser bundle. Re-exported here for back-compat with any\n// existing `from \"@/lib/i18n\"` imports on the server side.\nexport {\n DEFAULT_LOCALE,\n isSupportedLocale,\n SUPPORTED_LOCALES,\n type SupportedLocale,\n} from \"./locales\";\n\nimport { DEFAULT_LOCALE, isSupportedLocale, type SupportedLocale } from \"./locales\";\n\n/**\n * Best-match a raw `Accept-Language` header against `SUPPORTED_LOCALES`.\n * Walks the quality-ordered list, strips region tags (`uk-UA` → `uk`),\n * and returns the first supported hit. `null` when nothing matches.\n */\nfunction matchAcceptLanguage(header: string | null): SupportedLocale | null {\n if (!header) return null;\n const tags = header\n .split(\",\")\n .map((part) => part.split(\";\")[0].trim().toLowerCase())\n .filter(Boolean);\n for (const tag of tags) {\n const base = tag.split(\"-\")[0];\n if (isSupportedLocale(base)) return base;\n }\n return null;\n}\n\n/**\n * Server-side request config — next-intl invokes this on every render\n * to pick the locale + load its messages bundle. Resolution order:\n *\n * 1. next-intl `requestLocale` (set by routing/middleware, if any)\n * 2. `wexio-locale` cookie (per-visitor preference / manual override)\n * 3. `Accept-Language` header best-match against `SUPPORTED_LOCALES`\n * 4. `DEFAULT_LOCALE` fallback\n *\n * The client embeds (web-component / react-component) resolve locale\n * separately via `detectClientLocale` (adds `?lang=` support); this\n * server path covers the Next iframe app.\n */\nexport default getRequestConfig(async ({ requestLocale }) => {\n const locale = await resolveServerLocale(requestLocale);\n // The `demo` namespace (mock news / help / conversation content) lives\n // in its own `messages/demo.<locale>.json` so the demo strings stay out\n // of the operator-facing chrome file. Merge it back under `demo` —\n // `useTranslations(\"demo\")` is called unconditionally by several\n // components (the demo content is only READ when `isDummy`), so the\n // namespace must exist for every locale or those hooks throw\n // MISSING_MESSAGE (which is exactly the `uk` error we hit).\n const [base, demo] = await Promise.all([\n import(`@/messages/${locale}.json`),\n import(`@/messages/demo.${locale}.json`),\n ]);\n return {\n locale,\n messages: { ...base.default, demo: demo.default },\n };\n});\n\nasync function resolveServerLocale(\n requestLocale: Promise<string | undefined>,\n): Promise<SupportedLocale> {\n const requested = await requestLocale;\n if (isSupportedLocale(requested)) return requested;\n\n try {\n const hdrs = await headers();\n // `?lang=` for this render — set by `middleware.ts` (also persisted\n // to the cookie below for subsequent navigations).\n const fromQuery = hdrs.get(\"x-wexio-locale\");\n if (isSupportedLocale(fromQuery)) return fromQuery;\n\n const cookieLocale = (await cookies()).get(\"wexio-locale\")?.value;\n if (isSupportedLocale(cookieLocale)) return cookieLocale;\n\n const fromHeader = matchAcceptLanguage(hdrs.get(\"accept-language\"));\n if (fromHeader) return fromHeader;\n } catch {\n // `headers()` / `cookies()` unavailable (e.g. static render) — fall\n // through to the default.\n }\n\n return DEFAULT_LOCALE;\n}\n","import { DEFAULT_LOCALE, SUPPORTED_LOCALES, type SupportedLocale } from \"./i18n\";\n\n/**\n * Resolve the active locale on the client. Used by the widget shell\n * to set `NextIntlClientProvider`'s `locale` on mount.\n *\n * Resolution order:\n *\n * 1. `?lang=` URL search param — explicit dev / marketing override\n * 2. `wexio-locale` cookie — persisted explicit override\n * 3. operator `localeStrategy`:\n * - a pinned code (`en` / `uk`) — use it\n * - `WEBSITE` — host page `<html lang>`\n * - `AUTO` (or unset) — fall through to the browser\n * 4. `navigator.language` — browser preference\n * 5. `DEFAULT_LOCALE`\n *\n * `strategy` comes from the operator's BE config (`WidgetConfig.localeStrategy`).\n * It's the operator's choice of HOW to pick the visitor's language; the\n * explicit `?lang=` / cookie signals still sit above it as dev / preview\n * escape hatches. When `strategy` is omitted the behaviour is identical to\n * the legacy `?lang=` → cookie → `navigator.language` chain.\n *\n * Every raw value is normalised the same way: lower-cased and stripped of\n * its region tag, splitting on BOTH `-` and `_` so `uk-UA`, `uk-UK`, and a\n * POSIX-style `uk_UA` all collapse to `uk` before matching against\n * `SUPPORTED_LOCALES`.\n */\nexport function detectClientLocale(strategy?: string): SupportedLocale {\n if (typeof window === \"undefined\") return DEFAULT_LOCALE;\n\n // 1. Explicit `?lang=` override — wins over everything (dev, marketing\n // tour, dashboard preview), regardless of the operator's strategy.\n const url = new URL(window.location.href);\n const fromUrl = matchLocale(url.searchParams.get(\"lang\"));\n if (fromUrl) return fromUrl;\n\n // 2. Persisted explicit override (the cookie middleware sets from `?lang=`).\n const fromCookie = matchLocale(readCookie(\"wexio-locale\"));\n if (fromCookie) return fromCookie;\n\n // 3. Operator strategy.\n if (strategy && strategy !== \"AUTO\" && strategy !== \"WEBSITE\") {\n // Pinned to a specific language. If the operator pinned a code the\n // widget bundle doesn't ship, fall through rather than render a\n // broken/untranslated UI.\n const pinned = matchLocale(strategy);\n if (pinned) return pinned;\n } else if (strategy === \"WEBSITE\") {\n // Match the host page — `<html lang=\"…\">`, which a site's own\n // language switcher keeps in sync. The widget shares the host\n // document in web-component / react-component mode, so this reads\n // the host's attribute directly. Falls through to the browser when\n // the page declares no (supported) language.\n const fromPage = matchLocale(document.documentElement.lang);\n if (fromPage) return fromPage;\n }\n\n // 4. Browser preference — also the `AUTO` path.\n const fromNav = matchLocale(navigator.language);\n if (fromNav) return fromNav;\n\n return DEFAULT_LOCALE;\n}\n\n/**\n * Normalise a raw locale-ish string (`\"uk-UA\"`, `\"UK_uk\"`, `\"en\"`) and\n * return it only if its base language is one we ship. `null` for empty /\n * unsupported input so callers can use it in a `??` / `if` chain.\n */\nfunction matchLocale(raw: string | null | undefined): SupportedLocale | null {\n if (!raw) return null;\n const base = raw.toLowerCase().split(/[-_]/)[0];\n return (SUPPORTED_LOCALES as readonly string[]).includes(base) ? (base as SupportedLocale) : null;\n}\n\nfunction readCookie(name: string): string | null {\n const cookies = document.cookie.split(\";\");\n for (const raw of cookies) {\n const [key, ...rest] = raw.trim().split(\"=\");\n if (key === name) return decodeURIComponent(rest.join(\"=\"));\n }\n return null;\n}\n","/**\n * React-component bundle stylesheet. Points at the same Tailwind layer\n * + theme tokens as the iframe/web-component builds so all three\n * delivery modes share one CSS source of truth.\n *\n * Inlined into the JS bundle via `?inline` and adopted into a Shadow\n * DOM portal so widget styles can't leak into (or absorb from) the\n * host React tree's stylesheet.\n */\n@import \"../app/globals.css\";\n","\"use client\";\n\nimport { ApolloProvider as Provider } from \"@apollo/client/react\";\nimport { NextIntlClientProvider } from \"next-intl\";\nimport { type ReactNode, useEffect, useMemo, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { WidgetShell } from \"@/components/widget/widget-shell\";\nimport { getApolloClient, setPublicKey } from \"@/lib/apollo-client\";\nimport { detectClientLocale } from \"@/lib/locale-detect\";\nimport {\n type VisitorIdentity,\n type VisitorPrefill,\n type WidgetEnv,\n WidgetEnvProvider,\n} from \"@/lib/use-widget-env\";\nimport type { InjectableWidgetConfig, WidgetConfig } from \"@/lib/widget-config\";\nimport demoEn from \"@/messages/demo.en.json\";\nimport demoUk from \"@/messages/demo.uk.json\";\nimport enMessages from \"@/messages/en.json\";\nimport ukMessages from \"@/messages/uk.json\";\n\n// Inlined Tailwind layer + theme tokens. Vite resolves `?inline` at\n// build time; the type lives in `styles.css.d.ts`. We adopt this into\n// the Shadow DOM portal so widget styles never collide with the host\n// React tree's stylesheet.\nimport widgetStyles from \"./styles.css?inline\";\n\ntype SupportedLocale = \"en\" | \"uk\";\n\n// `demo` is a separate file (mock content kept out of the chrome bundle)\n// merged back in under the `demo` key — `useTranslations(\"demo\")` is\n// called unconditionally, so the namespace must exist for every locale.\nconst LOCALE_MESSAGES: Record<SupportedLocale, Record<string, unknown>> = {\n en: { ...enMessages, demo: demoEn },\n uk: { ...ukMessages, demo: demoUk },\n};\n\nexport interface WexioWidgetProps {\n /**\n * Wexio integration public key — `pk_live_...`. Omit for demo mode\n * (renders the bundled `DEMO_CONFIG` so marketing sites and\n * Storybook stories work without a backend).\n */\n publicKey?: string;\n /**\n * UI locale. Defaults to `\"en\"`. Web-widget v1 ships English +\n * Ukrainian; extend `LOCALE_MESSAGES` in `react-component/index.tsx`\n * + `messages/<code>.json` to add more.\n */\n locale?: SupportedLocale;\n /**\n * Log a known user into the widget (the React equivalent of\n * Intercom's `boot({ user_id, ... })`). `userId` + `userHash` are the\n * verified identity — `userHash` is an HMAC-SHA256 of `userId` you\n * compute server-side with the integration secret. `name` / `email` /\n * `phone` populate the People profile; `attributes` is an open bag of\n * extra fields. Omit to keep the visitor anonymous.\n *\n * **Memoise this** — a fresh object literal every render churns the\n * env (the handshake itself is guarded against re-firing unless the\n * `userId`/`userHash` actually change).\n */\n user?: VisitorIdentity;\n /**\n * Default profile values to PRE-FILL the prechat form — the lighter,\n * unverified cousin of `user` (no `userHash`). When they cover every\n * required prechat field the widget attaches them + skips the form;\n * otherwise it pre-fills what it can. Use for a logged-in host that\n * knows the visitor's details but isn't doing verified identity.\n */\n prefill?: VisitorPrefill;\n /**\n * Override the resolved widget mode. In normal operator + visitor\n * use, leave undefined — it auto-resolves to `production` when a\n * `publicKey` is set, `demo` otherwise. Set `\"preview\"` only if you\n * also want the iframe-style `wexio:preview-config:v1` postMessage\n * channel active; for a React host, prefer `configOverride` below.\n */\n mode?: \"production\" | \"preview\" | \"demo\";\n /**\n * Live config patch — the operator dashboard's in-progress draft.\n * Merged on top of the resolved config (BE / demo) on every render,\n * so the preview pane reflects unsaved edits instantly with no\n * postMessage serialization. Covers everything in `WidgetConfig`:\n * `theme` (colors / fonts / radii), `themeMode`, `features` (which\n * tabs), `defaultTab`, `greeting`, `prechatForm`, `branding`,\n * `operatorAvatars`, `organizationLogoUrl`, `sounds`.\n *\n * NOT covered (not part of `WidgetConfig`): the Home-tab block\n * layout, and Help/News article content — those are fetched by the\n * widget from the BE at runtime, so previewing unsaved versions of\n * them needs a separate mechanism.\n *\n * **Memoise this** on the host side — a fresh object literal every\n * render re-runs the merge (cheap, but tidier to avoid).\n */\n configOverride?: Partial<WidgetConfig>;\n /**\n * Full, pre-resolved widget config. When provided, the widget boots\n * from it directly and SKIPS the `GET /api/web/config/:pk` bootstrap\n * request — for a host that already has the config (server-rendered it,\n * or fetched it once app-wide). `configOverride` still layers on top.\n * Keeps the live data layer (real chat / help / news); add `useDummyData`\n * if you also want mock content.\n *\n * Still pass `publicKey` — it's needed for the GraphQL header + the\n * visitor handshake; only the CONFIG fetch is skipped. The config's\n * localized chrome is whatever you pass, so re-supply it on a locale\n * change (there's no fetch to re-run).\n *\n * Typed `InjectableWidgetConfig`: `branding` + `status` (server-/plan-\n * owned) and `integrationId` / `name` (optional identity) are excluded —\n * a host can't override the paid white-label / plan gate from props; the\n * widget fills those itself. Pass the rest (theme / messenger / features\n * / homeLayout / greeting / prechat / sounds / security / locales).\n *\n * **Memoise this** — a fresh object literal every render re-runs the\n * env memo (harmless, but tidier to avoid).\n */\n config?: InjectableWidgetConfig;\n /**\n * Force the widget's data layer into mock mode regardless of whether a\n * `publicKey` was supplied. The dashboard's preview pane uses this so a\n * brand-new integration (with empty BE-side content) still shows a\n * populated widget — sample conversations, help articles, news, FAQs,\n * launcher unread count, operator avatars — on top of the operator's\n * real config (theme / logo / greeting / blocks / prechat / sounds all\n * flow through untouched, in either mode).\n */\n useDummyData?: boolean;\n /**\n * Dashboard-prefetched data for the preview pane. When the dashboard\n * already has operator-side news posts loaded, it can inject them\n * here and the widget will render those instead of round-tripping to\n * the BE's visitor surface. Lets the preview show real data without\n * the widget needing dashboard-origin authorization.\n *\n * Production embeds leave this undefined — visitor queries handle\n * data fetching normally.\n */\n previewData?: {\n /** Array of news posts for the News tab + `news-preview` home\n * block. Same JSON shape the BE's `visitorNewsFeed` returns; the\n * widget's extractors accept operator-side `NewsPost` rows\n * unchanged. */\n newsPosts?: unknown[];\n /** Id-keyed lookup for the `featured-article` home block. */\n newsPostsById?: Record<string, unknown>;\n /** Array of help articles for the Help tab + `pinned-articles`\n * home block + article detail. Operator-side `HelpArticle` row\n * shape, accepted by the same extractors as visitor JSON. */\n helpArticles?: unknown[];\n /** Id-keyed lookup for the `pinned-articles` home block. */\n helpArticlesById?: Record<string, unknown>;\n };\n /**\n * Render the media lightbox (image / video gallery) as a\n * viewport-`fixed` overlay instead of one contained to this widget's\n * host box. Leave unset for a normal embed — the gallery stays\n * inside the box. Set `true` when the widget itself is rendered very\n * small (e.g. a dashboard's floating mobile-preview), so the gallery\n * is still usable. The overlay keeps the widget's Shadow-DOM styles\n * either way.\n */\n lightboxViewport?: boolean;\n /**\n * Notified every time the widget's intended dimensions change\n * (open ↔ closed ↔ expanded). Use for host-side layout sync —\n * e.g. push other UI aside when the panel opens.\n */\n onResize?: (size: { width: number; height: number }) => void;\n /**\n * Fired when the visitor taps the close chip. The widget hides\n * itself; the host may want to unmount the component or shrink\n * its container.\n */\n onClose?: () => void;\n /**\n * Pass-through wrapper class. The widget itself paints into a\n * Shadow DOM; this class lands on the outer host `<div>` you can\n * size + position with normal layout CSS.\n */\n className?: string;\n /**\n * Pass-through inline styles for the outer host `<div>`. Same\n * positioning role as `className` — pick whichever fits your\n * codebase.\n */\n style?: React.CSSProperties;\n}\n\n/**\n * `<WexioWidget />` — native React component embed for the Wexio web\n * messenger.\n *\n * Same `WidgetShell` React tree as the iframe / web-component builds,\n * mounted inside a Shadow DOM portal so styles stay isolated from the\n * host's React app. Host integrates via standard React idioms:\n *\n * ```tsx\n * <WexioWidget\n * publicKey=\"pk_live_...\"\n * locale=\"en\"\n * onResize={({ width, height }) => layout.reserve(width, height)}\n * onClose={() => setShowChat(false)}\n * className=\"fixed bottom-5 right-5 w-[420px] h-[720px]\"\n * />\n * ```\n *\n * **Why a Shadow DOM portal** — the alternative (direct render into\n * the host tree) means Tailwind classes from the widget collide with\n * the host's stylesheet, theme tokens leak, and any CSS reset on the\n * host page breaks the widget's layout. The portal gives us the\n * isolation of an iframe with the React-API of a native component.\n *\n * **SSR-safe** — renders `null` on the server. The shadow root +\n * portal target mount on first `useEffect`. Wrap with\n * `<Suspense fallback={null}>` if you need to defer hydration in\n * RSC-heavy apps.\n */\nexport function WexioWidget({\n publicKey,\n // No default: when the host doesn't pin a `locale`, fall back to the\n // visitor's browser via `detectClientLocale()` (resolved below).\n locale,\n user,\n prefill,\n mode,\n configOverride,\n config,\n useDummyData,\n previewData,\n lightboxViewport,\n onResize,\n onClose,\n className,\n style,\n}: WexioWidgetProps) {\n const hostRef = useRef<HTMLDivElement | null>(null);\n const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);\n // Resolved UI locale. Phase 1: an explicit `locale` prop, else the\n // browser (`detectClientLocale()` with no strategy yet). Phase 2: once\n // `useWidgetConfig` reports the operator's `localeStrategy` via the env\n // callback below, re-resolve (e.g. switch to the host page's\n // `<html lang>` for `WEBSITE`, or a pinned code). An explicit prop\n // pins it — the strategy callback is then a no-op.\n const [resolvedLocale, setResolvedLocale] = useState<SupportedLocale>(\n () => locale ?? detectClientLocale(),\n );\n // Keep the explicit prop authoritative if the host changes it.\n useEffect(() => {\n if (locale) setResolvedLocale(locale);\n }, [locale]);\n // The shadow root — handed to the widget via `env.styleRoot` so its\n // theme-token `<style>` block is injected INSIDE the shadow DOM\n // (self-contained theming; never touches the host page's `<head>`).\n const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);\n\n // Keep the latest callbacks accessible to the env without re-creating\n // the env object on every host re-render — that would loop the\n // resize effect inside `WidgetShell` (which has `env` in its deps).\n const onResizeRef = useRef(onResize);\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onResizeRef.current = onResize;\n onCloseRef.current = onClose;\n }, [onResize, onClose]);\n\n // Stamp the apollo singleton's public-key synchronously the first\n // time we have one — same trick the web-component path uses to\n // avoid racing the first GraphQL request against the effect inside\n // `ApolloProvider`.\n useEffect(() => {\n setPublicKey(publicKey ?? null);\n }, [publicKey]);\n\n // Mount the shadow root once, on the first commit on the client.\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n // `attachShadow` throws if called twice on the same element —\n // React StrictMode double-invokes effects in dev, so re-use any\n // existing root rather than recreating it.\n const shadow = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n\n // Adopt the bundled Tailwind layer + theme tokens. Falls back to\n // a `<style>` node when constructable stylesheets are unavailable\n // (older Safari / Firefox-ESR).\n if (typeof CSSStyleSheet !== \"undefined\" && \"replaceSync\" in CSSStyleSheet.prototype) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(widgetStyles);\n shadow.adoptedStyleSheets = [...(shadow.adoptedStyleSheets ?? []), sheet];\n } else if (!shadow.querySelector(\"style[data-wexio-style]\")) {\n const styleNode = document.createElement(\"style\");\n styleNode.setAttribute(\"data-wexio-style\", \"true\");\n styleNode.textContent = widgetStyles;\n shadow.appendChild(styleNode);\n }\n\n // Portal target — a plain div inside the shadow root that React\n // renders the `WidgetShell` tree into.\n let target = shadow.querySelector<HTMLDivElement>(\"div[data-wexio-portal-target]\");\n if (!target) {\n target = document.createElement(\"div\");\n target.setAttribute(\"data-wexio-portal-target\", \"true\");\n target.style.display = \"contents\";\n shadow.appendChild(target);\n }\n setPortalTarget(target);\n setShadowRoot(shadow);\n }, []);\n\n // Build the env per (mode, publicKey, configOverride) — the inner\n // callbacks route through refs so updating an `onResize` prop\n // doesn't bust the env reference. `configOverride` IS in the deps:\n // when the dashboard editor edits a token the env changes, which\n // flows into `useWidgetConfig`'s effective-config `useMemo`. The\n // shell's resize effect also re-runs on that change — harmless\n // (it just re-reports unchanged dimensions), as long as the host\n // memoises `configOverride` so it only changes on real edits.\n const env = useMemo<WidgetEnv>(() => {\n return {\n kind: \"web-component\",\n publicKeyOverride: publicKey,\n modeOverride: mode ?? (publicKey ? \"production\" : \"demo\"),\n configOverride,\n // Full config injection — skips the bootstrap `GET /config`.\n configBase: config,\n forceDummyData: useDummyData,\n previewData,\n // The React embed always lives inside a host-controlled `<div>` —\n // anchor the launcher + panel to that box, not the viewport, so the\n // widget can be dropped into a dashboard preview pane (or any sized\n // container) without escaping to a fixed viewport corner. The host\n // gives the outer `<div>` its positioning context via `className` /\n // `style` (`relative` / `absolute` / `fixed` all establish one).\n embedded: true,\n // Known-user identity (Intercom-style boot). Routes the visitor\n // handshake to the identified flow; omit to stay anonymous.\n visitorIdentity: user,\n // Unverified default profile — pre-fills / auto-attaches the prechat.\n visitorPrefill: prefill,\n // Gallery overlay scope — `true` breaks the lightbox out to the\n // full viewport (for hosts that render the widget very small).\n lightboxViewport: lightboxViewport ?? false,\n // Self-contained theming: `data-theme` goes on the portal-target\n // element and the operator's theme `<style>` is injected into the\n // shadow root — so the dark-mode structural rules in `globals.css`\n // (adopted into this same shadow tree) actually match. Both are\n // `undefined` until the shadow root mounts, but `WidgetShell` only\n // renders once `portalTarget` exists, so the hooks that read these\n // always see the resolved values.\n themeRoot: portalTarget ?? undefined,\n styleRoot: shadowRoot ?? undefined,\n onResize: (width, height) => {\n onResizeRef.current?.({ width, height });\n },\n onClose: () => {\n onCloseRef.current?.();\n },\n // Phase 2 of locale resolution — `useWidgetConfig` reports the\n // operator's strategy here once the config lands. Skip entirely\n // when the host pinned an explicit `locale` prop.\n onLocaleStrategy: locale\n ? undefined\n : (strategy: string) => setResolvedLocale(detectClientLocale(strategy)),\n };\n }, [\n publicKey,\n mode,\n configOverride,\n config,\n useDummyData,\n previewData,\n lightboxViewport,\n portalTarget,\n shadowRoot,\n locale,\n user,\n prefill,\n ]);\n\n const tree = portalTarget\n ? createPortal(\n <ReactWidgetTree env={env} locale={resolvedLocale}>\n <WidgetShell />\n </ReactWidgetTree>,\n portalTarget,\n )\n : null;\n\n return (\n <div ref={hostRef} data-wexio-widget-host=\"true\" className={className} style={style}>\n {tree}\n </div>\n );\n}\n\n/**\n * Same provider stack the web-component path uses, factored out so we\n * don't duplicate the Apollo + NextIntl + WidgetEnv layering.\n */\nfunction ReactWidgetTree({\n env,\n locale,\n children,\n}: {\n env: WidgetEnv;\n locale: SupportedLocale;\n children: ReactNode;\n}) {\n const messages = LOCALE_MESSAGES[locale];\n // Memoise the apollo client lookup so React strict-mode's\n // double-effect doesn't churn it.\n const client = useMemo(() => getApolloClient(), []);\n return (\n <Provider client={client}>\n <NextIntlClientProvider locale={locale} messages={messages}>\n <WidgetEnvProvider env={env}>{children}</WidgetEnvProvider>\n </NextIntlClientProvider>\n </Provider>\n );\n}\n\n// Re-export `setPublicKey` for advanced consumers who want to stamp\n// the apollo client outside the component lifecycle (e.g. SSR data\n// fetching that needs the same header).\nexport { setPublicKey as setWexioPublicKey } from \"@/lib/apollo-client\";\n// Re-export the prop type so consumers can spread it through wrappers.\nexport type { WexioWidgetProps as WexioWidgetReactProps };\n"],"x_google_ignoreList":[0,1,2,3,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,64,65,66,67,68,69,88,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247],"mappings":";;;;;;;;;;;;;;;;;;;;;;;qCAIW,KAAiB,SAAU,GAAI;CACtC,IAAI,IAAS,EAAG,QAAQ,IAAW,EAAG,UAClC,IAAgB,GAAkB,EAClC,IAAgBA,GAAM,WAAW,EAAc,EAC/C,IAAUA,GAAM,QAAQ,WAAY;EACpC,OAAO,EAAS,EAAS,EAAE,EAAE,EAAc,EAAE,EAAE,QAAQ,KAAU,EAAc,QAAQ,CAAC;IACzF,CAAC,GAAe,EAAO,CAAC;CAE3B,OADA,GAAU,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