@domainkit/react 0.1.1 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["Root","mergeMessages","useController","useController","RequestState.useController","Flow","BaseDialog","failure","useController","Root","Status","BaseDialog","Provider.Mark","Dialog","Flow","RequestState.useController","Status","useController","RequestState.recordsIdentity","RequestState.useController","Flow","Records.Table","BaseDialog","RequestState.useController","RequestState.recordsIdentity","_exhaustive","RecordStatus","Connection.useController","Connection.Root","Connection.Status","Connection.RetryAction","BaseDialog","Connection.Trigger","Connection.Dialog","Provider.Mark","Provisioning.Flow","Verification.Status","Connection.DisconnectAction","Records.Table","Cleanup.Flow"],"sources":["../src/composition.tsx","../src/icons.tsx","../src/messages.ts","../src/theme.ts","../src/domain-kit.tsx","../src/request-state.ts","../src/cleanup.tsx","../src/provider.tsx","../src/connection.tsx","../src/records.tsx","../src/provisioning.tsx","../src/verification.tsx","../src/domain.tsx","../src/testing.ts","../src/transport.ts"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\";\nimport type { CSSProperties, ElementType, ReactElement } from \"react\";\n\nexport type ClassName<State> = string | ((state: State) => string | undefined);\nexport type Style<State> = CSSProperties | ((state: State) => CSSProperties | undefined);\n\nexport type PartProps<Tag extends ElementType, State extends Record<string, unknown>> = Omit<\n useRender.ElementProps<Tag>,\n \"className\" | \"style\"\n> & {\n readonly className?: ClassName<State>;\n readonly render?: useRender.RenderProp<State>;\n readonly style?: Style<State>;\n};\n\nexport function usePart<\n Tag extends keyof React.JSX.IntrinsicElements,\n State extends Record<string, unknown>,\n>(\n defaultTagName: Tag,\n componentProps: PartProps<Tag, State>,\n state: State,\n internalProps: Record<string, unknown>,\n): ReactElement {\n const { className, render, style, ...externalProps } = componentProps;\n const parameters: useRender.Parameters<State, Element, undefined> & {\n readonly className?: ClassName<State>;\n readonly style?: Style<State>;\n } = {\n ...(className === undefined ? {} : { className }),\n defaultTagName,\n props: [internalProps, externalProps] as unknown as Record<string, unknown>,\n ...(render === undefined ? {} : { render }),\n state,\n ...(style === undefined ? {} : { style }),\n };\n return useRender(parameters);\n}\n","import { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nexport type Icons = {\n readonly copied: ReactNode;\n readonly copy: ReactNode;\n readonly download: ReactNode;\n};\n\nfunction Glyph({ children }: { readonly children: ReactNode }) {\n return (\n <svg\n aria-hidden=\"true\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n viewBox=\"0 0 24 24\"\n >\n {children}\n </svg>\n );\n}\n\nexport const defaultIcons = {\n copied: (\n <Glyph>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n ),\n copy: (\n <Glyph>\n <rect height=\"14\" rx=\"2\" width=\"14\" x=\"8\" y=\"8\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </Glyph>\n ),\n download: (\n <Glyph>\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <path d=\"m7 10 5 5 5-5\" />\n <path d=\"M12 15V3\" />\n </Glyph>\n ),\n} as const satisfies Icons;\n\nconst IconsContext = createContext<Icons>(defaultIcons);\n\nexport function IconsProvider({\n children,\n icons,\n}: {\n readonly children: ReactNode;\n readonly icons?: Partial<Icons>;\n}) {\n const value = useMemo<Icons>(\n () => ({\n copied: icons?.copied ?? defaultIcons.copied,\n copy: icons?.copy ?? defaultIcons.copy,\n download: icons?.download ?? defaultIcons.download,\n }),\n [icons],\n );\n return <IconsContext.Provider value={value}>{children}</IconsContext.Provider>;\n}\n\nexport function useIcons(): Icons {\n return useContext(IconsContext);\n}\n","export interface Catalog {\n readonly applyCleanup: string;\n readonly applyDns: string;\n readonly applyingDns: string;\n readonly automaticUnavailable: string;\n readonly cancel: string;\n readonly checkAgain: string;\n readonly checkingDns: string;\n readonly checkDns: string;\n readonly cleanupComplete: string;\n readonly cleanupConsent: string;\n readonly cleanupPartial: string;\n readonly cleaningDns: string;\n readonly connectProvider: (provider: string) => string;\n readonly connected: (provider: string) => string;\n readonly connecting: string;\n readonly close: string;\n readonly detectingProvider: string;\n readonly disconnectDomain: string;\n readonly disconnecting: string;\n readonly domainDisconnected: string;\n readonly dialogDescription: (domain: string) => string;\n readonly dialogTitle: (provider: string) => string;\n readonly openingAuthorization: string;\n readonly planConsent: string;\n readonly planningCleanup: string;\n readonly planningDns: string;\n readonly recordsApplied: string;\n readonly recordsPartiallyApplied: string;\n readonly reviewCleanup: string;\n readonly reviewDns: string;\n readonly retry: string;\n readonly reuseConnection: (connection: string) => string;\n readonly tokenLabel: string;\n}\n\nexport const english: Catalog = {\n applyCleanup: \"Remove records\",\n applyDns: \"Add records\",\n applyingDns: \"Adding records…\",\n automaticUnavailable: \"Automatic connection is not available for this domain\",\n cancel: \"Cancel\",\n checkAgain: \"Check again\",\n checkingDns: \"Checking DNS…\",\n checkDns: \"Check DNS\",\n cleanupComplete: \"DNS cleanup complete\",\n cleanupConsent: \"Only records proven by the apply receipt will be deleted.\",\n cleanupPartial: \"Some DNS records could not be deleted. Review and retry safely.\",\n cleaningDns: \"Removing records…\",\n connectProvider: () => \"Connect\",\n connected: (provider) => `${provider} connected`,\n connecting: \"Connecting…\",\n close: \"Close\",\n detectingProvider: \"Detecting DNS provider…\",\n disconnectDomain: \"Disconnect\",\n disconnecting: \"Disconnecting…\",\n domainDisconnected: \"Domain disconnected. DNS records were preserved.\",\n dialogDescription: (domain) => `Authorize DNS changes for ${domain}.`,\n dialogTitle: (provider) => `Connect ${provider}`,\n openingAuthorization: \"Opening provider authorization…\",\n planConsent: \"Review the exact DNS operations before approving this plan.\",\n planningCleanup: \"Preparing cleanup…\",\n planningDns: \"Preparing DNS changes…\",\n recordsApplied: \"DNS changes applied\",\n recordsPartiallyApplied: \"Some DNS changes failed. Review and retry safely.\",\n reviewCleanup: \"Remove records\",\n reviewDns: \"Review changes\",\n retry: \"Try again\",\n reuseConnection: (connection) => `Use ${connection}`,\n tokenLabel: \"API token\",\n};\n\nexport const merge = (overrides: Partial<Catalog> = {}): Catalog => ({ ...english, ...overrides });\n","import type { CSSProperties } from \"react\";\n\nexport interface Theme {\n readonly accent?: string;\n readonly accentContrast?: string;\n readonly background?: string;\n readonly border?: string;\n readonly danger?: string;\n readonly fill?: string;\n readonly fontFamily?: string;\n readonly muted?: string;\n readonly radius?: string;\n readonly shadow?: string;\n readonly success?: string;\n readonly text?: string;\n}\n\nconst variables = {\n accent: \"--domainkit-accent\",\n accentContrast: \"--domainkit-accent-contrast\",\n background: \"--domainkit-background\",\n border: \"--domainkit-border\",\n danger: \"--domainkit-danger\",\n fill: \"--domainkit-fill\",\n fontFamily: \"--domainkit-font-family\",\n muted: \"--domainkit-muted\",\n radius: \"--domainkit-radius\",\n shadow: \"--domainkit-shadow\",\n success: \"--domainkit-success\",\n text: \"--domainkit-text\",\n} as const satisfies Record<keyof Theme, string>;\n\nexport function toStyle(theme: Theme = {}): CSSProperties {\n return Object.fromEntries(\n Object.entries(theme).flatMap(([key, value]) =>\n value === undefined ? [] : [[variables[key as keyof Theme], value]],\n ),\n ) as CSSProperties;\n}\n","import {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useSyncExternalStore,\n type ReactNode,\n type RefObject,\n} from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport type { Icons } from \"./icons.tsx\";\nimport { IconsProvider } from \"./icons.tsx\";\nimport type { Catalog } from \"./messages.ts\";\nimport { merge as mergeMessages } from \"./messages.ts\";\nimport type { Marks } from \"./provider.tsx\";\nimport type { Theme } from \"./theme.ts\";\nimport { toStyle } from \"./theme.ts\";\nimport type { DomainKitTransport } from \"./transport.ts\";\n\nexport interface RootState extends Record<string, unknown> {\n readonly colorScheme: \"dark\" | \"inherit\" | \"light\";\n}\n\nexport interface RootProps extends Omit<PartProps<\"div\", RootState>, \"children\"> {\n readonly children: ReactNode;\n readonly colorScheme?: RootState[\"colorScheme\"];\n readonly icons?: Partial<Icons>;\n readonly messages?: Partial<Catalog>;\n readonly marks?: Marks;\n readonly navigate?: (url: string) => void;\n readonly portalContainer?: HTMLElement | null;\n readonly theme?: Theme;\n readonly transport: DomainKitTransport;\n}\n\ninterface ContextValue {\n readonly colorScheme: RootState[\"colorScheme\"];\n readonly navigate: (url: string) => void;\n readonly marks: Marks;\n readonly messages: Catalog;\n readonly portalContainer: RefObject<HTMLElement | null>;\n readonly themeStyle: ReturnType<typeof toStyle>;\n readonly transport: DomainKitTransport;\n}\n\nconst Context = createContext<ContextValue | null>(null);\n\nconst navigateInBrowser = (url: string): void => {\n if (typeof window === \"undefined\") {\n throw new Error(\"DomainKit OAuth navigation requires a browser or a custom navigate function\");\n }\n window.location.assign(url);\n};\n\nconst resolvePortalContainer = (\n container: HTMLElement | null,\n ownerDocument: Document | null,\n): HTMLElement | null => {\n if (container === null || ownerDocument === null) return null;\n return container.ownerDocument === ownerDocument && container.getRootNode() === ownerDocument\n ? container\n : null;\n};\n\nconst usePortalContainer = (container: HTMLElement | null): HTMLElement | null => {\n const ownerDocument = useMemo(() => container?.ownerDocument ?? null, [container]);\n const subscribe = useCallback(\n (notify: () => void) => {\n if (ownerDocument === null || typeof MutationObserver === \"undefined\") return () => {};\n const observer = new MutationObserver(notify);\n observer.observe(ownerDocument, { childList: true, subtree: true });\n return () => observer.disconnect();\n },\n [ownerDocument],\n );\n const getSnapshot = useCallback(\n () => resolvePortalContainer(container, ownerDocument),\n [container, ownerDocument],\n );\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n};\n\nexport function Root({\n children,\n colorScheme = \"inherit\",\n icons,\n marks = {},\n messages,\n navigate = navigateInBrowser,\n portalContainer = null,\n theme,\n transport,\n ...props\n}: RootProps) {\n const themeStyle = toStyle(theme);\n const resolvedPortalContainer = usePortalContainer(portalContainer);\n const portalContainerRef = useMemo<RefObject<HTMLElement | null>>(\n () => ({ current: resolvedPortalContainer }),\n [resolvedPortalContainer],\n );\n const content = usePart(\n \"div\",\n props,\n { colorScheme },\n {\n children,\n \"data-color-scheme\": colorScheme,\n \"data-domainkit-root\": \"\",\n style: themeStyle,\n },\n );\n return (\n <Context.Provider\n value={{\n colorScheme,\n marks,\n messages: mergeMessages(messages),\n navigate,\n portalContainer: portalContainerRef,\n themeStyle,\n transport,\n }}\n >\n <IconsProvider {...(icons === undefined ? {} : { icons })}>{content}</IconsProvider>\n </Context.Provider>\n );\n}\n\nexport function useDomainKit(): ContextValue {\n const value = useContext(Context);\n if (value === null)\n throw new Error(\"DomainKit components must be rendered inside DomainKit.Root\");\n return value;\n}\n","import { useCallback, useEffect, useInsertionEffect, useRef, useState } from \"react\";\n\nimport type { DnsRecord } from \"./transport.ts\";\n\nexport interface Controller<State> {\n readonly begin: (state: State) => number;\n readonly commit: (request: number, state: State) => boolean;\n readonly reset: (state: State) => void;\n readonly state: State;\n}\n\nexport function useController<State>(identity: string, initial: State): Controller<State> {\n const currentIdentity = useRef(identity);\n const revision = useRef(0);\n const [snapshot, setSnapshot] = useState(() => ({ identity, state: initial }));\n\n useInsertionEffect(() => {\n currentIdentity.current = identity;\n revision.current += 1;\n }, [identity]);\n\n useEffect(() => {\n setSnapshot({ identity, state: initial });\n }, [identity]);\n\n const begin = useCallback((state: State) => {\n const request = ++revision.current;\n setSnapshot({ identity: currentIdentity.current, state });\n return request;\n }, []);\n const commit = useCallback((request: number, state: State) => {\n if (revision.current !== request) return false;\n setSnapshot({ identity: currentIdentity.current, state });\n return true;\n }, []);\n const reset = useCallback((state: State) => {\n revision.current += 1;\n setSnapshot({ identity: currentIdentity.current, state });\n }, []);\n\n return {\n begin,\n commit,\n reset,\n state: snapshot.identity === identity ? snapshot.state : initial,\n };\n}\n\nexport const recordsIdentity = (records: ReadonlyArray<DnsRecord>): string =>\n JSON.stringify(\n records.map((record) => [\n record.id,\n record.name,\n record.priority ?? null,\n record.type,\n record.value,\n ]),\n );\n","import { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { useCallback } from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport * as RequestState from \"./request-state.ts\";\nimport type { CleanupPlan, CleanupResult, Connected, Failure } from \"./transport.ts\";\n\nexport type State =\n | { readonly _tag: \"Idle\" }\n | { readonly _tag: \"Planning\" }\n | { readonly _tag: \"Review\"; readonly plan: CleanupPlan }\n | { readonly _tag: \"Cleaning\"; readonly plan: CleanupPlan }\n | {\n readonly _tag: \"Cleaned\";\n readonly result: Extract<CleanupResult, { readonly _tag: \"Cleaned\" }>;\n }\n | {\n readonly _tag: \"Partial\";\n readonly result: Extract<CleanupResult, { readonly _tag: \"Partial\" }>;\n }\n | { readonly _tag: \"Stale\"; readonly message: string }\n | Failure;\n\nexport function useController(connection: Connected, receiptId: string) {\n const { transport } = useDomainKit();\n const requestState = RequestState.useController<State>(\n `${connection.connectionId}:${connection.domain}:${receiptId}`,\n { _tag: \"Idle\" },\n );\n const state = requestState.state;\n\n const plan = useCallback(async () => {\n const request = requestState.begin({ _tag: \"Planning\" });\n try {\n const result = await transport.cleanup.plan({\n connectionId: connection.connectionId,\n domain: connection.domain,\n receiptId,\n });\n requestState.commit(\n request,\n result._tag === \"CleanupPlan\" ? { _tag: \"Review\", plan: result } : result,\n );\n } catch (cause) {\n requestState.commit(request, toFailure(cause));\n }\n }, [connection.connectionId, connection.domain, receiptId, requestState, transport]);\n\n const apply = useCallback(async () => {\n if (state._tag !== \"Review\") return;\n const reviewedPlan = state.plan;\n if (reviewedPlan.operations.some((operation) => operation._tag === \"Blocked\")) return;\n const request = requestState.begin({ _tag: \"Cleaning\", plan: reviewedPlan });\n try {\n const result = await transport.cleanup.apply({\n connectionId: connection.connectionId,\n domain: connection.domain,\n planDigest: reviewedPlan.digest,\n receiptId,\n });\n requestState.commit(\n request,\n result._tag === \"Cleaned\"\n ? { _tag: \"Cleaned\", result }\n : result._tag === \"Partial\"\n ? { _tag: \"Partial\", result }\n : result,\n );\n } catch (cause) {\n requestState.commit(request, toFailure(cause));\n }\n }, [connection.connectionId, connection.domain, receiptId, requestState, state, transport]);\n\n return {\n apply,\n dismiss: () => requestState.reset({ _tag: \"Idle\" }),\n plan,\n state,\n } as const;\n}\n\nconst toFailure = (cause: unknown): Failure => ({\n _tag: \"Failure\",\n message: cause instanceof Error ? cause.message : \"Domain cleanup failed\",\n retry: \"safe\",\n});\n\nexport interface FlowProps extends PartProps<\"div\", { readonly status: State[\"_tag\"] }> {\n readonly connection: Connected;\n readonly receiptId: string;\n}\n\nexport function Flow({ connection, receiptId, ...props }: FlowProps) {\n const controller = useController(connection, receiptId);\n const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();\n const state = controller.state;\n const plan = state._tag === \"Review\" || state._tag === \"Cleaning\" ? state.plan : undefined;\n return usePart(\n \"div\",\n props,\n { status: state._tag },\n {\n children: (\n <>\n {state._tag === \"Cleaned\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"success\">\n {messages.cleanupComplete}\n </p>\n ) : null}\n {state._tag === \"Partial\" || state._tag === \"Failure\" || state._tag === \"Stale\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {state._tag === \"Partial\" ? messages.cleanupPartial : state.message}\n </p>\n ) : null}\n <BaseDialog.Root\n onOpenChange={(open) => {\n if (!open) controller.dismiss();\n }}\n open={plan !== undefined}\n >\n <BaseDialog.Trigger\n data-domainkit-part=\"cleanup-trigger\"\n disabled={state._tag === \"Planning\" || state._tag === \"Cleaning\"}\n onClick={() => void controller.plan()}\n >\n {state._tag === \"Planning\" ? messages.planningCleanup : messages.reviewCleanup}\n </BaseDialog.Trigger>\n {plan === undefined ? null : (\n <BaseDialog.Portal container={portalContainer ?? undefined}>\n <BaseDialog.Backdrop data-domainkit-part=\"dialog-backdrop\" />\n <BaseDialog.Popup\n data-color-scheme={colorScheme}\n data-domainkit-part=\"cleanup-dialog\"\n data-domainkit-root=\"\"\n style={themeStyle}\n >\n <div data-domainkit-part=\"dialog-header\">\n <div data-domainkit-part=\"dialog-heading\">\n <BaseDialog.Title data-domainkit-part=\"dialog-title\">\n {messages.reviewCleanup}\n </BaseDialog.Title>\n <BaseDialog.Description data-domainkit-part=\"dialog-description\">\n {messages.cleanupConsent}\n </BaseDialog.Description>\n </div>\n <BaseDialog.Close\n aria-label={messages.close}\n data-domainkit-part=\"dialog-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <div data-domainkit-part=\"dialog-body\">\n <ul data-domainkit-part=\"cleanup-operations\">\n {plan.operations.map((operation) => (\n <li data-operation={operation._tag} key={operation.id}>\n <span data-domainkit-part=\"operation-kind\">{operation._tag}</span>{\" \"}\n <strong data-domainkit-part=\"operation-type\">\n {operation.record.type}\n </strong>{\" \"}\n <span data-domainkit-part=\"operation-record\">\n <span data-domainkit-part=\"operation-name\">\n {operation.record.name}\n </span>\n <code data-domainkit-part=\"operation-value\">\n {operation.record.value}\n </code>\n {operation.record.priority === undefined ? null : (\n <span data-domainkit-part=\"operation-priority\">\n Priority {operation.record.priority}\n </span>\n )}\n {operation._tag === \"Blocked\" ? (\n <span data-domainkit-part=\"operation-reason\">{operation.reason}</span>\n ) : null}\n </span>\n </li>\n ))}\n </ul>\n </div>\n <div data-domainkit-part=\"dialog-footer\">\n <BaseDialog.Close data-domainkit-part=\"dialog-cancel\">\n {messages.cancel}\n </BaseDialog.Close>\n <button\n data-domainkit-part=\"cleanup-apply\"\n disabled={\n state._tag === \"Cleaning\" ||\n plan.operations.some((operation) => operation._tag === \"Blocked\")\n }\n onClick={() => void controller.apply()}\n type=\"button\"\n >\n {state._tag === \"Cleaning\" ? messages.cleaningDns : messages.applyCleanup}\n </button>\n </div>\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n )}\n </BaseDialog.Root>\n </>\n ),\n \"data-domainkit-part\": \"cleanup-flow\",\n \"data-state\": state._tag,\n },\n );\n}\n","import { useId, useState, type ComponentPropsWithoutRef, type ReactNode } from \"react\";\n\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport type { Provider as ProviderDescriptor } from \"./transport.ts\";\n\nexport type Marks = Readonly<\n Record<string, ReactNode | ((provider: ProviderDescriptor) => ReactNode)>\n>;\n\nexport interface MarkState extends Record<string, unknown> {\n readonly providerId: string;\n}\n\nexport interface MarkProps extends PartProps<\"span\", MarkState> {\n readonly provider: ProviderDescriptor;\n}\n\nconst logoHosts: Readonly<Record<string, string>> = {\n aws: \"amazonaws.com\",\n bluehost: \"bluehost.com\",\n cloudflare: \"cloudflare.com\",\n digitalocean: \"digitalocean.com\",\n dnsimple: \"dnsimple.com\",\n dreamhost: \"dreamhost.com\",\n dynadot: \"dynadot.com\",\n gandi: \"gandi.net\",\n godaddy: \"godaddy.com\",\n google: \"cloud.google.com\",\n googlecloud: \"cloud.google.com\",\n googleclouddns: \"cloud.google.com\",\n hostgator: \"hostgator.com\",\n hostinger: \"hostinger.com\",\n hover: \"hover.com\",\n ionos: \"ionos.com\",\n namecheap: \"namecheap.com\",\n namecom: \"name.com\",\n netlify: \"netlify.com\",\n ns1: \"ns1.com\",\n ovh: \"ovh.com\",\n porkbun: \"porkbun.com\",\n spaceship: \"spaceship.com\",\n squarespace: \"squarespace.com\",\n vercel: \"vercel.com\",\n};\n\nconst logoKey = (providerId: string): string =>\n providerId\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"\");\n\nconst logoHost = (providerId: string): string | undefined => logoHosts[logoKey(providerId)];\n\nconst letterMark = (provider: ProviderDescriptor): string =>\n provider.name.trim().charAt(0).toUpperCase() || \"?\";\n\n/** Official AWS architecture glyph (white \"53\" in nested circles). */\nconst route53Glyph =\n \"M48.692,40.6795109 C49.431,41.3627732 49.801,42.2781246 49.801,43.4275659 C49.801,44.678046 49.351,45.6764293 48.452,46.4227159 C47.552,47.1700028 46.343,47.543146 44.826,47.543146 C43.627,47.543146 42.44,47.2870477 41.266,46.7768518 L41.266,45.2452638 C42.657,45.7054405 43.843,45.9345284 44.826,45.9345284 C45.796,45.9345284 46.542,45.7174451 47.065,45.2842788 C47.588,44.8501121 47.849,44.2308744 47.849,43.4275659 C47.849,41.8829729 46.874,41.1106764 44.921,41.1106764 C44.309,41.1106764 43.703,41.1426887 43.103,41.2057129 L43.103,39.9432282 L47.123,35.5585448 L41.458,35.5585448 L41.458,33.9889422 L49.247,33.9889422 L49.247,35.5015229 L45.304,39.6751253 C45.369,39.6621203 45.431,39.656118 45.496,39.656118 L45.687,39.656118 C46.951,39.656118 47.952,39.9972489 48.692,40.6795109 M37.574,40.3453826 C38.351,41.0726618 38.74,42.0740463 38.74,43.349536 C38.74,44.6010165 38.288,45.6124048 37.381,46.3847013 C36.475,47.1569978 35.283,47.543146 33.803,47.543146 C32.503,47.543146 31.284,47.2870477 30.148,46.7768518 L30.148,45.2452638 C31.564,45.7054405 32.776,45.9345284 33.784,45.9345284 C34.754,45.9345284 35.497,45.7154443 36.013,45.2742749 C36.53,44.834106 36.789,44.1998624 36.789,43.3695437 C36.789,42.4631957 36.546,41.8059434 36.061,41.3977867 C35.576,40.9896299 34.785,40.7845512 33.688,40.7845512 C32.897,40.7845512 31.909,40.8495762 30.722,40.976625 L30.722,39.7131399 L31.086,33.9889422 L38.071,33.9889422 L38.071,35.5585448 L32.693,35.5585448 L32.444,39.4450369 C33.146,39.3179882 33.777,39.2539636 34.338,39.2539636 C35.716,39.2539636 36.795,39.617103 37.574,40.3453826 M51.957,54.37777 C47.103,55.250105 42.852,57.2268639 40,58.8374822 C37.147,57.2268639 32.896,55.250105 28.043,54.37777 C26.677,54.1326759 19.869,52.7111302 19.869,48.7756192 C19.869,46.951919 20.522,45.7424547 21.776,43.5826255 C23.274,40.9996338 25.138,37.7843994 25.138,33.1556222 C25.138,29.8473521 24.271,26.6751342 22.559,23.7149977 C22.76,23.4669025 22.965,23.2158061 23.171,22.9627089 C25.707,24.2301955 28.347,24.8724421 31.031,24.8724421 C34.311,24.8724421 37.325,24.0111114 40,22.3114589 C42.674,24.0111114 45.688,24.8724421 48.968,24.8724421 C51.652,24.8724421 54.293,24.2301955 56.829,22.9627089 C57.034,23.2158061 57.239,23.4669025 57.44,23.7149977 C55.728,26.6751342 54.861,29.8473521 54.861,33.1556222 C54.861,37.7843994 56.725,40.9996338 58.226,43.586627 C59.477,45.7424547 60.13,46.951919 60.13,48.7756192 C60.13,52.7111302 53.322,54.1326759 51.957,54.37777 M56.861,33.1556222 C56.861,29.9974097 57.752,26.9702475 59.507,24.1581679 C59.735,23.7950284 59.706,23.3278491 59.434,22.9957216 C58.926,22.3734827 58.393,21.7182311 57.867,21.0669811 C57.562,20.6898363 57.032,20.5857963 56.606,20.8198862 C54.143,22.1814089 51.574,22.8716739 48.968,22.8716739 C45.824,22.8716739 43.077,22.0263494 40.569,20.2886823 C40.227,20.0515912 39.772,20.0515912 39.43,20.2886823 C36.922,22.0263494 34.175,22.8716739 31.031,22.8716739 C28.425,22.8716739 25.856,22.1814089 23.393,20.8198862 C22.968,20.5857963 22.437,20.6898363 22.132,21.0669811 C21.606,21.7182311 21.073,22.3734827 20.565,22.9957216 C20.294,23.3278491 20.264,23.7950284 20.492,24.1581679 C22.248,26.9702475 23.138,29.9974097 23.138,33.1556222 C23.138,37.2461927 21.423,40.2023277 20.045,42.581241 C18.695,44.9041328 17.869,46.4467251 17.869,48.7756192 C17.869,54.1646882 25.385,55.9343677 27.689,56.3475263 C32.549,57.2208616 36.793,59.2806524 39.497,60.8542565 C39.652,60.9452915 39.826,60.9903088 40,60.9903088 C40.173,60.9903088 40.347,60.9452915 40.503,60.8542565 C43.207,59.2806524 47.45,57.2208616 52.31,56.3475263 C54.614,55.9343677 62.13,54.1646882 62.13,48.7756192 C62.13,46.4467251 61.304,44.9041328 59.954,42.5782399 C58.576,40.2023277 56.861,37.2461927 56.861,33.1556222 M52.994,60.1569888 C46.863,61.2594121 41.723,64.556678 40,65.7641416 C38.276,64.556678 33.136,61.2594121 27.005,60.1569888 C14.937,57.9891566 14,50.8974338 14,48.7756192 C14,45.2852792 15.371,42.9233724 16.697,40.6374948 C17.961,38.4596586 19.268,36.2067937 19.268,33.1556222 C19.268,28.3357718 16.485,24.9314648 15.112,23.5459328 C16.556,21.7892584 20.204,17.3415508 22.003,15.0236609 C24.729,17.5966487 27.898,19.0001876 31.031,19.0001876 C34.509,19.0001876 37.385,17.5846441 40,14.5644846 C42.614,17.5846441 45.49,19.0001876 48.968,19.0001876 C52.101,19.0001876 55.27,17.5966487 57.997,15.0236609 C59.796,17.3415508 63.443,21.7892584 64.887,23.5459328 C63.514,24.9314648 60.731,28.3357718 60.731,33.1556222 C60.731,36.2067937 62.039,38.4596586 63.302,40.6374948 C64.629,42.9233724 66,45.2852792 66,48.7756192 C66,50.8974338 65.062,57.9891566 52.994,60.1569888 M65.032,39.6341095 C63.797,37.5052922 62.731,35.6675867 62.731,33.1556222 C62.731,27.867592 66.847,24.4472789 66.887,24.4152666 C67.094,24.2472021 67.226,24.0031083 67.254,23.7370062 C67.28,23.470904 67.2,23.2058022 67.03,22.9997231 C66.963,22.9196924 60.408,14.9726413 58.906,12.9138509 C58.73,12.6727583 58.457,12.5227007 58.159,12.5046938 C57.86,12.4826853 57.572,12.601731 57.368,12.8198148 C54.848,15.5148495 51.866,16.9994194 48.968,16.9994194 C45.764,16.9994194 43.244,15.5718713 40.794,12.3706423 C40.415,11.8764526 39.585,11.8764526 39.206,12.3706423 C36.755,15.5718713 34.235,16.9994194 31.031,16.9994194 C28.133,16.9994194 25.151,15.5148495 22.631,12.8198148 C22.427,12.601731 22.137,12.4776834 21.84,12.5046938 C21.543,12.5227007 21.269,12.6727583 21.093,12.9138509 C19.591,14.9726413 13.036,22.9196924 12.969,22.9997231 C12.8,23.2058022 12.72,23.470904 12.747,23.7360058 C12.773,24.0011076 12.904,24.2452013 13.11,24.4132658 C13.152,24.4472789 17.268,27.867592 17.268,33.1556222 C17.268,35.6675867 16.202,37.5052922 14.967,39.6341095 C13.576,42.0310298 12,44.7470725 12,48.7756192 C12,55.487196 17.477,60.4781121 26.652,62.1267451 C33.559,63.3682217 39.334,67.7489036 39.391,67.7939209 C39.57,67.9309735 39.785,68 40,68 C40.214,68 40.429,67.9309735 40.609,67.7929205 C40.667,67.7489036 46.422,63.3712229 53.347,62.1267451 C62.522,60.4781121 68,55.487196 68,48.7756192 C68,44.7470725 66.423,42.0310298 65.032,39.6341095\";\n\nfunction Route53Mark() {\n const gradientId = `dk-r53-${useId().replaceAll(\":\", \"\")}`;\n return (\n <svg aria-hidden=\"true\" viewBox=\"0 0 80 80\">\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" x2=\"100%\" y1=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" stopColor=\"#4D27A8\" />\n <stop offset=\"100%\" stopColor=\"#A166FF\" />\n </linearGradient>\n </defs>\n <rect fill={`url(#${gradientId})`} height=\"80\" width=\"80\" />\n <path d={route53Glyph} fill=\"#fff\" />\n </svg>\n );\n}\n\nconst logoMarks: Readonly<Record<string, typeof Route53Mark>> = {\n amazonroute53: Route53Mark,\n route53: Route53Mark,\n};\n\nfunction DefaultMark({ provider }: { readonly provider: ProviderDescriptor }) {\n const BuiltIn = logoMarks[logoKey(provider.id)];\n const host = logoHost(provider.id);\n const [failed, setFailed] = useState(false);\n if (BuiltIn !== undefined) return <BuiltIn />;\n if (host === undefined || failed) return letterMark(provider);\n return (\n <img\n alt=\"\"\n height={32}\n onError={() => setFailed(true)}\n referrerPolicy=\"no-referrer\"\n src={`https://integrations.sh/logo/${host}?sz=64`}\n width={32}\n />\n );\n}\n\nexport function Mark({ provider, ...props }: MarkProps) {\n const { marks } = useDomainKit();\n const replacement = marks[provider.id];\n const content =\n typeof replacement === \"function\"\n ? replacement(provider)\n : (replacement ?? <DefaultMark provider={provider} />);\n return usePart(\n \"span\",\n props,\n { providerId: provider.id },\n {\n \"aria-label\": provider.name,\n children: content,\n \"data-domainkit-part\": \"provider-mark\",\n role: \"img\",\n },\n );\n}\n\nexport type { ProviderDescriptor as Provider };\nexport type MarkElementProps = ComponentPropsWithoutRef<\"span\">;\n","import { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type FormEvent,\n} from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport * as Provider from \"./provider.tsx\";\nimport * as RequestState from \"./request-state.ts\";\nimport type {\n AuthenticationMethod,\n Connected,\n ConnectionSnapshot,\n Failure,\n RemoveDomainResult,\n} from \"./transport.ts\";\n\nexport type State =\n | { readonly _tag: \"Loading\" }\n | ConnectionSnapshot\n | { readonly _tag: \"Submitting\"; readonly snapshot: Disconnected }\n | { readonly _tag: \"Redirecting\"; readonly snapshot: Disconnected };\n\ntype Disconnected = Extract<ConnectionSnapshot, { readonly _tag: \"Disconnected\" }>;\n\nexport interface Controller {\n readonly connect: (\n method: \"oauth\" | \"token\",\n token?: string,\n parameters?: Readonly<Record<string, string>>,\n ) => Promise<void>;\n readonly retry: () => void;\n readonly reuse: () => Promise<void>;\n readonly state: State;\n}\n\nconst failure = (cause: unknown): Failure => ({\n _tag: \"Failure\",\n message: cause instanceof Error ? cause.message : \"The connection request failed\",\n retry: \"safe\",\n});\n\nexport function useController(domain: string): Controller {\n const { navigate, transport } = useDomainKit();\n const [attempt, setAttempt] = useState(0);\n const [state, setState] = useState<State>({ _tag: \"Loading\" });\n const activeRequest = useRef(0);\n\n useEffect(() => {\n const request = ++activeRequest.current;\n setState({ _tag: \"Loading\" });\n void transport.connection.inspect({ domain }).then(\n (snapshot) => {\n if (activeRequest.current === request) setState(snapshot);\n },\n (cause: unknown) => {\n if (activeRequest.current === request) setState(failure(cause));\n },\n );\n return () => {\n if (activeRequest.current === request) activeRequest.current += 1;\n };\n }, [attempt, domain, transport]);\n\n const connect = useCallback(\n async (\n method: \"oauth\" | \"token\",\n token?: string,\n parameters?: Readonly<Record<string, string>>,\n ) => {\n if (state._tag !== \"Disconnected\") return;\n const request = ++activeRequest.current;\n const snapshot = state;\n setState({ _tag: \"Submitting\", snapshot });\n try {\n const result = await transport.connection.connect({\n domain,\n method,\n ...(parameters === undefined ? {} : { parameters }),\n providerId: snapshot.provider.id,\n ...(token === undefined ? {} : { token }),\n });\n if (activeRequest.current !== request) return;\n if (result._tag === \"Redirect\") {\n setState({ _tag: \"Redirecting\", snapshot });\n navigate(result.authorizationUrl);\n return;\n }\n setState(result);\n } catch (cause) {\n if (activeRequest.current === request) setState(failure(cause));\n }\n },\n [domain, navigate, state, transport],\n );\n\n const reuse = useCallback(async () => {\n if (state._tag !== \"Disconnected\" || state.reusableConnection === undefined) return;\n const request = ++activeRequest.current;\n const snapshot = state;\n const reusableConnection = state.reusableConnection;\n setState({ _tag: \"Submitting\", snapshot });\n try {\n const result = await transport.connection.reuse({\n connectionId: reusableConnection.connectionId,\n domain,\n });\n if (activeRequest.current === request) setState(result);\n } catch (cause) {\n if (activeRequest.current === request) setState(failure(cause));\n }\n }, [domain, state, transport]);\n\n return {\n connect,\n retry: () => setAttempt((current) => current + 1),\n reuse,\n state,\n };\n}\n\nexport interface RootState extends Record<string, unknown> {\n readonly status: State[\"_tag\"];\n}\n\nexport interface RootProps extends PartProps<\"div\", RootState> {\n readonly status?: State[\"_tag\"];\n}\n\nexport function Root({ children, status = \"Loading\", ...props }: RootProps) {\n return usePart(\n \"div\",\n props,\n { status },\n {\n children,\n \"data-domainkit-part\": \"connection-root\",\n },\n );\n}\n\nexport interface StatusState extends Record<string, unknown> {\n readonly status: State[\"_tag\"];\n}\n\nexport interface StatusProps extends PartProps<\"div\", StatusState> {\n readonly state: State;\n}\n\nexport function Status({ state, ...props }: StatusProps) {\n const { messages } = useDomainKit();\n const text =\n state._tag === \"Loading\"\n ? messages.detectingProvider\n : state._tag === \"Connected\"\n ? messages.connected(state.provider.name)\n : state._tag === \"Unsupported\"\n ? messages.automaticUnavailable\n : state._tag === \"Failure\"\n ? state.message\n : state._tag === \"Redirecting\"\n ? messages.openingAuthorization\n : state._tag === \"Submitting\"\n ? messages.connecting\n : `${state.provider.name} is available`;\n return usePart(\n \"div\",\n props,\n { status: state._tag },\n {\n children: text,\n \"data-domainkit-part\": \"connection-status\",\n \"data-state\": state._tag,\n },\n );\n}\n\nexport interface TriggerProps extends ComponentPropsWithoutRef<typeof BaseDialog.Trigger> {\n readonly provider: Provider.Provider;\n}\n\nexport function Trigger({ provider, ...props }: TriggerProps) {\n const { messages } = useDomainKit();\n return (\n <BaseDialog.Trigger data-domainkit-part=\"connection-trigger\" {...props}>\n <Provider.Mark aria-hidden=\"true\" provider={provider} />\n {messages.connectProvider(provider.name)}\n </BaseDialog.Trigger>\n );\n}\n\nexport interface ActionState extends Record<string, unknown> {\n readonly authentication: \"oauth\" | \"reuse\" | \"token\";\n}\n\nexport interface OAuthActionProps extends PartProps<\"button\", ActionState> {\n readonly controller: Controller;\n readonly label: string;\n}\n\nexport function OAuthAction({ controller, label, ...props }: OAuthActionProps) {\n return usePart(\n \"button\",\n props,\n { authentication: \"oauth\" },\n {\n children: label,\n \"data-domainkit-part\": \"oauth-connect\",\n onClick: () => void controller.connect(\"oauth\"),\n type: \"button\",\n },\n );\n}\n\nexport interface ReuseActionProps extends PartProps<\"button\", ActionState> {\n readonly controller: Controller;\n readonly label: string;\n}\n\nexport function ReuseAction({ controller, label, ...props }: ReuseActionProps) {\n return usePart(\n \"button\",\n props,\n { authentication: \"reuse\" },\n {\n children: label,\n \"data-domainkit-part\": \"reuse-connection\",\n onClick: () => void controller.reuse(),\n type: \"button\",\n },\n );\n}\n\nexport interface TokenActionProps extends Omit<PartProps<\"form\", ActionState>, \"method\"> {\n readonly controller: Controller;\n readonly method: Extract<AuthenticationMethod, { readonly _tag: \"Token\" }>;\n}\n\nexport function TokenAction({ controller, method, ...props }: TokenActionProps) {\n const { messages } = useDomainKit();\n const [token, setToken] = useState(\"\");\n const [parameters, setParameters] = useState<Readonly<Record<string, string>>>({});\n const submit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (token.length > 0) {\n const populated = Object.fromEntries(\n Object.entries(parameters).filter(([, value]) => value.length > 0),\n );\n void controller.connect(\n \"token\",\n token,\n Object.keys(populated).length === 0 ? undefined : populated,\n );\n }\n };\n const missingRequiredParameter = method.parameters?.some(\n (parameter) => parameter.required === true && !parameters[parameter.key],\n );\n return usePart(\n \"form\",\n props,\n { authentication: \"token\" },\n {\n children: (\n <>\n {method.parameters?.map((parameter) => (\n <label key={parameter.key}>\n {parameter.label}\n <input\n name={parameter.key}\n onChange={(event) => {\n const value = event.currentTarget.value;\n setParameters((current) => ({\n ...current,\n [parameter.key]: value,\n }));\n }}\n placeholder={parameter.placeholder}\n required={parameter.required}\n type=\"text\"\n value={parameters[parameter.key] ?? \"\"}\n />\n {parameter.description === undefined ? null : <small>{parameter.description}</small>}\n </label>\n ))}\n <label>\n {messages.tokenLabel}\n <input\n autoComplete=\"off\"\n name=\"token\"\n onChange={(event) => setToken(event.currentTarget.value)}\n placeholder={method.placeholder}\n type=\"password\"\n value={token}\n />\n </label>\n <button disabled={token.length === 0 || missingRequiredParameter === true} type=\"submit\">\n {method.label}\n </button>\n </>\n ),\n \"data-domainkit-part\": \"token-connect\",\n onSubmit: submit,\n },\n );\n}\n\nexport interface DialogProps {\n readonly controller: Controller;\n readonly snapshot: Disconnected;\n}\n\nexport function Dialog({ controller, snapshot }: DialogProps) {\n const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();\n return (\n <BaseDialog.Portal container={portalContainer}>\n <BaseDialog.Backdrop data-domainkit-part=\"dialog-backdrop\" />\n <BaseDialog.Popup\n data-domainkit-part=\"connection-dialog\"\n data-domainkit-root=\"\"\n data-color-scheme={colorScheme}\n style={themeStyle}\n >\n <div data-domainkit-part=\"dialog-header\">\n <Provider.Mark provider={snapshot.provider} />\n <div data-domainkit-part=\"dialog-heading\">\n <BaseDialog.Title data-domainkit-part=\"dialog-title\">\n {messages.dialogTitle(snapshot.provider.name)}\n </BaseDialog.Title>\n <BaseDialog.Description data-domainkit-part=\"dialog-description\">\n {messages.dialogDescription(snapshot.domain)}\n </BaseDialog.Description>\n </div>\n <BaseDialog.Close aria-label={messages.close} data-domainkit-part=\"dialog-close\">\n ×\n </BaseDialog.Close>\n </div>\n <div data-domainkit-part=\"dialog-body\">\n {snapshot.provider.authentication.map((method) =>\n method._tag === \"OAuth\" ? (\n <OAuthAction controller={controller} key={method._tag} label={method.label} />\n ) : null,\n )}\n {snapshot.reusableConnection === undefined ? null : (\n <ReuseAction\n controller={controller}\n label={messages.reuseConnection(snapshot.reusableConnection.label)}\n />\n )}\n {snapshot.provider.authentication.map((method) =>\n method._tag === \"Token\" ? (\n <TokenAction controller={controller} key={method._tag} method={method} />\n ) : null,\n )}\n </div>\n <div data-domainkit-part=\"dialog-footer\">\n <BaseDialog.Close data-domainkit-part=\"dialog-cancel\">{messages.cancel}</BaseDialog.Close>\n </div>\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n );\n}\n\nexport interface FlowProps extends Omit<RootProps, \"children\"> {\n readonly domain: string;\n}\n\nexport function Flow({ domain, ...props }: FlowProps) {\n const controller = useController(domain);\n const state = controller.state;\n const snapshot =\n state._tag === \"Disconnected\"\n ? state\n : state._tag === \"Submitting\" || state._tag === \"Redirecting\"\n ? state.snapshot\n : undefined;\n return (\n <Root {...props} status={state._tag}>\n <Status state={state} />\n {state._tag === \"Failure\" && state.retry !== \"never\" ? (\n <RetryAction\n controller={controller}\n kind={state.retry === \"after-user-action\" ? \"after-user-action\" : \"retry\"}\n />\n ) : null}\n {snapshot === undefined ? null : (\n <BaseDialog.Root>\n <Trigger provider={snapshot.provider} />\n <Dialog controller={controller} snapshot={snapshot} />\n </BaseDialog.Root>\n )}\n </Root>\n );\n}\n\nexport interface RetryActionProps extends PartProps<\"button\", { readonly status: \"Failure\" }> {\n readonly controller: Controller;\n readonly kind?: \"after-user-action\" | \"retry\";\n}\n\nexport function RetryAction({ controller, kind = \"retry\", ...props }: RetryActionProps) {\n const { messages } = useDomainKit();\n return usePart(\n \"button\",\n props,\n { status: \"Failure\" },\n {\n children: kind === \"after-user-action\" ? messages.checkAgain : messages.retry,\n \"data-domainkit-part\": \"connection-retry\",\n onClick: controller.retry,\n type: \"button\",\n },\n );\n}\n\nexport type DisconnectState =\n | { readonly _tag: \"Idle\" }\n | { readonly _tag: \"Disconnecting\" }\n | RemoveDomainResult\n | Failure;\n\nexport function useDisconnect(connection: Connected) {\n const { transport } = useDomainKit();\n const requestState = RequestState.useController<DisconnectState>(\n `${connection.connectionId}:${connection.domain}:disconnect`,\n { _tag: \"Idle\" },\n );\n const disconnect = useCallback(async () => {\n const request = requestState.begin({ _tag: \"Disconnecting\" });\n try {\n requestState.commit(\n request,\n await transport.connection.removeDomain({\n connectionId: connection.connectionId,\n domain: connection.domain,\n preserveDns: true,\n }),\n );\n } catch (cause) {\n requestState.commit(request, failure(cause));\n }\n }, [connection.connectionId, connection.domain, requestState, transport]);\n return { disconnect, state: requestState.state } as const;\n}\n\nexport interface DisconnectActionProps extends PartProps<\n \"div\",\n { readonly status: DisconnectState[\"_tag\"] }\n> {\n readonly connection: Connected;\n}\n\nexport function DisconnectAction({ connection, ...props }: DisconnectActionProps) {\n const controller = useDisconnect(connection);\n const { messages } = useDomainKit();\n const state = controller.state;\n return usePart(\n \"div\",\n props,\n { status: state._tag },\n {\n children: (\n <>\n {state._tag === \"Removed\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"success\">\n {messages.domainDisconnected}\n </p>\n ) : null}\n {state._tag === \"Failure\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {state.message}\n </p>\n ) : null}\n {state._tag === \"Removed\" ? null : (\n <button\n data-domainkit-part=\"disconnect-action\"\n disabled={state._tag === \"Disconnecting\"}\n onClick={() => void controller.disconnect()}\n type=\"button\"\n >\n {state._tag === \"Disconnecting\" ? messages.disconnecting : messages.disconnectDomain}\n </button>\n )}\n </>\n ),\n \"data-domainkit-part\": \"disconnect\",\n },\n );\n}\n\nexport type { Connected };\n","import { useEffect, useRef, useState, type ReactElement, type ReactNode } from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useIcons } from \"./icons.tsx\";\nimport type { DnsRecord, ObservationEvidence } from \"./transport.ts\";\n\nconst copyText = (value: string): Promise<boolean> => {\n if (typeof navigator === \"undefined\" || navigator.clipboard === undefined) {\n return Promise.resolve(false);\n }\n return navigator.clipboard.writeText(value).then(\n () => true,\n () => false,\n );\n};\n\nconst downloadText = (filename: string, contents: string): void => {\n if (typeof document === \"undefined\") return;\n const blob = new Blob([contents], { type: \"text/plain;charset=utf-8\" });\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement(\"a\");\n anchor.download = filename;\n anchor.href = url;\n document.body.append(anchor);\n anchor.click();\n anchor.remove();\n URL.revokeObjectURL(url);\n};\n\nconst absoluteDomainName = (value: string): string => (value.endsWith(\".\") ? value : `${value}.`);\n\nconst textEncoder = new TextEncoder();\n\nconst escapeTxtCharacter = (character: string): string => {\n if (character === '\"' || character === \"\\\\\") return `\\\\${character}`;\n const codePoint = character.codePointAt(0);\n if (codePoint !== undefined && (codePoint < 32 || codePoint === 127)) {\n return `\\\\${codePoint.toString().padStart(3, \"0\")}`;\n }\n return character;\n};\n\nconst txtValue = (value: string): string => {\n const chunks: Array<string> = [];\n let chunk = \"\";\n let byteLength = 0;\n for (const character of value) {\n const characterByteLength = textEncoder.encode(character).byteLength;\n if (byteLength + characterByteLength > 255) {\n chunks.push(chunk);\n chunk = \"\";\n byteLength = 0;\n }\n chunk += escapeTxtCharacter(character);\n byteLength += characterByteLength;\n }\n chunks.push(chunk);\n return chunks.map((part) => `\"${part}\"`).join(\" \");\n};\n\nconst srvValue = (value: string): string => {\n const fields = value.trim().split(/\\s+/);\n if (fields.length !== 3) throw new Error(`Invalid SRV value: ${value}`);\n const [weight, port, target] = fields;\n if (weight === undefined || port === undefined || target === undefined) {\n throw new Error(`Invalid SRV value: ${value}`);\n }\n return `${weight} ${port} ${absoluteDomainName(target)}`;\n};\n\nconst zoneValue = (record: DnsRecord): string => {\n switch (record.type.toUpperCase()) {\n case \"CNAME\":\n case \"MX\":\n case \"NS\":\n case \"PTR\":\n return absoluteDomainName(record.value);\n case \"SRV\":\n return srvValue(record.value);\n case \"TXT\":\n return txtValue(record.value);\n default:\n return record.value;\n }\n};\n\ntype LeafState = Record<string, unknown>;\n\nfunction leafPart<Tag extends keyof React.JSX.IntrinsicElements>(\n defaultTagName: Tag,\n part: string,\n) {\n return function Leaf(props: PartProps<Tag, LeafState>): ReactElement {\n return usePart(defaultTagName, props, {}, { \"data-domainkit-part\": part });\n };\n}\n\nexport interface CopyValueProps extends PartProps<\"span\", { readonly copied: boolean }> {\n readonly copiedIcon?: ReactNode;\n readonly copiedLabel?: string;\n readonly copyIcon?: ReactNode;\n readonly copyLabel?: string;\n readonly value: string;\n}\n\nexport function CopyValue({\n copiedIcon,\n copiedLabel = \"Copied\",\n copyIcon,\n copyLabel = \"Copy\",\n value,\n ...props\n}: CopyValueProps) {\n const icons = useIcons();\n const [copied, setCopied] = useState(false);\n const reset = useRef<ReturnType<typeof setTimeout>>(undefined);\n useEffect(() => () => clearTimeout(reset.current), []);\n return usePart(\n \"span\",\n props,\n { copied },\n {\n children: (\n <>\n <code>{value}</code>\n <button\n aria-label={`${copied ? copiedLabel : copyLabel} ${value}`}\n data-domainkit-part=\"copy-action\"\n onClick={() => {\n void copyText(value).then((ok) => {\n if (!ok) return;\n setCopied(true);\n clearTimeout(reset.current);\n reset.current = setTimeout(() => setCopied(false), 2000);\n });\n }}\n type=\"button\"\n >\n <span\n aria-hidden=\"true\"\n data-domainkit-part=\"copy-glyph\"\n data-icon=\"\"\n data-state=\"idle\"\n >\n {copyIcon ?? icons.copy}\n </span>\n <span\n aria-hidden=\"true\"\n data-domainkit-part=\"copy-glyph\"\n data-icon=\"\"\n data-state=\"done\"\n >\n {copiedIcon ?? icons.copied}\n </span>\n </button>\n </>\n ),\n \"data-copied\": copied ? \"\" : undefined,\n \"data-domainkit-part\": \"copy-value\",\n },\n );\n}\n\nexport interface ZoneFileProps extends PartProps<\"div\", { readonly count: number }> {\n readonly copiedIcon?: ReactNode;\n readonly copiedLabel?: string;\n readonly copyIcon?: ReactNode;\n readonly copyLabel?: string;\n readonly domain: string;\n readonly downloadIcon?: ReactNode;\n readonly downloadLabel?: string;\n readonly records: ReadonlyArray<DnsRecord>;\n}\n\nexport function ZoneFile({\n copiedIcon,\n copiedLabel = \"Copied\",\n copyIcon,\n copyLabel = \"Copy zone\",\n domain,\n downloadIcon,\n downloadLabel = \"Download\",\n records,\n ...props\n}: ZoneFileProps) {\n const icons = useIcons();\n const [copied, setCopied] = useState(false);\n const reset = useRef<ReturnType<typeof setTimeout>>(undefined);\n const zone = toZoneFile(records);\n useEffect(() => () => clearTimeout(reset.current), []);\n return usePart(\n \"div\",\n props,\n { count: records.length },\n {\n children: (\n <>\n <button\n aria-label={copied ? copiedLabel : copyLabel}\n data-domainkit-part=\"zone-copy\"\n onClick={() => {\n void copyText(zone).then((ok) => {\n if (!ok) return;\n setCopied(true);\n clearTimeout(reset.current);\n reset.current = setTimeout(() => setCopied(false), 2000);\n });\n }}\n type=\"button\"\n >\n <span aria-hidden=\"true\" data-icon=\"inline-start\">\n {copied ? (copiedIcon ?? icons.copied) : (copyIcon ?? icons.copy)}\n </span>\n {copied ? copiedLabel : copyLabel}\n </button>\n <button\n data-domainkit-part=\"zone-download\"\n onClick={() => downloadText(`${domain}.txt`, zone)}\n type=\"button\"\n >\n <span aria-hidden=\"true\" data-icon=\"inline-start\">\n {downloadIcon ?? icons.download}\n </span>\n {downloadLabel}\n </button>\n </>\n ),\n \"data-domainkit-part\": \"zone-file\",\n },\n );\n}\n\nexport interface StatusProps extends PartProps<\n \"span\",\n { readonly status: ObservationEvidence[\"_tag\"] }\n> {\n readonly evidence: ObservationEvidence;\n}\n\nexport function Status({ evidence, ...props }: StatusProps) {\n return usePart(\n \"span\",\n props,\n { status: evidence._tag },\n {\n children: evidence._tag,\n \"data-domainkit-part\": \"record-status\",\n \"data-status\": evidence._tag,\n },\n );\n}\n\nexport interface PriorityProps extends PartProps<\"span\", { readonly priority: number }> {\n readonly priority?: number;\n}\n\nexport function Priority({ children, priority = 0, ...props }: PriorityProps) {\n return usePart(\n \"span\",\n props,\n { priority },\n {\n children: children ?? `Priority ${priority}`,\n \"data-domainkit-part\": \"record-priority\",\n },\n );\n}\n\nexport const Header = leafPart(\"thead\", \"records-header\");\nexport const Body = leafPart(\"tbody\", \"records-body\");\nexport const Footer = leafPart(\"tfoot\", \"records-footer\");\nexport const Row = leafPart(\"tr\", \"records-row\");\nexport const Head = leafPart(\"th\", \"records-head\");\nexport const Cell = leafPart(\"td\", \"records-cell\");\nexport const Caption = leafPart(\"caption\", \"records-caption\");\nexport const Value = leafPart(\"span\", \"record-value\");\nexport const CardHeader = leafPart(\"div\", \"record-card-head\");\nexport const CardTitle = leafPart(\"strong\", \"record-card-title\");\nexport const CardContent = leafPart(\"dl\", \"record-card-content\");\n\nexport interface RootProps extends PartProps<\"table\", { readonly count: number }> {\n readonly count?: number;\n}\n\nexport function Root({ count = 0, ...props }: RootProps) {\n return (\n <div data-domainkit-part=\"records-panel\">\n {usePart(\"table\", props, { count }, { \"data-domainkit-part\": \"records-table\" })}\n </div>\n );\n}\n\nexport interface CardProps extends PartProps<\"section\", { readonly recordId: string }> {\n readonly copiedIcon?: ReactNode;\n readonly copyIcon?: ReactNode;\n readonly evidence?: ReadonlyArray<ObservationEvidence>;\n readonly record: DnsRecord;\n}\n\nexport function Card({ copiedIcon, copyIcon, evidence, record, ...props }: CardProps) {\n const matching =\n evidence === undefined ? [] : evidence.filter((item) => item.recordId === record.id);\n return usePart(\n \"section\",\n props,\n { recordId: record.id },\n {\n children: (\n <>\n <CardHeader>\n <CardTitle>{record.type}</CardTitle>\n {matching.map((item, index) => (\n <Status evidence={item} key={`${item._tag}-${index}`} />\n ))}\n </CardHeader>\n <CardContent>\n <div>\n <dt>Name</dt>\n <dd>\n <CopyValue copiedIcon={copiedIcon} copyIcon={copyIcon} value={record.name} />\n </dd>\n </div>\n <div>\n <dt>Value</dt>\n <dd>\n <CopyValue copiedIcon={copiedIcon} copyIcon={copyIcon} value={record.value} />\n {record.priority === undefined ? null : <Priority priority={record.priority} />}\n </dd>\n </div>\n </CardContent>\n </>\n ),\n \"data-domainkit-part\": \"record-card\",\n },\n );\n}\n\nexport interface TableProps extends PartProps<\"table\", { readonly count: number }> {\n readonly copiedIcon?: ReactNode;\n readonly copyIcon?: ReactNode;\n readonly evidence?: ReadonlyArray<ObservationEvidence>;\n readonly records: ReadonlyArray<DnsRecord>;\n}\n\nexport function Table({ copiedIcon, copyIcon, evidence, records, ...props }: TableProps) {\n const status = evidence !== undefined;\n return (\n <Root count={records.length} {...props}>\n <Header>\n <Row>\n <Head scope=\"col\">Type</Head>\n <Head scope=\"col\">Name</Head>\n <Head scope=\"col\">Value</Head>\n {status ? (\n <Head data-column=\"status\" scope=\"col\">\n Status\n </Head>\n ) : null}\n </Row>\n </Header>\n <Body>\n {records.map((record) => (\n <Row key={record.id}>\n <Cell>{record.type}</Cell>\n <Cell>\n <CopyValue copiedIcon={copiedIcon} copyIcon={copyIcon} value={record.name} />\n </Cell>\n <Cell>\n <Value>\n <CopyValue copiedIcon={copiedIcon} copyIcon={copyIcon} value={record.value} />\n {record.priority === undefined ? null : <Priority priority={record.priority} />}\n </Value>\n </Cell>\n {status ? (\n <Cell data-column=\"status\">\n {evidence\n .filter((item) => item.recordId === record.id)\n .map((item, index) => (\n <Status evidence={item} key={`${item._tag}-${index}`} />\n ))}\n </Cell>\n ) : null}\n </Row>\n ))}\n </Body>\n </Root>\n );\n}\n\nexport const toZoneFile = (records: ReadonlyArray<DnsRecord>): string =>\n `${records\n .map(\n (record) =>\n `${absoluteDomainName(record.name)} IN ${record.type} ${record.priority === undefined ? \"\" : `${record.priority} `}${zoneValue(record)}`,\n )\n .join(\"\\n\")}\\n`;\n\nexport type { DnsRecord, ObservationEvidence };\n","import { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { useCallback } from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport * as Records from \"./records.tsx\";\nimport * as RequestState from \"./request-state.ts\";\nimport type { ApplyResult, Connected, DnsRecord, Failure, ProvisioningPlan } from \"./transport.ts\";\n\nexport type State =\n | { readonly _tag: \"Idle\" }\n | { readonly _tag: \"Planning\" }\n | { readonly _tag: \"Review\"; readonly plan: ProvisioningPlan }\n | { readonly _tag: \"Applying\"; readonly plan: ProvisioningPlan }\n | {\n readonly _tag: \"Complete\";\n readonly result: Extract<ApplyResult, { readonly _tag: \"Applied\" }>;\n }\n | {\n readonly _tag: \"Partial\";\n readonly result: Extract<ApplyResult, { readonly _tag: \"Partial\" }>;\n }\n | { readonly _tag: \"Stale\"; readonly message: string }\n | Failure;\n\nexport interface Controller {\n readonly apply: () => Promise<void>;\n readonly dismiss: () => void;\n readonly plan: () => Promise<void>;\n readonly retry: () => Promise<void>;\n readonly state: State;\n}\n\nconst failure = (cause: unknown): Failure => ({\n _tag: \"Failure\",\n message: cause instanceof Error ? cause.message : \"DNS provisioning failed\",\n retry: \"safe\",\n});\n\nexport function useController(\n connection: Connected,\n records: ReadonlyArray<DnsRecord>,\n onApplied?: (result: Extract<ApplyResult, { readonly _tag: \"Applied\" | \"Partial\" }>) => void,\n): Controller {\n const { transport } = useDomainKit();\n const identity = `${connection.connectionId}:${connection.domain}:${RequestState.recordsIdentity(records)}`;\n const requestState = RequestState.useController<State>(identity, { _tag: \"Idle\" });\n const state = requestState.state;\n\n const plan = useCallback(async () => {\n const request = requestState.begin({ _tag: \"Planning\" });\n try {\n const result = await transport.provisioning.plan({\n connectionId: connection.connectionId,\n domain: connection.domain,\n records,\n });\n requestState.commit(\n request,\n result._tag === \"Plan\" ? { _tag: \"Review\", plan: result } : result,\n );\n } catch (cause) {\n requestState.commit(request, failure(cause));\n }\n }, [connection.connectionId, connection.domain, records, requestState, transport]);\n\n const apply = useCallback(async () => {\n if (state._tag !== \"Review\") return;\n const reviewedPlan = state.plan;\n if (reviewedPlan.operations.some((operation) => operation._tag === \"Conflict\")) return;\n const request = requestState.begin({ _tag: \"Applying\", plan: reviewedPlan });\n try {\n const result = await transport.provisioning.apply({\n connectionId: connection.connectionId,\n domain: connection.domain,\n planDigest: reviewedPlan.digest,\n });\n if (result._tag === \"Applied\") {\n if (requestState.commit(request, { _tag: \"Complete\", result })) onApplied?.(result);\n } else if (result._tag === \"Partial\") {\n if (requestState.commit(request, { _tag: \"Partial\", result })) onApplied?.(result);\n } else {\n requestState.commit(request, result);\n }\n } catch (cause) {\n requestState.commit(request, failure(cause));\n }\n }, [connection.connectionId, connection.domain, onApplied, requestState, state, transport]);\n\n return {\n apply,\n dismiss: () => requestState.reset({ _tag: \"Idle\" }),\n plan,\n retry: plan,\n state,\n };\n}\n\nexport interface FlowProps extends PartProps<\"div\", { readonly status: State[\"_tag\"] }> {\n readonly connection: Connected;\n readonly onApplied?: (\n result: Extract<ApplyResult, { readonly _tag: \"Applied\" | \"Partial\" }>,\n ) => void;\n readonly records: ReadonlyArray<DnsRecord>;\n readonly showRecords?: boolean;\n}\n\nexport function Flow({ connection, onApplied, records, showRecords = true, ...props }: FlowProps) {\n const controller = useController(connection, records, onApplied);\n const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();\n const state = controller.state;\n const plan = state._tag === \"Review\" || state._tag === \"Applying\" ? state.plan : undefined;\n return usePart(\n \"div\",\n props,\n { status: state._tag },\n {\n children: (\n <>\n {showRecords ? <Records.Table records={records} /> : null}\n {state._tag === \"Complete\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"success\">\n {messages.recordsApplied}\n </p>\n ) : null}\n {state._tag === \"Partial\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {messages.recordsPartiallyApplied}\n </p>\n ) : null}\n {state._tag === \"Failure\" || state._tag === \"Stale\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {state.message}\n </p>\n ) : null}\n <BaseDialog.Root\n onOpenChange={(open) => {\n if (!open) controller.dismiss();\n }}\n open={plan !== undefined}\n >\n <BaseDialog.Trigger\n data-domainkit-part=\"plan-trigger\"\n disabled={state._tag === \"Planning\" || state._tag === \"Applying\"}\n onClick={() => void controller.plan()}\n >\n {state._tag === \"Planning\" ? messages.planningDns : messages.reviewDns}\n </BaseDialog.Trigger>\n {plan === undefined ? null : (\n <BaseDialog.Portal container={portalContainer ?? undefined}>\n <BaseDialog.Backdrop data-domainkit-part=\"dialog-backdrop\" />\n <BaseDialog.Popup\n data-color-scheme={colorScheme}\n data-domainkit-part=\"plan-dialog\"\n data-domainkit-root=\"\"\n style={themeStyle}\n >\n <div data-domainkit-part=\"dialog-header\">\n <div data-domainkit-part=\"dialog-heading\">\n <BaseDialog.Title data-domainkit-part=\"dialog-title\">\n {messages.reviewDns}\n </BaseDialog.Title>\n <BaseDialog.Description data-domainkit-part=\"dialog-description\">\n {messages.planConsent}\n </BaseDialog.Description>\n </div>\n <BaseDialog.Close\n aria-label={messages.close}\n data-domainkit-part=\"dialog-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <div data-domainkit-part=\"dialog-body\">\n <OperationList plan={plan} />\n </div>\n <div data-domainkit-part=\"dialog-footer\">\n <BaseDialog.Close data-domainkit-part=\"dialog-cancel\">\n {messages.cancel}\n </BaseDialog.Close>\n <button\n data-domainkit-part=\"plan-apply\"\n disabled={\n state._tag === \"Applying\" ||\n plan.operations.some((operation) => operation._tag === \"Conflict\")\n }\n onClick={() => void controller.apply()}\n type=\"button\"\n >\n {state._tag === \"Applying\" ? messages.applyingDns : messages.applyDns}\n </button>\n </div>\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n )}\n </BaseDialog.Root>\n {state._tag === \"Failure\" || state._tag === \"Stale\" || state._tag === \"Partial\" ? (\n <button\n data-domainkit-part=\"provisioning-retry\"\n onClick={() => void controller.retry()}\n type=\"button\"\n >\n {messages.retry}\n </button>\n ) : null}\n </>\n ),\n \"data-domainkit-part\": \"provisioning-flow\",\n \"data-state\": state._tag,\n },\n );\n}\n\nexport function OperationList({ plan }: { readonly plan: ProvisioningPlan }) {\n return (\n <ul data-domainkit-part=\"plan-operations\">\n {plan.operations.map((operation) => (\n <li data-operation={operation._tag} key={operation.id}>\n <span data-domainkit-part=\"operation-kind\">{operation._tag}</span>{\" \"}\n <strong data-domainkit-part=\"operation-type\">{operation.record.type}</strong>{\" \"}\n <span data-domainkit-part=\"operation-record\">\n <span data-domainkit-part=\"operation-name\">{operation.record.name}</span>\n <code data-domainkit-part=\"operation-value\">{operation.record.value}</code>\n {operation.record.priority === undefined ? null : (\n <span data-domainkit-part=\"operation-priority\">\n Priority {operation.record.priority}\n </span>\n )}\n {operation._tag === \"Conflict\" ? (\n <span data-domainkit-part=\"operation-reason\">{operation.reason}</span>\n ) : null}\n </span>\n </li>\n ))}\n </ul>\n );\n}\n","import { useCallback } from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport { Status as RecordStatus } from \"./records.tsx\";\nimport * as RequestState from \"./request-state.ts\";\nimport type {\n Connected,\n DnsRecord,\n Failure,\n Observation,\n ObservationEvidence,\n} from \"./transport.ts\";\n\nexport type State =\n | { readonly _tag: \"Idle\" }\n | { readonly _tag: \"Observing\" }\n | Observation\n | Failure;\n\nexport interface ObserveConfig {\n readonly connection?: Connected;\n readonly domain: string;\n readonly records: ReadonlyArray<DnsRecord>;\n readonly sources?: {\n readonly provider?: boolean;\n readonly publicDns?: boolean;\n };\n}\n\nexport function useController(config: ObserveConfig) {\n const { transport } = useDomainKit();\n const sources = {\n provider: config.sources?.provider ?? config.connection !== undefined,\n publicDns: config.sources?.publicDns ?? true,\n };\n const requestState = RequestState.useController<State>(\n `${config.connection?.connectionId ?? \"public\"}:${config.domain}:${sources.provider}:${sources.publicDns}:${RequestState.recordsIdentity(config.records)}`,\n { _tag: \"Idle\" },\n );\n const state = requestState.state;\n const observe = useCallback(async () => {\n const request = requestState.begin({ _tag: \"Observing\" });\n try {\n requestState.commit(\n request,\n await transport.verification.observe({\n ...(config.connection === undefined\n ? {}\n : { connectionId: config.connection.connectionId }),\n domain: config.domain,\n records: config.records,\n sources,\n }),\n );\n } catch (cause) {\n requestState.commit(request, {\n _tag: \"Failure\",\n message: cause instanceof Error ? cause.message : \"DNS observation failed\",\n retry: \"safe\",\n });\n }\n }, [config, requestState, sources, transport]);\n return { observe, state } as const;\n}\n\nconst evidenceNote = (evidence: ObservationEvidence): string | undefined => {\n switch (evidence._tag) {\n case \"Mismatch\":\n case \"Unavailable\":\n return evidence.message;\n case \"Found\":\n case \"Missing\":\n return undefined;\n default: {\n const _exhaustive: never = evidence;\n return _exhaustive;\n }\n }\n};\n\nconst observationGroups = (\n observation: Observation,\n): ReadonlyArray<{\n readonly evidence: ReadonlyArray<ObservationEvidence>;\n readonly label: string;\n}> =>\n [\n { evidence: observation.provider, label: \"Provider\" },\n { evidence: observation.publicDns, label: \"Public DNS\" },\n ].filter((group) => group.evidence.length > 0);\n\nexport interface StatusProps extends PartProps<\"div\", { readonly status: State[\"_tag\"] }> {\n readonly config: ObserveConfig;\n}\n\nexport function Status({ config, ...props }: StatusProps) {\n const controller = useController(config);\n const { messages } = useDomainKit();\n const state = controller.state;\n return usePart(\n \"div\",\n props,\n { status: state._tag },\n {\n children: (\n <>\n {state._tag === \"Observation\" ? (\n <div data-domainkit-part=\"observation-list\">\n {observationGroups(state).map((group) => (\n <section data-domainkit-part=\"observation-group\" key={group.label}>\n <p data-domainkit-part=\"observation-source\">{group.label}</p>\n <ul>\n {group.evidence.map((evidence, index) => {\n const note = evidenceNote(evidence);\n return (\n <li key={`${evidence._tag}-${evidence.recordId}-${index}`}>\n <div data-domainkit-part=\"observation-row\">\n <span data-domainkit-part=\"observation-record\">\n {evidence.recordId}\n </span>\n <RecordStatus evidence={evidence} />\n </div>\n {note === undefined ? null : (\n <p data-domainkit-part=\"observation-note\">{note}</p>\n )}\n </li>\n );\n })}\n </ul>\n </section>\n ))}\n </div>\n ) : state._tag === \"Failure\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {state.message}\n </p>\n ) : null}\n <button\n data-domainkit-part=\"observe-action\"\n disabled={state._tag === \"Observing\"}\n onClick={() => void controller.observe()}\n type=\"button\"\n >\n {state._tag === \"Observing\" ? messages.checkingDns : messages.checkDns}\n </button>\n </>\n ),\n \"data-domainkit-part\": \"verification-status\",\n \"data-state\": state._tag,\n },\n );\n}\n\nexport type { Observation };\n","import { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport * as Cleanup from \"./cleanup.tsx\";\nimport * as Connection from \"./connection.tsx\";\nimport * as Provisioning from \"./provisioning.tsx\";\nimport * as Provider from \"./provider.tsx\";\nimport * as Records from \"./records.tsx\";\nimport * as Verification from \"./verification.tsx\";\nimport type { ApplyResult, DnsRecord } from \"./transport.ts\";\n\nexport interface FlowProps {\n readonly domain: string;\n readonly receiptId?: string;\n readonly records: ReadonlyArray<DnsRecord>;\n}\n\nexport function Flow({ domain, receiptId, records }: FlowProps) {\n const connection = Connection.useController(domain);\n const state = connection.state;\n return (\n <Connection.Root status={state._tag}>\n {state._tag === \"Connected\" ? null : <Connection.Status state={state} />}\n {state._tag === \"Failure\" && (state.retry === \"safe\" || state.retry === \"unknown\") ? (\n <Connection.RetryAction controller={connection} />\n ) : null}\n {state._tag === \"Disconnected\" ? (\n <BaseDialog.Root>\n <Connection.Trigger provider={state.provider} />\n <Connection.Dialog controller={connection} snapshot={state} />\n </BaseDialog.Root>\n ) : null}\n {state._tag === \"Connected\" ? (\n <div data-domainkit-part=\"connected-shell\">\n <ConnectedFlow\n connection={state}\n {...(receiptId === undefined ? {} : { initialReceiptId: receiptId })}\n records={records}\n />\n </div>\n ) : null}\n </Connection.Root>\n );\n}\n\nfunction ConnectedFlow({\n connection,\n initialReceiptId,\n records,\n}: {\n readonly connection: Extract<Connection.State, { readonly _tag: \"Connected\" }>;\n readonly initialReceiptId?: string;\n readonly records: ReadonlyArray<DnsRecord>;\n}) {\n const [appliedReceipt, setAppliedReceipt] = useState<{\n readonly epoch: number;\n readonly receiptId: string;\n }>();\n const receiptSource = initialReceiptId ?? null;\n const receiptEpoch = useRef({ source: receiptSource, value: 0 });\n const epoch =\n receiptEpoch.current.source === receiptSource\n ? receiptEpoch.current.value\n : receiptEpoch.current.value + 1;\n useEffect(() => {\n if (receiptEpoch.current.source === receiptSource) return;\n receiptEpoch.current = { source: receiptSource, value: receiptEpoch.current.value + 1 };\n setAppliedReceipt(undefined);\n }, [receiptSource]);\n const receiptId =\n appliedReceipt !== undefined && appliedReceipt.epoch === epoch\n ? appliedReceipt.receiptId\n : initialReceiptId;\n const rememberReceipt = (\n result: Extract<ApplyResult, { readonly _tag: \"Applied\" | \"Partial\" }>,\n ) => {\n setAppliedReceipt({ epoch, receiptId: result.receiptId });\n };\n return (\n <>\n <div data-domainkit-part=\"connected-card\">\n <div data-domainkit-part=\"connected-identity\">\n <Provider.Mark provider={connection.provider} />\n <Connection.Status state={connection} />\n </div>\n <div data-domainkit-part=\"connected-actions\">\n <Provisioning.Flow\n connection={connection}\n onApplied={rememberReceipt}\n records={records}\n showRecords={false}\n />\n <Verification.Status config={{ connection, domain: connection.domain, records }} />\n <Connection.DisconnectAction connection={connection} />\n </div>\n </div>\n <Records.Table records={records} />\n {receiptId === undefined ? null : (\n <Cleanup.Flow connection={connection} receiptId={receiptId} />\n )}\n </>\n );\n}\n","import type {\n Connected,\n ConnectionResult,\n ConnectionSnapshot,\n DomainKitTransport,\n ApplyResult,\n CleanupPlan,\n CleanupResult,\n Observation,\n Provider,\n ProvisioningPlan,\n RemoveDomainResult,\n} from \"./transport.ts\";\n\nexport interface FakeOptions {\n readonly connect?: ConnectionResult;\n readonly inspect: ConnectionSnapshot | ReadonlyArray<ConnectionSnapshot>;\n readonly reuse?: Connected;\n readonly removeDomain?: RemoveDomainResult;\n readonly plan?: ProvisioningPlan;\n readonly apply?: ApplyResult;\n readonly observe?: Observation;\n readonly cleanupPlan?: CleanupPlan;\n readonly cleanupApply?: CleanupResult;\n}\n\nexport interface FakeTransport extends DomainKitTransport {\n readonly calls: {\n readonly connect: Array<Parameters<DomainKitTransport[\"connection\"][\"connect\"]>[0]>;\n readonly inspect: Array<Parameters<DomainKitTransport[\"connection\"][\"inspect\"]>[0]>;\n readonly reuse: Array<Parameters<DomainKitTransport[\"connection\"][\"reuse\"]>[0]>;\n readonly removeDomain: Array<Parameters<DomainKitTransport[\"connection\"][\"removeDomain\"]>[0]>;\n readonly plan: Array<Parameters<DomainKitTransport[\"provisioning\"][\"plan\"]>[0]>;\n readonly apply: Array<Parameters<DomainKitTransport[\"provisioning\"][\"apply\"]>[0]>;\n readonly observe: Array<Parameters<DomainKitTransport[\"verification\"][\"observe\"]>[0]>;\n readonly cleanupPlan: Array<Parameters<DomainKitTransport[\"cleanup\"][\"plan\"]>[0]>;\n readonly cleanupApply: Array<Parameters<DomainKitTransport[\"cleanup\"][\"apply\"]>[0]>;\n };\n}\n\nexport const provider = (overrides: Partial<Provider> = {}): Provider => ({\n authentication: [\n { _tag: \"OAuth\", label: \"Continue with OAuth\" },\n { _tag: \"Token\", label: \"Connect with token\", placeholder: \"Paste API token\" },\n ],\n id: \"cloudflare\",\n name: \"Cloudflare\",\n ...overrides,\n});\n\nexport function makeFakeTransport(options: FakeOptions): FakeTransport {\n const calls: FakeTransport[\"calls\"] = {\n apply: [],\n cleanupApply: [],\n cleanupPlan: [],\n connect: [],\n inspect: [],\n observe: [],\n plan: [],\n removeDomain: [],\n reuse: [],\n };\n const inspections = Array.isArray(options.inspect) ? [...options.inspect] : [options.inspect];\n return {\n calls,\n cleanup: {\n apply: async (input) => {\n calls.cleanupApply.push(input);\n return (\n options.cleanupApply ?? {\n _tag: \"Cleaned\",\n operationId: \"cleanup-operation-1\",\n results: [],\n }\n );\n },\n plan: async (input) => {\n calls.cleanupPlan.push(input);\n return (\n options.cleanupPlan ?? {\n _tag: \"CleanupPlan\",\n digest: \"cleanup-digest-1\",\n expiresAt: \"2099-01-01T00:00:00.000Z\",\n operations: [],\n }\n );\n },\n },\n connection: {\n connect: async (input) => {\n calls.connect.push(input);\n return (\n options.connect ?? {\n _tag: \"Connected\",\n connectionId: \"connection-1\",\n domain: input.domain,\n provider: provider(),\n }\n );\n },\n inspect: async (input) => {\n calls.inspect.push(input);\n return inspections.shift() ?? inspections.at(-1) ?? options.inspect;\n },\n reuse: async (input) => {\n calls.reuse.push(input);\n return (\n options.reuse ?? {\n _tag: \"Connected\",\n connectionId: input.connectionId,\n domain: input.domain,\n provider: provider(),\n }\n );\n },\n removeDomain: async (input) => {\n calls.removeDomain.push(input);\n return (\n options.removeDomain ?? {\n _tag: \"Removed\",\n connectionId: input.connectionId,\n domain: input.domain,\n remainingDomainCount: 0,\n }\n );\n },\n },\n provisioning: {\n apply: async (input) => {\n calls.apply.push(input);\n return (\n options.apply ?? {\n _tag: \"Applied\",\n operationId: \"apply-operation-1\",\n receiptId: \"receipt-1\",\n results: [],\n }\n );\n },\n plan: async (input) => {\n calls.plan.push(input);\n return (\n options.plan ?? {\n _tag: \"Plan\",\n digest: \"plan-digest-1\",\n expiresAt: \"2099-01-01T00:00:00.000Z\",\n operations: input.records.map((record) => ({\n _tag: \"Create\" as const,\n id: `create-${record.id}`,\n record,\n })),\n }\n );\n },\n },\n verification: {\n observe: async (input) => {\n calls.observe.push(input);\n return (\n options.observe ?? {\n _tag: \"Observation\",\n provider: input.sources.provider\n ? input.records.map((record) => ({ _tag: \"Found\" as const, recordId: record.id }))\n : [],\n publicDns: input.sources.publicDns\n ? input.records.map((record) => ({ _tag: \"Found\" as const, recordId: record.id }))\n : [],\n }\n );\n },\n },\n };\n}\n","export interface Failure {\n readonly _tag: \"Failure\";\n readonly message: string;\n readonly retry: \"never\" | \"after-user-action\" | \"safe\" | \"unknown\";\n}\n\nexport interface AuthenticationParameter {\n readonly description?: string;\n readonly key: string;\n readonly label: string;\n readonly placeholder?: string;\n readonly required?: boolean;\n}\n\nexport type AuthenticationMethod =\n | { readonly _tag: \"OAuth\"; readonly label: string }\n | {\n readonly _tag: \"Token\";\n readonly label: string;\n readonly parameters?: ReadonlyArray<AuthenticationParameter>;\n readonly placeholder?: string;\n };\n\nexport interface Provider {\n readonly authentication: ReadonlyArray<AuthenticationMethod>;\n readonly id: string;\n readonly name: string;\n}\n\nexport interface Connected {\n readonly _tag: \"Connected\";\n readonly connectionId: string;\n readonly domain: string;\n readonly provider: Provider;\n}\n\nexport interface ReusableConnection {\n readonly connectionId: string;\n readonly label: string;\n}\n\nexport type ConnectionSnapshot =\n | Connected\n | {\n readonly _tag: \"Disconnected\";\n readonly domain: string;\n readonly provider: Provider;\n readonly reusableConnection?: ReusableConnection;\n }\n | { readonly _tag: \"Unsupported\"; readonly domain: string }\n | Failure;\n\nexport type ConnectionResult =\n | Connected\n | { readonly _tag: \"Redirect\"; readonly authorizationUrl: string }\n | Failure;\n\nexport interface ConnectionTransport {\n readonly connect: (input: {\n readonly domain: string;\n readonly method: \"oauth\" | \"token\";\n readonly parameters?: Readonly<Record<string, string>>;\n readonly providerId: string;\n readonly token?: string;\n }) => Promise<ConnectionResult>;\n readonly inspect: (input: { readonly domain: string }) => Promise<ConnectionSnapshot>;\n readonly reuse: (input: {\n readonly connectionId: string;\n readonly domain: string;\n }) => Promise<Connected | Failure>;\n readonly removeDomain: (input: {\n readonly connectionId: string;\n readonly domain: string;\n readonly preserveDns: true;\n }) => Promise<RemoveDomainResult | Failure>;\n}\n\nexport interface RemoveDomainResult {\n readonly _tag: \"Removed\";\n readonly connectionId: string;\n readonly domain: string;\n readonly remainingDomainCount: number;\n}\n\nexport interface DnsRecord {\n readonly id: string;\n readonly name: string;\n readonly priority?: number;\n readonly type: string;\n readonly value: string;\n}\n\nexport type PlanOperation =\n | { readonly _tag: \"Create\"; readonly id: string; readonly record: DnsRecord }\n | { readonly _tag: \"Noop\"; readonly id: string; readonly record: DnsRecord }\n | {\n readonly _tag: \"Conflict\";\n readonly id: string;\n readonly record: DnsRecord;\n readonly reason: string;\n };\n\nexport interface ProvisioningPlan {\n readonly _tag: \"Plan\";\n readonly digest: string;\n readonly expiresAt: string;\n readonly operations: ReadonlyArray<PlanOperation>;\n}\n\nexport type OperationResult =\n | { readonly _tag: \"Applied\"; readonly operationId: string }\n | { readonly _tag: \"Unchanged\"; readonly operationId: string }\n | { readonly _tag: \"Failed\"; readonly message: string; readonly operationId: string };\n\nexport type ApplyResult =\n | {\n readonly _tag: \"Applied\";\n readonly operationId: string;\n readonly receiptId: string;\n readonly results: ReadonlyArray<OperationResult>;\n }\n | {\n readonly _tag: \"Partial\";\n readonly operationId: string;\n readonly receiptId: string;\n readonly results: ReadonlyArray<OperationResult>;\n }\n | { readonly _tag: \"Stale\"; readonly message: string }\n | Failure;\n\nexport interface ProvisioningTransport {\n readonly plan: (input: {\n readonly connectionId: string;\n readonly domain: string;\n readonly records: ReadonlyArray<DnsRecord>;\n }) => Promise<ProvisioningPlan | Failure>;\n readonly apply: (input: {\n readonly connectionId: string;\n readonly domain: string;\n readonly planDigest: string;\n }) => Promise<ApplyResult>;\n}\n\nexport type ObservationEvidence =\n | { readonly _tag: \"Found\"; readonly recordId: string }\n | { readonly _tag: \"Missing\"; readonly recordId: string }\n | { readonly _tag: \"Mismatch\"; readonly recordId: string; readonly message: string }\n | { readonly _tag: \"Unavailable\"; readonly recordId: string; readonly message: string };\n\nexport interface Observation {\n readonly _tag: \"Observation\";\n readonly provider: ReadonlyArray<ObservationEvidence>;\n readonly publicDns: ReadonlyArray<ObservationEvidence>;\n}\n\nexport interface VerificationTransport {\n readonly observe: (input: {\n readonly connectionId?: string;\n readonly domain: string;\n readonly records: ReadonlyArray<DnsRecord>;\n readonly sources: {\n readonly provider: boolean;\n readonly publicDns: boolean;\n };\n }) => Promise<Observation | Failure>;\n}\n\nexport type CleanupOperation =\n | { readonly _tag: \"Delete\"; readonly id: string; readonly record: DnsRecord }\n | { readonly _tag: \"AlreadyAbsent\"; readonly id: string; readonly record: DnsRecord }\n | {\n readonly _tag: \"Blocked\";\n readonly id: string;\n readonly record: DnsRecord;\n readonly reason: string;\n };\n\nexport interface CleanupPlan {\n readonly _tag: \"CleanupPlan\";\n readonly digest: string;\n readonly expiresAt: string;\n readonly operations: ReadonlyArray<CleanupOperation>;\n}\n\nexport type CleanupResult =\n | {\n readonly _tag: \"Cleaned\";\n readonly operationId: string;\n readonly results: ReadonlyArray<OperationResult>;\n }\n | {\n readonly _tag: \"Partial\";\n readonly operationId: string;\n readonly results: ReadonlyArray<OperationResult>;\n }\n | { readonly _tag: \"Stale\"; readonly message: string }\n | Failure;\n\nexport interface CleanupTransport {\n readonly plan: (input: {\n readonly connectionId: string;\n readonly domain: string;\n readonly receiptId: string;\n }) => Promise<CleanupPlan | Failure>;\n readonly apply: (input: {\n readonly connectionId: string;\n readonly domain: string;\n readonly planDigest: string;\n readonly receiptId: string;\n }) => Promise<CleanupResult>;\n}\n\nexport interface DomainKitTransport {\n readonly cleanup: CleanupTransport;\n readonly connection: ConnectionTransport;\n readonly provisioning: ProvisioningTransport;\n readonly verification: VerificationTransport;\n}\n"],"mappings":";;;;;;AAeA,SAAgB,QAId,gBACA,gBACA,OACA,eACc;CACd,MAAM,EAAE,WAAW,QAAQ,OAAO,GAAG,kBAAkB;CACvD,MAAM,aAGF;EACF,GAAI,cAAc,KAAA,IAAY,C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MAAM,KAAK,YAAY,GAAG,EAAE,KAAK,QAAQ;GAC9D;GACA,OAAO,OAAO,UAAU;IACtB,MAAM,MAAM,KAAK,KAAK;IACtB,OACE,QAAQ,SAAS;KACf,MAAM;KACN,cAAc,MAAM;KACpB,QAAQ,MAAM;KACd,UAAU,SAAS;IACrB;GAEJ;GACA,cAAc,OAAO,UAAU;IAC7B,MAAM,aAAa,KAAK,KAAK;IAC7B,OACE,QAAQ,gBAAgB;KACtB,MAAM;KACN,cAAc,MAAM;KACpB,QAAQ,MAAM;KACd,sBAAsB;IACxB;GAEJ;EACF;EACA,cAAc;GACZ,OAAO,OAAO,UAAU;IACtB,MAAM,MAAM,KAAK,KAAK;IACtB,OACE,QAAQ,SAAS;KACf,MAAM;KACN,aAAa;KACb,WAAW;KACX,SAAS,CAAC;IACZ;GAEJ;GACA,MAAM,OAAO,UAAU;IACrB,MAAM,KAAK,KAAK,KAAK;IACrB,OACE,QAAQ,QAAQ;KACd,MAAM;KACN,QAAQ;KACR,WAAW;KACX,YAAY,MAAM,QAAQ,KAAK,YAAY;MACzC,MAAM;MACN,IAAI,UAAU,OAAO;MACrB;KACF,EAAE;IACJ;GAEJ;EACF;EACA,cAAc,EACZ,SAAS,OAAO,UAAU;GACxB,MAAM,QAAQ,KAAK,KAAK;GACxB,OACE,QAAQ,WAAW;IACjB,MAAM;IACN,UAAU,MAAM,QAAQ,WACpB,MAAM,QAAQ,KAAK,YAAY;KAAE,MAAM;KAAkB,UAAU,OAAO;IAAG,EAAE,IAC/E,CAAC;IACL,WAAW,MAAM,QAAQ,YACrB,MAAM,QAAQ,KAAK,YAAY;KAAE,MAAM;KAAkB,UAAU,OAAO;IAAG,EAAE,IAC/E,CAAC;GACP;EAEJ,EACF;CACF;AACF"}
1
+ {"version":3,"file":"index.mjs","names":["Root","mergeMessages","leafPart","Value","Priority","Root","State","Command","useModel","useController","Root","Outcome","Dialog","BaseDialog","Operations.List","Flow","State","Command","useModel","useController","Root","Status","BaseDialog","Provider.Mark","Dialog","Flow","RetryAction","Status","Root","State","Command","useModel","useController","Root","Outcome","Dialog","BaseDialog","Operations.List","Flow","Records.Table","_exhaustive","RecordStatus","Connection.useController","Connection.Root","Connection.Status","Connection.RetryAction","BaseDialog","Connection.ConnectTrigger","Connection.Dialog","Provider.Mark","Provisioning.Flow","Verification.Status","Connection.DisconnectAction","Records.Table","Cleanup.Flow"],"sources":["../src/atom.ts","../src/composition.tsx","../src/icons.tsx","../src/messages.ts","../src/theme.ts","../src/domain-kit.tsx","../src/operations.tsx","../src/cleanup.tsx","../src/provider.tsx","../src/connection.tsx","../src/records.tsx","../src/provisioning.tsx","../src/verification.tsx","../src/domain.tsx","../src/testing.ts"],"sourcesContent":["import * as Data from \"effect/Data\";\nimport type * as Atom from \"effect/unstable/reactivity/Atom\";\nimport { Transport } from \"domainkit\";\n\nexport type Runtime = Atom.AtomRuntime<Transport.Service>;\n\nexport type Failure = Data.TaggedEnum<{\n Failure: {\n readonly message: string;\n readonly operation: string;\n readonly retry: Transport.Failure[\"retry\"];\n };\n}>;\nexport const Failure = Data.taggedEnum<Failure>();\n\nexport const failureFromError = (error: Transport.Failure): Failure =>\n Failure.Failure({\n message: error.message,\n operation: error.operation,\n retry: error.retry,\n });\n\nexport const failureFromDefect = (operation: string, message: string): Failure =>\n Failure.Failure({ message, operation, retry: \"safe\" });\n\nexport const recordsIdentity = (records: ReadonlyArray<Transport.DnsRecord>): string =>\n JSON.stringify(\n records.map(({ id, name, priority, type, value }) => ({ id, name, priority, type, value })),\n );\n","import { useRender } from \"@base-ui/react/use-render\";\nimport type { CSSProperties, ElementType, ReactElement } from \"react\";\n\nexport type ClassName<State> = string | ((state: State) => string | undefined);\nexport type Style<State> = CSSProperties | ((state: State) => CSSProperties | undefined);\n\nexport type PartProps<Tag extends ElementType, State extends Record<string, unknown>> = Omit<\n useRender.ElementProps<Tag>,\n \"className\" | \"style\"\n> & {\n readonly className?: ClassName<State>;\n readonly render?: useRender.RenderProp<State>;\n readonly style?: Style<State>;\n};\n\nexport function usePart<\n Tag extends keyof React.JSX.IntrinsicElements,\n State extends Record<string, unknown>,\n>(\n defaultTagName: Tag,\n componentProps: PartProps<Tag, State>,\n state: State,\n internalProps: Record<string, unknown>,\n): ReactElement {\n const { className, render, style, ...externalProps } = componentProps;\n const parameters: useRender.Parameters<State, Element, undefined> & {\n readonly className?: ClassName<State>;\n readonly style?: Style<State>;\n } = {\n ...(className === undefined ? {} : { className }),\n defaultTagName,\n props: [internalProps, externalProps] as unknown as Record<string, unknown>,\n ...(render === undefined ? {} : { render }),\n state,\n ...(style === undefined ? {} : { style }),\n };\n return useRender(parameters);\n}\n","import { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nexport type Icons = {\n readonly copied: ReactNode;\n readonly copy: ReactNode;\n readonly download: ReactNode;\n};\n\nfunction Glyph({ children }: { readonly children: ReactNode }) {\n return (\n <svg\n aria-hidden=\"true\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n viewBox=\"0 0 24 24\"\n >\n {children}\n </svg>\n );\n}\n\nexport const defaultIcons = {\n copied: (\n <Glyph>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n ),\n copy: (\n <Glyph>\n <rect height=\"14\" rx=\"2\" width=\"14\" x=\"8\" y=\"8\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </Glyph>\n ),\n download: (\n <Glyph>\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <path d=\"m7 10 5 5 5-5\" />\n <path d=\"M12 15V3\" />\n </Glyph>\n ),\n} as const satisfies Icons;\n\nconst IconsContext = createContext<Icons>(defaultIcons);\n\nexport function IconsProvider({\n children,\n icons,\n}: {\n readonly children: ReactNode;\n readonly icons?: Partial<Icons>;\n}) {\n const value = useMemo<Icons>(\n () => ({\n copied: icons?.copied ?? defaultIcons.copied,\n copy: icons?.copy ?? defaultIcons.copy,\n download: icons?.download ?? defaultIcons.download,\n }),\n [icons],\n );\n return <IconsContext.Provider value={value}>{children}</IconsContext.Provider>;\n}\n\nexport function useIcons(): Icons {\n return useContext(IconsContext);\n}\n","export interface Catalog {\n readonly applyCleanup: string;\n readonly applyDns: string;\n readonly applyingDns: string;\n readonly automaticUnavailable: string;\n readonly cancel: string;\n readonly checkAgain: string;\n readonly checkingDns: string;\n readonly checkDns: string;\n readonly cleanupComplete: string;\n readonly cleanupConsent: string;\n readonly cleanupPartial: string;\n readonly cleaningDns: string;\n readonly connectProvider: (provider: string) => string;\n readonly connected: (provider: string) => string;\n readonly providerAvailable: (provider: string) => string;\n readonly connecting: string;\n readonly close: string;\n readonly detectingProvider: string;\n readonly disconnectDomain: string;\n readonly disconnecting: string;\n readonly domainDisconnected: string;\n readonly dialogDescription: (domain: string) => string;\n readonly dialogTitle: (provider: string) => string;\n readonly openingAuthorization: string;\n readonly planConsent: string;\n readonly planningCleanup: string;\n readonly planningDns: string;\n readonly recordsApplied: string;\n readonly recordsPartiallyApplied: string;\n readonly reviewCleanup: string;\n readonly reviewDns: string;\n readonly retry: string;\n readonly reuseConnection: (connection: string) => string;\n readonly tokenLabel: string;\n}\n\nexport const english: Catalog = {\n applyCleanup: \"Remove records\",\n applyDns: \"Add records\",\n applyingDns: \"Adding records…\",\n automaticUnavailable: \"Automatic connection is not available for this domain\",\n cancel: \"Cancel\",\n checkAgain: \"Check again\",\n checkingDns: \"Checking DNS…\",\n checkDns: \"Check DNS\",\n cleanupComplete: \"DNS cleanup complete\",\n cleanupConsent: \"Only records proven by the apply receipt will be deleted.\",\n cleanupPartial: \"Some DNS records could not be deleted. Review and retry safely.\",\n cleaningDns: \"Removing records…\",\n connectProvider: () => \"Connect\",\n connected: (provider) => `${provider} connected`,\n providerAvailable: (provider) => `${provider} manages DNS for this domain`,\n connecting: \"Connecting…\",\n close: \"Close\",\n detectingProvider: \"Detecting DNS provider…\",\n disconnectDomain: \"Disconnect\",\n disconnecting: \"Disconnecting…\",\n domainDisconnected: \"Domain disconnected. DNS records were preserved.\",\n dialogDescription: (domain) => `Authorize DNS changes for ${domain}.`,\n dialogTitle: (provider) => `Connect ${provider}`,\n openingAuthorization: \"Opening provider authorization…\",\n planConsent: \"Review the exact DNS operations before approving this plan.\",\n planningCleanup: \"Preparing cleanup…\",\n planningDns: \"Preparing DNS changes…\",\n recordsApplied: \"DNS changes applied\",\n recordsPartiallyApplied: \"Some DNS changes failed. Review and retry safely.\",\n reviewCleanup: \"Remove records\",\n reviewDns: \"Review changes\",\n retry: \"Try again\",\n reuseConnection: (connection) => `Use ${connection}`,\n tokenLabel: \"API token\",\n};\n\nexport const merge = (overrides: Partial<Catalog> = {}): Catalog => ({\n ...english,\n ...overrides,\n});\n","import type { CSSProperties } from \"react\";\n\nexport interface Theme {\n readonly accent?: string;\n readonly accentContrast?: string;\n readonly background?: string;\n readonly border?: string;\n readonly danger?: string;\n readonly fill?: string;\n readonly fontFamily?: string;\n readonly muted?: string;\n readonly radius?: string;\n readonly shadow?: string;\n readonly success?: string;\n readonly text?: string;\n}\n\nconst variables = {\n accent: \"--domainkit-accent\",\n accentContrast: \"--domainkit-accent-contrast\",\n background: \"--domainkit-background\",\n border: \"--domainkit-border\",\n danger: \"--domainkit-danger\",\n fill: \"--domainkit-fill\",\n fontFamily: \"--domainkit-font-family\",\n muted: \"--domainkit-muted\",\n radius: \"--domainkit-radius\",\n shadow: \"--domainkit-shadow\",\n success: \"--domainkit-success\",\n text: \"--domainkit-text\",\n} as const satisfies Record<keyof Theme, string>;\n\nexport function toStyle(theme: Theme = {}): CSSProperties {\n return Object.fromEntries(\n Object.entries(theme).flatMap(([key, value]) =>\n value === undefined ? [] : [[variables[key as keyof Theme], value]],\n ),\n ) as CSSProperties;\n}\n","import { RegistryProvider } from \"@effect/atom-react\";\nimport { Transport } from \"domainkit\";\nimport type * as Layer from \"effect/Layer\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useSyncExternalStore,\n type ReactNode,\n type RefObject,\n} from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport type { Icons } from \"./icons.tsx\";\nimport { IconsProvider } from \"./icons.tsx\";\nimport type { Catalog } from \"./messages.ts\";\nimport { merge as mergeMessages } from \"./messages.ts\";\nimport type { Marks } from \"./provider.tsx\";\nimport type { Theme } from \"./theme.ts\";\nimport { toStyle } from \"./theme.ts\";\nimport type { Runtime } from \"./atom.ts\";\n\nexport interface RootState extends Record<string, unknown> {\n readonly colorScheme: \"dark\" | \"inherit\" | \"light\";\n}\n\nexport interface RootProps extends Omit<PartProps<\"div\", RootState>, \"children\"> {\n readonly children: ReactNode;\n readonly colorScheme?: RootState[\"colorScheme\"];\n readonly icons?: Partial<Icons>;\n readonly messages?: Partial<Catalog>;\n readonly marks?: Marks;\n readonly navigate?: (url: string) => void;\n readonly portalContainer?: HTMLElement | null;\n readonly theme?: Theme;\n readonly transport: Layer.Layer<Transport.Service>;\n}\n\ninterface ContextValue {\n readonly colorScheme: RootState[\"colorScheme\"];\n readonly navigate: (url: string) => void;\n readonly marks: Marks;\n readonly messages: Catalog;\n readonly portalContainer: RefObject<HTMLElement | null>;\n readonly themeStyle: ReturnType<typeof toStyle>;\n readonly runtime: Runtime;\n}\n\nconst Context = createContext<ContextValue | null>(null);\n\nconst navigateInBrowser = (url: string): void => {\n if (typeof window === \"undefined\") {\n throw new Error(\"DomainKit OAuth navigation requires a browser or a custom navigate function\");\n }\n window.location.assign(url);\n};\n\nconst resolvePortalContainer = (\n container: HTMLElement | null,\n ownerDocument: Document | null,\n): HTMLElement | null => {\n if (container === null || ownerDocument === null) return null;\n return container.ownerDocument === ownerDocument && container.getRootNode() === ownerDocument\n ? container\n : null;\n};\n\nconst usePortalContainer = (container: HTMLElement | null): HTMLElement | null => {\n const ownerDocument = useMemo(() => container?.ownerDocument ?? null, [container]);\n const subscribe = useCallback(\n (notify: () => void) => {\n if (ownerDocument === null || typeof MutationObserver === \"undefined\") return () => {};\n const observer = new MutationObserver(notify);\n observer.observe(ownerDocument, { childList: true, subtree: true });\n return () => observer.disconnect();\n },\n [ownerDocument],\n );\n const getSnapshot = useCallback(\n () => resolvePortalContainer(container, ownerDocument),\n [container, ownerDocument],\n );\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n};\n\nexport function Root({\n children,\n colorScheme = \"inherit\",\n icons,\n marks = {},\n messages,\n navigate = navigateInBrowser,\n portalContainer = null,\n theme,\n transport,\n ...props\n}: RootProps) {\n const runtime = useMemo(() => Atom.runtime(transport), [transport]);\n const themeStyle = toStyle(theme);\n const resolvedPortalContainer = usePortalContainer(portalContainer);\n const portalContainerRef = useMemo<RefObject<HTMLElement | null>>(\n () => ({ current: resolvedPortalContainer }),\n [resolvedPortalContainer],\n );\n const content = usePart(\n \"div\",\n props,\n { colorScheme },\n {\n children,\n \"data-color-scheme\": colorScheme,\n \"data-domainkit-root\": \"\",\n style: themeStyle,\n },\n );\n return (\n <RegistryProvider>\n <Context.Provider\n value={{\n colorScheme,\n marks,\n messages: mergeMessages(messages),\n navigate,\n portalContainer: portalContainerRef,\n runtime,\n themeStyle,\n }}\n >\n <IconsProvider {...(icons === undefined ? {} : { icons })}>{content}</IconsProvider>\n </Context.Provider>\n </RegistryProvider>\n );\n}\n\nexport function useDomainKit(): ContextValue {\n const value = useContext(Context);\n if (value === null)\n throw new Error(\"DomainKit components must be rendered inside DomainKit.Root\");\n return value;\n}\n","import type { Transport } from \"domainkit\";\nimport type { ReactElement } from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\n\nexport type Operation =\n | Transport.ProvisioningPlan[\"operations\"][number]\n | Transport.CleanupPlan[\"operations\"][number];\n\ntype LeafState = Record<string, unknown>;\n\nfunction leafPart<Tag extends keyof React.JSX.IntrinsicElements>(\n defaultTagName: Tag,\n part: string,\n) {\n return function Leaf(props: PartProps<Tag, LeafState>): ReactElement {\n return usePart(defaultTagName, props, {}, { \"data-domainkit-part\": part });\n };\n}\n\nexport const Kind = leafPart(\"span\", \"operation-kind\");\nexport const Type = leafPart(\"strong\", \"operation-type\");\nexport const Record = leafPart(\"span\", \"operation-record\");\nexport const Name = leafPart(\"span\", \"operation-name\");\nexport const Value = leafPart(\"code\", \"operation-value\");\nexport const Priority = leafPart(\"span\", \"operation-priority\");\nexport const Reason = leafPart(\"span\", \"operation-reason\");\n\nexport interface ItemProps extends PartProps<\"li\", { readonly operation: Operation[\"_tag\"] }> {\n readonly operation: Operation;\n}\n\nexport function Item({ operation, ...props }: ItemProps) {\n return usePart(\n \"li\",\n props,\n { operation: operation._tag },\n {\n children: (\n <>\n <Kind>{operation._tag}</Kind> <Type>{operation.record.type}</Type>{\" \"}\n <Record>\n <Name>{operation.record.name}</Name>\n <Value>{operation.record.value}</Value>\n {operation.record.priority === undefined ? null : (\n <Priority>Priority {operation.record.priority}</Priority>\n )}\n {\"reason\" in operation ? <Reason>{operation.reason}</Reason> : null}\n </Record>\n </>\n ),\n \"data-domainkit-part\": \"operation-item\",\n \"data-operation\": operation._tag,\n },\n );\n}\n\nexport interface RootProps extends PartProps<\n \"ul\",\n { readonly count: number; readonly lifecycle: Lifecycle }\n> {\n readonly count?: number;\n readonly lifecycle: Lifecycle;\n}\n\nexport type Lifecycle = \"cleanup\" | \"provisioning\";\n\nexport function Root({ count = 0, lifecycle, ...props }: RootProps) {\n return usePart(\n \"ul\",\n props,\n { count, lifecycle },\n {\n \"data-domainkit-part\":\n lifecycle === \"provisioning\" ? \"plan-operations\" : \"cleanup-operations\",\n \"data-lifecycle\": lifecycle,\n },\n );\n}\n\nexport interface ListProps extends Omit<RootProps, \"children\" | \"count\"> {\n readonly operations: ReadonlyArray<Operation>;\n}\n\nexport function List({ lifecycle, operations, ...props }: ListProps) {\n return (\n <Root count={operations.length} lifecycle={lifecycle} {...props}>\n {operations.map((operation) => (\n <Item key={operation.id} operation={operation} />\n ))}\n </Root>\n );\n}\n","import { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Transport } from \"domainkit\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport { useMemo } from \"react\";\n\nimport { failureFromError, type Failure } from \"./atom.ts\";\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport * as Operations from \"./operations.tsx\";\n\ntype LocalState = Data.TaggedEnum<{\n Cleaned: { readonly result: Extract<Transport.CleanupResult, { readonly _tag: \"Cleaned\" }> };\n Cleaning: { readonly plan: Transport.CleanupPlan };\n Idle: {};\n Partial: { readonly result: Extract<Transport.CleanupResult, { readonly _tag: \"Partial\" }> };\n Planning: {};\n Review: { readonly plan: Transport.CleanupPlan };\n}>;\nexport const State = Data.taggedEnum<LocalState>();\nexport type State =\n | LocalState\n | Extract<Transport.CleanupResult, { readonly _tag: \"Stale\" }>\n | Failure;\n\nexport type Command = Data.TaggedEnum<{\n Apply: {};\n Dismiss: {};\n Plan: {};\n}>;\nexport const Command = Data.taggedEnum<Command>();\n\nexport interface Model {\n readonly command: Atom.AtomResultFn<Command, void>;\n readonly state: Atom.Atom<State>;\n}\n\nexport interface Controller {\n readonly apply: () => void;\n readonly dismiss: () => void;\n readonly plan: () => void;\n readonly state: State;\n}\n\nexport function useModel(connection: Transport.Connected, receiptId: string): Model {\n const { runtime } = useDomainKit();\n return useMemo(() => {\n const state = Atom.make<State>(State.Idle());\n const execute = runtime.fn<Command>()((command, get) => {\n if (command._tag === \"Dismiss\") {\n get.set(state, State.Idle());\n return Effect.void;\n }\n if (command._tag === \"Plan\") {\n get.set(state, State.Planning());\n return Effect.flatMap(Transport.Service, (transport) =>\n transport.cleanup.plan({\n connectionId: connection.connectionId,\n domain: connection.domain,\n receiptId,\n }),\n ).pipe(\n Effect.tap((plan) => Effect.sync(() => get.set(state, State.Review({ plan })))),\n Effect.catch((error) => Effect.sync(() => get.set(state, failureFromError(error)))),\n Effect.asVoid,\n );\n }\n const current = get(state);\n if (\n current._tag !== \"Review\" ||\n current.plan.operations.some((operation) => operation._tag === \"Blocked\")\n )\n return Effect.void;\n const plan = current.plan;\n get.set(state, State.Cleaning({ plan }));\n return Effect.flatMap(Transport.Service, (transport) =>\n transport.cleanup.apply({\n connectionId: connection.connectionId,\n domain: connection.domain,\n planDigest: plan.digest,\n receiptId,\n }),\n ).pipe(\n Effect.tap((result) =>\n Effect.sync(() =>\n get.set(\n state,\n result._tag === \"Cleaned\"\n ? State.Cleaned({ result })\n : result._tag === \"Partial\"\n ? State.Partial({ result })\n : result,\n ),\n ),\n ),\n Effect.catch((error) => Effect.sync(() => get.set(state, failureFromError(error)))),\n Effect.asVoid,\n );\n });\n return { command: execute, state };\n }, [connection.connectionId, connection.domain, receiptId, runtime]);\n}\n\nexport function useController(connection: Transport.Connected, receiptId: string): Controller {\n const model = useModel(connection, receiptId);\n const state = useAtomValue(model.state);\n const execute = useAtomSet(model.command);\n\n return {\n apply: () => execute(Command.Apply()),\n dismiss: () => execute(Command.Dismiss()),\n plan: () => execute(Command.Plan()),\n state,\n } as const;\n}\n\nexport interface RootProps extends PartProps<\"div\", { readonly status: State[\"_tag\"] }> {\n readonly status: State[\"_tag\"];\n}\n\nexport function Root({ status, ...props }: RootProps) {\n return usePart(\n \"div\",\n props,\n { status },\n { \"data-domainkit-part\": \"cleanup-flow\", \"data-state\": status },\n );\n}\n\nexport function Outcome({ state }: { readonly state: State }) {\n const { messages } = useDomainKit();\n if (state._tag === \"Cleaned\") {\n return (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"success\">\n {messages.cleanupComplete}\n </p>\n );\n }\n if (state._tag === \"Partial\" || state._tag === \"Failure\" || state._tag === \"Stale\") {\n return (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {state._tag === \"Partial\" ? messages.cleanupPartial : state.message}\n </p>\n );\n }\n return null;\n}\n\nexport function Dialog({ controller }: { readonly controller: Controller }) {\n const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();\n const state = controller.state;\n const plan = state._tag === \"Review\" || state._tag === \"Cleaning\" ? state.plan : undefined;\n return (\n <BaseDialog.Root\n onOpenChange={(open) => {\n if (!open) controller.dismiss();\n }}\n open={plan !== undefined}\n >\n <BaseDialog.Trigger\n data-domainkit-part=\"cleanup-trigger\"\n disabled={state._tag === \"Planning\" || state._tag === \"Cleaning\"}\n onClick={() => controller.plan()}\n >\n {state._tag === \"Planning\" ? messages.planningCleanup : messages.reviewCleanup}\n </BaseDialog.Trigger>\n {plan === undefined ? null : (\n <BaseDialog.Portal container={portalContainer ?? undefined}>\n <BaseDialog.Backdrop data-domainkit-part=\"dialog-backdrop\" />\n <BaseDialog.Popup\n data-color-scheme={colorScheme}\n data-domainkit-part=\"cleanup-dialog\"\n data-domainkit-root=\"\"\n style={themeStyle}\n >\n <div data-domainkit-part=\"dialog-header\">\n <div data-domainkit-part=\"dialog-heading\">\n <BaseDialog.Title data-domainkit-part=\"dialog-title\">\n {messages.reviewCleanup}\n </BaseDialog.Title>\n <BaseDialog.Description data-domainkit-part=\"dialog-description\">\n {messages.cleanupConsent}\n </BaseDialog.Description>\n </div>\n <BaseDialog.Close aria-label={messages.close} data-domainkit-part=\"dialog-close\">\n ×\n </BaseDialog.Close>\n </div>\n <div data-domainkit-part=\"dialog-body\">\n <Operations.List lifecycle=\"cleanup\" operations={plan.operations} />\n </div>\n <div data-domainkit-part=\"dialog-footer\">\n <BaseDialog.Close data-domainkit-part=\"dialog-cancel\">\n {messages.cancel}\n </BaseDialog.Close>\n <button\n data-domainkit-part=\"cleanup-apply\"\n disabled={\n state._tag === \"Cleaning\" ||\n plan.operations.some((operation) => operation._tag === \"Blocked\")\n }\n onClick={() => controller.apply()}\n type=\"button\"\n >\n {state._tag === \"Cleaning\" ? messages.cleaningDns : messages.applyCleanup}\n </button>\n </div>\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n )}\n </BaseDialog.Root>\n );\n}\n\nexport interface FlowProps extends Omit<RootProps, \"status\"> {\n readonly connection: Transport.Connected;\n readonly receiptId: string;\n}\n\nexport function Flow({ connection, receiptId, ...props }: FlowProps) {\n const controller = useController(connection, receiptId);\n const state = controller.state;\n return (\n <Root status={state._tag} {...props}>\n <Outcome state={state} />\n <Dialog controller={controller} />\n </Root>\n );\n}\n","import { useId, useState, type ComponentPropsWithoutRef, type ReactNode } from \"react\";\nimport type { Transport } from \"domainkit\";\n\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\ntype ProviderDescriptor = Transport.Provider;\n\nexport type Marks = Readonly<\n Record<string, ReactNode | ((provider: ProviderDescriptor) => ReactNode)>\n>;\n\nexport interface MarkState extends Record<string, unknown> {\n readonly providerId: string;\n}\n\nexport interface MarkProps extends PartProps<\"span\", MarkState> {\n readonly provider: ProviderDescriptor;\n}\n\nconst logoHosts: Readonly<Record<string, string>> = {\n aws: \"amazonaws.com\",\n bluehost: \"bluehost.com\",\n cloudflare: \"cloudflare.com\",\n digitalocean: \"digitalocean.com\",\n dnsimple: \"dnsimple.com\",\n dreamhost: \"dreamhost.com\",\n dynadot: \"dynadot.com\",\n gandi: \"gandi.net\",\n godaddy: \"godaddy.com\",\n google: \"cloud.google.com\",\n googlecloud: \"cloud.google.com\",\n googleclouddns: \"cloud.google.com\",\n hostgator: \"hostgator.com\",\n hostinger: \"hostinger.com\",\n hover: \"hover.com\",\n ionos: \"ionos.com\",\n namecheap: \"namecheap.com\",\n namecom: \"name.com\",\n netlify: \"netlify.com\",\n ns1: \"ns1.com\",\n ovh: \"ovh.com\",\n porkbun: \"porkbun.com\",\n spaceship: \"spaceship.com\",\n squarespace: \"squarespace.com\",\n vercel: \"vercel.com\",\n};\n\nconst logoKey = (providerId: string): string =>\n providerId\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"\");\n\nconst logoHost = (providerId: string): string | undefined => logoHosts[logoKey(providerId)];\n\nconst letterMark = (provider: ProviderDescriptor): string =>\n provider.name.trim().charAt(0).toUpperCase() || \"?\";\n\n/** Official AWS architecture glyph (white \"53\" in nested circles). */\nconst route53Glyph =\n \"M48.692,40.6795109 C49.431,41.3627732 49.801,42.2781246 49.801,43.4275659 C49.801,44.678046 49.351,45.6764293 48.452,46.4227159 C47.552,47.1700028 46.343,47.543146 44.826,47.543146 C43.627,47.543146 42.44,47.2870477 41.266,46.7768518 L41.266,45.2452638 C42.657,45.7054405 43.843,45.9345284 44.826,45.9345284 C45.796,45.9345284 46.542,45.7174451 47.065,45.2842788 C47.588,44.8501121 47.849,44.2308744 47.849,43.4275659 C47.849,41.8829729 46.874,41.1106764 44.921,41.1106764 C44.309,41.1106764 43.703,41.1426887 43.103,41.2057129 L43.103,39.9432282 L47.123,35.5585448 L41.458,35.5585448 L41.458,33.9889422 L49.247,33.9889422 L49.247,35.5015229 L45.304,39.6751253 C45.369,39.6621203 45.431,39.656118 45.496,39.656118 L45.687,39.656118 C46.951,39.656118 47.952,39.9972489 48.692,40.6795109 M37.574,40.3453826 C38.351,41.0726618 38.74,42.0740463 38.74,43.349536 C38.74,44.6010165 38.288,45.6124048 37.381,46.3847013 C36.475,47.1569978 35.283,47.543146 33.803,47.543146 C32.503,47.543146 31.284,47.2870477 30.148,46.7768518 L30.148,45.2452638 C31.564,45.7054405 32.776,45.9345284 33.784,45.9345284 C34.754,45.9345284 35.497,45.7154443 36.013,45.2742749 C36.53,44.834106 36.789,44.1998624 36.789,43.3695437 C36.789,42.4631957 36.546,41.8059434 36.061,41.3977867 C35.576,40.9896299 34.785,40.7845512 33.688,40.7845512 C32.897,40.7845512 31.909,40.8495762 30.722,40.976625 L30.722,39.7131399 L31.086,33.9889422 L38.071,33.9889422 L38.071,35.5585448 L32.693,35.5585448 L32.444,39.4450369 C33.146,39.3179882 33.777,39.2539636 34.338,39.2539636 C35.716,39.2539636 36.795,39.617103 37.574,40.3453826 M51.957,54.37777 C47.103,55.250105 42.852,57.2268639 40,58.8374822 C37.147,57.2268639 32.896,55.250105 28.043,54.37777 C26.677,54.1326759 19.869,52.7111302 19.869,48.7756192 C19.869,46.951919 20.522,45.7424547 21.776,43.5826255 C23.274,40.9996338 25.138,37.7843994 25.138,33.1556222 C25.138,29.8473521 24.271,26.6751342 22.559,23.7149977 C22.76,23.4669025 22.965,23.2158061 23.171,22.9627089 C25.707,24.2301955 28.347,24.8724421 31.031,24.8724421 C34.311,24.8724421 37.325,24.0111114 40,22.3114589 C42.674,24.0111114 45.688,24.8724421 48.968,24.8724421 C51.652,24.8724421 54.293,24.2301955 56.829,22.9627089 C57.034,23.2158061 57.239,23.4669025 57.44,23.7149977 C55.728,26.6751342 54.861,29.8473521 54.861,33.1556222 C54.861,37.7843994 56.725,40.9996338 58.226,43.586627 C59.477,45.7424547 60.13,46.951919 60.13,48.7756192 C60.13,52.7111302 53.322,54.1326759 51.957,54.37777 M56.861,33.1556222 C56.861,29.9974097 57.752,26.9702475 59.507,24.1581679 C59.735,23.7950284 59.706,23.3278491 59.434,22.9957216 C58.926,22.3734827 58.393,21.7182311 57.867,21.0669811 C57.562,20.6898363 57.032,20.5857963 56.606,20.8198862 C54.143,22.1814089 51.574,22.8716739 48.968,22.8716739 C45.824,22.8716739 43.077,22.0263494 40.569,20.2886823 C40.227,20.0515912 39.772,20.0515912 39.43,20.2886823 C36.922,22.0263494 34.175,22.8716739 31.031,22.8716739 C28.425,22.8716739 25.856,22.1814089 23.393,20.8198862 C22.968,20.5857963 22.437,20.6898363 22.132,21.0669811 C21.606,21.7182311 21.073,22.3734827 20.565,22.9957216 C20.294,23.3278491 20.264,23.7950284 20.492,24.1581679 C22.248,26.9702475 23.138,29.9974097 23.138,33.1556222 C23.138,37.2461927 21.423,40.2023277 20.045,42.581241 C18.695,44.9041328 17.869,46.4467251 17.869,48.7756192 C17.869,54.1646882 25.385,55.9343677 27.689,56.3475263 C32.549,57.2208616 36.793,59.2806524 39.497,60.8542565 C39.652,60.9452915 39.826,60.9903088 40,60.9903088 C40.173,60.9903088 40.347,60.9452915 40.503,60.8542565 C43.207,59.2806524 47.45,57.2208616 52.31,56.3475263 C54.614,55.9343677 62.13,54.1646882 62.13,48.7756192 C62.13,46.4467251 61.304,44.9041328 59.954,42.5782399 C58.576,40.2023277 56.861,37.2461927 56.861,33.1556222 M52.994,60.1569888 C46.863,61.2594121 41.723,64.556678 40,65.7641416 C38.276,64.556678 33.136,61.2594121 27.005,60.1569888 C14.937,57.9891566 14,50.8974338 14,48.7756192 C14,45.2852792 15.371,42.9233724 16.697,40.6374948 C17.961,38.4596586 19.268,36.2067937 19.268,33.1556222 C19.268,28.3357718 16.485,24.9314648 15.112,23.5459328 C16.556,21.7892584 20.204,17.3415508 22.003,15.0236609 C24.729,17.5966487 27.898,19.0001876 31.031,19.0001876 C34.509,19.0001876 37.385,17.5846441 40,14.5644846 C42.614,17.5846441 45.49,19.0001876 48.968,19.0001876 C52.101,19.0001876 55.27,17.5966487 57.997,15.0236609 C59.796,17.3415508 63.443,21.7892584 64.887,23.5459328 C63.514,24.9314648 60.731,28.3357718 60.731,33.1556222 C60.731,36.2067937 62.039,38.4596586 63.302,40.6374948 C64.629,42.9233724 66,45.2852792 66,48.7756192 C66,50.8974338 65.062,57.9891566 52.994,60.1569888 M65.032,39.6341095 C63.797,37.5052922 62.731,35.6675867 62.731,33.1556222 C62.731,27.867592 66.847,24.4472789 66.887,24.4152666 C67.094,24.2472021 67.226,24.0031083 67.254,23.7370062 C67.28,23.470904 67.2,23.2058022 67.03,22.9997231 C66.963,22.9196924 60.408,14.9726413 58.906,12.9138509 C58.73,12.6727583 58.457,12.5227007 58.159,12.5046938 C57.86,12.4826853 57.572,12.601731 57.368,12.8198148 C54.848,15.5148495 51.866,16.9994194 48.968,16.9994194 C45.764,16.9994194 43.244,15.5718713 40.794,12.3706423 C40.415,11.8764526 39.585,11.8764526 39.206,12.3706423 C36.755,15.5718713 34.235,16.9994194 31.031,16.9994194 C28.133,16.9994194 25.151,15.5148495 22.631,12.8198148 C22.427,12.601731 22.137,12.4776834 21.84,12.5046938 C21.543,12.5227007 21.269,12.6727583 21.093,12.9138509 C19.591,14.9726413 13.036,22.9196924 12.969,22.9997231 C12.8,23.2058022 12.72,23.470904 12.747,23.7360058 C12.773,24.0011076 12.904,24.2452013 13.11,24.4132658 C13.152,24.4472789 17.268,27.867592 17.268,33.1556222 C17.268,35.6675867 16.202,37.5052922 14.967,39.6341095 C13.576,42.0310298 12,44.7470725 12,48.7756192 C12,55.487196 17.477,60.4781121 26.652,62.1267451 C33.559,63.3682217 39.334,67.7489036 39.391,67.7939209 C39.57,67.9309735 39.785,68 40,68 C40.214,68 40.429,67.9309735 40.609,67.7929205 C40.667,67.7489036 46.422,63.3712229 53.347,62.1267451 C62.522,60.4781121 68,55.487196 68,48.7756192 C68,44.7470725 66.423,42.0310298 65.032,39.6341095\";\n\nfunction Route53Mark() {\n const gradientId = `dk-r53-${useId().replaceAll(\":\", \"\")}`;\n return (\n <svg aria-hidden=\"true\" viewBox=\"0 0 80 80\">\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" x2=\"100%\" y1=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" stopColor=\"#4D27A8\" />\n <stop offset=\"100%\" stopColor=\"#A166FF\" />\n </linearGradient>\n </defs>\n <rect fill={`url(#${gradientId})`} height=\"80\" width=\"80\" />\n <path d={route53Glyph} fill=\"#fff\" />\n </svg>\n );\n}\n\nconst logoMarks: Readonly<Record<string, typeof Route53Mark>> = {\n amazonroute53: Route53Mark,\n route53: Route53Mark,\n};\n\nfunction DefaultMark({ provider }: { readonly provider: ProviderDescriptor }) {\n const BuiltIn = logoMarks[logoKey(provider.id)];\n const host = logoHost(provider.id);\n const [failed, setFailed] = useState(false);\n if (BuiltIn !== undefined) return <BuiltIn />;\n if (host === undefined || failed) return letterMark(provider);\n return (\n <img\n alt=\"\"\n height={32}\n onError={() => setFailed(true)}\n referrerPolicy=\"no-referrer\"\n src={`https://integrations.sh/logo/${host}?sz=64`}\n width={32}\n />\n );\n}\n\nexport function Mark({ provider, ...props }: MarkProps) {\n const { marks } = useDomainKit();\n const replacement = marks[provider.id];\n const content =\n typeof replacement === \"function\"\n ? replacement(provider)\n : (replacement ?? <DefaultMark provider={provider} />);\n return usePart(\n \"span\",\n props,\n { providerId: provider.id },\n {\n \"aria-label\": provider.name,\n children: content,\n \"data-domainkit-part\": \"provider-mark\",\n role: \"img\",\n },\n );\n}\n\nexport type { ProviderDescriptor as Provider };\nexport type MarkElementProps = ComponentPropsWithoutRef<\"span\">;\n","import { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Transport } from \"domainkit\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport {\n useMemo,\n useState,\n type ComponentPropsWithoutRef,\n type FormEvent,\n type ReactNode,\n} from \"react\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport * as Provider from \"./provider.tsx\";\nimport { failureFromDefect, failureFromError, type Failure } from \"./atom.ts\";\n\ntype LocalState = Data.TaggedEnum<{\n Loading: {};\n Redirecting: { readonly snapshot: Disconnected };\n Submitting: { readonly snapshot: Disconnected };\n}>;\nexport const State = Data.taggedEnum<LocalState>();\nexport type State = LocalState | Transport.ConnectionSnapshot | Failure;\n\ntype Disconnected = Extract<Transport.ConnectionSnapshot, { readonly _tag: \"Disconnected\" }>;\n\nexport interface Controller {\n readonly connect: (method: Transport.Method) => void;\n readonly retry: () => void;\n readonly reuse: () => void;\n readonly state: State;\n}\n\nexport type Command = Data.TaggedEnum<{\n Connect: { readonly method: Transport.Method };\n Retry: {};\n Reuse: {};\n}>;\nexport const Command = Data.taggedEnum<Command>();\n\nexport interface Model {\n readonly command: Atom.AtomResultFn<Command, void>;\n readonly state: Atom.Atom<State>;\n}\n\nexport function useModel(domain: string): Model {\n const { navigate, runtime } = useDomainKit();\n return useMemo(() => {\n const actionState = Atom.make<State | undefined>(undefined);\n const inspect = runtime.atom(\n Effect.flatMap(Transport.Service, (transport) => transport.connection.inspect({ domain })),\n );\n const state = Atom.make((get): State => {\n const action = get(actionState);\n if (action !== undefined) return action;\n const inspection = get(inspect);\n return AsyncResult.matchWithError(inspection, {\n onDefect: () => failureFromDefect(\"connection.inspect\", \"Provider detection failed\"),\n onError: failureFromError,\n onInitial: () => State.Loading(),\n onSuccess: ({ value }) => value,\n });\n });\n const command = runtime.fn<Command>()((input, get) => {\n if (input._tag === \"Retry\") {\n get.set(actionState, undefined);\n get.refresh(inspect);\n return Effect.void;\n }\n const snapshot = get(state);\n if (snapshot._tag !== \"Disconnected\") return Effect.void;\n const reusableConnection = snapshot.reusableConnection;\n if (input._tag === \"Reuse\" && reusableConnection === undefined) return Effect.void;\n get.set(actionState, State.Submitting({ snapshot }));\n const complete = (\n request: Effect.Effect<Transport.ConnectionResult, Transport.Failure, Transport.Service>,\n ) =>\n request.pipe(\n Effect.tap((result) =>\n Effect.sync(() => {\n if (result._tag === \"Redirect\") {\n get.set(actionState, State.Redirecting({ snapshot }));\n navigate(result.authorizationUrl);\n } else {\n get.set(actionState, result);\n }\n }),\n ),\n Effect.catch((error) => Effect.sync(() => get.set(actionState, failureFromError(error)))),\n Effect.asVoid,\n );\n if (input._tag === \"Connect\") {\n return complete(\n Effect.flatMap(Transport.Service, (transport) =>\n transport.connection.connect({\n domain,\n method: input.method,\n providerId: snapshot.provider.id,\n }),\n ),\n );\n }\n if (reusableConnection === undefined) return Effect.void;\n return complete(\n Effect.flatMap(Transport.Service, (transport) =>\n transport.connection.reuse({ connectionId: reusableConnection.connectionId, domain }),\n ),\n );\n });\n return { command, state };\n }, [domain, navigate, runtime]);\n}\n\nexport function useController(domain: string): Controller {\n const model = useModel(domain);\n const state = useAtomValue(model.state);\n const execute = useAtomSet(model.command);\n\n return {\n connect: (method) => execute(Command.Connect({ method })),\n retry: () => execute(Command.Retry()),\n reuse: () => execute(Command.Reuse()),\n state,\n };\n}\n\nexport interface RootState extends Record<string, unknown> {\n readonly status: State[\"_tag\"];\n}\n\nexport interface RootProps extends PartProps<\"div\", RootState> {\n readonly status?: State[\"_tag\"];\n}\n\nexport function Root({ children, status = \"Loading\", ...props }: RootProps) {\n return usePart(\n \"div\",\n props,\n { status },\n {\n children,\n \"data-domainkit-part\": \"connection-root\",\n },\n );\n}\n\nexport interface StatusState extends Record<string, unknown> {\n readonly status: State[\"_tag\"];\n}\n\nexport interface StatusProps extends PartProps<\"div\", StatusState> {\n readonly state: State;\n}\n\nexport function Status({ children, state, ...props }: StatusProps) {\n const { messages } = useDomainKit();\n const text =\n state._tag === \"Loading\"\n ? messages.detectingProvider\n : state._tag === \"Connected\"\n ? messages.connected(state.provider.name)\n : state._tag === \"Unsupported\"\n ? messages.automaticUnavailable\n : state._tag === \"Failure\"\n ? state.message\n : state._tag === \"Redirecting\"\n ? messages.openingAuthorization\n : state._tag === \"Submitting\"\n ? messages.connecting\n : messages.providerAvailable(state.provider.name);\n return usePart(\n \"div\",\n props,\n { status: state._tag },\n {\n children: children ?? text,\n \"data-domainkit-part\": \"connection-status\",\n \"data-state\": state._tag,\n },\n );\n}\n\nexport interface TriggerProps extends Omit<\n ComponentPropsWithoutRef<typeof BaseDialog.Trigger>,\n \"children\"\n> {\n readonly children: ReactNode;\n}\n\nexport interface ConnectTriggerProps extends Omit<TriggerProps, \"children\"> {\n readonly children?: ReactNode;\n readonly provider: Provider.Provider;\n}\n\nexport function Trigger({ children, ...props }: TriggerProps) {\n return (\n <BaseDialog.Trigger data-domainkit-part=\"connection-trigger\" {...props}>\n {children}\n </BaseDialog.Trigger>\n );\n}\n\nexport function ConnectTrigger({ children, provider, ...props }: ConnectTriggerProps) {\n const { messages } = useDomainKit();\n return (\n <Trigger {...props} data-domainkit-recipe=\"connect\">\n {children ?? (\n <>\n <Provider.Mark aria-hidden=\"true\" provider={provider} />\n {messages.connectProvider(provider.name)}\n </>\n )}\n </Trigger>\n );\n}\n\nexport interface ActionState extends Record<string, unknown> {\n readonly authentication: \"oauth\" | \"reuse\" | \"token\";\n}\n\nexport interface OAuthActionProps extends PartProps<\"button\", ActionState> {\n readonly controller: Controller;\n readonly label: string;\n}\n\nexport function OAuthAction({ controller, label, ...props }: OAuthActionProps) {\n return usePart(\n \"button\",\n props,\n { authentication: \"oauth\" },\n {\n children: label,\n \"data-domainkit-part\": \"oauth-connect\",\n onClick: () => controller.connect(Transport.Method.OAuth()),\n type: \"button\",\n },\n );\n}\n\nexport interface ReuseActionProps extends PartProps<\"button\", ActionState> {\n readonly controller: Controller;\n readonly label: string;\n}\n\nexport function ReuseAction({ controller, label, ...props }: ReuseActionProps) {\n return usePart(\n \"button\",\n props,\n { authentication: \"reuse\" },\n {\n children: label,\n \"data-domainkit-part\": \"reuse-connection\",\n onClick: () => void controller.reuse(),\n type: \"button\",\n },\n );\n}\n\nexport interface TokenActionProps extends Omit<PartProps<\"form\", ActionState>, \"method\"> {\n readonly controller: Controller;\n readonly method: Extract<Transport.AuthenticationMethod, { readonly _tag: \"Token\" }>;\n}\n\nexport function TokenAction({ controller, method, ...props }: TokenActionProps) {\n const { messages } = useDomainKit();\n const [token, setToken] = useState(\"\");\n const [parameters, setParameters] = useState<Readonly<Record<string, string>>>({});\n const submit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (token.length > 0) {\n const populated = Object.fromEntries(\n Object.entries(parameters).filter(([, value]) => value.length > 0),\n );\n controller.connect(\n Transport.Method.Token({\n token,\n ...(Object.keys(populated).length === 0 ? {} : { parameters: populated }),\n }),\n );\n }\n };\n const missingRequiredParameter = method.parameters?.some(\n (parameter) => parameter.required === true && !parameters[parameter.key],\n );\n return usePart(\n \"form\",\n props,\n { authentication: \"token\" },\n {\n children: (\n <>\n {method.parameters?.map((parameter) => (\n <label key={parameter.key}>\n {parameter.label}\n <input\n name={parameter.key}\n onChange={(event) => {\n const value = event.currentTarget.value;\n setParameters((current) => ({\n ...current,\n [parameter.key]: value,\n }));\n }}\n placeholder={parameter.placeholder}\n required={parameter.required}\n type=\"text\"\n value={parameters[parameter.key] ?? \"\"}\n />\n {parameter.description === undefined ? null : <small>{parameter.description}</small>}\n </label>\n ))}\n <label>\n {messages.tokenLabel}\n <input\n autoComplete=\"off\"\n name=\"token\"\n onChange={(event) => setToken(event.currentTarget.value)}\n placeholder={method.placeholder}\n type=\"password\"\n value={token}\n />\n </label>\n <button disabled={token.length === 0 || missingRequiredParameter === true} type=\"submit\">\n {method.label}\n </button>\n </>\n ),\n \"data-domainkit-part\": \"token-connect\",\n onSubmit: submit,\n },\n );\n}\n\nexport interface DialogProps {\n readonly controller: Controller;\n readonly snapshot: Disconnected;\n}\n\nexport function Dialog({ controller, snapshot }: DialogProps) {\n const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();\n return (\n <BaseDialog.Portal container={portalContainer}>\n <BaseDialog.Backdrop data-domainkit-part=\"dialog-backdrop\" />\n <BaseDialog.Popup\n data-domainkit-part=\"connection-dialog\"\n data-domainkit-root=\"\"\n data-color-scheme={colorScheme}\n style={themeStyle}\n >\n <div data-domainkit-part=\"dialog-header\">\n <Provider.Mark provider={snapshot.provider} />\n <div data-domainkit-part=\"dialog-heading\">\n <BaseDialog.Title data-domainkit-part=\"dialog-title\">\n {messages.dialogTitle(snapshot.provider.name)}\n </BaseDialog.Title>\n <BaseDialog.Description data-domainkit-part=\"dialog-description\">\n {messages.dialogDescription(snapshot.domain)}\n </BaseDialog.Description>\n </div>\n <BaseDialog.Close aria-label={messages.close} data-domainkit-part=\"dialog-close\">\n ×\n </BaseDialog.Close>\n </div>\n <div data-domainkit-part=\"dialog-body\">\n {snapshot.provider.authentication.map((method) =>\n method._tag === \"OAuth\" ? (\n <OAuthAction controller={controller} key={method._tag} label={method.label} />\n ) : null,\n )}\n {snapshot.reusableConnection === undefined ? null : (\n <ReuseAction\n controller={controller}\n label={messages.reuseConnection(snapshot.reusableConnection.label)}\n />\n )}\n {snapshot.provider.authentication.map((method) =>\n method._tag === \"Token\" ? (\n <TokenAction controller={controller} key={method._tag} method={method} />\n ) : null,\n )}\n </div>\n <div data-domainkit-part=\"dialog-footer\">\n <BaseDialog.Close data-domainkit-part=\"dialog-cancel\">{messages.cancel}</BaseDialog.Close>\n </div>\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n );\n}\n\nexport interface FlowProps extends Omit<RootProps, \"children\"> {\n readonly domain: string;\n}\n\nexport function Flow({ domain, ...props }: FlowProps) {\n const controller = useController(domain);\n const state = controller.state;\n const snapshot =\n state._tag === \"Disconnected\"\n ? state\n : state._tag === \"Submitting\" || state._tag === \"Redirecting\"\n ? state.snapshot\n : undefined;\n return (\n <Root {...props} status={state._tag}>\n <Status state={state} />\n {state._tag === \"Failure\" && state.retry !== \"never\" ? (\n <RetryAction\n controller={controller}\n kind={state.retry === \"after-user-action\" ? \"after-user-action\" : \"retry\"}\n />\n ) : null}\n {snapshot === undefined ? null : (\n <BaseDialog.Root>\n <ConnectTrigger provider={snapshot.provider} />\n <Dialog controller={controller} snapshot={snapshot} />\n </BaseDialog.Root>\n )}\n </Root>\n );\n}\n\nexport interface RetryActionProps extends PartProps<\"button\", { readonly status: \"Failure\" }> {\n readonly controller: Controller;\n readonly kind?: \"after-user-action\" | \"retry\";\n}\n\nexport function RetryAction({ controller, kind = \"retry\", ...props }: RetryActionProps) {\n const { messages } = useDomainKit();\n return usePart(\n \"button\",\n props,\n { status: \"Failure\" },\n {\n children: kind === \"after-user-action\" ? messages.checkAgain : messages.retry,\n \"data-domainkit-part\": \"connection-retry\",\n onClick: controller.retry,\n type: \"button\",\n },\n );\n}\n\ntype LocalDisconnectState = Data.TaggedEnum<{\n Disconnecting: {};\n Idle: {};\n}>;\nexport const DisconnectState = Data.taggedEnum<LocalDisconnectState>();\nexport type DisconnectState = LocalDisconnectState | Transport.RemoveDomainResult | Failure;\n\nexport function useDisconnect(connection: Transport.Connected) {\n const { runtime } = useDomainKit();\n const controller = useMemo(() => {\n const state = Atom.make<DisconnectState>(DisconnectState.Idle());\n const disconnect = runtime.fn<void>()((_, get) => {\n get.set(state, DisconnectState.Disconnecting());\n return Effect.flatMap(Transport.Service, (transport) =>\n transport.connection.removeDomain({\n connectionId: connection.connectionId,\n domain: connection.domain,\n preserveDns: true,\n }),\n ).pipe(\n Effect.tap((result) => Effect.sync(() => get.set(state, result))),\n Effect.catch((error) => Effect.sync(() => get.set(state, failureFromError(error)))),\n Effect.asVoid,\n );\n });\n return { disconnect, state };\n }, [connection.connectionId, connection.domain, runtime]);\n const state = useAtomValue(controller.state);\n const disconnect = useAtomSet(controller.disconnect);\n return { disconnect: () => disconnect(), state } as const;\n}\n\nexport interface DisconnectActionProps extends PartProps<\n \"div\",\n { readonly status: DisconnectState[\"_tag\"] }\n> {\n readonly connection: Transport.Connected;\n}\n\nexport function DisconnectAction({ connection, ...props }: DisconnectActionProps) {\n const controller = useDisconnect(connection);\n const { messages } = useDomainKit();\n const state = controller.state;\n return usePart(\n \"div\",\n props,\n { status: state._tag },\n {\n children: (\n <>\n {state._tag === \"Removed\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"success\">\n {messages.domainDisconnected}\n </p>\n ) : null}\n {state._tag === \"Failure\" ? (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {state.message}\n </p>\n ) : null}\n {state._tag === \"Removed\" ? null : (\n <button\n data-domainkit-part=\"disconnect-action\"\n disabled={state._tag === \"Disconnecting\"}\n onClick={() => void controller.disconnect()}\n type=\"button\"\n >\n {state._tag === \"Disconnecting\" ? messages.disconnecting : messages.disconnectDomain}\n </button>\n )}\n </>\n ),\n \"data-domainkit-part\": \"disconnect\",\n },\n );\n}\n\nexport type Connected = Transport.Connected;\n","import { useEffect, useRef, useState, type ReactElement, type ReactNode } from \"react\";\nimport type { Transport } from \"domainkit\";\n\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useIcons } from \"./icons.tsx\";\n\nexport const copyText = (value: string): Promise<boolean> => {\n if (typeof navigator === \"undefined\" || navigator.clipboard === undefined) {\n return Promise.resolve(false);\n }\n return navigator.clipboard.writeText(value).then(\n () => true,\n () => false,\n );\n};\n\nconst downloadText = (filename: string, contents: string): void => {\n if (typeof document === \"undefined\") return;\n const blob = new Blob([contents], { type: \"text/plain;charset=utf-8\" });\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement(\"a\");\n anchor.download = filename;\n anchor.href = url;\n document.body.append(anchor);\n anchor.click();\n anchor.remove();\n URL.revokeObjectURL(url);\n};\n\nconst absoluteDomainName = (value: string): string => (value.endsWith(\".\") ? value : `${value}.`);\n\nconst textEncoder = new TextEncoder();\n\nconst escapeTxtCharacter = (character: string): string => {\n if (character === '\"' || character === \"\\\\\") return `\\\\${character}`;\n const codePoint = character.codePointAt(0);\n if (codePoint !== undefined && (codePoint < 32 || codePoint === 127)) {\n return `\\\\${codePoint.toString().padStart(3, \"0\")}`;\n }\n return character;\n};\n\nconst txtValue = (value: string): string => {\n const chunks: Array<string> = [];\n let chunk = \"\";\n let byteLength = 0;\n for (const character of value) {\n const characterByteLength = textEncoder.encode(character).byteLength;\n if (byteLength + characterByteLength > 255) {\n chunks.push(chunk);\n chunk = \"\";\n byteLength = 0;\n }\n chunk += escapeTxtCharacter(character);\n byteLength += characterByteLength;\n }\n chunks.push(chunk);\n return chunks.map((part) => `\"${part}\"`).join(\" \");\n};\n\nconst srvValue = (value: string): string => {\n const fields = value.trim().split(/\\s+/);\n if (fields.length !== 3) throw new Error(`Invalid SRV value: ${value}`);\n const [weight, port, target] = fields;\n if (weight === undefined || port === undefined || target === undefined) {\n throw new Error(`Invalid SRV value: ${value}`);\n }\n return `${weight} ${port} ${absoluteDomainName(target)}`;\n};\n\nconst zoneValue = (record: Transport.DnsRecord): string => {\n switch (record.type.toUpperCase()) {\n case \"CNAME\":\n case \"MX\":\n case \"NS\":\n case \"PTR\":\n return absoluteDomainName(record.value);\n case \"SRV\":\n return srvValue(record.value);\n case \"TXT\":\n return txtValue(record.value);\n default:\n return record.value;\n }\n};\n\ntype LeafState = Record<string, unknown>;\n\nfunction leafPart<Tag extends keyof React.JSX.IntrinsicElements>(\n defaultTagName: Tag,\n part: string,\n) {\n return function Leaf(props: PartProps<Tag, LeafState>): ReactElement {\n return usePart(defaultTagName, props, {}, { \"data-domainkit-part\": part });\n };\n}\n\nexport interface CopyController {\n readonly copied: boolean;\n readonly copy: () => void;\n}\n\nexport function useCopy(value: string, resetAfter = 2000): CopyController {\n const [copied, setCopied] = useState(false);\n const reset = useRef<ReturnType<typeof setTimeout>>(undefined);\n useEffect(() => () => clearTimeout(reset.current), []);\n return {\n copied,\n copy: () => {\n void copyText(value).then((ok) => {\n if (!ok) return;\n setCopied(true);\n clearTimeout(reset.current);\n reset.current = setTimeout(() => setCopied(false), resetAfter);\n });\n },\n };\n}\n\nexport interface CopyValueProps extends PartProps<\"span\", { readonly copied: boolean }> {\n readonly copiedIcon?: ReactNode;\n readonly copiedLabel?: string;\n readonly copyIcon?: ReactNode;\n readonly copyLabel?: string;\n readonly value: string;\n}\n\nexport function CopyValue({\n copiedIcon,\n copiedLabel = \"Copied\",\n copyIcon,\n copyLabel = \"Copy\",\n value,\n ...props\n}: CopyValueProps) {\n const icons = useIcons();\n const controller = useCopy(value);\n const copied = controller.copied;\n return usePart(\n \"span\",\n props,\n { copied },\n {\n children: (\n <>\n <code>{value}</code>\n <button\n aria-label={`${copied ? copiedLabel : copyLabel} ${value}`}\n data-domainkit-part=\"copy-action\"\n onClick={controller.copy}\n type=\"button\"\n >\n <span\n aria-hidden=\"true\"\n data-domainkit-part=\"copy-glyph\"\n data-icon=\"\"\n data-state=\"idle\"\n >\n {copyIcon ?? icons.copy}\n </span>\n <span\n aria-hidden=\"true\"\n data-domainkit-part=\"copy-glyph\"\n data-icon=\"\"\n data-state=\"done\"\n >\n {copiedIcon ?? icons.copied}\n </span>\n </button>\n </>\n ),\n \"data-copied\": copied ? \"\" : undefined,\n \"data-domainkit-part\": \"copy-value\",\n },\n );\n}\n\nexport interface ZoneFileProps extends PartProps<\"div\", { readonly count: number }> {\n readonly copiedIcon?: ReactNode;\n readonly copiedLabel?: string;\n readonly copyIcon?: ReactNode;\n readonly copyLabel?: string;\n readonly domain: string;\n readonly downloadIcon?: ReactNode;\n readonly downloadLabel?: string;\n readonly records: ReadonlyArray<Transport.DnsRecord>;\n}\n\nexport function ZoneFile({\n copiedIcon,\n copiedLabel = \"Copied\",\n copyIcon,\n copyLabel = \"Copy zone\",\n domain,\n downloadIcon,\n downloadLabel = \"Download\",\n records,\n ...props\n}: ZoneFileProps) {\n const icons = useIcons();\n const zone = toZoneFile(records);\n const controller = useCopy(zone);\n const copied = controller.copied;\n return usePart(\n \"div\",\n props,\n { count: records.length },\n {\n children: (\n <>\n <button\n aria-label={copied ? copiedLabel : copyLabel}\n data-domainkit-part=\"zone-copy\"\n onClick={controller.copy}\n type=\"button\"\n >\n <span aria-hidden=\"true\" data-icon=\"inline-start\">\n {copied ? (copiedIcon ?? icons.copied) : (copyIcon ?? icons.copy)}\n </span>\n {copied ? copiedLabel : copyLabel}\n </button>\n <button\n data-domainkit-part=\"zone-download\"\n onClick={() => downloadZoneFile(domain, records)}\n type=\"button\"\n >\n <span aria-hidden=\"true\" data-icon=\"inline-start\">\n {downloadIcon ?? icons.download}\n </span>\n {downloadLabel}\n </button>\n </>\n ),\n \"data-domainkit-part\": \"zone-file\",\n },\n );\n}\n\nexport interface StatusProps extends PartProps<\n \"span\",\n { readonly status: Transport.ObservationEvidence[\"_tag\"] }\n> {\n readonly evidence: Transport.ObservationEvidence;\n}\n\nexport function Status({ evidence, ...props }: StatusProps) {\n return usePart(\n \"span\",\n props,\n { status: evidence._tag },\n {\n children: evidence._tag,\n \"data-domainkit-part\": \"record-status\",\n \"data-status\": evidence._tag,\n },\n );\n}\n\nexport interface PriorityProps extends PartProps<\"span\", { readonly priority: number }> {\n readonly priority?: number;\n}\n\nexport function Priority({ children, priority = 0, ...props }: PriorityProps) {\n return usePart(\n \"span\",\n props,\n { priority },\n {\n children: children ?? `Priority ${priority}`,\n \"data-domainkit-part\": \"record-priority\",\n },\n );\n}\n\nexport const Header = leafPart(\"thead\", \"records-header\");\nexport const Body = leafPart(\"tbody\", \"records-body\");\nexport const Footer = leafPart(\"tfoot\", \"records-footer\");\nexport const Row = leafPart(\"tr\", \"records-row\");\nexport const Head = leafPart(\"th\", \"records-head\");\nexport const Cell = leafPart(\"td\", \"records-cell\");\nexport const Caption = leafPart(\"caption\", \"records-caption\");\nexport const Value = leafPart(\"span\", \"record-value\");\nexport const CardHeader = leafPart(\"div\", \"record-card-head\");\nexport const CardTitle = leafPart(\"strong\", \"record-card-title\");\nexport const CardContent = leafPart(\"dl\", \"record-card-content\");\n\nexport interface RootProps extends PartProps<\"table\", { readonly count: number }> {\n readonly count?: number;\n}\n\nexport function Root({ count = 0, ...props }: RootProps) {\n return (\n <div data-domainkit-part=\"records-panel\">\n {usePart(\"table\", props, { count }, { \"data-domainkit-part\": \"records-table\" })}\n </div>\n );\n}\n\nexport interface CardProps extends PartProps<\"section\", { readonly recordId: string }> {\n readonly copiedIcon?: ReactNode;\n readonly copyIcon?: ReactNode;\n readonly evidence?: ReadonlyArray<Transport.ObservationEvidence>;\n readonly record: Transport.DnsRecord;\n}\n\nexport function Card({ copiedIcon, copyIcon, evidence, record, ...props }: CardProps) {\n const matching =\n evidence === undefined ? [] : evidence.filter((item) => item.recordId === record.id);\n return usePart(\n \"section\",\n props,\n { recordId: record.id },\n {\n children: (\n <>\n <CardHeader>\n <CardTitle>{record.type}</CardTitle>\n {matching.map((item, index) => (\n <Status evidence={item} key={`${item._tag}-${index}`} />\n ))}\n </CardHeader>\n <CardContent>\n <div>\n <dt>Name</dt>\n <dd>\n <CopyValue copiedIcon={copiedIcon} copyIcon={copyIcon} value={record.name} />\n </dd>\n </div>\n <div>\n <dt>Value</dt>\n <dd>\n <CopyValue copiedIcon={copiedIcon} copyIcon={copyIcon} value={record.value} />\n {record.priority === undefined ? null : <Priority priority={record.priority} />}\n </dd>\n </div>\n </CardContent>\n </>\n ),\n \"data-domainkit-part\": \"record-card\",\n },\n );\n}\n\nexport interface TableProps extends PartProps<\"table\", { readonly count: number }> {\n readonly copiedIcon?: ReactNode;\n readonly copyIcon?: ReactNode;\n readonly evidence?: ReadonlyArray<Transport.ObservationEvidence>;\n readonly records: ReadonlyArray<Transport.DnsRecord>;\n}\n\nexport function Table({ copiedIcon, copyIcon, evidence, records, ...props }: TableProps) {\n const status = evidence !== undefined;\n return (\n <Root count={records.length} {...props}>\n <Header>\n <Row>\n <Head scope=\"col\">Type</Head>\n <Head scope=\"col\">Name</Head>\n <Head scope=\"col\">Value</Head>\n {status ? (\n <Head data-column=\"status\" scope=\"col\">\n Status\n </Head>\n ) : null}\n </Row>\n </Header>\n <Body>\n {records.map((record) => (\n <Row key={record.id}>\n <Cell>{record.type}</Cell>\n <Cell>\n <CopyValue copiedIcon={copiedIcon} copyIcon={copyIcon} value={record.name} />\n </Cell>\n <Cell>\n <Value>\n <CopyValue copiedIcon={copiedIcon} copyIcon={copyIcon} value={record.value} />\n {record.priority === undefined ? null : <Priority priority={record.priority} />}\n </Value>\n </Cell>\n {status ? (\n <Cell data-column=\"status\">\n {evidence\n .filter((item) => item.recordId === record.id)\n .map((item, index) => (\n <Status evidence={item} key={`${item._tag}-${index}`} />\n ))}\n </Cell>\n ) : null}\n </Row>\n ))}\n </Body>\n </Root>\n );\n}\n\nexport const toZoneFile = (records: ReadonlyArray<Transport.DnsRecord>): string =>\n `${records\n .map(\n (record) =>\n `${absoluteDomainName(record.name)} IN ${record.type} ${record.priority === undefined ? \"\" : `${record.priority} `}${zoneValue(record)}`,\n )\n .join(\"\\n\")}\\n`;\n\nexport const downloadZoneFile = (\n domain: string,\n records: ReadonlyArray<Transport.DnsRecord>,\n): void => downloadText(`${domain}.txt`, toZoneFile(records));\n\nexport type DnsRecord = Transport.DnsRecord;\nexport type ObservationEvidence = Transport.ObservationEvidence;\n","import { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Transport } from \"domainkit\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport { useMemo, useRef } from \"react\";\n\nimport { failureFromError, recordsIdentity, type Failure } from \"./atom.ts\";\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport * as Operations from \"./operations.tsx\";\nimport * as Records from \"./records.tsx\";\n\ntype LocalState = Data.TaggedEnum<{\n Applying: { readonly plan: Transport.ProvisioningPlan };\n Complete: { readonly result: Extract<Transport.ApplyResult, { readonly _tag: \"Applied\" }> };\n Idle: {};\n Partial: { readonly result: Extract<Transport.ApplyResult, { readonly _tag: \"Partial\" }> };\n Planning: {};\n Review: { readonly plan: Transport.ProvisioningPlan };\n}>;\nexport const State = Data.taggedEnum<LocalState>();\nexport type State =\n | LocalState\n | Extract<Transport.ApplyResult, { readonly _tag: \"Stale\" }>\n | Failure;\n\nexport interface Controller {\n readonly apply: () => void;\n readonly dismiss: () => void;\n readonly plan: () => void;\n readonly retry: () => void;\n readonly state: State;\n}\n\nexport type Command = Data.TaggedEnum<{\n Apply: {};\n Dismiss: {};\n Plan: {};\n}>;\nexport const Command = Data.taggedEnum<Command>();\n\nexport interface Model {\n readonly command: Atom.AtomResultFn<Command, void>;\n readonly state: Atom.Atom<State>;\n}\n\nexport function useModel(\n connection: Transport.Connected,\n records: ReadonlyArray<Transport.DnsRecord>,\n onApplied?: (\n result: Extract<Transport.ApplyResult, { readonly _tag: \"Applied\" | \"Partial\" }>,\n ) => void,\n): Model {\n const { runtime } = useDomainKit();\n const recordKey = recordsIdentity(records);\n const onAppliedRef = useRef(onApplied);\n onAppliedRef.current = onApplied;\n return useMemo(() => {\n const state = Atom.make<State>(State.Idle());\n const execute = runtime.fn<Command>()((command, get) => {\n if (command._tag === \"Dismiss\") {\n get.set(state, State.Idle());\n return Effect.void;\n }\n if (command._tag === \"Plan\") {\n get.set(state, State.Planning());\n return Effect.flatMap(Transport.Service, (transport) =>\n transport.provisioning.plan({\n connectionId: connection.connectionId,\n domain: connection.domain,\n records,\n }),\n ).pipe(\n Effect.tap((plan) => Effect.sync(() => get.set(state, State.Review({ plan })))),\n Effect.catch((error) => Effect.sync(() => get.set(state, failureFromError(error)))),\n Effect.asVoid,\n );\n }\n const current = get(state);\n if (\n current._tag !== \"Review\" ||\n current.plan.operations.some((operation) => operation._tag === \"Conflict\")\n )\n return Effect.void;\n const plan = current.plan;\n get.set(state, State.Applying({ plan }));\n return Effect.flatMap(Transport.Service, (transport) =>\n transport.provisioning.apply({\n connectionId: connection.connectionId,\n domain: connection.domain,\n planDigest: plan.digest,\n }),\n ).pipe(\n Effect.tap((result) =>\n Effect.sync(() => {\n if (result._tag === \"Applied\") {\n get.set(state, State.Complete({ result }));\n onAppliedRef.current?.(result);\n } else if (result._tag === \"Partial\") {\n get.set(state, State.Partial({ result }));\n onAppliedRef.current?.(result);\n } else {\n get.set(state, result);\n }\n }),\n ),\n Effect.catch((error) => Effect.sync(() => get.set(state, failureFromError(error)))),\n Effect.asVoid,\n );\n });\n return { command: execute, state };\n }, [connection.connectionId, connection.domain, recordKey, runtime]);\n}\n\nexport function useController(\n connection: Transport.Connected,\n records: ReadonlyArray<Transport.DnsRecord>,\n onApplied?: (\n result: Extract<Transport.ApplyResult, { readonly _tag: \"Applied\" | \"Partial\" }>,\n ) => void,\n): Controller {\n const model = useModel(connection, records, onApplied);\n const state = useAtomValue(model.state);\n const execute = useAtomSet(model.command);\n\n return {\n apply: () => execute(Command.Apply()),\n dismiss: () => execute(Command.Dismiss()),\n plan: () => execute(Command.Plan()),\n retry: () => execute(Command.Plan()),\n state,\n };\n}\n\nexport interface RootProps extends PartProps<\"div\", { readonly status: State[\"_tag\"] }> {\n readonly status: State[\"_tag\"];\n}\n\nexport function Root({ status, ...props }: RootProps) {\n return usePart(\n \"div\",\n props,\n { status },\n { \"data-domainkit-part\": \"provisioning-flow\", \"data-state\": status },\n );\n}\n\nexport function Outcome({ state }: { readonly state: State }) {\n const { messages } = useDomainKit();\n if (state._tag === \"Complete\") {\n return (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"success\">\n {messages.recordsApplied}\n </p>\n );\n }\n if (state._tag === \"Partial\" || state._tag === \"Failure\" || state._tag === \"Stale\") {\n return (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {state._tag === \"Partial\" ? messages.recordsPartiallyApplied : state.message}\n </p>\n );\n }\n return null;\n}\n\nexport function Dialog({ controller }: { readonly controller: Controller }) {\n const { colorScheme, messages, portalContainer, themeStyle } = useDomainKit();\n const state = controller.state;\n const plan = state._tag === \"Review\" || state._tag === \"Applying\" ? state.plan : undefined;\n return (\n <BaseDialog.Root\n onOpenChange={(open) => {\n if (!open) controller.dismiss();\n }}\n open={plan !== undefined}\n >\n <BaseDialog.Trigger\n data-domainkit-part=\"plan-trigger\"\n disabled={state._tag === \"Planning\" || state._tag === \"Applying\"}\n onClick={() => controller.plan()}\n >\n {state._tag === \"Planning\" ? messages.planningDns : messages.reviewDns}\n </BaseDialog.Trigger>\n {plan === undefined ? null : (\n <BaseDialog.Portal container={portalContainer ?? undefined}>\n <BaseDialog.Backdrop data-domainkit-part=\"dialog-backdrop\" />\n <BaseDialog.Popup\n data-color-scheme={colorScheme}\n data-domainkit-part=\"plan-dialog\"\n data-domainkit-root=\"\"\n style={themeStyle}\n >\n <div data-domainkit-part=\"dialog-header\">\n <div data-domainkit-part=\"dialog-heading\">\n <BaseDialog.Title data-domainkit-part=\"dialog-title\">\n {messages.reviewDns}\n </BaseDialog.Title>\n <BaseDialog.Description data-domainkit-part=\"dialog-description\">\n {messages.planConsent}\n </BaseDialog.Description>\n </div>\n <BaseDialog.Close aria-label={messages.close} data-domainkit-part=\"dialog-close\">\n ×\n </BaseDialog.Close>\n </div>\n <div data-domainkit-part=\"dialog-body\">\n <Operations.List lifecycle=\"provisioning\" operations={plan.operations} />\n </div>\n <div data-domainkit-part=\"dialog-footer\">\n <BaseDialog.Close data-domainkit-part=\"dialog-cancel\">\n {messages.cancel}\n </BaseDialog.Close>\n <button\n data-domainkit-part=\"plan-apply\"\n disabled={\n state._tag === \"Applying\" ||\n plan.operations.some((operation) => operation._tag === \"Conflict\")\n }\n onClick={() => controller.apply()}\n type=\"button\"\n >\n {state._tag === \"Applying\" ? messages.applyingDns : messages.applyDns}\n </button>\n </div>\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n )}\n </BaseDialog.Root>\n );\n}\n\nexport function RetryAction({ controller }: { readonly controller: Controller }) {\n const { messages } = useDomainKit();\n const state = controller.state;\n if (state._tag !== \"Failure\" && state._tag !== \"Stale\" && state._tag !== \"Partial\") return null;\n return (\n <button\n data-domainkit-part=\"provisioning-retry\"\n onClick={() => controller.retry()}\n type=\"button\"\n >\n {messages.retry}\n </button>\n );\n}\n\nexport interface FlowProps extends Omit<RootProps, \"status\"> {\n readonly connection: Transport.Connected;\n readonly onApplied?: (\n result: Extract<Transport.ApplyResult, { readonly _tag: \"Applied\" | \"Partial\" }>,\n ) => void;\n readonly records: ReadonlyArray<Transport.DnsRecord>;\n readonly showRecords?: boolean;\n}\n\nexport function Flow({ connection, onApplied, records, showRecords = true, ...props }: FlowProps) {\n const controller = useController(connection, records, onApplied);\n const state = controller.state;\n return (\n <Root status={state._tag} {...props}>\n {showRecords ? <Records.Table records={records} /> : null}\n <Outcome state={state} />\n <Dialog controller={controller} />\n <RetryAction controller={controller} />\n </Root>\n );\n}\n","import { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Transport } from \"domainkit\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Atom from \"effect/unstable/reactivity/Atom\";\nimport { useMemo } from \"react\";\n\nimport { failureFromError, recordsIdentity, type Failure } from \"./atom.ts\";\nimport type { PartProps } from \"./composition.tsx\";\nimport { usePart } from \"./composition.tsx\";\nimport { useDomainKit } from \"./domain-kit.tsx\";\nimport { Status as RecordStatus } from \"./records.tsx\";\n\ntype LocalState = Data.TaggedEnum<{\n Idle: {};\n Observing: {};\n}>;\nexport const State = Data.taggedEnum<LocalState>();\nexport type State = LocalState | Transport.Observation | Failure;\n\nexport interface ObserveConfig {\n readonly connection?: Transport.Connected;\n readonly domain: string;\n readonly records: ReadonlyArray<Transport.DnsRecord>;\n readonly sources?: {\n readonly provider?: boolean;\n readonly publicDns?: boolean;\n };\n}\n\nexport type Command = Data.TaggedEnum<{\n Observe: {};\n Reset: {};\n}>;\nexport const Command = Data.taggedEnum<Command>();\n\nexport interface Model {\n readonly command: Atom.AtomResultFn<Command, void>;\n readonly state: Atom.Atom<State>;\n}\n\nexport interface Controller {\n readonly observe: () => void;\n readonly reset: () => void;\n readonly state: State;\n}\n\nexport function useModel(config: ObserveConfig): Model {\n const { runtime } = useDomainKit();\n const provider = config.sources?.provider ?? config.connection !== undefined;\n const publicDns = config.sources?.publicDns ?? true;\n const recordKey = recordsIdentity(config.records);\n return useMemo(() => {\n const state = Atom.make<State>(State.Idle());\n const observe = runtime.fn<Command>()((command, get) => {\n if (command._tag === \"Reset\") {\n get.set(state, State.Idle());\n return Effect.void;\n }\n get.set(state, State.Observing());\n return Effect.flatMap(Transport.Service, (transport) =>\n transport.verification.observe({\n ...(config.connection === undefined\n ? {}\n : { connectionId: config.connection.connectionId }),\n domain: config.domain,\n records: config.records,\n sources: { provider, publicDns },\n }),\n ).pipe(\n Effect.tap((observation) => Effect.sync(() => get.set(state, observation))),\n Effect.catch((error) => Effect.sync(() => get.set(state, failureFromError(error)))),\n Effect.asVoid,\n );\n });\n return { command: observe, state };\n }, [config.connection?.connectionId, config.domain, provider, publicDns, recordKey, runtime]);\n}\n\nexport function useController(config: ObserveConfig): Controller {\n const model = useModel(config);\n const state = useAtomValue(model.state);\n const dispatch = useAtomSet(model.command);\n const observe = () => dispatch(Command.Observe());\n const reset = () => dispatch(Command.Reset());\n return { observe, reset, state };\n}\n\nconst evidenceNote = (evidence: Transport.ObservationEvidence): string | undefined => {\n switch (evidence._tag) {\n case \"Mismatch\":\n case \"Unavailable\":\n return evidence.message;\n case \"Found\":\n case \"Missing\":\n return undefined;\n default: {\n const _exhaustive: never = evidence;\n return _exhaustive;\n }\n }\n};\n\nconst observationGroups = (\n observation: Transport.Observation,\n): ReadonlyArray<{\n readonly evidence: ReadonlyArray<Transport.ObservationEvidence>;\n readonly label: string;\n}> =>\n [\n { evidence: observation.provider, label: \"Provider\" },\n { evidence: observation.publicDns, label: \"Public DNS\" },\n ].filter((group) => group.evidence.length > 0);\n\nexport interface RootProps extends PartProps<\"div\", { readonly status: State[\"_tag\"] }> {\n readonly status: State[\"_tag\"];\n}\n\nexport function Root({ status, ...props }: RootProps) {\n return usePart(\n \"div\",\n props,\n { status },\n { \"data-domainkit-part\": \"verification-status\", \"data-state\": status },\n );\n}\n\nexport function Evidence({ observation }: { readonly observation: Transport.Observation }) {\n return (\n <div data-domainkit-part=\"observation-list\">\n {observationGroups(observation).map((group) => (\n <section data-domainkit-part=\"observation-group\" key={group.label}>\n <p data-domainkit-part=\"observation-source\">{group.label}</p>\n <ul>\n {group.evidence.map((evidence, index) => {\n const note = evidenceNote(evidence);\n return (\n <li key={`${evidence._tag}-${evidence.recordId}-${index}`}>\n <div data-domainkit-part=\"observation-row\">\n <span data-domainkit-part=\"observation-record\">{evidence.recordId}</span>\n <RecordStatus evidence={evidence} />\n </div>\n {note === undefined ? null : <p data-domainkit-part=\"observation-note\">{note}</p>}\n </li>\n );\n })}\n </ul>\n </section>\n ))}\n </div>\n );\n}\n\nexport function Outcome({ state }: { readonly state: State }) {\n if (state._tag !== \"Failure\") return null;\n return (\n <p data-domainkit-part=\"flow-outcome\" data-tone=\"danger\" role=\"alert\">\n {state.message}\n </p>\n );\n}\n\nexport function ObserveAction({ controller }: { readonly controller: Controller }) {\n const { messages } = useDomainKit();\n return (\n <button\n data-domainkit-part=\"observe-action\"\n disabled={controller.state._tag === \"Observing\"}\n onClick={() => controller.observe()}\n type=\"button\"\n >\n {controller.state._tag === \"Observing\" ? messages.checkingDns : messages.checkDns}\n </button>\n );\n}\n\nexport interface StatusProps extends Omit<RootProps, \"status\"> {\n readonly config: ObserveConfig;\n}\n\nexport function Status({ config, ...props }: StatusProps) {\n const controller = useController(config);\n const state = controller.state;\n return (\n <Root status={state._tag} {...props}>\n {state._tag === \"Observation\" ? <Evidence observation={state} /> : null}\n <Outcome state={state} />\n <ObserveAction controller={controller} />\n </Root>\n );\n}\n\nexport type Observation = Transport.Observation;\n","import { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport type { Transport } from \"domainkit\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport * as Cleanup from \"./cleanup.tsx\";\nimport * as Connection from \"./connection.tsx\";\nimport * as Provisioning from \"./provisioning.tsx\";\nimport * as Provider from \"./provider.tsx\";\nimport * as Records from \"./records.tsx\";\nimport * as Verification from \"./verification.tsx\";\n\nexport interface FlowProps {\n readonly domain: string;\n readonly receiptId?: string;\n readonly records: ReadonlyArray<Transport.DnsRecord>;\n}\n\nexport function Flow({ domain, receiptId, records }: FlowProps) {\n const connection = Connection.useController(domain);\n const state = connection.state;\n return (\n <Connection.Root status={state._tag}>\n {state._tag === \"Connected\" ? null : <Connection.Status state={state} />}\n {state._tag === \"Failure\" && (state.retry === \"safe\" || state.retry === \"unknown\") ? (\n <Connection.RetryAction controller={connection} />\n ) : null}\n {state._tag === \"Disconnected\" ? (\n <BaseDialog.Root>\n <Connection.ConnectTrigger provider={state.provider} />\n <Connection.Dialog controller={connection} snapshot={state} />\n </BaseDialog.Root>\n ) : null}\n {state._tag === \"Connected\" ? (\n <div data-domainkit-part=\"connected-shell\">\n <ConnectedFlow\n connection={state}\n {...(receiptId === undefined ? {} : { initialReceiptId: receiptId })}\n records={records}\n />\n </div>\n ) : null}\n </Connection.Root>\n );\n}\n\nfunction ConnectedFlow({\n connection,\n initialReceiptId,\n records,\n}: {\n readonly connection: Extract<Connection.State, { readonly _tag: \"Connected\" }>;\n readonly initialReceiptId?: string;\n readonly records: ReadonlyArray<Transport.DnsRecord>;\n}) {\n const [appliedReceipt, setAppliedReceipt] = useState<{\n readonly epoch: number;\n readonly receiptId: string;\n }>();\n const receiptSource = initialReceiptId ?? null;\n const receiptEpoch = useRef({ source: receiptSource, value: 0 });\n const epoch =\n receiptEpoch.current.source === receiptSource\n ? receiptEpoch.current.value\n : receiptEpoch.current.value + 1;\n useEffect(() => {\n if (receiptEpoch.current.source === receiptSource) return;\n receiptEpoch.current = { source: receiptSource, value: receiptEpoch.current.value + 1 };\n setAppliedReceipt(undefined);\n }, [receiptSource]);\n const receiptId =\n appliedReceipt !== undefined && appliedReceipt.epoch === epoch\n ? appliedReceipt.receiptId\n : initialReceiptId;\n const rememberReceipt = (\n result: Extract<Transport.ApplyResult, { readonly _tag: \"Applied\" | \"Partial\" }>,\n ) => {\n setAppliedReceipt({ epoch, receiptId: result.receiptId });\n };\n return (\n <>\n <div data-domainkit-part=\"connected-card\">\n <div data-domainkit-part=\"connected-identity\">\n <Provider.Mark provider={connection.provider} />\n <Connection.Status state={connection} />\n </div>\n <div data-domainkit-part=\"connected-actions\">\n <Provisioning.Flow\n connection={connection}\n onApplied={rememberReceipt}\n records={records}\n showRecords={false}\n />\n <Verification.Status config={{ connection, domain: connection.domain, records }} />\n <Connection.DisconnectAction connection={connection} />\n </div>\n </div>\n <Records.Table records={records} />\n {receiptId === undefined ? null : (\n <Cleanup.Flow connection={connection} receiptId={receiptId} />\n )}\n </>\n );\n}\n","import { Transport } from \"domainkit\";\nimport type * as Layer from \"effect/Layer\";\n\nexport interface FakeOptions {\n readonly connect?: Transport.ConnectionResult;\n readonly inspect:\n | Transport.ConnectionSnapshot\n | FakeFailure\n | ReadonlyArray<Transport.ConnectionSnapshot | FakeFailure>;\n readonly reuse?: Transport.Connected;\n readonly removeDomain?: Transport.RemoveDomainResult;\n readonly plan?: Transport.ProvisioningPlan;\n readonly apply?: Transport.ApplyResult;\n readonly observe?: Transport.Observation;\n readonly cleanupPlan?: Transport.CleanupPlan;\n readonly cleanupApply?: Transport.CleanupResult;\n}\n\ninterface FakeFailure {\n readonly _tag: \"Failure\";\n readonly message: string;\n readonly operation?: string;\n readonly retry: Transport.Failure[\"retry\"];\n}\n\nexport interface FakeTransport extends Transport.AsyncInterface, Layer.Layer<Transport.Service> {\n readonly calls: {\n readonly connect: Array<Transport.ConnectInput>;\n readonly inspect: Array<Transport.InspectInput>;\n readonly reuse: Array<Transport.ReuseInput>;\n readonly removeDomain: Array<Transport.RemoveDomainInput>;\n readonly plan: Array<Transport.ProvisioningPlanInput>;\n readonly apply: Array<Transport.ProvisioningApplyInput>;\n readonly observe: Array<Transport.ObserveInput>;\n readonly cleanupPlan: Array<Transport.CleanupPlanInput>;\n readonly cleanupApply: Array<Transport.CleanupApplyInput>;\n };\n}\n\nexport const provider = (overrides: Partial<Transport.Provider> = {}): Transport.Provider => ({\n authentication: [\n { _tag: \"OAuth\", label: \"Continue with OAuth\" },\n { _tag: \"Token\", label: \"Connect with token\", placeholder: \"Paste API token\" },\n ],\n id: \"cloudflare\",\n name: \"Cloudflare\",\n ...overrides,\n});\n\nexport function makeFakeTransport(options: FakeOptions): FakeTransport {\n const calls: FakeTransport[\"calls\"] = {\n apply: [],\n cleanupApply: [],\n cleanupPlan: [],\n connect: [],\n inspect: [],\n observe: [],\n plan: [],\n removeDomain: [],\n reuse: [],\n };\n const inspections = Array.isArray(options.inspect) ? [...options.inspect] : [options.inspect];\n const transport: Transport.AsyncInterface = {\n cleanup: {\n apply: async (input) => {\n calls.cleanupApply.push(input);\n return (\n options.cleanupApply ?? {\n _tag: \"Cleaned\",\n operationId: \"cleanup-operation-1\",\n results: [],\n }\n );\n },\n plan: async (input) => {\n calls.cleanupPlan.push(input);\n return (\n options.cleanupPlan ?? {\n _tag: \"CleanupPlan\",\n digest: \"cleanup-digest-1\",\n expiresAt: \"2099-01-01T00:00:00.000Z\",\n operations: [],\n }\n );\n },\n },\n connection: {\n connect: async (input) => {\n calls.connect.push(input);\n return (\n options.connect ?? {\n _tag: \"Connected\",\n connectionId: \"connection-1\",\n domain: input.domain,\n provider: provider(),\n }\n );\n },\n inspect: async (input) => {\n calls.inspect.push(input);\n const snapshot = inspections.shift() ?? inspections.at(-1) ?? options.inspect;\n if (Array.isArray(snapshot)) throw new Error(\"Fake inspection sequence is empty\");\n if (snapshot._tag === \"Failure\")\n throw new Transport.Failure({\n message: snapshot.message,\n operation: snapshot.operation ?? \"connection.inspect\",\n retry: snapshot.retry,\n });\n return snapshot;\n },\n reuse: async (input) => {\n calls.reuse.push(input);\n return (\n options.reuse ?? {\n _tag: \"Connected\",\n connectionId: input.connectionId,\n domain: input.domain,\n provider: provider(),\n }\n );\n },\n removeDomain: async (input) => {\n calls.removeDomain.push(input);\n return (\n options.removeDomain ?? {\n _tag: \"Removed\",\n connectionId: input.connectionId,\n domain: input.domain,\n remainingDomainCount: 0,\n }\n );\n },\n },\n provisioning: {\n apply: async (input) => {\n calls.apply.push(input);\n return (\n options.apply ?? {\n _tag: \"Applied\",\n operationId: \"apply-operation-1\",\n receiptId: \"receipt-1\",\n results: [],\n }\n );\n },\n plan: async (input) => {\n calls.plan.push(input);\n return (\n options.plan ?? {\n _tag: \"Plan\",\n digest: \"plan-digest-1\",\n expiresAt: \"2099-01-01T00:00:00.000Z\",\n operations: input.records.map((record) => ({\n _tag: \"Create\" as const,\n id: `create-${record.id}`,\n record,\n })),\n }\n );\n },\n },\n verification: {\n observe: async (input) => {\n calls.observe.push(input);\n return (\n options.observe ?? {\n _tag: \"Observation\",\n provider: input.sources.provider\n ? input.records.map((record) => ({ _tag: \"Found\" as const, recordId: record.id }))\n : [],\n publicDns: input.sources.publicDns\n ? input.records.map((record) => ({ _tag: \"Found\" as const, recordId: record.id }))\n : [],\n }\n );\n },\n },\n };\n return Object.assign(Transport.layerFromAsync(transport), transport, { calls });\n}\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,UAAU,KAAK,WAAoB;AAEhD,MAAa,oBAAoB,UAC/B,QAAQ,QAAQ;CACd,SAAS,MAAM;CACf,WAAW,MAAM;CACjB,OAAO,MAAM;AACf,CAAC;AAEH,MAAa,qBAAqB,WAAmB,YACnD,QAAQ,QAAQ;CAAE;CAAS;CAAW,OAAO;AAAO,CAAC;AAEvD,MAAa,mBAAmB,YAC9B,KAAK,UACH,QAAQ,KAAK,EAAE,IAAI,MAAM,UAAU,MAAM,aAAa;CAAE;CAAI;CAAM;CAAU;CAAM;AAAM,EAAE,CAC5F;;;ACbF,SAAgB,QAId,gBACA,gBACA,OACA,eACc;CACd,MAAM,EAAE,WAAW,QAAQ,OAAO,GAAG,kBAAkB;CACvD,MAAM,aAGF;EACF,GAAI,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU;EAC/C;EACA,OAAO,CAAC,eAAe,aAAa;EACpC,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;EACzC;EACA,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;CACzC;CACA,OAAO,UAAU,UAAU;AAC7B;;;AC7BA,SAAS,MAAM,EAAE,YAA8C;CAC7D,OACE,oBAAC,OAAD;EACE,eAAY;EACZ,MAAK;EACL,QAAO;EACP,eAAc;EACd,gBAAe;EACf,aAAa;EACb,SAAQ;EAEP;CACE,CAAA;AAET;AAEA,MAAa,eAAe;CAC1B,QACE,oBAAC,OAAD,EAAA,UACE,oBAAC,QAAD,EAAM,GA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