@pontive/pontkit-core 1.38.0 → 1.40.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.
- package/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/index.js +1410 -1263
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14296 -12214
- package/dist/index.mjs.map +1 -1
- package/dist/pont2/core/context-root.d.ts +1 -0
- package/dist/pont2/core/events.d.ts +1 -1
- package/dist/pont2/core/icons.d.ts +6 -0
- package/dist/pont2/core/index.d.ts +1 -0
- package/dist/pont2/core/messages.d.ts +21 -0
- package/dist/pont2/core/popup/index.d.ts +1 -0
- package/dist/pont2/core/popup/modal.d.ts +56 -0
- package/dist/pont2/core/popup/popup-content.d.ts +7 -0
- package/dist/pont2/core/popup/story-helpers.d.ts +6 -0
- package/dist/pont2/custom-elements.json +42860 -18234
- package/dist/pont2/index.d.ts +7 -0
- package/dist/pont2/index.mjs +4434 -2359
- package/dist/pont2/index.mjs.map +1 -1
- package/dist/pont2/kit/badge-selector/badge-selector.d.ts +65 -0
- package/dist/pont2/kit/consent/consent.d.ts +3 -2
- package/dist/pont2/kit/data-table/data-table.d.ts +120 -0
- package/dist/pont2/kit/data-table/rows.d.ts +25 -0
- package/dist/pont2/kit/flow-widget/flow-widget.d.ts +21 -8
- package/dist/pont2/kit/index.d.ts +7 -0
- package/dist/pont2/kit/layout/layout.d.ts +7 -0
- package/dist/pont2/kit/multi-email-input/emails.d.ts +19 -0
- package/dist/pont2/kit/multi-email-input/multi-email-input.d.ts +78 -0
- package/dist/pont2/kit/multi-select-filter/multi-select-filter.d.ts +53 -0
- package/dist/pont2/kit/pagination/pagination.d.ts +61 -0
- package/dist/pont2/kit/pagination/range.d.ts +17 -0
- package/dist/pont2/kit/provider/coexistence.d.ts +19 -0
- package/dist/pont2/kit/provider/contexts.d.ts +46 -0
- package/dist/pont2/kit/provider/provider.d.ts +185 -0
- package/dist/pont2/kit/provider/redirect.d.ts +122 -0
- package/dist/pont2/kit/provider/runtime-config.d.ts +24 -0
- package/dist/pont2/kit/provider/sdk.d.ts +86 -0
- package/dist/pont2/kit/provider/signed-in.d.ts +81 -0
- package/dist/pont2/kit/provider/widget-messages.d.ts +35 -0
- package/dist/pont2/primitives/alert-dialog/alert-dialog.d.ts +132 -0
- package/dist/pont2/primitives/combobox/combobox.d.ts +82 -14
- package/dist/pont2/primitives/dialog/dialog.d.ts +195 -0
- package/dist/pont2/primitives/drawer/drawer.d.ts +112 -0
- package/dist/pont2/primitives/hover-card/hover-card.d.ts +83 -0
- package/dist/pont2/primitives/pagination/pagination.d.ts +120 -0
- package/dist/pont2/primitives/sheet/sheet.d.ts +92 -0
- package/dist/pont2/primitives/sonner/sonner.d.ts +86 -0
- package/dist/pont2/primitives/sonner/toast-store.d.ts +81 -0
- package/dist/pont2/styles.css +1325 -81
- package/dist/pont2/theme/tokens.json.d.ts +700 -1
- package/dist/pont2/theme-golden.json +85 -43
- package/dist/pont2/theme.mjs +119 -119
- package/dist/pont2/tokens.json +700 -1
- package/dist/styles.css +1325 -81
- package/package.json +11 -5
package/dist/pont2/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../pont2/src/core/attrs.ts","../../pont2/src/core/names.ts","../../pont2/src/core/host-element.ts","../../pont2/src/core/form-control.ts","../../pont2/src/core/design-mode.ts","../../pont2/src/core/ids.ts","../../pont2/src/core/events.ts","../../pont2/src/core/icons.ts","../../pont2/src/core/messages.ts","../../pont2/src/core/url.ts","../../pont2/src/core/controllers/roving-focus.ts","../../pont2/src/core/controllers/action.ts","../../pont2/src/core/controllers/copy.ts","../../pont2/src/primitives/badge/badge.ts","../../pont2/src/primitives/button/button.ts","../../pont2/src/primitives/checkbox/checkbox.ts","../../pont2/src/primitives/input/input.ts","../../pont2/src/primitives/kbd/kbd.ts","../../pont2/src/primitives/label/label.ts","../../pont2/src/primitives/separator/separator.ts","../../pont2/src/primitives/skeleton/skeleton.ts","../../pont2/src/primitives/spinner/spinner.ts","../../pont2/src/primitives/textarea/textarea.ts","../../pont2/src/primitives/alert/alert.ts","../../pont2/src/primitives/avatar/avatar.ts","../../pont2/src/primitives/button-group/button-group.ts","../../pont2/src/primitives/card/card.ts","../../pont2/src/primitives/empty/empty.ts","../../pont2/src/primitives/field/field.ts","../../pont2/src/primitives/input-group/input-group.ts","../../pont2/src/primitives/item/item.ts","../../pont2/src/primitives/native-select/native-select.ts","../../pont2/src/primitives/table/table.ts","../../pont2/src/primitives/input-otp/otp.ts","../../pont2/src/primitives/input-otp/input-otp.ts","../../pont2/src/primitives/progress/progress.ts","../../pont2/src/primitives/radio-group/radio-group.ts","../../pont2/src/primitives/slider/slider-math.ts","../../pont2/src/primitives/slider/slider.ts","../../pont2/src/primitives/switch/switch.ts","../../pont2/src/primitives/tabs/tabs.ts","../../pont2/src/core/popup/position.ts","../../pont2/src/core/popup/anchored.ts","../../pont2/src/core/popup/list.ts","../../pont2/src/core/popup/popup-content.ts","../../pont2/src/core/popup/popup-root.ts","../../pont2/src/primitives/popover/popover.ts","../../pont2/src/primitives/dropdown-menu/dropdown-menu.ts","../../pont2/src/primitives/select/select.ts","../../pont2/src/primitives/combobox/combobox.ts","../../pont2/src/primitives/tooltip/tooltip.ts","../../pont2/src/kit/aliases.ts","../../pont2/src/kit/alert/alert.ts","../../pont2/src/kit/avatar/avatar.ts","../../pont2/src/kit/input-otp/input-otp.ts","../../pont2/src/kit/auth-button/providers.ts","../../pont2/src/kit/auth-button/auth-button.ts","../../pont2/src/kit/auth-field/auth-field.ts","../../pont2/src/kit/auth-field/password-field.ts","../../pont2/src/kit/otp-field/otp-field.ts","../../pont2/src/kit/otp-field/otp-resend.ts","../../pont2/src/kit/link/link.ts","../../pont2/src/kit/divider/divider.ts","../../pont2/src/kit/typography/typography.ts","../../pont2/src/kit/provider-field/provider-field.ts","../../pont2/src/kit/watermark/pontive-logo.ts","../../pont2/src/kit/watermark/watermark.ts","../../pont2/src/kit/block/branding.ts","../../pont2/src/kit/block/block.ts","../../pont2/src/kit/container/container.ts","../../pont2/src/kit/header/header.ts","../../pont2/src/kit/gap/gap.ts","../../pont2/src/kit/logo/logo.ts","../../pont2/src/kit/countdown/countdown.ts","../../pont2/src/kit/edit-identifier/edit-identifier.ts","../../pont2/src/kit/secret/secret.ts","../../pont2/src/kit/qr-code/qr-code.ts","../../pont2/src/kit/recovery-codes/recovery-codes.ts","../../pont2/src/kit/scope-list/scope-value.ts","../../pont2/src/kit/scope-list/scope-list.ts","../../pont2/src/kit/layout/flow-error.ts","../../pont2/src/kit/layout/layout.ts","../../pont2/src/kit/consent/consent-api.ts","../../pont2/src/kit/consent/consent.ts","../../pont2/src/kit/flow-widget/flow-widget.ts","../../pont2/src/kit/flow-widget/preview.ts","../../pont2/src/kit/flow-widget/specimens.ts"],"sourcesContent":["import { noChange } from \"lit\";\nimport { Directive, directive, PartType, type ElementPart, type PartInfo } from \"lit/directive.js\";\n\nexport type AttrValue = string | number | boolean | null | undefined;\nexport type AttrMap = Record<string, AttrValue>;\n\n/**\n * `<button ${attrs({ \"data-provider\": \"google\", \"aria-busy\": loading })}>`\n *\n * Lit has no attribute spread; part functions need one. It plays the role of\n * `{...props}` in a shadcn component: a composing component can put extra\n * attributes on the *same* element a part renders, so it never has to wrap\n * that element. `true` → empty attribute; `false`/`null`/`undefined` → removed;\n * keys dropped since the previous render are removed.\n */\nclass AttrsDirective extends Directive {\n private prev = new Set<string>();\n\n constructor(info: PartInfo) {\n super(info);\n if (info.type !== PartType.ELEMENT) throw new Error(\"attrs() must be used in element position\");\n }\n\n render(_attrs: AttrMap) {\n return noChange;\n }\n\n override update(part: ElementPart, [map]: [AttrMap]) {\n applyAttrs(part.element, map, this.prev);\n this.prev = new Set(Object.keys(map));\n return noChange;\n }\n}\n\nexport const attrs = directive(AttrsDirective);\n\n/** Imperative twin of `attrs()`, for code that holds a node rather than a template. */\nexport function applyAttrs(el: Element, map: AttrMap, previous?: Iterable<string>): void {\n if (previous) for (const k of previous) if (!(k in map)) el.removeAttribute(k);\n for (const [k, v] of Object.entries(map)) {\n if (v === false || v == null) {\n if (el.hasAttribute(k)) el.removeAttribute(k);\n } else {\n const s = v === true ? \"\" : String(v);\n if (el.getAttribute(k) !== s) el.setAttribute(k, s);\n }\n }\n}\n\n/**\n * A list attribute: a JSON array (`[\"google\",\"github\"]`, the form the platform's\n * resolve pass writes for `providers` and `identifiers`) or space/comma-separated\n * words (`google github`), as authors write them. Non-string JSON items become\n * strings; anything unparsable is an empty list.\n */\nexport function parseList(value: string | null | undefined): string[] {\n const raw = (value ?? \"\").trim();\n if (!raw) return [];\n if (raw.startsWith(\"[\")) {\n try {\n const parsed: unknown = JSON.parse(raw);\n return Array.isArray(parsed) ? parsed.map(item => String(item).trim()).filter(Boolean) : [];\n } catch {\n return [];\n }\n }\n return raw.split(/[\\s,]+/).filter(Boolean);\n}\n","/**\n * The pont2 namespace, in one place.\n *\n * | Thing | Form | Example |\n * |------------------|-------------------------------|--------------------------------------|\n * | primitive tag | `pont2-prim-<name>` | `pont2-prim-alert`, `pont2-prim-alert-title` |\n * | kit tag | `pont2-<name>` | `pont2-alert` (composite), `pont2-button` (alias) |\n * | identity attr | `data-pont2-<identity>` | `data-pont2-alert` (tier-neutral: \"this is an alert\") |\n * | slot attr | `data-slot=\"<name>\"` | `data-slot=\"item-separator\"` (shadcn's own, unprefixed) |\n * | state attrs | `data-<state>` | `data-checked`, `data-open` (Base UI's own, unprefixed) |\n * | CSS custom prop | `--pont2-sem-<role>` … | `--pont2-sem-color-primary` (docs/11-tokens.md) |\n * | cascade layer | `pont2.<layer>` | `pont2.primitives`, `pont2.kit` |\n * | custom event | `pont2-<name>` | `pont2-open-change` |\n *\n * Two element surfaces share one namespace (docs/10-primitives-and-kit.md):\n *\n * - **primitives** `pont2-prim-*`: shadcn's components, one for one.\n * - **kit** `pont2-*`: what applications use. A kit element is either an\n * *alias* of a primitive (same behaviour, second tag) or a *composite* (a\n * subclass of a primitive that renders the primitive's children from\n * properties). Invariant: **`pont2-<name>` is always a `<name>` at its\n * root**, which is what lets `sel()` / `tags()` match both surfaces at once.\n *\n * The identity attribute is tier-neutral on purpose: it says *what* an element\n * is (an alert), not *which tag* produced it. Recipes and lookups key on it, so\n * a primitive, its alias, a composite built on it and hand-written recipe\n * markup are all styled and found the same way.\n *\n * `data-slot` and the state attributes stay unprefixed on purpose: they are\n * shadcn's and Base UI's public styling contract, and keeping them verbatim\n * is what lets shadcn styles port across mechanically.\n */\nexport const PREFIX = \"pont2\";\n/** Tag segment that marks the primitive surface. */\nexport const PRIM = \"prim\";\n\n/** Kit tag: `tag(\"alert\")` → `pont2-alert`. */\nexport const tag = (name: string) => `${PREFIX}-${name}` as const;\n/** Primitive tag: `primTag(\"alert\")` → `pont2-prim-alert`. */\nexport const primTag = (name: string) => `${PREFIX}-${PRIM}-${name}` as const;\nexport const identityAttr = (identity: string) => `data-${PREFIX}-${identity}` as const;\n\n/**\n * Selector for every element that *is* a `<name>`: its primitive tag, its kit\n * tag (an alias or a composite, which by the kit invariant has that root) and\n * its identity attribute (upgraded elements, parts rendered by composites,\n * hand-written recipe markup).\n *\n * `sel(\"alert\")` → `:is(pont2-prim-alert, pont2-alert, [data-pont2-alert])`\n *\n * Use it for every structural lookup (`closest`, `querySelector`), so a\n * component works whichever surface its parts were written with.\n * Tier 3 shells are the exception: their identity attribute lives on the\n * native child, so look shells up with `tags()`.\n */\nexport const sel = (name: string) => `:is(${primTag(name)}, ${tag(name)}, [${identityAttr(name)}])`;\n\n/** The element tags only, on both surfaces: `:is(pont2-prim-x, pont2-x)`. Use for shells. */\nexport const tags = (name: string) => `:is(${primTag(name)}, ${tag(name)})`;\n\n/**\n * Registers an element once. Re-registration (HMR, a second bundle copy) is a\n * no-op rather than a thrown DOMException, but a *different* class under the\n * same tag is reported, because that means two copies of pont2 are loaded.\n */\nexport function define(name: string, ctor: CustomElementConstructor): void {\n const existing = customElements.get(name);\n if (!existing) {\n customElements.define(name, ctor);\n } else if (existing !== ctor && import.meta.env?.DEV) {\n console.warn(`[pont2] <${name}> is already defined by another class (two pont2 copies loaded?).`);\n }\n}\n\nconst aliases = new Map<CustomElementConstructor, CustomElementConstructor>();\n\n/**\n * Promotes a primitive to the kit surface unchanged: `pont2-<name>` becomes a\n * second tag for `pont2-prim-<name>`.\n *\n * The platform forbids registering one constructor under two names, so the\n * alias is an empty subclass. It inherits everything (identity, slot, role,\n * properties, form association), so it is styled, announced and submitted\n * exactly like the primitive, and `instanceof` the primitive class holds.\n *\n * ```ts\n * defineAlias(\"pont2-button\", Pont2Button); // <pont2-prim-button> → also <pont2-button>\n * ```\n *\n * Returns the alias constructor.\n */\nexport function defineAlias<T extends CustomElementConstructor>(kitTag: `pont2-${string}`, base: T): T {\n if (import.meta.env?.DEV) {\n const expected = kitTag.replace(`${PREFIX}-`, `${PREFIX}-${PRIM}-`);\n const registered = customElements.getName?.(base);\n if (registered && registered !== expected) {\n console.warn(`[pont2] defineAlias(\"${kitTag}\") expects the class registered as <${expected}>, got <${registered}>.`);\n }\n }\n let alias = aliases.get(base) as T | undefined;\n if (!alias) {\n // Static members (properties, identity, formAssociated, nativeSelector…)\n // are inherited through the constructor's prototype chain.\n alias = class extends (base as unknown as new () => HTMLElement) {} as unknown as T;\n Object.defineProperty(alias, \"name\", { value: `${base.name}Alias` });\n aliases.set(base, alias);\n }\n define(kitTag, alias);\n return customElements.get(kitTag) as T;\n}\n","import { LitElement, ReactiveElement, type PropertyValues } from \"lit\";\nimport type { DirectiveResult } from \"lit/directive.js\";\n\nimport { attrs, type AttrMap } from \"./attrs\";\nimport { identityAttr, PREFIX } from \"./names\";\n\n/**\n * # HostElement: the host is the component's root element\n *\n * The base class of every pont2 element. A shadcn component is a function\n * that returns its root element and then disappears. A custom element cannot\n * disappear, so in pont2 **the host *is* the root**: `<pont2-prim-separator>` is the\n * separator, it does not render one.\n *\n * What a subclass gets:\n *\n * | Static / member | Does |\n * |---------------------|----------------------------------------------------------------------|\n * | `static identity` | Stamps `data-pont2-<identity>`. Every class in the chain adds its own, so a subclass keeps its base's styles (`pont2-prim-item-separator` carries `data-pont2-separator` *and* `data-pont2-item-separator`). |\n * | `static slotName` | Stamps `data-slot` (shadcn's convention). Most-derived class wins. An author-written `data-slot` is never overwritten. |\n * | `static role` | Default ARIA role through `ElementInternals`. An author's `role=\"\"` attribute still wins. |\n * | `internals` | `ElementInternals`: default ARIA, custom states, forms (see FormControlElement). |\n * | `setData()` | Writes component-owned `data-*` state on the host (Base UI's presence-style attributes). |\n * | `setState()` | Adds/removes a CustomStateSet entry, matchable as `:state(x)`. |\n * | `static part()` | The same identity, slot and role as attributes, for a composite to put on a plain element (see below). |\n * | `static composite` | Marks a kit composite: it renders its whole subtree from properties (docs/10-primitives-and-kit.md). |\n *\n * Light DOM throughout: `createRenderRoot()` returns `this`. Most Tier 1\n * elements never override `render()`; their children are whatever the author\n * wrote, left exactly where the author wrote them.\n */\nexport abstract class HostElement extends LitElement {\n /** Style identity → `data-pont2-<identity>`. Inherited along the class chain. */\n static identity?: string;\n /** shadcn `data-slot` value. Most-derived wins; never overrides the author. */\n static slotName?: string;\n /** Default ARIA role, set through ElementInternals (author attribute wins). */\n static role?: string;\n\n /**\n * `true` on kit composites (`src/kit/`): the element renders its entire\n * subtree from properties, so author-written children are a mistake (use the\n * `pont2-prim-*` form for custom content). Reported once in development.\n */\n static composite = false;\n\n /**\n * A **part**: this element's identity, `data-slot` and default role as plain\n * attributes, for a template to put on a native element.\n *\n * ```ts\n * html`<div ${AlertTitle.part()}>${this.heading}</div>`\n * // → <div data-pont2-alert-title data-slot=\"alert-title\">…</div>\n * ```\n *\n * The result is styled by the element's recipe and found by `sel()` lookups,\n * exactly like the element itself, so a composite reproduces shadcn's DOM\n * without nesting custom elements. A part carries **attributes only**: use\n * it for Tier 1 elements whose host adds nothing but identity, slot and role.\n * An element with behaviour (state, observers, keyboard, form association)\n * has to be rendered as the element. `extra` adds or overrides attributes.\n */\n static part(extra: AttrMap = {}): DirectiveResult {\n const map: AttrMap = {};\n for (const id of identitiesOf(this)) map[identityAttr(id)] = true;\n if (this.slotName) map[\"data-slot\"] = this.slotName;\n if (this.role) map.role = this.role;\n return attrs({ ...map, ...extra });\n }\n\n protected readonly internals: ElementInternals = this.attachInternals();\n\n protected override createRenderRoot(): HTMLElement {\n return this;\n }\n\n /**\n * Elements that do not override `render()` (most Tier 1 hosts) skip Lit's\n * template rendering entirely. Otherwise lit-html would append a `<!---->`\n * part marker to the author's children: a stray node in a component whose\n * whole point is to add none, and one more node for React to step around.\n */\n protected override update(changed: PropertyValues): void {\n if (this.render === HostElement.prototype.render) {\n ReactiveElement.prototype[\"update\"].call(this, changed);\n return;\n }\n super.update(changed);\n }\n\n override connectedCallback(): void {\n const ctor = this.constructor as typeof HostElement;\n if (ctor.composite && !this.hasUpdated && import.meta.env?.DEV) warnAuthorChildren(this);\n super.connectedCallback();\n\n // Attributes may not be added in a custom element constructor (it would\n // make document.createElement() throw), so identity is stamped on connect.\n for (const id of identitiesOf(ctor)) {\n if (!this.hasAttribute(`data-${PREFIX}-${id}`)) {\n this.setAttribute(`data-${PREFIX}-${id}`, \"\");\n }\n }\n if (ctor.slotName && !this.hasAttribute(\"data-slot\")) {\n this.setAttribute(\"data-slot\", ctor.slotName);\n }\n if (ctor.role && !this.internals.role) this.internals.role = ctor.role;\n }\n\n /**\n * Sets `data-<name>`: a string value, `true` → empty (presence) attribute,\n * `false`/`null`/`undefined` → removed. Base UI exposes state as presence\n * attributes (`data-checked`, `data-disabled`, `data-open`), which is what\n * shadcn's Base UI styles select on, so `true`/`false` is the common call.\n */\n protected setData(name: string, value: string | boolean | null | undefined): void {\n const attr = `data-${name}`;\n if (value === false || value == null) {\n if (this.hasAttribute(attr)) this.removeAttribute(attr);\n } else {\n const v = value === true ? \"\" : value;\n if (this.getAttribute(attr) !== v) this.setAttribute(attr, v);\n }\n }\n\n /** Adds or removes a custom state, matchable in CSS as `:state(<name>)`. */\n protected setState(name: string, on: boolean): void {\n try {\n if (on) this.internals.states.add(name);\n else this.internals.states.delete(name);\n } catch {\n // Very old engines only accepted `--name`; state is a nicety, never load-bearing.\n }\n }\n}\n\nfunction warnAuthorChildren(el: HTMLElement): void {\n const authored = Array.from(el.childNodes).some(\n n => n.nodeType === Node.ELEMENT_NODE || (n.nodeType === Node.TEXT_NODE && n.textContent!.trim() !== \"\"),\n );\n if (authored) {\n console.warn(\n `[pont2] <${el.localName}> is a composite: it renders its content from properties and ignores children. ` +\n `For custom content, write the primitive form instead (the pont2-prim-* elements it is built from).`,\n el,\n );\n }\n}\n\n/** Every `identity` declared along the prototype chain, most-derived first. */\nexport function identitiesOf(ctor: typeof HostElement): string[] {\n const out: string[] = [];\n let c: unknown = ctor;\n while (typeof c === \"function\" && c !== HostElement && c !== LitElement) {\n const k = c as typeof HostElement;\n if (Object.hasOwn(k, \"identity\") && k.identity) out.push(k.identity);\n c = Object.getPrototypeOf(c);\n }\n return out;\n}\n\n/**\n * # ShellElement: Tier 3 (native-bound) host\n *\n * Some shadcn roots must stay *native* elements: `<button>`, `<a>`, `<input>`,\n * `<textarea>`, `<label>`, `<select>`, `<table>`, `<fieldset>`. Their behaviour\n * (implicit form submission, `SubmitEvent.submitter`, autofill, password\n * managers, real links, `for=` labelling, table parsing) cannot be emulated\n * faithfully by a custom element.\n *\n * For those, the host is a **transparent shell**: `display: contents`\n * (`[data-pont2-shell]` in styles/base.css), no role, no styles, no box. It\n * exists only so HTML authors have a tag. Everything styled or announced lives\n * on the one native element inside it. Two nodes is the platform floor for\n * native semantics, and composition never adds a third.\n *\n * Never style a shell, give it a role, or anchor positioning to it. Use\n * `control` (the native element) instead.\n */\nexport abstract class ShellElement extends HostElement {\n static override identity = \"shell\";\n\n /** The single native element this shell stands for. */\n abstract get control(): HTMLElement | null;\n\n override focus(options?: FocusOptions): void {\n this.control?.focus(options);\n }\n\n override blur(): void {\n this.control?.blur();\n }\n}\n\n/**\n * # NativeEnhancer: Tier 3 element form (\"asChild\")\n *\n * `<pont2-prim-button variant=\"outline\"><button>Save</button></pont2-prim-button>`\n *\n * The author writes the native element; the shell applies the recipe to it\n * (attributes only). The native node is never moved, wrapped or re-created,\n * so React, a parent Lit template or server HTML keep owning it. A\n * MutationObserver re-applies the recipe if the child is swapped.\n *\n * This is shadcn's `asChild` / Base UI's `render` prop, expressed in HTML.\n */\nexport abstract class NativeEnhancer<T extends HTMLElement = HTMLElement> extends ShellElement {\n /** Selector for the native child this enhancer applies its recipe to. */\n static nativeSelector = \"*\";\n\n private _observer?: MutationObserver;\n private _warned = false;\n\n override get control(): T | null {\n const sel = (this.constructor as typeof NativeEnhancer).nativeSelector;\n for (const child of Array.from(this.children)) {\n if (child.matches(sel)) return child as T;\n }\n return null;\n }\n\n /** Apply the recipe (attributes / properties) to the native element. */\n protected abstract apply(control: T): void;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._observer ??= new MutationObserver(() => this.requestUpdate());\n this._observer.observe(this, { childList: true });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._observer?.disconnect();\n }\n\n protected override updated(): void {\n const el = this.control;\n if (el) {\n this.apply(el);\n return;\n }\n if (!this._warned && this.isConnected && this.childNodes.length) {\n this._warned = true;\n const sel = (this.constructor as typeof NativeEnhancer).nativeSelector;\n console.warn(\n `<${this.localName}> enhances a native child element (${sel}) and found none. ` +\n `Write <${this.localName}><${sel.split(\",\")[0].trim()}>…</…></${this.localName}>, ` +\n `or use the recipe attributes on the native element directly.`,\n this,\n );\n }\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { HostElement } from \"./host-element\";\n\nexport interface ValidityResult {\n flags: ValidityStateFlags;\n message: string;\n}\n\n/**\n * # FormControlElement: Tier 2 form-associated widget\n *\n * The base for widgets whose host is an ARIA widget root *and* a form control\n * (Checkbox, Switch, RadioGroup, Slider, Select, Combobox, InputOTP …). It is\n * a **form-associated custom element** (FACE), so with no hidden `<input>`:\n *\n * - it submits `name=value` with its `<form>` (`internals.setFormValue`);\n * - it takes part in constraint validation (`setValidity`, `:invalid`,\n * `checkValidity()`, `reportValidity()`, blocking submit when `required`);\n * - it is disabled by `disabled`, by an ancestor `<fieldset disabled>` and by\n * its form, through `formDisabledCallback`;\n * - it resets with its form (`formResetCallback`) and restores on\n * back/forward navigation (`formStateRestoreCallback`);\n * - it is labelable: `<label for>` and wrapping labels work, and `labels`\n * lists them;\n * - the `form=\"id\"` content attribute works natively.\n *\n * Base UI renders a visually hidden `<input>` next to each such widget to get\n * the same effect in React. A FACE makes that node unnecessary, which is\n * one node fewer than shadcn/Base UI.\n *\n * Subclasses implement `formValue()`, `resetToDefault()` and optionally\n * `validate()`; the base syncs internals/data attributes after every update.\n */\nexport abstract class FormControlElement extends HostElement {\n static formAssociated = true;\n\n static override properties: PropertyDeclarations = {\n name: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n required: { type: Boolean, reflect: true },\n readOnly: { type: Boolean, reflect: true, attribute: \"readonly\" },\n formDisabled: { state: true },\n };\n\n declare name: string;\n declare disabled: boolean;\n declare required: boolean;\n declare readOnly: boolean;\n /** Disabled by an ancestor `<fieldset disabled>` or the form. */\n declare protected formDisabled: boolean;\n\n private _customMessage = \"\";\n\n constructor() {\n super();\n this.name = \"\";\n this.disabled = false;\n this.required = false;\n this.readOnly = false;\n this.formDisabled = false;\n }\n\n /* -------------------------------------------------------------- */\n /* Subclass contract */\n /* -------------------------------------------------------------- */\n\n /** What the control submits. `null` submits nothing (an unchecked checkbox). */\n protected abstract formValue(): string | File | FormData | null;\n\n /** Restore the default value (the one in the markup). */\n protected abstract resetToDefault(): void;\n\n /** Built-in constraint check. Return `null` when valid. */\n protected validate(): ValidityResult | null {\n return null;\n }\n\n /** Whether the host itself is a tab stop. Composite widgets with an inner roving tab stop return false. */\n protected get hostFocusable(): boolean {\n return true;\n }\n\n /** Element `reportValidity()` should point at (must be inside the host). */\n protected get validationAnchor(): HTMLElement | undefined {\n return undefined;\n }\n\n /* -------------------------------------------------------------- */\n /* Public form API (mirrors native controls) */\n /* -------------------------------------------------------------- */\n\n get form(): HTMLFormElement | null {\n return this.internals.form;\n }\n get labels(): NodeList {\n return this.internals.labels;\n }\n get validity(): ValidityState {\n return this.internals.validity;\n }\n get validationMessage(): string {\n return this.internals.validationMessage;\n }\n get willValidate(): boolean {\n return this.internals.willValidate;\n }\n /** `disabled` or disabled by a fieldset/form. */\n get isDisabled(): boolean {\n return this.disabled || this.formDisabled;\n }\n checkValidity(): boolean {\n return this.internals.checkValidity();\n }\n reportValidity(): boolean {\n return this.internals.reportValidity();\n }\n setCustomValidity(message: string): void {\n this._customMessage = message;\n this.syncValidity();\n }\n\n /* -------------------------------------------------------------- */\n /* FACE lifecycle */\n /* -------------------------------------------------------------- */\n\n formResetCallback(): void {\n this.resetToDefault();\n }\n\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n\n formStateRestoreCallback(state: string | File | FormData | null): void {\n this.restoreState(state);\n }\n\n /** Override to restore from the value `formValue()` produced. */\n protected restoreState(_state: string | File | FormData | null): void {}\n\n /* -------------------------------------------------------------- */\n /* Sync */\n /* -------------------------------------------------------------- */\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n const disabled = this.isDisabled;\n\n this.internals.ariaDisabled = disabled ? \"true\" : null;\n this.internals.ariaRequired = this.required ? \"true\" : null;\n this.internals.ariaReadOnly = this.readOnly ? \"true\" : null;\n this.setData(\"disabled\", disabled);\n this.setData(\"required\", this.required);\n this.setData(\"readonly\", this.readOnly);\n\n if (this.hostFocusable) {\n if (disabled) this.removeAttribute(\"tabindex\");\n else if (!this.hasAttribute(\"tabindex\")) this.tabIndex = 0;\n }\n\n this.internals.setFormValue(this.formValue());\n this.syncValidity();\n }\n\n protected syncValidity(): void {\n const own = this.validate();\n if (this._customMessage) {\n this.internals.setValidity({ customError: true }, this._customMessage, this.validationAnchor);\n } else if (own) {\n this.internals.setValidity(own.flags, own.message, this.validationAnchor);\n } else {\n this.internals.setValidity({});\n }\n }\n}\n","import { ContextConsumer, createContext } from \"@lit/context\";\nimport type { ReactiveElement } from \"lit\";\n\n/**\n * # Design mode: the element is on the screen designer's canvas\n *\n * Resolution (turning an app's providers into buttons, narrowing identifiers,\n * injecting the brand logo) happens at serve time, on the server. The designer\n * has no app to resolve against, so an element placed there in its normal,\n * bare authored form would render its empty state: an empty provider grid, a\n * broken logo. That isn't neutral; it tells the author the element is broken.\n *\n * In design mode an element renders a **representative example** of itself\n * instead (pontive-spec 17 §1). It must not prune itself, inject real\n * configuration, or substitute `{{placeholders}}` (pont2 never does). Ported\n * from the legacy `designModeContext` (migration tracker F-32).\n *\n * `pont2-layout` provides it (`design-mode`), which is how the dashboard's\n * widget builder drives it. Its key is `pont2:design-mode`.\n *\n * Design mode is an authoring signal only: it never touches the branding\n * entitlement (the watermark), which has no override at all.\n */\nexport const designModeContext = createContext<boolean>(\"pont2:design-mode\");\n\n/**\n * Reads design mode for one element. An explicit `design-mode` attribute on the\n * element wins (`design-mode` or `design-mode=\"true\"` on; `design-mode=\"false\"`\n * off), so a story or a standalone demo can show the design rendering without a\n * layout. Otherwise the nearest provider decides.\n */\nexport class DesignModeController {\n private consumer: ContextConsumer<typeof designModeContext, ReactiveElement>;\n\n constructor(private readonly host: ReactiveElement) {\n this.consumer = new ContextConsumer(host, { context: designModeContext, subscribe: true });\n }\n\n /** Whether the element should render its design-mode example. */\n get active(): boolean {\n if (this.host.hasAttribute(\"design-mode\")) return this.host.getAttribute(\"design-mode\") !== \"false\";\n return this.consumer.value ?? false;\n }\n}\n","let counter = 0;\n\n/** A document-unique id, e.g. `pont2-field-3`. Like React's `useId()`. */\nexport function uid(scope = \"id\"): string {\n counter += 1;\n return `pont2-${scope}-${counter}`;\n}\n\n/** Returns `el.id`, assigning a fresh `uid(scope)` first if it has none. */\nexport function ensureId(el: Element, scope = \"id\"): string {\n if (!el.id) el.id = uid(scope);\n return el.id;\n}\n\n/** Adds/removes an id in a space-separated IDREF list attribute (aria-describedby etc.). */\nexport function toggleIdRef(el: Element, attr: string, id: string, on: boolean): void {\n const ids = new Set((el.getAttribute(attr) ?? \"\").split(/\\s+/).filter(Boolean));\n if (on) ids.add(id);\n else ids.delete(id);\n if (ids.size) el.setAttribute(attr, [...ids].join(\" \"));\n else el.removeAttribute(attr);\n}\n","/**\n * Event conventions (docs/02-conventions.md, \"Events\"):\n *\n * - Value-holding widgets fire the platform's own `input` (while the value\n * changes through interaction) and `change` (when it is committed), both\n * bubbling, exactly like native controls. The new value is read from the\n * target (`e.target.checked`, `e.target.value`), so `@change=${…}` in Lit,\n * `onChange` via @lit/react and `addEventListener(\"change\")` all work.\n * - Anything without a native equivalent is a `pont2-<name>` CustomEvent with\n * a typed `detail`, bubbling and composed. Base UI's `onOpenChange(open,\n * details)` becomes `pont2-open-change` with `{ open, reason }`; it is\n * cancelable, and `preventDefault()` keeps the current state (Base UI's\n * `eventDetails.cancel()`).\n * - Events fire only for user-initiated changes, never for property writes,\n * matching native controls (and Base UI's controlled props).\n */\nexport function fireNative(target: EventTarget, type: \"input\" | \"change\"): void {\n target.dispatchEvent(new Event(type, { bubbles: true, composed: type === \"input\" }));\n}\n\nexport function fire<T>(target: EventTarget, type: `pont2-${string}`, detail: T, cancelable = false): boolean {\n return target.dispatchEvent(new CustomEvent<T>(type, { detail, bubbles: true, composed: true, cancelable }));\n}\n\nexport type OpenChangeReason =\n | \"trigger-press\"\n | \"trigger-hover\"\n | \"trigger-focus\"\n | \"outside-press\"\n | \"escape-key\"\n | \"item-press\"\n | \"list-navigation\"\n | \"input-change\"\n | \"focus-out\"\n | \"imperative\";\n\nexport interface OpenChangeDetail {\n open: boolean;\n reason: OpenChangeReason;\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n \"pont2-open-change\": CustomEvent<OpenChangeDetail>;\n }\n}\n","import { html, svg, type SVGTemplateResult, type TemplateResult } from \"lit\";\n\nimport { attrs, type AttrMap } from \"./attrs\";\n\n/**\n * The handful of icons primitives draw themselves (check marks, chevrons,\n * the spinner). shadcn renders these with lucide-react through an\n * `IconPlaceholder`; pont2 inlines the same lucide geometry so it has no icon\n * dependency. Lucide is ISC-licensed (https://lucide.dev/license).\n *\n * Every icon is `aria-hidden` and sized by the component's CSS, as in shadcn\n * (`[&_svg:not([class*='size-'])]:size-4`). Consumers can pass their own SVG\n * anywhere an icon is accepted.\n *\n * Each icon takes optional extra attributes for the `<svg>` itself, e.g.\n * shadcn's button icon marker: `icons.arrowRight({ \"data-icon\": \"inline-end\" })`.\n */\nconst icon = (name: string, body: SVGTemplateResult, extra: AttrMap = {}) => html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n data-icon-name=${name}\n ${attrs(extra)}\n>${body}</svg>`;\n\n// Bodies use Lit's `svg` tag: a nested template is parsed on its own, so an\n// `html` fragment would create <path> in the HTML namespace and draw nothing.\nexport const icons = {\n check: (a?: AttrMap) => icon(\"check\", svg`<path d=\"M20 6 9 17l-5-5\" />`, a),\n minus: (a?: AttrMap) => icon(\"minus\", svg`<path d=\"M5 12h14\" />`, a),\n x: (a?: AttrMap) => icon(\"x\", svg`<path d=\"M18 6 6 18\" /><path d=\"m6 6 12 12\" />`, a),\n chevronDown: (a?: AttrMap) => icon(\"chevron-down\", svg`<path d=\"m6 9 6 6 6-6\" />`, a),\n chevronUp: (a?: AttrMap) => icon(\"chevron-up\", svg`<path d=\"m18 15-6-6-6 6\" />`, a),\n chevronRight: (a?: AttrMap) => icon(\"chevron-right\", svg`<path d=\"m9 18 6-6-6-6\" />`, a),\n chevronLeft: (a?: AttrMap) => icon(\"chevron-left\", svg`<path d=\"m15 18-6-6 6-6\" />`, a),\n chevronsUpDown: (a?: AttrMap) =>\n icon(\"chevrons-up-down\", svg`<path d=\"m7 15 5 5 5-5\" /><path d=\"m7 9 5-5 5 5\" />`, a),\n search: (a?: AttrMap) => icon(\"search\", svg`<path d=\"m21 21-4.34-4.34\" /><circle cx=\"11\" cy=\"11\" r=\"8\" />`, a),\n circle: (a?: AttrMap) => icon(\"circle\", svg`<circle cx=\"12\" cy=\"12\" r=\"10\" />`, a),\n loaderCircle: (a?: AttrMap) => icon(\"loader-circle\", svg`<path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />`, a),\n circleAlert: (a?: AttrMap) =>\n icon(\n \"circle-alert\",\n svg`<circle cx=\"12\" cy=\"12\" r=\"10\" /><line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" /><line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />`,\n a,\n ),\n circleX: (a?: AttrMap) =>\n icon(\"circle-x\", svg`<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m15 9-6 6\" /><path d=\"m9 9 6 6\" />`, a),\n circleCheck: (a?: AttrMap) =>\n icon(\"circle-check\", svg`<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m9 12 2 2 4-4\" />`, a),\n triangleAlert: (a?: AttrMap) =>\n icon(\n \"triangle-alert\",\n svg`<path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" /><path d=\"M12 9v4\" /><path d=\"M12 17h.01\" />`,\n a,\n ),\n info: (a?: AttrMap) =>\n icon(\"info\", svg`<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"M12 16v-4\" /><path d=\"M12 8h.01\" />`, a),\n eye: (a?: AttrMap) =>\n icon(\n \"eye\",\n svg`<path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" /><circle cx=\"12\" cy=\"12\" r=\"3\" />`,\n a,\n ),\n eyeOff: (a?: AttrMap) =>\n icon(\n \"eye-off\",\n svg`<path d=\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\" /><path d=\"M14.084 14.158a3 3 0 0 1-4.242-4.242\" /><path d=\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\" /><path d=\"m2 2 20 20\" />`,\n a,\n ),\n pencil: (a?: AttrMap) =>\n icon(\n \"pencil\",\n svg`<path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" /><path d=\"m15 5 4 4\" />`,\n a,\n ),\n copy: (a?: AttrMap) =>\n icon(\n \"copy\",\n svg`<rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" /><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />`,\n a,\n ),\n download: (a?: AttrMap) =>\n icon(\n \"download\",\n svg`<path d=\"M12 15V3\" /><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" /><path d=\"m7 10 5 5 5-5\" />`,\n a,\n ),\n arrowRight: (a?: AttrMap) => icon(\"arrow-right\", svg`<path d=\"M5 12h14\" /><path d=\"m12 5 7 7-7 7\" />`, a),\n userRoundKey: (a?: AttrMap) =>\n icon(\n \"user-round-key\",\n svg`<path d=\"M19 11v6\" /><path d=\"M19 13h2\" /><path d=\"M2 21a8 8 0 0 1 12.868-6.349\" /><circle cx=\"10\" cy=\"8\" r=\"5\" /><circle cx=\"19\" cy=\"19\" r=\"2\" />`,\n a,\n ),\n} satisfies Record<string, (a?: AttrMap) => TemplateResult>;\n\nexport type IconName = keyof typeof icons;\n","import type { ReactiveController, ReactiveControllerHost } from \"lit\";\n\n/**\n * # The kit's own words: a message table (decision D8 of the migration plan)\n *\n * Text no render spec carries, which a kit element writes itself: a connection\n * error, \"Start again\", the password toggle's and the spinner's labels. The\n * sign-in runtime sends it with every flow response, already in the flow's\n * language and the instance's wording (branding-svc `pkg/message`, the codes\n * marked Client; the SDK exposes them as `messages` on start results and flow\n * events). Whatever receives a set calls `setMessages`, and every place that\n * would write English reads `msg(code)` instead.\n *\n * English is the fallback. It is only needed before the page has heard from the\n * server, for example when a flow fails to start because the network is down.\n * Once a set has arrived it is kept, so a later failure that never reaches the\n * server is still worded in the page's language.\n *\n * The table is **page-wide**, as in the legacy kit (`src/i18n/messages.ts`,\n * ported, carry-over §2): every widget on a page speaks the same language, and\n * a set one widget receives (or a stopped instance's refusal, §6) applies to all.\n * Elements that render `msg()` add a `MessagesController`, so text that arrives\n * after they first rendered reaches them.\n *\n * The account widgets' codes (carry-over §3) join this table when they are\n * built (migration tracker I-2, W-7…W-10).\n */\n\nexport const KIT_MESSAGES_EN = {\n connection_failed: \"We couldn't reach the server. Check your connection and try again.\",\n too_many_attempts: \"Too many attempts. Try again later.\",\n server_error: \"Something went wrong on our side. Please try again.\",\n instance_unavailable: \"This app isn't available right now.\",\n generic_error: \"Something went wrong. Please try again.\",\n flow_ended: \"This sign-in could not be completed.\",\n passkey_cancelled: \"The passkey request was cancelled or timed out. Please try again.\",\n start_again: \"Start again\",\n continued_elsewhere_title: \"You continued in another tab\",\n continued_elsewhere_subtitle: \"You can close this one.\",\n continue_here: \"Continue here instead\",\n show_password: \"Show password\",\n hide_password: \"Hide password\",\n loading: \"Loading\",\n} as const;\n\nexport type KitMessageCode = keyof typeof KIT_MESSAGES_EN;\n\nlet current: Partial<Record<string, string>> = {};\nlet currentLocaleTag: string | undefined;\nconst listeners = new Set<() => void>();\n\n/**\n * Records a set the server sent. Sets merge (a flow response and, later, the\n * widget-messages read carry different codes for the same language). An empty or\n * missing set changes nothing: a response without one says nothing about the\n * language having changed.\n */\nexport function setMessages(messages?: Record<string, string> | null, locale?: string): void {\n if (!messages || Object.keys(messages).length === 0) return;\n current = { ...current, ...messages };\n if (locale) currentLocaleTag = locale;\n listeners.forEach(listener => listener());\n}\n\n/**\n * The text for a code in the language the page was last served in. A code\n * outside the kit's table needs a `fallback`; without one, the code itself is\n * returned (visible, rather than an empty string).\n */\nexport function msg(code: KitMessageCode): string;\nexport function msg(code: string, fallback: string): string;\nexport function msg(code: string, fallback?: string): string {\n const text = current[code]?.trim();\n return text || fallback || (KIT_MESSAGES_EN as Record<string, string>)[code] || code;\n}\n\n/** The language the page was last served in, for formatting; undefined until the server has said. */\nexport function currentLocale(): string | undefined {\n return currentLocaleTag;\n}\n\n/** Calls `listener` whenever a set arrives. Returns the unsubscribe. */\nexport function onMessagesChanged(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\n/** Forgets every set. For tests and stories. */\nexport function resetMessages(): void {\n current = {};\n currentLocaleTag = undefined;\n listeners.forEach(listener => listener());\n}\n\n/** Re-renders its host whenever a set arrives. Add it to every element that renders `msg()`. */\nexport class MessagesController implements ReactiveController {\n private unsubscribe?: () => void;\n\n constructor(private readonly host: ReactiveControllerHost) {\n host.addController(this);\n }\n\n hostConnected(): void {\n this.unsubscribe = onMessagesChanged(() => this.host.requestUpdate());\n }\n\n hostDisconnected(): void {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n }\n}\n","/**\n * URLs a kit element may navigate to or link to.\n *\n * Render specs and attributes are data, so an `href` or a redirect target can\n * be anything, including `javascript:` or `data:`. Every element that turns\n * one into navigation (`pont2-link[href]`, `pont2-countdown[redirect-url]`)\n * goes through `safeUrl` and treats `null` as \"don't navigate\".\n */\n\n/** Resolves `raw` against `base` (the page) and accepts only http(s); otherwise `null`. */\nexport function safeUrl(raw: string | null | undefined, base = globalThis.location?.href): string | null {\n if (!raw) return null;\n try {\n const url = new URL(raw, base);\n return url.protocol === \"http:\" || url.protocol === \"https:\" ? url.href : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Stricter than `safeUrl`: an **absolute** http(s) URL with a host, or `null`.\n * For links to pages outside the flow (`pont2-external-link`), whose href is\n * usually a server placeholder filled from the app's settings\n * (`{{consent_privacy_policy_url}}`): empty, still a placeholder, relative or\n * a code-running scheme must not become a link. The legacy\n * `safeExternalHref`, ported.\n */\nexport function safeExternalUrl(raw: unknown): string | null {\n if (typeof raw !== \"string\") return null;\n const value = raw.trim();\n if (!value) return null;\n let url: URL;\n try {\n url = new URL(value);\n } catch {\n return null;\n }\n if (url.protocol !== \"https:\" && url.protocol !== \"http:\") return null;\n return url.hostname ? url.href : null;\n}\n","import type { ReactiveController, ReactiveControllerHost } from \"lit\";\n\nexport type Orientation = \"horizontal\" | \"vertical\" | \"both\";\n\nexport interface RovingFocusOptions {\n /** Candidate items, in DOM order. Called on every key press, so it may query live. */\n items: () => HTMLElement[];\n orientation?: () => Orientation;\n /** Wrap from last to first (Base UI `loopFocus`, default true). */\n loop?: () => boolean;\n /** Items to skip. Default: `[data-disabled]` / `aria-disabled=\"true\"` / `:disabled`. */\n isDisabled?: (item: HTMLElement) => boolean;\n /** Called after focus moves through the keyboard (radio/tabs use it to activate). */\n onNavigate?: (item: HTMLElement, event: KeyboardEvent) => void;\n}\n\n/** `ltr` unless the nearest `[dir]` ancestor (or the document) says `rtl`. */\nexport function directionOf(el: Element): \"ltr\" | \"rtl\" {\n const owner = el.closest(\"[dir]\");\n const dir = (owner?.getAttribute(\"dir\") ?? document.documentElement.dir ?? \"\").toLowerCase();\n return dir === \"rtl\" ? \"rtl\" : \"ltr\";\n}\n\nconst defaultDisabled = (el: HTMLElement) =>\n el.hasAttribute(\"data-disabled\") ||\n el.getAttribute(\"aria-disabled\") === \"true\" ||\n (el as HTMLButtonElement).disabled === true;\n\n/**\n * Roving tabindex (WAI-ARIA APG \"managing focus within composites\"): exactly\n * one item is a tab stop (`tabindex=\"0\"`), the rest are `-1`, and arrow keys,\n * Home and End move focus between them. Used by RadioGroup, Tabs, ToggleGroup\n * and menus, which is what Base UI's `CompositeRoot` does internally.\n *\n * The host calls `sync(active)` whenever the \"current\" item may have\n * changed (selection, items added or removed).\n */\nexport class RovingFocusController implements ReactiveController {\n private readonly opts: Required<Omit<RovingFocusOptions, \"onNavigate\">> &\n Pick<RovingFocusOptions, \"onNavigate\">;\n\n constructor(\n private readonly host: ReactiveControllerHost & HTMLElement,\n options: RovingFocusOptions,\n ) {\n this.opts = {\n orientation: () => \"both\",\n loop: () => true,\n isDisabled: defaultDisabled,\n ...options,\n };\n host.addController(this);\n }\n\n hostConnected(): void {\n this.host.addEventListener(\"keydown\", this.onKeyDown);\n this.host.addEventListener(\"focusin\", this.onFocusIn);\n }\n\n hostDisconnected(): void {\n this.host.removeEventListener(\"keydown\", this.onKeyDown);\n this.host.removeEventListener(\"focusin\", this.onFocusIn);\n }\n\n /** Make `active` (or the first enabled item) the single tab stop. */\n sync(active?: HTMLElement | null): void {\n const items = this.opts.items();\n const enabled = items.filter(i => !this.opts.isDisabled(i));\n const stop = active && enabled.includes(active) ? active : enabled[0];\n for (const item of items) item.tabIndex = item === stop ? 0 : -1;\n }\n\n /** Focus an item and make it the tab stop. */\n focus(item: HTMLElement, options?: FocusOptions): void {\n this.sync(item);\n item.focus(options);\n }\n\n private onFocusIn = (e: FocusEvent) => {\n const items = this.opts.items();\n const item = items.find(i => i === e.target || i.contains(e.target as Node));\n if (item && !this.opts.isDisabled(item)) this.sync(item);\n };\n\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) return;\n const items = this.opts.items();\n const current = items.findIndex(i => i === e.target || i.contains(e.target as Node));\n if (current < 0) return;\n\n const orientation = this.opts.orientation();\n const rtl = directionOf(this.host) === \"rtl\";\n const horizontal = orientation !== \"vertical\";\n const vertical = orientation !== \"horizontal\";\n\n let step: 1 | -1 | \"first\" | \"last\" | 0 = 0;\n switch (e.key) {\n case \"ArrowRight\":\n if (horizontal) step = rtl ? -1 : 1;\n break;\n case \"ArrowLeft\":\n if (horizontal) step = rtl ? 1 : -1;\n break;\n case \"ArrowDown\":\n if (vertical) step = 1;\n break;\n case \"ArrowUp\":\n if (vertical) step = -1;\n break;\n case \"Home\":\n step = \"first\";\n break;\n case \"End\":\n step = \"last\";\n break;\n }\n if (step === 0) return;\n\n const next = this.findNext(items, current, step);\n if (!next) return;\n e.preventDefault();\n this.focus(next);\n this.opts.onNavigate?.(next, e);\n };\n\n private findNext(items: HTMLElement[], from: number, step: 1 | -1 | \"first\" | \"last\") {\n const ok = (i: HTMLElement) => !this.opts.isDisabled(i);\n if (step === \"first\") return items.find(ok);\n if (step === \"last\") return [...items].reverse().find(ok);\n\n const n = items.length;\n const loop = this.opts.loop();\n for (let k = 1; k <= n; k++) {\n let i = from + step * k;\n if (loop) i = (i + n) % n;\n else if (i < 0 || i >= n) return undefined;\n if (ok(items[i])) return items[i];\n }\n return undefined;\n }\n}\n","import type { ReactiveController, ReactiveControllerHost } from \"lit\";\n\nimport { fire } from \"../events\";\n\n/**\n * # The action protocol: `pont2-action` + `respondWith()`\n *\n * Some elements start asynchronous work they must not own: a sign-in button\n * starts a login-flow step, but the network call, the session and the next\n * screen belong to whatever hosts the flow (a widget, a layout, the app).\n * The element asks; an ancestor answers.\n *\n * ```\n * element ── pont2-action { action, data, respondWith } ──▶ ancestor (bubbles, composed)\n * ancestor calls detail.respondWith(promise)\n * element: busy until the promise settles\n * element ── pont2-action-success { action, data, result } ──▶\n * or pont2-action-error { action, data, error, message } ──▶\n * ```\n *\n * `respondWith()` must be called **synchronously, inside the listener** (as in\n * a service worker's `FetchEvent`). That is deliberate: the dispatch happens\n * inside the user's click, so work started in the listener still has the\n * click's *transient user activation*, which WebAuthn (passkeys) and\n * `window.open` (OAuth popups) require. Starting the work after an `await`\n * would lose it.\n *\n * ```ts\n * widget.addEventListener(\"pont2-action\", e => {\n * if (e.detail.action) e.detail.respondWith(Auth.processLoginflowEvent({ event: e.detail.action }));\n * });\n * ```\n *\n * Nobody responding is valid: the request event doubles as a click\n * notification (the legacy kit's `<tag>:click`), and an element may then fall\n * back to native behaviour (a submit button lets its form submit).\n *\n * Why an event and not an import: pont2 depends on no auth client, any\n * framework can answer a DOM event, Storybook and tests answer with a fake,\n * and the element never needs to know who is listening (docs/kit/auth-button.md).\n */\n\nexport interface ActionRequestDetail<D = Record<string, unknown>> {\n /** What to do, e.g. a login-flow event id. May be absent (a plain click notification). */\n action: string | undefined;\n /** Context from the element (the provider, the form data…). */\n data: D;\n /** Hand the element the work's promise. Only valid during dispatch, at most once. */\n respondWith(response: unknown): void;\n}\n\nexport interface ActionSuccessDetail<D = Record<string, unknown>> {\n action: string | undefined;\n data: D;\n result: unknown;\n}\n\nexport interface ActionErrorDetail<D = Record<string, unknown>> {\n action: string | undefined;\n data: D;\n error: unknown;\n message: string;\n}\n\nexport class ActionController implements ReactiveController {\n /** True while a response is pending. The host re-renders when it changes. */\n busy = false;\n\n constructor(private host: ReactiveControllerHost & HTMLElement) {\n host.addController(this);\n }\n\n hostConnected(): void {}\n\n /**\n * Fires `pont2-action` from the host. Returns `true` if a listener called\n * `respondWith()` (the element is now busy), `false` otherwise or when\n * already busy (one request at a time).\n */\n request<D extends Record<string, unknown>>(action: string | undefined, data: D): boolean {\n if (this.busy) return false;\n let response: Promise<unknown> | undefined;\n let open = true;\n const detail: ActionRequestDetail<D> = {\n action,\n data,\n respondWith: value => {\n if (!open) throw new DOMException(\"respondWith() must be called synchronously in the listener.\", \"InvalidStateError\");\n if (response) throw new DOMException(\"respondWith() was already called.\", \"InvalidStateError\");\n response = Promise.resolve(value);\n },\n };\n fire(this.host, \"pont2-action\", detail);\n open = false;\n if (!response) return false;\n void this.track(action, data, response);\n return true;\n }\n\n private async track<D>(action: string | undefined, data: D, response: Promise<unknown>): Promise<void> {\n this.setBusy(true);\n try {\n const result = await response;\n fire<ActionSuccessDetail<D>>(this.host, \"pont2-action-success\", { action, data, result });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n fire<ActionErrorDetail<D>>(this.host, \"pont2-action-error\", { action, data, error, message });\n } finally {\n this.setBusy(false);\n }\n }\n\n private setBusy(on: boolean): void {\n this.busy = on;\n this.host.requestUpdate();\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n \"pont2-action\": CustomEvent<ActionRequestDetail>;\n \"pont2-action-success\": CustomEvent<ActionSuccessDetail>;\n \"pont2-action-error\": CustomEvent<ActionErrorDetail>;\n }\n}\n","import type { ReactiveController, ReactiveControllerHost } from \"lit\";\n\nimport { fire } from \"../events\";\n\nexport interface CopiedDetail {\n /** What was copied, e.g. \"secret\", \"recovery-codes\". Never the copied text. */\n kind: string;\n}\n\nexport interface CopyErrorDetail {\n kind: string;\n error: unknown;\n}\n\n/**\n * Copy-to-clipboard with transient \"copied\" feedback.\n *\n * `copy(text)` writes to the clipboard, sets `copied` for `duration` ms (the\n * host re-renders), and fires `pont2-copied` / `pont2-copy-error`. The events\n * deliberately carry no text: what gets copied here is secret (TOTP secrets,\n * recovery codes), and events are observable by any script on the page.\n */\nexport class CopyController implements ReactiveController {\n copied = false;\n private timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor(\n private host: ReactiveControllerHost & HTMLElement,\n private kind: string,\n private duration = 2000,\n ) {\n host.addController(this);\n }\n\n hostConnected(): void {}\n\n hostDisconnected(): void {\n if (this.timer !== undefined) clearTimeout(this.timer);\n }\n\n async copy(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text);\n } catch (error) {\n fire<CopyErrorDetail>(this.host, \"pont2-copy-error\", { kind: this.kind, error });\n return false;\n }\n this.copied = true;\n this.host.requestUpdate();\n if (this.timer !== undefined) clearTimeout(this.timer);\n this.timer = setTimeout(() => {\n this.copied = false;\n this.timer = undefined;\n this.host.requestUpdate();\n }, this.duration);\n fire<CopiedDetail>(this.host, \"pont2-copied\", { kind: this.kind });\n return true;\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n \"pont2-copied\": CustomEvent<CopiedDetail>;\n \"pont2-copy-error\": CustomEvent<CopyErrorDetail>;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const BADGE_VARIANTS = [\"default\", \"secondary\", \"destructive\", \"outline\", \"ghost\", \"link\"] as const;\nexport type BadgeVariant = (typeof BADGE_VARIANTS)[number];\n\n/**\n * # Badge: Tier 1 (structural)\n *\n * shadcn: `<Badge variant>` → Base UI `useRender({ defaultTagName: \"span\" })`\n * → `<span data-slot=\"badge\" data-variant>`; with `render={<a/>}` it becomes\n * a link.\n *\n * pont2: `<pont2-prim-badge>` **is** the span. For a link badge, put the recipe on\n * a real anchor: `<a data-pont2-badge data-variant=\"outline\" href=\"…\">`.\n *\n * @tag pont2-prim-badge\n * @attr variant - default | secondary | destructive | outline | ghost | link\n */\nexport class Badge extends HostElement {\n static override identity = \"badge\";\n static override slotName = \"badge\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n\n declare variant: BadgeVariant;\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\ndefine(\"pont2-prim-badge\", Badge);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-badge\": Badge;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { NativeEnhancer, ShellElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Button: Tier 3 (native-bound)\n *\n * shadcn: `<Button variant size>` → Base UI `<Button>` → a native `<button>`\n * (or, through `render`, the author's `<a>`), with `data-slot=\"button\"`.\n *\n * A button's root must stay native: implicit form submission,\n * `SubmitEvent.submitter`, `name=value` in FormData, password-manager\n * heuristics, middle-click on links. So the styled element is always a native\n * `<button>`/`<a>`, reachable four ways that all share one recipe\n * (button.css, keyed on `[data-pont2-button]`):\n *\n * | Entry point | You write | DOM nodes |\n * |-------------|------------------------------------------------------------------|-----------|\n * | Recipe | `<button data-pont2-button data-variant=\"outline\">` | 1 |\n * | Part | `button({ variant: \"outline\" }, content)` inside a Lit template | 1 |\n * | Enhancer | `<pont2-prim-button variant=\"outline\"><button>…</button></pont2-prim-button>` | shell + 1 |\n * | Base class | `class ProviderButton extends ButtonBase` | shell + 1 |\n */\n\nexport const BUTTON_VARIANTS = [\"default\", \"outline\", \"secondary\", \"ghost\", \"destructive\", \"link\"] as const;\nexport const BUTTON_SIZES = [\"default\", \"xs\", \"sm\", \"lg\", \"icon\", \"icon-xs\", \"icon-sm\", \"icon-lg\"] as const;\nexport type ButtonVariant = (typeof BUTTON_VARIANTS)[number];\nexport type ButtonSize = (typeof BUTTON_SIZES)[number];\n\nexport interface ButtonRecipe {\n variant?: ButtonVariant;\n size?: ButtonSize;\n disabled?: boolean;\n /**\n * Base UI `focusableWhenDisabled`: stay in the tab order while disabled\n * (`aria-disabled` instead of `disabled`). Use it for loading states, so\n * focus is not lost mid-submit.\n */\n focusableWhenDisabled?: boolean;\n}\n\nexport interface ButtonOptions extends ButtonRecipe {\n type?: \"button\" | \"submit\" | \"reset\";\n name?: string;\n value?: string;\n /** Renders an `<a>` instead of a `<button>` (shadcn `render={<a/>}`). */\n href?: string;\n target?: string;\n rel?: string;\n /** Overrides `data-slot` (shadcn `<Button data-slot=\"…\">`). */\n slot?: string;\n /** Extra attributes on the same native element: the `{...props}` spread. */\n attrs?: AttrMap;\n onClick?: (e: MouseEvent) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Recipe (imperative): for code that holds a node */\n/* ------------------------------------------------------------------ */\n\nexport function applyButton(el: HTMLElement, o: ButtonRecipe): void {\n if (!el.hasAttribute(\"data-pont2-button\")) el.setAttribute(\"data-pont2-button\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", \"button\");\n el.setAttribute(\"data-variant\", o.variant ?? \"default\");\n el.setAttribute(\"data-size\", o.size ?? \"default\");\n\n const disabled = !!o.disabled;\n const native = el instanceof HTMLButtonElement;\n el.toggleAttribute(\"data-disabled\", disabled);\n\n if (native && !o.focusableWhenDisabled) {\n el.disabled = disabled;\n el.removeAttribute(\"aria-disabled\");\n } else {\n if (native) el.disabled = false;\n if (disabled) el.setAttribute(\"aria-disabled\", \"true\");\n else el.removeAttribute(\"aria-disabled\");\n // A disabled link leaves the tab order unless it should stay focusable.\n if (!native) {\n if (disabled && !o.focusableWhenDisabled) el.tabIndex = -1;\n else el.removeAttribute(\"tabindex\");\n }\n }\n}\n\n/** True when a click on `el` must be swallowed (aria-disabled buttons and links). */\nexport function isSoftDisabled(el: Element): boolean {\n return el.getAttribute(\"aria-disabled\") === \"true\" || el.hasAttribute(\"data-disabled\");\n}\n\n/* ------------------------------------------------------------------ */\n/* Part: a template function, the counterpart of a React component */\n/* ------------------------------------------------------------------ */\n\nexport function button(o: ButtonOptions, content: unknown) {\n const variant = o.variant ?? \"default\";\n const size = o.size ?? \"default\";\n const slot = o.slot ?? \"button\";\n const disabled = !!o.disabled;\n const soft = disabled && (o.focusableWhenDisabled || o.href !== undefined);\n\n const onClick = (e: MouseEvent) => {\n if (soft) {\n e.preventDefault();\n e.stopImmediatePropagation();\n return;\n }\n o.onClick?.(e);\n };\n\n if (o.href !== undefined) {\n return html`<a\n data-pont2-button\n data-slot=${slot}\n data-variant=${variant}\n data-size=${size}\n href=${o.href}\n target=${o.target ?? nothing}\n rel=${o.rel ?? nothing}\n ?data-disabled=${disabled}\n aria-disabled=${disabled ? \"true\" : nothing}\n tabindex=${disabled && !o.focusableWhenDisabled ? \"-1\" : nothing}\n ${attrs(o.attrs ?? {})}\n @click=${onClick}\n >${content}</a\n >`;\n }\n\n return html`<button\n data-pont2-button\n data-slot=${slot}\n data-variant=${variant}\n data-size=${size}\n type=${o.type ?? \"button\"}\n name=${o.name ?? nothing}\n .value=${o.value ?? \"\"}\n ?disabled=${disabled && !o.focusableWhenDisabled}\n ?data-disabled=${disabled}\n aria-disabled=${soft ? \"true\" : nothing}\n ${attrs(o.attrs ?? {})}\n @click=${onClick}\n >${content}</button>`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Shared reactive properties */\n/* ------------------------------------------------------------------ */\n\nconst recipeProperties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n focusableWhenDisabled: { type: Boolean, attribute: \"focusable-when-disabled\" },\n};\n\n/* ------------------------------------------------------------------ */\n/* Element: enhancer (asChild) */\n/* ------------------------------------------------------------------ */\n\n/**\n * `<pont2-prim-button>`: applies the button recipe to the native `<button>` or\n * `<a>` you put inside it.\n *\n * ```html\n * <pont2-prim-button variant=\"outline\"><button type=\"submit\">Continue</button></pont2-prim-button>\n * <pont2-prim-button variant=\"link\"><a href=\"/forgot\">Forgot password?</a></pont2-prim-button>\n * ```\n *\n * @tag pont2-prim-button\n * @attr variant - default | outline | secondary | ghost | destructive | link\n * @attr size - default | xs | sm | lg | icon | icon-xs | icon-sm | icon-lg\n * @attr disabled - Disables the native child (or sets aria-disabled on a link).\n * @attr focusable-when-disabled - Keep the disabled button in the tab order.\n */\nexport class Pont2Button extends NativeEnhancer<HTMLButtonElement | HTMLAnchorElement> {\n static override nativeSelector = \"button, a\";\n static override properties = recipeProperties;\n\n declare variant: ButtonVariant;\n declare size: ButtonSize;\n declare disabled: boolean;\n declare focusableWhenDisabled: boolean;\n\n constructor() {\n super();\n this.variant = \"default\";\n this.size = \"default\";\n this.disabled = false;\n this.focusableWhenDisabled = false;\n // Swallow clicks on soft-disabled controls before author listeners run.\n this.addEventListener(\"click\", this.guard, { capture: true });\n }\n\n private guard = (e: MouseEvent) => {\n const c = this.control;\n if (c && this.disabled && (c === e.target || c.contains(e.target as Node)) && isSoftDisabled(c)) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n };\n\n protected apply(control: HTMLButtonElement | HTMLAnchorElement): void {\n applyButton(control, this);\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Base class for compositions that ARE buttons */\n/* ------------------------------------------------------------------ */\n\n/**\n * Extend this when your component *is* a button whose content it generates\n * (a provider sign-in button, a submit button with a spinner). Subclasses\n * inherit `variant`/`size`/`disabled`/`type`/`href`… so nothing is forwarded\n * by hand; they implement `renderContent()` and may override\n * `buttonOptions()`. The DOM is always\n * `<host data-pont2-shell> > <button|a data-pont2-button>`.\n */\nexport abstract class ButtonBase extends ShellElement {\n static override properties: PropertyDeclarations = {\n ...recipeProperties,\n type: { type: String },\n name: { type: String },\n value: { type: String },\n href: { type: String },\n target: { type: String },\n rel: { type: String },\n };\n\n declare variant: ButtonVariant;\n declare size: ButtonSize;\n declare disabled: boolean;\n declare focusableWhenDisabled: boolean;\n declare type: \"button\" | \"submit\" | \"reset\";\n declare name?: string;\n declare value?: string;\n declare href?: string;\n declare target?: string;\n declare rel?: string;\n\n constructor() {\n super();\n this.variant = \"default\";\n this.size = \"default\";\n this.disabled = false;\n this.focusableWhenDisabled = false;\n this.type = \"button\";\n }\n\n /** The native element. Focus, tooltips and popovers anchor here, never on the shell. */\n override get control(): HTMLButtonElement | HTMLAnchorElement | null {\n return this.querySelector(\":scope > [data-pont2-button]\");\n }\n\n protected buttonOptions(): ButtonOptions {\n const { variant, size, type, name, value, disabled, focusableWhenDisabled, href, target, rel } = this;\n return { variant, size, type, name, value, disabled, focusableWhenDisabled, href, target, rel };\n }\n\n protected abstract renderContent(): unknown;\n\n override render() {\n return button(this.buttonOptions(), this.renderContent());\n }\n}\n\ndefine(\"pont2-prim-button\", Pont2Button);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-button\": Pont2Button;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement, type ValidityResult } from \"../../core/form-control\";\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Checkbox: Tier 2 (widget, form-associated)\n *\n * shadcn: `<Checkbox>` → Base UI `<Checkbox.Root>` (`<span role=\"checkbox\">`\n * plus a hidden `<input type=\"checkbox\">`) > `<Checkbox.Indicator>` > icon.\n *\n * pont2: the host **is** the `role=\"checkbox\"` root, and it is a\n * form-associated custom element, so there is no hidden input:\n *\n * ```\n * shadcn/Base UI: span[role=checkbox] > span[data-slot=checkbox-indicator] > svg + input[hidden]\n * pont2: pont2-prim-checkbox > span[data-slot=checkbox-indicator] > svg\n * ```\n *\n * State attributes are Base UI's: `data-checked` | `data-unchecked`,\n * `data-indeterminate`, `data-disabled`, `data-readonly`, `data-required`.\n * The CustomStateSet mirrors them (`:state(checked)`).\n *\n * @tag pont2-prim-checkbox\n * @attr checked - Initial checked state (`defaultChecked`); `.checked` is the live state.\n * @attr indeterminate - Mixed state (`aria-checked=\"mixed\"`).\n * @attr name, value, unchecked-value, disabled, required, readonly\n * @fires input - The checked state changed through interaction.\n * @fires change - Same moment as `input`, like a native checkbox.\n */\nexport class Checkbox extends FormControlElement {\n static override identity = \"checkbox\";\n static override slotName = \"checkbox\";\n static override role = \"checkbox\";\n\n static override properties: PropertyDeclarations = {\n ...FormControlElement.properties,\n checked: { type: Boolean },\n indeterminate: { type: Boolean, reflect: true },\n value: { type: String },\n uncheckedValue: { type: String, attribute: \"unchecked-value\" },\n };\n\n declare checked: boolean;\n declare indeterminate: boolean;\n declare value: string;\n declare uncheckedValue: string | undefined;\n\n constructor() {\n super();\n this.checked = false;\n this.indeterminate = false;\n this.value = \"on\";\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"keyup\", this.onKeyUp);\n }\n\n /** Toggle as if the user clicked (fires input/change). */\n toggle(): void {\n if (this.isDisabled || this.readOnly) return;\n this.indeterminate = false;\n this.checked = !this.checked;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n protected formValue() {\n if (this.checked) return this.value;\n return this.uncheckedValue ?? null;\n }\n\n protected resetToDefault(): void {\n this.checked = this.hasAttribute(\"checked\");\n this.indeterminate = this.hasAttribute(\"indeterminate\");\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n this.checked = state === this.value;\n }\n\n protected override validate(): ValidityResult | null {\n if (this.required && !this.checked) {\n return { flags: { valueMissing: true }, message: \"Please tick this box if you want to proceed.\" };\n }\n return null;\n }\n\n private onClick = (e: MouseEvent) => {\n if (this.isDisabled || this.readOnly) {\n e.preventDefault();\n return;\n }\n this.toggle();\n };\n\n // Native checkboxes toggle on Space *keyup*; keydown is prevented so the page does not scroll.\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \" \" && e.target === this) e.preventDefault();\n };\n private onKeyUp = (e: KeyboardEvent) => {\n if (e.key === \" \" && e.target === this) this.click();\n };\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n const on = this.checked && !this.indeterminate;\n this.internals.ariaChecked = this.indeterminate ? \"mixed\" : String(this.checked);\n this.setData(\"checked\", on);\n this.setData(\"unchecked\", !this.checked && !this.indeterminate);\n this.setData(\"indeterminate\", this.indeterminate);\n this.setState(\"checked\", on);\n this.setState(\"indeterminate\", this.indeterminate);\n }\n\n override render() {\n if (!this.checked && !this.indeterminate) return nothing;\n // Base UI <Checkbox.Indicator> (not kept mounted when unchecked).\n return html`<span\n data-pont2-checkbox-indicator\n data-slot=\"checkbox-indicator\"\n ?data-checked=${this.checked && !this.indeterminate}\n ?data-indeterminate=${this.indeterminate}\n >${this.indeterminate ? icons.minus() : icons.check()}</span\n >`;\n }\n}\n\ndefine(\"pont2-prim-checkbox\", Checkbox);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-checkbox\": Checkbox;\n }\n}\n","import { html, nothing } from \"lit\";\nimport { live } from \"lit/directives/live.js\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Input: Tier 3 (native-bound)\n *\n * shadcn: `<Input>` → Base UI `<Input>` → a native `<input data-slot=\"input\">`.\n *\n * A sign-in kit's inputs must be native and in light DOM: autofill, password\n * managers, `autocomplete=\"one-time-code\"`, form submission, `<label for>`\n * and `aria-describedby` all depend on it.\n *\n * - recipe: `<input data-pont2-input type=\"email\" name=\"email\">`\n * - part: `input({ type: \"email\", name: \"email\" })`\n * - enhancer: `<pont2-prim-input><input type=\"email\" name=\"email\"></pont2-prim-input>`\n */\nexport interface InputOptions {\n id?: string;\n name?: string;\n type?: string;\n value?: string;\n placeholder?: string;\n autocomplete?: string;\n inputmode?: string;\n required?: boolean;\n disabled?: boolean;\n readonly?: boolean;\n invalid?: boolean;\n describedBy?: string;\n slot?: string;\n attrs?: AttrMap;\n onInput?: (e: InputEvent) => void;\n onChange?: (e: Event) => void;\n}\n\nexport function applyInput(el: HTMLInputElement, slot = \"input\"): void {\n if (!el.hasAttribute(\"data-pont2-input\")) el.setAttribute(\"data-pont2-input\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", slot);\n}\n\nexport function input(o: InputOptions = {}) {\n return html`<input\n data-pont2-input\n data-slot=${o.slot ?? \"input\"}\n id=${o.id ?? nothing}\n name=${o.name ?? nothing}\n type=${o.type ?? \"text\"}\n .value=${live(o.value ?? \"\")}\n placeholder=${o.placeholder ?? nothing}\n autocomplete=${(o.autocomplete as never) ?? nothing}\n inputmode=${(o.inputmode as never) ?? nothing}\n ?required=${o.required}\n ?disabled=${o.disabled}\n ?readonly=${o.readonly}\n aria-invalid=${o.invalid ? \"true\" : nothing}\n aria-describedby=${o.describedBy ?? nothing}\n ${attrs(o.attrs ?? {})}\n @input=${o.onInput ?? nothing}\n @change=${o.onChange ?? nothing}\n />`;\n}\n\n/**\n * @tag pont2-prim-input\n */\nexport class Pont2Input extends NativeEnhancer<HTMLInputElement> {\n static override nativeSelector = \"input\";\n protected apply(control: HTMLInputElement): void {\n applyInput(control);\n }\n}\n\ndefine(\"pont2-prim-input\", Pont2Input);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-input\": Pont2Input;\n }\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Kbd, KbdGroup: Tier 1 (structural)\n *\n * shadcn: `<Kbd>` → `<kbd data-slot=\"kbd\">`; `<KbdGroup>` → `<kbd data-slot=\"kbd-group\">`.\n *\n * pont2: the host is the key cap. `<kbd>` has no implicit ARIA role, so a\n * custom element loses no semantics here. (If you need the literal element,\n * use the recipe: `<kbd data-pont2-kbd>⌘</kbd>`.)\n *\n * @tag pont2-prim-kbd\n */\nexport class Kbd extends HostElement {\n static override identity = \"kbd\";\n static override slotName = \"kbd\";\n}\n\n/**\n * @tag pont2-prim-kbd-group\n */\nexport class KbdGroup extends HostElement {\n static override identity = \"kbd-group\";\n static override slotName = \"kbd-group\";\n}\n\ndefine(\"pont2-prim-kbd\", Kbd);\ndefine(\"pont2-prim-kbd-group\", KbdGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-kbd\": Kbd;\n \"pont2-prim-kbd-group\": KbdGroup;\n }\n}\n","import { html, nothing } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Label: Tier 3 (native-bound)\n *\n * shadcn: `<Label>` → a native `<label data-slot=\"label\">`.\n *\n * It must be a real `<label>`: `for=` association, click-to-focus, and\n * labelling form-associated custom elements (Checkbox, Switch …) only work\n * on the native element. So:\n *\n * - recipe: `<label data-pont2-label for=\"email\">Email</label>`\n * - part: `label({ for: \"email\" }, \"Email\")`\n * - enhancer: `<pont2-prim-label><label for=\"email\">Email</label></pont2-prim-label>`\n */\nexport interface LabelOptions {\n for?: string;\n id?: string;\n slot?: string;\n /** Extra identities, e.g. FieldLabel passes `[\"field-label\"]`. */\n identities?: string[];\n attrs?: AttrMap;\n}\n\nexport function applyLabel(el: HTMLLabelElement, slot = \"label\"): void {\n if (!el.hasAttribute(\"data-pont2-label\")) el.setAttribute(\"data-pont2-label\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", slot);\n}\n\nexport function label(o: LabelOptions, content: unknown) {\n const extra: AttrMap = {};\n for (const id of o.identities ?? []) extra[`data-pont2-${id}`] = true;\n return html`<label\n data-pont2-label\n data-slot=${o.slot ?? \"label\"}\n for=${o.for ?? nothing}\n id=${o.id ?? nothing}\n ${attrs({ ...extra, ...(o.attrs ?? {}) })}\n >${content}</label\n >`;\n}\n\n/**\n * @tag pont2-prim-label\n */\nexport class Pont2Label extends NativeEnhancer<HTMLLabelElement> {\n static override nativeSelector = \"label\";\n protected apply(control: HTMLLabelElement): void {\n applyLabel(control);\n }\n}\n\ndefine(\"pont2-prim-label\", Pont2Label);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-label\": Pont2Label;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type SeparatorOrientation = \"horizontal\" | \"vertical\";\n\n/**\n * # Separator: Tier 1 (structural)\n *\n * shadcn: `<Separator orientation>` → Base UI `<Separator>` →\n * `<div role=\"separator\" aria-orientation data-orientation data-slot=\"separator\">`.\n *\n * pont2: the host **is** that div. No `render()`, no children, one node.\n * Role and orientation are ElementInternals defaults, so an author's own\n * `role=\"none\"` (purely decorative rule) still wins.\n *\n * Subclass it to make a separator with another meaning, e.g.\n * `class ItemSeparator extends Separator { static identity = \"item-separator\" }`:\n * it keeps `data-pont2-separator` (the look) and gains its own slot.\n *\n * @tag pont2-prim-separator\n * @attr orientation - horizontal (default) | vertical\n */\nexport class Separator extends HostElement {\n static override identity = \"separator\";\n static override slotName = \"separator\";\n static override role = \"separator\";\n\n static override properties: PropertyDeclarations = {\n orientation: { type: String, reflect: true },\n };\n\n declare orientation: SeparatorOrientation;\n\n constructor() {\n super();\n this.orientation = \"horizontal\";\n }\n\n protected override willUpdate(): void {\n const o = this.orientation === \"vertical\" ? \"vertical\" : \"horizontal\";\n this.setData(\"orientation\", o);\n this.internals.ariaOrientation = o;\n }\n}\n\ndefine(\"pont2-prim-separator\", Separator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-separator\": Separator;\n }\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Skeleton: Tier 1 (structural)\n *\n * shadcn: `<Skeleton>` → `<div data-slot=\"skeleton\" class=\"animate-pulse bg-muted rounded-md\">`.\n * Size it with your own CSS (`style=\"width:12rem;height:1rem\"` or a class).\n *\n * @tag pont2-prim-skeleton\n */\nexport class Skeleton extends HostElement {\n static override identity = \"skeleton\";\n static override slotName = \"skeleton\";\n}\n\ndefine(\"pont2-prim-skeleton\", Skeleton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-skeleton\": Skeleton;\n }\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Spinner: Tier 1 (structural)\n *\n * shadcn: `<Spinner>` → lucide `<Loader2Icon role=\"status\" aria-label=\"Loading\"\n * data-slot=\"spinner\" class=\"size-4 animate-spin\">`, i.e. one `<svg>`.\n *\n * A custom element cannot *be* an `<svg>`, and rendering one inside would add\n * a node. pont2 draws the identical lucide `loader-circle` geometry as a CSS\n * mask on the host, so the spinner is still one node and still `currentColor`.\n * Swap the glyph with `--pont2-spinner-icon: url(…)`.\n *\n * `role=\"status\"` and `aria-label=\"Loading\"` are ElementInternals defaults;\n * write your own `aria-label` to localise it.\n *\n * @tag pont2-prim-spinner\n * @cssprop --pont2-spinner-icon - mask image (default: lucide loader-circle)\n */\nexport class Spinner extends HostElement {\n static override identity = \"spinner\";\n static override slotName = \"spinner\";\n static override role = \"status\";\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.internals.ariaLabel) this.internals.ariaLabel = \"Loading\";\n }\n}\n\ndefine(\"pont2-prim-spinner\", Spinner);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-spinner\": Spinner;\n }\n}\n","import { html, nothing } from \"lit\";\nimport { live } from \"lit/directives/live.js\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Textarea: Tier 3 (native-bound)\n *\n * shadcn: `<Textarea>` → a native `<textarea data-slot=\"textarea\">`, auto-sized\n * with `field-sizing: content`.\n *\n * - recipe: `<textarea data-pont2-textarea name=\"bio\"></textarea>`\n * - part: `textarea({ name: \"bio\" })`\n * - enhancer: `<pont2-prim-textarea><textarea name=\"bio\"></textarea></pont2-prim-textarea>`\n */\nexport interface TextareaOptions {\n id?: string;\n name?: string;\n value?: string;\n placeholder?: string;\n rows?: number;\n required?: boolean;\n disabled?: boolean;\n readonly?: boolean;\n invalid?: boolean;\n describedBy?: string;\n slot?: string;\n attrs?: AttrMap;\n onInput?: (e: InputEvent) => void;\n}\n\nexport function applyTextarea(el: HTMLTextAreaElement, slot = \"textarea\"): void {\n if (!el.hasAttribute(\"data-pont2-textarea\")) el.setAttribute(\"data-pont2-textarea\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", slot);\n}\n\nexport function textarea(o: TextareaOptions = {}) {\n return html`<textarea\n data-pont2-textarea\n data-slot=${o.slot ?? \"textarea\"}\n id=${o.id ?? nothing}\n name=${o.name ?? nothing}\n rows=${o.rows ?? nothing}\n placeholder=${o.placeholder ?? nothing}\n ?required=${o.required}\n ?disabled=${o.disabled}\n ?readonly=${o.readonly}\n aria-invalid=${o.invalid ? \"true\" : nothing}\n aria-describedby=${o.describedBy ?? nothing}\n .value=${live(o.value ?? \"\")}\n ${attrs(o.attrs ?? {})}\n @input=${o.onInput ?? nothing}\n ></textarea>`;\n}\n\n/**\n * @tag pont2-prim-textarea\n */\nexport class Pont2Textarea extends NativeEnhancer<HTMLTextAreaElement> {\n static override nativeSelector = \"textarea\";\n protected apply(control: HTMLTextAreaElement): void {\n applyTextarea(control);\n }\n}\n\ndefine(\"pont2-prim-textarea\", Pont2Textarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-textarea\": Pont2Textarea;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const ALERT_VARIANTS = [\"default\", \"destructive\"] as const;\nexport type AlertVariant = (typeof ALERT_VARIANTS)[number];\n\n/**\n * # Alert: Tier 1 (structural)\n *\n * shadcn: `<Alert variant>` → `<div role=\"alert\" data-slot=\"alert\">` with\n * `AlertTitle`, `AlertDescription`, `AlertAction` divs inside.\n *\n * pont2: every part is host-as-root. The alert's `role=\"alert\"` is an\n * ElementInternals default, so `role=\"status\"` written by the author (a polite\n * announcement) still wins.\n *\n * @tag pont2-prim-alert\n * @attr variant - default | destructive\n */\nexport class Alert extends HostElement {\n static override identity = \"alert\";\n static override slotName = \"alert\";\n static override role = \"alert\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n\n declare variant: AlertVariant;\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\n/** @tag pont2-prim-alert-title */\nexport class AlertTitle extends HostElement {\n static override identity = \"alert-title\";\n static override slotName = \"alert-title\";\n}\n\n/** @tag pont2-prim-alert-description */\nexport class AlertDescription extends HostElement {\n static override identity = \"alert-description\";\n static override slotName = \"alert-description\";\n}\n\n/** @tag pont2-prim-alert-action */\nexport class AlertAction extends HostElement {\n static override identity = \"alert-action\";\n static override slotName = \"alert-action\";\n}\n\ndefine(\"pont2-prim-alert\", Alert);\ndefine(\"pont2-prim-alert-title\", AlertTitle);\ndefine(\"pont2-prim-alert-description\", AlertDescription);\ndefine(\"pont2-prim-alert-action\", AlertAction);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-alert\": Alert;\n \"pont2-prim-alert-title\": AlertTitle;\n \"pont2-prim-alert-description\": AlertDescription;\n \"pont2-prim-alert-action\": AlertAction;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type AvatarSize = \"default\" | \"sm\" | \"lg\";\n/** Base UI `Avatar.Root` state `imageLoadingStatus`. */\nexport type ImageLoadingStatus = \"idle\" | \"loading\" | \"loaded\" | \"error\";\n\n/**\n * # Avatar: Tier 1 (structural, with image-loading behaviour)\n *\n * shadcn: `<Avatar size>` → Base UI `<Avatar.Root>` (`<span data-slot=\"avatar\"\n * data-size>`) holding `<Avatar.Image>` (an `<img>`, rendered only once it has\n * loaded) and `<Avatar.Fallback>` (a `<span>`, rendered until then).\n *\n * pont2: the host **is** the root span. The image is the author's own native\n * `<img>` (Tier 3: it must stay an `<img>` for `alt`, `srcset`, lazy loading),\n * written as a direct child. The host watches it and exposes Base UI's\n * `imageLoadingStatus` as `data-image-loading-status`; CSS shows the image\n * only when `loaded` and the fallback otherwise. Nothing is added, removed or\n * moved: the image and fallback both stay in the DOM and CSS swaps them.\n *\n * ```html\n * <pont2-prim-avatar>\n * <img src=\"/u/42.png\" alt=\"Ada Lovelace\">\n * <pont2-prim-avatar-fallback>AL</pont2-prim-avatar-fallback>\n * </pont2-prim-avatar>\n * ```\n *\n * @tag pont2-prim-avatar\n * @attr size - default | sm | lg\n * @fires pont2-loading-status-change - `{ status }` when the image status changes (Base UI `onLoadingStatusChange`).\n */\nexport class Avatar extends HostElement {\n static override identity = \"avatar\";\n static override slotName = \"avatar\";\n\n static override properties: PropertyDeclarations = {\n size: { type: String, reflect: true },\n imageLoadingStatus: { state: true },\n };\n\n declare size: AvatarSize;\n /** Base UI's `imageLoadingStatus`; read-only for consumers. */\n declare imageLoadingStatus: ImageLoadingStatus;\n\n private img: HTMLImageElement | null = null;\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.size = \"default\";\n this.imageLoadingStatus = \"idle\";\n }\n\n /** The author's `<img>` (a direct child), if any. */\n get image(): HTMLImageElement | null {\n return this.querySelector(\":scope > img\");\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.track());\n this.observer.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: [\"src\", \"srcset\"] });\n this.track();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.detach();\n }\n\n private detach() {\n this.img?.removeEventListener(\"load\", this.onLoad);\n this.img?.removeEventListener(\"error\", this.onError);\n this.img = null;\n }\n\n private track() {\n const img = this.image;\n if (img !== this.img) {\n this.detach();\n this.img = img;\n if (img) {\n img.addEventListener(\"load\", this.onLoad);\n img.addEventListener(\"error\", this.onError);\n if (!img.hasAttribute(\"data-pont2-avatar-image\")) img.setAttribute(\"data-pont2-avatar-image\", \"\");\n if (!img.hasAttribute(\"data-slot\")) img.setAttribute(\"data-slot\", \"avatar-image\");\n }\n }\n if (!img || !(img.currentSrc || img.getAttribute(\"src\"))) return this.setStatus(img ? \"error\" : \"idle\");\n if (img.complete) this.setStatus(img.naturalWidth > 0 ? \"loaded\" : \"error\");\n else this.setStatus(\"loading\");\n }\n\n private onLoad = () => this.setStatus(\"loaded\");\n private onError = () => this.setStatus(\"error\");\n\n private setStatus(status: ImageLoadingStatus) {\n if (status === this.imageLoadingStatus) return;\n this.imageLoadingStatus = status;\n this.dispatchEvent(\n new CustomEvent(\"pont2-loading-status-change\", { detail: { status }, bubbles: true, composed: true }),\n );\n }\n\n protected override willUpdate(): void {\n this.setData(\"size\", this.size || \"default\");\n this.setData(\"image-loading-status\", this.imageLoadingStatus);\n }\n}\n\n/**\n * Shown until the avatar's image has loaded (CSS-driven; see Avatar).\n *\n * @tag pont2-prim-avatar-fallback\n */\nexport class AvatarFallback extends HostElement {\n static override identity = \"avatar-fallback\";\n static override slotName = \"avatar-fallback\";\n}\n\n/** @tag pont2-prim-avatar-badge */\nexport class AvatarBadge extends HostElement {\n static override identity = \"avatar-badge\";\n static override slotName = \"avatar-badge\";\n}\n\n/** @tag pont2-prim-avatar-group */\nexport class AvatarGroup extends HostElement {\n static override identity = \"avatar-group\";\n static override slotName = \"avatar-group\";\n}\n\n/** @tag pont2-prim-avatar-group-count */\nexport class AvatarGroupCount extends HostElement {\n static override identity = \"avatar-group-count\";\n static override slotName = \"avatar-group-count\";\n}\n\ndefine(\"pont2-prim-avatar\", Avatar);\ndefine(\"pont2-prim-avatar-fallback\", AvatarFallback);\ndefine(\"pont2-prim-avatar-badge\", AvatarBadge);\ndefine(\"pont2-prim-avatar-group\", AvatarGroup);\ndefine(\"pont2-prim-avatar-group-count\", AvatarGroupCount);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-avatar\": Avatar;\n \"pont2-prim-avatar-fallback\": AvatarFallback;\n \"pont2-prim-avatar-badge\": AvatarBadge;\n \"pont2-prim-avatar-group\": AvatarGroup;\n \"pont2-prim-avatar-group-count\": AvatarGroupCount;\n }\n interface HTMLElementEventMap {\n \"pont2-loading-status-change\": CustomEvent<{ status: ImageLoadingStatus }>;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { Separator } from \"../separator/separator\";\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\";\n\n/**\n * # ButtonGroup: Tier 1 (structural)\n *\n * shadcn: `<ButtonGroup orientation>` → `<div role=\"group\" data-slot=\"button-group\"\n * data-orientation>`; `ButtonGroupText` (Base UI `useRender`, a div);\n * `ButtonGroupSeparator` (a vertical `Separator`).\n *\n * pont2: host-as-root. Children are whatever you write: recipe buttons,\n * `<pont2-prim-button>` shells, inputs, nested groups. The join rules (square inner\n * corners, collapsed borders) see through Tier 3 shells, because a shell has\n * no box. `ButtonGroupSeparator extends Separator`.\n *\n * @tag pont2-prim-button-group\n * @attr orientation - horizontal (default) | vertical\n */\nexport class ButtonGroup extends HostElement {\n static override identity = \"button-group\";\n static override slotName = \"button-group\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n orientation: { type: String, reflect: true },\n };\n\n declare orientation: ButtonGroupOrientation;\n\n constructor() {\n super();\n this.orientation = \"horizontal\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"orientation\", this.orientation === \"vertical\" ? \"vertical\" : \"horizontal\");\n }\n}\n\n/**\n * For a link or label instead of a div, use the recipe on that element:\n * `<label data-pont2-button-group-text data-slot=\"button-group-text\">`.\n *\n * @tag pont2-prim-button-group-text\n */\nexport class ButtonGroupText extends HostElement {\n static override identity = \"button-group-text\";\n static override slotName = \"button-group-text\";\n}\n\n/**\n * A Separator whose default orientation is vertical.\n *\n * @tag pont2-prim-button-group-separator\n */\nexport class ButtonGroupSeparator extends Separator {\n static override identity = \"button-group-separator\";\n static override slotName = \"button-group-separator\";\n\n constructor() {\n super();\n this.orientation = \"vertical\";\n }\n}\n\ndefine(\"pont2-prim-button-group\", ButtonGroup);\ndefine(\"pont2-prim-button-group-text\", ButtonGroupText);\ndefine(\"pont2-prim-button-group-separator\", ButtonGroupSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-button-group\": ButtonGroup;\n \"pont2-prim-button-group-text\": ButtonGroupText;\n \"pont2-prim-button-group-separator\": ButtonGroupSeparator;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type CardSize = \"default\" | \"sm\";\n\n/**\n * # Card: Tier 1 (structural)\n *\n * shadcn: `<Card size>` → `<div data-slot=\"card\" data-size>` and the\n * `CardHeader | CardTitle | CardDescription | CardAction | CardContent |\n * CardFooter` divs. Every part here is host-as-root: same depth as shadcn.\n *\n * @tag pont2-prim-card\n * @attr size - default | sm\n * @cssprop --pont2-card-spacing - padding/gap unit (default 1.5rem)\n * @cssprop --pont2-card-sm-spacing - the same for size=\"sm\" (default 1rem)\n * @cssprop --pont2-card-bg, --pont2-card-fg, --pont2-card-border-color, --pont2-card-radius, --pont2-card-shadow - see docs/11-tokens.md\n */\nexport class Card extends HostElement {\n static override identity = \"card\";\n static override slotName = \"card\";\n\n static override properties: PropertyDeclarations = {\n size: { type: String, reflect: true },\n };\n\n declare size: CardSize;\n\n constructor() {\n super();\n this.size = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"size\", this.size || \"default\");\n }\n}\n\n/** @tag pont2-prim-card-header */\nexport class CardHeader extends HostElement {\n static override identity = \"card-header\";\n static override slotName = \"card-header\";\n}\n\n/** @tag pont2-prim-card-title */\nexport class CardTitle extends HostElement {\n static override identity = \"card-title\";\n static override slotName = \"card-title\";\n}\n\n/** @tag pont2-prim-card-description */\nexport class CardDescription extends HostElement {\n static override identity = \"card-description\";\n static override slotName = \"card-description\";\n}\n\n/** @tag pont2-prim-card-action */\nexport class CardAction extends HostElement {\n static override identity = \"card-action\";\n static override slotName = \"card-action\";\n}\n\n/** @tag pont2-prim-card-content */\nexport class CardContent extends HostElement {\n static override identity = \"card-content\";\n static override slotName = \"card-content\";\n}\n\n/** @tag pont2-prim-card-footer */\nexport class CardFooter extends HostElement {\n static override identity = \"card-footer\";\n static override slotName = \"card-footer\";\n}\n\ndefine(\"pont2-prim-card\", Card);\ndefine(\"pont2-prim-card-header\", CardHeader);\ndefine(\"pont2-prim-card-title\", CardTitle);\ndefine(\"pont2-prim-card-description\", CardDescription);\ndefine(\"pont2-prim-card-action\", CardAction);\ndefine(\"pont2-prim-card-content\", CardContent);\ndefine(\"pont2-prim-card-footer\", CardFooter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-card\": Card;\n \"pont2-prim-card-header\": CardHeader;\n \"pont2-prim-card-title\": CardTitle;\n \"pont2-prim-card-description\": CardDescription;\n \"pont2-prim-card-action\": CardAction;\n \"pont2-prim-card-content\": CardContent;\n \"pont2-prim-card-footer\": CardFooter;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type EmptyMediaVariant = \"default\" | \"icon\";\n\n/**\n * # Empty: Tier 1 (structural)\n *\n * shadcn: `<Empty>` → `<div data-slot=\"empty\">` with `EmptyHeader`,\n * `EmptyMedia` (`data-slot=\"empty-icon\"`, `data-variant`), `EmptyTitle`,\n * `EmptyDescription`, `EmptyContent`, all divs. All host-as-root here.\n *\n * @tag pont2-prim-empty\n */\nexport class Empty extends HostElement {\n static override identity = \"empty\";\n static override slotName = \"empty\";\n}\n\n/** @tag pont2-prim-empty-header */\nexport class EmptyHeader extends HostElement {\n static override identity = \"empty-header\";\n static override slotName = \"empty-header\";\n}\n\n/**\n * Note shadcn's slot name for the media part is `empty-icon` (kept verbatim).\n *\n * @tag pont2-prim-empty-media\n * @attr variant - default | icon\n */\nexport class EmptyMedia extends HostElement {\n static override identity = \"empty-media\";\n static override slotName = \"empty-icon\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n\n declare variant: EmptyMediaVariant;\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\n/** @tag pont2-prim-empty-title */\nexport class EmptyTitle extends HostElement {\n static override identity = \"empty-title\";\n static override slotName = \"empty-title\";\n}\n\n/** @tag pont2-prim-empty-description */\nexport class EmptyDescription extends HostElement {\n static override identity = \"empty-description\";\n static override slotName = \"empty-description\";\n}\n\n/** @tag pont2-prim-empty-content */\nexport class EmptyContent extends HostElement {\n static override identity = \"empty-content\";\n static override slotName = \"empty-content\";\n}\n\ndefine(\"pont2-prim-empty\", Empty);\ndefine(\"pont2-prim-empty-header\", EmptyHeader);\ndefine(\"pont2-prim-empty-media\", EmptyMedia);\ndefine(\"pont2-prim-empty-title\", EmptyTitle);\ndefine(\"pont2-prim-empty-description\", EmptyDescription);\ndefine(\"pont2-prim-empty-content\", EmptyContent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-empty\": Empty;\n \"pont2-prim-empty-header\": EmptyHeader;\n \"pont2-prim-empty-media\": EmptyMedia;\n \"pont2-prim-empty-title\": EmptyTitle;\n \"pont2-prim-empty-description\": EmptyDescription;\n \"pont2-prim-empty-content\": EmptyContent;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { HostElement, NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { applyLabel } from \"../label/label\";\n\n/**\n * # Field family\n *\n * shadcn's `field.tsx` is plain markup (no Base UI primitive):\n *\n * | shadcn | renders | pont2 | tier |\n * |-------------------|--------------------------------------------|-------------------------------|------|\n * | FieldSet | `<fieldset data-slot=\"field-set\">` | recipe/part on `<fieldset>`, `<pont2-prim-field-set>` enhancer | 3 |\n * | FieldLegend | `<legend data-slot=\"field-legend\" data-variant>` | recipe/part on `<legend>` only | 3 |\n * | FieldGroup | `<div data-slot=\"field-group\">` | `<pont2-prim-field-group>` | 1 |\n * | Field | `<div role=\"group\" data-slot=\"field\" data-orientation>` | `<pont2-prim-field>` | 1 |\n * | FieldContent | `<div data-slot=\"field-content\">` | `<pont2-prim-field-content>` | 1 |\n * | FieldLabel | `<label data-slot=\"field-label\">` (Label) | recipe/part on `<label>`, `<pont2-prim-field-label>` enhancer | 3 |\n * | FieldTitle | `<div data-slot=\"field-label\">` | `<pont2-prim-field-title>` | 1 |\n * | FieldDescription | `<p data-slot=\"field-description\">` | `<pont2-prim-field-description>` | 1 |\n * | FieldSeparator | `<div data-slot=\"field-separator\">` > Separator + `<span>` | `<pont2-prim-field-separator>` (lines drawn in CSS) | 1 |\n * | FieldError | `<div role=\"alert\" data-slot=\"field-error\">` | `<pont2-prim-field-error>` | 1 |\n *\n * Like shadcn, the family does no id wiring: you write `for`/`id` and\n * `aria-describedby` yourself (Base UI's own `Field` primitive does wire ids;\n * shadcn's Field does not use it). See docs/primitives/field.md.\n */\n\n/* ------------------------------------------------------------------ */\n/* FieldSet / FieldLegend (native) */\n/* ------------------------------------------------------------------ */\n\nexport function applyFieldSet(el: HTMLFieldSetElement): void {\n if (!el.hasAttribute(\"data-pont2-field-set\")) el.setAttribute(\"data-pont2-field-set\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", \"field-set\");\n}\n\nexport function fieldSet(o: { disabled?: boolean; attrs?: AttrMap }, content: unknown) {\n return html`<fieldset data-pont2-field-set data-slot=\"field-set\" ?disabled=${o.disabled} ${attrs(o.attrs ?? {})}>\n ${content}\n </fieldset>`;\n}\n\nexport function fieldLegend(o: { variant?: \"legend\" | \"label\"; attrs?: AttrMap }, content: unknown) {\n return html`<legend\n data-pont2-field-legend\n data-slot=\"field-legend\"\n data-variant=${o.variant ?? \"legend\"}\n ${attrs(o.attrs ?? {})}\n >${content}</legend\n >`;\n}\n\n/**\n * Applies the FieldSet recipe to the `<fieldset>` inside it. The legend must\n * be a direct child of that `<fieldset>` to name it, so write\n * `<legend data-pont2-field-legend>` (there is no legend element).\n *\n * @tag pont2-prim-field-set\n */\nexport class FieldSetElement extends NativeEnhancer<HTMLFieldSetElement> {\n static override nativeSelector = \"fieldset\";\n protected apply(control: HTMLFieldSetElement): void {\n applyFieldSet(control);\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* FieldGroup / Field / FieldContent */\n/* ------------------------------------------------------------------ */\n\n/** @tag pont2-prim-field-group */\nexport class FieldGroup extends HostElement {\n static override identity = \"field-group\";\n static override slotName = \"field-group\";\n}\n\nexport type FieldOrientation = \"vertical\" | \"horizontal\" | \"responsive\";\n\n/**\n * @tag pont2-prim-field\n * @attr orientation - vertical (default) | horizontal | responsive\n * @attr invalid - Sets `data-invalid` (destructive text colour), like shadcn's `data-invalid`.\n * @attr disabled - Sets `data-disabled` (dims the label/title), like shadcn's `data-disabled`.\n */\nexport class Field extends HostElement {\n static override identity = \"field\";\n static override slotName = \"field\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n orientation: { type: String, reflect: true },\n invalid: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare orientation: FieldOrientation;\n declare invalid: boolean;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.orientation = \"vertical\";\n this.invalid = false;\n this.disabled = false;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n this.setData(\"orientation\", this.orientation || \"vertical\");\n // Only manage the state attributes we own; an author's data-invalid=\"true\" stays.\n if (changed.has(\"invalid\") && (this.invalid || changed.get(\"invalid\"))) this.setData(\"invalid\", this.invalid);\n if (changed.has(\"disabled\") && (this.disabled || changed.get(\"disabled\"))) this.setData(\"disabled\", this.disabled);\n }\n}\n\n/** @tag pont2-prim-field-content */\nexport class FieldContent extends HostElement {\n static override identity = \"field-content\";\n static override slotName = \"field-content\";\n}\n\n/* ------------------------------------------------------------------ */\n/* FieldLabel (native) / FieldTitle */\n/* ------------------------------------------------------------------ */\n\nexport function applyFieldLabel(el: HTMLLabelElement): void {\n applyLabel(el, \"field-label\");\n if (!el.hasAttribute(\"data-pont2-field-label\")) el.setAttribute(\"data-pont2-field-label\", \"\");\n}\n\n/** `<label data-pont2-label data-pont2-field-label data-slot=\"field-label\">` */\nexport function fieldLabel(o: { for?: string; id?: string; attrs?: AttrMap }, content: unknown) {\n return html`<label\n data-pont2-label\n data-pont2-field-label\n data-slot=\"field-label\"\n for=${o.for ?? nothing}\n id=${o.id ?? nothing}\n ${attrs(o.attrs ?? {})}\n >${content}</label\n >`;\n}\n\n/** @tag pont2-prim-field-label */\nexport class FieldLabelElement extends NativeEnhancer<HTMLLabelElement> {\n static override nativeSelector = \"label\";\n protected apply(control: HTMLLabelElement): void {\n applyFieldLabel(control);\n }\n}\n\n/**\n * A label-styled title for a field that has no single control to label\n * (shadcn gives it `data-slot=\"field-label\"` too, kept verbatim).\n *\n * @tag pont2-prim-field-title\n */\nexport class FieldTitle extends HostElement {\n static override identity = \"field-title\";\n static override slotName = \"field-label\";\n}\n\n/* ------------------------------------------------------------------ */\n/* FieldDescription / FieldSeparator / FieldError */\n/* ------------------------------------------------------------------ */\n\n/** @tag pont2-prim-field-description */\nexport class FieldDescription extends HostElement {\n static override identity = \"field-description\";\n static override slotName = \"field-description\";\n}\n\n/**\n * shadcn renders `div > Separator + span`. pont2 draws the two rule halves\n * with `::before`/`::after`, so the only nodes are the host and your text.\n * `data-content` is set when the separator has text, as in shadcn.\n *\n * @tag pont2-prim-field-separator\n */\nexport class FieldSeparator extends HostElement {\n static override identity = \"field-separator\";\n static override slotName = \"field-separator\";\n\n private observer?: MutationObserver;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.sync());\n this.observer.observe(this, { childList: true, characterData: true, subtree: true });\n this.sync();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n private sync() {\n this.setAttribute(\"data-content\", String(!!this.textContent?.trim() || this.children.length > 0));\n }\n}\n\nexport interface FieldErrorItem {\n message?: string;\n}\n\n/**\n * Write the message as children, or set `.errors` (shadcn's `errors` prop:\n * de-duplicated by message; one renders as text, several as a list). Hidden\n * while empty, like shadcn returning `null`.\n *\n * @tag pont2-prim-field-error\n */\nexport class FieldError extends HostElement {\n static override identity = \"field-error\";\n static override slotName = \"field-error\";\n static override role = \"alert\";\n\n static override properties: PropertyDeclarations = {\n errors: { attribute: false },\n };\n\n declare errors: Array<FieldErrorItem | undefined> | undefined;\n\n override render() {\n if (!this.errors?.length) return nothing;\n const unique = [...new Map(this.errors.map(e => [e?.message, e])).values()].filter(e => e?.message);\n if (unique.length === 1) return unique[0]!.message;\n return html`<ul data-slot=\"field-error-list\">\n ${unique.map(e => html`<li>${e!.message}</li>`)}\n </ul>`;\n }\n}\n\ndefine(\"pont2-prim-field-set\", FieldSetElement);\ndefine(\"pont2-prim-field-group\", FieldGroup);\ndefine(\"pont2-prim-field\", Field);\ndefine(\"pont2-prim-field-content\", FieldContent);\ndefine(\"pont2-prim-field-label\", FieldLabelElement);\ndefine(\"pont2-prim-field-title\", FieldTitle);\ndefine(\"pont2-prim-field-description\", FieldDescription);\ndefine(\"pont2-prim-field-separator\", FieldSeparator);\ndefine(\"pont2-prim-field-error\", FieldError);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-field-set\": FieldSetElement;\n \"pont2-prim-field-group\": FieldGroup;\n \"pont2-prim-field\": Field;\n \"pont2-prim-field-content\": FieldContent;\n \"pont2-prim-field-label\": FieldLabelElement;\n \"pont2-prim-field-title\": FieldTitle;\n \"pont2-prim-field-description\": FieldDescription;\n \"pont2-prim-field-separator\": FieldSeparator;\n \"pont2-prim-field-error\": FieldError;\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { HostElement, NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { applyButton, button, Pont2Button, type ButtonOptions } from \"../button/button\";\nimport { applyInput, input, type InputOptions } from \"../input/input\";\nimport { applyTextarea, textarea, type TextareaOptions } from \"../textarea/textarea\";\n\nexport type InputGroupAddonAlign = \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\";\nexport type InputGroupButtonSize = \"xs\" | \"sm\" | \"icon-xs\" | \"icon-sm\";\n\n/**\n * # InputGroup family\n *\n * shadcn: `InputGroup` (`div role=\"group\" data-slot=\"input-group\"`),\n * `InputGroupAddon` (`div role=\"group\" data-align`, click focuses the input),\n * `InputGroupText` (a `span`), and the controls `InputGroupInput` /\n * `InputGroupTextarea` / `InputGroupButton`, which are shadcn's `Input`,\n * `Textarea` and `Button` with extra classes and\n * `data-slot=\"input-group-control\"` (button: ghost, size xs).\n *\n * pont2:\n * - `<pont2-prim-input-group>`, `<pont2-prim-input-group-addon>`, `<pont2-prim-input-group-text>`\n * are host-as-root (Tier 1).\n * - The controls stay native (Tier 3): the Input/Textarea/Button recipe plus\n * an extra identity. Write them as recipes\n * (`<input data-pont2-input data-pont2-input-group-input data-slot=\"input-group-control\">`),\n * parts (`inputGroupInput()`), or enhancers (`<pont2-prim-input-group-input><input></…>`).\n *\n * Like shadcn, the control must be a *direct* child of the group for the\n * group's `has-[>input]` padding rules; with an enhancer the shell is\n * `display: contents` and the rules also match through it.\n */\n\n/**\n * @tag pont2-prim-input-group\n * @attr disabled - Sets `data-disabled` (dims addons), like shadcn's `data-disabled=\"true\"`.\n */\nexport class InputGroup extends HostElement {\n static override identity = \"input-group\";\n static override slotName = \"input-group\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n disabled: { type: Boolean, reflect: true },\n };\n\n declare disabled: boolean;\n\n constructor() {\n super();\n this.disabled = false;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"disabled\") && (this.disabled || changed.get(\"disabled\"))) this.setData(\"disabled\", this.disabled);\n }\n}\n\n/**\n * @tag pont2-prim-input-group-addon\n * @attr align - inline-start (default) | inline-end | block-start | block-end\n */\nexport class InputGroupAddon extends HostElement {\n static override identity = \"input-group-addon\";\n static override slotName = \"input-group-addon\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n align: { type: String, reflect: true },\n };\n\n declare align: InputGroupAddonAlign;\n\n constructor() {\n super();\n this.align = \"inline-start\";\n // shadcn: clicking the addon (but not a button in it) focuses the group's input.\n this.addEventListener(\"click\", e => {\n if ((e.target as HTMLElement).closest(\"button\")) return;\n this.parentElement?.querySelector(\"input\")?.focus();\n });\n }\n\n protected override willUpdate(): void {\n this.setData(\"align\", this.align || \"inline-start\");\n }\n}\n\n/** shadcn's InputGroupText has no data-slot; pont2 keeps it that way. @tag pont2-prim-input-group-text */\nexport class InputGroupText extends HostElement {\n static override identity = \"input-group-text\";\n}\n\n/* ------------------------------------------------------------------ */\n/* Controls (native) */\n/* ------------------------------------------------------------------ */\n\nconst CONTROL = \"input-group-control\";\n\nfunction markControl(el: HTMLElement, identity: string) {\n if (!el.hasAttribute(`data-pont2-${identity}`)) el.setAttribute(`data-pont2-${identity}`, \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", CONTROL);\n}\n\nexport function inputGroupInput(o: InputOptions = {}) {\n return input({ ...o, slot: CONTROL, attrs: { \"data-pont2-input-group-input\": true, ...(o.attrs ?? {}) } });\n}\n\nexport function inputGroupTextarea(o: TextareaOptions = {}) {\n return textarea({ ...o, slot: CONTROL, attrs: { \"data-pont2-input-group-textarea\": true, ...(o.attrs ?? {}) } });\n}\n\nexport interface InputGroupButtonOptions extends Omit<ButtonOptions, \"size\"> {\n size?: InputGroupButtonSize;\n}\n\n/** shadcn defaults: `variant=\"ghost\"`, `size=\"xs\"`, `type=\"button\"`. */\nexport function inputGroupButton(o: InputGroupButtonOptions, content: unknown) {\n return button(\n {\n variant: \"ghost\",\n ...o,\n size: (o.size ?? \"xs\") as ButtonOptions[\"size\"],\n attrs: { \"data-pont2-input-group-button\": true, ...(o.attrs ?? {}) },\n },\n content,\n );\n}\n\n/** @tag pont2-prim-input-group-input */\nexport class InputGroupInput extends NativeEnhancer<HTMLInputElement> {\n static override nativeSelector = \"input\";\n protected apply(control: HTMLInputElement): void {\n if (!control.hasAttribute(\"data-slot\")) control.setAttribute(\"data-slot\", CONTROL);\n applyInput(control, CONTROL);\n markControl(control, \"input-group-input\");\n }\n}\n\n/** @tag pont2-prim-input-group-textarea */\nexport class InputGroupTextarea extends NativeEnhancer<HTMLTextAreaElement> {\n static override nativeSelector = \"textarea\";\n protected apply(control: HTMLTextAreaElement): void {\n if (!control.hasAttribute(\"data-slot\")) control.setAttribute(\"data-slot\", CONTROL);\n applyTextarea(control, CONTROL);\n markControl(control, \"input-group-textarea\");\n }\n}\n\n/**\n * `<pont2-prim-button>` with shadcn's InputGroupButton defaults (ghost, xs) and its\n * extra recipe. It *is* a Pont2Button enhancer, so everything else is inherited.\n *\n * @tag pont2-prim-input-group-button\n * @attr size - xs (default) | sm | icon-xs | icon-sm\n */\nexport class InputGroupButton extends Pont2Button {\n constructor() {\n super();\n this.variant = \"ghost\";\n this.size = \"xs\";\n }\n\n protected override apply(control: HTMLButtonElement | HTMLAnchorElement): void {\n applyButton(control, this);\n if (!control.hasAttribute(\"data-pont2-input-group-button\")) control.setAttribute(\"data-pont2-input-group-button\", \"\");\n if (control instanceof HTMLButtonElement && !control.hasAttribute(\"type\")) control.type = \"button\";\n }\n}\n\ndefine(\"pont2-prim-input-group\", InputGroup);\ndefine(\"pont2-prim-input-group-addon\", InputGroupAddon);\ndefine(\"pont2-prim-input-group-text\", InputGroupText);\ndefine(\"pont2-prim-input-group-input\", InputGroupInput);\ndefine(\"pont2-prim-input-group-textarea\", InputGroupTextarea);\ndefine(\"pont2-prim-input-group-button\", InputGroupButton);\n\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-input-group\": InputGroup;\n \"pont2-prim-input-group-addon\": InputGroupAddon;\n \"pont2-prim-input-group-text\": InputGroupText;\n \"pont2-prim-input-group-input\": InputGroupInput;\n \"pont2-prim-input-group-textarea\": InputGroupTextarea;\n \"pont2-prim-input-group-button\": InputGroupButton;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { Separator } from \"../separator/separator\";\n\nexport type ItemVariant = \"default\" | \"outline\" | \"muted\";\nexport type ItemSize = \"default\" | \"sm\" | \"xs\";\nexport type ItemMediaVariant = \"default\" | \"icon\" | \"image\";\n\n/**\n * # Item family: Tier 1 (structural)\n *\n * shadcn: `ItemGroup` (`div role=\"list\"`), `Item` (Base UI `useRender`, a div\n * by default, or the author's `<a>` through `render`), `ItemMedia`,\n * `ItemContent`, `ItemTitle`, `ItemDescription` (a `p`), `ItemActions`,\n * `ItemHeader`, `ItemFooter`, and `ItemSeparator` (a `Separator`).\n *\n * pont2: every part is host-as-root. A link item is the recipe on a real\n * anchor: `<a data-pont2-item data-variant=\"outline\" href=\"…\">`.\n * `ItemSeparator extends Separator`, so it *is* a separator (one node, role\n * separator) that keeps the separator look and adds `data-slot=\"item-separator\"`.\n */\n\n/** @tag pont2-prim-item-group */\nexport class ItemGroup extends HostElement {\n static override identity = \"item-group\";\n static override slotName = \"item-group\";\n static override role = \"list\";\n}\n\n/** @tag pont2-prim-item-separator */\nexport class ItemSeparator extends Separator {\n static override identity = \"item-separator\";\n static override slotName = \"item-separator\";\n}\n\n/**\n * @tag pont2-prim-item\n * @attr variant - default | outline | muted\n * @attr size - default | sm | xs\n */\nexport class Item extends HostElement {\n static override identity = \"item\";\n static override slotName = \"item\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n };\n\n declare variant: ItemVariant;\n declare size: ItemSize;\n\n constructor() {\n super();\n this.variant = \"default\";\n this.size = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n this.setData(\"size\", this.size || \"default\");\n }\n}\n\n/**\n * @tag pont2-prim-item-media\n * @attr variant - default | icon | image\n */\nexport class ItemMedia extends HostElement {\n static override identity = \"item-media\";\n static override slotName = \"item-media\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n\n declare variant: ItemMediaVariant;\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\n/** @tag pont2-prim-item-content */\nexport class ItemContent extends HostElement {\n static override identity = \"item-content\";\n static override slotName = \"item-content\";\n}\n\n/** @tag pont2-prim-item-title */\nexport class ItemTitle extends HostElement {\n static override identity = \"item-title\";\n static override slotName = \"item-title\";\n}\n\n/** @tag pont2-prim-item-description */\nexport class ItemDescription extends HostElement {\n static override identity = \"item-description\";\n static override slotName = \"item-description\";\n}\n\n/** @tag pont2-prim-item-actions */\nexport class ItemActions extends HostElement {\n static override identity = \"item-actions\";\n static override slotName = \"item-actions\";\n}\n\n/** @tag pont2-prim-item-header */\nexport class ItemHeader extends HostElement {\n static override identity = \"item-header\";\n static override slotName = \"item-header\";\n}\n\n/** @tag pont2-prim-item-footer */\nexport class ItemFooter extends HostElement {\n static override identity = \"item-footer\";\n static override slotName = \"item-footer\";\n}\n\ndefine(\"pont2-prim-item-group\", ItemGroup);\ndefine(\"pont2-prim-item-separator\", ItemSeparator);\ndefine(\"pont2-prim-item\", Item);\ndefine(\"pont2-prim-item-media\", ItemMedia);\ndefine(\"pont2-prim-item-content\", ItemContent);\ndefine(\"pont2-prim-item-title\", ItemTitle);\ndefine(\"pont2-prim-item-description\", ItemDescription);\ndefine(\"pont2-prim-item-actions\", ItemActions);\ndefine(\"pont2-prim-item-header\", ItemHeader);\ndefine(\"pont2-prim-item-footer\", ItemFooter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-item-group\": ItemGroup;\n \"pont2-prim-item-separator\": ItemSeparator;\n \"pont2-prim-item\": Item;\n \"pont2-prim-item-media\": ItemMedia;\n \"pont2-prim-item-content\": ItemContent;\n \"pont2-prim-item-title\": ItemTitle;\n \"pont2-prim-item-description\": ItemDescription;\n \"pont2-prim-item-actions\": ItemActions;\n \"pont2-prim-item-header\": ItemHeader;\n \"pont2-prim-item-footer\": ItemFooter;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type NativeSelectSize = \"default\" | \"sm\";\n\n/**\n * # NativeSelect: Tier 1 wrapper + native `<select>`\n *\n * shadcn: `<NativeSelect size>` renders\n * `div[data-slot=native-select-wrapper][data-size] > select[data-slot=native-select][data-size] + svg[data-slot=native-select-icon]`;\n * `NativeSelectOption` / `NativeSelectOptGroup` are `<option>` / `<optgroup>`.\n *\n * pont2: `<pont2-prim-native-select>` **is** the wrapper div; you write the native\n * `<select>` (and its options) inside, and the host applies the recipe to it.\n * The chevron is drawn by the wrapper's `::after`, so the DOM is\n * `pont2-prim-native-select > select`: one node fewer than shadcn, and the select\n * stays a real form control (submission, autofill, mobile pickers).\n *\n * ```html\n * <pont2-prim-native-select>\n * <select name=\"country\"><option>Norway</option><option>Japan</option></select>\n * </pont2-prim-native-select>\n * ```\n *\n * @tag pont2-prim-native-select\n * @attr size - default | sm\n * @cssprop --pont2-native-select-icon - mask image for the chevron\n */\nexport class NativeSelect extends HostElement {\n static override identity = \"native-select-wrapper\";\n static override slotName = \"native-select-wrapper\";\n\n static override properties: PropertyDeclarations = {\n size: { type: String, reflect: true },\n };\n\n declare size: NativeSelectSize;\n\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.size = \"default\";\n }\n\n /** The native `<select>`. */\n get control(): HTMLSelectElement | null {\n return this.querySelector(\":scope > select\");\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n override focus(options?: FocusOptions): void {\n this.control?.focus(options);\n }\n\n protected override willUpdate(): void {\n const size = this.size || \"default\";\n this.setData(\"size\", size);\n const select = this.control;\n if (select) applyNativeSelect(select, size);\n }\n}\n\nexport function applyNativeSelect(el: HTMLSelectElement, size: NativeSelectSize = \"default\"): void {\n if (!el.hasAttribute(\"data-pont2-native-select\")) el.setAttribute(\"data-pont2-native-select\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", \"native-select\");\n el.setAttribute(\"data-size\", size);\n}\n\nexport interface NativeSelectOptions {\n size?: NativeSelectSize;\n id?: string;\n name?: string;\n disabled?: boolean;\n required?: boolean;\n invalid?: boolean;\n attrs?: AttrMap;\n onChange?: (e: Event) => void;\n}\n\n/** Part: the wrapper div and the select in one template (options are the content). */\nexport function nativeSelect(o: NativeSelectOptions, options: unknown) {\n const size = o.size ?? \"default\";\n return html`<div data-pont2-native-select-wrapper data-slot=\"native-select-wrapper\" data-size=${size}>\n <select\n data-pont2-native-select\n data-slot=\"native-select\"\n data-size=${size}\n id=${o.id ?? nothing}\n name=${o.name ?? nothing}\n ?disabled=${o.disabled}\n ?required=${o.required}\n aria-invalid=${o.invalid ? \"true\" : nothing}\n ${attrs(o.attrs ?? {})}\n @change=${o.onChange ?? nothing}\n >\n ${options}\n </select>\n </div>`;\n}\n\ndefine(\"pont2-prim-native-select\", NativeSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-native-select\": NativeSelect;\n }\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Table: Tier 1 container + native table (recipe)\n *\n * shadcn: `<Table>` → `<div data-slot=\"table-container\"><table data-slot=\"table\">`,\n * and `TableHeader | TableBody | TableFooter | TableRow | TableHead |\n * TableCell | TableCaption` are the native `thead | tbody | tfoot | tr | th |\n * td | caption` with a `data-slot` each.\n *\n * Table parts cannot be custom elements: the HTML parser \"foster-parents\"\n * unknown elements out of a `<table>` (`<table><pont2-tr>` puts the\n * `pont2-tr` *before* the table). And `colspan`, `headers`, `scope` and the\n * native table semantics only exist on the native elements.\n *\n * So `<pont2-prim-table>` **is** the container div (host-as-root), and you write a\n * plain native `<table>` inside it:\n *\n * ```html\n * <pont2-prim-table>\n * <table>\n * <caption>Recent invoices</caption>\n * <thead><tr><th>Invoice</th><th>Amount</th></tr></thead>\n * <tbody><tr><td>INV001</td><td>$250.00</td></tr></tbody>\n * </table>\n * </pont2-prim-table>\n * ```\n *\n * The host stamps each part's recipe (`data-pont2-table-*` + shadcn's\n * `data-slot`) onto the native elements of *its own* table (not nested ones),\n * and keeps doing so as rows are added. Styling also works before upgrade and\n * with no JS, through `pont2-prim-table > table …` selectors, and outside the\n * element via the recipe attributes (`applyTable()`).\n *\n * @tag pont2-prim-table\n */\nexport class Table extends HostElement {\n static override identity = \"table-container\";\n static override slotName = \"table-container\";\n\n private observer?: MutationObserver;\n\n /** The native `<table>` this container holds. */\n get table(): HTMLTableElement | null {\n return this.querySelector(\":scope > table\");\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.stamp());\n this.observer.observe(this, { childList: true, subtree: true });\n this.stamp();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n private stamp() {\n const t = this.table;\n if (t) applyTable(t);\n }\n}\n\nconst PARTS: Record<string, string> = {\n CAPTION: \"table-caption\",\n THEAD: \"table-header\",\n TBODY: \"table-body\",\n TFOOT: \"table-footer\",\n TR: \"table-row\",\n TH: \"table-head\",\n TD: \"table-cell\",\n};\n\nfunction mark(el: Element, part: string) {\n if (!el.hasAttribute(`data-pont2-${part}`)) el.setAttribute(`data-pont2-${part}`, \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", part);\n}\n\n/**\n * Applies the table recipe to a native `<table>` and its own sections, rows\n * and cells (not those of nested tables). Idempotent.\n */\nexport function applyTable(table: HTMLTableElement): void {\n mark(table, \"table\");\n if (table.caption) mark(table.caption, PARTS.CAPTION);\n for (const section of [table.tHead, ...Array.from(table.tBodies), table.tFoot]) {\n if (section) mark(section, PARTS[section.tagName]);\n }\n for (const row of Array.from(table.rows)) {\n mark(row, PARTS.TR);\n for (const cell of Array.from(row.cells)) mark(cell, PARTS[cell.tagName]);\n }\n}\n\ndefine(\"pont2-prim-table\", Table);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-table\": Table;\n }\n}\n","/**\n * Pure InputOTP helpers (no DOM), unit-tested in node.\n *\n * `pattern` is a whole-string regular expression source, like the input-otp\n * library's `REGEXP_ONLY_DIGITS` (`^\\d+$`); each character is tested on its\n * own, so pasted \"123-456\" or \"12 34 56\" is cleaned to \"123456\".\n */\nexport const REGEXP_ONLY_DIGITS = \"^\\\\d+$\";\nexport const REGEXP_ONLY_CHARS = \"^[a-zA-Z]+$\";\nexport const REGEXP_ONLY_DIGITS_AND_CHARS = \"^[a-zA-Z0-9]+$\";\n\nexport function sanitizeOtp(raw: string, maxLength: number, pattern: string | null = REGEXP_ONLY_DIGITS): string {\n let re: RegExp | null = null;\n if (pattern) {\n try {\n re = new RegExp(pattern);\n } catch {\n re = null;\n }\n }\n let out = \"\";\n for (const ch of Array.from(raw)) {\n if (out.length >= maxLength) break;\n if (/\\s/.test(ch)) continue;\n if (re && !re.test(ch)) continue;\n out += ch;\n }\n return out;\n}\n\nexport interface OtpSlotState {\n char: string | null;\n isActive: boolean;\n hasFakeCaret: boolean;\n}\n\n/**\n * Per-slot state, as input-otp computes it: while focused, the slot(s) under\n * the selection are active; a collapsed selection on an empty slot shows the\n * fake caret. A full value with the caret at the end activates the last slot.\n */\nexport function otpSlots(\n value: string,\n maxLength: number,\n focused: boolean,\n selStart: number | null,\n selEnd: number | null,\n): OtpSlotState[] {\n const chars = Array.from(value);\n let start = selStart ?? chars.length;\n let end = selEnd ?? start;\n if (start === end && start >= maxLength) {\n start = maxLength - 1;\n end = maxLength;\n }\n const collapsed = start === end;\n return Array.from({ length: maxLength }, (_, i) => {\n const char = chars[i] ?? null;\n const isActive = focused && (collapsed ? i === start : i >= start && i < end);\n return { char, isActive, hasFakeCaret: isActive && collapsed && char === null };\n });\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport { live } from \"lit/directives/live.js\";\n\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { define, sel } from \"../../core/names\";\nimport { REGEXP_ONLY_DIGITS, otpSlots, sanitizeOtp, type OtpSlotState } from \"./otp\";\n\nexport { REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from \"./otp\";\n\nconst ROOT = sel(\"input-otp\");\nconst SLOT = sel(\"input-otp-slot\");\nconst FORWARDED = [\"aria-label\", \"aria-labelledby\", \"aria-describedby\", \"aria-invalid\"] as const;\n\nexport interface OtpCompleteDetail {\n value: string;\n}\n\n/**\n * # InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator\n *\n * shadcn wraps the `input-otp` library: a container `div` holding the author's\n * groups/slots plus ONE real `<input>` stretched transparently over them; the\n * slots only *draw* the characters and a fake caret.\n * ```\n * shadcn: div.cn-input-otp > [InputOTPGroup > InputOTPSlot ×n, InputOTPSeparator] + div > input[data-slot=input-otp]\n * pont2: pont2-prim-input-otp > [pont2-prim-input-otp-group > pont2-prim-input-otp-slot ×n, pont2-prim-input-otp-separator] + div > input[data-slot=input-otp]\n * ```\n * Same shape, same reason: the single native `<input autocomplete=\"one-time-code\">`\n * is what SMS autofill (iOS/Android), password managers, paste and form\n * submission need. It is a Tier 3 core inside a Tier 1 container; the slots\n * are Tier 1 hosts the container pushes state into.\n *\n * The input is rendered by the host (after the author's children, where\n * input-otp puts it), so the author never writes it; `name`, `required`,\n * `disabled`, `autocomplete`, `inputmode`, `pattern` and the ARIA naming\n * attributes are forwarded to it.\n *\n * @tag pont2-prim-input-otp\n * @attr maxlength - Number of characters (default 6).\n * @attr pattern - Per-character regex source (default `^\\d+$`, digits). `pattern=\"\"` accepts anything.\n * @attr value - Default value; `.value` is live.\n * @attr name, required, disabled, autocomplete (one-time-code), inputmode, input-id\n * @fires input, change - Native events from the inner input (bubble through the host).\n * @fires pont2-complete - `{ value }` when every slot is filled (input-otp `onComplete`).\n */\nexport class InputOTP extends HostElement {\n static override identity = \"input-otp\";\n\n static override properties: PropertyDeclarations = {\n maxLength: { type: Number, attribute: \"maxlength\" },\n pattern: { type: String },\n defaultValue: { type: String, attribute: \"value\" },\n name: { type: String },\n required: { type: Boolean },\n disabled: { type: Boolean, reflect: true },\n autocomplete: { type: String },\n keyboardMode: { type: String, attribute: \"inputmode\" },\n inputId: { type: String, attribute: \"input-id\" },\n current: { state: true },\n forwarded: { state: true },\n };\n\n declare maxLength: number;\n declare pattern: string | null;\n declare defaultValue: string | null;\n declare name: string | null;\n declare required: boolean;\n declare disabled: boolean;\n declare autocomplete: string;\n /** Forwarded to the input as `inputmode` (named so it does not shadow HTMLElement.inputMode). */\n declare keyboardMode: string | null;\n declare inputId: string | null;\n declare protected current: string;\n declare protected forwarded: Record<string, string | null>;\n\n private dirty = false;\n private focused = false;\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.maxLength = 6;\n this.pattern = REGEXP_ONLY_DIGITS;\n this.defaultValue = null;\n this.name = null;\n this.required = false;\n this.disabled = false;\n this.autocomplete = \"one-time-code\";\n this.keyboardMode = null;\n this.inputId = null;\n this.current = \"\";\n this.forwarded = {};\n }\n\n /** The native input (the real form control). */\n get input(): HTMLInputElement | null {\n return this.querySelector(\":scope > [data-pont2-input-otp-input-wrapper] > input\");\n }\n\n get value(): string {\n return this.current;\n }\n set value(v: string) {\n this.dirty = true;\n this.current = sanitizeOtp(String(v ?? \"\"), this.maxLength, this.pattern || null);\n }\n\n override focus(options?: FocusOptions): void {\n this.input?.focus(options);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.readForwarded();\n this.observer ??= new MutationObserver(m => {\n if (m.some(r => r.type === \"attributes\" && r.target === this)) this.readForwarded();\n else this.syncSlots();\n });\n this.observer.observe(this, { attributes: true, attributeFilter: [...FORWARDED], childList: true, subtree: true });\n document.addEventListener(\"selectionchange\", this.onSelectionChange);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n document.removeEventListener(\"selectionchange\", this.onSelectionChange);\n }\n\n private readForwarded(): void {\n const f: Record<string, string | null> = {};\n for (const a of FORWARDED) f[a] = this.getAttribute(a);\n this.forwarded = f;\n }\n\n private get slots(): InputOTPSlot[] {\n return Array.from(this.querySelectorAll<InputOTPSlot>(SLOT)).filter(s => s.closest(ROOT) === this);\n }\n\n /** Push per-slot state into the slot elements. */\n private syncSlots(): void {\n const input = this.input;\n const states = otpSlots(this.current, this.maxLength, this.focused, input?.selectionStart ?? null, input?.selectionEnd ?? null);\n const invalid = this.forwarded[\"aria-invalid\"] === \"true\";\n this.slots.forEach((slot, order) => {\n const i = slot.hasAttribute(\"index\") ? Number(slot.getAttribute(\"index\")) : order;\n if (typeof slot.sync === \"function\") slot.sync(states[i] ?? { char: null, isActive: false, hasFakeCaret: false }, invalid);\n });\n }\n\n /* -------------------------------------------------------------- */\n /* Input handling (what input-otp does) */\n /* -------------------------------------------------------------- */\n\n private setFromInput(raw: string, input: HTMLInputElement): void {\n const clean = sanitizeOtp(raw, this.maxLength, this.pattern || null);\n if (clean !== input.value) {\n input.value = clean;\n input.setSelectionRange(clean.length, clean.length);\n }\n const was = this.current;\n this.dirty = true;\n this.current = clean;\n if (clean !== was && clean.length === this.maxLength) {\n fire<OtpCompleteDetail>(this, \"pont2-complete\", { value: clean });\n }\n this.syncSlots();\n }\n\n private onInput = (e: Event) => {\n this.setFromInput((e.target as HTMLInputElement).value, e.target as HTMLInputElement);\n };\n\n private onPaste = (e: ClipboardEvent) => {\n const input = e.target as HTMLInputElement;\n const text = e.clipboardData?.getData(\"text/plain\");\n if (text == null) return;\n // The native maxlength would truncate \"123-456\" before we could clean it.\n e.preventDefault();\n const start = input.selectionStart ?? input.value.length;\n const end = input.selectionEnd ?? start;\n this.setFromInput(input.value.slice(0, start) + text + input.value.slice(end), input);\n input.dispatchEvent(new Event(\"input\", { bubbles: true, composed: true }));\n };\n\n private placeCaret = () => {\n const input = this.input;\n if (!input) return;\n const n = input.value.length;\n // Full: select the last character so the next key replaces it (input-otp behaviour).\n if (n >= this.maxLength) input.setSelectionRange(this.maxLength - 1, this.maxLength);\n else input.setSelectionRange(n, n);\n this.syncSlots();\n };\n\n private onFocus = () => {\n this.focused = true;\n this.setData(\"focused\", true);\n requestAnimationFrame(this.placeCaret);\n };\n\n private onBlur = () => {\n this.focused = false;\n this.setData(\"focused\", false);\n this.syncSlots();\n };\n\n private onSelectionChange = () => {\n if (this.focused && document.activeElement === this.input) this.syncSlots();\n };\n\n /* -------------------------------------------------------------- */\n /* Render */\n /* -------------------------------------------------------------- */\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.dirty && (changed.has(\"defaultValue\") || !this.hasUpdated)) {\n this.current = sanitizeOtp(this.defaultValue ?? \"\", this.maxLength, this.pattern || null);\n }\n this.setData(\"disabled\", this.disabled);\n this.setData(\"complete\", this.current.length === this.maxLength);\n }\n\n protected override updated(): void {\n this.syncSlots();\n }\n\n override render() {\n const digits = this.pattern === REGEXP_ONLY_DIGITS;\n const f = this.forwarded;\n return html`<div data-pont2-input-otp-input-wrapper>\n <input\n data-pont2-input-otp-input\n data-slot=\"input-otp\"\n id=${this.inputId ?? nothing}\n name=${this.name ?? nothing}\n .value=${live(this.current)}\n maxlength=${this.maxLength}\n pattern=${this.pattern || nothing}\n inputmode=${(this.keyboardMode ?? (digits ? \"numeric\" : \"text\")) as never}\n autocomplete=${this.autocomplete as never}\n spellcheck=\"false\"\n autocapitalize=\"off\"\n ?required=${this.required}\n ?disabled=${this.disabled}\n aria-label=${f[\"aria-label\"] ?? nothing}\n aria-labelledby=${f[\"aria-labelledby\"] ?? nothing}\n aria-describedby=${f[\"aria-describedby\"] ?? nothing}\n aria-invalid=${f[\"aria-invalid\"] ?? nothing}\n @input=${this.onInput}\n @paste=${this.onPaste}\n @focus=${this.onFocus}\n @blur=${this.onBlur}\n @click=${this.placeCaret}\n />\n </div>`;\n }\n}\n\n/**\n * @tag pont2-prim-input-otp-group\n */\nexport class InputOTPGroup extends HostElement {\n static override identity = \"input-otp-group\";\n static override slotName = \"input-otp-group\";\n}\n\n/**\n * Draws one character (and the fake caret). Purely visual: the native input\n * is what assistive technology and autofill interact with.\n *\n * @tag pont2-prim-input-otp-slot\n * @attr index - Character position; defaults to the slot's order in the InputOTP.\n */\nexport class InputOTPSlot extends HostElement {\n static override identity = \"input-otp-slot\";\n static override slotName = \"input-otp-slot\";\n\n static override properties: PropertyDeclarations = {\n state: { state: true },\n };\n\n declare protected state: OtpSlotState;\n\n constructor() {\n super();\n this.state = { char: null, isActive: false, hasFakeCaret: false };\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n (this.closest(ROOT) as InputOTP | null)?.requestUpdate();\n }\n\n /** @internal Called by the InputOTP. */\n sync(state: OtpSlotState, invalid: boolean): void {\n this.state = state;\n this.setData(\"active\", state.isActive ? \"true\" : \"false\");\n this.setData(\"filled\", state.char != null);\n this.setData(\"invalid\", invalid);\n }\n\n override render() {\n const { char, hasFakeCaret } = this.state;\n return html`${char ?? nothing}${hasFakeCaret\n ? html`<div data-pont2-input-otp-caret><div data-pont2-input-otp-caret-line></div></div>`\n : nothing}`;\n }\n}\n\n/**\n * @tag pont2-prim-input-otp-separator\n */\nexport class InputOTPSeparator extends HostElement {\n static override identity = \"input-otp-separator\";\n static override slotName = \"input-otp-separator\";\n static override role = \"separator\";\n\n override render() {\n return icons.minus();\n }\n}\n\ndefine(\"pont2-prim-input-otp\", InputOTP);\ndefine(\"pont2-prim-input-otp-group\", InputOTPGroup);\ndefine(\"pont2-prim-input-otp-slot\", InputOTPSlot);\ndefine(\"pont2-prim-input-otp-separator\", InputOTPSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-input-otp\": InputOTP;\n \"pont2-prim-input-otp-group\": InputOTPGroup;\n \"pont2-prim-input-otp-slot\": InputOTPSlot;\n \"pont2-prim-input-otp-separator\": InputOTPSeparator;\n }\n interface HTMLElementEventMap {\n \"pont2-complete\": CustomEvent<OtpCompleteDetail>;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel } from \"../../core/names\";\n\nexport type ProgressStatus = \"progressing\" | \"complete\" | \"indeterminate\";\n\nconst ROOT = sel(\"progress\");\n\n/**\n * # Progress, ProgressLabel, ProgressValue: Tier 1/2 (status widget)\n *\n * shadcn: `<Progress value>` → Base UI `<Progress.Root>` (div[role=progressbar])\n * holding the author's children, then `<Progress.Track>` > `<Progress.Indicator>`\n * which shadcn always appends. `<ProgressLabel>` / `<ProgressValue>` are optional\n * children (span).\n *\n * pont2:\n * ```\n * pont2-prim-progress[role=progressbar] ← root; aria-value* via ElementInternals\n * pont2-prim-progress-label? pont2-prim-progress-value? ← author-written, never moved\n * div[data-slot=progress-track] > div[data-slot=progress-indicator] ← rendered last, as shadcn does\n * ```\n * Status attributes are Base UI's: `data-progressing` | `data-complete` |\n * `data-indeterminate`, on every part. No `value` attribute = indeterminate.\n *\n * @tag pont2-prim-progress\n * @attr value - Current value; omit for indeterminate.\n * @attr min, max - Range (default 0–100).\n */\nexport class Progress extends HostElement {\n static override identity = \"progress\";\n static override slotName = \"progress\";\n static override role = \"progressbar\";\n\n static override properties: PropertyDeclarations = {\n value: { type: Number },\n min: { type: Number },\n max: { type: Number },\n };\n\n declare value: number | null;\n declare min: number;\n declare max: number;\n\n constructor() {\n super();\n this.value = null;\n this.min = 0;\n this.max = 100;\n }\n\n get status(): ProgressStatus {\n if (this.value == null || Number.isNaN(this.value)) return \"indeterminate\";\n return this.value >= this.max ? \"complete\" : \"progressing\";\n }\n\n /** 0..1, or null when indeterminate. */\n get fraction(): number | null {\n if (this.status === \"indeterminate\") return null;\n const span = this.max - this.min;\n return span > 0 ? Math.min(1, Math.max(0, (this.value! - this.min) / span)) : 0;\n }\n\n /** The value as Base UI formats it by default: a locale percentage. */\n get formattedValue(): string {\n const f = this.fraction;\n return f == null ? \"\" : new Intl.NumberFormat(undefined, { style: \"percent\" }).format(f);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n const status = this.status;\n const i = this.internals;\n i.ariaValueMin = String(this.min);\n i.ariaValueMax = String(this.max);\n i.ariaValueNow = status === \"indeterminate\" ? null : String(this.value);\n i.ariaValueText = status === \"indeterminate\" ? null : this.formattedValue;\n for (const s of [\"progressing\", \"complete\", \"indeterminate\"] as const) this.setData(s, s === status);\n }\n\n protected override updated(): void {\n const labels = this.own<ProgressLabel>(sel(\"progress-label\"));\n if (\"ariaLabelledByElements\" in ElementInternals.prototype) {\n (this.internals as unknown as { ariaLabelledByElements: Element[] | null }).ariaLabelledByElements = labels.length ? labels : null;\n } else if (labels.length && !this.hasAttribute(\"aria-labelledby\")) {\n this.setAttribute(\"aria-labelledby\", labels.map(l => ensureId(l, \"progress-label\")).join(\" \"));\n }\n const parts = [...labels, ...this.own<ProgressValue>(sel(\"progress-value\"))];\n for (const p of parts) if (typeof p.sync === \"function\") p.sync(this.status, this.formattedValue);\n }\n\n private own<T extends Element>(sel: string): T[] {\n return Array.from(this.querySelectorAll<T>(sel)).filter(el => el.closest(ROOT) === this);\n }\n\n override render() {\n const s = this.status;\n const f = this.fraction;\n return html`<div\n data-pont2-progress-track\n data-slot=\"progress-track\"\n ?data-progressing=${s === \"progressing\"}\n ?data-complete=${s === \"complete\"}\n ?data-indeterminate=${s === \"indeterminate\"}\n >\n <div\n data-pont2-progress-indicator\n data-slot=\"progress-indicator\"\n ?data-progressing=${s === \"progressing\"}\n ?data-complete=${s === \"complete\"}\n ?data-indeterminate=${s === \"indeterminate\"}\n style=${f == null ? nothing : styleMap({ insetInlineStart: \"0\", width: `${f * 100}%` })}\n ></div>\n </div>`;\n }\n}\n\n/** Shared status sync for the optional parts. */\nabstract class ProgressPart extends HostElement {\n override connectedCallback(): void {\n super.connectedCallback();\n (this.closest(ROOT) as Progress | null)?.requestUpdate();\n }\n\n /** @internal Called by the root. */\n sync(status: ProgressStatus, _formatted: string): void {\n for (const s of [\"progressing\", \"complete\", \"indeterminate\"] as const) this.setData(s, s === status);\n }\n}\n\n/**\n * Labels the progress bar (the root's accessible name points at it).\n * @tag pont2-prim-progress-label\n */\nexport class ProgressLabel extends ProgressPart {\n static override identity = \"progress-label\";\n static override slotName = \"progress-label\";\n}\n\n/**\n * Shows the formatted value (\"45%\") unless you write your own text inside it.\n * @tag pont2-prim-progress-value\n */\nexport class ProgressValue extends ProgressPart {\n static override identity = \"progress-value\";\n static override slotName = \"progress-value\";\n\n static override properties: PropertyDeclarations = {\n formatted: { state: true },\n };\n\n declare protected formatted: string;\n private authored = false;\n\n constructor() {\n super();\n this.formatted = \"\";\n }\n\n override connectedCallback(): void {\n // Author text wins (Base UI's `children`); decided once, before the first render.\n if (!this.hasUpdated) this.authored = (this.textContent ?? \"\").trim() !== \"\";\n super.connectedCallback();\n this.setAttribute(\"aria-hidden\", this.getAttribute(\"aria-hidden\") ?? \"true\");\n }\n\n override sync(status: ProgressStatus, formatted: string): void {\n super.sync(status, formatted);\n this.formatted = formatted;\n }\n\n override render() {\n return this.authored ? nothing : this.formatted;\n }\n}\n\ndefine(\"pont2-prim-progress\", Progress);\ndefine(\"pont2-prim-progress-label\", ProgressLabel);\ndefine(\"pont2-prim-progress-value\", ProgressValue);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-progress\": Progress;\n \"pont2-prim-progress-label\": ProgressLabel;\n \"pont2-prim-progress-value\": ProgressValue;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { RovingFocusController, type Orientation } from \"../../core/controllers/roving-focus\";\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement, type ValidityResult } from \"../../core/form-control\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define, sel } from \"../../core/names\";\n\n/**\n * # RadioGroup, RadioGroupItem: Tier 2 (widgets)\n *\n * shadcn: `<RadioGroup>` → Base UI `<RadioGroup>` (`<div role=\"radiogroup\">`\n * plus a hidden input) and `<RadioGroupItem value>` → Base UI `<Radio.Root>`\n * (`<span role=\"radio\">`) > `<Radio.Indicator>` > `<span>` (the dot).\n *\n * pont2:\n * ```\n * pont2-prim-radio-group[role=radiogroup] ← form-associated: submits name=value\n * pont2-prim-radio-group-item[role=radio] ← author-written, never moved\n * span[data-slot=radio-group-indicator] ← rendered while checked\n * span[data-pont2-radio-group-indicator-icon]\n * ```\n *\n * The group owns the value, the form value, validity and the roving tab stop.\n * Items are independent stateful widgets nested inside it, which is the one\n * kind of nesting the architecture keeps (04-composition.md); they find their\n * group with `closest()` and report presses to it. Items are also\n * form-associated (submitting nothing) purely so that they are *labelable*:\n * shadcn's `<RadioGroupItem id=\"r1\"/><Label htmlFor=\"r1\">` works unchanged.\n *\n * Keyboard (Base UI / APG): Tab enters at the checked item (or the first),\n * arrows move focus **and select** (wrapping), Space selects the focused item.\n */\nexport class RadioGroup extends FormControlElement {\n static override identity = \"radio-group\";\n static override slotName = \"radio-group\";\n static override role = \"radiogroup\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n orientation: { type: String },\n };\n\n /** The selected item's value; `\"\"` when nothing is selected. */\n declare value: string;\n /** Arrow-key axis. Base UI accepts both axes by default. */\n declare orientation: Orientation | undefined;\n\n private roving = new RovingFocusController(this, {\n items: () => this.items,\n orientation: () => this.orientation ?? \"both\",\n onNavigate: item => this.selectItem(item as RadioGroupItem),\n });\n\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.value = \"\";\n }\n\n /** The items that belong to this group (not to a nested group). */\n get items(): RadioGroupItem[] {\n return Array.from(this.querySelectorAll<RadioGroupItem>(sel(\"radio-group-item\"))).filter(\n i => i.closest(sel(\"radio-group\")) === this,\n );\n }\n\n protected override get hostFocusable(): boolean {\n return false;\n }\n\n protected override get validationAnchor(): HTMLElement | undefined {\n return this.items[0];\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, subtree: true });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n /** Called by an item when it is pressed. */\n selectItem(item: RadioGroupItem): void {\n if (this.isDisabled || this.readOnly || item.disabled) return;\n if (item.value === this.value) return;\n this.value = item.value;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n /** Called by items when they connect, so a late-upgrading item is synced. */\n itemsChanged(): void {\n this.requestUpdate();\n }\n\n protected formValue() {\n return this.value || null;\n }\n\n protected resetToDefault(): void {\n this.value = this.getAttribute(\"value\") ?? \"\";\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n if (typeof state === \"string\") this.value = state;\n }\n\n protected override validate(): ValidityResult | null {\n return this.required && !this.value\n ? { flags: { valueMissing: true }, message: \"Please select one of these options.\" }\n : null;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.internals.ariaOrientation = this.orientation === \"horizontal\" || this.orientation === \"vertical\" ? this.orientation : null;\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n const disabled = this.isDisabled;\n let checked: RadioGroupItem | null = null;\n for (const item of this.items) {\n item.checked = !!this.value && item.value === this.value;\n item.groupDisabled = disabled;\n item.groupReadOnly = this.readOnly;\n item.groupRequired = this.required;\n if (item.checked) checked = item;\n }\n this.roving.sync(checked);\n }\n}\n\n/**\n * @tag pont2-prim-radio-group-item\n * @attr value - The value the group takes when this item is selected.\n * @attr disabled\n */\nexport class RadioGroupItem extends HostElement {\n static formAssociated = true;\n static override identity = \"radio-group-item\";\n static override slotName = \"radio-group-item\";\n static override role = \"radio\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n checked: { state: true },\n groupDisabled: { state: true },\n groupReadOnly: { state: true },\n groupRequired: { state: true },\n formDisabled: { state: true },\n };\n\n declare value: string;\n declare disabled: boolean;\n declare checked: boolean;\n declare groupDisabled: boolean;\n declare groupReadOnly: boolean;\n declare groupRequired: boolean;\n declare protected formDisabled: boolean;\n\n constructor() {\n super();\n this.value = \"\";\n this.disabled = false;\n this.checked = false;\n this.groupDisabled = false;\n this.groupReadOnly = false;\n this.groupRequired = false;\n this.formDisabled = false;\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n }\n\n get group(): RadioGroup | null {\n return this.closest(sel(\"radio-group\")) as RadioGroup | null;\n }\n\n get isDisabled(): boolean {\n return this.disabled || this.groupDisabled || this.formDisabled;\n }\n\n get labels(): NodeList {\n return this.internals.labels;\n }\n\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.group?.itemsChanged();\n }\n\n private onClick = (e: MouseEvent) => {\n if (this.isDisabled) {\n e.preventDefault();\n return;\n }\n this.group?.selectItem(this);\n // A press focuses the item, as a native radio does (also when it came from a <label>).\n if (document.activeElement !== this) this.focus();\n };\n\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.target !== this) return;\n if (e.key === \" \") {\n e.preventDefault();\n this.click();\n }\n // Enter does not select a radio (native behaviour); it would submit the form natively,\n // so mirror that through the form's implicit submission.\n if (e.key === \"Enter\") this.internals.form?.requestSubmit();\n };\n\n protected override willUpdate(): void {\n const disabled = this.isDisabled;\n this.internals.ariaChecked = String(this.checked);\n this.internals.ariaDisabled = disabled ? \"true\" : null;\n this.internals.ariaReadOnly = this.groupReadOnly ? \"true\" : null;\n this.internals.ariaRequired = this.groupRequired ? \"true\" : null;\n this.setData(\"checked\", this.checked);\n this.setData(\"unchecked\", !this.checked);\n this.setData(\"disabled\", disabled);\n this.setData(\"readonly\", this.groupReadOnly);\n this.setData(\"required\", this.groupRequired);\n this.setState(\"checked\", this.checked);\n // The group decides the tab stop; a disabled item is never one.\n if (disabled) this.tabIndex = -1;\n else if (!this.hasAttribute(\"tabindex\")) this.tabIndex = -1;\n }\n\n override render() {\n if (!this.checked) return nothing;\n return html`<span data-pont2-radio-group-indicator data-slot=\"radio-group-indicator\" data-checked\n ><span data-pont2-radio-group-indicator-icon></span\n ></span>`;\n }\n}\n\ndefine(\"pont2-prim-radio-group\", RadioGroup);\ndefine(\"pont2-prim-radio-group-item\", RadioGroupItem);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-radio-group\": RadioGroup;\n \"pont2-prim-radio-group-item\": RadioGroupItem;\n }\n}\n","/**\n * Pure slider maths (no DOM), shared by <pont2-prim-slider> and unit-tested in node.\n * Mirrors Base UI's Slider value handling: values are clamped to [min, max],\n * snapped to `step` measured from `min`, and in a range slider a thumb can\n * neither cross nor come closer than `minStepsBetweenValues * step` to its\n * neighbours.\n */\n\nexport interface SliderRange {\n min: number;\n max: number;\n step: number;\n}\n\nexport const clamp = (v: number, min: number, max: number) => Math.min(max, Math.max(min, v));\n\n/** Decimal places of a number, so 0.1 + 0.2 snaps to 0.3 rather than 0.30000000000000004. */\nexport function decimals(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const s = String(n);\n if (s.includes(\"e-\")) return Number(s.split(\"e-\")[1]);\n const i = s.indexOf(\".\");\n return i < 0 ? 0 : s.length - i - 1;\n}\n\nexport function snap(value: number, { min, max, step }: SliderRange): number {\n if (!(step > 0)) return clamp(value, min, max);\n const snapped = Math.round((value - min) / step) * step + min;\n const d = Math.max(decimals(step), decimals(min));\n return clamp(Number(snapped.toFixed(d)), min, max);\n}\n\n/** 0..1 position of a value along the track. */\nexport function fraction(value: number, { min, max }: Pick<SliderRange, \"min\" | \"max\">): number {\n if (max <= min) return 0;\n return clamp((value - min) / (max - min), 0, 1);\n}\n\n/** Value at a 0..1 position along the track (before snapping). */\nexport function valueAt(f: number, { min, max }: Pick<SliderRange, \"min\" | \"max\">): number {\n return min + clamp(f, 0, 1) * (max - min);\n}\n\n/** Index of the thumb a pointer press at `value` should grab. Ties go to the later thumb when pressing above it. */\nexport function closestThumb(values: number[], value: number): number {\n let best = 0;\n let bestDist = Infinity;\n values.forEach((v, i) => {\n const d = Math.abs(v - value);\n if (d < bestDist || (d === bestDist && value > v)) {\n best = i;\n bestDist = d;\n }\n });\n return best;\n}\n\n/**\n * Sets thumb `index` to `value`, keeping the values ordered: the thumb is\n * clamped between its neighbours (Base UI's default \"none\" collision\n * behaviour), `minSteps` steps apart.\n */\nexport function setThumb(\n values: number[],\n index: number,\n value: number,\n range: SliderRange,\n minSteps = 0,\n): number[] {\n const gap = minSteps * range.step;\n const lo = index > 0 ? values[index - 1] + gap : range.min;\n const hi = index < values.length - 1 ? values[index + 1] - gap : range.max;\n const next = values.slice();\n next[index] = clamp(snap(value, range), lo, hi);\n return next;\n}\n\nexport type SliderKey = \"ArrowUp\" | \"ArrowDown\" | \"ArrowLeft\" | \"ArrowRight\" | \"PageUp\" | \"PageDown\" | \"Home\" | \"End\";\n\n/**\n * The value a key press moves a thumb to (APG slider pattern).\n * `rtl` flips Left/Right for horizontal sliders. Shift+Arrow moves by `largeStep`.\n */\nexport function keyValue(\n key: string,\n current: number,\n range: SliderRange & { largeStep: number },\n opts: { shift?: boolean; rtl?: boolean; vertical?: boolean } = {},\n): number | null {\n const small = opts.shift ? range.largeStep : range.step;\n const flip = opts.rtl && !opts.vertical ? -1 : 1;\n switch (key) {\n case \"ArrowUp\":\n return current + small;\n case \"ArrowDown\":\n return current - small;\n case \"ArrowRight\":\n return current + small * flip;\n case \"ArrowLeft\":\n return current - small * flip;\n case \"PageUp\":\n return current + range.largeStep;\n case \"PageDown\":\n return current - range.largeStep;\n case \"Home\":\n return range.min;\n case \"End\":\n return range.max;\n default:\n return null;\n }\n}\n\n/** Parses `value=\"25\"` or `value=\"25, 75\"` (the default value attribute). */\nexport function parseValues(attr: string | null | undefined, fallback: number): number[] {\n if (attr == null || attr.trim() === \"\") return [fallback];\n const out = attr\n .split(\",\")\n .map(s => Number(s.trim()))\n .filter(n => Number.isFinite(n));\n return out.length ? out.sort((a, b) => a - b) : [fallback];\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nimport { directionOf } from \"../../core/controllers/roving-focus\";\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement } from \"../../core/form-control\";\nimport { ensureId } from \"../../core/ids\";\nimport { define } from \"../../core/names\";\nimport { closestThumb, fraction, keyValue, parseValues, setThumb, valueAt, type SliderRange } from \"./slider-math\";\n\nexport type SliderOrientation = \"horizontal\" | \"vertical\";\n\n/**\n * # Slider: Tier 2 (widget, form-associated)\n *\n * shadcn: `<Slider defaultValue min max>` → Base UI\n * ```\n * Slider.Root div[data-slot=slider][data-orientation]\n * Control div\n * Track div[data-slot=slider-track]\n * Indicator div[data-slot=slider-range]\n * Thumb ×n div[data-slot=slider-thumb] > input[type=range] (the input carries role=slider)\n * ```\n * pont2:\n * ```\n * pont2-prim-slider ← root, form-associated (submits name=value per thumb)\n * div[data-slot=slider-control]\n * div[data-slot=slider-track] > div[data-slot=slider-range]\n * div[data-slot=slider-thumb][role=slider] ×n\n * ```\n * The thumbs carry `role=\"slider\"` and the ARIA values themselves, so Base UI's\n * per-thumb hidden `<input type=\"range\">` is not needed (one node fewer per\n * thumb); the root is the form control. Everything inside the root is\n * rendered by the slider (shadcn's Slider takes no children either).\n *\n * Single value: `value=\"40\"`. Range: `value=\"20, 80\"` (one thumb per value).\n * With no value, one thumb at `min`. Thumbs never cross.\n *\n * Keyboard (APG / Base UI): ←/↓ −step, →/↑ +step (← and → swap in RTL),\n * Shift+arrow and PageUp/PageDown ±largeStep, Home/End min/max.\n * Pointer: press anywhere on the control moves the closest thumb, then drags.\n *\n * @tag pont2-prim-slider\n * @attr value - Default value(s), comma-separated for a range. `.value` / `.values` are live.\n * @attr min, max, step, large-step, min-steps-between-values\n * @attr orientation - horizontal (default) | vertical\n * @attr name, disabled, readonly\n * @fires input - While the value changes (keyboard or drag).\n * @fires change - When a change is committed (key press, pointer release). Base UI `onValueCommitted`.\n */\nexport class Slider extends FormControlElement {\n static override identity = \"slider\";\n static override slotName = \"slider\";\n\n static override properties: PropertyDeclarations = {\n defaultValue: { type: String, attribute: \"value\" },\n min: { type: Number },\n max: { type: Number },\n step: { type: Number },\n largeStep: { type: Number, attribute: \"large-step\" },\n minStepsBetweenValues: { type: Number, attribute: \"min-steps-between-values\" },\n orientation: { type: String, reflect: true },\n values: { attribute: false },\n activeThumb: { state: true },\n };\n\n declare defaultValue: string | null;\n declare min: number;\n declare max: number;\n declare step: number;\n declare largeStep: number;\n declare minStepsBetweenValues: number;\n declare orientation: SliderOrientation;\n /** Live values, ascending; one per thumb. */\n declare values: number[];\n declare protected activeThumb: number;\n\n private dirty = false;\n private dragging = -1;\n\n constructor() {\n super();\n this.defaultValue = null;\n this.min = 0;\n this.max = 100;\n this.step = 1;\n this.largeStep = 10;\n this.minStepsBetweenValues = 0;\n this.orientation = \"horizontal\";\n this.values = [0];\n this.activeThumb = -1;\n }\n\n /** A number for a single-thumb slider, an array for a range (Base UI's shape). */\n get value(): number | number[] {\n return this.values.length === 1 ? this.values[0] : this.values.slice();\n }\n set value(v: number | number[]) {\n this.dirty = true;\n const arr = Array.isArray(v) ? v.slice() : [v];\n this.values = arr.map(n => setThumb([n], 0, n, this.range)[0]).sort((a, b) => a - b);\n }\n\n private get range(): SliderRange {\n return { min: this.min, max: this.max, step: this.step };\n }\n\n protected override get hostFocusable(): boolean {\n return false;\n }\n\n protected override get validationAnchor(): HTMLElement | undefined {\n return this.thumbs[0];\n }\n\n private get thumbs(): HTMLElement[] {\n return Array.from(this.querySelectorAll<HTMLElement>(\":scope > [data-slot=slider-control] > [data-slot=slider-thumb]\"));\n }\n\n private get control(): HTMLElement | null {\n return this.querySelector(\":scope > [data-slot=slider-control]\");\n }\n\n /* -------------------------------------------------------------- */\n /* Form */\n /* -------------------------------------------------------------- */\n\n protected formValue() {\n if (!this.name) return null;\n if (this.values.length === 1) return String(this.values[0]);\n const fd = new FormData();\n for (const v of this.values) fd.append(this.name, String(v));\n return fd;\n }\n\n protected resetToDefault(): void {\n this.dirty = false;\n this.values = this.initialValues();\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n if (typeof state === \"string\") this.value = Number(state);\n else if (state instanceof FormData) this.value = state.getAll(this.name).map(Number);\n }\n\n private initialValues(): number[] {\n return parseValues(this.defaultValue, this.min).map(v => setThumb([v], 0, v, this.range)[0]);\n }\n\n /* -------------------------------------------------------------- */\n /* Interaction */\n /* -------------------------------------------------------------- */\n\n private commit(index: number, raw: number, final: boolean): void {\n const next = setThumb(this.values, index, raw, this.range, this.minStepsBetweenValues);\n const changed = next[index] !== this.values[index];\n if (changed) {\n this.dirty = true;\n this.values = next;\n fireNative(this, \"input\");\n }\n if (final && (changed || this.dragging >= 0)) fireNative(this, \"change\");\n }\n\n private onKeyDown = (e: KeyboardEvent, index: number) => {\n if (this.isDisabled || this.readOnly) return;\n const vertical = this.orientation === \"vertical\";\n const v = keyValue(e.key, this.values[index], { ...this.range, largeStep: this.largeStep }, {\n shift: e.shiftKey,\n rtl: directionOf(this) === \"rtl\",\n vertical,\n });\n if (v == null) return;\n e.preventDefault();\n this.commit(index, v, true);\n };\n\n private valueFromPointer(e: PointerEvent): number {\n const rect = this.control!.getBoundingClientRect();\n const thumb = this.thumbs[0]?.getBoundingClientRect();\n // thumbAlignment=\"edge\": thumbs travel within the control, inset by half a thumb at each end.\n if (this.orientation === \"vertical\") {\n const t = thumb?.height ?? 0;\n return valueAt(1 - (e.clientY - rect.top - t / 2) / Math.max(1, rect.height - t), this.range);\n }\n const t = thumb?.width ?? 0;\n let f = (e.clientX - rect.left - t / 2) / Math.max(1, rect.width - t);\n if (directionOf(this) === \"rtl\") f = 1 - f;\n return valueAt(f, this.range);\n }\n\n private onPointerDown = (e: PointerEvent) => {\n if (this.isDisabled || this.readOnly || e.button !== 0) return;\n const control = this.control!;\n const raw = this.valueFromPointer(e);\n const onThumb = (e.target as HTMLElement).closest?.(\"[data-slot=slider-thumb]\") as HTMLElement | null;\n const index = onThumb ? this.thumbs.indexOf(onThumb) : closestThumb(this.values, raw);\n this.dragging = index;\n this.activeThumb = index;\n control.setPointerCapture(e.pointerId);\n e.preventDefault();\n this.thumbs[index]?.focus({ preventScroll: true });\n if (!onThumb) this.commit(index, raw, false);\n };\n\n private onPointerMove = (e: PointerEvent) => {\n if (this.dragging < 0) return;\n this.commit(this.dragging, this.valueFromPointer(e), false);\n };\n\n private onPointerUp = (e: PointerEvent) => {\n if (this.dragging < 0) return;\n this.control?.releasePointerCapture(e.pointerId);\n this.commit(this.dragging, this.values[this.dragging], true);\n this.dragging = -1;\n this.activeThumb = -1;\n };\n\n /* -------------------------------------------------------------- */\n /* Render */\n /* -------------------------------------------------------------- */\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n if (!this.dirty && (changed.has(\"defaultValue\") || changed.has(\"min\") || changed.has(\"max\") || !this.hasUpdated)) {\n this.values = this.initialValues();\n }\n this.setData(\"orientation\", this.orientation === \"vertical\" ? \"vertical\" : \"horizontal\");\n this.setData(\"dragging\", this.dragging >= 0);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n // Label the thumbs: <label for=\"slider-id\"> labels the root (it is form-associated);\n // the thumbs, which hold the focus, are labelled by the same elements.\n const labels = Array.from(this.labels) as HTMLElement[];\n const ids = labels.map(l => ensureId(l, \"slider-label\")).join(\" \");\n for (const t of this.thumbs) {\n if (ids) t.setAttribute(\"aria-labelledby\", ids);\n else t.removeAttribute(\"aria-labelledby\");\n }\n }\n\n override render() {\n const vertical = this.orientation === \"vertical\";\n const o = vertical ? \"vertical\" : \"horizontal\";\n const disabled = this.isDisabled;\n const fr = this.values.map(v => fraction(v, this.range));\n const thumbPos = (f: number) => `calc(${f} * (100% - var(--_pont2-slider-thumb)))`;\n const start = this.values.length > 1 ? fr[0] : 0;\n const end = fr[fr.length - 1];\n // Range: between thumb centres; single: from the start to the thumb centre.\n const rangeStyle = vertical\n ? { bottom: this.values.length > 1 ? `calc(${thumbPos(start)} + var(--_pont2-slider-thumb) / 2)` : \"0\", top: `calc(100% - ${thumbPos(end)} - var(--_pont2-slider-thumb) / 2)` }\n : { insetInlineStart: this.values.length > 1 ? `calc(${thumbPos(start)} + var(--_pont2-slider-thumb) / 2)` : \"0\", insetInlineEnd: `calc(100% - ${thumbPos(end)} - var(--_pont2-slider-thumb) / 2)` };\n const label = this.getAttribute(\"aria-label\");\n const names = this.values.length === 2 ? [\"Minimum\", \"Maximum\"] : [];\n\n return html`<div\n data-pont2-slider-control\n data-slot=\"slider-control\"\n data-orientation=${o}\n ?data-disabled=${disabled}\n @pointerdown=${this.onPointerDown}\n @pointermove=${this.onPointerMove}\n @pointerup=${this.onPointerUp}\n @pointercancel=${this.onPointerUp}\n >\n <div data-pont2-slider-track data-slot=\"slider-track\" data-orientation=${o} ?data-disabled=${disabled}>\n <div data-pont2-slider-range data-slot=\"slider-range\" data-orientation=${o} ?data-disabled=${disabled} style=${styleMap(rangeStyle)}></div>\n </div>\n ${repeat(\n this.values,\n (_v, i) => i,\n (v, i) => html`<div\n data-pont2-slider-thumb\n data-slot=\"slider-thumb\"\n data-index=${i}\n data-orientation=${o}\n ?data-disabled=${disabled}\n ?data-dragging=${this.activeThumb === i}\n role=\"slider\"\n tabindex=${disabled ? -1 : 0}\n aria-valuemin=${this.min}\n aria-valuemax=${this.max}\n aria-valuenow=${v}\n aria-orientation=${o}\n aria-disabled=${disabled ? \"true\" : \"false\"}\n aria-label=${label ? (names[i] ? `${label} ${names[i].toLowerCase()}` : label) : (names[i] ?? nothing)}\n style=${styleMap(vertical ? { bottom: thumbPos(fr[i]) } : { insetInlineStart: thumbPos(fr[i]) })}\n @keydown=${(e: KeyboardEvent) => this.onKeyDown(e, i)}\n ></div>`,\n )}\n </div>`;\n }\n}\n\ndefine(\"pont2-prim-slider\", Slider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-slider\": Slider;\n }\n}\n","import { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement, type ValidityResult } from \"../../core/form-control\";\nimport { define } from \"../../core/names\";\n\nexport type SwitchSize = \"default\" | \"sm\";\n\n/**\n * # Switch: Tier 2 (widget, form-associated)\n *\n * shadcn: `<Switch size>` → Base UI `<Switch.Root>` (`<span role=\"switch\">`\n * plus a hidden `<input type=\"checkbox\">`) > `<Switch.Thumb>` (`<span>`).\n *\n * pont2: the host **is** the `role=\"switch\"` root and a form-associated\n * custom element (no hidden input); it renders only the thumb.\n *\n * ```\n * shadcn/Base UI: span[role=switch][data-slot=switch] > span[data-slot=switch-thumb] + input[hidden]\n * pont2: pont2-prim-switch > span[data-slot=switch-thumb]\n * ```\n *\n * State attributes (Base UI): `data-checked` | `data-unchecked`, `data-disabled`,\n * `data-readonly`, `data-required`, on the root and the thumb. `data-size`\n * is shadcn's.\n *\n * @tag pont2-prim-switch\n * @attr checked - Initial state (`defaultChecked`); `.checked` is the live state.\n * @attr size - default | sm\n * @attr name, value, unchecked-value, disabled, required, readonly\n * @fires input - The state changed through interaction.\n * @fires change - Same moment as `input`, like a native checkbox.\n */\nexport class Switch extends FormControlElement {\n static override identity = \"switch\";\n static override slotName = \"switch\";\n static override role = \"switch\";\n\n static override properties: PropertyDeclarations = {\n checked: { type: Boolean },\n size: { type: String, reflect: true },\n value: { type: String },\n uncheckedValue: { type: String, attribute: \"unchecked-value\" },\n };\n\n declare checked: boolean;\n declare size: SwitchSize;\n declare value: string;\n declare uncheckedValue: string | undefined;\n\n constructor() {\n super();\n this.checked = false;\n this.size = \"default\";\n this.value = \"on\";\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"keyup\", this.onKeyUp);\n }\n\n /** Toggle as if the user clicked (fires input/change). */\n toggle(): void {\n if (this.isDisabled || this.readOnly) return;\n this.checked = !this.checked;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n protected formValue() {\n return this.checked ? this.value : (this.uncheckedValue ?? null);\n }\n\n protected resetToDefault(): void {\n this.checked = this.hasAttribute(\"checked\");\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n this.checked = state === this.value;\n }\n\n protected override validate(): ValidityResult | null {\n return this.required && !this.checked\n ? { flags: { valueMissing: true }, message: \"Please turn this on if you want to proceed.\" }\n : null;\n }\n\n private onClick = (e: MouseEvent) => {\n if (this.isDisabled || this.readOnly) {\n e.preventDefault();\n return;\n }\n this.toggle();\n };\n\n // Base UI's switch behaves like a button: Enter activates on keydown, Space on keyup.\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.target !== this) return;\n if (e.key === \" \") e.preventDefault();\n if (e.key === \"Enter\") {\n e.preventDefault();\n this.click();\n }\n };\n private onKeyUp = (e: KeyboardEvent) => {\n if (e.key === \" \" && e.target === this) this.click();\n };\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.internals.ariaChecked = String(this.checked);\n this.setData(\"checked\", this.checked);\n this.setData(\"unchecked\", !this.checked);\n this.setData(\"size\", this.size === \"sm\" ? \"sm\" : \"default\");\n this.setState(\"checked\", this.checked);\n }\n\n override render() {\n return html`<span\n data-pont2-switch-thumb\n data-slot=\"switch-thumb\"\n ?data-checked=${this.checked}\n ?data-unchecked=${!this.checked}\n ?data-disabled=${this.isDisabled}\n ></span>`;\n }\n}\n\ndefine(\"pont2-prim-switch\", Switch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-switch\": Switch;\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { RovingFocusController, type Orientation } from \"../../core/controllers/roving-focus\";\nimport { fireNative } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel } from \"../../core/names\";\n\nexport type TabsOrientation = \"horizontal\" | \"vertical\";\nexport type TabsListVariant = \"default\" | \"line\";\ntype ActivationDirection = \"left\" | \"right\" | \"up\" | \"down\" | \"none\";\n\nconst ROOT = sel(\"tabs\");\nconst TRIGGER = sel(\"tabs-trigger\");\nconst PANEL = sel(\"tabs-content\");\n\n/**\n * Wires an IDREF relation through ElementInternals when the engine supports\n * element reflection there, so no author-facing attribute is written; falls\n * back to the plain attribute (with generated ids) otherwise.\n */\nfunction relate(internals: ElementInternals, host: HTMLElement, prop: \"ariaControlsElements\" | \"ariaLabelledByElements\", attr: string, targets: Element[]) {\n if (prop in ElementInternals.prototype) {\n (internals as unknown as Record<string, Element[] | null>)[prop] = targets.length ? targets : null;\n } else if (targets.length) {\n host.setAttribute(attr, targets.map(t => ensureId(t, \"tabs\")).join(\" \"));\n } else {\n host.removeAttribute(attr);\n }\n}\n\n/**\n * # Tabs, TabsList, TabsTrigger, TabsContent: Tier 2 (widgets)\n *\n * shadcn: `<Tabs>` → Base UI `<Tabs.Root>` (div) > `<Tabs.List>` (div[role=tablist])\n * > `<Tabs.Tab>` (button[role=tab]) …, and `<Tabs.Panel>` (div[role=tabpanel]).\n *\n * pont2: every part is host-as-root, written by the author and never moved:\n * ```\n * pont2-prim-tabs[data-orientation]\n * pont2-prim-tabs-list[role=tablist][data-variant]\n * pont2-prim-tabs-trigger[role=tab][value] ×n (data-active on the active one)\n * pont2-prim-tabs-content[role=tabpanel][value] ×n (hidden unless active)\n * ```\n * The root owns the value; triggers and panels are matched by `value`.\n * ARIA relations (`aria-controls`, `aria-labelledby`) are wired through\n * ElementInternals, so the author's markup is not rewritten.\n *\n * Keyboard (Base UI / APG): the list is one tab stop (roving tabindex);\n * arrows along the orientation move focus (wrapping), Home/End jump, and\n * Enter/Space activate. With `activate-on-focus` on the list, moving focus\n * also activates (Base UI default: off).\n *\n * @tag pont2-prim-tabs\n * @attr value - The default active tab value; `.value` is live. Defaults to the first enabled trigger.\n * @attr orientation - horizontal (default) | vertical\n * @fires input, change - The active tab changed through interaction.\n */\nexport class Tabs extends HostElement {\n static override identity = \"tabs\";\n static override slotName = \"tabs\";\n\n static override properties: PropertyDeclarations = {\n defaultValue: { type: String, attribute: \"value\" },\n orientation: { type: String, reflect: true },\n current: { state: true },\n };\n\n declare defaultValue: string | null;\n declare orientation: TabsOrientation;\n declare protected current: string;\n\n /** The active tab's value. Setting it activates that tab without firing events. */\n get value(): string {\n return this.current;\n }\n set value(v: string) {\n this.dirty = true;\n this.current = v;\n }\n\n private dirty = false;\n private direction: ActivationDirection = \"none\";\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.defaultValue = null;\n this.orientation = \"horizontal\";\n this.current = \"\";\n }\n\n get triggers(): TabsTrigger[] {\n return this.own<TabsTrigger>(TRIGGER);\n }\n get panels(): TabsContent[] {\n return this.own<TabsContent>(PANEL);\n }\n get lists(): TabsList[] {\n return this.own<TabsList>(sel(\"tabs-list\"));\n }\n\n private own<T extends Element>(sel: string): T[] {\n return Array.from(this.querySelectorAll<T>(sel)).filter(el => el.closest(ROOT) === this);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: [\"value\", \"disabled\"] });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n /** Activate a trigger as the user would (fires input/change). */\n select(trigger: TabsTrigger): void {\n if (trigger.disabled || trigger.value === this.value) return;\n const triggers = this.triggers;\n const from = triggers.findIndex(t => t.value === this.value);\n const to = triggers.indexOf(trigger);\n const vertical = this.orientation === \"vertical\";\n this.direction = from < 0 || to === from ? \"none\" : to > from ? (vertical ? \"down\" : \"right\") : vertical ? \"up\" : \"left\";\n this.value = trigger.value;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.dirty && (changed.has(\"defaultValue\") || !this.hasUpdated)) {\n this.current = this.defaultValue ?? \"\";\n }\n }\n\n protected override updated(): void {\n const o = this.orientation === \"vertical\" ? \"vertical\" : \"horizontal\";\n const triggers = this.triggers;\n const panels = this.panels;\n // No (matching) value: fall back to the first enabled trigger, like Base UI.\n let value = this.current;\n if (!triggers.some(t => t.getAttribute(\"value\") === value)) {\n value = triggers.find(t => !t.hasAttribute(\"disabled\"))?.getAttribute(\"value\") ?? \"\";\n }\n\n this.setData(\"orientation\", o);\n this.setData(\"activation-direction\", this.direction);\n // Parts that have not upgraded yet are skipped; they request an update on connect.\n const ready = (el: Element) => typeof (el as TabsTrigger).sync === \"function\";\n for (const list of this.lists) if (ready(list)) list.sync(o, this.direction);\n\n let active: TabsTrigger | null = null;\n for (const t of triggers) {\n const on = t.getAttribute(\"value\") === value;\n const panel = panels.find(p => p.getAttribute(\"value\") === t.getAttribute(\"value\")) ?? null;\n if (ready(t)) t.sync(on, o, panel);\n if (on) active = t;\n }\n for (const p of panels) {\n const trigger = triggers.find(t => t.getAttribute(\"value\") === p.getAttribute(\"value\")) ?? null;\n if (ready(p)) p.sync(p.getAttribute(\"value\") === value, o, trigger);\n }\n for (const list of this.lists) if (ready(list)) list.focusSync(active);\n }\n}\n\n/**\n * @tag pont2-prim-tabs-list\n * @attr variant - default | line\n * @attr activate-on-focus - Arrow-key focus also activates the tab (Base UI `activateOnFocus`).\n * @attr loop - Set `loop=\"false\"` to stop focus wrapping (Base UI `loopFocus`).\n */\nexport class TabsList extends HostElement {\n static override identity = \"tabs-list\";\n static override slotName = \"tabs-list\";\n static override role = \"tablist\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n activateOnFocus: { type: Boolean, attribute: \"activate-on-focus\" },\n loop: { type: String },\n };\n\n declare variant: TabsListVariant;\n declare activateOnFocus: boolean;\n declare loop: string | null;\n\n private orientation: Orientation = \"horizontal\";\n\n private roving = new RovingFocusController(this, {\n items: () => this.root?.triggers.filter(t => this.contains(t)) ?? [],\n orientation: () => this.orientation,\n loop: () => this.loop !== \"false\",\n onNavigate: item => {\n if (this.activateOnFocus) this.root?.select(item as TabsTrigger);\n },\n });\n\n constructor() {\n super();\n this.variant = \"default\";\n this.activateOnFocus = false;\n this.loop = null;\n }\n\n get root(): Tabs | null {\n return this.closest(ROOT) as Tabs | null;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.root?.requestUpdate();\n }\n\n /** @internal Called by the root. */\n sync(orientation: TabsOrientation, direction: ActivationDirection): void {\n this.orientation = orientation;\n this.internals.ariaOrientation = orientation;\n this.setData(\"orientation\", orientation);\n this.setData(\"activation-direction\", direction);\n }\n\n /** @internal Called by the root. */\n focusSync(active: HTMLElement | null): void {\n // Keep the roving stop on the focused tab while the user is navigating.\n const focused = this.root?.triggers.find(t => t === document.activeElement);\n this.roving.sync(focused ?? active);\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant === \"line\" ? \"line\" : \"default\");\n }\n}\n\n/**\n * @tag pont2-prim-tabs-trigger\n * @attr value - Identifies the tab and its panel.\n * @attr disabled\n */\nexport class TabsTrigger extends HostElement {\n static override identity = \"tabs-trigger\";\n static override slotName = \"tabs-trigger\";\n static override role = \"tab\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare value: string;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.value = \"\";\n this.disabled = false;\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n }\n\n get root(): Tabs | null {\n return this.closest(ROOT) as Tabs | null;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.root?.requestUpdate();\n }\n\n private onClick = () => {\n if (!this.disabled) this.root?.select(this);\n };\n\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.target !== this || this.disabled) return;\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this.root?.select(this);\n }\n };\n\n /** @internal Called by the root. */\n sync(active: boolean, orientation: TabsOrientation, panel: Element | null): void {\n this.internals.ariaSelected = String(active);\n this.internals.ariaDisabled = this.disabled ? \"true\" : null;\n relate(this.internals, this, \"ariaControlsElements\", \"aria-controls\", panel ? [panel] : []);\n this.setData(\"active\", active);\n this.setData(\"disabled\", this.disabled);\n this.setData(\"orientation\", orientation);\n this.setState(\"active\", active);\n }\n}\n\n/**\n * @tag pont2-prim-tabs-content\n * @attr value - The trigger value this panel belongs to.\n */\nexport class TabsContent extends HostElement {\n static override identity = \"tabs-content\";\n static override slotName = \"tabs-content\";\n static override role = \"tabpanel\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n };\n\n declare value: string;\n\n constructor() {\n super();\n this.value = \"\";\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n (this.closest(ROOT) as Tabs | null)?.requestUpdate();\n }\n\n /** @internal Called by the root. */\n sync(active: boolean, orientation: TabsOrientation, trigger: Element | null): void {\n relate(this.internals, this, \"ariaLabelledByElements\", \"aria-labelledby\", trigger ? [trigger] : []);\n // Base UI unmounts inactive panels; pont2 never removes author children, so it hides them.\n this.hidden = !active;\n this.setData(\"hidden\", !active);\n this.setData(\"orientation\", orientation);\n if (!this.hasAttribute(\"tabindex\")) this.tabIndex = 0;\n }\n}\n\ndefine(\"pont2-prim-tabs\", Tabs);\ndefine(\"pont2-prim-tabs-list\", TabsList);\ndefine(\"pont2-prim-tabs-trigger\", TabsTrigger);\ndefine(\"pont2-prim-tabs-content\", TabsContent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-tabs\": Tabs;\n \"pont2-prim-tabs-list\": TabsList;\n \"pont2-prim-tabs-trigger\": TabsTrigger;\n \"pont2-prim-tabs-content\": TabsContent;\n }\n}\n","/**\n * Pure anchored-positioning maths (no DOM). The same model as Floating UI /\n * Base UI's `<Positioner>`: place the floating box on a `side` of the anchor,\n * `align` it along that side, then `flip` to the opposite side and `shift`\n * along the cross axis to stay inside the viewport minus `collisionPadding`.\n *\n * Unit-tested in node: position.test.ts.\n */\n\nexport type PhysicalSide = \"top\" | \"bottom\" | \"left\" | \"right\";\n/** Base UI sides: physical, or logical (`inline-start`/`inline-end` follow `dir`). */\nexport type Side = PhysicalSide | \"inline-start\" | \"inline-end\";\nexport type Align = \"start\" | \"center\" | \"end\";\n\nexport interface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport interface PositionInput {\n anchor: Rect;\n floating: Size;\n viewport: Rect;\n side?: Side;\n align?: Align;\n /** Gap between anchor and floating box, on the main axis (px). */\n sideOffset?: number;\n /** Offset along the cross axis (px). Positive moves towards `end` for start/center, towards `start` for end. */\n alignOffset?: number;\n /** Minimum distance kept from the viewport edges (px). Base UI default: 5. */\n collisionPadding?: number;\n flip?: boolean;\n shift?: boolean;\n dir?: \"ltr\" | \"rtl\";\n}\n\nexport interface PositionResult {\n x: number;\n y: number;\n /** The side actually used, in the vocabulary it was requested in (logical stays logical). */\n side: Side;\n physicalSide: PhysicalSide;\n align: Align;\n /** Space between the floating box's anchored edge and the viewport edge (Base UI `--available-*`). */\n availableWidth: number;\n availableHeight: number;\n /** `--transform-origin`: the point of the anchor the box grows from. */\n transformOrigin: string;\n}\n\nconst OPPOSITE: Record<PhysicalSide, PhysicalSide> = { top: \"bottom\", bottom: \"top\", left: \"right\", right: \"left\" };\n\nexport function toPhysical(side: Side, dir: \"ltr\" | \"rtl\"): PhysicalSide {\n if (side === \"inline-start\") return dir === \"rtl\" ? \"right\" : \"left\";\n if (side === \"inline-end\") return dir === \"rtl\" ? \"left\" : \"right\";\n return side;\n}\n\nfunction toRequestedVocabulary(physical: PhysicalSide, requested: Side, dir: \"ltr\" | \"rtl\"): Side {\n if (requested !== \"inline-start\" && requested !== \"inline-end\") return physical;\n const start = dir === \"rtl\" ? \"right\" : \"left\";\n return physical === start ? \"inline-start\" : \"inline-end\";\n}\n\nconst isVertical = (s: PhysicalSide) => s === \"top\" || s === \"bottom\";\n\n/** Free space between the anchor (plus offset) and the padded viewport edge on `side`. */\nexport function spaceOn(side: PhysicalSide, anchor: Rect, viewport: Rect, offset: number, pad: number): number {\n switch (side) {\n case \"bottom\":\n return viewport.y + viewport.height - pad - (anchor.y + anchor.height + offset);\n case \"top\":\n return anchor.y - offset - (viewport.y + pad);\n case \"right\":\n return viewport.x + viewport.width - pad - (anchor.x + anchor.width + offset);\n case \"left\":\n return anchor.x - offset - (viewport.x + pad);\n }\n}\n\nexport function computePosition(input: PositionInput): PositionResult {\n const {\n anchor,\n floating,\n viewport,\n side: requested = \"bottom\",\n align = \"center\",\n sideOffset = 0,\n alignOffset = 0,\n collisionPadding = 5,\n flip = true,\n shift = true,\n dir = \"ltr\",\n } = input;\n const pad = collisionPadding;\n\n let side = toPhysical(requested, dir);\n\n // --- flip ------------------------------------------------------------\n if (flip) {\n const need = isVertical(side) ? floating.height : floating.width;\n const here = spaceOn(side, anchor, viewport, sideOffset, pad);\n const there = spaceOn(OPPOSITE[side], anchor, viewport, sideOffset, pad);\n if (here < need && there > here) side = OPPOSITE[side];\n }\n\n // --- main axis -------------------------------------------------------\n let x = 0;\n let y = 0;\n switch (side) {\n case \"bottom\":\n y = anchor.y + anchor.height + sideOffset;\n break;\n case \"top\":\n y = anchor.y - floating.height - sideOffset;\n break;\n case \"right\":\n x = anchor.x + anchor.width + sideOffset;\n break;\n case \"left\":\n x = anchor.x - floating.width - sideOffset;\n break;\n }\n\n // --- cross axis (align) ---------------------------------------------\n if (isVertical(side)) {\n // `start` is the inline-start edge, so it mirrors in RTL.\n const startEdge = dir === \"rtl\" ? anchor.x + anchor.width - floating.width : anchor.x;\n const endEdge = dir === \"rtl\" ? anchor.x : anchor.x + anchor.width - floating.width;\n const sign = dir === \"rtl\" ? -1 : 1;\n if (align === \"start\") x = startEdge + sign * alignOffset;\n else if (align === \"end\") x = endEdge - sign * alignOffset;\n else x = anchor.x + (anchor.width - floating.width) / 2 + sign * alignOffset;\n } else {\n if (align === \"start\") y = anchor.y + alignOffset;\n else if (align === \"end\") y = anchor.y + anchor.height - floating.height - alignOffset;\n else y = anchor.y + (anchor.height - floating.height) / 2 + alignOffset;\n }\n\n // --- shift (keep inside the padded viewport on the cross axis) -------\n if (shift) {\n if (isVertical(side)) {\n const min = viewport.x + pad;\n const max = viewport.x + viewport.width - pad - floating.width;\n x = max < min ? min : Math.min(Math.max(x, min), max);\n } else {\n const min = viewport.y + pad;\n const max = viewport.y + viewport.height - pad - floating.height;\n y = max < min ? min : Math.min(Math.max(y, min), max);\n }\n }\n\n // --- available space (Base UI --available-width / --available-height) -\n const mainSpace = Math.max(0, spaceOn(side, anchor, viewport, sideOffset, pad));\n const availableHeight = isVertical(side) ? mainSpace : Math.max(0, viewport.height - 2 * pad);\n const availableWidth = isVertical(side) ? Math.max(0, viewport.width - 2 * pad) : mainSpace;\n\n // --- transform origin: the anchor edge the box grows out of -----------\n const ax = anchor.x + anchor.width / 2 - x;\n const ay = anchor.y + anchor.height / 2 - y;\n const transformOrigin =\n side === \"bottom\"\n ? `${round(ax)}px ${-sideOffset}px`\n : side === \"top\"\n ? `${round(ax)}px ${floating.height + sideOffset}px`\n : side === \"right\"\n ? `${-sideOffset}px ${round(ay)}px`\n : `${floating.width + sideOffset}px ${round(ay)}px`;\n\n return {\n x: round(x),\n y: round(y),\n side: toRequestedVocabulary(side, requested, dir),\n physicalSide: side,\n align,\n availableWidth: round(availableWidth),\n availableHeight: round(availableHeight),\n transformOrigin,\n };\n}\n\n/**\n * Base UI Select's `alignItemWithTrigger`: place the popup so the selected\n * item sits exactly over the trigger (macOS-style). Returns `null` when that\n * is impossible inside the padded viewport, so the caller falls back to\n * normal side positioning (Base UI does the same).\n */\nexport function alignItemWithAnchor(input: {\n anchor: Rect;\n floating: Size;\n viewport: Rect;\n /** Offset of the item's top edge from the floating box's top edge (scroll already subtracted). */\n itemTop: number;\n itemHeight: number;\n collisionPadding?: number;\n}): { x: number; y: number } | null {\n const pad = input.collisionPadding ?? 5;\n const { anchor, floating, viewport } = input;\n const y = anchor.y + anchor.height / 2 - (input.itemTop + input.itemHeight / 2);\n const min = viewport.y + pad;\n const max = viewport.y + viewport.height - pad - floating.height;\n if (max < min) return null;\n if (y < min || y > max) return null;\n return { x: round(anchor.x), y: round(y) };\n}\n\nconst round = (n: number) => Math.round(n * 100) / 100;\n","import { directionOf } from \"../controllers/roving-focus\";\nimport { alignItemWithAnchor, computePosition, type Align, type Rect, type Side } from \"./position\";\n\nexport interface AnchoredOptions {\n side: Side;\n align: Align;\n sideOffset: number;\n alignOffset: number;\n collisionPadding: number;\n /** Select's `alignItemWithTrigger`: the item to lay over the anchor, if any. */\n alignItem?: HTMLElement | null;\n}\n\n/**\n * Keeps a floating element (a `popover` in the top layer, so `position:\n * fixed` against the viewport) attached to an anchor element.\n *\n * It only *writes CSS custom properties and data attributes* on the floating\n * element; the stylesheet turns them into `left`/`top`. Base UI's variables\n * are written under pont2's namespace (read by pont2 CSS) and also verbatim,\n * so shadcn classes (`max-h-(--available-height)`, `w-(--anchor-width)`,\n * `origin-(--transform-origin)`) port unchanged into app CSS:\n *\n * | Written | Meaning |\n * |-------------------------|--------------------------------------------|\n * | `--pont2-popup-x/y` | viewport position of the box (px) |\n * | `--pont2-anchor-width/height` (+ `--anchor-*`) | size of the anchor |\n * | `--pont2-available-width/height` (+ `--available-*`) | room left before the collision padding |\n * | `--pont2-transform-origin` (+ `--transform-origin`) | the anchor point the box grows from |\n * | `--pont2-arrow-x/y` | anchor centre relative to the box (for arrows) |\n * | `data-side`, `data-align` | the side/alignment actually used (after flip) |\n *\n * Updates are batched to one per animation frame and re-run on scroll (any\n * ancestor, captured), resize, and size changes of either element.\n */\nexport class AnchoredPositioner {\n private frame = 0;\n private running = false;\n private ro?: ResizeObserver;\n private observedAnchor: Element | null = null;\n\n constructor(\n private readonly floating: HTMLElement,\n private readonly anchor: () => Element | null,\n private readonly options: () => AnchoredOptions,\n ) {}\n\n start(): void {\n if (this.running) {\n this.update();\n return;\n }\n this.running = true;\n window.addEventListener(\"scroll\", this.schedule, { capture: true, passive: true });\n window.addEventListener(\"resize\", this.schedule, { passive: true });\n this.ro = new ResizeObserver(this.schedule);\n this.ro.observe(this.floating);\n this.observeAnchor();\n this.update();\n }\n\n stop(): void {\n if (!this.running) return;\n this.running = false;\n cancelAnimationFrame(this.frame);\n window.removeEventListener(\"scroll\", this.schedule, { capture: true });\n window.removeEventListener(\"resize\", this.schedule);\n this.ro?.disconnect();\n this.observedAnchor = null;\n }\n\n private observeAnchor() {\n const a = this.anchor();\n if (a && a !== this.observedAnchor) {\n this.ro?.observe(a);\n this.observedAnchor = a;\n }\n }\n\n private schedule = () => {\n if (!this.running) return;\n cancelAnimationFrame(this.frame);\n this.frame = requestAnimationFrame(() => this.update());\n };\n\n /** Measure and write synchronously (also called right after showPopover, before first paint). */\n update(): void {\n const anchorEl = this.anchor();\n if (!anchorEl || !this.floating.isConnected) return;\n this.observeAnchor();\n\n const a = anchorEl.getBoundingClientRect();\n const anchor: Rect = { x: a.left, y: a.top, width: a.width, height: a.height };\n // offsetWidth/Height ignore transforms, so a running zoom-in animation\n // does not feed back into the measurement.\n const floating = { width: this.floating.offsetWidth, height: this.floating.offsetHeight };\n const viewport: Rect = {\n x: 0,\n y: 0,\n width: document.documentElement.clientWidth,\n height: window.innerHeight,\n };\n const o = this.options();\n const style = this.floating.style;\n // Each Base UI variable is written twice: `--pont2-<name>` (what pont2's\n // own CSS reads, per the --pont2- namespace rule) and Base UI's verbatim\n // `--<name>`, so shadcn classes such as `max-h-(--available-height)` port\n // unchanged into consumer CSS.\n const set = (name: string, value: string) => {\n style.setProperty(`--pont2-${name}`, value);\n style.setProperty(`--${name}`, value);\n };\n set(\"anchor-width\", `${a.width}px`);\n set(\"anchor-height\", `${a.height}px`);\n\n if (o.alignItem) {\n const f = this.floating.getBoundingClientRect();\n const it = o.alignItem.getBoundingClientRect();\n const aligned = alignItemWithAnchor({\n anchor,\n floating,\n viewport,\n itemTop: it.top - f.top,\n itemHeight: it.height,\n collisionPadding: o.collisionPadding,\n });\n if (aligned) {\n style.setProperty(\"--pont2-popup-x\", `${aligned.x}px`);\n style.setProperty(\"--pont2-popup-y\", `${aligned.y}px`);\n set(\"available-height\", `${viewport.height - 2 * o.collisionPadding}px`);\n set(\"available-width\", `${viewport.width - 2 * o.collisionPadding}px`);\n set(\"transform-origin\", \"center\");\n this.floating.setAttribute(\"data-side\", \"none\");\n this.floating.setAttribute(\"data-align\", \"center\");\n return;\n }\n }\n\n const r = computePosition({\n anchor,\n floating,\n viewport,\n side: o.side,\n align: o.align,\n sideOffset: o.sideOffset,\n alignOffset: o.alignOffset,\n collisionPadding: o.collisionPadding,\n dir: directionOf(anchorEl),\n });\n style.setProperty(\"--pont2-popup-x\", `${r.x}px`);\n style.setProperty(\"--pont2-popup-y\", `${r.y}px`);\n set(\"available-width\", `${r.availableWidth}px`);\n set(\"available-height\", `${r.availableHeight}px`);\n set(\"transform-origin\", r.transformOrigin);\n style.setProperty(\"--pont2-arrow-x\", `${a.left + a.width / 2 - r.x}px`);\n style.setProperty(\"--pont2-arrow-y\", `${a.top + a.height / 2 - r.y}px`);\n if (this.floating.getAttribute(\"data-side\") !== r.side) this.floating.setAttribute(\"data-side\", r.side);\n if (this.floating.getAttribute(\"data-align\") !== r.align) this.floating.setAttribute(\"data-align\", r.align);\n }\n}\n","/**\n * List navigation and typeahead for popup lists (menus, select, combobox).\n *\n * Two focus models, as in Base UI:\n * - **real focus** (Menu, Select): the highlighted item *is* `document.activeElement`;\n * items carry `tabindex=\"-1\"` and `data-highlighted` follows focus;\n * - **virtual focus** (Combobox): focus stays in the `<input>`; the highlighted\n * item gets `data-highlighted` and the input points at it with\n * `aria-activedescendant`.\n *\n * Both share `moveIndex()` and `Typeahead`.\n */\n\nexport const isItemDisabled = (el: Element) =>\n el.hasAttribute(\"data-disabled\") || el.getAttribute(\"aria-disabled\") === \"true\";\n\nexport const isItemVisible = (el: HTMLElement) => !el.hidden && !el.closest(\"[hidden]\");\n\nexport type Move = \"next\" | \"prev\" | \"first\" | \"last\";\n\n/** Index of the next enabled item in `direction` from `current` (−1 = none yet). */\nexport function moveIndex(\n items: readonly Element[],\n current: number,\n move: Move,\n { loop = true, isDisabled = isItemDisabled }: { loop?: boolean; isDisabled?: (el: Element) => boolean } = {},\n): number {\n const n = items.length;\n if (!n) return -1;\n const ok = (i: number) => !isDisabled(items[i]);\n if (move === \"first\") {\n for (let i = 0; i < n; i++) if (ok(i)) return i;\n return -1;\n }\n if (move === \"last\") {\n for (let i = n - 1; i >= 0; i--) if (ok(i)) return i;\n return -1;\n }\n const step = move === \"next\" ? 1 : -1;\n if (current < 0) return moveIndex(items, -1, step === 1 ? \"first\" : \"last\", { loop, isDisabled });\n for (let k = 1; k <= n; k++) {\n let i = current + step * k;\n if (loop) i = (i + n) % n;\n else if (i < 0 || i >= n) return current;\n if (ok(i)) return i;\n }\n return current;\n}\n\n/** Keyboard key → move, for a vertical list. */\nexport function keyToMove(key: string): Move | null {\n switch (key) {\n case \"ArrowDown\":\n return \"next\";\n case \"ArrowUp\":\n return \"prev\";\n case \"Home\":\n return \"first\";\n case \"End\":\n return \"last\";\n default:\n return null;\n }\n}\n\n/**\n * Typeahead (APG): printable keys typed within 500ms build a prefix; the\n * first enabled item after the current one whose label starts with it wins.\n * Repeating one character cycles through items starting with it.\n */\nexport class Typeahead {\n private buffer = \"\";\n private timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor(private readonly timeout = 500) {}\n\n /** Whether a keyboard event is a typeahead character. */\n static isChar(e: KeyboardEvent): boolean {\n return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && e.key !== \" \";\n }\n\n get active(): boolean {\n return this.buffer.length > 0;\n }\n\n match(\n key: string,\n items: readonly Element[],\n current: number,\n label: (el: Element) => string = el => el.textContent ?? \"\",\n ): number {\n clearTimeout(this.timer);\n this.timer = setTimeout(() => (this.buffer = \"\"), this.timeout);\n this.buffer += key.toLowerCase();\n\n const repeated = this.buffer.split(\"\").every(c => c === this.buffer[0]);\n const search = repeated ? this.buffer[0] : this.buffer;\n const n = items.length;\n const start = repeated || current < 0 ? current + 1 : current;\n for (let k = 0; k < n; k++) {\n const i = (start + k + n) % n;\n const el = items[i];\n if (isItemDisabled(el)) continue;\n if (label(el).trim().toLowerCase().startsWith(search)) return i;\n }\n return -1;\n }\n\n reset(): void {\n clearTimeout(this.timer);\n this.buffer = \"\";\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport type { OpenChangeReason } from \"../events\";\nimport { HostElement } from \"../host-element\";\nimport { AnchoredPositioner } from \"./anchored\";\nimport type { Align, Side } from \"./position\";\n\n/** Popups currently open, bottom → top. Escape and outside presses are resolved against it. */\nconst stack: PopupContent[] = [];\n\nlet globalListeners = false;\nfunction installGlobalListeners() {\n if (globalListeners) return;\n globalListeners = true;\n\n // Escape closes only the top-most popup (a submenu before its menu).\n document.addEventListener(\"keydown\", e => {\n if (e.key !== \"Escape\" || e.defaultPrevented) return;\n const top = stack.at(-1);\n if (!top) return;\n e.preventDefault();\n e.stopPropagation();\n top.requestClose(\"escape-key\");\n });\n\n // Outside press: captured on pointerdown, before focus moves (Base UI\n // dismisses on pointerdown for mouse too).\n document.addEventListener(\n \"pointerdown\",\n e => {\n const path = e.composedPath();\n for (const popup of [...stack].reverse()) {\n if (popup.containsPath(path)) break; // inside: this one and everything below stay\n popup.requestClose(\"outside-press\");\n }\n },\n true,\n );\n}\n\n/**\n * # PopupContent: base for every popup surface\n *\n * DropdownMenuContent, SelectContent, ComboboxContent, PopoverContent and\n * TooltipContent all extend it. The host **is** the popup (shadcn's\n * `data-slot=\"…-content\"` element); Base UI's separate `Portal` and\n * `Positioner` wrappers have no counterpart, because:\n *\n * - **Portal → the native Popover API.** The host carries `popover=\"manual\"`\n * and `showPopover()` lifts it into the browser's top layer: it escapes\n * `overflow: hidden` and stacking contexts *without moving the node*. It\n * stays exactly where the author wrote it, so React/Lit/server HTML keep\n * owning it, and it inherits CSS custom properties from its real ancestors.\n * - **Positioner → AnchoredPositioner**, which writes position variables on\n * this same element (see anchored.ts).\n *\n * Base UI DOM: Portal > Positioner div > Popup div[data-slot=…-content] > children\n * pont2 DOM: pont2-…-content[popover][data-slot=…-content] > children\n *\n * Open/close states are Base UI's: `data-open` / `data-closed`, plus\n * `data-starting-style` (first frame after opening) and `data-ending-style`\n * (while closing). On close the element stays in the top layer until its\n * CSS animations/transitions finish, then `hidePopover()` runs, so shadcn's\n * `animate-out` classes port as plain keyframes.\n *\n * The content never decides it is open; its root does. It *requests*\n * closing (Escape, outside press, Tab) through `onRequestClose`, which the\n * root turns into a cancelable `pont2-open-change` event.\n */\nexport abstract class PopupContent extends HostElement {\n static override identity = \"popup\";\n\n static override properties: PropertyDeclarations = {\n side: { type: String, reflect: false },\n align: { type: String, reflect: false },\n sideOffset: { type: Number, attribute: \"side-offset\" },\n alignOffset: { type: Number, attribute: \"align-offset\" },\n collisionPadding: { type: Number, attribute: \"collision-padding\" },\n };\n\n declare side: Side;\n declare align: Align;\n declare sideOffset: number;\n declare alignOffset: number;\n declare collisionPadding: number;\n\n /** Set by the root: asked to close for `reason`. */\n onRequestClose?: (reason: OpenChangeReason) => void;\n /** Set by the root: elements that do not count as \"outside\" (the trigger). */\n insideElements: () => (Element | null | undefined)[] = () => [];\n /** Set by the root: what the popup is anchored to. */\n anchorElement: () => Element | null = () => null;\n\n protected readonly positioner = new AnchoredPositioner(\n this,\n () => this.anchorElement(),\n () => ({\n side: this.side,\n align: this.align,\n sideOffset: this.sideOffset,\n alignOffset: this.alignOffset,\n collisionPadding: this.collisionPadding,\n alignItem: this.alignItem(),\n }),\n );\n\n private closing?: Promise<void>;\n private generation = 0;\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"center\";\n this.sideOffset = 0;\n this.alignOffset = 0;\n this.collisionPadding = 5;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n installGlobalListeners();\n if (!this.hasAttribute(\"popover\")) this.setAttribute(\"popover\", \"manual\");\n if (!this.isOpen) this.setData(\"closed\", true);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.positioner.stop();\n const i = stack.indexOf(this);\n if (i >= 0) stack.splice(i, 1);\n }\n\n get isOpen(): boolean {\n return this.hasAttribute(\"data-open\");\n }\n\n /** Select overrides this to lay the selected item over the trigger. */\n protected alignItem(): HTMLElement | null {\n return null;\n }\n\n /** True if the event path is inside this popup or one of its inside elements. */\n containsPath(path: EventTarget[]): boolean {\n if (path.includes(this)) return true;\n return this.insideElements().some(el => el && path.includes(el));\n }\n\n requestClose(reason: OpenChangeReason): void {\n this.onRequestClose?.(reason);\n }\n\n /** Re-measure (e.g. after the content changed size). */\n reposition(): void {\n if (this.isOpen) this.positioner.update();\n }\n\n show(): void {\n this.generation++;\n this.closing = undefined;\n this.setData(\"ending-style\", false);\n this.setData(\"closed\", false);\n this.setData(\"open\", true);\n if (!this.matches(\":popover-open\")) {\n this.setData(\"starting-style\", true);\n try {\n this.showPopover();\n } catch {\n /* already open, or not connected */\n }\n requestAnimationFrame(() => this.setData(\"starting-style\", false));\n }\n if (!stack.includes(this)) stack.push(this);\n this.positioner.start();\n }\n\n /** Starts the close; resolves once the exit animation finished and the popover is hidden. */\n hide(): Promise<void> {\n if (!this.isOpen && !this.closing) {\n this.setData(\"closed\", true);\n return Promise.resolve();\n }\n if (this.closing) return this.closing;\n const gen = ++this.generation;\n this.setData(\"open\", false);\n this.setData(\"closed\", true);\n this.setData(\"ending-style\", true);\n const i = stack.indexOf(this);\n if (i >= 0) stack.splice(i, 1);\n\n this.closing = (async () => {\n // Let the closed styles apply, then wait for whatever they animate.\n await new Promise(r => requestAnimationFrame(() => r(null)));\n const anims = this.getAnimations().filter(a => a.playState !== \"finished\");\n await Promise.allSettled(anims.map(a => a.finished));\n if (gen !== this.generation) return; // re-opened meanwhile\n this.setData(\"ending-style\", false);\n this.positioner.stop();\n try {\n this.hidePopover();\n } catch {\n /* not open */\n }\n this.closing = undefined;\n })();\n return this.closing;\n }\n}\n\n/** Open popups, bottom → top (read-only view, for tests and devtools). */\nexport const openPopups = (): readonly PopupContent[] => stack;\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { fire, type OpenChangeDetail, type OpenChangeReason } from \"../events\";\nimport { HostElement, NativeEnhancer } from \"../host-element\";\nimport { ensureId } from \"../ids\";\nimport type { PopupContent } from \"./popup-content\";\n\n/**\n * Finds the first element matching `selector` under `root` that belongs to\n * `root` itself, i.e. whose closest `rootSelector` ancestor is `root` (so a\n * DropdownMenu never picks up its submenu's trigger or content).\n */\nexport function ownQuery<T extends Element>(root: Element, selector: string, rootSelector: string): T | null {\n for (const el of Array.from(root.querySelectorAll<T>(selector))) {\n if (el.parentElement?.closest(rootSelector) === root) return el;\n }\n return null;\n}\n\n/** All matches that belong to `root` (see ownQuery). */\nexport function ownQueryAll<T extends Element>(root: Element, selector: string, rootSelector: string): T[] {\n return Array.from(root.querySelectorAll<T>(selector)).filter(\n el => el.parentElement?.closest(rootSelector) === root,\n );\n}\n\n/**\n * # PopupRoot: the coordinator of a popup family\n *\n * Base UI's `<Menu.Root>`, `<Popover.Root>`, `<Select.Root>` render **no\n * element**; they are React context providers. A custom element cannot\n * render nothing, so pont2's roots are *coordinators*: they exist in the\n * DOM (authors need a tag to group trigger and content) but have no box and\n * no role:\n *\n * `[data-pont2-popup-root] { display: contents }` (core/popup/popup.css)\n *\n * That is the same reasoning as a Tier 3 shell, applied to an element whose\n * shadcn counterpart has no DOM at all. Instead of context, the root finds\n * its parts by DOM lookup (`ownQuery`), wires their ARIA, and owns the one\n * piece of state: `open`.\n *\n * `open` changes requested by the user (trigger press, Escape, outside press,\n * item press…) go through `setOpen(open, reason)`, which fires a cancelable\n * `pont2-open-change` ({ open, reason }) first: Base UI's\n * `onOpenChange(open, eventDetails)` + `eventDetails.cancel()`. Writing the\n * `open` property directly is the controlled form and fires nothing.\n */\nexport abstract class PopupRoot extends HostElement {\n static override identity = \"popup-root\";\n\n static override properties: PropertyDeclarations = {\n open: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare open: boolean;\n declare disabled: boolean;\n\n /** Why the popup last opened/closed (drives focus management). */\n protected lastReason: OpenChangeReason = \"imperative\";\n /** Whether the last open was keyboard-initiated (focus the first item, not the popup). */\n protected openedByKeyboard = false;\n\n constructor() {\n super();\n this.open = false;\n this.disabled = false;\n }\n\n /** The element the popup anchors to and returns focus to (a native button / input). */\n abstract get triggerElement(): HTMLElement | null;\n abstract get contentElement(): PopupContent | null;\n /** `aria-haspopup` value for the trigger. */\n protected abstract get popupKind(): \"menu\" | \"listbox\" | \"dialog\" | \"true\";\n\n /**\n * Request an open-state change, as the user did. Returns false if a\n * `pont2-open-change` listener cancelled it.\n */\n setOpen(open: boolean, reason: OpenChangeReason, opts: { keyboard?: boolean } = {}): boolean {\n if (open === this.open) return true;\n if (open && this.disabled) return false;\n const allowed = fire<OpenChangeDetail>(this, \"pont2-open-change\", { open, reason }, true);\n if (!allowed) return false;\n this.lastReason = reason;\n this.openedByKeyboard = !!opts.keyboard;\n this.open = open;\n return true;\n }\n\n toggle(reason: OpenChangeReason = \"trigger-press\", opts: { keyboard?: boolean } = {}): void {\n this.setOpen(!this.open, reason, opts);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n // Parts may upgrade after the root; wire once everything is defined.\n queueMicrotask(() => this.wire());\n }\n\n /** Connect trigger and content (idempotent). Call when parts change. */\n wire(): void {\n const content = this.contentElement;\n const trigger = this.triggerElement;\n if (content) {\n ensureId(content, \"popup\");\n content.onRequestClose = reason => this.setOpen(false, reason);\n content.anchorElement = () => this.anchorElement();\n content.insideElements = () => [this.triggerElement, ...this.extraInsideElements()];\n }\n if (trigger) {\n trigger.setAttribute(\"aria-haspopup\", this.popupKind);\n trigger.setAttribute(\"aria-expanded\", String(this.open));\n if (content) trigger.setAttribute(\"aria-controls\", content.id);\n trigger.toggleAttribute(\"data-popup-open\", this.open);\n trigger.toggleAttribute(\"data-disabled\", this.disabled);\n }\n }\n\n /** What the content positions against. Defaults to the trigger. */\n protected anchorElement(): Element | null {\n return this.triggerElement;\n }\n\n /** Further elements whose presses are not \"outside\" (e.g. a combobox input group). */\n protected extraInsideElements(): (Element | null)[] {\n return [];\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.wire();\n if (!changed.has(\"open\")) return;\n const content = this.contentElement;\n if (!content) return;\n if (this.open) {\n content.show();\n this.afterOpen();\n } else if (changed.get(\"open\") !== undefined) {\n const hadFocus = content.contains(document.activeElement) || document.activeElement === document.body;\n void content.hide();\n this.afterClose(hadFocus);\n }\n }\n\n /** Focus management after opening. Default: focus the popup itself. */\n protected afterOpen(): void {}\n\n /** Focus management after closing. Default: return focus to the trigger if it was inside. */\n protected afterClose(focusWasInside: boolean): void {\n if (focusWasInside && this.lastReason !== \"outside-press\") this.triggerElement?.focus({ preventScroll: true });\n }\n}\n\n/**\n * Trigger enhancer: `<pont2-x-trigger><button>…</button></pont2-x-trigger>`.\n * The native button is the trigger (Tier 3). It gets `data-slot`, and its\n * root sets `aria-haspopup` / `aria-expanded` / `aria-controls` /\n * `data-popup-open` on it. Pressing it toggles the root.\n */\nexport abstract class PopupTrigger extends NativeEnhancer<HTMLButtonElement> {\n static override nativeSelector = \"button\";\n /** Tag of the root this trigger belongs to. */\n static rootTag = \"\";\n /**\n * `data-slot` written on the *native button* (e.g. \"dropdown-menu-trigger\").\n * Deliberately not `slotName`: that would stamp the shell, and a shell is\n * never styled or selected.\n */\n static controlSlot = \"trigger\";\n\n get root(): PopupRoot | null {\n return this.closest((this.constructor as typeof PopupTrigger).rootTag) as PopupRoot | null;\n }\n\n constructor() {\n super();\n // Wrappers, not method references: subclass overrides are installed after\n // this constructor runs.\n this.addEventListener(\"click\", e => this.onClick(e));\n this.addEventListener(\"keydown\", e => this.onKeyDown(e));\n }\n\n protected apply(control: HTMLButtonElement): void {\n const slot = (this.constructor as typeof PopupTrigger).controlSlot;\n if (!control.hasAttribute(\"data-slot\") || control.getAttribute(\"data-slot\") === \"button\") {\n control.setAttribute(\"data-slot\", slot);\n }\n if (!control.hasAttribute(\"type\")) control.type = \"button\";\n this.root?.wire();\n }\n\n protected onClick(e: MouseEvent): void {\n const c = this.control;\n if (!c || !(c === e.target || c.contains(e.target as Node)) || c.disabled) return;\n // `detail === 0`: activated by keyboard (Enter/Space), not a pointer.\n this.root?.toggle(\"trigger-press\", { keyboard: e.detail === 0 });\n }\n\n protected onKeyDown(_e: KeyboardEvent): void {}\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot, PopupTrigger } from \"../../core/popup/popup-root\";\n\nconst ROOT = sel(\"popover\");\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * # Popover\n *\n * shadcn: `<Popover>` (Base UI `Popover.Root`, renders nothing) >\n * `<PopoverTrigger>` (a `<button>`) + `<PopoverContent>` (Portal > Positioner >\n * `<div data-slot=\"popover-content\">`), with `PopoverHeader/Title/Description`.\n *\n * pont2:\n * ```html\n * <pont2-prim-popover> coordinator, display: contents\n * <pont2-prim-popover-trigger><button data-pont2-button data-variant=\"outline\">Open</button></pont2-prim-popover-trigger>\n * <pont2-prim-popover-content> the popup itself: [popover], role=dialog\n * <pont2-prim-popover-header>\n * <pont2-prim-popover-title>Dimensions</pont2-prim-popover-title>\n * <pont2-prim-popover-description>Set the dimensions for the layer.</pont2-prim-popover-description>\n * </pont2-prim-popover-header>\n * …\n * </pont2-prim-popover-content>\n * </pont2-prim-popover>\n * ```\n *\n * @tag pont2-prim-popover\n * @attr open - Open state (initially: Base UI `defaultOpen`; property: controlled `open`).\n * @fires pont2-open-change - cancelable, `{ open, reason }`.\n */\nexport class Popover extends PopupRoot {\n static override identity = \"popover\";\n\n get triggerElement(): HTMLButtonElement | null {\n return ownQuery<PopoverTrigger>(this, tags(\"popover-trigger\"), ROOT)?.control ?? null;\n }\n get contentElement(): PopoverContent | null {\n return ownQuery<PopoverContent>(this, sel(\"popover-content\"), ROOT);\n }\n protected get popupKind() {\n return \"dialog\" as const;\n }\n\n protected override afterOpen(): void {\n const content = this.contentElement;\n if (!content) return;\n // Base UI Popover: focus the first focusable element in the popup, else the popup.\n const first = content.querySelector<HTMLElement>(FOCUSABLE);\n (first ?? content).focus({ preventScroll: true });\n }\n}\n\n/** @tag pont2-prim-popover-trigger */\nexport class PopoverTrigger extends PopupTrigger {\n static override rootTag = ROOT;\n static override controlSlot = \"popover-trigger\";\n}\n\n/**\n * The popup. Non-modal, like Base UI's default: closes on Escape, on a press\n * outside, and when focus leaves both the popup and its trigger.\n *\n * @tag pont2-prim-popover-content\n * @attr side - bottom (default) | top | left | right | inline-start | inline-end\n * @attr align - center (default) | start | end\n * @attr side-offset - default 4\n * @attr align-offset - default 0\n * @cssprop --pont2-popover-bg, --pont2-popover-fg, --pont2-popover-border-color, --pont2-popover-radius, --pont2-popover-shadow - see docs/11-tokens.md\n * @cssprop --pont2-popover-width, --pont2-popover-padding-x, --pont2-popover-padding-y, --pont2-popover-gap - sizes (defaults 18rem, 1rem, 1rem, 1rem)\n */\nexport class PopoverContent extends PopupContent {\n static override identity = \"popover-content\";\n static override slotName = \"popover-content\";\n static override role = \"dialog\";\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"center\";\n this.sideOffset = 4;\n this.addEventListener(\"focusout\", this.onFocusOut);\n }\n\n override show(): void {\n this.tabIndex = -1;\n const title = this.querySelector(`${sel(\"popover-title\")}, [data-slot=popover-title]`);\n const desc = this.querySelector(`${sel(\"popover-description\")}, [data-slot=popover-description]`);\n if (title && !this.hasAttribute(\"aria-labelledby\")) this.setAttribute(\"aria-labelledby\", ensureId(title, \"popover-title\"));\n if (desc && !this.hasAttribute(\"aria-describedby\")) this.setAttribute(\"aria-describedby\", ensureId(desc, \"popover-desc\"));\n super.show();\n }\n\n private onFocusOut = (e: FocusEvent) => {\n const to = e.relatedTarget as Node | null;\n if (!to || !this.isOpen) return; // focus went to the page/body: keep open (Base UI)\n if (this.contains(to) || this.insideElements().some(el => el?.contains(to))) return;\n this.requestClose(\"focus-out\");\n };\n}\n\n/** @tag pont2-prim-popover-header */\nexport class PopoverHeader extends HostElement {\n static override identity = \"popover-header\";\n static override slotName = \"popover-header\";\n}\n\n/** Base UI `Popover.Title` renders an `<h2>`; pont2 keeps the heading semantics through internals. @tag pont2-prim-popover-title */\nexport class PopoverTitle extends HostElement {\n static override identity = \"popover-title\";\n static override slotName = \"popover-title\";\n static override role = \"heading\";\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.internals.ariaLevel) this.internals.ariaLevel = \"2\";\n }\n}\n\n/** Base UI `Popover.Description` renders a `<p>`. @tag pont2-prim-popover-description */\nexport class PopoverDescription extends HostElement {\n static override identity = \"popover-description\";\n static override slotName = \"popover-description\";\n}\n\ndefine(\"pont2-prim-popover\", Popover);\ndefine(\"pont2-prim-popover-trigger\", PopoverTrigger);\ndefine(\"pont2-prim-popover-content\", PopoverContent);\ndefine(\"pont2-prim-popover-header\", PopoverHeader);\ndefine(\"pont2-prim-popover-title\", PopoverTitle);\ndefine(\"pont2-prim-popover-description\", PopoverDescription);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-popover\": Popover;\n \"pont2-prim-popover-trigger\": PopoverTrigger;\n \"pont2-prim-popover-content\": PopoverContent;\n \"pont2-prim-popover-header\": PopoverHeader;\n \"pont2-prim-popover-title\": PopoverTitle;\n \"pont2-prim-popover-description\": PopoverDescription;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { directionOf } from \"../../core/controllers/roving-focus\";\nimport { fireNative } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { isItemDisabled, isItemVisible, keyToMove, moveIndex, Typeahead } from \"../../core/popup/list\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot, PopupTrigger } from \"../../core/popup/popup-root\";\nimport { Separator } from \"../separator/separator\";\n\nconst ROOTS = `${sel(\"dropdown-menu\")}, ${sel(\"dropdown-menu-sub\")}`;\nconst CONTENT = \"[data-pont2-dropdown-menu-content]\";\nconst ITEM = \"[data-pont2-menu-item]\";\n\n/** Boolean attribute that defaults to true and is turned off with `=\"false\"`. */\nconst trueUnlessFalse = { fromAttribute: (v: string | null) => v !== \"false\", toAttribute: (v: boolean) => String(v) };\n\ntype FocusTarget = \"first\" | \"last\" | \"popup\";\n\n/* ==================================================================== */\n/* Roots */\n/* ==================================================================== */\n\n/**\n * # DropdownMenu\n *\n * shadcn: `<DropdownMenu>` = Base UI `Menu.Root` (renders nothing).\n *\n * ```html\n * <pont2-prim-dropdown-menu>\n * <pont2-prim-dropdown-menu-trigger><button data-pont2-button data-variant=\"outline\">Open</button></pont2-prim-dropdown-menu-trigger>\n * <pont2-prim-dropdown-menu-content>\n * <pont2-prim-dropdown-menu-group>\n * <pont2-prim-dropdown-menu-label>My Account</pont2-prim-dropdown-menu-label>\n * <pont2-prim-dropdown-menu-item>Profile <pont2-prim-dropdown-menu-shortcut>⇧⌘P</pont2-prim-dropdown-menu-shortcut></pont2-prim-dropdown-menu-item>\n * </pont2-prim-dropdown-menu-group>\n * </pont2-prim-dropdown-menu-content>\n * </pont2-prim-dropdown-menu>\n * ```\n *\n * @tag pont2-prim-dropdown-menu\n * @fires pont2-open-change - cancelable `{ open, reason }`\n */\nexport class DropdownMenu extends PopupRoot {\n static override identity = \"dropdown-menu\";\n\n /** Where focus goes when the menu opens (set by the trigger's key handling). */\n focusOnOpen: FocusTarget = \"popup\";\n\n get triggerElement(): HTMLElement | null {\n return ownQuery<DropdownMenuTrigger>(this, tags(\"dropdown-menu-trigger\"), ROOTS)?.control ?? null;\n }\n get contentElement(): DropdownMenuContent | null {\n return ownQuery<DropdownMenuContent>(this, sel(\"dropdown-menu-content\"), ROOTS);\n }\n protected get popupKind() {\n return \"menu\" as const;\n }\n\n openWith(focus: FocusTarget, reason: \"trigger-press\" | \"list-navigation\" = \"trigger-press\"): void {\n this.focusOnOpen = focus;\n if (this.open) this.contentElement?.focusTarget(focus);\n else this.setOpen(true, reason, { keyboard: focus !== \"popup\" });\n }\n\n override toggle(reason: \"trigger-press\" = \"trigger-press\", opts: { keyboard?: boolean } = {}): void {\n // Base UI: opening with Enter/Space highlights the first item.\n this.focusOnOpen = opts.keyboard ? \"first\" : \"popup\";\n super.toggle(reason, opts);\n }\n\n protected override afterOpen(): void {\n this.contentElement?.focusTarget(this.focusOnOpen);\n }\n}\n\n/**\n * # DropdownMenuSub\n *\n * Base UI `Menu.SubmenuRoot` (renders nothing). Its trigger is a\n * `pont2-prim-dropdown-menu-sub-trigger` (a menuitem), its popup a\n * `pont2-prim-dropdown-menu-sub-content`.\n *\n * @tag pont2-prim-dropdown-menu-sub\n */\nexport class DropdownMenuSub extends PopupRoot {\n static override identity = \"dropdown-menu-sub\";\n\n focusOnOpen: FocusTarget = \"popup\";\n\n get triggerElement(): DropdownMenuSubTrigger | null {\n return ownQuery<DropdownMenuSubTrigger>(this, sel(\"dropdown-menu-sub-trigger\"), ROOTS);\n }\n get contentElement(): DropdownMenuSubContent | null {\n return ownQuery<DropdownMenuSubContent>(this, sel(\"dropdown-menu-sub-content\"), ROOTS);\n }\n protected get popupKind() {\n return \"menu\" as const;\n }\n\n openWith(focus: FocusTarget, reason: \"trigger-press\" | \"trigger-hover\" | \"list-navigation\"): void {\n this.focusOnOpen = focus;\n if (this.open) this.contentElement?.focusTarget(focus);\n else this.setOpen(true, reason, { keyboard: focus !== \"popup\" });\n }\n\n protected override afterOpen(): void {\n if (this.focusOnOpen !== \"popup\") this.contentElement?.focusTarget(this.focusOnOpen);\n }\n}\n\n/* ==================================================================== */\n/* Trigger */\n/* ==================================================================== */\n\n/**\n * Tier 3 enhancer around a native `<button>`; combine freely with the\n * button recipe (`<button data-pont2-button data-variant=\"outline\">`).\n * ArrowDown/ArrowUp open the menu and highlight the first/last item.\n *\n * @tag pont2-prim-dropdown-menu-trigger\n */\nexport class DropdownMenuTrigger extends PopupTrigger {\n static override rootTag = sel(\"dropdown-menu\");\n static override controlSlot = \"dropdown-menu-trigger\";\n\n protected override onKeyDown(e: KeyboardEvent): void {\n const root = this.root as DropdownMenu | null;\n if (!root || !this.control || e.target !== this.control) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n root.openWith(e.key === \"ArrowDown\" ? \"first\" : \"last\", \"list-navigation\");\n }\n }\n}\n\n/* ==================================================================== */\n/* Content */\n/* ==================================================================== */\n\n/**\n * The menu popup: Base UI `Menu.Popup` (`role=\"menu\"`). Items get real\n * focus (roving), so the highlighted item is `document.activeElement`.\n *\n * @tag pont2-prim-dropdown-menu-content\n * @attr side - bottom (default) … @attr align - start (default) …\n * @attr side-offset - 4 @attr align-offset - 0\n * @cssprop --pont2-dropdown-menu-bg, --pont2-dropdown-menu-fg, --pont2-dropdown-menu-border-color, --pont2-dropdown-menu-radius, --pont2-dropdown-menu-shadow - see docs/11-tokens.md\n * @cssprop --pont2-dropdown-menu-min-width, --pont2-dropdown-menu-padding-x, --pont2-dropdown-menu-padding-y - sizes (defaults 8rem, 0.25rem, 0.25rem)\n * @cssprop --pont2-dropdown-menu-sub-content-shadow - submenu shadow (default: the menu shadow token, else shadow-lg)\n * @cssprop --pont2-dropdown-menu-item-radius, --pont2-dropdown-menu-item-bg-focus, --pont2-dropdown-menu-item-fg-focus - items, inherited from the content\n * @cssprop --pont2-dropdown-menu-item-destructive-fg, --pont2-dropdown-menu-item-destructive-bg-focus - variant=\"destructive\" items\n */\nexport class DropdownMenuContent extends PopupContent {\n static override identity = \"dropdown-menu-content\";\n static override slotName = \"dropdown-menu-content\";\n static override role = \"menu\";\n\n private typeahead = new Typeahead();\n private subCloseTimer = 0;\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"start\";\n this.sideOffset = 4;\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"pointerleave\", this.onPointerLeave);\n this.addEventListener(\"pointerenter\", () => this.cancelSubClose());\n }\n\n /** This menu's own items (not its submenus'), visible, in order. */\n get items(): MenuItemBase[] {\n return Array.from(this.querySelectorAll<MenuItemBase>(ITEM)).filter(\n i => i.closest(CONTENT) === this && isItemVisible(i),\n );\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals.ariaOrientation = \"vertical\";\n }\n\n override show(): void {\n this.tabIndex = -1;\n super.show();\n }\n\n override hide(): Promise<void> {\n this.closeSubs();\n return super.hide();\n }\n\n focusTarget(target: FocusTarget): void {\n const items = this.items;\n const i = target === \"popup\" ? -1 : moveIndex(items, -1, target);\n (i >= 0 ? items[i] : this).focus({ preventScroll: i < 0 });\n }\n\n /** Close open submenus of this menu, optionally keeping one. */\n closeSubs(except?: Element | null): void {\n for (const sub of Array.from(this.querySelectorAll<DropdownMenuSub>(sel(\"dropdown-menu-sub\")))) {\n if (sub === except || sub.parentElement?.closest(CONTENT) !== this) continue;\n if (sub.open) sub.open = false;\n }\n }\n\n /** Called when the pointer rests on one of this menu's items. */\n scheduleSubClose(keep: Element | null): void {\n this.cancelSubClose();\n this.subCloseTimer = window.setTimeout(() => this.closeSubs(keep), 120);\n }\n\n cancelSubClose(): void {\n clearTimeout(this.subCloseTimer);\n }\n\n private onPointerLeave = () => {\n // Base UI: the highlight leaves with the pointer; focus stays in the menu.\n if (this.contains(document.activeElement) && document.activeElement !== this) {\n const active = document.activeElement as HTMLElement;\n if (active.closest(CONTENT) === this && !(active instanceof DropdownMenuSubTrigger && active.isSubOpen)) {\n this.focus({ preventScroll: true });\n }\n }\n };\n\n private onKeyDown = (e: KeyboardEvent) => {\n // Keys from a nested submenu are handled by that submenu.\n const owner = (e.target as Element).closest(CONTENT);\n if (owner !== this || e.defaultPrevented) return;\n\n const items = this.items;\n const current = items.indexOf(e.target as MenuItemBase);\n const rtl = directionOf(this) === \"rtl\";\n\n if (e.key === \"Tab\") {\n // Base UI: Tab closes the whole menu; focusing the trigger first lets the\n // browser's default Tab move on from it, like leaving any other control.\n const top = this.closest<DropdownMenu>(sel(\"dropdown-menu\"));\n top?.setOpen(false, \"focus-out\");\n top?.triggerElement?.focus();\n return;\n }\n\n const closeKey = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n if (e.key === closeKey && this instanceof DropdownMenuSubContent) {\n e.preventDefault();\n const sub = this.closest<DropdownMenuSub>(sel(\"dropdown-menu-sub\"));\n sub?.setOpen(false, \"list-navigation\");\n sub?.triggerElement?.focus();\n return;\n }\n\n const move = keyToMove(e.key);\n if (move) {\n e.preventDefault();\n const next = moveIndex(items, current, move);\n if (next >= 0) items[next].focus();\n return;\n }\n\n if ((e.key === \"Enter\" || e.key === \" \") && current >= 0) {\n e.preventDefault();\n if (e.key === \" \" && this.typeahead.active) return;\n items[current].click();\n return;\n }\n\n if (Typeahead.isChar(e)) {\n const i = this.typeahead.match(e.key, items, current, el => (el as MenuItemBase).label);\n if (i >= 0) items[i].focus();\n }\n };\n}\n\n/** @tag pont2-prim-dropdown-menu-sub-content */\nexport class DropdownMenuSubContent extends DropdownMenuContent {\n static override identity = \"dropdown-menu-sub-content\";\n static override slotName = \"dropdown-menu-sub-content\";\n\n constructor() {\n super();\n this.side = \"inline-end\";\n this.align = \"start\";\n this.sideOffset = 0;\n this.alignOffset = -3;\n this.addEventListener(\"pointerenter\", () =>\n this.parentElement?.closest<DropdownMenuContent>(CONTENT)?.cancelSubClose(),\n );\n }\n}\n\n/* ==================================================================== */\n/* Items */\n/* ==================================================================== */\n\n/**\n * Shared behaviour of every menu item (Base UI `Menu.Item` and friends):\n * host-as-root `role=menuitem*`, `tabindex=-1`, focus ⇄ `data-highlighted`,\n * pointer hover highlights, click activates and (optionally) closes the menu.\n */\nexport abstract class MenuItemBase extends HostElement {\n static override identity = \"menu-item\";\n static override role = \"menuitem\";\n\n static override properties: PropertyDeclarations = {\n disabled: { type: Boolean, reflect: true },\n inset: { type: Boolean, reflect: true },\n closeOnClick: { attribute: \"close-on-click\", converter: trueUnlessFalse },\n };\n\n declare disabled: boolean;\n declare inset: boolean;\n declare closeOnClick: boolean;\n\n constructor() {\n super();\n this.disabled = false;\n this.inset = false;\n this.closeOnClick = true;\n this.addEventListener(\"focus\", () => this.setData(\"highlighted\", true));\n this.addEventListener(\"blur\", () => this.setData(\"highlighted\", false));\n this.addEventListener(\"pointermove\", this.onPointerMove);\n this.addEventListener(\"click\", this.onClick);\n }\n\n /** Text used by typeahead (Base UI `label`): the `label` attribute, else the text content. */\n get label(): string {\n return this.getAttribute(\"label\") ?? (this.textContent ?? \"\").trim();\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"tabindex\")) this.tabIndex = -1;\n }\n\n protected get menu(): DropdownMenuContent | null {\n return this.closest<DropdownMenuContent>(CONTENT);\n }\n\n private onPointerMove = (e: PointerEvent) => {\n if (e.pointerType === \"touch\" || this.disabled) return;\n if (document.activeElement !== this) this.focus({ preventScroll: true });\n this.menu?.scheduleSubClose(this instanceof DropdownMenuSubTrigger ? this.parentElement : null);\n };\n\n private onClick = (e: MouseEvent) => {\n if (this.disabled || isItemDisabled(this)) {\n e.preventDefault();\n e.stopImmediatePropagation();\n return;\n }\n this.activate();\n if (this.closeOnClick) {\n this.closest<DropdownMenu>(sel(\"dropdown-menu\"))?.setOpen(false, \"item-press\");\n }\n };\n\n /** What pressing the item does beyond firing `click`. */\n protected activate(): void {}\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.setData(\"disabled\", this.disabled);\n this.setData(\"inset\", this.inset);\n this.internals.ariaDisabled = this.disabled ? \"true\" : null;\n }\n}\n\n/**\n * Base UI `Menu.Item`. Listen for `click` to act on it.\n *\n * @tag pont2-prim-dropdown-menu-item\n * @attr variant - default | destructive\n * @attr inset, disabled, close-on-click=\"false\"\n */\nexport class DropdownMenuItem extends MenuItemBase {\n static override identity = \"dropdown-menu-item\";\n static override slotName = \"dropdown-menu-item\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n declare variant: \"default\" | \"destructive\";\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\nconst indicator = (slot: string, on: boolean) =>\n html`<span data-pont2-dropdown-menu-item-indicator data-slot=${slot}>${on ? icons.check() : nothing}</span>`;\n\n/**\n * Base UI `Menu.CheckboxItem` (`role=menuitemcheckbox`). Stays open on\n * click by default, like Base UI. Fires `change` when toggled.\n *\n * @tag pont2-prim-dropdown-menu-checkbox-item\n * @attr checked\n * @fires change\n */\nexport class DropdownMenuCheckboxItem extends MenuItemBase {\n static override identity = \"dropdown-menu-checkbox-item\";\n static override slotName = \"dropdown-menu-checkbox-item\";\n static override role = \"menuitemcheckbox\";\n\n static override properties: PropertyDeclarations = {\n checked: { type: Boolean, reflect: true },\n };\n declare checked: boolean;\n\n constructor() {\n super();\n this.checked = false;\n this.closeOnClick = false;\n }\n\n protected override activate(): void {\n this.checked = !this.checked;\n fireNative(this, \"change\");\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.internals.ariaChecked = String(this.checked);\n this.setData(\"checked\", this.checked);\n this.setData(\"unchecked\", !this.checked);\n }\n\n override render() {\n return indicator(\"dropdown-menu-checkbox-item-indicator\", this.checked);\n }\n}\n\n/**\n * Base UI `Menu.RadioGroup` (`role=group`). Holds `value`; fires `change`\n * when a radio item is picked.\n *\n * @tag pont2-prim-dropdown-menu-radio-group\n * @attr value\n * @fires change\n */\nexport class DropdownMenuRadioGroup extends HostElement {\n static override identity = \"dropdown-menu-radio-group\";\n static override slotName = \"dropdown-menu-radio-group\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String, reflect: true },\n };\n declare value: string;\n\n constructor() {\n super();\n this.value = \"\";\n }\n\n select(value: string): void {\n if (value === this.value) return;\n this.value = value;\n fireNative(this, \"change\");\n }\n\n protected override updated(): void {\n for (const item of Array.from(this.querySelectorAll<DropdownMenuRadioItem>(sel(\"dropdown-menu-radio-item\")))) {\n if (item.closest(sel(\"dropdown-menu-radio-group\")) === this) item.requestUpdate();\n }\n }\n}\n\n/**\n * Base UI `Menu.RadioItem` (`role=menuitemradio`).\n *\n * @tag pont2-prim-dropdown-menu-radio-item\n * @attr value\n */\nexport class DropdownMenuRadioItem extends MenuItemBase {\n static override identity = \"dropdown-menu-radio-item\";\n static override slotName = \"dropdown-menu-radio-item\";\n static override role = \"menuitemradio\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n };\n declare value: string;\n\n constructor() {\n super();\n this.value = \"\";\n this.closeOnClick = false;\n }\n\n get group(): DropdownMenuRadioGroup | null {\n return this.closest(sel(\"dropdown-menu-radio-group\"));\n }\n get checked(): boolean {\n return !!this.group && this.group.value === this.value;\n }\n\n protected override activate(): void {\n this.group?.select(this.value);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.internals.ariaChecked = String(this.checked);\n this.setData(\"checked\", this.checked);\n this.setData(\"unchecked\", !this.checked);\n }\n\n override render() {\n return indicator(\"dropdown-menu-radio-item-indicator\", this.checked);\n }\n}\n\n/**\n * Base UI `Menu.SubmenuTrigger`: a menuitem that opens a submenu on hover\n * (100 ms), click, Enter/Space, or ArrowRight (ArrowLeft in RTL). Renders the\n * chevron after your content, as shadcn does.\n *\n * @tag pont2-prim-dropdown-menu-sub-trigger\n */\nexport class DropdownMenuSubTrigger extends MenuItemBase {\n static override identity = \"dropdown-menu-sub-trigger\";\n static override slotName = \"dropdown-menu-sub-trigger\";\n\n private hoverTimer = 0;\n\n constructor() {\n super();\n this.closeOnClick = false;\n this.addEventListener(\"keydown\", this.onKey);\n this.addEventListener(\"pointerenter\", this.onEnter);\n this.addEventListener(\"pointerleave\", () => clearTimeout(this.hoverTimer));\n }\n\n get sub(): DropdownMenuSub | null {\n return this.closest(sel(\"dropdown-menu-sub\"));\n }\n get isSubOpen(): boolean {\n return !!this.sub?.open;\n }\n\n protected override activate(): void {\n this.sub?.openWith(\"first\", \"trigger-press\");\n }\n\n private onEnter = (e: PointerEvent) => {\n if (e.pointerType === \"touch\" || this.disabled) return;\n clearTimeout(this.hoverTimer);\n this.hoverTimer = window.setTimeout(() => this.sub?.openWith(\"popup\", \"trigger-hover\"), 100);\n };\n\n private onKey = (e: KeyboardEvent) => {\n if (e.target !== this || this.disabled) return;\n const openKey = directionOf(this) === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n if (e.key === openKey) {\n e.preventDefault();\n e.stopPropagation();\n this.sub?.openWith(\"first\", \"list-navigation\");\n }\n };\n\n override render() {\n return icons.chevronRight();\n }\n}\n\n/** Base UI `Menu.Group` (`role=group`, labelled by its label). @tag pont2-prim-dropdown-menu-group */\nexport class DropdownMenuGroup extends HostElement {\n static override identity = \"dropdown-menu-group\";\n static override slotName = \"dropdown-menu-group\";\n static override role = \"group\";\n\n override connectedCallback(): void {\n super.connectedCallback();\n queueMicrotask(() => {\n const label = this.querySelector(`:scope > ${sel(\"dropdown-menu-label\")}`);\n if (label && !this.hasAttribute(\"aria-labelledby\")) {\n this.setAttribute(\"aria-labelledby\", ensureId(label, \"menu-label\"));\n }\n });\n }\n}\n\n/** Base UI `Menu.GroupLabel`. @tag pont2-prim-dropdown-menu-label @attr inset */\nexport class DropdownMenuLabel extends HostElement {\n static override identity = \"dropdown-menu-label\";\n static override slotName = \"dropdown-menu-label\";\n static override properties: PropertyDeclarations = { inset: { type: Boolean, reflect: true } };\n declare inset: boolean;\n constructor() {\n super();\n this.inset = false;\n }\n protected override willUpdate(): void {\n this.setData(\"inset\", this.inset);\n }\n}\n\n/**\n * Base UI `Menu.Separator`. **Is a** Separator (`extends Separator`), so it\n * carries `data-pont2-separator` (the look) and its own slot.\n *\n * @tag pont2-prim-dropdown-menu-separator\n */\nexport class DropdownMenuSeparator extends Separator {\n static override identity = \"dropdown-menu-separator\";\n static override slotName = \"dropdown-menu-separator\";\n}\n\n/** shadcn `DropdownMenuShortcut` (a `<span>`). @tag pont2-prim-dropdown-menu-shortcut */\nexport class DropdownMenuShortcut extends HostElement {\n static override identity = \"dropdown-menu-shortcut\";\n static override slotName = \"dropdown-menu-shortcut\";\n}\n\ndefine(\"pont2-prim-dropdown-menu\", DropdownMenu);\ndefine(\"pont2-prim-dropdown-menu-sub\", DropdownMenuSub);\ndefine(\"pont2-prim-dropdown-menu-trigger\", DropdownMenuTrigger);\ndefine(\"pont2-prim-dropdown-menu-content\", DropdownMenuContent);\ndefine(\"pont2-prim-dropdown-menu-sub-content\", DropdownMenuSubContent);\ndefine(\"pont2-prim-dropdown-menu-item\", DropdownMenuItem);\ndefine(\"pont2-prim-dropdown-menu-checkbox-item\", DropdownMenuCheckboxItem);\ndefine(\"pont2-prim-dropdown-menu-radio-group\", DropdownMenuRadioGroup);\ndefine(\"pont2-prim-dropdown-menu-radio-item\", DropdownMenuRadioItem);\ndefine(\"pont2-prim-dropdown-menu-sub-trigger\", DropdownMenuSubTrigger);\ndefine(\"pont2-prim-dropdown-menu-group\", DropdownMenuGroup);\ndefine(\"pont2-prim-dropdown-menu-label\", DropdownMenuLabel);\ndefine(\"pont2-prim-dropdown-menu-separator\", DropdownMenuSeparator);\ndefine(\"pont2-prim-dropdown-menu-shortcut\", DropdownMenuShortcut);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-dropdown-menu\": DropdownMenu;\n \"pont2-prim-dropdown-menu-sub\": DropdownMenuSub;\n \"pont2-prim-dropdown-menu-trigger\": DropdownMenuTrigger;\n \"pont2-prim-dropdown-menu-content\": DropdownMenuContent;\n \"pont2-prim-dropdown-menu-sub-content\": DropdownMenuSubContent;\n \"pont2-prim-dropdown-menu-item\": DropdownMenuItem;\n \"pont2-prim-dropdown-menu-checkbox-item\": DropdownMenuCheckboxItem;\n \"pont2-prim-dropdown-menu-radio-group\": DropdownMenuRadioGroup;\n \"pont2-prim-dropdown-menu-radio-item\": DropdownMenuRadioItem;\n \"pont2-prim-dropdown-menu-sub-trigger\": DropdownMenuSubTrigger;\n \"pont2-prim-dropdown-menu-group\": DropdownMenuGroup;\n \"pont2-prim-dropdown-menu-label\": DropdownMenuLabel;\n \"pont2-prim-dropdown-menu-separator\": DropdownMenuSeparator;\n \"pont2-prim-dropdown-menu-shortcut\": DropdownMenuShortcut;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { HostElement, ShellElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { isItemDisabled, isItemVisible, keyToMove, moveIndex, Typeahead } from \"../../core/popup/list\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot } from \"../../core/popup/popup-root\";\nimport { Separator } from \"../separator/separator\";\n\nconst ROOT = sel(\"select\");\nconst trueUnlessFalse = { fromAttribute: (v: string | null) => v !== \"false\", toAttribute: (v: boolean) => String(v) };\n\n/**\n * # Select\n *\n * shadcn: `<Select>` = Base UI `Select.Root` (renders a hidden `<input>` for\n * forms, nothing else) > `<SelectTrigger>` (`<button role=combobox>` with\n * `<SelectValue>` + chevron) + `<SelectContent>` (Portal > Positioner > Popup >\n * List > items).\n *\n * pont2:\n * ```html\n * <pont2-prim-select name=\"fruit\" value=\"apple\"> coordinator + form-associated, display: contents\n * <pont2-prim-select-trigger placeholder=\"Select a fruit\"></pont2-prim-select-trigger> shell > native <button>\n * <pont2-prim-select-content> the popup: [popover], role=listbox\n * <pont2-prim-select-group>\n * <pont2-prim-select-label>Fruits</pont2-prim-select-label>\n * <pont2-prim-select-item value=\"apple\">Apple</pont2-prim-select-item>\n * </pont2-prim-select-group>\n * </pont2-prim-select-content>\n * </pont2-prim-select>\n * ```\n *\n * The **root is the form control** (a form-associated custom element):\n * `name`/`value` submit with the form, `required` blocks submission,\n * `<fieldset disabled>` and form reset work, and `<label for=\"…\">` targets it\n * (the label's text becomes the trigger's accessible name). That replaces\n * Base UI's hidden `<input>`, one node fewer.\n *\n * @tag pont2-prim-select\n * @attr value - selected value (initially: Base UI `defaultValue`)\n * @attr name, required, disabled, open\n * @fires input, change - the user picked a value (read `.value`)\n * @fires pont2-open-change - cancelable `{ open, reason }`\n */\nexport class Select extends PopupRoot {\n static formAssociated = true;\n static override identity = \"select\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n name: { type: String, reflect: true },\n required: { type: Boolean, reflect: true },\n /** `aria-invalid` on the root is forwarded to the native trigger (which you do not write). */\n invalid: { type: String, attribute: \"aria-invalid\" },\n formDisabled: { state: true },\n };\n\n declare value: string;\n declare name: string;\n declare required: boolean;\n declare invalid: string | null;\n declare protected formDisabled: boolean;\n\n private typeahead = new Typeahead();\n private focusSelectedOnOpen = true;\n\n constructor() {\n super();\n this.value = \"\";\n this.name = \"\";\n this.required = false;\n this.formDisabled = false;\n // A <label for> click lands on the (box-less) root: forward focus to the trigger.\n this.addEventListener(\"click\", e => {\n if (e.target === this) this.triggerElement?.focus();\n });\n }\n\n /* ---------------- parts ---------------- */\n\n get triggerElement(): HTMLButtonElement | null {\n return ownQuery<SelectTrigger>(this, tags(\"select-trigger\"), ROOT)?.control ?? null;\n }\n get triggerHost(): SelectTrigger | null {\n return ownQuery<SelectTrigger>(this, tags(\"select-trigger\"), ROOT);\n }\n get contentElement(): SelectContent | null {\n return ownQuery<SelectContent>(this, sel(\"select-content\"), ROOT);\n }\n protected get popupKind() {\n return \"listbox\" as const;\n }\n get items(): SelectItem[] {\n return Array.from(this.querySelectorAll<SelectItem>(sel(\"select-item\"))).filter(\n i => i.closest(ROOT) === this && isItemVisible(i),\n );\n }\n get selectedItem(): SelectItem | null {\n return this.items.find(i => i.value === this.value) ?? null;\n }\n\n /* ---------------- form-associated API ---------------- */\n\n get form(): HTMLFormElement | null {\n return this.internals.form;\n }\n get labels(): NodeList {\n return this.internals.labels;\n }\n get validity(): ValidityState {\n return this.internals.validity;\n }\n get validationMessage(): string {\n return this.internals.validationMessage;\n }\n get isDisabled(): boolean {\n return this.disabled || this.formDisabled;\n }\n checkValidity(): boolean {\n return this.internals.checkValidity();\n }\n reportValidity(): boolean {\n return this.internals.reportValidity();\n }\n formResetCallback(): void {\n this.value = this.getAttribute(\"value\") ?? \"\";\n }\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n formStateRestoreCallback(state: string | null): void {\n if (typeof state === \"string\") this.value = state;\n }\n\n /* ---------------- behaviour ---------------- */\n\n override wire(): void {\n super.wire();\n // Labels of the (box-less) root name the trigger button.\n const trigger = this.triggerElement;\n if (trigger) {\n const ids = Array.from(this.internals.labels as NodeListOf<HTMLElement>).map(l => ensureId(l, \"select-label\"));\n if (ids.length && !trigger.hasAttribute(\"aria-label\")) trigger.setAttribute(\"aria-labelledby\", ids.join(\" \"));\n }\n }\n\n /** Pick `value` as the user did: updates, fires input/change, closes. */\n select(value: string): void {\n const changed = value !== this.value;\n this.value = value;\n if (changed) {\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n this.setOpen(false, \"item-press\");\n }\n\n /** Called by the trigger for keys pressed while it has focus. */\n handleTriggerKey(e: KeyboardEvent): void {\n if (this.isDisabled) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n this.setOpen(true, \"list-navigation\", { keyboard: true });\n return;\n }\n // Base UI: typing on a closed select picks the matching item directly.\n if (!this.open && Typeahead.isChar(e)) {\n const items = this.items;\n const i = this.typeahead.match(e.key, items, items.indexOf(this.selectedItem!), el => (el as SelectItem).label);\n if (i >= 0 && items[i].value !== this.value) {\n this.value = items[i].value;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n }\n }\n\n override setOpen(open: boolean, reason: Parameters<PopupRoot[\"setOpen\"]>[1], opts?: { keyboard?: boolean }): boolean {\n if (open && this.isDisabled) return false;\n return super.setOpen(open, reason, opts);\n }\n\n protected override afterOpen(): void {\n const content = this.contentElement;\n if (!content) return;\n const target = (this.focusSelectedOnOpen && this.selectedItem) || (this.openedByKeyboard ? this.items.find(i => !isItemDisabled(i)) : null);\n (target ?? content).focus({ preventScroll: true });\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n const disabled = this.isDisabled;\n this.setData(\"disabled\", disabled);\n this.setData(\"required\", this.required);\n this.internals.setFormValue(this.value || null);\n if (this.required && !this.value) {\n this.internals.setValidity({ valueMissing: true }, \"Please select an item in the list.\", this.triggerElement ?? undefined);\n } else {\n this.internals.setValidity({});\n }\n if (changed.has(\"value\") || changed.has(\"disabled\") || changed.has(\"formDisabled\") || changed.has(\"invalid\")) {\n for (const item of this.items) item.requestUpdate();\n this.triggerHost?.requestUpdate();\n }\n }\n}\n\n/* ==================================================================== */\n\n/**\n * shadcn `SelectTrigger` + `SelectValue`. Tier 3, **self-rendering**: the\n * trigger generates all of its content (the selected item's label or the\n * placeholder, then the chevron), so it renders its own native `<button>`\n * rather than enhancing one you write (docs/02-conventions.md, \"Tier 3\n * entry points\").\n *\n * ```\n * shadcn: button[data-slot=select-trigger][role=combobox] > span[data-slot=select-value] + svg\n * pont2: pont2-prim-select-trigger (shell) > button[data-slot=select-trigger][role=combobox] > span[data-slot=select-value] + svg\n * ```\n *\n * @tag pont2-prim-select-trigger\n * @attr placeholder - shown when no value is selected (Base UI `Select.Value` placeholder)\n * @attr size - default | sm\n */\nexport class SelectTrigger extends ShellElement {\n static override properties: PropertyDeclarations = {\n placeholder: { type: String },\n size: { type: String },\n };\n declare placeholder: string;\n declare size: \"default\" | \"sm\";\n\n constructor() {\n super();\n this.placeholder = \"\";\n this.size = \"default\";\n }\n\n get root(): Select | null {\n return this.closest(ROOT);\n }\n\n override get control(): HTMLButtonElement | null {\n return this.querySelector(\":scope > [data-pont2-select-trigger]\");\n }\n\n private onClick = (e: MouseEvent) => {\n const root = this.root;\n if (!root || root.isDisabled) return;\n root.toggle(\"trigger-press\", { keyboard: e.detail === 0 });\n };\n\n private onKeyDown = (e: KeyboardEvent) => this.root?.handleTriggerKey(e);\n\n protected override updated(): void {\n this.root?.wire();\n }\n\n override render() {\n const root = this.root;\n const item = root?.selectedItem ?? null;\n const disabled = !!root?.isDisabled;\n return html`<button\n type=\"button\"\n role=\"combobox\"\n data-pont2-select-trigger\n data-slot=\"select-trigger\"\n data-size=${this.size || \"default\"}\n ?data-placeholder=${!item}\n aria-invalid=${root?.invalid ?? nothing}\n ?disabled=${disabled}\n ?data-disabled=${disabled}\n @click=${this.onClick}\n @keydown=${this.onKeyDown}\n ><span data-pont2-select-value data-slot=\"select-value\" ?data-placeholder=${!item}\n >${item ? item.labelNodes() : this.placeholder}</span\n >${icons.chevronDown()}</button>`;\n }\n}\n\n/* ==================================================================== */\n\n/**\n * The popup (`role=listbox`). By default the selected item is laid over the\n * trigger (Base UI `alignItemWithTrigger`, macOS-style); when that cannot fit\n * it falls back to opening below the trigger.\n *\n * @tag pont2-prim-select-content\n * @attr align-item-with-trigger - default true; `=\"false\"` always opens on `side`\n * @attr side - bottom @attr align - center @attr side-offset - 4\n */\nexport class SelectContent extends PopupContent {\n static override identity = \"select-content\";\n static override slotName = \"select-content\";\n static override role = \"listbox\";\n\n static override properties: PropertyDeclarations = {\n alignItemWithTrigger: { attribute: \"align-item-with-trigger\", converter: trueUnlessFalse },\n };\n declare alignItemWithTrigger: boolean;\n\n private typeahead = new Typeahead();\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"center\";\n this.sideOffset = 4;\n this.alignItemWithTrigger = true;\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"pointerleave\", () => {\n if (this.contains(document.activeElement)) this.focus({ preventScroll: true });\n });\n }\n\n get root(): Select | null {\n return this.closest(ROOT);\n }\n\n protected override alignItem(): HTMLElement | null {\n if (!this.alignItemWithTrigger) return null;\n const root = this.root;\n return root?.selectedItem ?? root?.items[0] ?? null;\n }\n\n protected override willUpdate(): void {\n this.setData(\"align-trigger\", this.alignItemWithTrigger ? \"true\" : \"false\");\n }\n\n override show(): void {\n this.tabIndex = -1;\n super.show();\n // Bring the selected item into view inside the list, then re-measure.\n const item = this.root?.selectedItem;\n if (item) {\n const top = item.offsetTop;\n if (top < this.scrollTop || top + item.offsetHeight > this.scrollTop + this.clientHeight) {\n this.scrollTop = top - (this.clientHeight - item.offsetHeight) / 2;\n }\n }\n this.positioner.update();\n }\n\n private onKeyDown = (e: KeyboardEvent) => {\n const root = this.root;\n if (!root || e.defaultPrevented) return;\n const items = root.items;\n const current = items.indexOf(e.target as SelectItem);\n\n if (e.key === \"Tab\") {\n root.setOpen(false, \"focus-out\");\n root.triggerElement?.focus();\n return;\n }\n const move = keyToMove(e.key);\n if (move) {\n e.preventDefault();\n const next = moveIndex(items, current, move, { loop: false });\n if (next >= 0) items[next].focus();\n return;\n }\n if ((e.key === \"Enter\" || e.key === \" \") && current >= 0) {\n e.preventDefault();\n if (e.key === \" \" && this.typeahead.active) return;\n items[current].click();\n return;\n }\n if (Typeahead.isChar(e)) {\n const i = this.typeahead.match(e.key, items, current, el => (el as SelectItem).label);\n if (i >= 0) items[i].focus();\n }\n };\n}\n\n/* ==================================================================== */\n\n/**\n * Base UI `Select.Item` (`role=option`): host-as-root. Your content is the\n * item text (Base UI `ItemText`); the check indicator is rendered after it\n * when selected.\n *\n * @tag pont2-prim-select-item\n * @attr value - required\n * @attr label - text for typeahead and the trigger (defaults to the text content)\n * @attr disabled\n */\nexport class SelectItem extends HostElement {\n static override identity = \"select-item\";\n static override slotName = \"select-item\";\n static override role = \"option\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n };\n declare value: string;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.value = \"\";\n this.disabled = false;\n this.addEventListener(\"focus\", () => this.setData(\"highlighted\", true));\n this.addEventListener(\"blur\", () => this.setData(\"highlighted\", false));\n this.addEventListener(\"pointermove\", e => {\n if (e.pointerType !== \"touch\" && !this.disabled && document.activeElement !== this) this.focus({ preventScroll: true });\n });\n this.addEventListener(\"click\", e => {\n if (this.disabled) {\n e.stopImmediatePropagation();\n return;\n }\n this.root?.select(this.value);\n });\n }\n\n get root(): Select | null {\n return this.closest(ROOT);\n }\n get selected(): boolean {\n return !!this.root && this.root.value === this.value;\n }\n get label(): string {\n return this.getAttribute(\"label\") ?? this.textOf();\n }\n\n private textOf(): string {\n let t = \"\";\n for (const n of Array.from(this.childNodes)) {\n if (n instanceof Comment) continue; // lit-html part markers\n if (n instanceof Element && n.hasAttribute(\"data-pont2-select-item-indicator\")) continue;\n t += n.textContent ?? \"\";\n }\n return t.trim();\n }\n\n /** Copies of the author's content, for the trigger to display (Base UI renders the item label). */\n labelNodes(): Node[] {\n if (this.hasAttribute(\"label\")) return [document.createTextNode(this.getAttribute(\"label\")!)];\n return Array.from(this.childNodes)\n .filter(n => !(n instanceof Comment) && !(n instanceof Element && n.hasAttribute(\"data-pont2-select-item-indicator\")))\n .map(n => {\n const c = n.cloneNode(true);\n if (c instanceof Element) c.removeAttribute(\"id\");\n return c;\n });\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"tabindex\")) this.tabIndex = -1;\n }\n\n protected override willUpdate(): void {\n const selected = this.selected;\n this.internals.ariaSelected = String(selected);\n this.internals.ariaDisabled = this.disabled ? \"true\" : null;\n this.setData(\"selected\", selected);\n this.setData(\"disabled\", this.disabled);\n }\n\n override render() {\n return this.selected\n ? html`<span data-pont2-select-item-indicator data-slot=\"select-item-indicator\">${icons.check()}</span>`\n : nothing;\n }\n}\n\n/** Base UI `Select.Group` (`role=group`). @tag pont2-prim-select-group */\nexport class SelectGroup extends HostElement {\n static override identity = \"select-group\";\n static override slotName = \"select-group\";\n static override role = \"group\";\n override connectedCallback(): void {\n super.connectedCallback();\n queueMicrotask(() => {\n const label = this.querySelector(`:scope > ${sel(\"select-label\")}`);\n if (label && !this.hasAttribute(\"aria-labelledby\")) this.setAttribute(\"aria-labelledby\", ensureId(label, \"select-group-label\"));\n });\n }\n}\n\n/** Base UI `Select.GroupLabel`. @tag pont2-prim-select-label */\nexport class SelectLabel extends HostElement {\n static override identity = \"select-label\";\n static override slotName = \"select-label\";\n}\n\n/** Base UI `Select.Separator`; is-a Separator. @tag pont2-prim-select-separator */\nexport class SelectSeparator extends Separator {\n static override identity = \"select-separator\";\n static override slotName = \"select-separator\";\n}\n\ndefine(\"pont2-prim-select\", Select);\ndefine(\"pont2-prim-select-trigger\", SelectTrigger);\ndefine(\"pont2-prim-select-content\", SelectContent);\ndefine(\"pont2-prim-select-item\", SelectItem);\ndefine(\"pont2-prim-select-group\", SelectGroup);\ndefine(\"pont2-prim-select-label\", SelectLabel);\ndefine(\"pont2-prim-select-separator\", SelectSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-select\": Select;\n \"pont2-prim-select-trigger\": SelectTrigger;\n \"pont2-prim-select-content\": SelectContent;\n \"pont2-prim-select-item\": SelectItem;\n \"pont2-prim-select-group\": SelectGroup;\n \"pont2-prim-select-label\": SelectLabel;\n \"pont2-prim-select-separator\": SelectSeparator;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { ensureId, uid } from \"../../core/ids\";\nimport { define, sel } from \"../../core/names\";\nimport { isItemDisabled, isItemVisible, keyToMove, moveIndex } from \"../../core/popup/list\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot } from \"../../core/popup/popup-root\";\nimport { Separator } from \"../separator/separator\";\n\nconst ROOT = sel(\"combobox\");\nconst trueUnlessFalse = { fromAttribute: (v: string | null) => v !== \"false\", toAttribute: (v: boolean) => String(v) };\n\n/**\n * # Combobox (single selection)\n *\n * shadcn: `<Combobox>` = Base UI `Combobox.Root` (a hidden `<input>` for\n * forms, nothing else) > `<ComboboxInput>` (InputGroup > `<input\n * role=combobox>` + addon > trigger/clear buttons) + `<ComboboxContent>`\n * (Portal > Positioner > Popup) > `<ComboboxList role=listbox>` > items,\n * `<ComboboxEmpty>`, groups.\n *\n * pont2:\n * ```html\n * <pont2-prim-combobox name=\"framework\"> coordinator + form-associated, display: contents\n * <pont2-prim-combobox-input placeholder=\"Select a framework\"></pont2-prim-combobox-input> is the InputGroup; renders the native input + buttons\n * <pont2-prim-combobox-content> the popup: [popover]\n * <pont2-prim-combobox-empty>No items found.</pont2-prim-combobox-empty>\n * <pont2-prim-combobox-list> role=listbox\n * <pont2-prim-combobox-item value=\"next\">Next.js</pont2-prim-combobox-item>\n * </pont2-prim-combobox-list>\n * </pont2-prim-combobox-content>\n * </pont2-prim-combobox>\n * ```\n *\n * **Which element submits?** The root (a form-associated custom element)\n * submits `name` = the *selected item's value*, exactly what Base UI's hidden\n * input submits. The native `<input>` is the typing surface (IME, caret,\n * mobile keyboards, screen-reader combobox semantics) and has no `name`, so\n * the half-typed query never reaches the server.\n *\n * Focus stays in the input; the highlighted item is announced with\n * `aria-activedescendant` (virtual focus), as in Base UI.\n *\n * Not implemented yet: `multiple` with chips (`ComboboxChips`), async items,\n * `autoHighlight`, creatable items. See docs/primitives/combobox.md.\n *\n * @tag pont2-prim-combobox\n * @attr value - selected value (initially: Base UI `defaultValue`)\n * @attr name, required, disabled, open\n * @fires input, change - the user picked (or cleared) a value\n * @fires pont2-open-change - cancelable `{ open, reason }`\n */\nexport class Combobox extends PopupRoot {\n static formAssociated = true;\n static override identity = \"combobox\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n name: { type: String, reflect: true },\n required: { type: Boolean, reflect: true },\n query: { state: true },\n formDisabled: { state: true },\n };\n\n declare value: string;\n declare name: string;\n declare required: boolean;\n /** What the user typed since the popup opened; filters the items. */\n declare query: string;\n declare protected formDisabled: boolean;\n\n /** The virtually focused item. */\n highlighted: ComboboxItem | null = null;\n\n constructor() {\n super();\n this.value = \"\";\n this.name = \"\";\n this.required = false;\n this.query = \"\";\n this.formDisabled = false;\n this.addEventListener(\"click\", e => {\n if (e.target === this) this.inputElement?.focus(); // <label for> on the root\n });\n }\n\n /* ---------------- parts ---------------- */\n\n get inputHost(): ComboboxInput | null {\n return ownQuery<ComboboxInput>(this, sel(\"combobox-input\"), ROOT);\n }\n get inputElement(): HTMLInputElement | null {\n return this.inputHost?.control ?? null;\n }\n /** The input is the combobox element: it gets aria-expanded/controls and receives focus back. */\n get triggerElement(): HTMLInputElement | null {\n return this.inputElement;\n }\n get contentElement(): ComboboxContent | null {\n return ownQuery<ComboboxContent>(this, sel(\"combobox-content\"), ROOT);\n }\n get listElement(): ComboboxList | null {\n return ownQuery<ComboboxList>(this, sel(\"combobox-list\"), ROOT);\n }\n protected get popupKind() {\n return \"listbox\" as const;\n }\n protected override anchorElement(): Element | null {\n return this.inputHost;\n }\n protected override extraInsideElements(): (Element | null)[] {\n return [this.inputHost];\n }\n\n get allItems(): ComboboxItem[] {\n return Array.from(this.querySelectorAll<ComboboxItem>(sel(\"combobox-item\"))).filter(i => i.closest(ROOT) === this);\n }\n /** Items matching the current query. */\n get items(): ComboboxItem[] {\n return this.allItems.filter(i => isItemVisible(i));\n }\n get selectedItem(): ComboboxItem | null {\n return this.allItems.find(i => i.value === this.value) ?? null;\n }\n\n /* ---------------- form-associated API ---------------- */\n\n get form(): HTMLFormElement | null {\n return this.internals.form;\n }\n get labels(): NodeList {\n return this.internals.labels;\n }\n get validity(): ValidityState {\n return this.internals.validity;\n }\n get isDisabled(): boolean {\n return this.disabled || this.formDisabled;\n }\n checkValidity(): boolean {\n return this.internals.checkValidity();\n }\n reportValidity(): boolean {\n return this.internals.reportValidity();\n }\n formResetCallback(): void {\n this.value = this.getAttribute(\"value\") ?? \"\";\n this.syncInputText();\n }\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n formStateRestoreCallback(state: string | null): void {\n if (typeof state === \"string\") this.value = state;\n }\n\n /* ---------------- behaviour ---------------- */\n\n /** Base UI default filter: case- and accent-insensitive \"contains\". */\n static filter(label: string, query: string): boolean {\n const norm = (s: string) => s.normalize(\"NFD\").replace(/\\p{Diacritic}/gu, \"\").toLowerCase();\n return norm(label).includes(norm(query.trim()));\n }\n\n select(item: ComboboxItem | null): void {\n const value = item?.value ?? \"\";\n const changed = value !== this.value;\n this.value = value;\n this.query = \"\";\n this.syncInputText();\n if (changed) {\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n this.setOpen(false, \"item-press\");\n }\n\n /** Show the selected item's label in the input (after select/close/reset). */\n syncInputText(): void {\n const input = this.inputElement;\n if (input) input.value = this.selectedItem?.label ?? \"\";\n }\n\n highlight(item: ComboboxItem | null, scroll = true): void {\n if (this.highlighted === item) return;\n this.highlighted?.setHighlighted(false);\n this.highlighted = item;\n item?.setHighlighted(true);\n const input = this.inputElement;\n if (input) {\n if (item) input.setAttribute(\"aria-activedescendant\", ensureId(item, \"combobox-item\"));\n else input.removeAttribute(\"aria-activedescendant\");\n }\n if (item && scroll) item.scrollIntoView({ block: \"nearest\" });\n }\n\n /** From the input: the user typed. */\n handleQuery(text: string): void {\n this.query = text;\n if (!this.open) this.setOpen(true, \"input-change\");\n // Keep the highlight only if it is still visible.\n this.applyFilter();\n if (this.highlighted && !isItemVisible(this.highlighted)) this.highlight(null);\n }\n\n /** From the input: keyboard. */\n handleKey(e: KeyboardEvent): void {\n if (this.isDisabled) return;\n const move = e.key === \"ArrowDown\" || e.key === \"ArrowUp\" ? keyToMove(e.key) : null;\n if (move) {\n e.preventDefault();\n if (!this.open) {\n this.setOpen(true, \"list-navigation\", { keyboard: true });\n this.applyFilter();\n }\n const items = this.items;\n const current = this.highlighted ? items.indexOf(this.highlighted) : -1;\n const next = moveIndex(items, current, move);\n this.highlight(next >= 0 ? items[next] : null);\n return;\n }\n if (e.key === \"Enter\" && this.open) {\n e.preventDefault(); // never submit the form while choosing\n if (this.highlighted && !isItemDisabled(this.highlighted)) this.select(this.highlighted);\n return;\n }\n if (e.key === \"Tab\" && this.open) this.setOpen(false, \"focus-out\");\n }\n\n /** Hide items (and empty groups) that do not match the query. */\n applyFilter(): void {\n const q = this.query;\n let visible = 0;\n for (const item of this.allItems) {\n const show = !q || Combobox.filter(item.label, q);\n item.hidden = !show;\n if (show) visible++;\n }\n for (const group of Array.from(this.querySelectorAll<HTMLElement>(sel(\"combobox-group\")))) {\n if (group.closest(ROOT) !== this) continue;\n group.hidden = !group.querySelector(`${sel(\"combobox-item\")}:not([hidden])`);\n }\n const empty = visible === 0;\n this.listElement?.toggleAttribute(\"data-empty\", empty);\n this.contentElement?.toggleAttribute(\"data-empty\", empty);\n this.contentElement?.reposition();\n }\n\n override wire(): void {\n super.wire();\n const input = this.inputElement;\n const list = this.listElement;\n if (input && list) input.setAttribute(\"aria-controls\", ensureId(list, \"combobox-list\"));\n if (input) {\n const ids = Array.from(this.internals.labels as NodeListOf<HTMLElement>).map(l => ensureId(l, \"combobox-label\"));\n if (ids.length && !input.hasAttribute(\"aria-label\")) input.setAttribute(\"aria-labelledby\", ids.join(\" \"));\n }\n }\n\n protected override afterOpen(): void {\n this.applyFilter();\n if (this.openedByKeyboard && !this.highlighted) {\n const sel = this.selectedItem;\n this.highlight(sel && isItemVisible(sel) ? sel : null);\n }\n }\n\n protected override afterClose(): void {\n this.highlight(null);\n this.query = \"\";\n this.syncInputText();\n // Unfiltered again for next time, once the exit animation is done.\n setTimeout(() => {\n if (!this.open) this.applyFilter();\n }, 200);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.setData(\"disabled\", this.isDisabled);\n this.internals.setFormValue(this.value || null);\n if (this.required && !this.value) {\n this.internals.setValidity({ valueMissing: true }, \"Please select an item in the list.\", this.inputElement ?? undefined);\n } else {\n this.internals.setValidity({});\n }\n if (changed.has(\"value\")) {\n for (const item of this.allItems) item.requestUpdate();\n if (changed.get(\"value\") === undefined) queueMicrotask(() => this.syncInputText());\n }\n if (changed.has(\"disabled\") || changed.has(\"formDisabled\")) this.inputHost?.requestUpdate();\n }\n}\n\n/* ==================================================================== */\n\n/**\n * shadcn `ComboboxInput`: an InputGroup holding the native `<input>` and an\n * inline-end addon with the trigger (and optionally clear) button. The host\n * **is** the InputGroup (`role=group`, `data-slot=\"input-group\"`); it renders\n * the input and buttons because shadcn's ComboboxInput generates them too.\n *\n * ```\n * shadcn: div[data-slot=input-group] > input + div[data-slot=input-group-addon] > button[data-slot=input-group-button]\n * pont2: pont2-prim-combobox-input > input + div[data-slot=input-group-addon] > button[data-slot=input-group-button]\n * ```\n *\n * @tag pont2-prim-combobox-input\n * @attr placeholder\n * @attr show-trigger - default true; `=\"false\"` hides the chevron button\n * @attr show-clear - shows a clear (×) button while a value is selected\n */\nexport class ComboboxInput extends HostElement {\n static override identity = \"combobox-input\";\n static override slotName = \"input-group\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n placeholder: { type: String },\n showTrigger: { attribute: \"show-trigger\", converter: trueUnlessFalse },\n showClear: { type: Boolean, attribute: \"show-clear\" },\n };\n declare placeholder: string;\n declare showTrigger: boolean;\n declare showClear: boolean;\n\n private readonly inputId = uid(\"combobox-input\");\n\n constructor() {\n super();\n this.placeholder = \"\";\n this.showTrigger = true;\n this.showClear = false;\n }\n\n get root(): Combobox | null {\n return this.closest(ROOT);\n }\n get control(): HTMLInputElement | null {\n return this.querySelector(\":scope > input\");\n }\n\n override focus(options?: FocusOptions): void {\n this.control?.focus(options);\n }\n\n protected override updated(): void {\n this.root?.wire();\n }\n\n private onInput = (e: Event) => this.root?.handleQuery((e.target as HTMLInputElement).value);\n private onKeyDown = (e: KeyboardEvent) => this.root?.handleKey(e);\n private onInputClick = () => {\n const root = this.root;\n if (root && !root.open) root.setOpen(true, \"trigger-press\");\n };\n private onFocusOut = (e: FocusEvent) => {\n const root = this.root;\n const to = e.relatedTarget as Node | null;\n if (!root?.open) return;\n if (to && (this.contains(to) || root.contentElement?.contains(to))) return;\n root.setOpen(false, \"focus-out\");\n };\n private onTrigger = () => {\n const root = this.root;\n if (!root) return;\n root.query = \"\";\n root.toggle(\"trigger-press\");\n this.control?.focus();\n };\n private onClear = () => {\n const root = this.root;\n if (!root) return;\n root.select(null);\n this.control?.focus();\n };\n private onAddonClick = (e: MouseEvent) => {\n // InputGroupAddon: clicks on the addon (not its buttons) focus the input.\n if (!(e.target as Element).closest(\"button\")) this.control?.focus();\n };\n\n override render() {\n const root = this.root;\n const disabled = !!root?.isDisabled;\n const hasValue = !!root?.value;\n return html`<input\n id=${this.inputId}\n data-pont2-combobox-input-control\n data-slot=\"input-group-control\"\n type=\"text\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autocomplete=\"off\"\n placeholder=${this.placeholder || nothing}\n ?disabled=${disabled}\n aria-invalid=${root?.getAttribute(\"aria-invalid\") ?? nothing}\n @input=${this.onInput}\n @keydown=${this.onKeyDown}\n @click=${this.onInputClick}\n @focusout=${this.onFocusOut}\n /><div data-pont2-combobox-input-addon data-slot=\"input-group-addon\" data-align=\"inline-end\" role=\"group\" @click=${this.onAddonClick}>\n ${this.showTrigger && !(this.showClear && hasValue)\n ? html`<button\n type=\"button\"\n tabindex=\"-1\"\n data-pont2-button\n data-variant=\"ghost\"\n data-size=\"icon-xs\"\n data-slot=\"input-group-button\"\n data-combobox-trigger\n aria-label=\"Open\"\n ?disabled=${disabled}\n @mousedown=${(e: Event) => e.preventDefault()}\n @click=${this.onTrigger}\n >${icons.chevronDown()}</button>`\n : nothing}\n ${this.showClear && hasValue\n ? html`<button\n type=\"button\"\n data-pont2-button\n data-variant=\"ghost\"\n data-size=\"icon-xs\"\n data-slot=\"combobox-clear\"\n aria-label=\"Clear\"\n ?disabled=${disabled}\n @mousedown=${(e: Event) => e.preventDefault()}\n @click=${this.onClear}\n >${icons.x()}</button>`\n : nothing}\n </div>`;\n }\n}\n\n/* ==================================================================== */\n\n/**\n * The popup (Base UI `Combobox.Popup`, no role of its own: the list inside\n * is the listbox). Opens below the input, start-aligned, 6px away.\n *\n * @tag pont2-prim-combobox-content\n */\nexport class ComboboxContent extends PopupContent {\n static override identity = \"combobox-content\";\n static override slotName = \"combobox-content\";\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"start\";\n this.sideOffset = 6;\n // Keep focus in the input while the pointer interacts with the list.\n this.addEventListener(\"mousedown\", e => e.preventDefault());\n }\n}\n\n/** Base UI `Combobox.List` (`role=listbox`). @tag pont2-prim-combobox-list */\nexport class ComboboxList extends HostElement {\n static override identity = \"combobox-list\";\n static override slotName = \"combobox-list\";\n static override role = \"listbox\";\n}\n\n/**\n * Base UI `Combobox.Item` (`role=option`), host-as-root, never focused\n * (virtual focus). The check indicator is rendered after your content when\n * selected.\n *\n * @tag pont2-prim-combobox-item\n * @attr value, label, disabled\n */\nexport class ComboboxItem extends HostElement {\n static override identity = \"combobox-item\";\n static override slotName = \"combobox-item\";\n static override role = \"option\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n };\n declare value: string;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.value = \"\";\n this.disabled = false;\n this.addEventListener(\"pointermove\", e => {\n if (e.pointerType !== \"touch\" && !this.disabled) this.root?.highlight(this, false);\n });\n this.addEventListener(\"click\", () => {\n if (!this.disabled) this.root?.select(this);\n });\n }\n\n get root(): Combobox | null {\n return this.closest(ROOT);\n }\n get selected(): boolean {\n return !!this.root && !!this.root.value && this.root.value === this.value;\n }\n get label(): string {\n if (this.hasAttribute(\"label\")) return this.getAttribute(\"label\")!;\n let t = \"\";\n for (const n of Array.from(this.childNodes)) {\n if (n instanceof Comment) continue; // lit-html part markers\n if (n instanceof Element && n.hasAttribute(\"data-pont2-combobox-item-indicator\")) continue;\n t += n.textContent ?? \"\";\n }\n return t.trim();\n }\n\n setHighlighted(on: boolean): void {\n this.setData(\"highlighted\", on);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n ensureId(this, \"combobox-item\");\n }\n\n protected override willUpdate(): void {\n const selected = this.selected;\n this.internals.ariaSelected = String(selected);\n this.internals.ariaDisabled = this.disabled ? \"true\" : null;\n this.setData(\"selected\", selected);\n this.setData(\"disabled\", this.disabled);\n }\n\n override render() {\n return this.selected\n ? html`<span data-pont2-combobox-item-indicator data-slot=\"combobox-item-indicator\">${icons.check()}</span>`\n : nothing;\n }\n}\n\n/** Base UI `Combobox.Empty`: shown only while no item matches. @tag pont2-prim-combobox-empty */\nexport class ComboboxEmpty extends HostElement {\n static override identity = \"combobox-empty\";\n static override slotName = \"combobox-empty\";\n override connectedCallback(): void {\n super.connectedCallback();\n // Announced politely when it appears (Base UI renders it with role=status).\n this.internals.role = \"status\";\n this.internals.ariaLive = \"polite\";\n }\n}\n\n/** Base UI `Combobox.Group`. @tag pont2-prim-combobox-group */\nexport class ComboboxGroup extends HostElement {\n static override identity = \"combobox-group\";\n static override slotName = \"combobox-group\";\n static override role = \"group\";\n override connectedCallback(): void {\n super.connectedCallback();\n queueMicrotask(() => {\n const label = this.querySelector(`:scope > ${sel(\"combobox-label\")}`);\n if (label && !this.hasAttribute(\"aria-labelledby\")) this.setAttribute(\"aria-labelledby\", ensureId(label, \"combobox-group-label\"));\n });\n }\n}\n\n/** Base UI `Combobox.GroupLabel`. @tag pont2-prim-combobox-label */\nexport class ComboboxLabel extends HostElement {\n static override identity = \"combobox-label\";\n static override slotName = \"combobox-label\";\n}\n\n/** Base UI `Combobox.Separator`; is-a Separator. @tag pont2-prim-combobox-separator */\nexport class ComboboxSeparator extends Separator {\n static override identity = \"combobox-separator\";\n static override slotName = \"combobox-separator\";\n}\n\ndefine(\"pont2-prim-combobox\", Combobox);\ndefine(\"pont2-prim-combobox-input\", ComboboxInput);\ndefine(\"pont2-prim-combobox-content\", ComboboxContent);\ndefine(\"pont2-prim-combobox-list\", ComboboxList);\ndefine(\"pont2-prim-combobox-item\", ComboboxItem);\ndefine(\"pont2-prim-combobox-empty\", ComboboxEmpty);\ndefine(\"pont2-prim-combobox-group\", ComboboxGroup);\ndefine(\"pont2-prim-combobox-label\", ComboboxLabel);\ndefine(\"pont2-prim-combobox-separator\", ComboboxSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-combobox\": Combobox;\n \"pont2-prim-combobox-input\": ComboboxInput;\n \"pont2-prim-combobox-content\": ComboboxContent;\n \"pont2-prim-combobox-list\": ComboboxList;\n \"pont2-prim-combobox-item\": ComboboxItem;\n \"pont2-prim-combobox-empty\": ComboboxEmpty;\n \"pont2-prim-combobox-group\": ComboboxGroup;\n \"pont2-prim-combobox-label\": ComboboxLabel;\n \"pont2-prim-combobox-separator\": ComboboxSeparator;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot, PopupTrigger } from \"../../core/popup/popup-root\";\n\nconst ROOT = sel(\"tooltip\");\n\n/**\n * # Tooltip\n *\n * shadcn: `<TooltipProvider delay={0}>` > `<Tooltip>` (Base UI `Tooltip.Root`,\n * renders nothing) > `<TooltipTrigger>` (a `<button>`) + `<TooltipContent>`\n * (Portal > Positioner > Popup > children + `<Tooltip.Arrow>`).\n *\n * pont2: no Provider (a per-root `delay`, default 0 like shadcn's provider);\n * the arrow is the content's `::before`, so the popup is one node.\n *\n * ```html\n * <pont2-prim-tooltip>\n * <pont2-prim-tooltip-trigger><button data-pont2-button data-variant=\"outline\">Hover</button></pont2-prim-tooltip-trigger>\n * <pont2-prim-tooltip-content>Add to library</pont2-prim-tooltip-content>\n * </pont2-prim-tooltip>\n * ```\n *\n * Opens on pointer hover and on keyboard focus; closes on leave, blur,\n * Escape or press. The trigger is described by the content\n * (`aria-describedby`) while it is open.\n *\n * @tag pont2-prim-tooltip\n * @attr delay - ms before opening on hover (default 0)\n * @attr close-delay - ms before closing (default 0)\n */\nexport class Tooltip extends PopupRoot {\n static override identity = \"tooltip\";\n\n static override properties: PropertyDeclarations = {\n delay: { type: Number },\n closeDelay: { type: Number, attribute: \"close-delay\" },\n };\n declare delay: number;\n declare closeDelay: number;\n\n private timer = 0;\n\n constructor() {\n super();\n this.delay = 0;\n this.closeDelay = 0;\n }\n\n get triggerElement(): HTMLElement | null {\n return ownQuery<TooltipTrigger>(this, tags(\"tooltip-trigger\"), ROOT)?.control ?? null;\n }\n get contentElement(): TooltipContent | null {\n return ownQuery<TooltipContent>(this, sel(\"tooltip-content\"), ROOT);\n }\n protected get popupKind() {\n return \"true\" as const;\n }\n\n /** A tooltip is not a popup the trigger \"has\": no aria-haspopup/expanded, just a description. */\n override wire(): void {\n const content = this.contentElement;\n const trigger = this.triggerElement;\n if (content) {\n ensureId(content, \"tooltip\");\n content.onRequestClose = reason => this.setOpen(false, reason);\n content.anchorElement = () => this.triggerElement;\n content.insideElements = () => [];\n }\n if (trigger && content) {\n const ids = new Set((trigger.getAttribute(\"aria-describedby\") ?? \"\").split(/\\s+/).filter(Boolean));\n if (this.open) ids.add(content.id);\n else ids.delete(content.id);\n if (ids.size) trigger.setAttribute(\"aria-describedby\", [...ids].join(\" \"));\n else trigger.removeAttribute(\"aria-describedby\");\n trigger.toggleAttribute(\"data-popup-open\", this.open);\n }\n }\n\n schedule(open: boolean, reason: \"trigger-hover\" | \"trigger-focus\" | \"focus-out\"): void {\n clearTimeout(this.timer);\n const ms = open ? this.delay : this.closeDelay;\n if (ms <= 0) this.setOpen(open, reason);\n else this.timer = window.setTimeout(() => this.setOpen(open, reason), ms);\n }\n\n // Focus stays where it is: a tooltip never takes focus.\n protected override afterClose(): void {}\n}\n\n/** @tag pont2-prim-tooltip-trigger */\nexport class TooltipTrigger extends PopupTrigger {\n static override rootTag = ROOT;\n static override controlSlot = \"tooltip-trigger\";\n\n constructor() {\n super();\n this.addEventListener(\"pointerenter\", e => {\n if (e.pointerType !== \"touch\") (this.root as Tooltip | null)?.schedule(true, \"trigger-hover\");\n });\n this.addEventListener(\"pointerleave\", () => (this.root as Tooltip | null)?.schedule(false, \"trigger-hover\"));\n this.addEventListener(\"focusin\", e => {\n if ((e.target as Element).matches(\":focus-visible\")) (this.root as Tooltip | null)?.schedule(true, \"trigger-focus\");\n });\n this.addEventListener(\"focusout\", () => (this.root as Tooltip | null)?.schedule(false, \"focus-out\"));\n }\n\n /** Pressing the trigger closes the tooltip (Base UI), it never toggles it open. */\n protected override onClick(): void {\n const root = this.root;\n if (root?.open) root.setOpen(false, \"trigger-press\");\n }\n}\n\n/**\n * The tooltip popup (`role=tooltip`), `side=\"top\"` by default.\n *\n * @tag pont2-prim-tooltip-content\n * @cssprop --pont2-tooltip-bg, --pont2-tooltip-fg, --pont2-tooltip-radius - see docs/11-tokens.md (the arrow shares the background)\n * @cssprop --pont2-tooltip-max-width, --pont2-tooltip-padding-x, --pont2-tooltip-padding-y - sizes (defaults 20rem, 0.75rem, 0.375rem)\n */\nexport class TooltipContent extends PopupContent {\n static override identity = \"tooltip-content\";\n static override slotName = \"tooltip-content\";\n static override role = \"tooltip\";\n\n constructor() {\n super();\n this.side = \"top\";\n this.align = \"center\";\n this.sideOffset = 4;\n }\n}\n\ndefine(\"pont2-prim-tooltip\", Tooltip);\ndefine(\"pont2-prim-tooltip-trigger\", TooltipTrigger);\ndefine(\"pont2-prim-tooltip-content\", TooltipContent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-tooltip\": Tooltip;\n \"pont2-prim-tooltip-trigger\": TooltipTrigger;\n \"pont2-prim-tooltip-content\": TooltipContent;\n }\n}\n\n","import { defineAlias } from \"../core/names\";\nimport { Badge } from \"../primitives/badge/badge\";\nimport { Pont2Button } from \"../primitives/button/button\";\nimport { Checkbox } from \"../primitives/checkbox/checkbox\";\nimport { Pont2Input } from \"../primitives/input/input\";\nimport { Kbd, KbdGroup } from \"../primitives/kbd/kbd\";\nimport { Pont2Label } from \"../primitives/label/label\";\nimport { NativeSelect } from \"../primitives/native-select/native-select\";\nimport { Separator } from \"../primitives/separator/separator\";\nimport { Skeleton } from \"../primitives/skeleton/skeleton\";\nimport { Slider } from \"../primitives/slider/slider\";\nimport { Spinner } from \"../primitives/spinner/spinner\";\nimport { Switch } from \"../primitives/switch/switch\";\nimport { Table } from \"../primitives/table/table\";\nimport { Pont2Textarea } from \"../primitives/textarea/textarea\";\n\n/**\n * # Kit aliases: primitives promoted to the kit surface unchanged\n *\n * Each line gives a primitive a second tag without the `prim` segment.\n * The alias is an empty subclass (see `defineAlias`), so it behaves, styles,\n * announces and submits exactly like the primitive.\n *\n * What may be aliased (docs/10-primitives-and-kit.md, \"Promotion rules\"):\n *\n * 1. **Whole families only.** Every tag a primitive folder defines is aliased\n * together, so kit markup never mixes `pont2-*` and `pont2-prim-*`.\n * 2. **Only families that can never get a same-name composite**, because\n * turning an alias into a composite later is a breaking change. In\n * practice: families with no structural children to abstract (a button,\n * an input, a switch). A family with title/description/item children\n * (Card, Field, Select…) stays primitive-only until it is decided whether\n * it gets a composite.\n * 3. The alias tag is listed in the primitive's CSS selectors, so it is\n * styled before upgrade like the primitive tag (guardrail-checked).\n */\ndefineAlias(\"pont2-badge\", Badge);\ndefineAlias(\"pont2-button\", Pont2Button);\ndefineAlias(\"pont2-checkbox\", Checkbox);\ndefineAlias(\"pont2-input\", Pont2Input);\ndefineAlias(\"pont2-kbd\", Kbd);\ndefineAlias(\"pont2-kbd-group\", KbdGroup);\ndefineAlias(\"pont2-label\", Pont2Label);\ndefineAlias(\"pont2-native-select\", NativeSelect);\ndefineAlias(\"pont2-separator\", Separator);\ndefineAlias(\"pont2-skeleton\", Skeleton);\ndefineAlias(\"pont2-slider\", Slider);\ndefineAlias(\"pont2-spinner\", Spinner);\ndefineAlias(\"pont2-switch\", Switch);\ndefineAlias(\"pont2-table\", Table);\ndefineAlias(\"pont2-textarea\", Pont2Textarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-badge\": Badge;\n \"pont2-button\": Pont2Button;\n \"pont2-checkbox\": Checkbox;\n \"pont2-input\": Pont2Input;\n \"pont2-kbd\": Kbd;\n \"pont2-kbd-group\": KbdGroup;\n \"pont2-label\": Pont2Label;\n \"pont2-native-select\": NativeSelect;\n \"pont2-separator\": Separator;\n \"pont2-skeleton\": Skeleton;\n \"pont2-slider\": Slider;\n \"pont2-spinner\": Spinner;\n \"pont2-switch\": Switch;\n \"pont2-table\": Table;\n \"pont2-textarea\": Pont2Textarea;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { Alert, AlertDescription, AlertTitle } from \"../../primitives/alert/alert\";\n\nexport const ALERT_STATUSES = [\"default\", \"error\", \"warning\", \"success\", \"info\"] as const;\nexport type AlertStatus = (typeof ALERT_STATUSES)[number];\n\nconst STATUS_ICON: Record<AlertStatus, () => TemplateResult> = {\n default: icons.circleAlert,\n error: icons.circleX,\n warning: icons.triangleAlert,\n success: icons.circleCheck,\n info: icons.info,\n};\n\n/**\n * # `<pont2-alert>`: kit composite over `<pont2-prim-alert>`\n *\n * The props-driven form of shadcn's Alert, and pont2's version of the legacy\n * `pont-alert` (which composed `pont-callout`, the legacy shadcn alert).\n *\n * ```html\n * <pont2-alert status=\"error\" icon heading=\"Payment failed\"\n * description=\"Check your card details and try again.\"></pont2-alert>\n * ```\n *\n * renders exactly the DOM the primitive form produces:\n *\n * ```html\n * <pont2-alert data-pont2-alert data-slot=\"alert\" data-variant=\"destructive\" data-status=\"error\">\n * <svg …/>\n * <div data-pont2-alert-title data-slot=\"alert-title\">Payment failed</div>\n * <div data-pont2-alert-description data-slot=\"alert-description\">Check your…</div>\n * </pont2-alert>\n * ```\n *\n * - **It is a primitive Alert** (`extends Alert`): same identity, slot, recipe\n * and `variant`. Title and description are rendered as *parts* (plain divs\n * with the primitive's attributes), not nested elements.\n * - **What it adds** over shadcn: `status` (`error` maps to shadcn's\n * `destructive` variant; `warning`/`success`/`info` are coloured in\n * `@layer pont2.kit` with the `--pont2-sem-color-success|warning|info` tokens), a\n * status icon, and a status-appropriate role (`alert` for error/warning,\n * `status` otherwise, as the legacy `pont-alert` did). An author `role`\n * attribute still wins.\n * - **What it leaves out:** rich content (links, an action button). Use the\n * primitive form for those; a composite ignores author children.\n *\n * `heading` instead of `title`: `title` is a global HTML attribute that shows\n * a native tooltip, so the attribute would leak onto the whole alert.\n *\n * @tag pont2-alert\n * @attr status - default | error | warning | success | info\n * @attr heading - the alert title text\n * @attr description - the description text\n * @attr icon - show the status icon\n * @cssprop --pont2-alert-warning-fg, --pont2-alert-success-fg, --pont2-alert-info-fg - status colours (default the sem status colours)\n */\nexport class KitAlert extends Alert {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n status: { type: String, reflect: true },\n heading: { type: String },\n description: { type: String },\n icon: { type: Boolean, reflect: true },\n };\n\n declare status: AlertStatus;\n declare heading: string;\n declare description: string;\n declare icon: boolean;\n\n constructor() {\n super();\n this.status = \"default\";\n this.heading = \"\";\n this.description = \"\";\n this.icon = false;\n }\n\n protected override willUpdate(): void {\n const status = ALERT_STATUSES.includes(this.status) ? this.status : \"default\";\n // The primitive's `variant` stays its public styling contract; status drives it.\n this.variant = status === \"error\" ? \"destructive\" : \"default\";\n super.willUpdate();\n this.setData(\"status\", status);\n this.internals.role = status === \"error\" || status === \"warning\" ? \"alert\" : \"status\";\n }\n\n protected override render() {\n const status = ALERT_STATUSES.includes(this.status) ? this.status : \"default\";\n return html`${this.icon ? STATUS_ICON[status]() : nothing}${this.heading\n ? html`<div ${AlertTitle.part()}>${this.heading}</div>`\n : nothing}${this.description ? html`<div ${AlertDescription.part()}>${this.description}</div>` : nothing}`;\n }\n}\n\ndefine(\"pont2-alert\", KitAlert);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-alert\": KitAlert;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { define } from \"../../core/names\";\nimport { Avatar, AvatarBadge, AvatarFallback } from \"../../primitives/avatar/avatar\";\n\n/** \"Ada Lovelace\" → \"AL\", \"ada\" → \"A\". At most two letters, upper-cased. */\nexport function initials(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const letters = words.length > 1 ? [words[0], words[words.length - 1]] : words;\n return letters.map(w => Array.from(w)[0] ?? \"\").join(\"\").toLocaleUpperCase();\n}\n\n/**\n * # `<pont2-avatar>`: kit composite over `<pont2-prim-avatar>`\n *\n * ```html\n * <pont2-avatar src=\"/u/42.png\" alt=\"Ada Lovelace\" badge></pont2-avatar>\n * ```\n *\n * renders the primitive's DOM:\n *\n * ```html\n * <pont2-avatar data-pont2-avatar data-slot=\"avatar\" data-size=\"default\" data-image-loading-status=\"loaded\">\n * <img src=\"/u/42.png\" alt=\"Ada Lovelace\" data-pont2-avatar-image data-slot=\"avatar-image\">\n * <span data-pont2-avatar-fallback data-slot=\"avatar-fallback\">AL</span>\n * <span data-pont2-avatar-badge data-slot=\"avatar-badge\"></span>\n * </pont2-avatar>\n * ```\n *\n * - **It is a primitive Avatar** (`extends Avatar`): the primitive watches the\n * rendered `<img>` and swaps image and fallback on\n * `data-image-loading-status` as usual.\n * - **Fallback text:** `fallback`, else the initials of `alt`. When `alt` is\n * set the fallback is announced as an image named by `alt` (not as \"AL\"):\n * only one of image and fallback is ever displayed, so nothing is read twice.\n * - **Badge:** `badge` shows shadcn's status dot. For an icon inside the\n * badge, use the primitive form.\n *\n * @tag pont2-avatar\n * @attr src - image URL (no image is rendered without it)\n * @attr alt - image alternative text; also the source of the default initials\n * @attr fallback - fallback text (defaults to the initials of `alt`)\n * @attr size - default | sm | lg (primitive)\n * @attr badge - show the badge dot\n */\nexport class KitAvatar extends Avatar {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n src: { type: String },\n alt: { type: String },\n fallback: { type: String },\n badge: { type: Boolean, reflect: true },\n };\n\n declare src: string;\n declare alt: string;\n declare fallback: string;\n declare badge: boolean;\n\n constructor() {\n super();\n this.src = \"\";\n this.alt = \"\";\n this.fallback = \"\";\n this.badge = false;\n }\n\n protected override render() {\n const text = this.fallback || initials(this.alt);\n return html`${this.src ? html`<img src=${this.src} alt=${this.alt} />` : nothing}<span\n ${AvatarFallback.part(this.alt ? { role: \"img\", \"aria-label\": this.alt } : {})}\n >${text}</span\n >${this.badge ? html`<span ${AvatarBadge.part()}></span>` : nothing}`;\n }\n}\n\ndefine(\"pont2-avatar\", KitAvatar);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-avatar\": KitAvatar;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { InputOTP, InputOTPGroup, InputOTPSeparator } from \"../../primitives/input-otp/input-otp\";\n\n/** `groupSizes(6, 3)` → `[3, 3]`; `groupSizes(7, 3)` → `[3, 3, 1]`; size ≤ 0 → one group. */\nexport function groupSizes(length: number, size: number): number[] {\n const n = Math.max(0, Math.floor(length));\n const g = Math.floor(size);\n if (!(g > 0) || g >= n) return n ? [n] : [];\n const out: number[] = [];\n for (let left = n; left > 0; left -= g) out.push(Math.min(g, left));\n return out;\n}\n\n/**\n * The slot structure for `length` characters: groups of `groupSize` (one group\n * when 0), separators between groups when `separator`. Groups and separators\n * are parts; slots are `pont2-prim-input-otp-slot` elements (they have\n * behaviour). Shared with the OTP field (kit/otp-field).\n */\nexport function otpGroups(length: number, groupSize: number, separator: boolean) {\n let index = 0;\n return groupSizes(length, groupSize).map((n, g) => {\n const slots = Array.from({ length: n }, () => {\n const i = index++;\n return html`<pont2-prim-input-otp-slot index=${i}></pont2-prim-input-otp-slot>`;\n });\n const sep = g > 0 && separator ? html`<div ${InputOTPSeparator.part()}>${icons.minus()}</div>` : nothing;\n return html`${sep}<div ${InputOTPGroup.part()}>${slots}</div>`;\n });\n}\n\n/**\n * # `<pont2-input-otp>`: kit composite over `<pont2-prim-input-otp>`\n *\n * ```html\n * <pont2-input-otp name=\"code\" maxlength=\"6\" group-size=\"3\" separator aria-label=\"Verification code\"></pont2-input-otp>\n * ```\n *\n * renders the primitive's DOM, which is shadcn's:\n *\n * ```html\n * <pont2-input-otp data-pont2-input-otp …>\n * <div data-pont2-input-otp-group data-slot=\"input-otp-group\">\n * <pont2-prim-input-otp-slot index=\"0\"></pont2-prim-input-otp-slot> ×3\n * </div>\n * <div data-pont2-input-otp-separator data-slot=\"input-otp-separator\" role=\"separator\"><svg/></div>\n * <div data-pont2-input-otp-group …> …×3 </div>\n * <div data-pont2-input-otp-input-wrapper><input data-slot=\"input-otp\" autocomplete=\"one-time-code\" …></div>\n * </pont2-input-otp>\n * ```\n *\n * - **It is a primitive InputOTP** (`extends InputOTP`): the one native input,\n * form participation, paste cleaning, `pont2-complete` and every primitive\n * attribute (`maxlength`, `pattern`, `value`, `name`, `required`,\n * `disabled`, `aria-*`) work unchanged.\n * - **What it adds:** the slots are generated from `maxlength`, split into\n * groups of `group-size` (one group when absent), with a separator between\n * groups when `separator` is set.\n * - Groups and separators are **parts** (plain divs). Slots are rendered as\n * `pont2-prim-input-otp-slot` **elements**, because each slot has behaviour\n * (it draws its character and the fake caret from state the root pushes in).\n *\n * @tag pont2-input-otp\n * @attr group-size - characters per group (default: all in one group)\n * @attr separator - draw a separator between groups\n */\nexport class KitInputOTP extends InputOTP {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n groupSize: { type: Number, attribute: \"group-size\" },\n separator: { type: Boolean },\n };\n\n declare groupSize: number;\n declare separator: boolean;\n\n constructor() {\n super();\n this.groupSize = 0;\n this.separator = false;\n }\n\n override render() {\n // The primitive renders the native input last, where input-otp puts it.\n return html`${otpGroups(this.maxLength, this.groupSize, this.separator)}${super.render()}`;\n }\n}\n\ndefine(\"pont2-input-otp\", KitInputOTP);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-input-otp\": KitInputOTP;\n }\n}\n","import { html, svg, type SVGTemplateResult } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\n\n/**\n * Sign-in providers: display names and brand marks.\n *\n * The marks are Simple Icons (https://simpleicons.org, CC0-1.0), the same\n * geometry the legacy kit ships (src/components/renderers/auth/button/\n * button.defs.ts). pont2 keeps its own copy because it imports nothing from\n * the legacy kit (docs/08-parallel-constraints.md).\n */\nexport const AUTH_PROVIDERS = [\"apple\", \"discord\", \"facebook\", \"github\", \"google\", \"linkedin\", \"meta\", \"microsoft\", \"x\"] as const;\nexport type AuthProvider = (typeof AUTH_PROVIDERS)[number];\n\nexport const PROVIDER_NAMES: Record<AuthProvider, string> = {\n apple: \"Apple\",\n discord: \"Discord\",\n facebook: \"Facebook\",\n github: \"GitHub\",\n google: \"Google\",\n linkedin: \"LinkedIn\",\n meta: \"Meta\",\n microsoft: \"Microsoft\",\n x: \"X\",\n};\n\nconst MARKS: Record<AuthProvider, SVGTemplateResult> = {\n apple: svg`<path d=\"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701\" />`,\n discord: svg`<path d=\"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z\" />`,\n facebook: svg`<path d=\"M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z\" />`,\n github: svg`<path d=\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\" />`,\n google: svg`<path d=\"M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z\" />`,\n linkedin: svg`<path d=\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z\" />`,\n meta: svg`<path d=\"M6.915 4.03c-1.968 0-3.683 1.28-4.871 3.113C.704 9.208 0 11.883 0 14.449c0 .706.07 1.369.21 1.973a6.624 6.624 0 0 0 .265.86 5.297 5.297 0 0 0 .371.761c.696 1.159 1.818 1.927 3.593 1.927 1.497 0 2.633-.671 3.965-2.444.76-1.012 1.144-1.626 2.663-4.32l.756-1.339.186-.325c.061.1.121.196.183.3l2.152 3.595c.724 1.21 1.665 2.556 2.47 3.314 1.046.987 1.992 1.22 3.06 1.22 1.075 0 1.876-.355 2.455-.843a3.743 3.743 0 0 0 .81-.973c.542-.939.861-2.127.861-3.745 0-2.72-.681-5.357-2.084-7.45-1.282-1.912-2.957-2.93-4.716-2.93-1.047 0-2.088.467-3.053 1.308-.652.57-1.257 1.29-1.82 2.05-.69-.875-1.335-1.547-1.958-2.056-1.182-.966-2.315-1.303-3.454-1.303zm10.16 2.053c1.147 0 2.188.758 2.992 1.999 1.132 1.748 1.647 4.195 1.647 6.4 0 1.548-.368 2.9-1.839 2.9-.58 0-1.027-.23-1.664-1.004-.496-.601-1.343-1.878-2.832-4.358l-.617-1.028a44.908 44.908 0 0 0-1.255-1.98c.07-.109.141-.224.211-.327 1.12-1.667 2.118-2.602 3.358-2.602zm-10.201.553c1.265 0 2.058.791 2.675 1.446.307.327.737.871 1.234 1.579l-1.02 1.566c-.757 1.163-1.882 3.017-2.837 4.338-1.191 1.649-1.81 1.817-2.486 1.817-.524 0-1.038-.237-1.383-.794-.263-.426-.464-1.13-.464-2.046 0-2.221.63-4.535 1.66-6.088.454-.687.964-1.226 1.533-1.533a2.264 2.264 0 0 1 1.088-.285z\" />`,\n microsoft: svg`<path d=\"M11.4 24H0V12.6h11.4V24zM24 24H12.6V12.6H24V24zM11.4 11.4H0V0h11.4v11.4zM24 11.4H12.6V0H24v11.4z\" />`,\n x: svg`<path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.763l7.726-8.835L1.254 2.25H8.08l4.713 6.231 5.45-6.231zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77z\" />`,\n};\n\nexport const isAuthProvider = (p: unknown): p is AuthProvider => AUTH_PROVIDERS.includes(p as AuthProvider);\n\n/** A provider's brand mark as an `<svg>` (filled with `currentColor`, aria-hidden). */\nexport function providerIcon(provider: AuthProvider, extra: AttrMap = {}) {\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-provider-icon=${provider}\n ${attrs(extra)}\n >${MARKS[provider]}</svg>`;\n}\n","import { html, nothing, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { ButtonBase, type ButtonOptions } from \"../../primitives/button/button\";\nimport { Spinner } from \"../../primitives/spinner/spinner\";\nimport { PROVIDER_NAMES, isAuthProvider, providerIcon, type AuthProvider } from \"./providers\";\n\nexport { AUTH_PROVIDERS, PROVIDER_NAMES, providerIcon, type AuthProvider } from \"./providers\";\n\n/** What the button shows: the legacy kit's `content` prop. */\nexport const AUTH_BUTTON_CONTENTS = [\"label\", \"icon-label\", \"icon\"] as const;\nexport type AuthButtonContent = (typeof AUTH_BUTTON_CONTENTS)[number];\nexport const AUTH_BUTTON_ICON_ALIGNS = [\"start\", \"end\"] as const;\nexport type AuthButtonIconAlign = (typeof AUTH_BUTTON_ICON_ALIGNS)[number];\n\n/**\n * # AuthButton: the shared base of the auth-flow buttons\n *\n * An auth button **is a Button** (`extends ButtonBase`: variant, size,\n * disabled, type… inherited, nothing forwarded) and **has action behaviour**\n * (`ActionController`: the `pont2-action` request/response protocol, see\n * core/controllers/action.ts). Its DOM is the button primitive's:\n *\n * ```html\n * <pont2-provider-button provider=\"google\" data-pont2-shell> ← display: contents\n * <button data-pont2-button data-slot=\"button\" data-variant=\"outline\" data-provider=\"google\" type=\"button\">\n * <svg data-icon=\"inline-start\" …/>Continue with Google\n * </button>\n * </pont2-provider-button>\n * ```\n *\n * Two nodes; the legacy `pont-provider-button > pont-button > button` has three.\n *\n * While busy (a `respondWith()` promise is pending, or `loading` is set) the\n * button shows a spinner in place of its icon, sets `aria-busy`, and is\n * disabled *focusably* (`aria-disabled`, Base UI's `focusableWhenDisabled`),\n * so keyboard focus is not lost mid-request and a second press is ignored.\n *\n * Subclasses provide the default copy, the icon, and what a press does.\n */\nexport abstract class AuthButton extends ButtonBase {\n static override composite = true;\n\n // Lit merges these with ButtonBase's (variant, size, disabled, type …).\n static override properties: PropertyDeclarations = {\n content: { type: String },\n iconAlign: { type: String, attribute: \"icon-align\" },\n label: { type: String },\n event: { type: String },\n loading: { type: Boolean, reflect: true },\n };\n\n /**\n * `label` (default), `icon-label` or `icon` (icon only; the label becomes the\n * accessible name). Icon-only keeps the text size, as shadcn's login blocks\n * do: at the default size it is already near-square (38×36px, as shadcn's),\n * and it can still stretch to fill a grid cell (`w-full`). Set\n * `size=\"icon\"` for a fixed square.\n */\n declare content: AuthButtonContent;\n declare iconAlign: AuthButtonIconAlign;\n /** Visible text (and accessible name). Each button has a default. */\n declare label: string;\n /** The action requested on press (a login-flow event id). */\n declare event: string | undefined;\n /** Busy state set by the owner, in addition to a pending `respondWith()`. */\n declare loading: boolean;\n\n protected readonly action = new ActionController(this);\n\n constructor() {\n super();\n this.content = \"label\";\n this.iconAlign = \"start\";\n this.label = \"\";\n this.event = undefined;\n this.loading = false;\n }\n\n /** True while a request is pending or `loading` is set. */\n get busy(): boolean {\n return this.loading || this.action.busy;\n }\n\n /** The text used when `label` is empty. */\n protected abstract defaultLabel(): string;\n /** The button's icon, with the attributes shadcn's button CSS keys on. */\n protected abstract renderIcon(attrs: Record<string, string>): TemplateResult | typeof nothing;\n /** Data sent with the `pont2-action` request. */\n protected actionData(): Record<string, unknown> {\n return {};\n }\n /** What a press does. The default requests the action. */\n protected onPress(_e: MouseEvent): void {\n this.action.request(this.event, this.actionData());\n }\n\n protected get text(): string {\n return this.label || this.defaultLabel();\n }\n\n protected override buttonOptions(): ButtonOptions {\n const base = super.buttonOptions();\n const iconOnly = this.content === \"icon\";\n const busy = this.busy;\n return {\n ...base,\n disabled: base.disabled || busy,\n // Busy is a transient disabled state: keep focus where the user left it.\n focusableWhenDisabled: base.focusableWhenDisabled || (busy && !base.disabled),\n attrs: {\n \"data-event\": this.event,\n \"data-loading\": busy,\n \"aria-busy\": busy ? \"true\" : null,\n \"aria-label\": iconOnly ? this.text : null,\n ...this.extraAttrs(),\n },\n onClick: e => this.onPress(e),\n };\n }\n\n /** Extra attributes for the native button (`data-provider` …). */\n protected extraAttrs(): Record<string, string | boolean | null | undefined> {\n return {};\n }\n\n protected override renderContent() {\n const showIcon = this.content !== \"label\";\n const showLabel = this.content !== \"icon\";\n // The icon slot holds the spinner while busy, even for label-only buttons.\n const slot = this.content === \"icon\" ? null : this.iconAlign === \"end\" ? \"inline-end\" : \"inline-start\";\n const mark = (a: Record<string, string>) =>\n this.busy\n ? html`<span ${Spinner.part({ ...a, role: false, \"aria-hidden\": \"true\" })}></span>`\n : showIcon\n ? this.renderIcon(a)\n : nothing;\n const icon = mark(slot ? { \"data-icon\": slot } : {});\n return this.iconAlign === \"end\"\n ? html`${showLabel ? this.text : nothing}${icon}`\n : html`${icon}${showLabel ? this.text : nothing}`;\n }\n}\n\n/* ==================================================================== */\n\n/**\n * # `<pont2-provider-button>`: sign in with an identity provider\n *\n * ```html\n * <pont2-provider-button provider=\"google\" event=\"oauth_google\"></pont2-provider-button>\n * ```\n *\n * Defaults: `variant=\"outline\"`, `content=\"icon-label\"`, label\n * \"`prompt` + provider name\" (\"Continue with Google\"). Pressing requests\n * `event` with `{ provider }` (see AuthButton).\n *\n * @tag pont2-provider-button\n * @attr provider - apple | discord | facebook | github | google | linkedin | meta | microsoft | x\n * @attr prompt - text before the provider name in the default label (default \"Continue with\")\n * @attr label - replaces the whole default label\n * @attr event - the action requested on press\n * @attr content - label | icon-label (default) | icon\n * @attr icon-align - start (default) | end\n * @attr loading - busy state set by the owner\n * @fires pont2-action - `{ action, data: { provider }, respondWith }` on press\n * @fires pont2-action-success - `{ action, data, result }`\n * @fires pont2-action-error - `{ action, data, error, message }`\n */\nexport class ProviderButton extends AuthButton {\n static override properties: PropertyDeclarations = {\n provider: { type: String, reflect: true },\n prompt: { type: String },\n };\n\n declare provider: AuthProvider;\n declare prompt: string;\n\n /** Design mode (core/design-mode.ts): a sample provider until the author picks one. */\n protected readonly design = new DesignModeController(this);\n\n /** The provider shown: `provider`, or \"google\" in design mode when none is set (the legacy sample). */\n get shownProvider(): AuthProvider {\n return !this.provider && this.design.active ? \"google\" : this.provider;\n }\n\n constructor() {\n super();\n this.variant = \"outline\";\n this.content = \"icon-label\";\n this.prompt = \"Continue with\";\n }\n\n protected defaultLabel(): string {\n const provider = this.shownProvider;\n const name = isAuthProvider(provider) ? PROVIDER_NAMES[provider] : (provider ?? \"\");\n return `${this.prompt || \"Continue with\"} ${name}`.trim();\n }\n\n protected renderIcon(a: Record<string, string>) {\n const provider = this.shownProvider;\n return isAuthProvider(provider) ? providerIcon(provider, a) : nothing;\n }\n\n protected override actionData() {\n return { provider: this.provider };\n }\n\n protected override extraAttrs() {\n return { \"data-provider\": this.shownProvider };\n }\n}\n\n/* ==================================================================== */\n\n/**\n * # `<pont2-passkey-button>`: sign in with a passkey\n *\n * ```html\n * <pont2-passkey-button event=\"passkey_login\"></pont2-passkey-button>\n * ```\n *\n * Defaults: `variant=\"secondary\"`, `content=\"label\"`, label \"Continue with\n * Passkey\", icon lucide `user-round-key`. Pressing requests `event`.\n *\n * The listener must start the WebAuthn call synchronously (call\n * `respondWith()` with the promise straight away). The request is dispatched\n * inside the click, so the call keeps the user activation that\n * `navigator.credentials.get()` needs in Safari.\n *\n * @tag pont2-passkey-button\n * @attr label, event, content, icon-align, loading - see ProviderButton\n * @fires pont2-action, pont2-action-success, pont2-action-error\n */\nexport class PasskeyButton extends AuthButton {\n constructor() {\n super();\n this.variant = \"secondary\";\n }\n\n protected defaultLabel(): string {\n return \"Continue with Passkey\";\n }\n\n protected renderIcon(a: Record<string, string>) {\n return icons.userRoundKey(a);\n }\n}\n\n/* ==================================================================== */\n\n/**\n * # `<pont2-submit-button>`: submit an auth form\n *\n * ```html\n * <form>\n * …fields…\n * <pont2-submit-button event=\"submit_password\"></pont2-submit-button>\n * </form>\n * ```\n *\n * A real `<button type=\"submit\">`, so the browser's own submission rules\n * apply: Enter in a field submits, constraint validation (`required`,\n * `type=\"email\"` …) blocks an invalid form, and `SubmitEvent.submitter` is\n * this button.\n *\n * When its form **submits** (not merely when it is clicked), the button\n * requests `event` with `{ form, formData }` (the FormData includes this\n * button's `name`/`value`, if any):\n *\n * - a listener calls `respondWith()` → the native submission is prevented\n * (the flow is handled in-page) and the button is busy until it settles;\n * - nobody responds → the form submits natively (progressive enhancement:\n * a plain `<form action>` still works).\n *\n * A submission without a submitter (`form.requestSubmit()`, e.g. an OTP\n * auto-submit) is handled by the form's **default button** (its first submit\n * button), as the browser does for implicit submission.\n *\n * Outside a form, a press requests the action directly.\n *\n * Defaults: `variant=\"default\"`, `content=\"label\"`, `icon-align=\"end\"`,\n * label \"Submit\", icon lucide `arrow-right`.\n *\n * @tag pont2-submit-button\n * @attr label, event, content, icon-align, loading - see ProviderButton\n * @fires pont2-action - `{ action, data: { form, formData }, respondWith }` on submit\n * @fires pont2-action-success, pont2-action-error\n */\nexport class SubmitButton extends AuthButton {\n constructor() {\n super();\n this.type = \"submit\";\n this.iconAlign = \"end\";\n }\n\n protected defaultLabel(): string {\n return \"Submit\";\n }\n\n protected renderIcon(a: Record<string, string>) {\n return icons.arrowRight(a);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n // Capture on the document: runs before the form's own submit listeners,\n // and catches implicit submission (Enter) where this is the default button.\n document.addEventListener(\"submit\", this.onSubmit, true);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"submit\", this.onSubmit, true);\n }\n\n protected override onPress(_e: MouseEvent): void {\n const c = this.control;\n // In a form, the submit event drives the request (after validation passes).\n if (c instanceof HTMLButtonElement && c.form && this.type === \"submit\") return;\n this.action.request(this.event, {});\n }\n\n private onSubmit = (e: SubmitEvent) => {\n const c = this.control;\n const form = c instanceof HTMLButtonElement ? c.form : null;\n if (!c || !form || form !== e.target) return;\n // A submit without a submitter (`form.requestSubmit()`, an OTP auto-submit)\n // belongs to the form's default button, as implicit submission does.\n const isDefault = !e.submitter && Array.from(form.elements).find(el => (el as HTMLButtonElement).type === \"submit\") === c;\n if (e.submitter !== c && !isDefault) return;\n if (this.busy) {\n e.preventDefault(); // a second submit while the first is pending\n return;\n }\n const formData = new FormData(form, c);\n if (this.action.request(this.event, { form, formData })) e.preventDefault();\n };\n}\n\ndefine(\"pont2-provider-button\", ProviderButton);\ndefine(\"pont2-passkey-button\", PasskeyButton);\ndefine(\"pont2-submit-button\", SubmitButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-provider-button\": ProviderButton;\n \"pont2-passkey-button\": PasskeyButton;\n \"pont2-submit-button\": SubmitButton;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues, type TemplateResult } from \"lit\";\n\nimport { parseList } from \"../../core/attrs\";\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { fire } from \"../../core/events\";\nimport { uid } from \"../../core/ids\";\nimport { define } from \"../../core/names\";\nimport { Field, FieldDescription, FieldError, fieldLabel } from \"../../primitives/field/field\";\nimport { input, type InputOptions } from \"../../primitives/input/input\";\n\n/* ==================================================================== */\n/* Messages */\n/* ==================================================================== */\n\nconst cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n\n/**\n * Default error copy, identical to the legacy kit's (field.defs.ts), so\n * existing screens read the same. Every message is overridable per field\n * (`required-error`, `format-error` …). Localised copy is expected from the\n * render spec / widget.\n */\nexport const fieldMessages = {\n required: (label: string) => `${cap(label)} is a required field.`,\n format: (label: string) => `Please enter a valid ${label.toLowerCase()}.`,\n minlength: (label: string, n?: number) =>\n n ? `${cap(label)} must be at least ${n} characters.` : `Please enter a longer ${label.toLowerCase()}.`,\n maxlength: (label: string, n?: number) =>\n n ? `${cap(label)} can have at most ${n} characters.` : `Please enter a shorter ${label.toLowerCase()}.`,\n};\n\n/* ==================================================================== */\n/* Types */\n/* ==================================================================== */\n\nexport type FieldIssueType = \"required\" | \"minlength\" | \"maxlength\" | \"format\" | \"rule\" | \"match\" | \"incomplete\";\n\nexport interface FieldIssue {\n type: FieldIssueType;\n message: string;\n}\n\n/** `pont2-field-validate` detail. The value is deliberately not included (passwords). */\nexport interface FieldValidateDetail {\n name: string;\n valid: boolean;\n issues: FieldIssue[];\n}\n\n/** \"default\": every rule; \"simple\": `required` only (the legacy `validation` attribute). */\nexport const FIELD_VALIDATION_MODES = [\"default\", \"simple\"] as const;\nexport type FieldValidationMode = (typeof FIELD_VALIDATION_MODES)[number];\n\n/** Compiles a pattern source, preferring Unicode mode (needed for `\\p{L}`). */\nexport function compilePattern(source: string): RegExp | null {\n if (!source) return null;\n try {\n return new RegExp(source, \"u\");\n } catch {\n try {\n return new RegExp(source);\n } catch {\n return null;\n }\n }\n}\n\n/** Positive integers only (legacy: values ≤ 0 are ignored). */\nconst positive = { fromAttribute: (v: string | null) => (v != null && Number(v) > 0 ? Number(v) : undefined) };\n\n/* The first invalid field of a validation pass takes focus (see onInvalid). */\nlet focusClaimed = false;\n\n/* ==================================================================== */\n/* AuthField */\n/* ==================================================================== */\n\n/**\n * # AuthField: the shared base of the auth-flow text fields\n *\n * An auth field **is a Field** (`extends Field`: the host is shadcn's\n * `div[role=group][data-slot=field]`, styled by the field recipe, with\n * `data-invalid` / `data-disabled`) that renders its label, control,\n * description and error from properties, as parts:\n *\n * ```html\n * <pont2-email-field data-pont2-field data-slot=\"field\" data-orientation=\"vertical\" [data-invalid]>\n * <label data-pont2-label data-pont2-field-label data-slot=\"field-label\" for=\"…-input\">Email</label>\n * <input data-pont2-input data-slot=\"input\" id=\"…-input\" name=\"email\" type=\"email\"\n * autocomplete=\"email\" aria-describedby=\"…-description …-error\" [aria-invalid=\"true\"]>\n * <p data-pont2-field-description data-slot=\"field-description\" id=\"…-description\">…</p>\n * <div data-pont2-field-error data-slot=\"field-error\" role=\"alert\" id=\"…-error\">Please enter a valid email.</div>\n * </pont2-email-field>\n * ```\n *\n * **The native `<input name>` is the form control.** There is no hidden\n * input and no form-association: the form's own FormData, autofill and\n * password managers, `form.reset()` and `<fieldset disabled>` all work\n * natively.\n *\n * **Validation is the platform's.** The field computes its issues on every\n * change and mirrors the first into `input.setCustomValidity()`, so\n * `form.checkValidity()`, `:invalid` and interactive validation are always\n * right, and the submit button never sends an invalid form. The field cancels\n * the browser's bubble (`invalid` event) and shows its own error instead.\n * Errors are **shown** after the user commits a change (`change`), when the\n * form is submitted, or on `reportValidity()`; once shown they update live\n * while typing.\n *\n * **Normalisation** (trimming, lower-casing an email…) is applied to the\n * submitted value through the form's `formdata` event, without rewriting what\n * the user sees.\n *\n * Subclasses supply defaults and rules through the protected hooks.\n *\n * @fires pont2-field-validate - `{ name, valid, issues }` whenever validity is shown (change, submit, reportValidity)\n */\nexport abstract class AuthField extends Field {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n inputId: { type: String, attribute: \"input-id\" },\n name: { type: String },\n defaultValue: { type: String, attribute: \"value\" },\n label: { type: String },\n placeholder: { type: String },\n description: { type: String },\n mark: { type: String },\n caret: { type: Boolean },\n autocomplete: { type: String },\n required: { type: Boolean, reflect: true },\n validation: { type: String },\n pattern: { type: String },\n minlength: { attribute: \"minlength\", converter: positive },\n maxlength: { attribute: \"maxlength\", converter: positive },\n requiredError: { type: String, attribute: \"required-error\" },\n formatError: { type: String, attribute: \"format-error\" },\n minlengthError: { type: String, attribute: \"minlength-error\" },\n maxlengthError: { type: String, attribute: \"maxlength-error\" },\n current: { state: true },\n shown: { state: true },\n };\n\n /** `id` of the native input (generated when absent), for `<label for>` elsewhere. */\n declare inputId: string;\n /** Form-data key. Each field has a default (`email`, `password`, `login_id` …). */\n declare name: string;\n /** Initial value (the `value` attribute, as on a native input). `.value` is live. */\n declare defaultValue: string;\n declare label: string;\n declare placeholder: string;\n declare description: string;\n /** Text after the label, e.g. \"(optional)\". */\n declare mark: string;\n /** Show a `*` after the label when `required` (and no `mark`). */\n declare caret: boolean;\n declare autocomplete: string;\n declare required: boolean;\n declare validation: FieldValidationMode;\n /** Regex source for the format rule. Each field has a default where the legacy kit had one. */\n declare pattern: string;\n declare minlength: number | undefined;\n declare maxlength: number | undefined;\n declare requiredError: string;\n declare formatError: string;\n declare minlengthError: string;\n declare maxlengthError: string;\n\n declare protected current: string;\n /** Whether issues are displayed (after change / submit / reportValidity). */\n declare protected shown: boolean;\n\n private dirty = false;\n private generatedId = uid(\"auth-field\");\n private boundForm: HTMLFormElement | null = null;\n\n constructor() {\n super();\n this.inputId = \"\";\n this.name = \"\";\n this.defaultValue = \"\";\n this.label = \"\";\n this.placeholder = \"\";\n this.description = \"\";\n this.mark = \"\";\n this.caret = false;\n this.autocomplete = \"\";\n this.required = false;\n this.validation = \"default\";\n this.pattern = \"\";\n this.minlength = undefined;\n this.maxlength = undefined;\n this.requiredError = \"\";\n this.formatError = \"\";\n this.minlengthError = \"\";\n this.maxlengthError = \"\";\n this.current = \"\";\n this.shown = false;\n }\n\n /* ---------------------------------------------------------------- */\n /* Hooks for subclasses */\n /* ---------------------------------------------------------------- */\n\n protected abstract defaultName(): string;\n protected abstract defaultLabel(): string;\n protected inputType(): string {\n return \"text\";\n }\n protected defaultAutocomplete(): string {\n return \"\";\n }\n protected defaultPattern(): string {\n return \"\";\n }\n /** Extra attributes for the input (inputmode, autocapitalize, spellcheck …). */\n protected inputAttrs(): Record<string, string | boolean | null | undefined> {\n return {};\n }\n /** The submitted form of a raw value. Identity by default. */\n normalizeValue(raw: string): string {\n return raw;\n }\n /**\n * Rules for a non-empty value, after `required`. The default is the legacy\n * order: minlength, then maxlength, then the format pattern; first failure only.\n */\n protected valueIssues(value: string): FieldIssue[] {\n const label = this.text;\n if (this.minlength && value.length < this.minlength) {\n return [{ type: \"minlength\", message: this.minlengthError || fieldMessages.minlength(label, this.minlength) }];\n }\n // A maxlength below minlength is raised to it, as in the legacy kit.\n const maxlength = this.maxlength ? Math.max(this.maxlength, this.minlength ?? 0) : undefined;\n if (maxlength && value.length > maxlength) {\n return [{ type: \"maxlength\", message: this.maxlengthError || fieldMessages.maxlength(label, maxlength) }];\n }\n const re = compilePattern(this.pattern || this.defaultPattern());\n if (re && !re.test(value)) return [{ type: \"format\", message: this.formatError || fieldMessages.format(label) }];\n return [];\n }\n\n /* ---------------------------------------------------------------- */\n /* Public API */\n /* ---------------------------------------------------------------- */\n\n /** The native input. */\n get control(): HTMLInputElement | null {\n return this.querySelector<HTMLInputElement>(`input[data-auth-field-control]`);\n }\n\n /** The normalised value (what is submitted). */\n get value(): string {\n return this.normalizeValue(this.current);\n }\n set value(v: string) {\n this.dirty = true;\n this.setCurrent(String(v ?? \"\"));\n }\n\n /** The effective form-data key. */\n get fieldName(): string {\n return this.name || this.defaultName();\n }\n\n /** The effective label text. */\n get text(): string {\n return this.label || this.defaultLabel();\n }\n\n /** Current issues (empty when valid). Independent of whether they are shown. */\n get issues(): FieldIssue[] {\n return this.computeIssues();\n }\n\n checkValidity(): boolean {\n return this.computeIssues().length === 0;\n }\n\n /** Shows the field's errors (or clears them) and returns validity. Legacy name: `validate()`. */\n reportValidity(): boolean {\n this.show();\n return this.checkValidity();\n }\n\n validate(): boolean {\n return this.reportValidity();\n }\n\n override focus(options?: FocusOptions): void {\n this.control?.focus(options);\n }\n\n /* ---------------------------------------------------------------- */\n /* Validation */\n /* ---------------------------------------------------------------- */\n\n protected computeIssues(): FieldIssue[] {\n if (this.disabled) return [];\n const value = this.normalizeValue(this.current);\n if (!value) {\n return this.required ? [{ type: \"required\", message: this.requiredError || fieldMessages.required(this.text) }] : [];\n }\n if (this.validation === \"simple\") return [];\n return this.valueIssues(value);\n }\n\n private show(): void {\n this.shown = true;\n const issues = this.computeIssues();\n fire<FieldValidateDetail>(this, \"pont2-field-validate\", { name: this.fieldName, valid: !issues.length, issues });\n }\n\n /* ---------------------------------------------------------------- */\n /* Events */\n /* ---------------------------------------------------------------- */\n\n protected onInput = (e: Event) => {\n this.dirty = true;\n this.setCurrent((e.target as HTMLInputElement).value);\n };\n\n /**\n * Sets the raw value and mirrors validity to the input **synchronously**:\n * code that submits in the same task (an OTP auto-submit, `requestSubmit()`\n * in an `input` listener) must not see the previous render's validity.\n */\n protected setCurrent(raw: string): void {\n this.current = raw;\n this.syncValidity();\n }\n\n protected syncValidity(): void {\n this.control?.setCustomValidity(this.computeIssues()[0]?.message ?? \"\");\n }\n\n protected onChange = () => this.show();\n\n private onInvalid = (e: Event) => {\n // Our inline error replaces the browser's bubble.\n e.preventDefault();\n this.show();\n if (!focusClaimed) {\n focusClaimed = true;\n this.control?.focus();\n // The pass fires one `invalid` per control, possibly with microtask\n // checkpoints in between, so release on the next task.\n setTimeout(() => (focusClaimed = false));\n }\n };\n\n private onFormData = (e: FormDataEvent) => {\n const c = this.control;\n if (!c || c.disabled || !c.name) return;\n e.formData.set(c.name, this.value);\n };\n\n protected onReset = () => {\n // `reset` fires before the controls are reset.\n setTimeout(() => {\n this.dirty = false;\n this.shown = false;\n this.current = this.control?.value ?? this.defaultValue;\n });\n };\n\n private bindForm(form: HTMLFormElement | null): void {\n if (form === this.boundForm) return;\n this.boundForm?.removeEventListener(\"formdata\", this.onFormData);\n this.boundForm?.removeEventListener(\"reset\", this.onReset);\n this.boundForm = form;\n form?.addEventListener(\"formdata\", this.onFormData);\n form?.addEventListener(\"reset\", this.onReset);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.bindForm(null);\n }\n\n /* ---------------------------------------------------------------- */\n /* Render */\n /* ---------------------------------------------------------------- */\n\n protected get controlId(): string {\n return this.inputId || `${this.id || this.generatedId}-input`;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.dirty && (changed.has(\"defaultValue\") || !this.hasUpdated)) this.current = this.defaultValue ?? \"\";\n this.invalid = this.shown && this.computeIssues().length > 0;\n super.willUpdate(changed);\n }\n\n protected override updated(): void {\n const c = this.control;\n if (c) {\n // The platform's validity mirrors ours: blocks submission, drives :invalid.\n this.syncValidity();\n this.bindForm(c.form);\n }\n }\n\n /** Options for the control part; subclasses render it differently (password: input group). */\n protected controlOptions(describedBy: string | undefined): InputOptions {\n return {\n id: this.controlId,\n name: this.fieldName,\n type: this.inputType(),\n value: this.current,\n placeholder: this.placeholder || undefined,\n autocomplete: this.autocomplete || this.defaultAutocomplete() || undefined,\n required: this.required,\n disabled: this.disabled,\n invalid: this.invalid,\n describedBy,\n attrs: {\n \"data-auth-field-control\": true,\n // The default value, so form.reset() restores it natively.\n value: this.defaultValue || null,\n ...this.inputAttrs(),\n },\n onInput: this.onInput,\n onChange: this.onChange,\n };\n }\n\n protected renderControl(o: InputOptions): TemplateResult {\n return input(o);\n }\n\n protected renderLabel(): TemplateResult | typeof nothing {\n const mark = this.mark\n ? html`<span data-slot=\"field-mark\">${this.mark}</span>`\n : this.caret && this.required\n ? html`<span data-slot=\"field-mark\" data-caret aria-hidden=\"true\">*</span>`\n : nothing;\n return fieldLabel({ for: this.controlId }, html`${this.text}${mark}`);\n }\n\n protected renderError(id: string, issues: FieldIssue[]): TemplateResult {\n const messages = [...new Set(issues.map(i => i.message))];\n return html`<div ${FieldError.part({ id })}>${messages.length === 1\n ? messages[0]\n : html`<ul data-slot=\"field-error-list\">${messages.map(m => html`<li>${m}</li>`)}</ul>`}</div>`;\n }\n\n override render() {\n const id = this.controlId;\n const descId = `${id}-description`;\n const errId = `${id}-error`;\n const issues = this.shown ? this.computeIssues() : [];\n const describedBy = [this.description ? descId : \"\", issues.length ? errId : \"\"].filter(Boolean).join(\" \") || undefined;\n return html`${this.renderLabel()}${this.renderControl(this.controlOptions(describedBy))}${this.description\n ? html`<p ${FieldDescription.part({ id: descId })}>${this.description}</p>`\n : nothing}${issues.length ? this.renderError(errId, issues) : nothing}`;\n }\n\n /** The `invalid` event does not bubble, so it is listened to on the input itself. */\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"invalid\", this.onInvalid, true);\n }\n}\n\n/* ==================================================================== */\n/* Text fields */\n/* ==================================================================== */\n\n/**\n * `<pont2-email-field>`: `type=\"email\"`, `autocomplete=\"email\"`, name\n * `email`. Normalised to trimmed lower case. Format rule: the legacy pattern\n * `^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$`.\n *\n * @tag pont2-email-field\n */\nexport class EmailField extends AuthField {\n protected defaultName() {\n return \"email\";\n }\n protected defaultLabel() {\n return \"Email\";\n }\n protected override inputType() {\n return \"email\";\n }\n protected override defaultAutocomplete() {\n return \"email\";\n }\n protected override defaultPattern() {\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.source;\n }\n override normalizeValue(raw: string) {\n return raw.trim().toLowerCase();\n }\n}\n\n/**\n * `<pont2-phone-field>`: `type=\"tel\"`, `autocomplete=\"tel\"`, name `phone`.\n * Normalised by removing whitespace. Format rule: the legacy pattern.\n *\n * @tag pont2-phone-field\n */\nexport class PhoneField extends AuthField {\n protected defaultName() {\n return \"phone\";\n }\n protected defaultLabel() {\n return \"Phone\";\n }\n protected override inputType() {\n return \"tel\";\n }\n protected override defaultAutocomplete() {\n return \"tel\";\n }\n protected override defaultPattern() {\n return /^\\+?(\\d[\\d-.() ]+)?(\\([\\d-.() ]+\\))?[\\d-.() ]+\\d$/.source;\n }\n override normalizeValue(raw: string) {\n return raw.replace(/\\s+/g, \"\");\n }\n}\n\n/**\n * `<pont2-username-field>`: `autocomplete=\"username\"`, name `username`,\n * no autocapitalisation or spellcheck. Normalised to trimmed lower case.\n * Rules: `minlength`, `maxlength`, then the pattern `^[a-z0-9_]*$`.\n *\n * @tag pont2-username-field\n */\nexport class UsernameField extends AuthField {\n protected defaultName() {\n return \"username\";\n }\n protected defaultLabel() {\n return \"Username\";\n }\n protected override defaultAutocomplete() {\n return \"username\";\n }\n protected override defaultPattern() {\n return /^[a-z0-9_]*$/.source;\n }\n protected override inputAttrs() {\n return { autocapitalize: \"none\", spellcheck: \"false\" };\n }\n override normalizeValue(raw: string) {\n return raw.trim().toLowerCase();\n }\n}\n\n/**\n * `<pont2-name-field>`: `autocomplete=\"name\"`, name `name`. Normalised by\n * trimming and collapsing whitespace. Rules: `minlength`, `maxlength`, then\n * the Unicode pattern `^[\\p{L} .'-]*$` (letters in any script).\n *\n * @tag pont2-name-field\n */\nexport class NameField extends AuthField {\n protected defaultName() {\n return \"name\";\n }\n protected defaultLabel() {\n return \"Name\";\n }\n protected override defaultAutocomplete() {\n return \"name\";\n }\n protected override defaultPattern() {\n return /^[\\p{L} .'-]*$/u.source;\n }\n override normalizeValue(raw: string) {\n return raw.trim().replace(/\\s+/g, \" \");\n }\n}\n\nexport const IDENTIFIER_KINDS = [\"email\", \"phone\", \"username\"] as const;\nexport type IdentifierKind = (typeof IDENTIFIER_KINDS)[number];\n\n/** `[\"email\",\"phone\"]` → \"Email or phone\"; three → \"Email, phone, or username\" (legacy copy). */\nexport function identifierLabel(kinds: readonly IdentifierKind[]): string {\n if (!kinds.length) return \"Identifier\";\n const list =\n kinds.length === 1\n ? kinds[0]\n : kinds.length === 2\n ? `${kinds[0]} or ${kinds[1]}`\n : `${kinds.slice(0, -1).join(\", \")}, or ${kinds[kinds.length - 1]}`;\n return list.charAt(0).toUpperCase() + list.slice(1);\n}\n\n/**\n * `<pont2-identifier-field>`: the sign-in identifier (email, phone or\n * username), submitted as `login_id` (the platform's contract).\n *\n * `identifiers` (attribute: a JSON array, as the platform writes it, or space- or\n * comma-separated; property: array) picks\n * the label (\"Email or phone\") and the input type: `email` or `tel` when it\n * is exactly one of those, `text` otherwise. `autocomplete=\"username\"`, which\n * is what password managers look for next to a password. Normalised to\n * trimmed lower case. Rule: `required` only (no format), as in the legacy kit.\n *\n * @tag pont2-identifier-field\n * @attr identifiers - e.g. `[\"email\",\"phone\"]` or \"email phone username\"\n */\nexport class IdentifierField extends AuthField {\n static override properties: PropertyDeclarations = {\n identifiers: {\n converter: {\n fromAttribute: (v: string | null) =>\n parseList(v).filter((k): k is IdentifierKind => IDENTIFIER_KINDS.includes(k as IdentifierKind)),\n },\n },\n };\n\n declare identifiers: IdentifierKind[];\n\n /** Design mode (core/design-mode.ts): sample identifiers when none are set. */\n protected readonly design = new DesignModeController(this);\n\n /**\n * The identifiers shown: `identifiers`, or email, username and phone in design mode when none are\n * set. At serve time the platform narrows the authored list to the app's login methods; the\n * designer narrows nothing, and \"Identifier\" would tell the author nothing (the legacy samples).\n */\n get shownIdentifiers(): IdentifierKind[] {\n const list = this.identifiers ?? [];\n return list.length === 0 && this.design.active ? [\"email\", \"username\", \"phone\"] : list;\n }\n\n constructor() {\n super();\n this.identifiers = [];\n }\n\n protected defaultName() {\n return \"login_id\";\n }\n protected defaultLabel() {\n return identifierLabel(this.shownIdentifiers);\n }\n protected override inputType() {\n const k = this.shownIdentifiers;\n return k.length === 1 && k[0] === \"email\" ? \"email\" : k.length === 1 && k[0] === \"phone\" ? \"tel\" : \"text\";\n }\n protected override defaultAutocomplete() {\n return \"username\";\n }\n protected override inputAttrs() {\n return { autocapitalize: \"none\", spellcheck: \"false\" };\n }\n protected override valueIssues() {\n return [];\n }\n override normalizeValue(raw: string) {\n return raw.trim().toLowerCase();\n }\n}\n\ndefine(\"pont2-email-field\", EmailField);\ndefine(\"pont2-phone-field\", PhoneField);\ndefine(\"pont2-username-field\", UsernameField);\ndefine(\"pont2-name-field\", NameField);\ndefine(\"pont2-identifier-field\", IdentifierField);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-email-field\": EmailField;\n \"pont2-phone-field\": PhoneField;\n \"pont2-username-field\": UsernameField;\n \"pont2-name-field\": NameField;\n \"pont2-identifier-field\": IdentifierField;\n }\n interface HTMLElementEventMap {\n \"pont2-field-validate\": CustomEvent<FieldValidateDetail>;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { icons } from \"../../core/icons\";\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\nimport { InputGroup, InputGroupAddon, inputGroupButton, inputGroupInput } from \"../../primitives/input-group/input-group\";\nimport type { InputOptions } from \"../../primitives/input/input\";\nimport { AuthField, fieldMessages, type FieldIssue } from \"./auth-field\";\n\n/* ==================================================================== */\n/* Password rules */\n/* ==================================================================== */\n\nexport type PasswordRuleName = \"uppercase\" | \"lowercase\" | \"number\" | \"special\";\n\n/** A rule: a named one, or your own `pattern`, each with an optional message. */\nexport type PasswordRule = { name: PasswordRuleName; error?: string } | { pattern: string; error?: string };\n\n/** The legacy named patterns (field.defs.ts). */\nexport const PASSWORD_RULE_PATTERNS: Record<PasswordRuleName, RegExp> = {\n uppercase: /[A-Z]/,\n lowercase: /[a-z]/,\n number: /[0-9]/,\n special: /[!@#$%^&*()_=+{}[\\]|\\\\;:\"<>,./?-]/,\n};\n\nexport const DEFAULT_PASSWORD_RULES: PasswordRule[] = [\n { name: \"uppercase\", error: \"Must contain an uppercase letter.\" },\n { name: \"lowercase\", error: \"Must contain a lowercase letter.\" },\n { name: \"number\", error: \"Must contain a number.\" },\n { name: \"special\", error: \"Must contain a special character.\" },\n];\n\nconst ruleRegExp = (r: PasswordRule): RegExp | null => {\n if (\"name\" in r) return PASSWORD_RULE_PATTERNS[r.name] ?? null;\n try {\n return new RegExp(r.pattern, \"u\");\n } catch {\n return null;\n }\n};\n\n/** `rules` attribute: JSON, e.g. `rules='[{\"name\":\"number\"},{\"pattern\":\".{12,}\",\"error\":\"12+ characters\"}]'`. */\nconst rulesConverter = {\n fromAttribute: (v: string | null): PasswordRule[] => {\n if (v == null) return DEFAULT_PASSWORD_RULES;\n try {\n const parsed = JSON.parse(v);\n return Array.isArray(parsed) ? parsed : DEFAULT_PASSWORD_RULES;\n } catch {\n return DEFAULT_PASSWORD_RULES;\n }\n },\n};\n\n/* ==================================================================== */\n/* SecretField: the show/hide toggle shared by password and confirm */\n/* ==================================================================== */\n\nexport const SECRET_FIELD_VARIANTS = [\"toggle\", \"simple\"] as const;\nexport type SecretFieldVariant = (typeof SECRET_FIELD_VARIANTS)[number];\n\n/**\n * A field whose value is secret: `type=\"password\"`, and with\n * `variant=\"toggle\"` (default) a show/hide button, built as shadcn builds it,\n * from InputGroup parts:\n *\n * ```html\n * <div data-pont2-input-group data-slot=\"input-group\" role=\"group\">\n * <input data-pont2-input data-pont2-input-group-input data-slot=\"input-group-control\" type=\"password\" …>\n * <div data-pont2-input-group-addon data-slot=\"input-group-addon\" data-align=\"inline-end\" role=\"group\">\n * <button data-pont2-button data-pont2-input-group-button data-variant=\"ghost\" data-size=\"icon-xs\"\n * aria-label=\"Show password\" aria-pressed=\"false\" aria-controls=\"…-input\"><svg/></button>\n * </div>\n * </div>\n * ```\n *\n * The toggle is a *toggle button* (`aria-pressed`, a stable name), the\n * WAI-ARIA pattern, rather than a button whose name flips. The value is\n * never normalised.\n *\n * @attr variant - toggle (default) | simple\n * @attr show-label - the toggle's accessible name (default: the `show_password` message, \"Show password\" in English)\n */\nexport abstract class SecretField extends AuthField {\n static override properties: PropertyDeclarations = {\n variant: { type: String },\n showLabel: { type: String, attribute: \"show-label\" },\n revealed: { type: Boolean, reflect: true },\n };\n\n declare variant: SecretFieldVariant;\n declare showLabel: string;\n /** Whether the value is currently shown as text. */\n declare revealed: boolean;\n\n /** Re-renders when the page's message table changes (the toggle's name). */\n protected readonly messagesController = new MessagesController(this);\n\n constructor() {\n super();\n this.variant = \"toggle\";\n this.showLabel = \"\";\n this.revealed = false;\n }\n\n protected override inputType() {\n return this.variant === \"toggle\" && this.revealed ? \"text\" : \"password\";\n }\n\n protected override inputAttrs() {\n return { autocapitalize: \"none\", spellcheck: \"false\" };\n }\n\n private toggle = () => {\n this.revealed = !this.revealed;\n // Keep the caret where it was (the input is re-rendered with a new type).\n void this.updateComplete.then(() => this.control?.focus());\n };\n\n protected override renderControl(o: InputOptions): TemplateResult {\n if (this.variant !== \"toggle\") return super.renderControl(o);\n return html`<div ${InputGroup.part({ \"data-disabled\": this.disabled })}>\n ${inputGroupInput(o)}\n <div ${InputGroupAddon.part({ \"data-align\": \"inline-end\" })}>\n ${inputGroupButton(\n {\n size: \"icon-xs\",\n disabled: this.disabled,\n attrs: {\n \"aria-label\": this.showLabel || msg(\"show_password\"),\n \"aria-pressed\": String(this.revealed),\n \"aria-controls\": this.controlId,\n },\n onClick: this.toggle,\n },\n this.revealed ? icons.eyeOff() : icons.eye(),\n )}\n </div>\n </div>`;\n }\n}\n\n/* ==================================================================== */\n/* PasswordField */\n/* ==================================================================== */\n\n/**\n * # `<pont2-password-field>`\n *\n * `autocomplete=\"current-password\"` by default (set `new-password` on\n * sign-up screens), name `password`. Rules: `minlength`, `maxlength`, then\n * **every** `rules` entry; all failing rules are listed (shadcn's FieldError\n * list). Defaults are the legacy four: uppercase, lowercase, number, special.\n *\n * `forgot` adds a \"Forgot your password?\" link-styled button beside the label\n * (shadcn's login block layout). It requests `forgot-event` through the\n * action protocol (`pont2-action` with `data: { forgot: true }`), exactly\n * like the auth buttons, and is busy until the response settles.\n *\n * @tag pont2-password-field\n * @attr rules - JSON array of `{ name }` / `{ pattern }` rules with optional `error`; `rules=\"[]\"` disables them\n * @attr forgot - show the forgot-password link\n * @attr forgot-label - its text (default \"Forgot your password?\")\n * @attr forgot-event - the action it requests\n * @fires pont2-action, pont2-action-success, pont2-action-error - from the forgot link\n */\nexport class PasswordField extends SecretField {\n static override properties: PropertyDeclarations = {\n rules: { converter: rulesConverter },\n forgot: { type: Boolean },\n forgotLabel: { type: String, attribute: \"forgot-label\" },\n forgotEvent: { type: String, attribute: \"forgot-event\" },\n };\n\n declare rules: PasswordRule[];\n declare forgot: boolean;\n declare forgotLabel: string;\n declare forgotEvent: string | undefined;\n\n protected readonly forgotAction = new ActionController(this);\n\n constructor() {\n super();\n this.rules = DEFAULT_PASSWORD_RULES;\n this.forgot = false;\n this.forgotLabel = \"\";\n this.forgotEvent = undefined;\n }\n\n protected defaultName() {\n return \"password\";\n }\n protected defaultLabel() {\n return \"Password\";\n }\n protected override defaultAutocomplete() {\n return \"current-password\";\n }\n\n protected override valueIssues(value: string): FieldIssue[] {\n const label = this.text;\n if (this.minlength && value.length < this.minlength) {\n return [{ type: \"minlength\", message: this.minlengthError || fieldMessages.minlength(label, this.minlength) }];\n }\n // A maxlength below minlength is raised to it, as in the legacy kit.\n const maxlength = this.maxlength ? Math.max(this.maxlength, this.minlength ?? 0) : undefined;\n if (maxlength && value.length > maxlength) {\n return [{ type: \"maxlength\", message: this.maxlengthError || fieldMessages.maxlength(label, maxlength) }];\n }\n const failing = (this.rules ?? []).filter(r => {\n const re = ruleRegExp(r);\n return re ? !re.test(value) : false;\n });\n if (!failing.length) return [];\n const messages = failing.map(r => r.error).filter((m): m is string => !!m);\n return messages.length\n ? messages.map(message => ({ type: \"rule\" as const, message }))\n : [{ type: \"rule\", message: this.formatError || fieldMessages.format(label) }];\n }\n\n protected override renderLabel(): TemplateResult | typeof nothing {\n if (!this.forgot) return super.renderLabel();\n const busy = this.forgotAction.busy;\n return html`<div data-pont2-auth-field-label-row>\n ${super.renderLabel()}\n ${button(\n {\n variant: \"link\",\n size: \"sm\",\n slot: \"field-forgot\",\n disabled: busy,\n focusableWhenDisabled: busy,\n attrs: { \"data-event\": this.forgotEvent, \"data-loading\": busy, \"aria-busy\": busy ? \"true\" : null },\n onClick: () => this.forgotAction.request(this.forgotEvent, { forgot: true, name: this.fieldName }),\n },\n this.forgotLabel || \"Forgot your password?\",\n )}\n </div>`;\n }\n}\n\n/* ==================================================================== */\n/* ConfirmField */\n/* ==================================================================== */\n\n/**\n * # `<pont2-confirm-field>`: repeat a password\n *\n * Valid when its value equals the `pair` field's (default: the first\n * `pont2-password-field` in the same form, else in the document). It\n * re-validates as either changes. `autocomplete=\"new-password\"`, name\n * `confirm`. Unlike the legacy kit, the pair's value is never put in an event.\n *\n * @tag pont2-confirm-field\n * @attr pair - CSS selector of the field to match (default \"pont2-password-field\")\n * @attr match-error - default \"Passwords do not match.\"\n */\nexport class ConfirmField extends SecretField {\n static override properties: PropertyDeclarations = {\n pair: { type: String },\n matchError: { type: String, attribute: \"match-error\" },\n };\n\n declare pair: string;\n declare matchError: string;\n\n private scope: Document | HTMLFormElement | null = null;\n\n constructor() {\n super();\n this.pair = \"pont2-password-field\";\n this.matchError = \"\";\n }\n\n protected defaultName() {\n return \"confirm\";\n }\n protected defaultLabel() {\n return \"Confirm Password\";\n }\n protected override defaultAutocomplete() {\n return \"new-password\";\n }\n\n /** The element being matched (a pont2 field or any element with `.value`). */\n get pairElement(): (Element & { value?: string }) | null {\n const root = this.closest(\"form\") ?? document;\n return this.pair ? root.querySelector(this.pair) : null;\n }\n\n protected override valueIssues(value: string): FieldIssue[] {\n const other = this.pairElement?.value ?? \"\";\n return value === other ? [] : [{ type: \"match\", message: this.matchError || \"Passwords do not match.\" }];\n }\n\n // Re-validate when the pair changes (its input events bubble through the form).\n private onScopeInput = (e: Event) => {\n const pair = this.pairElement;\n if (pair && e.target instanceof Node && pair.contains(e.target)) this.requestUpdate();\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.scope = this.closest(\"form\") ?? document;\n this.scope.addEventListener(\"input\", this.onScopeInput);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.scope?.removeEventListener(\"input\", this.onScopeInput);\n this.scope = null;\n }\n}\n\ndefine(\"pont2-password-field\", PasswordField);\ndefine(\"pont2-confirm-field\", ConfirmField);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-password-field\": PasswordField;\n \"pont2-confirm-field\": ConfirmField;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { define } from \"../../core/names\";\nimport type { InputOTP } from \"../../primitives/input-otp/input-otp\";\nimport { REGEXP_ONLY_DIGITS } from \"../../primitives/input-otp/otp\";\nimport type { InputOptions } from \"../../primitives/input/input\";\nimport { AuthField, type FieldIssue } from \"../auth-field/auth-field\";\nimport { otpGroups } from \"../input-otp/input-otp\";\n\n/** The legacy `pont-otp` layouts, kept for render-spec parity. */\nexport const OTP_LAYOUTS = [\"digits_only\", \"simple\", \"with_separator\", \"with_spacing\"] as const;\nexport type OtpLayout = (typeof OTP_LAYOUTS)[number];\n\n/**\n * # `<pont2-otp-field>`: a verification-code field\n *\n * ```html\n * <form>\n * <pont2-otp-field label=\"Verification code\" length=\"6\" layout=\"with_separator\" required></pont2-otp-field>\n * <pont2-submit-button event=\"verify_code\" label=\"Verify\"></pont2-submit-button>\n * </form>\n * ```\n *\n * **Is a Field** (`extends AuthField extends Field`) holding the Input OTP\n * primitive, as shadcn composes it (`<Field><FieldLabel/><InputOTP/>\n * <FieldDescription/></Field>`):\n *\n * ```html\n * <pont2-otp-field data-pont2-field data-slot=\"field\">\n * <label data-pont2-field-label for=\"…-input\">Verification code</label>\n * <pont2-prim-input-otp maxlength=\"6\" name=\"code\" input-id=\"…-input\" …>\n * <div data-pont2-input-otp-group …> <pont2-prim-input-otp-slot index=\"0\"> …×3 </div>\n * <div data-pont2-input-otp-separator …><svg/></div>\n * <div data-pont2-input-otp-group …> …×3 </div>\n * <div data-pont2-input-otp-input-wrapper><input autocomplete=\"one-time-code\" name=\"code\" …></div>\n * </pont2-prim-input-otp>\n * <div data-pont2-field-error role=\"alert\">Please enter the complete verification code.</div>\n * </pont2-otp-field>\n * ```\n *\n * The Input OTP is rendered as its **primitive element** (it has behaviour);\n * its groups and separators are parts, and its slots are elements (kit/input-otp).\n * Everything an auth field does applies: the one native\n * `autocomplete=\"one-time-code\"` input is the form control, validation is\n * native (`required`, then *incomplete*), errors are inline.\n *\n * **Auto-submit** (`auto-submit`): when every slot is filled,\n * - with `event`: requests it through the action protocol, with the same\n * `data: { form, formData }` shape as the submit button (so one flow\n * handler serves both);\n * - without `event`: submits the enclosing form (`form.requestSubmit()`), so\n * its submit button handles the request.\n *\n * @tag pont2-otp-field\n * @attr length - number of characters (default 6)\n * @attr layout - digits_only (one group, default) | simple (2 groups) | with_separator (3 groups) | with_spacing (one slot per group)\n * @attr group-size, separator - explicit grouping (override `layout`)\n * @attr pattern - per-character regex source (default digits; `pattern=\"\"` accepts anything)\n * @attr auto-submit - submit when complete\n * @attr event - the action requested on auto-submit\n * @attr incomplete-error - default \"Please enter the complete verification code.\"\n * @fires pont2-complete - from the Input OTP, `{ value }`\n * @fires pont2-action, pont2-action-success, pont2-action-error - on auto-submit with `event`\n */\nexport class OtpField extends AuthField {\n static override properties: PropertyDeclarations = {\n length: { type: Number },\n layout: { type: String },\n groupSize: { type: Number, attribute: \"group-size\" },\n separator: { type: Boolean },\n autoSubmit: { type: Boolean, attribute: \"auto-submit\" },\n event: { type: String },\n incompleteError: { type: String, attribute: \"incomplete-error\" },\n };\n\n declare length: number;\n declare layout: OtpLayout;\n declare groupSize: number | undefined;\n declare separator: boolean | undefined;\n declare autoSubmit: boolean;\n declare event: string | undefined;\n declare incompleteError: string;\n\n protected readonly action = new ActionController(this);\n\n constructor() {\n super();\n this.length = 6;\n this.layout = \"digits_only\";\n this.groupSize = undefined;\n this.separator = undefined;\n this.autoSubmit = false;\n this.event = undefined;\n this.incompleteError = \"\";\n this.pattern = REGEXP_ONLY_DIGITS;\n this.requiredError = \"\";\n // The input lives inside the Input OTP; its events bubble to us.\n this.addEventListener(\"input\", e => {\n if (e.target === this.control) this.onInput(e);\n });\n this.addEventListener(\"change\", e => {\n if (e.target === this.control) this.onChange();\n });\n this.addEventListener(\"pont2-complete\", e => this.onComplete(e.detail.value));\n }\n\n protected defaultName() {\n return \"code\";\n }\n protected defaultLabel() {\n return \"Code\";\n }\n\n /** The Input OTP primitive element. */\n get otp(): InputOTP | null {\n return this.querySelector(\"pont2-prim-input-otp\");\n }\n\n override get control(): HTMLInputElement | null {\n return this.otp?.input ?? null;\n }\n\n /** `true` while an auto-submit request is pending. */\n get busy(): boolean {\n return this.action.busy;\n }\n\n protected override computeIssues(): FieldIssue[] {\n if (this.disabled) return [];\n const value = this.current;\n if (!value) {\n return this.required ? [{ type: \"required\", message: this.requiredError || \"Code is required.\" }] : [];\n }\n if (this.validation === \"simple\") return [];\n return this.valueIssues(value);\n }\n\n protected override valueIssues(value: string): FieldIssue[] {\n return value.length === this.length\n ? []\n : [{ type: \"incomplete\", message: this.incompleteError || \"Please enter the complete verification code.\" }];\n }\n\n /** Group size and separators from `layout`, unless set explicitly. */\n get grouping(): { size: number; separator: boolean } {\n const n = this.length;\n const byLayout: Record<OtpLayout, { size: number; separator: boolean }> = {\n digits_only: { size: 0, separator: false },\n simple: { size: Math.ceil(n / 2), separator: true },\n with_separator: { size: Math.ceil(n / 3), separator: true },\n with_spacing: { size: 1, separator: false },\n };\n const base = byLayout[this.layout] ?? byLayout.digits_only;\n return { size: this.groupSize ?? base.size, separator: this.separator ?? base.separator };\n }\n\n private onComplete(value: string): void {\n this.setCurrent(value);\n if (!this.autoSubmit) return;\n const form = this.control?.form ?? null;\n if (this.event) {\n const formData = form ? new FormData(form) : new FormData();\n if (!form) formData.set(this.fieldName, value);\n this.action.request(this.event, { form, formData });\n } else {\n form?.requestSubmit();\n }\n }\n\n protected override onReset = () => {\n setTimeout(() => {\n const otp = this.otp;\n if (otp) otp.value = this.defaultValue;\n this.shown = false;\n this.current = this.defaultValue;\n });\n };\n\n protected override renderLabel(): TemplateResult | typeof nothing {\n // The label is optional for a code field; the input is then named by aria-label.\n return this.label ? super.renderLabel() : nothing;\n }\n\n protected override renderControl(o: InputOptions): TemplateResult {\n const { size, separator } = this.grouping;\n return html`<pont2-prim-input-otp\n input-id=${o.id!}\n name=${o.name ?? nothing}\n maxlength=${this.length}\n pattern=${this.pattern}\n value=${this.defaultValue || nothing}\n ?required=${this.required}\n ?disabled=${this.disabled}\n aria-label=${this.label ? nothing : \"Verification code\"}\n aria-describedby=${o.describedBy ?? nothing}\n aria-invalid=${o.invalid ? \"true\" : nothing}\n aria-busy=${this.busy ? \"true\" : nothing}\n >${otpGroups(this.length, size, separator)}</pont2-prim-input-otp\n >`;\n }\n}\n\ndefine(\"pont2-otp-field\", OtpField);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-otp-field\": OtpField;\n }\n}\n","import { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\n\n/**\n * # `<pont2-otp-resend>`: \"Resend code in 42s\", then a resend link\n *\n * ```html\n * <pont2-otp-resend event=\"resend_code\" duration=\"60\"></pont2-otp-resend>\n * ```\n *\n * ```html\n * <pont2-otp-resend data-pont2-otp-resend data-slot=\"otp-resend\">\n * <span data-slot=\"otp-resend-countdown\" role=\"timer\">Resend code in 42s</span>\n * ⟶ when it reaches 0:\n * <button data-pont2-button data-variant=\"link\" data-slot=\"otp-resend-button\" type=\"button\">Resend code</button>\n * </pont2-otp-resend>\n * ```\n *\n * The root is a plain row, so this is a new-name composite on `HostElement`\n * (06-higher-layers: layout renderers). The button is the button primitive's\n * part and requests `event` through the action protocol (`data: { resend:\n * true }`); the countdown restarts when it is pressed, as in the legacy kit.\n *\n * The countdown is `role=\"timer\"` (not announced every second). When it\n * ends, the button appears; focus is not moved.\n *\n * @tag pont2-otp-resend\n * @attr duration - seconds before the button appears (default 60; 0 shows it at once)\n * @attr event - the action requested on press\n * @attr label - button text (default \"Resend code\")\n * @attr countdown-text - text before the seconds (default \"Resend code in \")\n * @cssprop --pont2-otp-resend-fg - the row's text (default muted-foreground)\n * @cssprop --pont2-otp-resend-button-fg, --pont2-otp-resend-button-fg-hover - the link (default the row's colour; primary on hover)\n * @fires pont2-action, pont2-action-success, pont2-action-error\n */\nexport class OtpResend extends HostElement {\n static override identity = \"otp-resend\";\n static override slotName = \"otp-resend\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n duration: { type: Number },\n event: { type: String },\n label: { type: String },\n countdownText: { type: String, attribute: \"countdown-text\" },\n remaining: { state: true },\n };\n\n declare duration: number;\n declare event: string | undefined;\n declare label: string;\n declare countdownText: string;\n /** Seconds left. */\n declare remaining: number;\n\n protected readonly action = new ActionController(this);\n private timer: ReturnType<typeof setInterval> | undefined;\n\n constructor() {\n super();\n this.duration = 60;\n this.event = undefined;\n this.label = \"\";\n this.countdownText = \"\";\n this.remaining = 0;\n }\n\n /** Starts (or restarts) the countdown from `duration`. */\n restart(): void {\n this.stop();\n this.remaining = Math.max(0, Math.floor(this.duration || 0));\n if (this.remaining > 0) {\n this.timer = setInterval(() => {\n this.remaining = Math.max(0, this.remaining - 1);\n if (!this.remaining) this.stop();\n }, 1000);\n }\n }\n\n private stop(): void {\n if (this.timer !== undefined) clearInterval(this.timer);\n this.timer = undefined;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.restart();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.stop();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"duration\") && this.hasUpdated) this.restart();\n }\n\n private press = () => {\n this.action.request(this.event, { resend: true });\n this.restart();\n };\n\n override render() {\n if (this.remaining > 0) {\n return html`<span data-slot=\"otp-resend-countdown\" role=\"timer\"\n >${this.countdownText || \"Resend code in \"}${this.remaining}s</span\n >`;\n }\n const busy = this.action.busy;\n return button(\n {\n variant: \"link\",\n slot: \"otp-resend-button\",\n disabled: busy,\n focusableWhenDisabled: busy,\n attrs: { \"data-event\": this.event, \"data-loading\": busy, \"aria-busy\": busy ? \"true\" : null },\n onClick: this.press,\n },\n this.label || \"Resend code\",\n );\n }\n}\n\ndefine(\"pont2-otp-resend\", OtpResend);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-otp-resend\": OtpResend;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { safeExternalUrl, safeUrl } from \"../../core/url\";\nimport { button } from \"../../primitives/button/button\";\n\nexport const LINK_ALIGNS = [\"start\", \"center\", \"end\"] as const;\nexport type LinkAlign = (typeof LINK_ALIGNS)[number];\nexport const LINK_SERVICES = [\"auth\", \"other\"] as const;\nexport type LinkService = (typeof LINK_SERVICES)[number];\n\n/**\n * # `<pont2-link>`: \"Don't have an account? Sign up\"\n *\n * ```html\n * <pont2-link prompt=\"Don't have an account?\" label=\"Sign up\" event=\"goto_signup\"></pont2-link>\n * <pont2-link label=\"Privacy policy\" href=\"/privacy\" target=\"_blank\"></pont2-link>\n * ```\n *\n * shadcn's login blocks write this as `<div class=\"text-center text-sm\">\n * Don't have an account? <a class=\"underline underline-offset-4\">Sign\n * up</a></div>`. pont2's host is that row; the link is the button\n * primitive's part:\n *\n * - **with `href`**: a real `<a href>` (navigation, middle-click, \"open in\n * new tab\" work), styled as a link. Only an http(s) URL, absolute or\n * relative, is linked (`safeUrl`): a `javascript:`, `data:` or other\n * scheme renders **nothing** and the row is hidden (`data-invalid-href`),\n * because an `href` from a render spec is data, not trusted markup;\n * - **otherwise**: a `<button type=\"button\">` that requests `event` through\n * the action protocol (`data: { service }`), busy until it settles, like\n * the auth buttons. The legacy `service=\"other\"` (no auth call) maps to:\n * don't set `event`, or don't respond.\n *\n * @tag pont2-link\n * @attr label - link text (default \"Link\")\n * @attr prompt - text before the link\n * @attr event - the action requested on press (button form)\n * @attr service - auth (default) | other: passed in the request's data\n * @attr href, target, rel - render a real link instead (http(s) only; anything else renders nothing)\n * @attr align - start | center (default) | end\n * @attr disabled, loading\n * @cssprop --pont2-link-fg - the row's text (default muted-foreground)\n * @cssprop --pont2-link-button-fg, --pont2-link-button-fg-hover - the link (default the row's colour; primary on hover)\n * @fires pont2-action, pont2-action-success, pont2-action-error\n */\nexport class Link extends HostElement {\n static override identity = \"link\";\n static override slotName = \"link\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n label: { type: String },\n prompt: { type: String },\n event: { type: String },\n service: { type: String },\n href: { type: String },\n target: { type: String },\n rel: { type: String },\n align: { type: String },\n disabled: { type: Boolean, reflect: true },\n loading: { type: Boolean, reflect: true },\n };\n\n declare label: string;\n declare prompt: string;\n declare event: string | undefined;\n declare service: LinkService;\n declare href: string | undefined;\n declare target: string | undefined;\n declare rel: string | undefined;\n declare align: LinkAlign;\n declare disabled: boolean;\n declare loading: boolean;\n\n protected readonly action = new ActionController(this);\n\n constructor() {\n super();\n this.label = \"\";\n this.prompt = \"\";\n this.event = undefined;\n this.service = \"auth\";\n this.href = undefined;\n this.target = undefined;\n this.rel = undefined;\n this.align = \"center\";\n this.disabled = false;\n this.loading = false;\n }\n\n get busy(): boolean {\n return this.loading || this.action.busy;\n }\n\n /** The native `<a>` or `<button>`. */\n get control(): HTMLAnchorElement | HTMLButtonElement | null {\n return this.querySelector(\"[data-pont2-button]\");\n }\n\n /** `href` is set but is not an http(s) URL: the link renders nothing. */\n protected get invalidHref(): boolean {\n return this.href !== undefined && safeUrl(this.href) === null;\n }\n\n protected override willUpdate(_changed: PropertyValues): void {\n this.setData(\"align\", this.align || \"center\");\n this.setData(\"invalid-href\", this.invalidHref);\n }\n\n override render() {\n if (this.invalidHref) return nothing;\n const busy = this.busy;\n return html`${this.prompt ? html`<span data-slot=\"link-prompt\">${this.prompt}</span>` : nothing}${button(\n {\n variant: \"link\",\n slot: \"link-button\",\n href: this.href,\n target: this.target,\n rel: this.rel ?? (this.target === \"_blank\" ? \"noopener noreferrer\" : undefined),\n disabled: this.disabled || busy,\n focusableWhenDisabled: busy && !this.disabled,\n attrs: { \"data-event\": this.event, \"data-service\": this.service, \"data-loading\": busy, \"aria-busy\": busy ? \"true\" : null },\n onClick: this.href === undefined ? () => this.action.request(this.event, { service: this.service }) : undefined,\n },\n this.label || \"Link\",\n )}`;\n }\n}\n\ndefine(\"pont2-link\", Link);\n\n/**\n * # `<pont2-external-link>`: a page outside the flow, in a new tab\n *\n * ```html\n * <pont2-external-link label=\"Privacy policy\" href=\"{{consent_privacy_policy_url}}\"></pont2-external-link>\n * ```\n *\n * The consent screen's links to an app's privacy policy, terms or homepage. It\n * is `pont2-link`'s `href` form with the rules of the legacy\n * `pont-external-link` (carry-over §7):\n *\n * - only an **absolute** http(s) URL with a host renders (`safeExternalUrl`).\n * The href is usually a server placeholder filled from the app's settings,\n * so empty, still a placeholder, relative or any other scheme renders\n * **nothing** and the row is hidden (`data-invalid-href`);\n * - it always opens a new tab, with `rel=\"noopener noreferrer\"`;\n * - `label` falls back to the URL;\n * - it never requests an action and fires no event, so it is safe on screens\n * that are not an auth flow.\n *\n * Styled by `pont2-link`'s recipe and tokens, so the two read as one kind of\n * thing on a screen.\n *\n * @tag pont2-external-link\n * @attr href - absolute http(s) URL; anything else renders nothing\n * @attr label - link text (default: the URL)\n * @attr prompt - text before the link\n * @attr align - start | center (default) | end\n */\nexport class ExternalLink extends Link {\n protected override get invalidHref(): boolean {\n return safeExternalUrl(this.href) === null;\n }\n\n override render() {\n const href = safeExternalUrl(this.href);\n if (!href) return nothing;\n return html`${this.prompt ? html`<span data-slot=\"link-prompt\">${this.prompt}</span>` : nothing}${button(\n { variant: \"link\", slot: \"link-button\", href, target: \"_blank\", rel: \"noopener noreferrer\" },\n this.label?.trim() || href,\n )}`;\n }\n}\n\ndefine(\"pont2-external-link\", ExternalLink);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-link\": Link;\n \"pont2-external-link\": ExternalLink;\n }\n}\n","import { type PropertyDeclarations } from \"lit\";\n\nimport { define } from \"../../core/names\";\nimport { FieldSeparator } from \"../../primitives/field/field\";\n\n/**\n * # `<pont2-divider>`: \"Or continue with\"\n *\n * ```html\n * <pont2-divider label=\"Or continue with\"></pont2-divider>\n * ```\n *\n * **Is a FieldSeparator** (`extends FieldSeparator`), as shadcn's login\n * blocks write it (`<FieldSeparator>Or continue with</FieldSeparator>`): one\n * node, the rule halves drawn by the primitive's `::before`/`::after`, the\n * label a text node. Without a label it is a plain rule\n * (`data-content=\"false\"`).\n *\n * @tag pont2-divider\n * @attr label - text in the middle\n */\nexport class Divider extends FieldSeparator {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n label: { type: String },\n };\n\n declare label: string;\n\n constructor() {\n super();\n this.label = \"\";\n }\n\n override render() {\n return this.label;\n }\n}\n\ndefine(\"pont2-divider\", Divider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-divider\": Divider;\n }\n}\n","import { html, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { ShellElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type TitleLevel = \"1\" | \"2\" | \"3\" | \"4\";\nexport type TextAlign = \"auto\" | \"start\" | \"center\" | \"end\";\n\n/**\n * Title and subtitle: a heading and its supporting line.\n *\n * shadcn has no typography *components* (its typography page is classes), and\n * its login blocks write `<h1 class=\"text-2xl font-bold\">Welcome back</h1>\n * <p class=\"text-muted-foreground text-balance\">Login to your Acme Inc\n * account</p>`. pont2 keeps the **native** `<h1>`–`<h4>` / `<p>` (document\n * outline, heading navigation, reader modes), so these are Tier 3 shells:\n * the host has no box (`display: contents`), the native element is styled.\n *\n * The text comes from `content` (the legacy attribute, and what render\n * specs emit); a composite owns its children.\n */\nabstract class TextShell extends ShellElement {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n content: { type: String },\n align: { type: String },\n };\n\n declare content: string;\n declare align: TextAlign;\n\n constructor() {\n super();\n this.content = \"\";\n this.align = \"auto\";\n }\n\n override get control(): HTMLElement | null {\n return this.firstElementChild as HTMLElement | null;\n }\n\n}\n\n/**\n * # `<pont2-title>`\n *\n * ```html\n * <pont2-title level=\"1\" content=\"Welcome back\"></pont2-title>\n * → <pont2-title data-pont2-shell><h1 data-pont2-title data-level=\"1\" data-align=\"auto\">Welcome back</h1></pont2-title>\n * ```\n *\n * Sizes follow shadcn's auth blocks: level 1 is the block heading (`text-2xl\n * font-bold`), 2–4 step down (`text-xl`/`text-lg`/`text-base`, semibold).\n *\n * @tag pont2-title\n * @attr level - 1 (default) | 2 | 3 | 4: the native heading level\n * @attr content - the heading text\n * @attr align - auto (default: inherit) | start | center | end\n * @cssprop --pont2-title-fg, --pont2-title-font-weight - colour and weight (default foreground, semibold)\n * @cssprop --pont2-title-h1-font-size … --pont2-title-h4-font-size - size per level (default text-2xl, -xl, -lg, -base)\n * @cssprop --pont2-title-h1-font-weight - level 1 weight (default the title weight, else bold)\n */\nexport class Title extends TextShell {\n static override properties: PropertyDeclarations = {\n level: { type: String },\n };\n\n declare level: TitleLevel;\n\n constructor() {\n super();\n this.level = \"1\";\n }\n\n override render(): TemplateResult {\n const level = ([\"1\", \"2\", \"3\", \"4\"] as const).includes(this.level) ? this.level : \"1\";\n const a = this.align || \"auto\";\n const c = this.content;\n switch (level) {\n case \"2\":\n return html`<h2 data-pont2-title data-level=\"2\" data-align=${a}>${c}</h2>`;\n case \"3\":\n return html`<h3 data-pont2-title data-level=\"3\" data-align=${a}>${c}</h3>`;\n case \"4\":\n return html`<h4 data-pont2-title data-level=\"4\" data-align=${a}>${c}</h4>`;\n default:\n return html`<h1 data-pont2-title data-level=\"1\" data-align=${a}>${c}</h1>`;\n }\n }\n}\n\n/**\n * # `<pont2-subtitle>`\n *\n * ```html\n * <pont2-subtitle content=\"Login to your Acme Inc account\"></pont2-subtitle>\n * → <pont2-subtitle data-pont2-shell><p data-pont2-subtitle data-align=\"auto\">…</p></pont2-subtitle>\n * ```\n *\n * shadcn's block description: `text-muted-foreground text-balance` (text-sm).\n *\n * @tag pont2-subtitle\n * @attr content, align - as Title\n * @cssprop --pont2-subtitle-fg, --pont2-subtitle-font-size - colour and size (default muted-foreground, text-sm)\n */\nexport class Subtitle extends TextShell {\n override render(): TemplateResult {\n return html`<p data-pont2-subtitle data-align=${this.align || \"auto\"}>${this.content}</p>`;\n }\n}\n\ndefine(\"pont2-title\", Title);\ndefine(\"pont2-subtitle\", Subtitle);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-title\": Title;\n \"pont2-subtitle\": Subtitle;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\n\nimport { parseList } from \"../../core/attrs\";\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { define } from \"../../core/names\";\nimport type { ButtonSize, ButtonVariant } from \"../../primitives/button/button\";\nimport { Field } from \"../../primitives/field/field\";\nimport type { AuthButtonContent, AuthButtonIconAlign } from \"../auth-button/auth-button\";\nimport \"../auth-button/auth-button\";\nimport { AUTH_PROVIDERS, type AuthProvider } from \"../auth-button/providers\";\n\n/** Per-provider settings that override the field-wide ones (the legacy `overrides`). */\nexport interface ProviderOverride {\n provider: AuthProvider;\n label?: string;\n prompt?: string;\n event?: string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n content?: AuthButtonContent;\n iconAlign?: AuthButtonIconAlign;\n disabled?: boolean;\n loading?: boolean;\n}\n\n/** The legacy column layouts of a 12-column grid, by provider count. */\nexport type ProviderColumns = \"one\" | \"three\" | \"four\" | \"two-three\" | \"three-four\";\n\n/** 1–2 → one per row; multiples of 3 → three; 5 → 2 + 3; 7 → 3 + 4; otherwise four (legacy rule). */\nexport function providerColumns(count: number): ProviderColumns {\n if (count < 3) return \"one\";\n if (count % 3 === 0) return \"three\";\n if (count === 5) return \"two-three\";\n if (count === 7) return \"three-four\";\n return \"four\";\n}\n\n/** The legacy default event per provider: the platform's OAuth sign-in action. */\nexport const providerEvent = (p: AuthProvider) => `signin_with_oauth(${p})`;\n\nconst listConverter = {\n fromAttribute: (v: string | null): AuthProvider[] =>\n parseList(v).filter((p): p is AuthProvider => AUTH_PROVIDERS.includes(p as AuthProvider)),\n};\n\nconst jsonArray = {\n fromAttribute: (v: string | null): ProviderOverride[] => {\n try {\n const parsed = JSON.parse(v ?? \"[]\");\n return Array.isArray(parsed) ? parsed : [];\n } catch {\n return [];\n }\n },\n};\n\n/**\n * # `<pont2-provider-field>`: the \"continue with…\" button grid\n *\n * ```html\n * <pont2-provider-field providers=\"apple google meta\"></pont2-provider-field>\n * <pont2-provider-field providers='[\"google\",\"github\"]'></pont2-provider-field> (the form the platform injects)\n * ```\n *\n * **Is a Field** (`extends Field`), as in shadcn's login blocks (`<Field\n * className=\"grid grid-cols-3 gap-4\">` holding the buttons), laid out on the\n * legacy kit's 12-column grid (`data-columns`, see `providerColumns`). It\n * renders one **`<pont2-provider-button>` element** per provider:\n *\n * ```html\n * <pont2-provider-field data-pont2-field data-slot=\"field\" role=\"group\" data-columns=\"three\">\n * <pont2-provider-button provider=\"apple\" content=\"icon\" event=\"signin_with_oauth(apple)\" data-pont2-shell>\n * <button data-pont2-button data-variant=\"outline\" data-provider=\"apple\" aria-label=\"Continue with Apple\">…</button>\n * </pont2-provider-button>\n * …\n * </pont2-provider-field>\n * ```\n *\n * Nesting kit elements is normally forbidden in kit templates. This is the\n * documented exception (docs/10-primitives-and-kit.md §5): each button is an\n * **independent, stateful** element (its own busy state and action request),\n * repeated per item, and its host is `display: contents`, so the grid items\n * are the native buttons and the DOM is shadcn's.\n *\n * Field-wide settings apply to every button; `overrides` (JSON attribute or\n * array property) replaces them for one provider. With more than two\n * providers the buttons default to icon-only (legacy).\n *\n * @tag pont2-provider-field\n * @attr providers - e.g. \"apple google github\" (duplicates and unknown names are dropped)\n * @attr event - one event for every button (default: `signin_with_oauth(<provider>)` each)\n * @attr variant, size, content, icon-align, prompt, label, disabled, loading - passed to every button\n * @attr overrides - JSON array of per-provider settings, e.g. `[{\"provider\":\"google\",\"label\":\"Google Workspace\"}]`\n */\nexport class ProviderField extends Field {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n providers: { converter: listConverter },\n overrides: { converter: jsonArray },\n event: { type: String },\n variant: { type: String },\n size: { type: String },\n content: { type: String },\n iconAlign: { type: String, attribute: \"icon-align\" },\n prompt: { type: String },\n label: { type: String },\n loading: { type: Boolean },\n };\n\n declare providers: AuthProvider[];\n declare overrides: ProviderOverride[];\n declare event: string | undefined;\n declare variant: ButtonVariant | undefined;\n declare size: ButtonSize | undefined;\n declare content: AuthButtonContent | undefined;\n declare iconAlign: AuthButtonIconAlign | undefined;\n declare prompt: string | undefined;\n declare label: string | undefined;\n declare loading: boolean;\n\n constructor() {\n super();\n this.providers = [];\n this.overrides = [];\n this.event = undefined;\n this.variant = undefined;\n this.size = undefined;\n this.content = undefined;\n this.iconAlign = undefined;\n this.prompt = undefined;\n this.label = undefined;\n this.loading = false;\n }\n\n /** Design mode (core/design-mode.ts): sample providers when none are set. */\n protected readonly design = new DesignModeController(this);\n\n /**\n * The providers actually rendered: known names, first occurrence only. In design mode with none\n * set, three samples (google, apple, github): at serve time the platform injects the app's\n * providers, and three is where the grid switches to icon-only buttons, the arrangement most\n * real screens end up with (the legacy samples).\n */\n get list(): AuthProvider[] {\n const list = [...new Set((this.providers ?? []).filter(p => AUTH_PROVIDERS.includes(p)))];\n return list.length === 0 && this.design.active ? ([\"google\", \"apple\", \"github\"] as AuthProvider[]) : list;\n }\n\n /** The rendered `<pont2-provider-button>` elements. */\n get buttons(): HTMLElementTagNameMap[\"pont2-provider-button\"][] {\n return Array.from(this.querySelectorAll(\":scope > pont2-provider-button\"));\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.setData(\"columns\", providerColumns(this.list.length));\n }\n\n override render() {\n const list = this.list;\n // The first override for a provider wins, as in the legacy kit (a later duplicate is ignored).\n const overrides = new Map<string, ProviderOverride>();\n for (const o of this.overrides ?? []) if (!overrides.has(o.provider)) overrides.set(o.provider, o);\n const iconOnly = list.length > 2 ? \"icon\" : undefined;\n return repeat(\n list,\n p => p,\n p => {\n const o = overrides.get(p) ?? ({ provider: p } as ProviderOverride);\n const opt = <T>(v: T | undefined) => (v === undefined || v === null || v === \"\" ? nothing : v);\n return html`<pont2-provider-button\n provider=${p}\n event=${o.event ?? this.event ?? providerEvent(p)}\n variant=${opt(o.variant ?? this.variant)}\n size=${opt(o.size ?? this.size)}\n content=${opt(o.content ?? this.content ?? iconOnly)}\n icon-align=${opt(o.iconAlign ?? this.iconAlign)}\n prompt=${opt(o.prompt ?? this.prompt)}\n label=${opt(o.label ?? this.label)}\n ?disabled=${!!(o.disabled || this.disabled)}\n ?loading=${!!(o.loading || this.loading)}\n ></pont2-provider-button>`;\n },\n );\n }\n}\n\ndefine(\"pont2-provider-field\", ProviderField);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-provider-field\": ProviderField;\n }\n}\n","import { html, svg } from \"lit\";\n\n/**\n * The Pontive logo (mark + wordmark), the same geometry as the legacy\n * watermark. Pontive's own asset, so it is inlined (no image request) and the\n * mark and wordmark can be coloured separately in CSS.\n */\nexport const PONTIVE_MARK = svg`<polygon points=\"113.15,120.26 72.47,190.69 72.46,190.71 61.31,210.02 34.66,256.16 0,196.08 78.48,60.19\" /><polygon points=\"256.23,117.67 179.4,250.76 107.12,250.76 72.46,190.71 72.47,190.69 144.73,190.69 186.89,117.67 153.68,60.07 78.48,60.07 34.65,0 188.35,0\" />`;\nexport const PONTIVE_WORDMARK = svg`<path d=\"M305.95,36.62h76.01c37.22,0,63.16,24.13,63.16,58.64c0,35.19-25.94,59.77-63.16,59.77h-40.83v62.03h-35.19V36.62z M381.51,123.46c16.24,0,27.52-11.28,27.52-27.74c0-16.24-11.28-27.52-27.52-27.52h-40.37v55.26H381.51z\" /><path d=\"M454.59,143.76c0-45.11,31.58-75.79,76.91-75.79c45.34,0,76.91,30.68,76.91,75.79c0,45.34-31.58,75.79-76.91,75.79C486.17,219.54,454.59,189.09,454.59,143.76z M531.51,187.74c24.13,0,41.05-17.59,41.05-43.98c0-26.16-16.92-43.98-41.05-43.98c-23.91,0-40.83,17.82-40.83,43.98C490.68,170.15,507.6,187.74,531.51,187.74z\" /><path d=\"M635.48,70.45h34.96v18.72c3.61-8.8,17.14-21.2,40.37-21.2c33.38,0,59.1,25.71,59.1,63.83v85.26h-35.19v-84.58c0-19.85-12.86-33.16-32.03-33.16c-19.17,0-32.03,13.31-32.03,33.16v84.58h-35.19V70.45z\" /><path d=\"M815.02,102.03h-27.07V70.45h27.07V36.62h35.19v33.83h26.84v31.58h-26.84v115.03h-35.19V102.03z\" /><path d=\"M899.6,36.62h35.19V68.2H899.6V36.62z M899.6,89.85h35.19v127.21H899.6V89.85z\" /><path d=\"M955.09,70.45h36.31l39.7,103.76l39.47-103.76h36.31l-58.19,146.61h-35.19L955.09,70.45z\" /><path d=\"M1117.49,144.21c0-45.56,32.03-76.24,76.46-76.24c49.85,0,81.65,39.25,76.24,87.29h-116.16c2.48,20.53,20.3,33.16,39.47,33.16c15.56,0,30.68-8.12,37.22-22.33h36.99c-9.92,32.48-36.99,53.46-74.66,53.46C1148.39,219.54,1117.49,188.87,1117.49,144.21z M1232.75,127.97c-5.64-17.59-20.07-28.87-38.34-28.87c-18.5,0-33.38,11.05-38.8,29.1L1232.75,127.97z\" />`;\n\nexport const pontiveLogo = () => html`<svg\n data-slot=\"watermark-logo\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 1270.79 256.16\"\n role=\"img\"\n aria-label=\"Pontive\"\n><g data-logo-mark>${PONTIVE_MARK}</g><g data-logo-wordmark>${PONTIVE_WORDMARK}</g></svg>`;\n","import { html, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { pontiveLogo } from \"./pontive-logo\";\n\nexport const WATERMARK_VARIANTS = [\"brand\", \"theme\", \"muted\"] as const;\nexport type WatermarkVariant = (typeof WATERMARK_VARIANTS)[number];\nexport const WATERMARK_LOGO_ALIGNS = [\"start\", \"end\"] as const;\nexport type WatermarkLogoAlign = (typeof WATERMARK_LOGO_ALIGNS)[number];\n\n/** The watermark's content (label + logo), shared with the block's footer. */\nexport function watermarkContent(label: string, logoAlign: WatermarkLogoAlign): TemplateResult {\n const text = html`<span data-slot=\"watermark-label\">${label || \"Powered by\"}</span>`;\n return logoAlign === \"start\" ? html`${pontiveLogo()}${text}` : html`${text}${pontiveLogo()}`;\n}\n\n/**\n * # `<pont2-watermark>`: \"Powered by [Pontive]\"\n *\n * ```html\n * <pont2-watermark variant=\"muted\"></pont2-watermark>\n * → <pont2-watermark data-pont2-watermark data-slot=\"watermark\" data-variant=\"muted\">\n * <span data-slot=\"watermark-label\">Powered by</span><svg data-slot=\"watermark-logo\" role=\"img\" aria-label=\"Pontive\">…</svg>\n * </pont2-watermark>\n * ```\n *\n * Host-as-root (the legacy element wrapped a `<span>` in its tag). The block\n * renders the same content as a *part* in its footer (`Watermark.part()` +\n * `watermarkContent()`), so the screen shell needs no nested element.\n *\n * @tag pont2-watermark\n * @attr variant - brand (default: the mark in Pontive indigo) | theme (currentColor) | muted (muted text)\n * @attr logo-align - start | end (default)\n * @attr label - default \"Powered by\"\n * @cssprop --pont2-watermark-brand-icon-color - the mark in the brand variant (default #6366f1)\n * @cssprop --pont2-watermark-muted-fg - text and mark in the muted variant (default muted-foreground)\n */\nexport class Watermark extends HostElement {\n static override identity = \"watermark\";\n static override slotName = \"watermark\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n logoAlign: { type: String, attribute: \"logo-align\" },\n label: { type: String },\n };\n\n declare variant: WatermarkVariant;\n declare logoAlign: WatermarkLogoAlign;\n declare label: string;\n\n constructor() {\n super();\n this.variant = \"brand\";\n this.logoAlign = \"end\";\n this.label = \"\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"brand\");\n }\n\n override render() {\n return watermarkContent(this.label, this.logoAlign);\n }\n}\n\ndefine(\"pont2-watermark\", Watermark);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-watermark\": Watermark;\n }\n}\n","import { ContextConsumer, createContext } from \"@lit/context\";\nimport type { ReactiveElement } from \"lit\";\n\n/**\n * Account-level branding entitlements, the pont2 side of\n * docs/branding-entitlements.md (same rule, same shape):\n *\n * > A branding entitlement is a fact about the account, resolved by the\n * > backend, delivered as context. An element that renders branding *asks*\n * > for it. It is never *told* by its own markup.\n *\n * So there is no attribute, property or other escape hatch on any pont2\n * element; the flow host (the future pont2 widgets/layout) provides\n * `brandingContext` from the backend response, and Storybook provides it with\n * a `ContextProvider`.\n *\n * The context is the Context Community Protocol (`context-request` events)\n * through `@lit/context`. Its key is `pont2:branding`, separate from the\n * legacy `pont:branding` (docs/08-parallel-constraints.md §4).\n */\nexport interface BrandingEntitlements {\n /** Whether the Pontive watermark must be rendered on the screen shell. */\n showWatermark: boolean;\n}\n\n/** Fail closed: no provider, or an old backend, means the watermark shows. */\nexport const DEFAULT_BRANDING: BrandingEntitlements = { showWatermark: true };\n\nexport const brandingContext = createContext<BrandingEntitlements>(\"pont2:branding\");\n\n/**\n * Reads the entitlements for one element (subscribing, so a late or changed\n * provider value re-renders it). Deliberately no attribute override.\n */\nexport class BrandingController {\n private consumer: ContextConsumer<typeof brandingContext, ReactiveElement>;\n\n constructor(host: ReactiveElement) {\n this.consumer = new ContextConsumer(host, { context: brandingContext, subscribe: true });\n }\n\n get showWatermark(): boolean {\n return this.consumer.value?.showWatermark ?? DEFAULT_BRANDING.showWatermark;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { define } from \"../../core/names\";\nimport { Card, CardFooter } from \"../../primitives/card/card\";\nimport { Watermark, watermarkContent } from \"../watermark/watermark\";\nimport { BrandingController } from \"./branding\";\n\nexport { BrandingController, brandingContext, DEFAULT_BRANDING, type BrandingEntitlements } from \"./branding\";\n\nexport type BlockAlign = \"stretch\" | \"start\" | \"center\" | \"end\";\nexport type BlockJustify = \"start\" | \"center\" | \"end\";\n\n/**\n * # `<pont2-block>`: the screen shell\n *\n * ```html\n * <pont2-block>\n * <pont2-header>…</pont2-header>\n * <form>…</form>\n * </pont2-block>\n * ```\n *\n * **Is a Card** (`extends Card`): the host is the card, the screen's content\n * is its children, **left where they are**, and the block adds one thing of\n * its own, the watermark footer:\n *\n * ```html\n * <pont2-block data-pont2-card data-slot=\"card\" data-align=\"stretch\" data-justify=\"start\">\n * …the screen (author / render-spec content)…\n * <div data-pont2-card-footer data-slot=\"card-footer\" data-border=\"top\">\n * <span data-pont2-watermark data-slot=\"watermark\" data-variant=\"muted\">Powered by <svg/></span>\n * </div>\n * </pont2-block>\n * ```\n *\n * The legacy `pont-block` rendered `pont-card > [card] > pont-card-content >\n * [card-content]` and then **moved** the spec's children into it\n * (`moveLightDomChildrenInto`), the relocation pattern host-as-root exists to\n * remove. pont2 moves nothing: the card's inline padding (CardContent's\n * `px-(--card-spacing)`) is on the host, and the footer bleeds to the edges.\n *\n * **Watermark entitlement** (docs/branding-entitlements.md): the footer is\n * rendered unless the branding context says `showWatermark: false`. There is\n * no attribute or property for it, and it fails closed. It is part of the\n * shell, not the content, so a screen author cannot delete it.\n *\n * Not a props-driven composite (`composite = false`): a block *contains* the\n * screen. Lit renders the footer after the author's children.\n *\n * @tag pont2-block\n * @attr align - stretch (default) | start | center | end: the content's cross-axis alignment\n * @attr justify - start (default) | center | end: when the block is taller than its content\n * @attr size - default | sm (the Card primitive's spacing)\n * @cssprop --pont2-block-max-width - max width on wider screens (default 24rem)\n * @cssprop --pont2-block-gap - gap between children (default 1rem)\n * @cssprop --pont2-block-bg, --pont2-block-fg, --pont2-block-border-color, --pont2-block-radius, --pont2-block-shadow, --pont2-block-spacing - the screen card (fall back to the Card's tokens)\n * @cssprop --pont2-block-footer-bg - the watermark band\n */\nexport class Block extends Card {\n static override composite = false;\n\n static override properties: PropertyDeclarations = {\n align: { type: String },\n justify: { type: String },\n };\n\n declare align: BlockAlign;\n declare justify: BlockJustify;\n\n private branding = new BrandingController(this);\n\n constructor() {\n super();\n this.align = \"stretch\";\n this.justify = \"start\";\n }\n\n protected override willUpdate(): void {\n super.willUpdate();\n this.setData(\"align\", this.align || \"stretch\");\n this.setData(\"justify\", this.justify || \"start\");\n }\n\n override render() {\n if (!this.branding.showWatermark) return nothing;\n return html`<div ${CardFooter.part({ \"data-border\": \"top\", \"data-block-footer\": true })}>\n <span ${Watermark.part({ \"data-variant\": \"muted\" })}>${watermarkContent(\"\", \"end\")}</span>\n </div>`;\n }\n}\n\ndefine(\"pont2-block\", Block);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-block\": Block;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/** The legacy render-spec values. */\nexport const CONTAINER_TYPES = [\"flex_column\", \"flex_row\"] as const;\nexport type ContainerType = (typeof CONTAINER_TYPES)[number];\nexport type ContainerAlign = \"stretch\" | \"start\" | \"center\" | \"end\";\nexport type ContainerJustify = \"start\" | \"center\" | \"end\" | \"between\";\n\n/**\n * # `<pont2-container>`: a flex group of screen elements\n *\n * ```html\n * <pont2-container type=\"flex_row\" justify=\"between\">…</pont2-container>\n * → <pont2-container data-pont2-container data-slot=\"container\" data-type=\"flex_row\" data-justify=\"between\">…</pont2-container>\n * ```\n *\n * Tier 1 host-as-root: the host is the flex box and the children stay where\n * they are (the legacy element rendered an inner `div` and moved the children\n * into it). Not a composite: it contains content.\n *\n * @tag pont2-container\n * @attr type - flex_column (default) | flex_row\n * @attr align - stretch (default) | start | center | end (cross axis)\n * @attr justify - start (default) | center | end | between (main axis)\n * @cssprop --pont2-container-gap - default 1rem\n */\nexport class Container extends HostElement {\n static override identity = \"container\";\n static override slotName = \"container\";\n static override composite = false;\n\n static override properties: PropertyDeclarations = {\n type: { type: String },\n align: { type: String },\n justify: { type: String },\n };\n\n declare type: ContainerType;\n declare align: ContainerAlign;\n declare justify: ContainerJustify;\n\n /** Design mode (core/design-mode.ts): outlined and inset on the designer's canvas. */\n protected readonly design = new DesignModeController(this);\n\n constructor() {\n super();\n this.type = \"flex_column\";\n this.align = \"stretch\";\n this.justify = \"start\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"type\", this.type === \"flex_row\" ? \"flex_row\" : \"flex_column\");\n this.setData(\"align\", this.align || \"stretch\");\n this.setData(\"justify\", this.justify || \"start\");\n // A container draws nothing of its own, so on the designer's canvas it would be invisible, and\n // an empty one would have no extent to drop into. Design mode outlines and insets it, and labels\n // an empty one (container.css). Never on a served screen.\n const design = this.design.active;\n this.setData(\"design\", design);\n this.setData(\"design-empty\", design && this.childElementCount === 0);\n }\n}\n\ndefine(\"pont2-container\", Container);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-container\": Container;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const HEADER_ALIGNS = [\"start\", \"center\", \"end\"] as const;\nexport type HeaderAlign = (typeof HEADER_ALIGNS)[number];\n\n/**\n * # `<pont2-header>`: the screen's heading group (logo, title, subtitle)\n *\n * ```html\n * <pont2-header>\n * <pont2-logo image-url=\"/logo.svg\"></pont2-logo>\n * <pont2-title content=\"Welcome back\"></pont2-title>\n * <pont2-subtitle content=\"Login to your Acme Inc account\"></pont2-subtitle>\n * </pont2-header>\n * ```\n *\n * shadcn's login blocks: `<div class=\"flex flex-col items-center gap-2\n * text-center\">`. Tier 1 host-as-root (the legacy element moved its children\n * into an inner `div`); `align` sets both the boxes' and the text's alignment,\n * as the legacy header does. Not a composite: it contains content.\n *\n * @tag pont2-header\n * @attr align - start | center (default) | end\n * @cssprop --pont2-header-gap - default 0.5rem\n */\nexport class Header extends HostElement {\n static override identity = \"header\";\n static override slotName = \"header\";\n static override composite = false;\n\n static override properties: PropertyDeclarations = {\n align: { type: String },\n };\n\n declare align: HeaderAlign;\n\n constructor() {\n super();\n this.align = \"center\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"align\", this.align || \"center\");\n }\n}\n\ndefine(\"pont2-header\", Header);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-header\": Header;\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const GAP_TYPES = [\"vertical\", \"horizontal\"] as const;\nexport type GapType = (typeof GAP_TYPES)[number];\n\n/**\n * # `<pont2-gap>`: a fixed spacer\n *\n * ```html\n * <pont2-gap size=\"24px\"></pont2-gap>\n * → <pont2-gap data-pont2-gap data-type=\"vertical\" style=\"--pont2-gap-size: 24px\"></pont2-gap>\n * ```\n *\n * The host *is* the spacer (the legacy element rendered a sized `div` inside\n * itself). The size is any CSS length, passed through the `--pont2-gap-size`\n * custom property on the host, so no inline width/height overrides author CSS.\n * Decorative: `aria-hidden`.\n *\n * @tag pont2-gap\n * @attr size - CSS length (default 8px)\n * @attr type - vertical (default: takes height) | horizontal (takes width)\n */\nexport class Gap extends HostElement {\n static override identity = \"gap\";\n static override slotName = \"gap\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n size: { type: String },\n type: { type: String },\n };\n\n declare size: string;\n declare type: GapType;\n\n constructor() {\n super();\n this.size = \"8px\";\n this.type = \"vertical\";\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals.ariaHidden = \"true\";\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n this.setData(\"type\", this.type === \"horizontal\" ? \"horizontal\" : \"vertical\");\n if (changed.has(\"size\")) this.style.setProperty(\"--pont2-gap-size\", this.size || \"8px\");\n }\n}\n\ndefine(\"pont2-gap\", Gap);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-gap\": Gap;\n }\n}\n","import { html, nothing, svg, type PropertyDeclarations } from \"lit\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const LOGO_ALIGNS = [\"start\", \"center\", \"end\"] as const;\nexport type LogoAlign = (typeof LOGO_ALIGNS)[number];\n\n/**\n * A logo source as an `<img src>`: URLs and `data:` URIs pass through; a bare\n * base64 string is treated as an SVG (the legacy `resolveIconSource` rule).\n * `{{theme}}` in a URL is replaced with `light` or `dark`.\n */\nexport function logoSource(raw: string | undefined, theme: \"light\" | \"dark\"): string {\n if (!raw) return \"\";\n const url = raw.replace(\"{{theme}}\", theme);\n if (/^(https?:|data:|blob:|\\/|\\.{1,2}\\/)/.test(url)) return url;\n return `data:image/svg+xml;base64,${url}`;\n}\n\n/**\n * # `<pont2-logo>`: the application's logo\n *\n * ```html\n * <pont2-logo image-url=\"https://cdn.example.com/logo-{{theme}}.svg\" alt=\"Acme\"></pont2-logo>\n * → <pont2-logo data-pont2-logo data-slot=\"logo\" data-align=\"center\">\n * <img data-logo-theme=\"light\" src=\"…logo-light.svg\" alt=\"Acme\">\n * <img data-logo-theme=\"dark\" src=\"…logo-dark.svg\" alt=\"Acme\"> (only when it differs)\n * </pont2-logo>\n * ```\n *\n * **Always an `<img>`.** The legacy element decoded base64 SVG and injected\n * it as markup (`unsafeSVG`), which runs whatever the SVG contains in the\n * page. An `<img>` renders the same SVG sandboxed (no script, no external\n * fetches), and needs no decoding.\n *\n * **Dark mode by CSS**, not by watching `<html data-theme>`: when the dark\n * source differs (`image-url-dark`, or `{{theme}}` in the URL), both images\n * are rendered and the stylesheet shows the right one under `.dark` /\n * `[data-theme=\"dark\"]` (the pont2 dark-mode switches).\n *\n * @tag pont2-logo\n * @attr image-url - URL, `data:` URI or bare base64 SVG; `{{theme}}` is replaced\n * @attr image-url-dark - dark-mode source (default: `image-url` with `{{theme}}` = dark)\n * @attr alt - default \"Logo\" (legacy); set the brand name\n * @attr align - start | center (default) | end\n * @attr width, height - CSS lengths for the image\n */\nexport class Logo extends HostElement {\n static override identity = \"logo\";\n static override slotName = \"logo\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n imageUrl: { type: String, attribute: \"image-url\" },\n imageUrlDark: { type: String, attribute: \"image-url-dark\" },\n alt: { type: String },\n align: { type: String },\n width: { type: String },\n height: { type: String },\n };\n\n declare imageUrl: string;\n declare imageUrlDark: string;\n declare alt: string;\n declare align: LogoAlign;\n declare width: string;\n declare height: string;\n\n /** Design mode (core/design-mode.ts): a placeholder mark when no image is set. */\n protected readonly design = new DesignModeController(this);\n\n constructor() {\n super();\n this.imageUrl = \"\";\n this.imageUrlDark = \"\";\n this.alt = \"\";\n this.align = \"center\";\n this.width = \"\";\n this.height = \"\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"align\", this.align || \"center\");\n }\n\n override render() {\n const light = logoSource(this.imageUrl, \"light\");\n // At serve time a bare logo gets the brand's logo injected, or is pruned. The designer has\n // neither, so it shows a placeholder mark (the legacy one) rather than nothing.\n if (!light) return this.design.active ? PLACEHOLDER : nothing;\n const dark = logoSource(this.imageUrlDark || this.imageUrl, \"dark\");\n const style = styleMap({ width: this.width || undefined, height: this.height || undefined });\n const alt = this.alt || \"Logo\";\n return html`<img data-logo-theme=\"light\" src=${light} alt=${alt} style=${style} />${dark !== light\n ? html`<img data-logo-theme=\"dark\" src=${dark} alt=${alt} style=${style} />`\n : nothing}`;\n }\n}\n\n/** The design-mode placeholder: inline, static, `currentColor` so it follows the theme. */\nconst PLACEHOLDER = html`<span data-slot=\"logo-placeholder\" role=\"img\" aria-label=\"Logo placeholder\">${svg`<svg\n viewBox=\"0 0 120 32\" width=\"120\" height=\"32\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <rect x=\"0.75\" y=\"0.75\" width=\"118.5\" height=\"30.5\" rx=\"6\" fill=\"none\" stroke=\"currentColor\"\n stroke-opacity=\"0.28\" stroke-width=\"1.5\" stroke-dasharray=\"4 3\"/>\n <circle cx=\"20\" cy=\"16\" r=\"6\" fill=\"currentColor\" fill-opacity=\"0.3\"/>\n <rect x=\"32\" y=\"11\" width=\"52\" height=\"4\" rx=\"2\" fill=\"currentColor\" fill-opacity=\"0.3\"/>\n <rect x=\"32\" y=\"19\" width=\"34\" height=\"4\" rx=\"2\" fill=\"currentColor\" fill-opacity=\"0.18\"/>\n</svg>`}</span>`;\n\ndefine(\"pont2-logo\", Logo);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-logo\": Logo;\n }\n}\n","import { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { safeUrl } from \"../../core/url\";\n\nexport interface CountdownEndDetail {\n /** Where the countdown will navigate (already resolved), or null. */\n url: string | null;\n}\n\n/** Kept as countdown's export; the check itself is `safeUrl` (core/url.ts), shared with `pont2-link`. */\nexport const safeRedirect = (raw: string, base?: string): string | null => safeUrl(raw, base);\n\n/**\n * # `<pont2-countdown>`: \"Redirecting in 5s…\"\n *\n * ```html\n * <pont2-countdown content=\"Redirecting you in\" duration=\"5\" redirect-url=\"/dashboard\"></pont2-countdown>\n * → <pont2-countdown data-pont2-countdown data-slot=\"countdown\" role=\"timer\">Redirecting you in 5s…</pont2-countdown>\n * ```\n *\n * Host-as-root (the legacy element rendered a `div` inside its tag). Counts\n * down once a second; at zero it fires a **cancelable** `pont2-countdown-end`\n * and, unless a listener prevents it, navigates to `redirect-url`.\n *\n * **Only http(s) URLs are followed.** Render specs are author-editable HTML,\n * so a `javascript:` or `data:` redirect would be script injection; those are\n * refused (the event still fires, with `url: null`). The legacy element\n * assigned `location.href` unconditionally and defaulted to `/`; pont2 has no\n * default: without `redirect-url` it only fires the event.\n *\n * `role=\"timer\"`: assistive technology is not interrupted every second.\n *\n * @tag pont2-countdown\n * @attr duration - seconds (default 5)\n * @attr content - text before the seconds\n * @attr redirect-url - where to go at zero (http/https, relative URLs resolve against the page)\n * @fires pont2-countdown-end - `{ url }`, cancelable: `preventDefault()` stops the redirect\n */\nexport class Countdown extends HostElement {\n static override identity = \"countdown\";\n static override slotName = \"countdown\";\n static override role = \"timer\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n duration: { type: Number },\n content: { type: String },\n redirectUrl: { type: String, attribute: \"redirect-url\" },\n remaining: { state: true },\n };\n\n declare duration: number;\n declare content: string;\n declare redirectUrl: string;\n /** Seconds left. */\n declare remaining: number;\n\n private timer: ReturnType<typeof setInterval> | undefined;\n\n constructor() {\n super();\n this.duration = 5;\n this.content = \"\";\n this.redirectUrl = \"\";\n this.remaining = 0;\n }\n\n /** (Re)starts from `duration`. */\n restart(): void {\n this.stop();\n this.remaining = Math.max(0, Math.floor(this.duration || 0));\n if (!this.remaining) {\n this.end();\n return;\n }\n this.timer = setInterval(() => {\n this.remaining -= 1;\n if (this.remaining <= 0) {\n this.stop();\n this.end();\n }\n }, 1000);\n }\n\n private stop(): void {\n if (this.timer !== undefined) clearInterval(this.timer);\n this.timer = undefined;\n }\n\n private end(): void {\n const url = safeRedirect(this.redirectUrl);\n const go = fire<CountdownEndDetail>(this, \"pont2-countdown-end\", { url }, true);\n if (go && url) location.assign(url);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.restart();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.stop();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"duration\") && this.hasUpdated) this.restart();\n }\n\n override render() {\n return html`${this.content ? `${this.content} ` : \"\"}${this.remaining}s…`;\n }\n}\n\ndefine(\"pont2-countdown\", Countdown);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-countdown\": Countdown;\n }\n interface HTMLElementEventMap {\n \"pont2-countdown-end\": CustomEvent<CountdownEndDetail>;\n }\n}\n","import { html, type PropertyDeclarations } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\n\n/**\n * # `<pont2-edit-identifier>`: \"ada@example.com ✎\"\n *\n * The identifier the user entered on the previous step, with a button to go\n * back and change it.\n *\n * ```html\n * <pont2-edit-identifier identifier=\"ada@example.com\" event=\"change_identifier\"></pont2-edit-identifier>\n * → <pont2-edit-identifier data-pont2-edit-identifier data-slot=\"edit-identifier\">\n * <span data-slot=\"edit-identifier-value\">ada@example.com</span>\n * <button data-pont2-button data-variant=\"ghost\" data-size=\"icon-xs\" aria-label=\"Change ada@example.com\" type=\"button\"><svg/></button>\n * </pont2-edit-identifier>\n * ```\n *\n * The button is the button primitive's part and requests `event` through the\n * action protocol (`data: { identifier }`), busy until it settles. The\n * legacy element made the *whole* element a click target and its icon button\n * had no accessible name; here only the button acts, and it is named\n * (\"Change ada@example.com\", `label` + the identifier).\n *\n * @tag pont2-edit-identifier\n * @attr identifier - the value shown\n * @attr event - the action requested on press\n * @attr label - the button's accessible name prefix (default \"Change\")\n * @fires pont2-action, pont2-action-success, pont2-action-error\n */\nexport class EditIdentifier extends HostElement {\n static override identity = \"edit-identifier\";\n static override slotName = \"edit-identifier\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n identifier: { type: String },\n event: { type: String },\n label: { type: String },\n };\n\n declare identifier: string;\n declare event: string | undefined;\n declare label: string;\n\n protected readonly action = new ActionController(this);\n\n constructor() {\n super();\n this.identifier = \"\";\n this.event = undefined;\n this.label = \"\";\n }\n\n get control(): HTMLButtonElement | null {\n return this.querySelector(\"[data-pont2-button]\");\n }\n\n override render() {\n const busy = this.action.busy;\n return html`<span data-slot=\"edit-identifier-value\">${this.identifier}</span>${button(\n {\n variant: \"ghost\",\n size: \"icon-xs\",\n slot: \"edit-identifier-button\",\n disabled: busy,\n focusableWhenDisabled: busy,\n attrs: {\n \"aria-label\": `${this.label || \"Change\"} ${this.identifier}`.trim(),\n \"data-event\": this.event,\n \"aria-busy\": busy ? \"true\" : null,\n },\n onClick: () => this.action.request(this.event, { identifier: this.identifier }),\n },\n icons.pencil(),\n )}`;\n }\n}\n\ndefine(\"pont2-edit-identifier\", EditIdentifier);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-edit-identifier\": EditIdentifier;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { CopyController } from \"../../core/controllers/copy\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { uid } from \"../../core/ids\";\nimport { define } from \"../../core/names\";\nimport { InputGroup, InputGroupAddon, inputGroupButton, inputGroupInput } from \"../../primitives/input-group/input-group\";\n\n/**\n * # `<pont2-secret>`: the \"Can't scan?\" manual TOTP secret\n *\n * ```html\n * <pont2-secret secret=\"JBSWY3DPEHPK3PXP\" issuer=\"Acme\" account=\"ada@example.com\"></pont2-secret>\n * ```\n *\n * ```html\n * <pont2-secret data-pont2-secret data-slot=\"secret\">\n * <p data-slot=\"secret-title\">Can't scan?</p>\n * <div data-pont2-input-group …>\n * <input data-pont2-input-group-input readonly value=\"JBSWY3DPEHPK3PXP\" aria-label=\"Manual secret\">\n * <div data-pont2-input-group-addon data-align=\"inline-end\">\n * <button … aria-label=\"Copy secret\"><svg/></button>\n * </div>\n * </div>\n * <span data-slot=\"secret-copied\" role=\"status\">Copied!</span> (after copying)\n * <dl data-slot=\"secret-metadata\"><div><dt>Issuer</dt><dd>Acme</dd></div><div><dt>Account</dt><dd>…</dd></div></dl>\n * </pont2-secret>\n * ```\n *\n * Built from InputGroup parts (shadcn's input + addon button). Differences\n * from the legacy element, each deliberate:\n * - the input is **readonly**, not disabled: it can be focused and selected\n * (copy by hand, screen readers read it); monospace, spaced for reading;\n * - \"Copied!\" is a `role=\"status\"` live region, so it is announced;\n * - the copy events (`pont2-copied` / `pont2-copy-error`, `{ kind: \"secret\" }`)\n * **do not carry the secret** (the legacy `pont-secret:copied` did);\n * - issuer/account are a description list (`<dl>`), their semantic form.\n *\n * @tag pont2-secret\n * @attr secret, issuer, account\n * @attr title-text - default \"Can't scan?\" (`title` would be a native tooltip)\n * @attr secret-label, issuer-label, account-label, copy-label, copied-text - copy\n * @attr disabled - disables the copy button\n * @fires pont2-copied, pont2-copy-error - `{ kind: \"secret\" }`\n */\nexport class Secret extends HostElement {\n static override identity = \"secret\";\n static override slotName = \"secret\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n secret: { type: String },\n issuer: { type: String },\n account: { type: String },\n titleText: { type: String, attribute: \"title-text\" },\n secretLabel: { type: String, attribute: \"secret-label\" },\n issuerLabel: { type: String, attribute: \"issuer-label\" },\n accountLabel: { type: String, attribute: \"account-label\" },\n copyLabel: { type: String, attribute: \"copy-label\" },\n copiedText: { type: String, attribute: \"copied-text\" },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare secret: string;\n declare issuer: string;\n declare account: string;\n declare titleText: string;\n declare secretLabel: string;\n declare issuerLabel: string;\n declare accountLabel: string;\n declare copyLabel: string;\n declare copiedText: string;\n declare disabled: boolean;\n\n protected readonly clipboard = new CopyController(this, \"secret\");\n private inputId = uid(\"secret\");\n\n constructor() {\n super();\n this.secret = \"\";\n this.issuer = \"\";\n this.account = \"\";\n this.titleText = \"\";\n this.secretLabel = \"\";\n this.issuerLabel = \"\";\n this.accountLabel = \"\";\n this.copyLabel = \"\";\n this.copiedText = \"\";\n this.disabled = false;\n }\n\n /** Copies the secret (also what the button does). */\n copy(): Promise<boolean> {\n return this.secret && !this.disabled ? this.clipboard.copy(this.secret) : Promise.resolve(false);\n }\n\n override render() {\n const copied = this.clipboard.copied;\n const meta = (label: string, value: string) =>\n value ? html`<div><dt>${label}</dt><dd>${value}</dd></div>` : nothing;\n return html`<p data-slot=\"secret-title\">${this.titleText || \"Can't scan?\"}</p>\n <div ${InputGroup.part()}>\n ${inputGroupInput({\n id: this.inputId,\n value: this.secret,\n readonly: true,\n attrs: { \"aria-label\": this.secretLabel || \"Manual secret\", spellcheck: \"false\", \"data-secret\": true },\n })}\n <div ${InputGroupAddon.part({ \"data-align\": \"inline-end\" })}>\n ${inputGroupButton(\n {\n size: \"icon-xs\",\n disabled: this.disabled || !this.secret,\n attrs: { \"aria-label\": this.copyLabel || \"Copy secret\", \"aria-controls\": this.inputId },\n onClick: () => void this.copy(),\n },\n copied ? icons.check() : icons.copy(),\n )}\n </div>\n </div>\n <span data-slot=\"secret-copied\" role=\"status\">${copied ? this.copiedText || \"Copied!\" : \"\"}</span>\n ${this.issuer || this.account\n ? html`<dl data-slot=\"secret-metadata\">\n ${meta(this.issuerLabel || \"Issuer\", this.issuer)}${meta(this.accountLabel || \"Account\", this.account)}\n </dl>`\n : nothing}`;\n }\n}\n\ndefine(\"pont2-secret\", Secret);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-secret\": Secret;\n }\n}\n","import { html, nothing, svg, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport QRCode from \"qrcode\";\n\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\n\nexport const QR_ERROR_CORRECTIONS = [\"L\", \"M\", \"Q\", \"H\"] as const;\nexport type QrErrorCorrection = (typeof QR_ERROR_CORRECTIONS)[number];\n\n/** Quiet zone, in modules, around the code (the QR spec asks for 4). */\nconst QUIET = 4;\n\n/**\n * One SVG path covering every dark module of `text`'s QR code, plus the\n * code's size. `null` when the text cannot be encoded.\n */\nexport function qrPath(text: string, level: QrErrorCorrection): { d: string; size: number } | null {\n if (!text) return null;\n try {\n const { modules } = QRCode.create(text, { errorCorrectionLevel: level });\n const n = modules.size;\n let d = \"\";\n for (let y = 0; y < n; y++) {\n for (let x = 0; x < n; x++) {\n if (modules.data[y * n + x]) d += `M${x + QUIET} ${y + QUIET}h1v1h-1z`;\n }\n }\n return { d, size: n + QUIET * 2 };\n } catch {\n return null;\n }\n}\n\nexport interface QrDetail {\n url: string;\n}\n\n/**\n * # `<pont2-qr-code>`: the authenticator-app enrolment QR code\n *\n * ```html\n * <pont2-qr-code url=\"otpauth://totp/Acme:ada@example.com?secret=…&issuer=Acme\" timeout=\"30\"></pont2-qr-code>\n * ```\n *\n * ```html\n * <pont2-qr-code data-pont2-qr-code data-slot=\"qr-code\" [data-obscured]>\n * <svg data-slot=\"qr-code-image\" role=\"img\" aria-label=\"QR code\" viewBox=\"0 0 37 37\">\n * <rect …white…/><path d=\"M4 4h1v1h-1z…\"/>\n * </svg>\n * <div data-slot=\"qr-code-overlay\"> (when obscured)\n * <button data-pont2-button type=\"button\">Show QR code</button>\n * </div>\n * </pont2-qr-code>\n * ```\n *\n * **An SVG built from the code's modules** (`qrcode`'s `create()` matrix →\n * one `<path>`), not a canvas: crisp at any size and zoom, no pixel-ratio\n * maths, nothing injected as markup. Always dark-on-white with the\n * 4-module quiet zone, whatever the theme: inverted codes do not scan\n * everywhere.\n *\n * **Obscured after `timeout` seconds** (it encodes the TOTP secret): the\n * code fades and a \"Show QR code\" button brings it back for another\n * `timeout`. `timeout=\"0\"` never obscures.\n *\n * @tag pont2-qr-code\n * @attr url - the text to encode (an `otpauth://` URI)\n * @attr timeout - seconds before obscuring (default 10)\n * @attr error-correction - L | M (default) | Q | H\n * @attr label - accessible name of the image (default \"QR code\")\n * @attr reveal-label - the button text (default \"Show QR code\")\n * @attr disabled - never obscures, and disables the button\n * @cssprop --pont2-qr-code-width - the image width (default 12rem)\n * @fires pont2-qr-obscured, pont2-qr-revealed - `{ url }`\n * @fires pont2-qr-error - `{ url }` when the text cannot be encoded\n */\nexport class QrCode extends HostElement {\n static override identity = \"qr-code\";\n static override slotName = \"qr-code\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n url: { type: String },\n timeout: { type: Number },\n errorCorrection: { type: String, attribute: \"error-correction\" },\n label: { type: String },\n revealLabel: { type: String, attribute: \"reveal-label\" },\n disabled: { type: Boolean, reflect: true },\n obscured: { state: true },\n };\n\n declare url: string;\n declare timeout: number;\n declare errorCorrection: QrErrorCorrection;\n declare label: string;\n declare revealLabel: string;\n declare disabled: boolean;\n declare obscured: boolean;\n\n private timer: ReturnType<typeof setTimeout> | undefined;\n private path: ReturnType<typeof qrPath> = null;\n\n constructor() {\n super();\n this.url = \"\";\n this.timeout = 10;\n this.errorCorrection = \"M\";\n this.label = \"\";\n this.revealLabel = \"\";\n this.disabled = false;\n this.obscured = false;\n }\n\n /** Shows the code again and restarts the timeout. */\n reveal(): void {\n this.obscured = false;\n this.startTimer();\n }\n\n private startTimer(): void {\n if (this.timer !== undefined) clearTimeout(this.timer);\n this.timer = undefined;\n if (!(this.timeout > 0) || this.disabled) return;\n this.timer = setTimeout(() => {\n this.timer = undefined;\n this.obscured = true;\n fire<QrDetail>(this, \"pont2-qr-obscured\", { url: this.url });\n }, this.timeout * 1000);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.startTimer();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.timer !== undefined) clearTimeout(this.timer);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"url\") || changed.has(\"errorCorrection\")) {\n this.path = qrPath(this.url, this.errorCorrection || \"M\");\n if (this.url && !this.path) fire<QrDetail>(this, \"pont2-qr-error\", { url: this.url });\n if (this.hasUpdated) this.reveal();\n } else if ((changed.has(\"timeout\") || changed.has(\"disabled\")) && this.hasUpdated) {\n this.reveal();\n }\n this.setData(\"obscured\", this.obscured && !this.disabled);\n }\n\n private onReveal = () => {\n this.reveal();\n fire<QrDetail>(this, \"pont2-qr-revealed\", { url: this.url });\n };\n\n override render() {\n const p = this.path;\n if (!p) return nothing;\n const obscured = this.obscured && !this.disabled;\n return html`<svg\n data-slot=\"qr-code-image\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 ${p.size} ${p.size}\"\n shape-rendering=\"crispEdges\"\n role=\"img\"\n aria-label=${this.label || \"QR code\"}\n aria-hidden=${obscured ? \"true\" : nothing}\n >${svg`<rect width=\"${p.size}\" height=\"${p.size}\" fill=\"#fff\" /><path d=\"${p.d}\" fill=\"#000\" />`}</svg\n >${obscured\n ? html`<div data-slot=\"qr-code-overlay\">\n ${button(\n { variant: \"default\", slot: \"qr-code-reveal\", onClick: this.onReveal },\n this.revealLabel || \"Show QR code\",\n )}\n </div>`\n : nothing}`;\n }\n}\n\ndefine(\"pont2-qr-code\", QrCode);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-qr-code\": QrCode;\n }\n interface HTMLElementEventMap {\n \"pont2-qr-obscured\": CustomEvent<QrDetail>;\n \"pont2-qr-revealed\": CustomEvent<QrDetail>;\n \"pont2-qr-error\": CustomEvent<QrDetail>;\n }\n}\n","import { html, type PropertyDeclarations } from \"lit\";\n\nimport { parseList } from \"../../core/attrs\";\nimport { CopyController } from \"../../core/controllers/copy\";\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\n\n/** `codes` attribute: JSON array, or whitespace/comma separated. */\nconst codesConverter = {\n fromAttribute: (v: string | null): string[] => parseList(v),\n};\n\n/**\n * # `<pont2-recovery-codes>`: one-time recovery codes after MFA enrolment\n *\n * ```html\n * <pont2-recovery-codes codes='[\"a1b2-c3d4\",\"e5f6-g7h8\"]'></pont2-recovery-codes>\n * ```\n *\n * ```html\n * <pont2-recovery-codes data-pont2-recovery-codes data-slot=\"recovery-codes\">\n * <p data-slot=\"recovery-codes-title\">Recovery codes</p>\n * <p data-slot=\"recovery-codes-description\">Use these codes if you lose access…</p>\n * <ul data-slot=\"recovery-codes-list\"><li>a1b2-c3d4</li>…</ul>\n * <div data-slot=\"recovery-codes-actions\">\n * <button data-pont2-button data-variant=\"outline\">Copy codes</button>\n * <button data-pont2-button data-variant=\"outline\">Download codes</button>\n * </div>\n * <span data-slot=\"recovery-codes-copied\" role=\"status\">Copied!</span>\n * </pont2-recovery-codes>\n * ```\n *\n * Buttons are the button primitive's parts, the list is a monospace grid,\n * \"Copied!\" is announced (`role=\"status\"`). Events carry **no codes**\n * (`pont2-copied` / `pont2-copy-error` with `{ kind: \"recovery-codes\" }`,\n * `pont2-recovery-codes-downloaded`); the legacy events included them.\n *\n * @tag pont2-recovery-codes\n * @attr codes - JSON array or whitespace-separated list; `.codes` is an array\n * @attr title-text, description, empty-text, copy-label, download-label, copied-text - copy\n * @attr filename - download file name (default \"recovery-codes.txt\")\n * @attr disabled\n * @cssprop --pont2-recovery-codes-list-bg, --pont2-recovery-codes-list-radius - the code list's surface (default muted, radius-md)\n * @fires pont2-copied, pont2-copy-error, pont2-recovery-codes-downloaded\n */\nexport class RecoveryCodes extends HostElement {\n static override identity = \"recovery-codes\";\n static override slotName = \"recovery-codes\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n codes: { converter: codesConverter },\n titleText: { type: String, attribute: \"title-text\" },\n description: { type: String },\n emptyText: { type: String, attribute: \"empty-text\" },\n copyLabel: { type: String, attribute: \"copy-label\" },\n downloadLabel: { type: String, attribute: \"download-label\" },\n copiedText: { type: String, attribute: \"copied-text\" },\n filename: { type: String },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare codes: string[];\n declare titleText: string;\n declare description: string;\n declare emptyText: string;\n declare copyLabel: string;\n declare downloadLabel: string;\n declare copiedText: string;\n declare filename: string;\n declare disabled: boolean;\n\n protected readonly clipboard = new CopyController(this, \"recovery-codes\");\n\n constructor() {\n super();\n this.codes = [];\n this.titleText = \"\";\n this.description = \"\";\n this.emptyText = \"\";\n this.copyLabel = \"\";\n this.downloadLabel = \"\";\n this.copiedText = \"\";\n this.filename = \"\";\n this.disabled = false;\n }\n\n private get text(): string {\n return (this.codes ?? []).join(\"\\n\");\n }\n\n copy(): Promise<boolean> {\n return this.codes?.length && !this.disabled ? this.clipboard.copy(this.text) : Promise.resolve(false);\n }\n\n download(): void {\n if (!this.codes?.length || this.disabled) return;\n const url = URL.createObjectURL(new Blob([this.text], { type: \"text/plain\" }));\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = this.filename || \"recovery-codes.txt\";\n a.click();\n setTimeout(() => URL.revokeObjectURL(url));\n fire(this, \"pont2-recovery-codes-downloaded\", {});\n }\n\n override render() {\n const codes = this.codes ?? [];\n const off = this.disabled || !codes.length;\n return html`<p data-slot=\"recovery-codes-title\">${this.titleText || \"Recovery codes\"}</p>\n <p data-slot=\"recovery-codes-description\">\n ${this.description || \"Use these codes if you lose access to your authenticator app.\"}\n </p>\n ${codes.length\n ? html`<ul data-slot=\"recovery-codes-list\">${codes.map(c => html`<li>${c}</li>`)}</ul>`\n : html`<p data-slot=\"recovery-codes-empty\">${this.emptyText || \"No recovery codes available.\"}</p>`}\n <div data-slot=\"recovery-codes-actions\">\n ${button(\n { variant: \"outline\", disabled: off, onClick: () => void this.copy() },\n html`${this.clipboard.copied ? icons.check({ \"data-icon\": \"inline-start\" }) : icons.copy({ \"data-icon\": \"inline-start\" })}${this.copyLabel || \"Copy codes\"}`,\n )}\n ${button(\n { variant: \"outline\", disabled: off, onClick: () => this.download() },\n html`${icons.download({ \"data-icon\": \"inline-start\" })}${this.downloadLabel || \"Download codes\"}`,\n )}\n </div>\n <span data-slot=\"recovery-codes-copied\" role=\"status\"\n >${this.clipboard.copied ? this.copiedText || \"Copied!\" : \"\"}</span\n >`;\n }\n}\n\ndefine(\"pont2-recovery-codes\", RecoveryCodes);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-recovery-codes\": RecoveryCodes;\n }\n interface HTMLElementEventMap {\n \"pont2-recovery-codes-downloaded\": CustomEvent<Record<string, never>>;\n }\n}\n","/**\n * Pure value logic of the scope list (ported from the legacy\n * scope-list.value.ts, which has the same tests).\n */\nexport interface ConsentScope {\n scope: string;\n label: string;\n granted?: boolean;\n required?: boolean;\n}\n\n/** Drops malformed and duplicate entries; trims names; label defaults to the scope. */\nexport function normalizeScopes(scopes: unknown): ConsentScope[] {\n if (!Array.isArray(scopes)) return [];\n const seen = new Set<string>();\n return scopes.flatMap(s => {\n if (!s || typeof s !== \"object\") return [];\n const { scope, label, granted, required } = s as Record<string, unknown>;\n if (typeof scope !== \"string\" || !scope.trim()) return [];\n const name = scope.trim();\n if (seen.has(name)) return [];\n seen.add(name);\n return [{ scope: name, label: typeof label === \"string\" && label ? label : name, granted: granted === true, required: required === true }];\n });\n}\n\n/** Required scopes are always ticked; others unless the user unticked them. */\nexport function isScopeChecked(scope: ConsentScope, unticked: ReadonlySet<string>): boolean {\n return !!scope.required || !unticked.has(scope.scope);\n}\n\n/** The submitted value: ticked scope names, space-separated (OAuth `scope` syntax). */\nexport function scopeListValue(scopes: ConsentScope[], unticked: ReadonlySet<string>): string {\n return Array.from(new Set(scopes.filter(s => isScopeChecked(s, unticked)).map(s => s.scope))).join(\" \");\n}\n","import { html, type PropertyDeclarations } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\n\nimport { FormControlElement } from \"../../core/form-control\";\nimport { define } from \"../../core/names\";\nimport type { Checkbox } from \"../../primitives/checkbox/checkbox\";\nimport { isScopeChecked, normalizeScopes, scopeListValue, type ConsentScope } from \"./scope-value\";\n\nexport { isScopeChecked, normalizeScopes, scopeListValue, type ConsentScope } from \"./scope-value\";\n\nconst scopesConverter = {\n fromAttribute: (v: string | null): ConsentScope[] => {\n try {\n return normalizeScopes(JSON.parse(v ?? \"[]\"));\n } catch {\n return [];\n }\n },\n};\n\n/**\n * # `<pont2-scope-list>`: OAuth consent scopes\n *\n * ```html\n * <form>\n * <pont2-scope-list name=\"scope\"\n * scopes='[{\"scope\":\"openid\",\"label\":\"Sign you in\",\"required\":true},{\"scope\":\"email\",\"label\":\"See your email\"}]'>\n * </pont2-scope-list>\n * </form>\n * → FormData: scope=openid email\n * ```\n *\n * ```html\n * <pont2-scope-list data-pont2-scope-list data-slot=\"scope-list\" role=\"list\">\n * <div role=\"listitem\" data-slot=\"scope-list-item\" data-scope=\"openid\" data-required>\n * <label data-slot=\"scope-list-label\">\n * <pont2-prim-checkbox checked disabled required></pont2-prim-checkbox>\n * <span data-slot=\"scope-list-text\">Sign you in</span>\n * </label>\n * </div>\n * …\n * </pont2-scope-list>\n * ```\n *\n * **Form-associated** (`extends FormControlElement`): it submits the ticked\n * scopes, space-separated (OAuth `scope` syntax), under `name` (default\n * `scope`), resets, restores and follows `<fieldset disabled>` natively. The\n * legacy element exposed `.value` for its custom form to read.\n *\n * Each row is a **Checkbox primitive element** (it has behaviour) inside a\n * native `<label>`; the checkboxes have no `name`, so only the list submits.\n * Required scopes are always ticked and disabled. Scopes default to ticked;\n * the user unticks what they do not grant.\n *\n * @tag pont2-scope-list\n * @attr scopes - JSON array of `{ scope, label?, required?, granted? }`; `.scopes` is an array\n * @attr name - default \"scope\"\n * @attr disabled\n * @fires input, change - when a scope is toggled (read `.value`)\n */\nexport class ScopeList extends FormControlElement {\n static override identity = \"scope-list\";\n static override slotName = \"scope-list\";\n static override role = \"list\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n scopes: { converter: scopesConverter },\n unticked: { state: true },\n };\n\n declare scopes: ConsentScope[];\n declare protected unticked: Set<string>;\n\n constructor() {\n super();\n this.name = \"scope\";\n this.scopes = [];\n this.unticked = new Set();\n }\n\n /** The normalised scope list. */\n get list(): ConsentScope[] {\n return normalizeScopes(this.scopes);\n }\n\n /** The submitted value: ticked scopes, space-separated. */\n get value(): string {\n return scopeListValue(this.list, this.unticked);\n }\n\n protected override get hostFocusable(): boolean {\n return false; // the checkboxes are the tab stops\n }\n\n protected formValue(): string | null {\n return this.name ? this.value : null;\n }\n\n protected resetToDefault(): void {\n this.unticked = new Set();\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n const ticked = new Set(state.split(\" \"));\n this.unticked = new Set(this.list.filter(s => !ticked.has(s.scope)).map(s => s.scope));\n }\n\n private toggle(scope: string, e: Event): void {\n e.stopPropagation(); // the list's own input/change replace the checkbox's\n const next = new Set(this.unticked);\n if ((e.target as Checkbox).checked) next.delete(scope);\n else next.add(scope);\n this.unticked = next;\n // As native controls: `input` then `change`, from the list itself.\n this.dispatchEvent(new Event(\"input\", { bubbles: true, composed: true }));\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\n }\n\n override render() {\n return repeat(\n this.list,\n s => s.scope,\n s => html`<div\n role=\"listitem\"\n data-slot=\"scope-list-item\"\n data-scope=${s.scope}\n ?data-required=${s.required}\n ?data-granted=${s.granted}\n >\n <label data-slot=\"scope-list-label\">\n <pont2-prim-checkbox\n .checked=${isScopeChecked(s, this.unticked)}\n ?disabled=${this.isDisabled || s.required}\n ?required=${s.required}\n @input=${(e: Event) => e.stopPropagation()}\n @change=${(e: Event) => this.toggle(s.scope, e)}\n ></pont2-prim-checkbox>\n <span data-slot=\"scope-list-text\">${s.label}</span>\n </label>\n </div>`,\n );\n }\n}\n\ndefine(\"pont2-scope-list\", ScopeList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-scope-list\": ScopeList;\n }\n}\n","/**\n * Turning a failed flow request into words for the user: the legacy\n * `describeFlowError` (src/utils/flow-error.ts), ported (pont2 imports nothing\n * from the legacy kit), with the same English and the same message codes, so\n * a flow's localised `messages` (keyed by code) apply unchanged.\n */\n\nimport { KIT_MESSAGES_EN, msg as kitMsg, setMessages } from \"../../core/messages\";\n\nexport type FlowMessageCode =\n | \"connection_failed\"\n | \"too_many_attempts\"\n | \"server_error\"\n | \"instance_unavailable\"\n | \"generic_error\"\n | \"flow_ended\"\n | \"passkey_cancelled\"\n | \"start_again\"\n | \"continued_elsewhere_title\"\n | \"continued_elsewhere_subtitle\"\n | \"continue_here\";\n\n/** The flow codes' English (a subset of `KIT_MESSAGES_EN`, core/messages.ts). */\nexport const FLOW_MESSAGES_EN: Record<FlowMessageCode, string> = {\n connection_failed: KIT_MESSAGES_EN.connection_failed,\n too_many_attempts: KIT_MESSAGES_EN.too_many_attempts,\n server_error: KIT_MESSAGES_EN.server_error,\n instance_unavailable: KIT_MESSAGES_EN.instance_unavailable,\n generic_error: KIT_MESSAGES_EN.generic_error,\n flow_ended: KIT_MESSAGES_EN.flow_ended,\n passkey_cancelled: KIT_MESSAGES_EN.passkey_cancelled,\n start_again: KIT_MESSAGES_EN.start_again,\n continued_elsewhere_title: KIT_MESSAGES_EN.continued_elsewhere_title,\n continued_elsewhere_subtitle: KIT_MESSAGES_EN.continued_elsewhere_subtitle,\n continue_here: KIT_MESSAGES_EN.continue_here,\n};\n\nexport interface FlowErrorDescription {\n message: string;\n /** The flow is over (409): offer \"Start again\". */\n restartable: boolean;\n /** The instance has stopped: nothing will work, so offer nothing to retry. */\n unavailable?: boolean;\n}\n\nconst FLOW_ENDED_STATUS = 409;\n\n/**\n * A stopped instance (paused, or its owner's Pontive account paused, cancelled or\n * deleted) refuses everything it serves to end users with this one code and no\n * reason (pontive-spec 01, \"Who is told why\"; carry-over §6).\n */\nexport const INSTANCE_UNAVAILABLE = \"instance_unavailable\";\n\n/** Whether a failed call was refused because the instance has stopped (its own `code`, or its body's). */\nexport function isInstanceUnavailable(error: unknown): boolean {\n return readError(error).code === INSTANCE_UNAVAILABLE;\n}\n\n/**\n * Keeps the sentence a stopped instance was refused with. Once stopped, the page\n * can no longer ask for its text, so the auth service words the refusal itself\n * (in the page's language and the instance's copy). Kept in the message table,\n * it is what every widget says for the code from then on, including for\n * refusals from services that only send English.\n */\nexport function rememberUnavailable(sentence?: string): void {\n const text = sentence?.trim();\n if (text) setMessages({ [INSTANCE_UNAVAILABLE]: text });\n}\n\n/**\n * - a cancelled or timed-out WebAuthn prompt (`NotAllowedError` / `AbortError`) → passkey_cancelled\n * - `instance_unavailable` → the refusal's own sentence, kept for the page (rememberUnavailable); not restartable\n * - 409 → the server's sentence, else flow_ended; restartable\n * - no response at all (NETWORK_ERROR / TIMEOUT) → connection_failed\n * - 429 → too_many_attempts; ≥ 500 → server_error\n * - anything else → the server's sentence, else generic_error\n *\n * Text comes from `messages` when given (a set a caller holds), else the\n * page-wide message table (core/messages.ts), else English.\n */\nexport function describeFlowError(\n error: unknown,\n messages: Partial<Record<string, string>> = {},\n): FlowErrorDescription {\n const msg = (code: FlowMessageCode) => messages[code] || kitMsg(code);\n if (typeof DOMException !== \"undefined\" && error instanceof DOMException) {\n if (error.name === \"NotAllowedError\" || error.name === \"AbortError\") {\n return { message: msg(\"passkey_cancelled\"), restartable: false };\n }\n }\n const { status, code, message } = readError(error);\n if (code === INSTANCE_UNAVAILABLE) {\n rememberUnavailable(message);\n // The refusal's sentence wins over any set the caller held: it is the newest word.\n return { message: kitMsg(INSTANCE_UNAVAILABLE), restartable: false, unavailable: true };\n }\n if (status === FLOW_ENDED_STATUS) return { message: serverSentence(message) ?? msg(\"flow_ended\"), restartable: true };\n if (status === undefined && (code === \"NETWORK_ERROR\" || code === \"TIMEOUT\")) {\n return { message: msg(\"connection_failed\"), restartable: false };\n }\n if (status === 429) return { message: msg(\"too_many_attempts\"), restartable: false };\n if (status !== undefined && status >= 500) return { message: msg(\"server_error\"), restartable: false };\n return { message: serverSentence(message) ?? msg(\"generic_error\"), restartable: false };\n}\n\nfunction readError(error: unknown): { status?: number; code?: string; message?: string } {\n if (typeof error === \"string\") return { message: error };\n if (!error || typeof error !== \"object\") return {};\n const e = error as { status?: unknown; code?: unknown; message?: unknown; data?: { error?: { code?: unknown; message?: unknown } } };\n const nested = e.data?.error;\n return {\n status: typeof e.status === \"number\" ? e.status : undefined,\n code: typeof e.code === \"string\" ? e.code : typeof nested?.code === \"string\" ? nested.code : undefined,\n message: typeof e.message === \"string\" ? e.message : typeof nested?.message === \"string\" ? nested.message : undefined,\n };\n}\n\n/** A server message fit to show: a sentence, not \"HTTP 400\" or something with code in backticks. */\nfunction serverSentence(message?: string): string | undefined {\n const text = message?.trim();\n if (!text) return undefined;\n if (/^HTTP \\d{3}\\b/.test(text) || text.includes(\"`\")) return undefined;\n const sentence = text.charAt(0).toUpperCase() + text.slice(1);\n return /[.!?。!?]$/u.test(sentence) ? sentence : `${sentence}.`;\n}\n","import { ContextProvider } from \"@lit/context\";\nimport { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport type { ActionErrorDetail, ActionRequestDetail } from \"../../core/controllers/action\";\nimport { designModeContext } from \"../../core/design-mode\";\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { brandingContext, DEFAULT_BRANDING, type BrandingEntitlements } from \"../block/branding\";\nimport { describeFlowError } from \"./flow-error\";\n\nexport {\n describeFlowError,\n FLOW_MESSAGES_EN,\n INSTANCE_UNAVAILABLE,\n isInstanceUnavailable,\n rememberUnavailable,\n type FlowErrorDescription,\n type FlowMessageCode,\n} from \"./flow-error\";\n\n/**\n * What the layout needs from an auth client: one method. `Auth` from\n * `@pontive/oidc-client` satisfies it structurally, so pont2 never imports an\n * auth client (option (b), docs/kit/layout.md).\n */\nexport interface FlowClient {\n processLoginflowEvent(request: FlowEventRequest): Promise<FlowEventResponse>;\n}\n\nexport interface FlowEventRequest {\n event: string;\n data?: Record<string, unknown>;\n}\n\n/** The parts of the SDK's `ProcessEventResponse` the layout reads. */\nexport interface FlowEventResponse {\n state?: string;\n render_spec?: unknown;\n}\n\nexport interface UnregisteredElementDetail {\n tag: string;\n}\n\n/** FormData → the plain object the flow API takes (last value wins, files dropped). */\nexport function formDataToObject(fd: FormData | undefined | null): Record<string, unknown> | undefined {\n if (!fd) return undefined;\n const out: Record<string, unknown> = {};\n for (const [k, v] of fd.entries()) if (typeof v === \"string\") out[k] = v;\n return Object.keys(out).length ? out : undefined;\n}\n\nconst BANNER = \"data-flow-error\";\nconst reported = new Set<string>();\n/** One warning per page for an unanswered submission (onFormSubmit). */\nlet warnedUnanswered = false;\n\n/**\n * # `<pont2-layout>`: renders a flow screen and runs its requests\n *\n * ```ts\n * import { Auth } from \"@pontive/oidc-client\";\n * const layout = document.createElement(\"pont2-layout\");\n * layout.client = Auth; // anything with processLoginflowEvent()\n * layout.branding = response.branding; // the account's entitlements (fail closed)\n * layout.renderSpec = response.render_spec; // the server's HTML for the screen\n * ```\n *\n * ```html\n * <pont2-layout data-pont2-layout data-slot=\"layout\">\n * <form data-slot=\"layout-form\" aria-busy=\"false\">\n * …the render spec (e.g. <pont2-block>…</pont2-block>)…\n * </form>\n * </pont2-layout>\n * ```\n *\n * The **flow host** for one screen. It:\n *\n * 1. **renders the spec** (server HTML) inside one native `<form>`, upgrading\n * pont2 elements and reporting tags this bundle does not define\n * (`pont2-unregistered-element` on `document`, once per tag);\n * 2. **answers every `pont2-action`** from inside the screen (submit, provider,\n * passkey, link, OTP, resend, forgot, edit-identifier) with\n * `client.processLoginflowEvent({ event, data })`, where `data` is the\n * form's normalised FormData when the request carries one (submit, OTP\n * auto-submit); while a request is pending, another one joins it (no double\n * submit) and the form is `aria-busy`;\n * 3. **renders the next screen** when a response carries `render_spec`;\n * 4. **shows flow errors** (every `pont2-action-error` from inside) as an\n * error `pont2-alert` banner at the top of the screen, with \"Start again\"\n * (`pont2-layout-restart`) when the flow is over (409);\n * 5. **provides the branding entitlements** (`pont2:branding` context) to the\n * screen's block. Fails closed: without `branding`, the watermark shows.\n *\n * Trust boundary: the render spec is **server HTML** and is inserted as such\n * (as in the legacy `pont-layout`); everything a user types goes through\n * native inputs, never into markup. The spec must not contain its own\n * `<form>` (the layout's form is the one form).\n *\n * @tag pont2-layout\n * @prop client - `FlowClient` (e.g. the SDK's `Auth`). Without one, actions are not answered.\n * @prop renderSpec - the screen's HTML\n * @prop branding - `BrandingEntitlements` (attribute-less on purpose)\n * @prop messages - localised flow messages by code (the flow's `messages`)\n * @fires pont2-flow-response - `{ action, result }` after every successful request\n * @fires pont2-layout-restart - \"Start again\" pressed (the widget restarts the flow)\n * @fires pont2-unregistered-element - on `document`, `{ tag }`\n */\nexport class Layout extends HostElement {\n static override identity = \"layout\";\n static override slotName = \"layout\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n client: { attribute: false },\n renderSpec: { attribute: false },\n branding: { attribute: false },\n messages: { attribute: false },\n designMode: { type: Boolean, attribute: \"design-mode\", reflect: true },\n busy: { state: true },\n };\n\n declare client: FlowClient | undefined;\n declare renderSpec: string;\n declare branding: BrandingEntitlements;\n /**\n * The screen is on the designer's canvas: elements render representative examples of themselves\n * instead of their empty state (core/design-mode.ts). The dashboard's widget builder sets it.\n */\n declare designMode: boolean;\n declare messages: Partial<Record<string, string>>;\n declare protected busy: boolean;\n\n private provider = new ContextProvider(this, { context: brandingContext, initialValue: DEFAULT_BRANDING });\n private designProvider = new ContextProvider(this, { context: designModeContext, initialValue: false });\n private pending: Promise<FlowEventResponse> | null = null;\n\n constructor() {\n super();\n this.client = undefined;\n this.renderSpec = \"\";\n this.branding = DEFAULT_BRANDING;\n this.designMode = false;\n this.messages = {};\n this.busy = false;\n this.addEventListener(\"pont2-action\", e => this.onAction(e));\n this.addEventListener(\"pont2-action-error\", e => this.onError(e));\n }\n\n /** The layout's form (holds the screen). */\n get form(): HTMLFormElement | null {\n return this.querySelector(\":scope > form\");\n }\n\n /** Runs one flow request (what a `pont2-action` from inside triggers). */\n run(event: string, data?: Record<string, unknown>): Promise<FlowEventResponse> {\n const client = this.client;\n if (!client) return Promise.reject(new Error(\"pont2-layout has no client\"));\n if (this.pending) return this.pending;\n this.clearBanner();\n this.busy = true;\n // Synchronously, not on the next render: the request has started now.\n this.form?.setAttribute(\"aria-busy\", \"true\");\n // After the requesting button has become busy (it does so once its listener has answered).\n queueMicrotask(() => this.lockScreen());\n const request = client\n .processLoginflowEvent(data ? { event, data } : { event })\n .then(result => {\n if (typeof result?.render_spec === \"string\" && result.render_spec) this.renderSpec = result.render_spec;\n fire(this, \"pont2-flow-response\", { action: event, result });\n return result;\n })\n .finally(() => {\n this.unlockScreen();\n this.pending = null;\n this.busy = false;\n this.form?.setAttribute(\"aria-busy\", \"false\");\n });\n this.pending = request;\n return request;\n }\n\n /** The elements `lockScreen` disabled, to give back exactly those. */\n private locked: Array<HTMLElement & { disabled: boolean }> = [];\n\n /**\n * While a request runs, the screen's fields and its other buttons are disabled, as in the legacy\n * kit: nothing can be edited or pressed mid-request (migration tracker F-20, F-35). The button\n * that asked stays busy, focusably (it is not disabled). Elements already disabled are left\n * alone and stay disabled afterwards. The values were read before the request started, so\n * disabling the fields doesn't change what was sent.\n */\n private lockScreen(): void {\n const form = this.form;\n if (!form || !this.pending) return;\n for (const el of Array.from(form.querySelectorAll<HTMLElement>(\"*\"))) {\n if (!el.localName.startsWith(\"pont2-\") || !(\"disabled\" in el)) continue;\n const control = el as HTMLElement & { disabled: boolean; busy?: boolean };\n if (control.disabled || control.busy) continue;\n control.disabled = true;\n this.locked.push(control);\n }\n }\n\n private unlockScreen(): void {\n for (const el of this.locked) if (el.isConnected) el.disabled = false;\n this.locked = [];\n }\n\n private onAction(e: CustomEvent<ActionRequestDetail>): void {\n const { action, data } = e.detail;\n if (!action || !this.client) return;\n // A link with service=\"other\" is the app's, not the flow's (the legacy meaning): the layout\n // doesn't answer it, so the app can, through the same pont2-action (migration tracker F-16).\n if ((data as { service?: unknown } | undefined)?.service === \"other\") return;\n e.detail.respondWith(this.run(action, formDataToObject(data.formData as FormData | undefined)));\n }\n\n private onError(e: CustomEvent<ActionErrorDetail>): void {\n const { message, restartable } = describeFlowError(e.detail.error, this.messages);\n this.showError(message, restartable);\n }\n\n /**\n * Shows a flow error at the top of the screen (after its logo/header). It replaces any error\n * already there, the server's injected banner included (`pont2-alert[status=\"error\"]`), so the\n * screen holds one error at a time, as in the legacy kit (migration tracker F-21).\n */\n showError(message: string, restartable = false): void {\n const form = this.form;\n if (!form) return;\n this.clearBanner();\n form.querySelectorAll('pont2-alert[status=\"error\"]').forEach(el => el.remove());\n const alert = document.createElement(\"pont2-alert\");\n alert.setAttribute(\"status\", \"error\");\n alert.setAttribute(\"icon\", \"\");\n alert.setAttribute(\"description\", message);\n alert.setAttribute(BANNER, \"\");\n const banner: HTMLElement[] = [alert];\n if (restartable) {\n const shell = document.createElement(\"pont2-button\");\n shell.setAttribute(\"variant\", \"outline\");\n shell.setAttribute(BANNER, \"\");\n const b = document.createElement(\"button\");\n b.type = \"button\";\n b.textContent = this.messages.start_again || msg(\"start_again\");\n b.addEventListener(\"click\", () => fire(this, \"pont2-layout-restart\", {}));\n shell.append(b);\n banner.push(shell);\n }\n const block = form.querySelector(\":scope > pont2-block\");\n const parent = block ?? form;\n let anchor = parent.firstElementChild;\n while (anchor && /^pont2-(logo|header)$/.test(anchor.localName)) anchor = anchor.nextElementSibling;\n for (const el of banner) parent.insertBefore(el, anchor);\n }\n\n private clearBanner(): void {\n this.form?.querySelectorAll(`[${BANNER}]`).forEach(el => el.remove());\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"branding\")) this.provider.setValue(this.branding ?? DEFAULT_BRANDING);\n if (changed.has(\"designMode\")) this.designProvider.setValue(!!this.designMode);\n this.setData(\"busy\", this.busy);\n }\n\n protected override updated(changed: PropertyValues): void {\n const form = this.form;\n if (!form) return;\n form.setAttribute(\"aria-busy\", String(this.busy));\n if (changed.has(\"renderSpec\")) this.renderScreen(form);\n }\n\n private renderScreen(form: HTMLFormElement): void {\n form.innerHTML = this.renderSpec || \"\";\n for (const el of Array.from(form.querySelectorAll(\"*\"))) {\n if (!el.localName.includes(\"-\")) continue;\n if (customElements.get(el.localName)) customElements.upgrade(el);\n else if (!reported.has(el.localName)) {\n reported.add(el.localName);\n console.warn(`[pont2] <${el.localName}> is in the render spec but is not defined in this bundle.`);\n document.dispatchEvent(\n new CustomEvent<UnregisteredElementDetail>(\"pont2-unregistered-element\", { detail: { tag: el.localName } }),\n );\n }\n }\n }\n\n /**\n * The layout's form never submits natively. Every submission is either answered here (a\n * `pont2-action` the layout responds to, which prevents it) or it is a mistake: no `client`\n * yet, or a submit button without `event`. A native submission would then be a GET to the\n * current URL with every field, password included, in the query string. So whatever is left\n * unhandled is stopped here, at the form, after the submit buttons' own listeners have run.\n */\n private onFormSubmit = (e: SubmitEvent) => {\n if (e.defaultPrevented) return;\n e.preventDefault();\n if (!warnedUnanswered) {\n warnedUnanswered = true;\n console.warn(\n \"[pont2] a submission in <pont2-layout> was not answered (no client, or the submit button has no `event`). \" +\n \"Native submission is blocked.\",\n );\n }\n };\n\n override render() {\n // The form's children are the render spec, written by renderScreen(), never by this template.\n return html`<form data-slot=\"layout-form\" @submit=${this.onFormSubmit}></form>`;\n }\n}\n\ndefine(\"pont2-layout\", Layout);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-layout\": Layout;\n }\n interface HTMLElementEventMap {\n \"pont2-flow-response\": CustomEvent<{ action: string; result: FlowEventResponse }>;\n \"pont2-layout-restart\": CustomEvent<Record<string, never>>;\n }\n interface DocumentEventMap {\n \"pont2-unregistered-element\": CustomEvent<UnregisteredElementDetail>;\n }\n}\n","/**\n * The consent screen's two calls to auth-api (pontive-spec 40 §4.3), ported\n * from the legacy `pont-consent` (carry-over §8).\n *\n * Plain `fetch` rather than the auth SDK: the screen is not an auth flow. The\n * person already has a session, and the session cookie is what proves the\n * consent request is theirs, so every call is same-origin and carries it.\n *\n * GET {base}/auth/v1/consent/{id}?locales=… → { render_spec, locale?, dir? }\n * POST {base}/auth/v1/consent/{id} { event, data } → { redirect_to } | a view to render\n *\n * Errors use the platform envelope `{ error: { code, message } }` (or flat).\n * A 404 means the request expired, was already answered, or isn't this\n * session's; the server doesn't say which, and the way on is the same.\n */\n\nimport { msg } from \"../../core/messages\";\n\n/** What `GET /auth/v1/consent/{id}` answers, and a re-rendered screen. */\nexport interface ConsentView {\n render_spec: string;\n locale?: string;\n dir?: string;\n}\n\n/** What `POST /auth/v1/consent/{id}` answers. */\nexport type ConsentOutcome = { redirect_to: string } | ConsentView;\n\n/** A refused or failed consent call, shaped as `describeFlowError` reads one (`status`, `code`, `message`). */\nexport class ConsentError extends Error {\n constructor(\n message: string,\n readonly code: string,\n readonly status?: number,\n ) {\n super(message);\n this.name = \"ConsentError\";\n }\n}\n\n/** The person-facing sentence for an expired request (a 404). */\nexport const CONSENT_EXPIRED_EN = \"This request has expired. Go back to the app and try again.\";\n\n/** `consent_expired` from the page's message table, else English. */\nexport const consentExpired = () => msg(\"consent_expired\", CONSENT_EXPIRED_EN);\n\nexport function consentEndpoint(baseUrl: string, id: string): string {\n return `${baseUrl.replace(/\\/+$/, \"\")}/auth/v1/consent/${encodeURIComponent(id)}`;\n}\n\n/** Loads the screen for a consent request. */\nexport async function fetchConsent(baseUrl: string, id: string, options: { locales?: string } = {}): Promise<ConsentView> {\n const query = options.locales ? `?${new URLSearchParams({ locales: options.locales })}` : \"\";\n const body = await call(`${consentEndpoint(baseUrl, id)}${query}`, { method: \"GET\" });\n if (isView(body)) return body;\n throw new ConsentError(\"Unexpected consent response.\", \"UNEXPECTED_RESPONSE\");\n}\n\n/**\n * Answers a consent request: `allow` with the ticked scopes (`data.scope`, one\n * space-separated string, which auth-api requires), or `deny`. A 404 is reworded\n * as the expired-request sentence, so the layout's banner shows it as is.\n */\nexport async function submitConsent(\n baseUrl: string,\n id: string,\n event: string,\n data: Record<string, unknown> = {},\n): Promise<ConsentOutcome> {\n let body: unknown;\n try {\n body = await call(consentEndpoint(baseUrl, id), { method: \"POST\", body: JSON.stringify({ event, data }) });\n } catch (err) {\n if (err instanceof ConsentError && err.status === 404) throw new ConsentError(consentExpired(), err.code, err.status);\n throw err;\n }\n if (isObject(body) && typeof body.redirect_to === \"string\" && body.redirect_to) return { redirect_to: body.redirect_to };\n if (isView(body)) return body;\n throw new ConsentError(\"Unexpected consent response.\", \"UNEXPECTED_RESPONSE\");\n}\n\n/**\n * Whether the browser may be sent to a `redirect_to`. It is the app's\n * registered redirect URI, which may be a native app's custom scheme\n * (`com.example.app:/callback`), so this is not limited to http(s); it only\n * refuses the schemes that run code or read local data in this page.\n */\nexport function isNavigableRedirect(url: string, base = globalThis.location?.href): boolean {\n try {\n const { protocol } = new URL(url, base);\n return ![\"javascript:\", \"data:\", \"vbscript:\", \"blob:\", \"file:\"].includes(protocol);\n } catch {\n return false;\n }\n}\n\n/* ------------------------------------------------------------------ */\n\nasync function call(url: string, init: RequestInit): Promise<unknown> {\n let response: Response;\n try {\n response = await fetch(url, {\n ...init,\n credentials: \"same-origin\",\n headers: { Accept: \"application/json\", ...(init.body ? { \"Content-Type\": \"application/json\" } : {}) },\n });\n } catch (err) {\n throw new ConsentError(err instanceof Error ? err.message : String(err), \"NETWORK_ERROR\");\n }\n const body: unknown = await response.json().catch(() => undefined);\n if (!response.ok) {\n const flat = isObject(body) ? body : {};\n const envelope = isObject(flat.error) ? flat.error : {};\n const code = text(envelope.code) ?? text(flat.code) ?? \"API_ERROR\";\n const message = text(envelope.message) ?? text(flat.message) ?? `HTTP ${response.status}: ${response.statusText}`;\n throw new ConsentError(message, code, response.status);\n }\n return body;\n}\n\nfunction isView(body: unknown): body is ConsentView {\n return isObject(body) && typeof body.render_spec === \"string\";\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === \"string\" && value !== \"\" ? value : undefined;\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { Spinner } from \"../../primitives/spinner/spinner\";\nimport { DEFAULT_BRANDING, type BrandingEntitlements } from \"../block/branding\";\nimport { describeFlowError } from \"../layout/flow-error\";\nimport type { FlowClient, FlowEventRequest, FlowEventResponse, Layout } from \"../layout/layout\";\nimport \"../layout/layout\";\nimport { ConsentError, consentExpired, fetchConsent, isNavigableRedirect, submitConsent, type ConsentView } from \"./consent-api\";\n\nexport {\n CONSENT_EXPIRED_EN,\n ConsentError,\n consentEndpoint,\n consentExpired,\n fetchConsent,\n isNavigableRedirect,\n submitConsent,\n type ConsentOutcome,\n type ConsentView,\n} from \"./consent-api\";\n\n/**\n * # `<pont2-consent>`: an app asks for access; the person allows or denies\n *\n * ```html\n * <pont2-consent consent-request=\"cr_123\"></pont2-consent>\n * ```\n *\n * The OAuth consent screen (pontive-spec 40 §4.3), ported from the legacy\n * `pont-consent` (carry-over §8). **Not a flow widget:** the person already has\n * a session, so there is no flow to start and no SDK to wait for. The screen is\n * one consent request, which auth-api renders like a flow view (the built-in\n * `authorize_app` widget in the instance's brand and copy) and answers with a\n * redirect.\n *\n * It still renders through `pont2-layout`, with a consent-specific **client**,\n * so the markup, the error banner, the busy state and the branding entitlement\n * work as on every other screen:\n *\n * - **Load:** `GET {base-url}/auth/v1/consent/{consent-request}?locales=…`, same\n * origin with the session cookie (`fetchConsent`). The view's `locale` and\n * `dir` become the element's `lang` and `dir`.\n * - **Answer:** Allow and Deny are submit buttons naming the `allow` / `deny`\n * event; `pont2-scope-list` submits the ticked scopes as `scope`, one\n * space-separated string. The client posts `{ event, data }`\n * (`submitConsent`) and then either sends the browser to `redirect_to` (the\n * app's redirect URI, which may be a custom scheme; only code-running schemes\n * are refused) or renders the screen the server sent back.\n * - **Errors:** a request that expired, was already answered or isn't this\n * session's (404) says \"This request has expired. Go back to the app and try\n * again.\" (`consent_expired`) and offers nothing to retry. Any other failure\n * is worded by `describeFlowError` and offers \"Start again\", which reloads the\n * request.\n *\n * @tag pont2-consent\n * @attr consent-request - the consent request's id (the page's `consent_request` parameter)\n * @attr base-url - where auth-api is; empty (default) means same origin, which the session cookie needs\n * @attr locales - preferred languages, passed to the load (`?locales=`)\n * @prop branding - the account's branding entitlements (fail closed: the watermark shows)\n */\nexport class Consent extends HostElement {\n static override identity = \"consent\";\n\n static override properties: PropertyDeclarations = {\n consentRequest: { type: String, attribute: \"consent-request\" },\n baseUrl: { type: String, attribute: \"base-url\" },\n locales: { type: String },\n branding: { attribute: false },\n renderSpec: { state: true },\n loadError: { state: true },\n };\n\n declare consentRequest: string;\n declare baseUrl: string;\n declare locales: string;\n declare branding: BrandingEntitlements;\n declare protected renderSpec: string;\n declare protected loadError: { message: string; retryable: boolean } | null;\n\n protected readonly messagesController = new MessagesController(this);\n\n /** Bumped per load, so only the latest answer lands on the screen. */\n private loadSeq = 0;\n /** The request, server and languages last loaded: a change means load again. */\n private loadedKey: string | null = null;\n\n /**\n * What the layout calls for Allow / Deny. Stable for the element's lifetime:\n * the layout keeps it across screens.\n */\n readonly client: FlowClient = {\n processLoginflowEvent: (request: FlowEventRequest) => this.answer(request),\n };\n\n constructor() {\n super();\n this.consentRequest = \"\";\n this.baseUrl = \"\";\n this.locales = \"\";\n this.branding = DEFAULT_BRANDING;\n this.renderSpec = \"\";\n this.loadError = null;\n this.addEventListener(\"pont2-layout-restart\", () => void this.load());\n }\n\n /** The element's layout. */\n get layout(): Layout | null {\n return this.querySelector(\"pont2-layout\");\n }\n\n /** Loads (or reloads) the consent request. */\n async load(): Promise<void> {\n const seq = ++this.loadSeq;\n this.loadError = null;\n try {\n if (!this.consentRequest) throw new ConsentError(\"No consent request was given.\", \"MISSING_REQUEST\");\n const view = await fetchConsent(this.baseUrl, this.consentRequest, { locales: this.locales || undefined });\n if (seq === this.loadSeq) this.show(view);\n } catch (err) {\n if (seq !== this.loadSeq) return;\n console.error(`[pont2] <${this.localName}>: loading the consent request failed:`, err);\n const expired = (err as { status?: number })?.status === 404;\n const { message, unavailable } = describeFlowError(err);\n // An empty shell to show the error in. An expired request stays expired; a stopped instance stays stopped.\n this.renderSpec = \"<pont2-block></pont2-block>\";\n this.loadError = expired ? { message: consentExpired(), retryable: false } : { message, retryable: !unavailable };\n }\n }\n\n private show(view: ConsentView): void {\n if (view.locale) this.lang = view.locale;\n if (view.dir === \"rtl\" || view.dir === \"ltr\") this.dir = view.dir;\n this.renderSpec = view.render_spec;\n }\n\n private async answer({ event, data }: FlowEventRequest): Promise<FlowEventResponse> {\n const outcome = await submitConsent(this.baseUrl, this.consentRequest, event, data);\n if (\"redirect_to\" in outcome) {\n if (!isNavigableRedirect(outcome.redirect_to)) {\n throw new ConsentError(\"Unexpected consent response.\", \"UNSAFE_REDIRECT\");\n }\n location.assign(outcome.redirect_to);\n return {};\n }\n this.show(outcome);\n return { render_spec: outcome.render_spec };\n }\n\n protected override willUpdate(_changed: PropertyValues): void {\n this.setData(\"state\", this.loadError ? \"error\" : this.renderSpec ? \"screen\" : \"loading\");\n // First render, or a different request, server or language: load (again).\n const key = JSON.stringify([this.consentRequest, this.baseUrl, this.locales]);\n if (key !== this.loadedKey) {\n this.loadedKey = key;\n void this.load();\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n // The app's placeholder (`<… ><div part=\"fallback\">…</div></…>`, which the pontkit bindings\n // rely on) goes once there is a screen or an error to show (migration tracker F-17).\n if (this.renderSpec) this.querySelector(':scope > [part=\"fallback\"]')?.remove();\n if (changed.has(\"loadError\") && this.loadError) {\n const { message, retryable } = this.loadError;\n const layout = this.layout;\n void layout?.updateComplete.then(() => layout.showError(message, retryable));\n }\n }\n\n override render() {\n if (!this.renderSpec) {\n // The app's own placeholder stands in for the spinner while it is there.\n if (this.querySelector(':scope > [part=\"fallback\"]')) return nothing;\n return html`<div data-slot=\"flow-widget-loading\">\n <span ${Spinner.part({ \"aria-label\": msg(\"loading\") })}></span>\n </div>`;\n }\n return html`<pont2-layout .client=${this.client} .branding=${this.branding} .renderSpec=${this.renderSpec}></pont2-layout>`;\n }\n}\n\ndefine(\"pont2-consent\", Consent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-consent\": Consent;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { MessagesController, msg, setMessages } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { Spinner } from \"../../primitives/spinner/spinner\";\nimport { DEFAULT_BRANDING, type BrandingEntitlements } from \"../block/branding\";\nimport { describeFlowError, type FlowMessageCode } from \"../layout/flow-error\";\nimport type { FlowClient, Layout } from \"../layout/layout\";\nimport \"../layout/layout\";\n\n/**\n * What a widget needs from an auth client: the layout's `processLoginflowEvent`\n * plus `startLoginflow`, and optionally `whenConfigured`. The SDK's `Auth`\n * satisfies it structurally (docs/kit/layout.md, option (b)).\n */\nexport interface WidgetClient extends FlowClient {\n startLoginflow(flowId?: string): Promise<FlowStart>;\n whenConfigured?(): Promise<void>;\n}\n\n/** The parts of the SDK's `StartLoginflowResponse` a widget reads. */\nexport interface FlowStart {\n render_spec?: unknown;\n messages?: Record<string, string>;\n}\n\n/** The parts of the SDK's `FlowStateChangeEvent` a widget reads. */\nexport interface FlowStateEvent {\n eventType: string;\n flowType?: string;\n render_spec?: unknown;\n messages?: Record<string, string>;\n}\n\n/**\n * Feeds the SDK's asynchronous flow-state changes (a resumed flow, a flow an\n * emailed link continued, \"continued in another tab\") to every connected\n * pont2 flow widget of that `flowType`.\n *\n * The SDK reports them only through the one `onFlowStateChange` callback of\n * `Auth.configure()` (which replaces the whole configuration), so the widget\n * cannot subscribe by itself; the app that configures `Auth` passes this:\n *\n * ```ts\n * Auth.configure({ …config, onFlowStateChange: dispatchFlowState });\n * ```\n */\nexport function dispatchFlowState(event: FlowStateEvent): void {\n document.dispatchEvent(new CustomEvent<FlowStateEvent>(\"pont2-flow-state\", { detail: event }));\n}\n\n/** Text placed in a double-quoted attribute of markup built as a string. */\nexport function escapeAttr(value: string): string {\n return value.replace(/&/g, \"&\").replace(/\"/g, \""\").replace(/</g, \"<\").replace(/>/g, \">\");\n}\n\n/** How long to wait for `client.whenConfigured()` before warning and trying anyway. */\nconst CONFIGURE_TIMEOUT = 5000;\n\n/**\n * # FlowWidget: the base of `<pont2-signin>` / `<pont2-signup>`\n *\n * ```ts\n * import { Auth } from \"@pontive/oidc-client\";\n * import { dispatchFlowState } from \"@pontive/pontkit-core/pont2\";\n *\n * Auth.configure({ …, onFlowStateChange: dispatchFlowState });\n * document.querySelector(\"pont2-signin\")!.client = Auth;\n * ```\n *\n * ```html\n * <pont2-signin data-pont2-flow-widget data-slot=\"flow-widget\" data-state=\"screen\">\n * <pont2-layout>…the current screen…</pont2-layout>\n * </pont2-signin>\n * ```\n *\n * It **starts the flow** (`client.startLoginflow(flowId)`, after\n * `client.whenConfigured()` when the client has one), renders **one\n * `pont2-layout`** with the screen, the client, the branding entitlements and\n * the flow's localised messages, and keeps it current:\n *\n * - each request's next screen is rendered by the layout itself;\n * - asynchronous changes arrive through `dispatchFlowState` (see above): a new\n * `render_spec`, new `messages`, or `flow_continued_elsewhere`, which shows\n * \"You continued in another tab\" with a \"Continue here instead\" link\n * (`continue_here`, handled by the SDK);\n * - \"Start again\" in the layout (`pont2-layout-restart`), or `restart()`,\n * starts the flow over;\n * - a flow that fails to start shows the error in the layout, restartable.\n *\n * Until the first screen arrives it shows a spinner (`data-state=\"loading\"`).\n *\n * Nesting `pont2-layout` in a kit template is the allow-listed case (docs/10\n * §5 rule 6): the layout is the stateful flow host, one per widget.\n *\n * @prop client - `WidgetClient` (e.g. the SDK's `Auth`); the flow starts once it is set and the widget is connected\n * @prop branding - `BrandingEntitlements` from the backend (attribute-less; fails closed)\n * @attr flow-id - the flow to start (each widget has a default)\n * @fires pont2-flow-response - (from the layout) after every successful request\n */\nexport abstract class FlowWidget extends HostElement {\n static override identity = \"flow-widget\";\n static override slotName = \"flow-widget\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n client: { attribute: false },\n branding: { attribute: false },\n flowId: { type: String, attribute: \"flow-id\" },\n renderSpec: { state: true },\n messages: { state: true },\n starting: { state: true },\n startError: { state: true },\n };\n\n declare client: WidgetClient | undefined;\n declare branding: BrandingEntitlements;\n declare flowId: string;\n declare protected renderSpec: string;\n declare protected messages: Partial<Record<string, string>>;\n declare protected starting: boolean;\n declare protected startError: { message: string; restartable: boolean } | null;\n /** Re-renders when the page's message table changes (the loading label). */\n protected readonly messagesController = new MessagesController(this);\n\n /** The SDK's `flowType` this widget runs (\"signin\", \"signup\"): which flow-state events apply. */\n protected abstract readonly flowType: string;\n\n private started = false;\n\n constructor() {\n super();\n this.client = undefined;\n this.branding = DEFAULT_BRANDING;\n this.flowId = \"\";\n this.renderSpec = \"\";\n this.messages = {};\n this.starting = false;\n this.startError = null;\n this.addEventListener(\"pont2-layout-restart\", () => void this.restart());\n }\n\n /** The widget's layout. */\n get layout(): Layout | null {\n return this.querySelector(\"pont2-layout\");\n }\n\n /** Starts the flow over. */\n async restart(): Promise<void> {\n this.started = false;\n await this.start();\n }\n\n /** Applies an SDK flow-state change (what `dispatchFlowState` delivers). */\n applyFlowState(event: FlowStateEvent): void {\n if (event.flowType && event.flowType !== this.flowType) return;\n if (event.messages) this.receiveMessages(event.messages);\n if (event.eventType === \"flow_continued_elsewhere\") {\n this.startError = null;\n this.renderSpec = this.continuedElsewhereSpec();\n return;\n }\n if (typeof event.render_spec === \"string\" && event.render_spec) {\n this.startError = null;\n this.renderSpec = event.render_spec;\n }\n }\n\n /** A set the flow sent: this widget's, and the page's message table (core/messages.ts). */\n private receiveMessages(messages: Record<string, string>): void {\n this.messages = { ...messages };\n setMessages(messages);\n }\n\n private msg(code: FlowMessageCode): string {\n return this.messages[code] || msg(code);\n }\n\n private continuedElsewhereSpec(): string {\n return `<pont2-block>\n <pont2-header>\n <pont2-title content=\"${escapeAttr(this.msg(\"continued_elsewhere_title\"))}\"></pont2-title>\n <pont2-subtitle content=\"${escapeAttr(this.msg(\"continued_elsewhere_subtitle\"))}\"></pont2-subtitle>\n </pont2-header>\n <pont2-link label=\"${escapeAttr(this.msg(\"continue_here\"))}\" event=\"continue_here\"></pont2-link>\n</pont2-block>`;\n }\n\n private onFlowState = (e: Event) => this.applyFlowState((e as CustomEvent<FlowStateEvent>).detail);\n\n override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener(\"pont2-flow-state\", this.onFlowState);\n void this.start();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"pont2-flow-state\", this.onFlowState);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n this.setData(\"state\", this.startError ? \"error\" : this.renderSpec ? \"screen\" : \"loading\");\n // Only a newly set client starts the flow; a failed start waits for \"Start again\"\n // (re-renders must never retry on their own).\n if (changed.has(\"client\") && this.client && this.isConnected && !this.started) void this.start();\n }\n\n protected override updated(changed: PropertyValues): void {\n // The app's placeholder (`<… ><div part=\"fallback\">…</div></…>`, which the pontkit bindings\n // rely on) goes once there is a screen or an error to show (migration tracker F-17).\n if (this.renderSpec) this.querySelector(':scope > [part=\"fallback\"]')?.remove();\n // The layout renders its form on its own update; show the error once it has.\n if (changed.has(\"startError\") && this.startError) {\n const { message, restartable } = this.startError;\n const layout = this.layout;\n // \"Start again\", unless the instance has stopped: starting again would only be refused again.\n void layout?.updateComplete.then(() => layout.showError(message, restartable));\n }\n }\n\n private async start(): Promise<void> {\n const client = this.client;\n if (!client || this.started) return;\n this.started = true;\n this.starting = true;\n this.startError = null;\n try {\n if (client.whenConfigured) {\n const configured = await Promise.race([\n client.whenConfigured().then(() => true),\n new Promise<false>(r => setTimeout(() => r(false), CONFIGURE_TIMEOUT)),\n ]);\n if (!configured) console.warn(`[pont2] <${this.localName}>: the client is not configured after ${CONFIGURE_TIMEOUT}ms.`);\n }\n const flowId = this.flowId || this.defaultFlowId();\n // No id at all (an invitation): the SDK picks the flow from the page's path.\n const res = await (flowId ? client.startLoginflow(flowId) : client.startLoginflow());\n if (res?.messages) this.receiveMessages(res.messages);\n if (typeof res?.render_spec === \"string\") this.renderSpec = res.render_spec;\n } catch (err) {\n console.error(`[pont2] <${this.localName}>: starting the flow failed:`, err);\n this.started = false;\n // An empty shell to show the error in, with \"Start again\" (restartable).\n this.renderSpec = \"<pont2-block></pont2-block>\";\n const { message, unavailable } = describeFlowError(err, this.messages);\n this.startError = { message, restartable: !unavailable };\n } finally {\n this.starting = false;\n }\n }\n\n /** The flow id used when `flow-id` is not set; `undefined` lets the SDK choose (an invitation). */\n protected abstract defaultFlowId(): string | undefined;\n\n override render() {\n if (!this.renderSpec) {\n // The app's own placeholder stands in for the spinner while it is there.\n if (this.querySelector(':scope > [part=\"fallback\"]')) return nothing;\n return html`<div data-slot=\"flow-widget-loading\">\n <span ${Spinner.part({ \"aria-label\": msg(\"loading\") })}></span>\n </div>`;\n }\n return html`<pont2-layout\n .client=${this.client}\n .branding=${this.branding}\n .messages=${this.messages}\n .renderSpec=${this.renderSpec}\n ></pont2-layout>`;\n }\n}\n\n/**\n * # `<pont2-signin>`: the sign-in widget\n *\n * Runs `sys_signin-flow-passkey` (the legacy default) unless `flow-id` says otherwise.\n *\n * @tag pont2-signin\n */\nexport class SignIn extends FlowWidget {\n protected readonly flowType = \"signin\";\n protected defaultFlowId() {\n return \"sys_signin-flow-passkey\";\n }\n}\n\n/**\n * # `<pont2-signup>`: the sign-up widget\n *\n * Runs `sys_signup-flow` (the legacy default) unless `flow-id` says otherwise.\n *\n * @tag pont2-signup\n */\nexport class SignUp extends FlowWidget {\n protected readonly flowType = \"signup\";\n protected defaultFlowId() {\n return \"sys_signup-flow\";\n }\n}\n\n/**\n * # `<pont2-invitation>`: accepting an invitation\n *\n * The invitee arrives from an emailed link holding a token and nothing else.\n * They aren't asked who they are, since the invitation already knows: the widget\n * starts the **invitation flow**, which resolves the token, decides whether the\n * invitee signs in or registers, and accepts the invitation once they are\n * authenticated. A port of the legacy `pont-invitation` (migration tracker W-4).\n *\n * It starts with **no flow id**: the SDK takes the invitation flow from the\n * page's path, so the app names that path as `invitationUrl` when it configures\n * the SDK (the legacy provider's `env.invitationUrl`; `<pont2-provider>` will\n * do it, W-1). An invitation answered by the sign-in flow would sign the invitee\n * in and join them to nothing, which is why this is its own element. The page\n * should also drop an existing session before the flow (the legacy\n * `answersInvitation`; the provider's job, W-1).\n *\n * Everything on screen comes from the flow's render spec: the instance's own\n * invitation widgets if it published any, else the built-in ones.\n *\n * @tag pont2-invitation\n */\nexport class Invitation extends FlowWidget {\n protected readonly flowType = \"invitation\";\n protected defaultFlowId() {\n return undefined;\n }\n}\n\ndefine(\"pont2-signin\", SignIn);\ndefine(\"pont2-signup\", SignUp);\ndefine(\"pont2-invitation\", Invitation);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-signin\": SignIn;\n \"pont2-signup\": SignUp;\n \"pont2-invitation\": Invitation;\n }\n interface DocumentEventMap {\n \"pont2-flow-state\": CustomEvent<FlowStateEvent>;\n }\n}\n","/**\n * Previewing pont2 screens without a server: what the dashboard's branding\n * editor shows (docs/12-theming-integration.md §3).\n *\n * The backend does not emit pont2 render specs yet (docs/09 decision 2), so a\n * preview cannot ask a real flow for its screens. These sample screens are\n * written the way a render spec would write them, and between them they use\n * every auth element whose tokens a brand is likely to change.\n *\n * Preview inside a real `<pont2-signin>` / `<pont2-signup>`, not a bare\n * `pont2-layout`: widget-scope theme values (`widgets.signin` …) apply to the\n * widget's tag, so only a widget shows them.\n *\n * ```ts\n * import { previewClient, PREVIEW_SCREENS } from \"@pontive/pontkit-core/pont2\";\n *\n * const widget = document.querySelector(\"pont2-signin\")!;\n * widget.client = previewClient(PREVIEW_SCREENS.signin.spec);\n * // switching screens later:\n * widget.client = previewClient(PREVIEW_SCREENS.verify.spec);\n * void widget.restart();\n * ```\n *\n * Pure data and a plain object: no DOM, no Lit, no network.\n */\nimport type { FlowEventRequest, FlowEventResponse } from \"../layout/layout\";\nimport type { FlowStart, WidgetClient } from \"./flow-widget\";\n\nexport interface PreviewScreen {\n /** A name for a screen picker. */\n label: string;\n /** The widget to preview it in (its tag is `pont2-<flow>`). */\n flow: \"signin\" | \"signup\";\n /** The screen, as a render spec would write it. */\n spec: string;\n}\n\nconst signin = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Welcome back\"></pont2-title>\n <pont2-subtitle content=\"Sign in to your account\"></pont2-subtitle>\n </pont2-header>\n <pont2-provider-field providers=\"google apple github\"></pont2-provider-field>\n <pont2-divider label=\"Or continue with\"></pont2-divider>\n <pont2-identifier-field identifiers=\"email username\" required></pont2-identifier-field>\n <pont2-submit-button event=\"submit_identifier\" label=\"Continue\"></pont2-submit-button>\n <pont2-passkey-button content=\"icon-label\" event=\"passkey\"></pont2-passkey-button>\n <pont2-link prompt=\"Don't have an account?\" label=\"Sign up\" event=\"goto_signup\"></pont2-link>\n</pont2-block>`;\n\nconst password = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Enter your password\"></pont2-title>\n </pont2-header>\n <pont2-edit-identifier identifier=\"ada@example.com\" event=\"change_identifier\"></pont2-edit-identifier>\n <pont2-password-field required rules=\"[]\" forgot forgot-event=\"forgot_password\"></pont2-password-field>\n <pont2-submit-button event=\"submit_password\" label=\"Sign in\"></pont2-submit-button>\n</pont2-block>`;\n\nconst verify = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Check your email\"></pont2-title>\n <pont2-subtitle content=\"We sent a 6-digit code to ada@example.com\"></pont2-subtitle>\n </pont2-header>\n <pont2-alert status=\"info\" icon description=\"The code expires in 10 minutes.\"></pont2-alert>\n <pont2-container align=\"center\">\n <pont2-otp-field layout=\"simple\" required></pont2-otp-field>\n </pont2-container>\n <pont2-submit-button event=\"verify_code\" label=\"Verify\"></pont2-submit-button>\n <pont2-otp-resend duration=\"30\" event=\"resend_code\"></pont2-otp-resend>\n</pont2-block>`;\n\nconst signup = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Create an account\"></pont2-title>\n <pont2-subtitle content=\"It only takes a minute\"></pont2-subtitle>\n </pont2-header>\n <pont2-name-field required></pont2-name-field>\n <pont2-email-field required></pont2-email-field>\n <pont2-password-field required></pont2-password-field>\n <pont2-confirm-field required></pont2-confirm-field>\n <pont2-submit-button event=\"submit_signup\" label=\"Create account\"></pont2-submit-button>\n <pont2-link prompt=\"Already have an account?\" label=\"Sign in\" event=\"goto_signin\"></pont2-link>\n</pont2-block>`;\n\n/** Sample screens for a branding preview, keyed by id. */\nexport const PREVIEW_SCREENS = {\n signin: { label: \"Sign in\", flow: \"signin\", spec: signin },\n password: { label: \"Password\", flow: \"signin\", spec: password },\n verify: { label: \"Verification code\", flow: \"signin\", spec: verify },\n signup: { label: \"Sign up\", flow: \"signup\", spec: signup },\n} as const satisfies Record<string, PreviewScreen>;\n\nexport type PreviewScreenId = keyof typeof PREVIEW_SCREENS;\n\nexport interface PreviewClientOptions {\n /** How long each request stays busy, in ms, so busy states can be seen (default 600). */\n delay?: number;\n /** The flow's localised messages (flow errors, \"Start again\" …). */\n messages?: Record<string, string>;\n}\n\n/**\n * A `WidgetClient` that shows one screen and never leaves it. Every request\n * (a submit, a provider button, a link) is busy for `delay` ms and then\n * resolves without a new screen, so the screen and what was typed stay put.\n * Nothing is sent anywhere.\n */\nexport function previewClient(spec: string, options: PreviewClientOptions = {}): WidgetClient {\n const delay = options.delay ?? 600;\n const messages = { ...options.messages };\n return {\n async whenConfigured() {},\n async startLoginflow(): Promise<FlowStart> {\n return { render_spec: spec, messages };\n },\n processLoginflowEvent(_request: FlowEventRequest): Promise<FlowEventResponse> {\n return new Promise(resolve => setTimeout(() => resolve({ state: \"preview\" }), delay));\n },\n };\n}\n","/**\n * Preview specimens: one component at a time, for the dashboard's Component\n * scope (docs/14-dashboard-branding.md §\"Previews\").\n *\n * `PREVIEW_SCREENS` shows whole sign-in screens, which is right for the\n * Global scope. When the branding editor is open on one component (\"Button\",\n * \"Alert\" …) it shows that component's specimen instead: its variants, sizes\n * and states side by side, so every token in its panel has something visible\n * to change.\n *\n * - **Keyed by token component** (a manifest `component`, `tokens.json`), not\n * by tag: that is what the editor's items are. A guardrail checks every key\n * is one.\n * - **pont2 owns the markup.** The dashboard renders `html` as given and never\n * writes pont2 markup itself, so a markup change here never needs a\n * dashboard change.\n * - Specimens sit at the global scope (no widget around them): the editor's\n * Component scope edits `:root` tokens.\n * - Nothing in a specimen reaches a server: there is no flow host, so action\n * buttons only show their busy state, if anything.\n *\n * Pure data: no DOM, no Lit, no network.\n */\n\nexport interface PreviewSpecimen {\n /** A name for the specimen. */\n label: string;\n /** The markup to render, inside a `<form>` that does not submit. */\n html: string;\n}\n\nconst row = (items: string) => `<div style=\"display:flex;flex-wrap:wrap;gap:.75rem;align-items:center\">${items}</div>`;\nconst stack = (items: string, width = \"24rem\") =>\n `<div style=\"display:grid;gap:1.5rem;max-width:${width}\">${items}</div>`;\nconst caption = (text: string) =>\n `<p style=\"margin:0 0 .5rem;font-size:.75rem;opacity:.6\">${text}</p>`;\nconst section = (title: string, body: string) => `<section>${caption(title)}${body}</section>`;\n\nconst VARIANTS = [\"default\", \"secondary\", \"outline\", \"ghost\", \"destructive\", \"link\"];\nconst SIZES = [\"xs\", \"sm\", \"default\", \"lg\"];\n\nconst button = stack(\n [\n section(\n \"Variants\",\n row(VARIANTS.map(v => `<button type=\"button\" data-pont2-button data-variant=\"${v}\">${v[0].toUpperCase()}${v.slice(1)}</button>`).join(\"\")),\n ),\n section(\n \"Sizes\",\n row(SIZES.map(s => `<button type=\"button\" data-pont2-button data-size=\"${s}\">Size ${s}</button>`).join(\"\")),\n ),\n section(\n \"Disabled\",\n row(`<button type=\"button\" data-pont2-button disabled>Default</button><button type=\"button\" data-pont2-button data-variant=\"outline\" disabled>Outline</button>`),\n ),\n ].join(\"\"),\n \"40rem\",\n);\n\nconst field = (id: string, label: string, input: string, description = \"\") =>\n `<pont2-prim-field>\n <label data-pont2-label data-pont2-field-label data-slot=\"field-label\" for=\"${id}\">${label}</label>\n ${input}\n ${description ? `<pont2-prim-field-description>${description}</pont2-prim-field-description>` : \"\"}\n </pont2-prim-field>`;\n\nconst inputs = stack(\n [\n section(\"Default\", `<input data-pont2-input id=\"s-input\" placeholder=\"you@example.com\">`),\n section(\"Filled\", `<input data-pont2-input value=\"ada@example.com\">`),\n section(\"Invalid\", `<input data-pont2-input aria-invalid=\"true\" value=\"not-an-email\">`),\n section(\"Disabled\", `<input data-pont2-input disabled value=\"Disabled\">`),\n ].join(\"\"),\n);\n\nconst fields = stack(\n [\n field(\"s-email\", \"Email\", `<input data-pont2-input id=\"s-email\" type=\"email\" placeholder=\"you@example.com\">`, \"We'll never share it.\"),\n field(\"s-name\", \"Name\", `<input data-pont2-input id=\"s-name\" aria-invalid=\"true\">`, \"This field is required.\"),\n `<pont2-email-field required></pont2-email-field>`,\n `<pont2-password-field required rules=\"[]\" forgot></pont2-password-field>`,\n ].join(\"\"),\n);\n\nconst checkbox = stack(\n [\n row(`<pont2-checkbox id=\"s-c1\" checked></pont2-checkbox><label data-pont2-label for=\"s-c1\">Remember me</label>`),\n row(`<pont2-checkbox id=\"s-c2\"></pont2-checkbox><label data-pont2-label for=\"s-c2\">Unchecked</label>`),\n row(`<pont2-checkbox id=\"s-c3\" aria-invalid=\"true\"></pont2-checkbox><label data-pont2-label for=\"s-c3\">Invalid</label>`),\n row(`<pont2-checkbox id=\"s-c4\" checked disabled></pont2-checkbox><label data-pont2-label for=\"s-c4\">Disabled</label>`),\n ].join(\"\"),\n);\n\nconst alerts = stack(\n [\n `<pont2-alert icon heading=\"Default\" description=\"A neutral message.\"></pont2-alert>`,\n `<pont2-alert icon status=\"info\" heading=\"New sign-in\" description=\"We noticed a sign-in from a new device.\"></pont2-alert>`,\n `<pont2-alert icon status=\"success\" heading=\"Saved\" description=\"Your changes have been saved.\"></pont2-alert>`,\n `<pont2-alert icon status=\"warning\" heading=\"Almost out\" description=\"Your code expires in one minute.\"></pont2-alert>`,\n `<pont2-alert icon status=\"error\" heading=\"Sign-in failed\" description=\"Check your email and password.\"></pont2-alert>`,\n ].join(\"\"),\n \"28rem\",\n);\n\nconst badges = row(\n [\"default\", \"secondary\", \"outline\", \"destructive\", \"ghost\", \"link\"]\n .map(v => `<pont2-badge variant=\"${v}\">${v}</pont2-badge>`)\n .join(\"\"),\n);\n\nconst block = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Welcome back\"></pont2-title>\n <pont2-subtitle content=\"Sign in to your account\"></pont2-subtitle>\n </pont2-header>\n <pont2-email-field required></pont2-email-field>\n <pont2-submit-button event=\"submit\" label=\"Continue\"></pont2-submit-button>\n</pont2-block>`;\n\nconst typography = stack(\n [\n `<pont2-title content=\"Welcome back\"></pont2-title>`,\n `<pont2-subtitle content=\"Sign in to your account\"></pont2-subtitle>`,\n ].join(\"\"),\n);\n\nexport const PREVIEW_SPECIMENS: Readonly<Record<string, PreviewSpecimen>> = {\n button: { label: \"Button\", html: button },\n \"provider-button\": {\n label: \"Provider buttons\",\n html: stack(\n [\n `<pont2-provider-button provider=\"google\"></pont2-provider-button>`,\n `<pont2-provider-button provider=\"apple\"></pont2-provider-button>`,\n row(`<pont2-provider-button provider=\"google\" content=\"icon\"></pont2-provider-button><pont2-provider-button provider=\"github\" content=\"icon\"></pont2-provider-button>`),\n `<pont2-passkey-button content=\"icon-label\"></pont2-passkey-button>`,\n ].join(\"\"),\n ),\n },\n input: { label: \"Input\", html: inputs },\n field: { label: \"Field\", html: fields },\n label: { label: \"Label\", html: fields },\n checkbox: { label: \"Checkbox\", html: checkbox },\n \"input-otp\": {\n label: \"One-time code\",\n html: stack(\n [\n `<pont2-input-otp aria-label=\"Verification code\"></pont2-input-otp>`,\n `<pont2-input-otp group-size=\"3\" separator aria-label=\"Code\"></pont2-input-otp>`,\n ].join(\"\"),\n ),\n },\n \"otp-resend\": { label: \"Resend code\", html: `<pont2-otp-resend duration=\"5\" event=\"resend_code\"></pont2-otp-resend>` },\n link: {\n label: \"Link\",\n html: stack(\n [\n `<pont2-link prompt=\"Don't have an account?\" label=\"Sign up\" event=\"goto_signup\"></pont2-link>`,\n `<pont2-link label=\"Forgot password?\" event=\"forgot\"></pont2-link>`,\n ].join(\"\"),\n ),\n },\n alert: { label: \"Alert\", html: alerts },\n separator: {\n label: \"Separator\",\n html: stack(`<pont2-separator></pont2-separator><pont2-divider label=\"Or continue with\"></pont2-divider>`),\n },\n badge: { label: \"Badge\", html: badges },\n block: { label: \"Block\", html: block },\n header: { label: \"Header\", html: block },\n container: { label: \"Container\", html: block },\n title: { label: \"Title\", html: typography },\n subtitle: { label: \"Subtitle\", html: typography },\n avatar: {\n label: \"Avatar\",\n html: row(\n `<pont2-avatar alt=\"Ada Lovelace\" size=\"sm\"></pont2-avatar><pont2-avatar alt=\"Grace Hopper\"></pont2-avatar><pont2-avatar alt=\"Katherine Johnson\" size=\"lg\"></pont2-avatar>`,\n ),\n },\n \"qr-code\": {\n label: \"QR code\",\n html: `<pont2-qr-code url=\"otpauth://totp/Pontive:ada@example.com?secret=JBSWY3DPEHPK3PXP\" timeout=\"0\" label=\"Scan with your authenticator app\"></pont2-qr-code>`,\n },\n \"recovery-codes\": {\n label: \"Recovery codes\",\n html: `<pont2-recovery-codes codes='[\"3f9a-81c2\",\"7d01-4be9\",\"a6c4-02f7\",\"5e88-c13d\",\"90b2-7fa6\",\"1c5e-d840\"]'></pont2-recovery-codes>`,\n },\n watermark: {\n label: \"Watermark\",\n html: stack(`<pont2-watermark></pont2-watermark><pont2-watermark variant=\"muted\" label=\"Secured by\"></pont2-watermark>`),\n },\n};\n"],"names":["AttrsDirective","Directive","info","PartType","_attrs","noChange","part","map","applyAttrs","attrs","directive","el","previous","k","v","s","parseList","value","raw","parsed","item","PREFIX","PRIM","tag","name","primTag","identityAttr","identity","sel","tags","define","ctor","aliases","defineAlias","kitTag","base","alias","_HostElement","LitElement","extra","id","identitiesOf","changed","ReactiveElement","attr","on","HostElement","out","c","_ShellElement","options","_a","ShellElement","_NativeEnhancer","child","NativeEnhancer","_FormControlElement","message","disabled","state","_state","own","FormControlElement","designModeContext","createContext","DesignModeController","host","ContextConsumer","counter","uid","scope","ensureId","toggleIdRef","ids","fireNative","target","type","fire","detail","cancelable","icon","body","html","icons","a","svg","KIT_MESSAGES_EN","current","currentLocaleTag","listeners","setMessages","messages","locale","listener","msg","code","fallback","currentLocale","onMessagesChanged","resetMessages","MessagesController","safeUrl","url","safeExternalUrl","directionOf","owner","defaultDisabled","RovingFocusController","e","i","items","orientation","rtl","horizontal","vertical","step","next","_b","active","enabled","stop","from","ok","loop","ActionController","action","data","response","open","result","error","CopyController","kind","duration","text","BADGE_VARIANTS","_Badge","Badge","BUTTON_VARIANTS","BUTTON_SIZES","applyButton","o","native","isSoftDisabled","button","content","variant","size","slot","soft","onClick","nothing","recipeProperties","_Pont2Button","control","Pont2Button","_ButtonBase","focusableWhenDisabled","href","rel","ButtonBase","_Checkbox","Checkbox","applyInput","input","live","_Pont2Input","Pont2Input","_Kbd","Kbd","_KbdGroup","KbdGroup","applyLabel","label","_Pont2Label","Pont2Label","_Separator","Separator","_Skeleton","Skeleton","_Spinner","Spinner","applyTextarea","textarea","_Pont2Textarea","Pont2Textarea","ALERT_VARIANTS","_Alert","Alert","_AlertTitle","AlertTitle","_AlertDescription","AlertDescription","_AlertAction","AlertAction","_Avatar","img","status","Avatar","_AvatarFallback","AvatarFallback","_AvatarBadge","AvatarBadge","_AvatarGroup","AvatarGroup","_AvatarGroupCount","AvatarGroupCount","_ButtonGroup","ButtonGroup","_ButtonGroupText","ButtonGroupText","_ButtonGroupSeparator","ButtonGroupSeparator","_Card","Card","_CardHeader","CardHeader","_CardTitle","CardTitle","_CardDescription","CardDescription","_CardAction","CardAction","_CardContent","CardContent","_CardFooter","CardFooter","_Empty","Empty","_EmptyHeader","EmptyHeader","_EmptyMedia","EmptyMedia","_EmptyTitle","EmptyTitle","_EmptyDescription","EmptyDescription","_EmptyContent","EmptyContent","applyFieldSet","fieldSet","fieldLegend","_FieldSetElement","FieldSetElement","_FieldGroup","FieldGroup","_Field","Field","_FieldContent","FieldContent","applyFieldLabel","fieldLabel","_FieldLabelElement","FieldLabelElement","_FieldTitle","FieldTitle","_FieldDescription","FieldDescription","_FieldSeparator","FieldSeparator","_FieldError","unique","FieldError","_InputGroup","InputGroup","_InputGroupAddon","InputGroupAddon","_InputGroupText","InputGroupText","CONTROL","markControl","inputGroupInput","inputGroupTextarea","inputGroupButton","_InputGroupInput","InputGroupInput","_InputGroupTextarea","InputGroupTextarea","InputGroupButton","_ItemGroup","ItemGroup","_ItemSeparator","ItemSeparator","_Item","Item","_ItemMedia","ItemMedia","_ItemContent","ItemContent","_ItemTitle","ItemTitle","_ItemDescription","ItemDescription","_ItemActions","ItemActions","_ItemHeader","ItemHeader","_ItemFooter","ItemFooter","_NativeSelect","select","applyNativeSelect","NativeSelect","nativeSelect","_Table","Table","PARTS","mark","applyTable","table","section","row","cell","REGEXP_ONLY_DIGITS","REGEXP_ONLY_CHARS","REGEXP_ONLY_DIGITS_AND_CHARS","sanitizeOtp","maxLength","pattern","re","ch","otpSlots","focused","selStart","selEnd","chars","start","end","collapsed","_","char","isActive","ROOT","SLOT","FORWARDED","_InputOTP","n","m","r","f","states","invalid","order","clean","was","digits","InputOTP","_InputOTPGroup","InputOTPGroup","_InputOTPSlot","hasFakeCaret","InputOTPSlot","_InputOTPSeparator","InputOTPSeparator","_Progress","span","labels","l","parts","p","styleMap","Progress","ProgressPart","_formatted","_ProgressLabel","ProgressLabel","_ProgressValue","formatted","ProgressValue","_RadioGroup","checked","RadioGroup","_RadioGroupItem","RadioGroupItem","clamp","min","max","decimals","snap","snapped","d","fraction","valueAt","closestThumb","values","best","bestDist","setThumb","index","range","minSteps","gap","lo","hi","keyValue","key","opts","small","flip","parseValues","b","_Slider","onThumb","_c","arr","fd","final","rect","thumb","t","fr","thumbPos","rangeStyle","names","repeat","_v","Slider","_Switch","Switch","TRIGGER","PANEL","relate","internals","prop","targets","_Tabs","trigger","triggers","to","panels","ready","list","panel","Tabs","_TabsList","direction","TabsList","_TabsTrigger","TabsTrigger","_TabsContent","TabsContent","OPPOSITE","toPhysical","side","dir","toRequestedVocabulary","physical","requested","isVertical","spaceOn","anchor","viewport","offset","pad","computePosition","floating","align","sideOffset","alignOffset","collisionPadding","shift","need","here","there","x","y","startEdge","endEdge","sign","mainSpace","availableHeight","availableWidth","ax","ay","transformOrigin","round","alignItemWithAnchor","AnchoredPositioner","anchorEl","style","set","it","aligned","isItemDisabled","isItemVisible","moveIndex","move","isDisabled","keyToMove","Typeahead","timeout","repeated","search","stack","globalListeners","installGlobalListeners","top","path","popup","_PopupContent","reason","gen","anims","PopupContent","openPopups","ownQuery","root","selector","rootSelector","ownQueryAll","_PopupRoot","hadFocus","focusWasInside","PopupRoot","_PopupTrigger","_e","PopupTrigger","FOCUSABLE","_Popover","Popover","_PopoverTrigger","PopoverTrigger","_PopoverContent","title","desc","PopoverContent","_PopoverHeader","PopoverHeader","_PopoverTitle","PopoverTitle","_PopoverDescription","PopoverDescription","ROOTS","CONTENT","ITEM","trueUnlessFalse","_DropdownMenu","focus","DropdownMenu","_DropdownMenuSub","DropdownMenuSub","_DropdownMenuTrigger","DropdownMenuTrigger","_DropdownMenuContent","DropdownMenuSubTrigger","closeKey","DropdownMenuSubContent","sub","except","keep","DropdownMenuContent","_DropdownMenuSubContent","_MenuItemBase","MenuItemBase","_DropdownMenuItem","DropdownMenuItem","indicator","_DropdownMenuCheckboxItem","DropdownMenuCheckboxItem","_DropdownMenuRadioGroup","DropdownMenuRadioGroup","_DropdownMenuRadioItem","DropdownMenuRadioItem","_DropdownMenuSubTrigger","openKey","_DropdownMenuGroup","DropdownMenuGroup","_DropdownMenuLabel","DropdownMenuLabel","_DropdownMenuSeparator","DropdownMenuSeparator","_DropdownMenuShortcut","DropdownMenuShortcut","_Select","Select","_SelectTrigger","SelectTrigger","_SelectContent","SelectContent","_SelectItem","selected","SelectItem","_SelectGroup","SelectGroup","_SelectLabel","SelectLabel","_SelectSeparator","SelectSeparator","_Combobox","query","norm","scroll","q","visible","show","group","empty","Combobox","_ComboboxInput","hasValue","ComboboxInput","_ComboboxContent","ComboboxContent","_ComboboxList","ComboboxList","_ComboboxItem","ComboboxItem","_ComboboxEmpty","ComboboxEmpty","_ComboboxGroup","ComboboxGroup","_ComboboxLabel","ComboboxLabel","_ComboboxSeparator","ComboboxSeparator","_Tooltip","ms","Tooltip","_TooltipTrigger","TooltipTrigger","_TooltipContent","TooltipContent","ALERT_STATUSES","STATUS_ICON","_KitAlert","KitAlert","initials","words","w","_KitAvatar","KitAvatar","groupSizes","length","g","left","otpGroups","groupSize","separator","slots","sep","_KitInputOTP","KitInputOTP","AUTH_PROVIDERS","PROVIDER_NAMES","MARKS","isAuthProvider","providerIcon","provider","AUTH_BUTTON_CONTENTS","AUTH_BUTTON_ICON_ALIGNS","_AuthButton","iconOnly","busy","showIcon","showLabel","AuthButton","_ProviderButton","ProviderButton","PasskeyButton","SubmitButton","form","isDefault","formData","cap","fieldMessages","FIELD_VALIDATION_MODES","compilePattern","source","positive","focusClaimed","_AuthField","maxlength","issues","describedBy","descId","errId","AuthField","EmailField","PhoneField","UsernameField","NameField","IDENTIFIER_KINDS","identifierLabel","kinds","_IdentifierField","IdentifierField","PASSWORD_RULE_PATTERNS","DEFAULT_PASSWORD_RULES","ruleRegExp","rulesConverter","SECRET_FIELD_VARIANTS","_SecretField","SecretField","_PasswordField","failing","PasswordField","_ConfirmField","pair","other","ConfirmField","OTP_LAYOUTS","_OtpField","otp","byLayout","OtpField","_OtpResend","OtpResend","LINK_ALIGNS","LINK_SERVICES","_Link","_changed","Link","ExternalLink","_Divider","Divider","_TextShell","TextShell","_Title","level","Title","Subtitle","providerColumns","count","providerEvent","listConverter","jsonArray","_ProviderField","overrides","opt","ProviderField","PONTIVE_MARK","PONTIVE_WORDMARK","pontiveLogo","WATERMARK_VARIANTS","WATERMARK_LOGO_ALIGNS","watermarkContent","logoAlign","_Watermark","Watermark","DEFAULT_BRANDING","brandingContext","BrandingController","_Block","Block","CONTAINER_TYPES","_Container","design","Container","HEADER_ALIGNS","_Header","Header","GAP_TYPES","_Gap","Gap","LOGO_ALIGNS","logoSource","theme","_Logo","light","PLACEHOLDER","dark","alt","Logo","safeRedirect","_Countdown","Countdown","_EditIdentifier","EditIdentifier","_Secret","copied","meta","Secret","QR_ERROR_CORRECTIONS","QUIET","qrPath","modules","QRCode","_QrCode","obscured","QrCode","codesConverter","_RecoveryCodes","codes","off","RecoveryCodes","normalizeScopes","scopes","seen","granted","required","isScopeChecked","unticked","scopeListValue","scopesConverter","_ScopeList","ticked","ScopeList","FLOW_MESSAGES_EN","FLOW_ENDED_STATUS","INSTANCE_UNAVAILABLE","isInstanceUnavailable","readError","rememberUnavailable","sentence","describeFlowError","kitMsg","serverSentence","nested","formDataToObject","BANNER","reported","warnedUnanswered","_Layout","ContextProvider","event","client","request","restartable","alert","banner","shell","parent","Layout","ConsentError","CONSENT_EXPIRED_EN","consentExpired","consentEndpoint","baseUrl","fetchConsent","call","isView","submitConsent","err","isObject","isNavigableRedirect","protocol","init","flat","envelope","_Consent","seq","view","expired","unavailable","outcome","retryable","layout","Consent","dispatchFlowState","escapeAttr","CONFIGURE_TIMEOUT","_FlowWidget","flowId","res","FlowWidget","SignIn","SignUp","Invitation","signin","password","verify","signup","PREVIEW_SCREENS","previewClient","spec","delay","_request","resolve","width","caption","VARIANTS","SIZES","field","description","inputs","fields","checkbox","alerts","badges","block","typography","PREVIEW_SPECIMENS"],"mappings":";;;;;;;AAeA,MAAMA,WAAuBC,GAAU;AAAA,EAGr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MACJ;AAAA,QACE;AAAA,QACA;AAAA,MAAA,EACA,KAAK,EAAE;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,cAAc,EAAE,OAAO,eAAe,MAAM,yEAAA;AAAA,EAC5C,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,MAAMA;AAAA,MACJ;AAAA,QACE;AAAA,QACA;AAAA,MAAA,EACA,KAAK,EAAE;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,OAAO,EAAE,OAAO,SAAS,MAAMgY,GAAA;AAAA,EAC/B,WAAW;AAAA,IACT,OAAO;AAAA,IACP,MAAMhY,EAAM,6FAA6F;AAAA,EAAA;AAAA,EAE3G,OAAO,EAAE,OAAO,SAAS,MAAMiY,GAAA;AAAA,EAC/B,OAAO,EAAE,OAAO,SAAS,MAAMC,GAAA;AAAA,EAC/B,QAAQ,EAAE,OAAO,UAAU,MAAMA,GAAA;AAAA,EACjC,WAAW,EAAE,OAAO,aAAa,MAAMA,GAAA;AAAA,EACvC,OAAO,EAAE,OAAO,SAAS,MAAMC,GAAA;AAAA,EAC/B,UAAU,EAAE,OAAO,YAAY,MAAMA,GAAA;AAAA,EACrC,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,MAAMzjB;AAAA,MACJ;AAAA,IAAA;AAAA,EACF;AAAA,EAEF,WAAW;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER,kBAAkB;AAAA,IAChB,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER,WAAW;AAAA,IACT,OAAO;AAAA,IACP,MAAMsL,EAAM,2GAA2G;AAAA,EAAA;AAE3H;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../pont2/src/core/context-root.ts","../../pont2/src/core/attrs.ts","../../pont2/src/core/names.ts","../../pont2/src/core/host-element.ts","../../pont2/src/core/form-control.ts","../../pont2/src/core/design-mode.ts","../../pont2/src/core/ids.ts","../../pont2/src/core/events.ts","../../pont2/src/core/icons.ts","../../pont2/src/core/messages.ts","../../pont2/src/core/url.ts","../../pont2/src/core/controllers/roving-focus.ts","../../pont2/src/core/controllers/action.ts","../../pont2/src/core/controllers/copy.ts","../../pont2/src/primitives/badge/badge.ts","../../pont2/src/primitives/button/button.ts","../../pont2/src/primitives/checkbox/checkbox.ts","../../pont2/src/primitives/input/input.ts","../../pont2/src/primitives/kbd/kbd.ts","../../pont2/src/primitives/label/label.ts","../../pont2/src/primitives/separator/separator.ts","../../pont2/src/primitives/skeleton/skeleton.ts","../../pont2/src/primitives/spinner/spinner.ts","../../pont2/src/primitives/textarea/textarea.ts","../../pont2/src/primitives/alert/alert.ts","../../pont2/src/primitives/avatar/avatar.ts","../../pont2/src/primitives/button-group/button-group.ts","../../pont2/src/primitives/card/card.ts","../../pont2/src/primitives/empty/empty.ts","../../pont2/src/primitives/field/field.ts","../../pont2/src/primitives/input-group/input-group.ts","../../pont2/src/primitives/item/item.ts","../../pont2/src/primitives/native-select/native-select.ts","../../pont2/src/primitives/table/table.ts","../../pont2/src/primitives/pagination/pagination.ts","../../pont2/src/primitives/input-otp/otp.ts","../../pont2/src/primitives/input-otp/input-otp.ts","../../pont2/src/primitives/progress/progress.ts","../../pont2/src/primitives/radio-group/radio-group.ts","../../pont2/src/primitives/slider/slider-math.ts","../../pont2/src/primitives/slider/slider.ts","../../pont2/src/primitives/switch/switch.ts","../../pont2/src/primitives/tabs/tabs.ts","../../pont2/src/core/popup/position.ts","../../pont2/src/core/popup/anchored.ts","../../pont2/src/core/popup/list.ts","../../pont2/src/core/popup/popup-content.ts","../../pont2/src/core/popup/popup-root.ts","../../pont2/src/core/popup/modal.ts","../../pont2/src/primitives/popover/popover.ts","../../pont2/src/primitives/dropdown-menu/dropdown-menu.ts","../../pont2/src/primitives/select/select.ts","../../pont2/src/primitives/combobox/combobox.ts","../../pont2/src/primitives/tooltip/tooltip.ts","../../pont2/src/primitives/dialog/dialog.ts","../../pont2/src/primitives/alert-dialog/alert-dialog.ts","../../pont2/src/primitives/sheet/sheet.ts","../../pont2/src/primitives/drawer/drawer.ts","../../pont2/src/primitives/hover-card/hover-card.ts","../../pont2/src/primitives/sonner/toast-store.ts","../../pont2/src/primitives/sonner/sonner.ts","../../pont2/src/kit/aliases.ts","../../pont2/src/kit/alert/alert.ts","../../pont2/src/kit/avatar/avatar.ts","../../pont2/src/kit/input-otp/input-otp.ts","../../pont2/src/kit/auth-button/providers.ts","../../pont2/src/kit/auth-button/auth-button.ts","../../pont2/src/kit/auth-field/auth-field.ts","../../pont2/src/kit/auth-field/password-field.ts","../../pont2/src/kit/otp-field/otp-field.ts","../../pont2/src/kit/otp-field/otp-resend.ts","../../pont2/src/kit/link/link.ts","../../pont2/src/kit/divider/divider.ts","../../pont2/src/kit/typography/typography.ts","../../pont2/src/kit/provider-field/provider-field.ts","../../pont2/src/kit/watermark/pontive-logo.ts","../../pont2/src/kit/watermark/watermark.ts","../../pont2/src/kit/block/branding.ts","../../pont2/src/kit/block/block.ts","../../pont2/src/kit/container/container.ts","../../pont2/src/kit/header/header.ts","../../pont2/src/kit/gap/gap.ts","../../pont2/src/kit/logo/logo.ts","../../pont2/src/kit/countdown/countdown.ts","../../pont2/src/kit/edit-identifier/edit-identifier.ts","../../pont2/src/kit/secret/secret.ts","../../pont2/src/kit/qr-code/qr-code.ts","../../pont2/src/kit/recovery-codes/recovery-codes.ts","../../pont2/src/kit/scope-list/scope-value.ts","../../pont2/src/kit/scope-list/scope-list.ts","../../pont2/src/kit/layout/flow-error.ts","../../pont2/src/kit/layout/layout.ts","../../pont2/src/kit/consent/consent-api.ts","../../pont2/src/kit/consent/consent.ts","../../pont2/src/kit/provider/contexts.ts","../../pont2/src/kit/flow-widget/flow-widget.ts","../../pont2/src/kit/flow-widget/preview.ts","../../pont2/src/kit/flow-widget/specimens.ts","../../pont2/src/kit/provider/coexistence.ts","../../pont2/src/kit/provider/redirect.ts","../../pont2/src/kit/provider/runtime-config.ts","../../pont2/src/kit/provider/sdk.ts","../../pont2/src/kit/provider/widget-messages.ts","../../pont2/src/kit/provider/provider.ts","../../pont2/src/kit/provider/signed-in.ts","../../pont2/src/kit/pagination/range.ts","../../pont2/src/kit/pagination/pagination.ts","../../pont2/src/kit/data-table/rows.ts","../../pont2/src/kit/data-table/data-table.ts","../../pont2/src/kit/badge-selector/badge-selector.ts","../../pont2/src/kit/multi-email-input/emails.ts","../../pont2/src/kit/multi-email-input/multi-email-input.ts","../../pont2/src/kit/multi-select-filter/multi-select-filter.ts"],"sourcesContent":["import { ContextRoot } from \"@lit/context\";\n\n/**\n * Lets an element find a provider that arrives after it asked.\n *\n * An element asks for its context once, when it connects, and a provider only\n * hears requests made while it listens. That holds when the elements are\n * defined before the page is built, but not when a framework renders\n * `<pont2-provider>` and its widgets first and this bundle loads afterwards\n * (every React host loading pont2 from the CDN): each element upgrades as its\n * definition runs, the widget may ask before the provider is defined, and it\n * would never ask again.\n *\n * A `ContextRoot` on the document keeps the subscribing requests nobody\n * answered and replays them when a provider announces itself. pont2's entry\n * evaluates this module before any element is defined (`core/index.ts` imports\n * it first). A port of the legacy `src/context-root.ts` (migration tracker W-1);\n * attached once per page even when several pont2 copies or the superset bundle\n * load it. The legacy kit's own root, if present, is harmless beside it: a\n * replayed request answered twice is deduplicated by the consumer.\n */\nconst KEY = Symbol.for(\"pont2.context-root\");\n\nexport function attachContextRoot(root: Element | undefined = globalThis.document?.documentElement): void {\n if (!root) return;\n const marked = root as Element & { [KEY]?: true };\n if (marked[KEY]) return;\n marked[KEY] = true;\n new ContextRoot().attach(root as HTMLElement);\n}\n\nattachContextRoot();\n","import { noChange } from \"lit\";\nimport { Directive, directive, PartType, type ElementPart, type PartInfo } from \"lit/directive.js\";\n\nexport type AttrValue = string | number | boolean | null | undefined;\nexport type AttrMap = Record<string, AttrValue>;\n\n/**\n * `<button ${attrs({ \"data-provider\": \"google\", \"aria-busy\": loading })}>`\n *\n * Lit has no attribute spread; part functions need one. It plays the role of\n * `{...props}` in a shadcn component: a composing component can put extra\n * attributes on the *same* element a part renders, so it never has to wrap\n * that element. `true` → empty attribute; `false`/`null`/`undefined` → removed;\n * keys dropped since the previous render are removed.\n */\nclass AttrsDirective extends Directive {\n private prev = new Set<string>();\n\n constructor(info: PartInfo) {\n super(info);\n if (info.type !== PartType.ELEMENT) throw new Error(\"attrs() must be used in element position\");\n }\n\n render(_attrs: AttrMap) {\n return noChange;\n }\n\n override update(part: ElementPart, [map]: [AttrMap]) {\n applyAttrs(part.element, map, this.prev);\n this.prev = new Set(Object.keys(map));\n return noChange;\n }\n}\n\nexport const attrs = directive(AttrsDirective);\n\n/** Imperative twin of `attrs()`, for code that holds a node rather than a template. */\nexport function applyAttrs(el: Element, map: AttrMap, previous?: Iterable<string>): void {\n if (previous) for (const k of previous) if (!(k in map)) el.removeAttribute(k);\n for (const [k, v] of Object.entries(map)) {\n if (v === false || v == null) {\n if (el.hasAttribute(k)) el.removeAttribute(k);\n } else {\n const s = v === true ? \"\" : String(v);\n if (el.getAttribute(k) !== s) el.setAttribute(k, s);\n }\n }\n}\n\n/**\n * A list attribute: a JSON array (`[\"google\",\"github\"]`, the form the platform's\n * resolve pass writes for `providers` and `identifiers`) or space/comma-separated\n * words (`google github`), as authors write them. Non-string JSON items become\n * strings; anything unparsable is an empty list.\n */\nexport function parseList(value: string | null | undefined): string[] {\n const raw = (value ?? \"\").trim();\n if (!raw) return [];\n if (raw.startsWith(\"[\")) {\n try {\n const parsed: unknown = JSON.parse(raw);\n return Array.isArray(parsed) ? parsed.map(item => String(item).trim()).filter(Boolean) : [];\n } catch {\n return [];\n }\n }\n return raw.split(/[\\s,]+/).filter(Boolean);\n}\n","/**\n * The pont2 namespace, in one place.\n *\n * | Thing | Form | Example |\n * |------------------|-------------------------------|--------------------------------------|\n * | primitive tag | `pont2-prim-<name>` | `pont2-prim-alert`, `pont2-prim-alert-title` |\n * | kit tag | `pont2-<name>` | `pont2-alert` (composite), `pont2-button` (alias) |\n * | identity attr | `data-pont2-<identity>` | `data-pont2-alert` (tier-neutral: \"this is an alert\") |\n * | slot attr | `data-slot=\"<name>\"` | `data-slot=\"item-separator\"` (shadcn's own, unprefixed) |\n * | state attrs | `data-<state>` | `data-checked`, `data-open` (Base UI's own, unprefixed) |\n * | CSS custom prop | `--pont2-sem-<role>` … | `--pont2-sem-color-primary` (docs/11-tokens.md) |\n * | cascade layer | `pont2.<layer>` | `pont2.primitives`, `pont2.kit` |\n * | custom event | `pont2-<name>` | `pont2-open-change` |\n *\n * Two element surfaces share one namespace (docs/10-primitives-and-kit.md):\n *\n * - **primitives** `pont2-prim-*`: shadcn's components, one for one.\n * - **kit** `pont2-*`: what applications use. A kit element is either an\n * *alias* of a primitive (same behaviour, second tag) or a *composite* (a\n * subclass of a primitive that renders the primitive's children from\n * properties). Invariant: **`pont2-<name>` is always a `<name>` at its\n * root**, which is what lets `sel()` / `tags()` match both surfaces at once.\n *\n * The identity attribute is tier-neutral on purpose: it says *what* an element\n * is (an alert), not *which tag* produced it. Recipes and lookups key on it, so\n * a primitive, its alias, a composite built on it and hand-written recipe\n * markup are all styled and found the same way.\n *\n * `data-slot` and the state attributes stay unprefixed on purpose: they are\n * shadcn's and Base UI's public styling contract, and keeping them verbatim\n * is what lets shadcn styles port across mechanically.\n */\nexport const PREFIX = \"pont2\";\n/** Tag segment that marks the primitive surface. */\nexport const PRIM = \"prim\";\n\n/** Kit tag: `tag(\"alert\")` → `pont2-alert`. */\nexport const tag = (name: string) => `${PREFIX}-${name}` as const;\n/** Primitive tag: `primTag(\"alert\")` → `pont2-prim-alert`. */\nexport const primTag = (name: string) => `${PREFIX}-${PRIM}-${name}` as const;\nexport const identityAttr = (identity: string) => `data-${PREFIX}-${identity}` as const;\n\n/**\n * Selector for every element that *is* a `<name>`: its primitive tag, its kit\n * tag (an alias or a composite, which by the kit invariant has that root) and\n * its identity attribute (upgraded elements, parts rendered by composites,\n * hand-written recipe markup).\n *\n * `sel(\"alert\")` → `:is(pont2-prim-alert, pont2-alert, [data-pont2-alert])`\n *\n * Use it for every structural lookup (`closest`, `querySelector`), so a\n * component works whichever surface its parts were written with.\n * Tier 3 shells are the exception: their identity attribute lives on the\n * native child, so look shells up with `tags()`.\n */\nexport const sel = (name: string) => `:is(${primTag(name)}, ${tag(name)}, [${identityAttr(name)}])`;\n\n/** The element tags only, on both surfaces: `:is(pont2-prim-x, pont2-x)`. Use for shells. */\nexport const tags = (name: string) => `:is(${primTag(name)}, ${tag(name)})`;\n\n/**\n * Registers an element once. Re-registration (HMR, a second bundle copy) is a\n * no-op rather than a thrown DOMException, but a *different* class under the\n * same tag is reported, because that means two copies of pont2 are loaded.\n */\nexport function define(name: string, ctor: CustomElementConstructor): void {\n const existing = customElements.get(name);\n if (!existing) {\n customElements.define(name, ctor);\n } else if (existing !== ctor && import.meta.env?.DEV) {\n console.warn(`[pont2] <${name}> is already defined by another class (two pont2 copies loaded?).`);\n }\n}\n\nconst aliases = new Map<CustomElementConstructor, CustomElementConstructor>();\n\n/**\n * Promotes a primitive to the kit surface unchanged: `pont2-<name>` becomes a\n * second tag for `pont2-prim-<name>`.\n *\n * The platform forbids registering one constructor under two names, so the\n * alias is an empty subclass. It inherits everything (identity, slot, role,\n * properties, form association), so it is styled, announced and submitted\n * exactly like the primitive, and `instanceof` the primitive class holds.\n *\n * ```ts\n * defineAlias(\"pont2-button\", Pont2Button); // <pont2-prim-button> → also <pont2-button>\n * ```\n *\n * Returns the alias constructor.\n */\nexport function defineAlias<T extends CustomElementConstructor>(kitTag: `pont2-${string}`, base: T): T {\n if (import.meta.env?.DEV) {\n const expected = kitTag.replace(`${PREFIX}-`, `${PREFIX}-${PRIM}-`);\n const registered = customElements.getName?.(base);\n if (registered && registered !== expected) {\n console.warn(`[pont2] defineAlias(\"${kitTag}\") expects the class registered as <${expected}>, got <${registered}>.`);\n }\n }\n let alias = aliases.get(base) as T | undefined;\n if (!alias) {\n // Static members (properties, identity, formAssociated, nativeSelector…)\n // are inherited through the constructor's prototype chain.\n alias = class extends (base as unknown as new () => HTMLElement) {} as unknown as T;\n Object.defineProperty(alias, \"name\", { value: `${base.name}Alias` });\n aliases.set(base, alias);\n }\n define(kitTag, alias);\n return customElements.get(kitTag) as T;\n}\n","import { LitElement, ReactiveElement, type PropertyValues } from \"lit\";\nimport type { DirectiveResult } from \"lit/directive.js\";\n\nimport { attrs, type AttrMap } from \"./attrs\";\nimport { identityAttr, PREFIX } from \"./names\";\n\n/**\n * # HostElement: the host is the component's root element\n *\n * The base class of every pont2 element. A shadcn component is a function\n * that returns its root element and then disappears. A custom element cannot\n * disappear, so in pont2 **the host *is* the root**: `<pont2-prim-separator>` is the\n * separator, it does not render one.\n *\n * What a subclass gets:\n *\n * | Static / member | Does |\n * |---------------------|----------------------------------------------------------------------|\n * | `static identity` | Stamps `data-pont2-<identity>`. Every class in the chain adds its own, so a subclass keeps its base's styles (`pont2-prim-item-separator` carries `data-pont2-separator` *and* `data-pont2-item-separator`). |\n * | `static slotName` | Stamps `data-slot` (shadcn's convention). Most-derived class wins. An author-written `data-slot` is never overwritten. |\n * | `static role` | Default ARIA role through `ElementInternals`. An author's `role=\"\"` attribute still wins. |\n * | `internals` | `ElementInternals`: default ARIA, custom states, forms (see FormControlElement). |\n * | `setData()` | Writes component-owned `data-*` state on the host (Base UI's presence-style attributes). |\n * | `setState()` | Adds/removes a CustomStateSet entry, matchable as `:state(x)`. |\n * | `static part()` | The same identity, slot and role as attributes, for a composite to put on a plain element (see below). |\n * | `static composite` | Marks a kit composite: it renders its whole subtree from properties (docs/10-primitives-and-kit.md). |\n *\n * Light DOM throughout: `createRenderRoot()` returns `this`. Most Tier 1\n * elements never override `render()`; their children are whatever the author\n * wrote, left exactly where the author wrote them.\n */\nexport abstract class HostElement extends LitElement {\n /** Style identity → `data-pont2-<identity>`. Inherited along the class chain. */\n static identity?: string;\n /** shadcn `data-slot` value. Most-derived wins; never overrides the author. */\n static slotName?: string;\n /** Default ARIA role, set through ElementInternals (author attribute wins). */\n static role?: string;\n\n /**\n * `true` on kit composites (`src/kit/`): the element renders its entire\n * subtree from properties, so author-written children are a mistake (use the\n * `pont2-prim-*` form for custom content). Reported once in development.\n */\n static composite = false;\n\n /**\n * A **part**: this element's identity, `data-slot` and default role as plain\n * attributes, for a template to put on a native element.\n *\n * ```ts\n * html`<div ${AlertTitle.part()}>${this.heading}</div>`\n * // → <div data-pont2-alert-title data-slot=\"alert-title\">…</div>\n * ```\n *\n * The result is styled by the element's recipe and found by `sel()` lookups,\n * exactly like the element itself, so a composite reproduces shadcn's DOM\n * without nesting custom elements. A part carries **attributes only**: use\n * it for Tier 1 elements whose host adds nothing but identity, slot and role.\n * An element with behaviour (state, observers, keyboard, form association)\n * has to be rendered as the element. `extra` adds or overrides attributes.\n */\n static part(extra: AttrMap = {}): DirectiveResult {\n const map: AttrMap = {};\n for (const id of identitiesOf(this)) map[identityAttr(id)] = true;\n if (this.slotName) map[\"data-slot\"] = this.slotName;\n if (this.role) map.role = this.role;\n return attrs({ ...map, ...extra });\n }\n\n protected readonly internals: ElementInternals = this.attachInternals();\n\n protected override createRenderRoot(): HTMLElement {\n return this;\n }\n\n /**\n * Elements that do not override `render()` (most Tier 1 hosts) skip Lit's\n * template rendering entirely. Otherwise lit-html would append a `<!---->`\n * part marker to the author's children: a stray node in a component whose\n * whole point is to add none, and one more node for React to step around.\n */\n protected override update(changed: PropertyValues): void {\n if (this.render === HostElement.prototype.render) {\n ReactiveElement.prototype[\"update\"].call(this, changed);\n return;\n }\n super.update(changed);\n }\n\n override connectedCallback(): void {\n const ctor = this.constructor as typeof HostElement;\n if (ctor.composite && !this.hasUpdated && import.meta.env?.DEV) warnAuthorChildren(this);\n super.connectedCallback();\n\n // Attributes may not be added in a custom element constructor (it would\n // make document.createElement() throw), so identity is stamped on connect.\n for (const id of identitiesOf(ctor)) {\n if (!this.hasAttribute(`data-${PREFIX}-${id}`)) {\n this.setAttribute(`data-${PREFIX}-${id}`, \"\");\n }\n }\n if (ctor.slotName && !this.hasAttribute(\"data-slot\")) {\n this.setAttribute(\"data-slot\", ctor.slotName);\n }\n if (ctor.role && !this.internals.role) this.internals.role = ctor.role;\n }\n\n /**\n * Sets `data-<name>`: a string value, `true` → empty (presence) attribute,\n * `false`/`null`/`undefined` → removed. Base UI exposes state as presence\n * attributes (`data-checked`, `data-disabled`, `data-open`), which is what\n * shadcn's Base UI styles select on, so `true`/`false` is the common call.\n */\n protected setData(name: string, value: string | boolean | null | undefined): void {\n const attr = `data-${name}`;\n if (value === false || value == null) {\n if (this.hasAttribute(attr)) this.removeAttribute(attr);\n } else {\n const v = value === true ? \"\" : value;\n if (this.getAttribute(attr) !== v) this.setAttribute(attr, v);\n }\n }\n\n /** Adds or removes a custom state, matchable in CSS as `:state(<name>)`. */\n protected setState(name: string, on: boolean): void {\n try {\n if (on) this.internals.states.add(name);\n else this.internals.states.delete(name);\n } catch {\n // Very old engines only accepted `--name`; state is a nicety, never load-bearing.\n }\n }\n}\n\nfunction warnAuthorChildren(el: HTMLElement): void {\n const authored = Array.from(el.childNodes).some(\n n => n.nodeType === Node.ELEMENT_NODE || (n.nodeType === Node.TEXT_NODE && n.textContent!.trim() !== \"\"),\n );\n if (authored) {\n console.warn(\n `[pont2] <${el.localName}> is a composite: it renders its content from properties and ignores children. ` +\n `For custom content, write the primitive form instead (the pont2-prim-* elements it is built from).`,\n el,\n );\n }\n}\n\n/** Every `identity` declared along the prototype chain, most-derived first. */\nexport function identitiesOf(ctor: typeof HostElement): string[] {\n const out: string[] = [];\n let c: unknown = ctor;\n while (typeof c === \"function\" && c !== HostElement && c !== LitElement) {\n const k = c as typeof HostElement;\n if (Object.hasOwn(k, \"identity\") && k.identity) out.push(k.identity);\n c = Object.getPrototypeOf(c);\n }\n return out;\n}\n\n/**\n * # ShellElement: Tier 3 (native-bound) host\n *\n * Some shadcn roots must stay *native* elements: `<button>`, `<a>`, `<input>`,\n * `<textarea>`, `<label>`, `<select>`, `<table>`, `<fieldset>`. Their behaviour\n * (implicit form submission, `SubmitEvent.submitter`, autofill, password\n * managers, real links, `for=` labelling, table parsing) cannot be emulated\n * faithfully by a custom element.\n *\n * For those, the host is a **transparent shell**: `display: contents`\n * (`[data-pont2-shell]` in styles/base.css), no role, no styles, no box. It\n * exists only so HTML authors have a tag. Everything styled or announced lives\n * on the one native element inside it. Two nodes is the platform floor for\n * native semantics, and composition never adds a third.\n *\n * Never style a shell, give it a role, or anchor positioning to it. Use\n * `control` (the native element) instead.\n */\nexport abstract class ShellElement extends HostElement {\n static override identity = \"shell\";\n\n /** The single native element this shell stands for. */\n abstract get control(): HTMLElement | null;\n\n override focus(options?: FocusOptions): void {\n this.control?.focus(options);\n }\n\n override blur(): void {\n this.control?.blur();\n }\n}\n\n/**\n * # NativeEnhancer: Tier 3 element form (\"asChild\")\n *\n * `<pont2-prim-button variant=\"outline\"><button>Save</button></pont2-prim-button>`\n *\n * The author writes the native element; the shell applies the recipe to it\n * (attributes only). The native node is never moved, wrapped or re-created,\n * so React, a parent Lit template or server HTML keep owning it. A\n * MutationObserver re-applies the recipe if the child is swapped.\n *\n * This is shadcn's `asChild` / Base UI's `render` prop, expressed in HTML.\n */\nexport abstract class NativeEnhancer<T extends HTMLElement = HTMLElement> extends ShellElement {\n /** Selector for the native child this enhancer applies its recipe to. */\n static nativeSelector = \"*\";\n\n private _observer?: MutationObserver;\n private _warned = false;\n\n override get control(): T | null {\n const sel = (this.constructor as typeof NativeEnhancer).nativeSelector;\n for (const child of Array.from(this.children)) {\n if (child.matches(sel)) return child as T;\n }\n return null;\n }\n\n /** Apply the recipe (attributes / properties) to the native element. */\n protected abstract apply(control: T): void;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._observer ??= new MutationObserver(() => this.requestUpdate());\n this._observer.observe(this, { childList: true });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._observer?.disconnect();\n }\n\n protected override updated(): void {\n const el = this.control;\n if (el) {\n this.apply(el);\n return;\n }\n if (!this._warned && this.isConnected && this.childNodes.length) {\n this._warned = true;\n const sel = (this.constructor as typeof NativeEnhancer).nativeSelector;\n console.warn(\n `<${this.localName}> enhances a native child element (${sel}) and found none. ` +\n `Write <${this.localName}><${sel.split(\",\")[0].trim()}>…</…></${this.localName}>, ` +\n `or use the recipe attributes on the native element directly.`,\n this,\n );\n }\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { HostElement } from \"./host-element\";\n\nexport interface ValidityResult {\n flags: ValidityStateFlags;\n message: string;\n}\n\n/**\n * # FormControlElement: Tier 2 form-associated widget\n *\n * The base for widgets whose host is an ARIA widget root *and* a form control\n * (Checkbox, Switch, RadioGroup, Slider, Select, Combobox, InputOTP …). It is\n * a **form-associated custom element** (FACE), so with no hidden `<input>`:\n *\n * - it submits `name=value` with its `<form>` (`internals.setFormValue`);\n * - it takes part in constraint validation (`setValidity`, `:invalid`,\n * `checkValidity()`, `reportValidity()`, blocking submit when `required`);\n * - it is disabled by `disabled`, by an ancestor `<fieldset disabled>` and by\n * its form, through `formDisabledCallback`;\n * - it resets with its form (`formResetCallback`) and restores on\n * back/forward navigation (`formStateRestoreCallback`);\n * - it is labelable: `<label for>` and wrapping labels work, and `labels`\n * lists them;\n * - the `form=\"id\"` content attribute works natively.\n *\n * Base UI renders a visually hidden `<input>` next to each such widget to get\n * the same effect in React. A FACE makes that node unnecessary, which is\n * one node fewer than shadcn/Base UI.\n *\n * Subclasses implement `formValue()`, `resetToDefault()` and optionally\n * `validate()`; the base syncs internals/data attributes after every update.\n */\nexport abstract class FormControlElement extends HostElement {\n static formAssociated = true;\n\n static override properties: PropertyDeclarations = {\n name: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n required: { type: Boolean, reflect: true },\n readOnly: { type: Boolean, reflect: true, attribute: \"readonly\" },\n formDisabled: { state: true },\n };\n\n declare name: string;\n declare disabled: boolean;\n declare required: boolean;\n declare readOnly: boolean;\n /** Disabled by an ancestor `<fieldset disabled>` or the form. */\n declare protected formDisabled: boolean;\n\n private _customMessage = \"\";\n\n constructor() {\n super();\n this.name = \"\";\n this.disabled = false;\n this.required = false;\n this.readOnly = false;\n this.formDisabled = false;\n }\n\n /* -------------------------------------------------------------- */\n /* Subclass contract */\n /* -------------------------------------------------------------- */\n\n /** What the control submits. `null` submits nothing (an unchecked checkbox). */\n protected abstract formValue(): string | File | FormData | null;\n\n /** Restore the default value (the one in the markup). */\n protected abstract resetToDefault(): void;\n\n /** Built-in constraint check. Return `null` when valid. */\n protected validate(): ValidityResult | null {\n return null;\n }\n\n /** Whether the host itself is a tab stop. Composite widgets with an inner roving tab stop return false. */\n protected get hostFocusable(): boolean {\n return true;\n }\n\n /** Element `reportValidity()` should point at (must be inside the host). */\n protected get validationAnchor(): HTMLElement | undefined {\n return undefined;\n }\n\n /* -------------------------------------------------------------- */\n /* Public form API (mirrors native controls) */\n /* -------------------------------------------------------------- */\n\n get form(): HTMLFormElement | null {\n return this.internals.form;\n }\n get labels(): NodeList {\n return this.internals.labels;\n }\n get validity(): ValidityState {\n return this.internals.validity;\n }\n get validationMessage(): string {\n return this.internals.validationMessage;\n }\n get willValidate(): boolean {\n return this.internals.willValidate;\n }\n /** `disabled` or disabled by a fieldset/form. */\n get isDisabled(): boolean {\n return this.disabled || this.formDisabled;\n }\n checkValidity(): boolean {\n return this.internals.checkValidity();\n }\n reportValidity(): boolean {\n return this.internals.reportValidity();\n }\n setCustomValidity(message: string): void {\n this._customMessage = message;\n this.syncValidity();\n }\n\n /* -------------------------------------------------------------- */\n /* FACE lifecycle */\n /* -------------------------------------------------------------- */\n\n formResetCallback(): void {\n this.resetToDefault();\n }\n\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n\n formStateRestoreCallback(state: string | File | FormData | null): void {\n this.restoreState(state);\n }\n\n /** Override to restore from the value `formValue()` produced. */\n protected restoreState(_state: string | File | FormData | null): void {}\n\n /* -------------------------------------------------------------- */\n /* Sync */\n /* -------------------------------------------------------------- */\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n const disabled = this.isDisabled;\n\n this.internals.ariaDisabled = disabled ? \"true\" : null;\n this.internals.ariaRequired = this.required ? \"true\" : null;\n this.internals.ariaReadOnly = this.readOnly ? \"true\" : null;\n this.setData(\"disabled\", disabled);\n this.setData(\"required\", this.required);\n this.setData(\"readonly\", this.readOnly);\n\n if (this.hostFocusable) {\n if (disabled) this.removeAttribute(\"tabindex\");\n else if (!this.hasAttribute(\"tabindex\")) this.tabIndex = 0;\n }\n\n this.internals.setFormValue(this.formValue());\n this.syncValidity();\n }\n\n protected syncValidity(): void {\n const own = this.validate();\n if (this._customMessage) {\n this.internals.setValidity({ customError: true }, this._customMessage, this.validationAnchor);\n } else if (own) {\n this.internals.setValidity(own.flags, own.message, this.validationAnchor);\n } else {\n this.internals.setValidity({});\n }\n }\n}\n","import { ContextConsumer, createContext } from \"@lit/context\";\nimport type { ReactiveElement } from \"lit\";\n\n/**\n * # Design mode: the element is on the screen designer's canvas\n *\n * Resolution (turning an app's providers into buttons, narrowing identifiers,\n * injecting the brand logo) happens at serve time, on the server. The designer\n * has no app to resolve against, so an element placed there in its normal,\n * bare authored form would render its empty state: an empty provider grid, a\n * broken logo. That isn't neutral; it tells the author the element is broken.\n *\n * In design mode an element renders a **representative example** of itself\n * instead (pontive-spec 17 §1). It must not prune itself, inject real\n * configuration, or substitute `{{placeholders}}` (pont2 never does). Ported\n * from the legacy `designModeContext` (migration tracker F-32).\n *\n * `pont2-layout` provides it (`design-mode`), which is how the dashboard's\n * widget builder drives it. Its key is `pont2:design-mode`.\n *\n * Design mode is an authoring signal only: it never touches the branding\n * entitlement (the watermark), which has no override at all.\n */\nexport const designModeContext = createContext<boolean>(\"pont2:design-mode\");\n\n/**\n * Reads design mode for one element. An explicit `design-mode` attribute on the\n * element wins (`design-mode` or `design-mode=\"true\"` on; `design-mode=\"false\"`\n * off), so a story or a standalone demo can show the design rendering without a\n * layout. Otherwise the nearest provider decides.\n */\nexport class DesignModeController {\n private consumer: ContextConsumer<typeof designModeContext, ReactiveElement>;\n\n constructor(private readonly host: ReactiveElement) {\n this.consumer = new ContextConsumer(host, { context: designModeContext, subscribe: true });\n }\n\n /** Whether the element should render its design-mode example. */\n get active(): boolean {\n if (this.host.hasAttribute(\"design-mode\")) return this.host.getAttribute(\"design-mode\") !== \"false\";\n return this.consumer.value ?? false;\n }\n}\n","let counter = 0;\n\n/** A document-unique id, e.g. `pont2-field-3`. Like React's `useId()`. */\nexport function uid(scope = \"id\"): string {\n counter += 1;\n return `pont2-${scope}-${counter}`;\n}\n\n/** Returns `el.id`, assigning a fresh `uid(scope)` first if it has none. */\nexport function ensureId(el: Element, scope = \"id\"): string {\n if (!el.id) el.id = uid(scope);\n return el.id;\n}\n\n/** Adds/removes an id in a space-separated IDREF list attribute (aria-describedby etc.). */\nexport function toggleIdRef(el: Element, attr: string, id: string, on: boolean): void {\n const ids = new Set((el.getAttribute(attr) ?? \"\").split(/\\s+/).filter(Boolean));\n if (on) ids.add(id);\n else ids.delete(id);\n if (ids.size) el.setAttribute(attr, [...ids].join(\" \"));\n else el.removeAttribute(attr);\n}\n","/**\n * Event conventions (docs/02-conventions.md, \"Events\"):\n *\n * - Value-holding widgets fire the platform's own `input` (while the value\n * changes through interaction) and `change` (when it is committed), both\n * bubbling, exactly like native controls. The new value is read from the\n * target (`e.target.checked`, `e.target.value`), so `@change=${…}` in Lit,\n * `onChange` via @lit/react and `addEventListener(\"change\")` all work.\n * - Anything without a native equivalent is a `pont2-<name>` CustomEvent with\n * a typed `detail`, bubbling and composed. Base UI's `onOpenChange(open,\n * details)` becomes `pont2-open-change` with `{ open, reason }`; it is\n * cancelable, and `preventDefault()` keeps the current state (Base UI's\n * `eventDetails.cancel()`).\n * - Events fire only for user-initiated changes, never for property writes,\n * matching native controls (and Base UI's controlled props).\n */\nexport function fireNative(target: EventTarget, type: \"input\" | \"change\"): void {\n target.dispatchEvent(new Event(type, { bubbles: true, composed: type === \"input\" }));\n}\n\nexport function fire<T>(target: EventTarget, type: `pont2-${string}`, detail: T, cancelable = false): boolean {\n return target.dispatchEvent(new CustomEvent<T>(type, { detail, bubbles: true, composed: true, cancelable }));\n}\n\nexport type OpenChangeReason =\n | \"trigger-press\"\n | \"trigger-hover\"\n | \"trigger-focus\"\n | \"outside-press\"\n | \"escape-key\"\n | \"item-press\"\n | \"list-navigation\"\n | \"input-change\"\n | \"focus-out\"\n | \"close-press\"\n | \"imperative\";\n\nexport interface OpenChangeDetail {\n open: boolean;\n reason: OpenChangeReason;\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n \"pont2-open-change\": CustomEvent<OpenChangeDetail>;\n }\n}\n","import { html, svg, type SVGTemplateResult, type TemplateResult } from \"lit\";\n\nimport { attrs, type AttrMap } from \"./attrs\";\n\n/**\n * The handful of icons primitives draw themselves (check marks, chevrons,\n * the spinner). shadcn renders these with lucide-react through an\n * `IconPlaceholder`; pont2 inlines the same lucide geometry so it has no icon\n * dependency. Lucide is ISC-licensed (https://lucide.dev/license).\n *\n * Every icon is `aria-hidden` and sized by the component's CSS, as in shadcn\n * (`[&_svg:not([class*='size-'])]:size-4`). Consumers can pass their own SVG\n * anywhere an icon is accepted.\n *\n * Each icon takes optional extra attributes for the `<svg>` itself, e.g.\n * shadcn's button icon marker: `icons.arrowRight({ \"data-icon\": \"inline-end\" })`.\n */\nconst icon = (name: string, body: SVGTemplateResult, extra: AttrMap = {}) => html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n data-icon-name=${name}\n ${attrs(extra)}\n>${body}</svg>`;\n\n// Bodies use Lit's `svg` tag: a nested template is parsed on its own, so an\n// `html` fragment would create <path> in the HTML namespace and draw nothing.\nexport const icons = {\n check: (a?: AttrMap) => icon(\"check\", svg`<path d=\"M20 6 9 17l-5-5\" />`, a),\n minus: (a?: AttrMap) => icon(\"minus\", svg`<path d=\"M5 12h14\" />`, a),\n x: (a?: AttrMap) => icon(\"x\", svg`<path d=\"M18 6 6 18\" /><path d=\"m6 6 12 12\" />`, a),\n chevronDown: (a?: AttrMap) => icon(\"chevron-down\", svg`<path d=\"m6 9 6 6 6-6\" />`, a),\n chevronUp: (a?: AttrMap) => icon(\"chevron-up\", svg`<path d=\"m18 15-6-6-6 6\" />`, a),\n chevronRight: (a?: AttrMap) => icon(\"chevron-right\", svg`<path d=\"m9 18 6-6-6-6\" />`, a),\n chevronLeft: (a?: AttrMap) => icon(\"chevron-left\", svg`<path d=\"m15 18-6-6 6-6\" />`, a),\n chevronsUpDown: (a?: AttrMap) =>\n icon(\"chevrons-up-down\", svg`<path d=\"m7 15 5 5 5-5\" /><path d=\"m7 9 5-5 5 5\" />`, a),\n ellipsis: (a?: AttrMap) =>\n icon(\"ellipsis\", svg`<circle cx=\"12\" cy=\"12\" r=\"1\" /><circle cx=\"19\" cy=\"12\" r=\"1\" /><circle cx=\"5\" cy=\"12\" r=\"1\" />`, a),\n arrowUp: (a?: AttrMap) => icon(\"arrow-up\", svg`<path d=\"m5 12 7-7 7 7\" /><path d=\"M12 19V5\" />`, a),\n arrowDown: (a?: AttrMap) => icon(\"arrow-down\", svg`<path d=\"M12 5v14\" /><path d=\"m19 12-7 7-7-7\" />`, a),\n arrowUpDown: (a?: AttrMap) =>\n icon(\"arrow-up-down\", svg`<path d=\"m21 16-4 4-4-4\" /><path d=\"M17 20V4\" /><path d=\"m3 8 4-4 4 4\" /><path d=\"M7 4v16\" />`, a),\n listFilter: (a?: AttrMap) => icon(\"list-filter\", svg`<path d=\"M3 6h18\" /><path d=\"M7 12h10\" /><path d=\"M10 18h4\" />`, a),\n search: (a?: AttrMap) => icon(\"search\", svg`<path d=\"m21 21-4.34-4.34\" /><circle cx=\"11\" cy=\"11\" r=\"8\" />`, a),\n circle: (a?: AttrMap) => icon(\"circle\", svg`<circle cx=\"12\" cy=\"12\" r=\"10\" />`, a),\n octagonX: (a?: AttrMap) =>\n icon(\n \"octagon-x\",\n svg`<path d=\"m15 9-6 6\" /><path d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\" /><path d=\"m9 9 6 6\" />`,\n a,\n ),\n loaderCircle: (a?: AttrMap) => icon(\"loader-circle\", svg`<path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />`, a),\n circleAlert: (a?: AttrMap) =>\n icon(\n \"circle-alert\",\n svg`<circle cx=\"12\" cy=\"12\" r=\"10\" /><line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" /><line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />`,\n a,\n ),\n circleX: (a?: AttrMap) =>\n icon(\"circle-x\", svg`<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m15 9-6 6\" /><path d=\"m9 9 6 6\" />`, a),\n circleCheck: (a?: AttrMap) =>\n icon(\"circle-check\", svg`<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m9 12 2 2 4-4\" />`, a),\n triangleAlert: (a?: AttrMap) =>\n icon(\n \"triangle-alert\",\n svg`<path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" /><path d=\"M12 9v4\" /><path d=\"M12 17h.01\" />`,\n a,\n ),\n info: (a?: AttrMap) =>\n icon(\"info\", svg`<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"M12 16v-4\" /><path d=\"M12 8h.01\" />`, a),\n eye: (a?: AttrMap) =>\n icon(\n \"eye\",\n svg`<path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" /><circle cx=\"12\" cy=\"12\" r=\"3\" />`,\n a,\n ),\n eyeOff: (a?: AttrMap) =>\n icon(\n \"eye-off\",\n svg`<path d=\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\" /><path d=\"M14.084 14.158a3 3 0 0 1-4.242-4.242\" /><path d=\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\" /><path d=\"m2 2 20 20\" />`,\n a,\n ),\n pencil: (a?: AttrMap) =>\n icon(\n \"pencil\",\n svg`<path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" /><path d=\"m15 5 4 4\" />`,\n a,\n ),\n copy: (a?: AttrMap) =>\n icon(\n \"copy\",\n svg`<rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" /><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />`,\n a,\n ),\n download: (a?: AttrMap) =>\n icon(\n \"download\",\n svg`<path d=\"M12 15V3\" /><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" /><path d=\"m7 10 5 5 5-5\" />`,\n a,\n ),\n arrowRight: (a?: AttrMap) => icon(\"arrow-right\", svg`<path d=\"M5 12h14\" /><path d=\"m12 5 7 7-7 7\" />`, a),\n userRoundKey: (a?: AttrMap) =>\n icon(\n \"user-round-key\",\n svg`<path d=\"M19 11v6\" /><path d=\"M19 13h2\" /><path d=\"M2 21a8 8 0 0 1 12.868-6.349\" /><circle cx=\"10\" cy=\"8\" r=\"5\" /><circle cx=\"19\" cy=\"19\" r=\"2\" />`,\n a,\n ),\n} satisfies Record<string, (a?: AttrMap) => TemplateResult>;\n\nexport type IconName = keyof typeof icons;\n","import type { ReactiveController, ReactiveControllerHost } from \"lit\";\n\n/**\n * # The kit's own words: a message table (decision D8 of the migration plan)\n *\n * Text no render spec carries, which a kit element writes itself: a connection\n * error, \"Start again\", the password toggle's and the spinner's labels. The\n * sign-in runtime sends it with every flow response, already in the flow's\n * language and the instance's wording (branding-svc `pkg/message`, the codes\n * marked Client; the SDK exposes them as `messages` on start results and flow\n * events). Whatever receives a set calls `setMessages`, and every place that\n * would write English reads `msg(code)` instead.\n *\n * English is the fallback. It is only needed before the page has heard from the\n * server, for example when a flow fails to start because the network is down.\n * Once a set has arrived it is kept, so a later failure that never reaches the\n * server is still worded in the page's language.\n *\n * The table is **page-wide**, as in the legacy kit (`src/i18n/messages.ts`,\n * ported, carry-over §2): every widget on a page speaks the same language, and\n * a set one widget receives (or a stopped instance's refusal, §6) applies to all.\n * Elements that render `msg()` add a `MessagesController`, so text that arrives\n * after they first rendered reaches them.\n *\n * The account widgets' codes (carry-over §3) join this table when they are\n * built (migration tracker I-2, W-7…W-10).\n */\n\nexport const KIT_MESSAGES_EN = {\n connection_failed: \"We couldn't reach the server. Check your connection and try again.\",\n too_many_attempts: \"Too many attempts. Try again later.\",\n server_error: \"Something went wrong on our side. Please try again.\",\n instance_unavailable: \"This app isn't available right now.\",\n generic_error: \"Something went wrong. Please try again.\",\n flow_ended: \"This sign-in could not be completed.\",\n passkey_cancelled: \"The passkey request was cancelled or timed out. Please try again.\",\n start_again: \"Start again\",\n continued_elsewhere_title: \"You continued in another tab\",\n continued_elsewhere_subtitle: \"You can close this one.\",\n continue_here: \"Continue here instead\",\n show_password: \"Show password\",\n hide_password: \"Hide password\",\n loading: \"Loading\",\n // Primitives and kit composites the account widgets use (tracker W-11, I-4).\n action_close: \"Close\",\n action_remove: \"Remove\",\n notifications: \"Notifications\",\n pagination: \"Pagination\",\n pagination_previous: \"Previous\",\n pagination_next: \"Next\",\n pagination_previous_page: \"Go to previous page\",\n pagination_next_page: \"Go to next page\",\n pagination_more: \"More pages\",\n no_results: \"No results.\",\n actions_menu: \"Actions\",\n sort_ascending: \"Sort ascending\",\n sort_descending: \"Sort descending\",\n filter: \"Filter\",\n clear_filters: \"Clear filters\",\n invalid_emails: \"Not valid email addresses:\",\n email_limit_reached: \"No more addresses can be added.\",\n invite_emails_placeholder: \"Type or paste email addresses\",\n invite_emails_required: \"Enter at least one email address.\",\n search_roles: \"Search roles\",\n no_options: \"Nothing found.\",\n} as const;\n\nexport type KitMessageCode = keyof typeof KIT_MESSAGES_EN;\n\nlet current: Partial<Record<string, string>> = {};\nlet currentLocaleTag: string | undefined;\nconst listeners = new Set<() => void>();\n\n/**\n * Records a set the server sent. Sets merge (a flow response and, later, the\n * widget-messages read carry different codes for the same language). An empty or\n * missing set changes nothing: a response without one says nothing about the\n * language having changed.\n */\nexport function setMessages(messages?: Record<string, string> | null, locale?: string): void {\n if (!messages || Object.keys(messages).length === 0) return;\n current = { ...current, ...messages };\n if (locale) currentLocaleTag = locale;\n listeners.forEach(listener => listener());\n}\n\n/**\n * The text for a code in the language the page was last served in. A code\n * outside the kit's table needs a `fallback`; without one, the code itself is\n * returned (visible, rather than an empty string).\n */\nexport function msg(code: KitMessageCode): string;\nexport function msg(code: string, fallback: string): string;\nexport function msg(code: string, fallback?: string): string {\n const text = current[code]?.trim();\n return text || fallback || (KIT_MESSAGES_EN as Record<string, string>)[code] || code;\n}\n\n/** The language the page was last served in, for formatting; undefined until the server has said. */\nexport function currentLocale(): string | undefined {\n return currentLocaleTag;\n}\n\n/** Calls `listener` whenever a set arrives. Returns the unsubscribe. */\nexport function onMessagesChanged(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\n/** Forgets every set. For tests and stories. */\nexport function resetMessages(): void {\n current = {};\n currentLocaleTag = undefined;\n listeners.forEach(listener => listener());\n}\n\n/** Re-renders its host whenever a set arrives. Add it to every element that renders `msg()`. */\nexport class MessagesController implements ReactiveController {\n private unsubscribe?: () => void;\n\n constructor(private readonly host: ReactiveControllerHost) {\n host.addController(this);\n }\n\n hostConnected(): void {\n this.unsubscribe = onMessagesChanged(() => this.host.requestUpdate());\n }\n\n hostDisconnected(): void {\n this.unsubscribe?.();\n this.unsubscribe = undefined;\n }\n}\n","/**\n * URLs a kit element may navigate to or link to.\n *\n * Render specs and attributes are data, so an `href` or a redirect target can\n * be anything, including `javascript:` or `data:`. Every element that turns\n * one into navigation (`pont2-link[href]`, `pont2-countdown[redirect-url]`)\n * goes through `safeUrl` and treats `null` as \"don't navigate\".\n */\n\n/** Resolves `raw` against `base` (the page) and accepts only http(s); otherwise `null`. */\nexport function safeUrl(raw: string | null | undefined, base = globalThis.location?.href): string | null {\n if (!raw) return null;\n try {\n const url = new URL(raw, base);\n return url.protocol === \"http:\" || url.protocol === \"https:\" ? url.href : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Stricter than `safeUrl`: an **absolute** http(s) URL with a host, or `null`.\n * For links to pages outside the flow (`pont2-external-link`), whose href is\n * usually a server placeholder filled from the app's settings\n * (`{{consent_privacy_policy_url}}`): empty, still a placeholder, relative or\n * a code-running scheme must not become a link. The legacy\n * `safeExternalHref`, ported.\n */\nexport function safeExternalUrl(raw: unknown): string | null {\n if (typeof raw !== \"string\") return null;\n const value = raw.trim();\n if (!value) return null;\n let url: URL;\n try {\n url = new URL(value);\n } catch {\n return null;\n }\n if (url.protocol !== \"https:\" && url.protocol !== \"http:\") return null;\n return url.hostname ? url.href : null;\n}\n","import type { ReactiveController, ReactiveControllerHost } from \"lit\";\n\nexport type Orientation = \"horizontal\" | \"vertical\" | \"both\";\n\nexport interface RovingFocusOptions {\n /** Candidate items, in DOM order. Called on every key press, so it may query live. */\n items: () => HTMLElement[];\n orientation?: () => Orientation;\n /** Wrap from last to first (Base UI `loopFocus`, default true). */\n loop?: () => boolean;\n /** Items to skip. Default: `[data-disabled]` / `aria-disabled=\"true\"` / `:disabled`. */\n isDisabled?: (item: HTMLElement) => boolean;\n /** Called after focus moves through the keyboard (radio/tabs use it to activate). */\n onNavigate?: (item: HTMLElement, event: KeyboardEvent) => void;\n}\n\n/** `ltr` unless the nearest `[dir]` ancestor (or the document) says `rtl`. */\nexport function directionOf(el: Element): \"ltr\" | \"rtl\" {\n const owner = el.closest(\"[dir]\");\n const dir = (owner?.getAttribute(\"dir\") ?? document.documentElement.dir ?? \"\").toLowerCase();\n return dir === \"rtl\" ? \"rtl\" : \"ltr\";\n}\n\nconst defaultDisabled = (el: HTMLElement) =>\n el.hasAttribute(\"data-disabled\") ||\n el.getAttribute(\"aria-disabled\") === \"true\" ||\n (el as HTMLButtonElement).disabled === true;\n\n/**\n * Roving tabindex (WAI-ARIA APG \"managing focus within composites\"): exactly\n * one item is a tab stop (`tabindex=\"0\"`), the rest are `-1`, and arrow keys,\n * Home and End move focus between them. Used by RadioGroup, Tabs, ToggleGroup\n * and menus, which is what Base UI's `CompositeRoot` does internally.\n *\n * The host calls `sync(active)` whenever the \"current\" item may have\n * changed (selection, items added or removed).\n */\nexport class RovingFocusController implements ReactiveController {\n private readonly opts: Required<Omit<RovingFocusOptions, \"onNavigate\">> &\n Pick<RovingFocusOptions, \"onNavigate\">;\n\n constructor(\n private readonly host: ReactiveControllerHost & HTMLElement,\n options: RovingFocusOptions,\n ) {\n this.opts = {\n orientation: () => \"both\",\n loop: () => true,\n isDisabled: defaultDisabled,\n ...options,\n };\n host.addController(this);\n }\n\n hostConnected(): void {\n this.host.addEventListener(\"keydown\", this.onKeyDown);\n this.host.addEventListener(\"focusin\", this.onFocusIn);\n }\n\n hostDisconnected(): void {\n this.host.removeEventListener(\"keydown\", this.onKeyDown);\n this.host.removeEventListener(\"focusin\", this.onFocusIn);\n }\n\n /** Make `active` (or the first enabled item) the single tab stop. */\n sync(active?: HTMLElement | null): void {\n const items = this.opts.items();\n const enabled = items.filter(i => !this.opts.isDisabled(i));\n const stop = active && enabled.includes(active) ? active : enabled[0];\n for (const item of items) item.tabIndex = item === stop ? 0 : -1;\n }\n\n /** Focus an item and make it the tab stop. */\n focus(item: HTMLElement, options?: FocusOptions): void {\n this.sync(item);\n item.focus(options);\n }\n\n private onFocusIn = (e: FocusEvent) => {\n const items = this.opts.items();\n const item = items.find(i => i === e.target || i.contains(e.target as Node));\n if (item && !this.opts.isDisabled(item)) this.sync(item);\n };\n\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) return;\n const items = this.opts.items();\n const current = items.findIndex(i => i === e.target || i.contains(e.target as Node));\n if (current < 0) return;\n\n const orientation = this.opts.orientation();\n const rtl = directionOf(this.host) === \"rtl\";\n const horizontal = orientation !== \"vertical\";\n const vertical = orientation !== \"horizontal\";\n\n let step: 1 | -1 | \"first\" | \"last\" | 0 = 0;\n switch (e.key) {\n case \"ArrowRight\":\n if (horizontal) step = rtl ? -1 : 1;\n break;\n case \"ArrowLeft\":\n if (horizontal) step = rtl ? 1 : -1;\n break;\n case \"ArrowDown\":\n if (vertical) step = 1;\n break;\n case \"ArrowUp\":\n if (vertical) step = -1;\n break;\n case \"Home\":\n step = \"first\";\n break;\n case \"End\":\n step = \"last\";\n break;\n }\n if (step === 0) return;\n\n const next = this.findNext(items, current, step);\n if (!next) return;\n e.preventDefault();\n this.focus(next);\n this.opts.onNavigate?.(next, e);\n };\n\n private findNext(items: HTMLElement[], from: number, step: 1 | -1 | \"first\" | \"last\") {\n const ok = (i: HTMLElement) => !this.opts.isDisabled(i);\n if (step === \"first\") return items.find(ok);\n if (step === \"last\") return [...items].reverse().find(ok);\n\n const n = items.length;\n const loop = this.opts.loop();\n for (let k = 1; k <= n; k++) {\n let i = from + step * k;\n if (loop) i = (i + n) % n;\n else if (i < 0 || i >= n) return undefined;\n if (ok(items[i])) return items[i];\n }\n return undefined;\n }\n}\n","import type { ReactiveController, ReactiveControllerHost } from \"lit\";\n\nimport { fire } from \"../events\";\n\n/**\n * # The action protocol: `pont2-action` + `respondWith()`\n *\n * Some elements start asynchronous work they must not own: a sign-in button\n * starts a login-flow step, but the network call, the session and the next\n * screen belong to whatever hosts the flow (a widget, a layout, the app).\n * The element asks; an ancestor answers.\n *\n * ```\n * element ── pont2-action { action, data, respondWith } ──▶ ancestor (bubbles, composed)\n * ancestor calls detail.respondWith(promise)\n * element: busy until the promise settles\n * element ── pont2-action-success { action, data, result } ──▶\n * or pont2-action-error { action, data, error, message } ──▶\n * ```\n *\n * `respondWith()` must be called **synchronously, inside the listener** (as in\n * a service worker's `FetchEvent`). That is deliberate: the dispatch happens\n * inside the user's click, so work started in the listener still has the\n * click's *transient user activation*, which WebAuthn (passkeys) and\n * `window.open` (OAuth popups) require. Starting the work after an `await`\n * would lose it.\n *\n * ```ts\n * widget.addEventListener(\"pont2-action\", e => {\n * if (e.detail.action) e.detail.respondWith(Auth.processLoginflowEvent({ event: e.detail.action }));\n * });\n * ```\n *\n * Nobody responding is valid: the request event doubles as a click\n * notification (the legacy kit's `<tag>:click`), and an element may then fall\n * back to native behaviour (a submit button lets its form submit).\n *\n * Why an event and not an import: pont2 depends on no auth client, any\n * framework can answer a DOM event, Storybook and tests answer with a fake,\n * and the element never needs to know who is listening (docs/kit/auth-button.md).\n */\n\nexport interface ActionRequestDetail<D = Record<string, unknown>> {\n /** What to do, e.g. a login-flow event id. May be absent (a plain click notification). */\n action: string | undefined;\n /** Context from the element (the provider, the form data…). */\n data: D;\n /** Hand the element the work's promise. Only valid during dispatch, at most once. */\n respondWith(response: unknown): void;\n}\n\nexport interface ActionSuccessDetail<D = Record<string, unknown>> {\n action: string | undefined;\n data: D;\n result: unknown;\n}\n\nexport interface ActionErrorDetail<D = Record<string, unknown>> {\n action: string | undefined;\n data: D;\n error: unknown;\n message: string;\n}\n\nexport class ActionController implements ReactiveController {\n /** True while a response is pending. The host re-renders when it changes. */\n busy = false;\n\n constructor(private host: ReactiveControllerHost & HTMLElement) {\n host.addController(this);\n }\n\n hostConnected(): void {}\n\n /**\n * Fires `pont2-action` from the host. Returns `true` if a listener called\n * `respondWith()` (the element is now busy), `false` otherwise or when\n * already busy (one request at a time).\n */\n request<D extends Record<string, unknown>>(action: string | undefined, data: D): boolean {\n if (this.busy) return false;\n let response: Promise<unknown> | undefined;\n let open = true;\n const detail: ActionRequestDetail<D> = {\n action,\n data,\n respondWith: value => {\n if (!open) throw new DOMException(\"respondWith() must be called synchronously in the listener.\", \"InvalidStateError\");\n if (response) throw new DOMException(\"respondWith() was already called.\", \"InvalidStateError\");\n response = Promise.resolve(value);\n },\n };\n fire(this.host, \"pont2-action\", detail);\n open = false;\n if (!response) return false;\n void this.track(action, data, response);\n return true;\n }\n\n private async track<D>(action: string | undefined, data: D, response: Promise<unknown>): Promise<void> {\n this.setBusy(true);\n try {\n const result = await response;\n fire<ActionSuccessDetail<D>>(this.host, \"pont2-action-success\", { action, data, result });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n fire<ActionErrorDetail<D>>(this.host, \"pont2-action-error\", { action, data, error, message });\n } finally {\n this.setBusy(false);\n }\n }\n\n private setBusy(on: boolean): void {\n this.busy = on;\n this.host.requestUpdate();\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n \"pont2-action\": CustomEvent<ActionRequestDetail>;\n \"pont2-action-success\": CustomEvent<ActionSuccessDetail>;\n \"pont2-action-error\": CustomEvent<ActionErrorDetail>;\n }\n}\n","import type { ReactiveController, ReactiveControllerHost } from \"lit\";\n\nimport { fire } from \"../events\";\n\nexport interface CopiedDetail {\n /** What was copied, e.g. \"secret\", \"recovery-codes\". Never the copied text. */\n kind: string;\n}\n\nexport interface CopyErrorDetail {\n kind: string;\n error: unknown;\n}\n\n/**\n * Copy-to-clipboard with transient \"copied\" feedback.\n *\n * `copy(text)` writes to the clipboard, sets `copied` for `duration` ms (the\n * host re-renders), and fires `pont2-copied` / `pont2-copy-error`. The events\n * deliberately carry no text: what gets copied here is secret (TOTP secrets,\n * recovery codes), and events are observable by any script on the page.\n */\nexport class CopyController implements ReactiveController {\n copied = false;\n private timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor(\n private host: ReactiveControllerHost & HTMLElement,\n private kind: string,\n private duration = 2000,\n ) {\n host.addController(this);\n }\n\n hostConnected(): void {}\n\n hostDisconnected(): void {\n if (this.timer !== undefined) clearTimeout(this.timer);\n }\n\n async copy(text: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(text);\n } catch (error) {\n fire<CopyErrorDetail>(this.host, \"pont2-copy-error\", { kind: this.kind, error });\n return false;\n }\n this.copied = true;\n this.host.requestUpdate();\n if (this.timer !== undefined) clearTimeout(this.timer);\n this.timer = setTimeout(() => {\n this.copied = false;\n this.timer = undefined;\n this.host.requestUpdate();\n }, this.duration);\n fire<CopiedDetail>(this.host, \"pont2-copied\", { kind: this.kind });\n return true;\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n \"pont2-copied\": CustomEvent<CopiedDetail>;\n \"pont2-copy-error\": CustomEvent<CopyErrorDetail>;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const BADGE_VARIANTS = [\"default\", \"secondary\", \"destructive\", \"outline\", \"ghost\", \"link\"] as const;\nexport type BadgeVariant = (typeof BADGE_VARIANTS)[number];\n\n/**\n * # Badge: Tier 1 (structural)\n *\n * shadcn: `<Badge variant>` → Base UI `useRender({ defaultTagName: \"span\" })`\n * → `<span data-slot=\"badge\" data-variant>`; with `render={<a/>}` it becomes\n * a link.\n *\n * pont2: `<pont2-prim-badge>` **is** the span. For a link badge, put the recipe on\n * a real anchor: `<a data-pont2-badge data-variant=\"outline\" href=\"…\">`.\n *\n * @tag pont2-prim-badge\n * @attr variant - default | secondary | destructive | outline | ghost | link\n */\nexport class Badge extends HostElement {\n static override identity = \"badge\";\n static override slotName = \"badge\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n\n declare variant: BadgeVariant;\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\ndefine(\"pont2-prim-badge\", Badge);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-badge\": Badge;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { NativeEnhancer, ShellElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Button: Tier 3 (native-bound)\n *\n * shadcn: `<Button variant size>` → Base UI `<Button>` → a native `<button>`\n * (or, through `render`, the author's `<a>`), with `data-slot=\"button\"`.\n *\n * A button's root must stay native: implicit form submission,\n * `SubmitEvent.submitter`, `name=value` in FormData, password-manager\n * heuristics, middle-click on links. So the styled element is always a native\n * `<button>`/`<a>`, reachable four ways that all share one recipe\n * (button.css, keyed on `[data-pont2-button]`):\n *\n * | Entry point | You write | DOM nodes |\n * |-------------|------------------------------------------------------------------|-----------|\n * | Recipe | `<button data-pont2-button data-variant=\"outline\">` | 1 |\n * | Part | `button({ variant: \"outline\" }, content)` inside a Lit template | 1 |\n * | Enhancer | `<pont2-prim-button variant=\"outline\"><button>…</button></pont2-prim-button>` | shell + 1 |\n * | Base class | `class ProviderButton extends ButtonBase` | shell + 1 |\n */\n\nexport const BUTTON_VARIANTS = [\"default\", \"outline\", \"secondary\", \"ghost\", \"destructive\", \"link\"] as const;\nexport const BUTTON_SIZES = [\"default\", \"xs\", \"sm\", \"lg\", \"icon\", \"icon-xs\", \"icon-sm\", \"icon-lg\"] as const;\nexport type ButtonVariant = (typeof BUTTON_VARIANTS)[number];\nexport type ButtonSize = (typeof BUTTON_SIZES)[number];\n\nexport interface ButtonRecipe {\n variant?: ButtonVariant;\n size?: ButtonSize;\n disabled?: boolean;\n /**\n * Base UI `focusableWhenDisabled`: stay in the tab order while disabled\n * (`aria-disabled` instead of `disabled`). Use it for loading states, so\n * focus is not lost mid-submit.\n */\n focusableWhenDisabled?: boolean;\n}\n\nexport interface ButtonOptions extends ButtonRecipe {\n type?: \"button\" | \"submit\" | \"reset\";\n name?: string;\n value?: string;\n /** Renders an `<a>` instead of a `<button>` (shadcn `render={<a/>}`). */\n href?: string;\n target?: string;\n rel?: string;\n /** Overrides `data-slot` (shadcn `<Button data-slot=\"…\">`). */\n slot?: string;\n /** Extra attributes on the same native element: the `{...props}` spread. */\n attrs?: AttrMap;\n onClick?: (e: MouseEvent) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Recipe (imperative): for code that holds a node */\n/* ------------------------------------------------------------------ */\n\nexport function applyButton(el: HTMLElement, o: ButtonRecipe): void {\n if (!el.hasAttribute(\"data-pont2-button\")) el.setAttribute(\"data-pont2-button\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", \"button\");\n el.setAttribute(\"data-variant\", o.variant ?? \"default\");\n el.setAttribute(\"data-size\", o.size ?? \"default\");\n\n const disabled = !!o.disabled;\n const native = el instanceof HTMLButtonElement;\n el.toggleAttribute(\"data-disabled\", disabled);\n\n if (native && !o.focusableWhenDisabled) {\n el.disabled = disabled;\n el.removeAttribute(\"aria-disabled\");\n } else {\n if (native) el.disabled = false;\n if (disabled) el.setAttribute(\"aria-disabled\", \"true\");\n else el.removeAttribute(\"aria-disabled\");\n // A disabled link leaves the tab order unless it should stay focusable.\n if (!native) {\n if (disabled && !o.focusableWhenDisabled) el.tabIndex = -1;\n else el.removeAttribute(\"tabindex\");\n }\n }\n}\n\n/** True when a click on `el` must be swallowed (aria-disabled buttons and links). */\nexport function isSoftDisabled(el: Element): boolean {\n return el.getAttribute(\"aria-disabled\") === \"true\" || el.hasAttribute(\"data-disabled\");\n}\n\n/* ------------------------------------------------------------------ */\n/* Part: a template function, the counterpart of a React component */\n/* ------------------------------------------------------------------ */\n\nexport function button(o: ButtonOptions, content: unknown) {\n const variant = o.variant ?? \"default\";\n const size = o.size ?? \"default\";\n const slot = o.slot ?? \"button\";\n const disabled = !!o.disabled;\n const soft = disabled && (o.focusableWhenDisabled || o.href !== undefined);\n\n const onClick = (e: MouseEvent) => {\n if (soft) {\n e.preventDefault();\n e.stopImmediatePropagation();\n return;\n }\n o.onClick?.(e);\n };\n\n if (o.href !== undefined) {\n return html`<a\n data-pont2-button\n data-slot=${slot}\n data-variant=${variant}\n data-size=${size}\n href=${o.href}\n target=${o.target ?? nothing}\n rel=${o.rel ?? nothing}\n ?data-disabled=${disabled}\n aria-disabled=${disabled ? \"true\" : nothing}\n tabindex=${disabled && !o.focusableWhenDisabled ? \"-1\" : nothing}\n ${attrs(o.attrs ?? {})}\n @click=${onClick}\n >${content}</a\n >`;\n }\n\n return html`<button\n data-pont2-button\n data-slot=${slot}\n data-variant=${variant}\n data-size=${size}\n type=${o.type ?? \"button\"}\n name=${o.name ?? nothing}\n .value=${o.value ?? \"\"}\n ?disabled=${disabled && !o.focusableWhenDisabled}\n ?data-disabled=${disabled}\n aria-disabled=${soft ? \"true\" : nothing}\n ${attrs(o.attrs ?? {})}\n @click=${onClick}\n >${content}</button>`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Shared reactive properties */\n/* ------------------------------------------------------------------ */\n\nconst recipeProperties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n focusableWhenDisabled: { type: Boolean, attribute: \"focusable-when-disabled\" },\n};\n\n/* ------------------------------------------------------------------ */\n/* Element: enhancer (asChild) */\n/* ------------------------------------------------------------------ */\n\n/**\n * `<pont2-prim-button>`: applies the button recipe to the native `<button>` or\n * `<a>` you put inside it.\n *\n * ```html\n * <pont2-prim-button variant=\"outline\"><button type=\"submit\">Continue</button></pont2-prim-button>\n * <pont2-prim-button variant=\"link\"><a href=\"/forgot\">Forgot password?</a></pont2-prim-button>\n * ```\n *\n * @tag pont2-prim-button\n * @attr variant - default | outline | secondary | ghost | destructive | link\n * @attr size - default | xs | sm | lg | icon | icon-xs | icon-sm | icon-lg\n * @attr disabled - Disables the native child (or sets aria-disabled on a link).\n * @attr focusable-when-disabled - Keep the disabled button in the tab order.\n */\nexport class Pont2Button extends NativeEnhancer<HTMLButtonElement | HTMLAnchorElement> {\n static override nativeSelector = \"button, a\";\n static override properties = recipeProperties;\n\n declare variant: ButtonVariant;\n declare size: ButtonSize;\n declare disabled: boolean;\n declare focusableWhenDisabled: boolean;\n\n constructor() {\n super();\n this.variant = \"default\";\n this.size = \"default\";\n this.disabled = false;\n this.focusableWhenDisabled = false;\n // Swallow clicks on soft-disabled controls before author listeners run.\n this.addEventListener(\"click\", this.guard, { capture: true });\n }\n\n private guard = (e: MouseEvent) => {\n const c = this.control;\n if (c && this.disabled && (c === e.target || c.contains(e.target as Node)) && isSoftDisabled(c)) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n };\n\n protected apply(control: HTMLButtonElement | HTMLAnchorElement): void {\n applyButton(control, this);\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Base class for compositions that ARE buttons */\n/* ------------------------------------------------------------------ */\n\n/**\n * Extend this when your component *is* a button whose content it generates\n * (a provider sign-in button, a submit button with a spinner). Subclasses\n * inherit `variant`/`size`/`disabled`/`type`/`href`… so nothing is forwarded\n * by hand; they implement `renderContent()` and may override\n * `buttonOptions()`. The DOM is always\n * `<host data-pont2-shell> > <button|a data-pont2-button>`.\n */\nexport abstract class ButtonBase extends ShellElement {\n static override properties: PropertyDeclarations = {\n ...recipeProperties,\n type: { type: String },\n name: { type: String },\n value: { type: String },\n href: { type: String },\n target: { type: String },\n rel: { type: String },\n };\n\n declare variant: ButtonVariant;\n declare size: ButtonSize;\n declare disabled: boolean;\n declare focusableWhenDisabled: boolean;\n declare type: \"button\" | \"submit\" | \"reset\";\n declare name?: string;\n declare value?: string;\n declare href?: string;\n declare target?: string;\n declare rel?: string;\n\n constructor() {\n super();\n this.variant = \"default\";\n this.size = \"default\";\n this.disabled = false;\n this.focusableWhenDisabled = false;\n this.type = \"button\";\n }\n\n /** The native element. Focus, tooltips and popovers anchor here, never on the shell. */\n override get control(): HTMLButtonElement | HTMLAnchorElement | null {\n return this.querySelector(\":scope > [data-pont2-button]\");\n }\n\n protected buttonOptions(): ButtonOptions {\n const { variant, size, type, name, value, disabled, focusableWhenDisabled, href, target, rel } = this;\n return { variant, size, type, name, value, disabled, focusableWhenDisabled, href, target, rel };\n }\n\n protected abstract renderContent(): unknown;\n\n override render() {\n return button(this.buttonOptions(), this.renderContent());\n }\n}\n\ndefine(\"pont2-prim-button\", Pont2Button);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-button\": Pont2Button;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement, type ValidityResult } from \"../../core/form-control\";\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Checkbox: Tier 2 (widget, form-associated)\n *\n * shadcn: `<Checkbox>` → Base UI `<Checkbox.Root>` (`<span role=\"checkbox\">`\n * plus a hidden `<input type=\"checkbox\">`) > `<Checkbox.Indicator>` > icon.\n *\n * pont2: the host **is** the `role=\"checkbox\"` root, and it is a\n * form-associated custom element, so there is no hidden input:\n *\n * ```\n * shadcn/Base UI: span[role=checkbox] > span[data-slot=checkbox-indicator] > svg + input[hidden]\n * pont2: pont2-prim-checkbox > span[data-slot=checkbox-indicator] > svg\n * ```\n *\n * State attributes are Base UI's: `data-checked` | `data-unchecked`,\n * `data-indeterminate`, `data-disabled`, `data-readonly`, `data-required`.\n * The CustomStateSet mirrors them (`:state(checked)`).\n *\n * @tag pont2-prim-checkbox\n * @attr checked - Initial checked state (`defaultChecked`); `.checked` is the live state.\n * @attr indeterminate - Mixed state (`aria-checked=\"mixed\"`).\n * @attr name, value, unchecked-value, disabled, required, readonly\n * @fires input - The checked state changed through interaction.\n * @fires change - Same moment as `input`, like a native checkbox.\n */\nexport class Checkbox extends FormControlElement {\n static override identity = \"checkbox\";\n static override slotName = \"checkbox\";\n static override role = \"checkbox\";\n\n static override properties: PropertyDeclarations = {\n ...FormControlElement.properties,\n checked: { type: Boolean },\n indeterminate: { type: Boolean, reflect: true },\n value: { type: String },\n uncheckedValue: { type: String, attribute: \"unchecked-value\" },\n };\n\n declare checked: boolean;\n declare indeterminate: boolean;\n declare value: string;\n declare uncheckedValue: string | undefined;\n\n constructor() {\n super();\n this.checked = false;\n this.indeterminate = false;\n this.value = \"on\";\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"keyup\", this.onKeyUp);\n }\n\n /** Toggle as if the user clicked (fires input/change). */\n toggle(): void {\n if (this.isDisabled || this.readOnly) return;\n this.indeterminate = false;\n this.checked = !this.checked;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n protected formValue() {\n if (this.checked) return this.value;\n return this.uncheckedValue ?? null;\n }\n\n protected resetToDefault(): void {\n this.checked = this.hasAttribute(\"checked\");\n this.indeterminate = this.hasAttribute(\"indeterminate\");\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n this.checked = state === this.value;\n }\n\n protected override validate(): ValidityResult | null {\n if (this.required && !this.checked) {\n return { flags: { valueMissing: true }, message: \"Please tick this box if you want to proceed.\" };\n }\n return null;\n }\n\n private onClick = (e: MouseEvent) => {\n if (this.isDisabled || this.readOnly) {\n e.preventDefault();\n return;\n }\n this.toggle();\n };\n\n // Native checkboxes toggle on Space *keyup*; keydown is prevented so the page does not scroll.\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \" \" && e.target === this) e.preventDefault();\n };\n private onKeyUp = (e: KeyboardEvent) => {\n if (e.key === \" \" && e.target === this) this.click();\n };\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n const on = this.checked && !this.indeterminate;\n this.internals.ariaChecked = this.indeterminate ? \"mixed\" : String(this.checked);\n this.setData(\"checked\", on);\n this.setData(\"unchecked\", !this.checked && !this.indeterminate);\n this.setData(\"indeterminate\", this.indeterminate);\n this.setState(\"checked\", on);\n this.setState(\"indeterminate\", this.indeterminate);\n }\n\n override render() {\n if (!this.checked && !this.indeterminate) return nothing;\n // Base UI <Checkbox.Indicator> (not kept mounted when unchecked).\n return html`<span\n data-pont2-checkbox-indicator\n data-slot=\"checkbox-indicator\"\n ?data-checked=${this.checked && !this.indeterminate}\n ?data-indeterminate=${this.indeterminate}\n >${this.indeterminate ? icons.minus() : icons.check()}</span\n >`;\n }\n}\n\ndefine(\"pont2-prim-checkbox\", Checkbox);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-checkbox\": Checkbox;\n }\n}\n","import { html, nothing } from \"lit\";\nimport { live } from \"lit/directives/live.js\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Input: Tier 3 (native-bound)\n *\n * shadcn: `<Input>` → Base UI `<Input>` → a native `<input data-slot=\"input\">`.\n *\n * A sign-in kit's inputs must be native and in light DOM: autofill, password\n * managers, `autocomplete=\"one-time-code\"`, form submission, `<label for>`\n * and `aria-describedby` all depend on it.\n *\n * - recipe: `<input data-pont2-input type=\"email\" name=\"email\">`\n * - part: `input({ type: \"email\", name: \"email\" })`\n * - enhancer: `<pont2-prim-input><input type=\"email\" name=\"email\"></pont2-prim-input>`\n */\nexport interface InputOptions {\n id?: string;\n name?: string;\n type?: string;\n value?: string;\n placeholder?: string;\n autocomplete?: string;\n inputmode?: string;\n required?: boolean;\n disabled?: boolean;\n readonly?: boolean;\n invalid?: boolean;\n describedBy?: string;\n slot?: string;\n attrs?: AttrMap;\n onInput?: (e: InputEvent) => void;\n onChange?: (e: Event) => void;\n}\n\nexport function applyInput(el: HTMLInputElement, slot = \"input\"): void {\n if (!el.hasAttribute(\"data-pont2-input\")) el.setAttribute(\"data-pont2-input\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", slot);\n}\n\nexport function input(o: InputOptions = {}) {\n return html`<input\n data-pont2-input\n data-slot=${o.slot ?? \"input\"}\n id=${o.id ?? nothing}\n name=${o.name ?? nothing}\n type=${o.type ?? \"text\"}\n .value=${live(o.value ?? \"\")}\n placeholder=${o.placeholder ?? nothing}\n autocomplete=${(o.autocomplete as never) ?? nothing}\n inputmode=${(o.inputmode as never) ?? nothing}\n ?required=${o.required}\n ?disabled=${o.disabled}\n ?readonly=${o.readonly}\n aria-invalid=${o.invalid ? \"true\" : nothing}\n aria-describedby=${o.describedBy ?? nothing}\n ${attrs(o.attrs ?? {})}\n @input=${o.onInput ?? nothing}\n @change=${o.onChange ?? nothing}\n />`;\n}\n\n/**\n * @tag pont2-prim-input\n */\nexport class Pont2Input extends NativeEnhancer<HTMLInputElement> {\n static override nativeSelector = \"input\";\n protected apply(control: HTMLInputElement): void {\n applyInput(control);\n }\n}\n\ndefine(\"pont2-prim-input\", Pont2Input);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-input\": Pont2Input;\n }\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Kbd, KbdGroup: Tier 1 (structural)\n *\n * shadcn: `<Kbd>` → `<kbd data-slot=\"kbd\">`; `<KbdGroup>` → `<kbd data-slot=\"kbd-group\">`.\n *\n * pont2: the host is the key cap. `<kbd>` has no implicit ARIA role, so a\n * custom element loses no semantics here. (If you need the literal element,\n * use the recipe: `<kbd data-pont2-kbd>⌘</kbd>`.)\n *\n * @tag pont2-prim-kbd\n */\nexport class Kbd extends HostElement {\n static override identity = \"kbd\";\n static override slotName = \"kbd\";\n}\n\n/**\n * @tag pont2-prim-kbd-group\n */\nexport class KbdGroup extends HostElement {\n static override identity = \"kbd-group\";\n static override slotName = \"kbd-group\";\n}\n\ndefine(\"pont2-prim-kbd\", Kbd);\ndefine(\"pont2-prim-kbd-group\", KbdGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-kbd\": Kbd;\n \"pont2-prim-kbd-group\": KbdGroup;\n }\n}\n","import { html, nothing } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Label: Tier 3 (native-bound)\n *\n * shadcn: `<Label>` → a native `<label data-slot=\"label\">`.\n *\n * It must be a real `<label>`: `for=` association, click-to-focus, and\n * labelling form-associated custom elements (Checkbox, Switch …) only work\n * on the native element. So:\n *\n * - recipe: `<label data-pont2-label for=\"email\">Email</label>`\n * - part: `label({ for: \"email\" }, \"Email\")`\n * - enhancer: `<pont2-prim-label><label for=\"email\">Email</label></pont2-prim-label>`\n */\nexport interface LabelOptions {\n for?: string;\n id?: string;\n slot?: string;\n /** Extra identities, e.g. FieldLabel passes `[\"field-label\"]`. */\n identities?: string[];\n attrs?: AttrMap;\n}\n\nexport function applyLabel(el: HTMLLabelElement, slot = \"label\"): void {\n if (!el.hasAttribute(\"data-pont2-label\")) el.setAttribute(\"data-pont2-label\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", slot);\n}\n\nexport function label(o: LabelOptions, content: unknown) {\n const extra: AttrMap = {};\n for (const id of o.identities ?? []) extra[`data-pont2-${id}`] = true;\n return html`<label\n data-pont2-label\n data-slot=${o.slot ?? \"label\"}\n for=${o.for ?? nothing}\n id=${o.id ?? nothing}\n ${attrs({ ...extra, ...(o.attrs ?? {}) })}\n >${content}</label\n >`;\n}\n\n/**\n * @tag pont2-prim-label\n */\nexport class Pont2Label extends NativeEnhancer<HTMLLabelElement> {\n static override nativeSelector = \"label\";\n protected apply(control: HTMLLabelElement): void {\n applyLabel(control);\n }\n}\n\ndefine(\"pont2-prim-label\", Pont2Label);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-label\": Pont2Label;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type SeparatorOrientation = \"horizontal\" | \"vertical\";\n\n/**\n * # Separator: Tier 1 (structural)\n *\n * shadcn: `<Separator orientation>` → Base UI `<Separator>` →\n * `<div role=\"separator\" aria-orientation data-orientation data-slot=\"separator\">`.\n *\n * pont2: the host **is** that div. No `render()`, no children, one node.\n * Role and orientation are ElementInternals defaults, so an author's own\n * `role=\"none\"` (purely decorative rule) still wins.\n *\n * Subclass it to make a separator with another meaning, e.g.\n * `class ItemSeparator extends Separator { static identity = \"item-separator\" }`:\n * it keeps `data-pont2-separator` (the look) and gains its own slot.\n *\n * @tag pont2-prim-separator\n * @attr orientation - horizontal (default) | vertical\n */\nexport class Separator extends HostElement {\n static override identity = \"separator\";\n static override slotName = \"separator\";\n static override role = \"separator\";\n\n static override properties: PropertyDeclarations = {\n orientation: { type: String, reflect: true },\n };\n\n declare orientation: SeparatorOrientation;\n\n constructor() {\n super();\n this.orientation = \"horizontal\";\n }\n\n protected override willUpdate(): void {\n const o = this.orientation === \"vertical\" ? \"vertical\" : \"horizontal\";\n this.setData(\"orientation\", o);\n this.internals.ariaOrientation = o;\n }\n}\n\ndefine(\"pont2-prim-separator\", Separator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-separator\": Separator;\n }\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Skeleton: Tier 1 (structural)\n *\n * shadcn: `<Skeleton>` → `<div data-slot=\"skeleton\" class=\"animate-pulse bg-muted rounded-md\">`.\n * Size it with your own CSS (`style=\"width:12rem;height:1rem\"` or a class).\n *\n * @tag pont2-prim-skeleton\n */\nexport class Skeleton extends HostElement {\n static override identity = \"skeleton\";\n static override slotName = \"skeleton\";\n}\n\ndefine(\"pont2-prim-skeleton\", Skeleton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-skeleton\": Skeleton;\n }\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Spinner: Tier 1 (structural)\n *\n * shadcn: `<Spinner>` → lucide `<Loader2Icon role=\"status\" aria-label=\"Loading\"\n * data-slot=\"spinner\" class=\"size-4 animate-spin\">`, i.e. one `<svg>`.\n *\n * A custom element cannot *be* an `<svg>`, and rendering one inside would add\n * a node. pont2 draws the identical lucide `loader-circle` geometry as a CSS\n * mask on the host, so the spinner is still one node and still `currentColor`.\n * Swap the glyph with `--pont2-spinner-icon: url(…)`.\n *\n * `role=\"status\"` and `aria-label=\"Loading\"` are ElementInternals defaults;\n * write your own `aria-label` to localise it.\n *\n * @tag pont2-prim-spinner\n * @cssprop --pont2-spinner-icon - mask image (default: lucide loader-circle)\n */\nexport class Spinner extends HostElement {\n static override identity = \"spinner\";\n static override slotName = \"spinner\";\n static override role = \"status\";\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.internals.ariaLabel) this.internals.ariaLabel = \"Loading\";\n }\n}\n\ndefine(\"pont2-prim-spinner\", Spinner);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-spinner\": Spinner;\n }\n}\n","import { html, nothing } from \"lit\";\nimport { live } from \"lit/directives/live.js\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Textarea: Tier 3 (native-bound)\n *\n * shadcn: `<Textarea>` → a native `<textarea data-slot=\"textarea\">`, auto-sized\n * with `field-sizing: content`.\n *\n * - recipe: `<textarea data-pont2-textarea name=\"bio\"></textarea>`\n * - part: `textarea({ name: \"bio\" })`\n * - enhancer: `<pont2-prim-textarea><textarea name=\"bio\"></textarea></pont2-prim-textarea>`\n */\nexport interface TextareaOptions {\n id?: string;\n name?: string;\n value?: string;\n placeholder?: string;\n rows?: number;\n required?: boolean;\n disabled?: boolean;\n readonly?: boolean;\n invalid?: boolean;\n describedBy?: string;\n slot?: string;\n attrs?: AttrMap;\n onInput?: (e: InputEvent) => void;\n}\n\nexport function applyTextarea(el: HTMLTextAreaElement, slot = \"textarea\"): void {\n if (!el.hasAttribute(\"data-pont2-textarea\")) el.setAttribute(\"data-pont2-textarea\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", slot);\n}\n\nexport function textarea(o: TextareaOptions = {}) {\n return html`<textarea\n data-pont2-textarea\n data-slot=${o.slot ?? \"textarea\"}\n id=${o.id ?? nothing}\n name=${o.name ?? nothing}\n rows=${o.rows ?? nothing}\n placeholder=${o.placeholder ?? nothing}\n ?required=${o.required}\n ?disabled=${o.disabled}\n ?readonly=${o.readonly}\n aria-invalid=${o.invalid ? \"true\" : nothing}\n aria-describedby=${o.describedBy ?? nothing}\n .value=${live(o.value ?? \"\")}\n ${attrs(o.attrs ?? {})}\n @input=${o.onInput ?? nothing}\n ></textarea>`;\n}\n\n/**\n * @tag pont2-prim-textarea\n */\nexport class Pont2Textarea extends NativeEnhancer<HTMLTextAreaElement> {\n static override nativeSelector = \"textarea\";\n protected apply(control: HTMLTextAreaElement): void {\n applyTextarea(control);\n }\n}\n\ndefine(\"pont2-prim-textarea\", Pont2Textarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-textarea\": Pont2Textarea;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const ALERT_VARIANTS = [\"default\", \"destructive\"] as const;\nexport type AlertVariant = (typeof ALERT_VARIANTS)[number];\n\n/**\n * # Alert: Tier 1 (structural)\n *\n * shadcn: `<Alert variant>` → `<div role=\"alert\" data-slot=\"alert\">` with\n * `AlertTitle`, `AlertDescription`, `AlertAction` divs inside.\n *\n * pont2: every part is host-as-root. The alert's `role=\"alert\"` is an\n * ElementInternals default, so `role=\"status\"` written by the author (a polite\n * announcement) still wins.\n *\n * @tag pont2-prim-alert\n * @attr variant - default | destructive\n */\nexport class Alert extends HostElement {\n static override identity = \"alert\";\n static override slotName = \"alert\";\n static override role = \"alert\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n\n declare variant: AlertVariant;\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\n/** @tag pont2-prim-alert-title */\nexport class AlertTitle extends HostElement {\n static override identity = \"alert-title\";\n static override slotName = \"alert-title\";\n}\n\n/** @tag pont2-prim-alert-description */\nexport class AlertDescription extends HostElement {\n static override identity = \"alert-description\";\n static override slotName = \"alert-description\";\n}\n\n/** @tag pont2-prim-alert-action */\nexport class AlertAction extends HostElement {\n static override identity = \"alert-action\";\n static override slotName = \"alert-action\";\n}\n\ndefine(\"pont2-prim-alert\", Alert);\ndefine(\"pont2-prim-alert-title\", AlertTitle);\ndefine(\"pont2-prim-alert-description\", AlertDescription);\ndefine(\"pont2-prim-alert-action\", AlertAction);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-alert\": Alert;\n \"pont2-prim-alert-title\": AlertTitle;\n \"pont2-prim-alert-description\": AlertDescription;\n \"pont2-prim-alert-action\": AlertAction;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type AvatarSize = \"default\" | \"sm\" | \"lg\";\n/** Base UI `Avatar.Root` state `imageLoadingStatus`. */\nexport type ImageLoadingStatus = \"idle\" | \"loading\" | \"loaded\" | \"error\";\n\n/**\n * # Avatar: Tier 1 (structural, with image-loading behaviour)\n *\n * shadcn: `<Avatar size>` → Base UI `<Avatar.Root>` (`<span data-slot=\"avatar\"\n * data-size>`) holding `<Avatar.Image>` (an `<img>`, rendered only once it has\n * loaded) and `<Avatar.Fallback>` (a `<span>`, rendered until then).\n *\n * pont2: the host **is** the root span. The image is the author's own native\n * `<img>` (Tier 3: it must stay an `<img>` for `alt`, `srcset`, lazy loading),\n * written as a direct child. The host watches it and exposes Base UI's\n * `imageLoadingStatus` as `data-image-loading-status`; CSS shows the image\n * only when `loaded` and the fallback otherwise. Nothing is added, removed or\n * moved: the image and fallback both stay in the DOM and CSS swaps them.\n *\n * ```html\n * <pont2-prim-avatar>\n * <img src=\"/u/42.png\" alt=\"Ada Lovelace\">\n * <pont2-prim-avatar-fallback>AL</pont2-prim-avatar-fallback>\n * </pont2-prim-avatar>\n * ```\n *\n * @tag pont2-prim-avatar\n * @attr size - default | sm | lg\n * @fires pont2-loading-status-change - `{ status }` when the image status changes (Base UI `onLoadingStatusChange`).\n */\nexport class Avatar extends HostElement {\n static override identity = \"avatar\";\n static override slotName = \"avatar\";\n\n static override properties: PropertyDeclarations = {\n size: { type: String, reflect: true },\n imageLoadingStatus: { state: true },\n };\n\n declare size: AvatarSize;\n /** Base UI's `imageLoadingStatus`; read-only for consumers. */\n declare imageLoadingStatus: ImageLoadingStatus;\n\n private img: HTMLImageElement | null = null;\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.size = \"default\";\n this.imageLoadingStatus = \"idle\";\n }\n\n /** The author's `<img>` (a direct child), if any. */\n get image(): HTMLImageElement | null {\n return this.querySelector(\":scope > img\");\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.track());\n this.observer.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: [\"src\", \"srcset\"] });\n this.track();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.detach();\n }\n\n private detach() {\n this.img?.removeEventListener(\"load\", this.onLoad);\n this.img?.removeEventListener(\"error\", this.onError);\n this.img = null;\n }\n\n private track() {\n const img = this.image;\n if (img !== this.img) {\n this.detach();\n this.img = img;\n if (img) {\n img.addEventListener(\"load\", this.onLoad);\n img.addEventListener(\"error\", this.onError);\n if (!img.hasAttribute(\"data-pont2-avatar-image\")) img.setAttribute(\"data-pont2-avatar-image\", \"\");\n if (!img.hasAttribute(\"data-slot\")) img.setAttribute(\"data-slot\", \"avatar-image\");\n }\n }\n if (!img || !(img.currentSrc || img.getAttribute(\"src\"))) return this.setStatus(img ? \"error\" : \"idle\");\n if (img.complete) this.setStatus(img.naturalWidth > 0 ? \"loaded\" : \"error\");\n else this.setStatus(\"loading\");\n }\n\n private onLoad = () => this.setStatus(\"loaded\");\n private onError = () => this.setStatus(\"error\");\n\n private setStatus(status: ImageLoadingStatus) {\n if (status === this.imageLoadingStatus) return;\n this.imageLoadingStatus = status;\n this.dispatchEvent(\n new CustomEvent(\"pont2-loading-status-change\", { detail: { status }, bubbles: true, composed: true }),\n );\n }\n\n protected override willUpdate(): void {\n this.setData(\"size\", this.size || \"default\");\n this.setData(\"image-loading-status\", this.imageLoadingStatus);\n }\n}\n\n/**\n * Shown until the avatar's image has loaded (CSS-driven; see Avatar).\n *\n * @tag pont2-prim-avatar-fallback\n */\nexport class AvatarFallback extends HostElement {\n static override identity = \"avatar-fallback\";\n static override slotName = \"avatar-fallback\";\n}\n\n/** @tag pont2-prim-avatar-badge */\nexport class AvatarBadge extends HostElement {\n static override identity = \"avatar-badge\";\n static override slotName = \"avatar-badge\";\n}\n\n/** @tag pont2-prim-avatar-group */\nexport class AvatarGroup extends HostElement {\n static override identity = \"avatar-group\";\n static override slotName = \"avatar-group\";\n}\n\n/** @tag pont2-prim-avatar-group-count */\nexport class AvatarGroupCount extends HostElement {\n static override identity = \"avatar-group-count\";\n static override slotName = \"avatar-group-count\";\n}\n\ndefine(\"pont2-prim-avatar\", Avatar);\ndefine(\"pont2-prim-avatar-fallback\", AvatarFallback);\ndefine(\"pont2-prim-avatar-badge\", AvatarBadge);\ndefine(\"pont2-prim-avatar-group\", AvatarGroup);\ndefine(\"pont2-prim-avatar-group-count\", AvatarGroupCount);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-avatar\": Avatar;\n \"pont2-prim-avatar-fallback\": AvatarFallback;\n \"pont2-prim-avatar-badge\": AvatarBadge;\n \"pont2-prim-avatar-group\": AvatarGroup;\n \"pont2-prim-avatar-group-count\": AvatarGroupCount;\n }\n interface HTMLElementEventMap {\n \"pont2-loading-status-change\": CustomEvent<{ status: ImageLoadingStatus }>;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { Separator } from \"../separator/separator\";\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\";\n\n/**\n * # ButtonGroup: Tier 1 (structural)\n *\n * shadcn: `<ButtonGroup orientation>` → `<div role=\"group\" data-slot=\"button-group\"\n * data-orientation>`; `ButtonGroupText` (Base UI `useRender`, a div);\n * `ButtonGroupSeparator` (a vertical `Separator`).\n *\n * pont2: host-as-root. Children are whatever you write: recipe buttons,\n * `<pont2-prim-button>` shells, inputs, nested groups. The join rules (square inner\n * corners, collapsed borders) see through Tier 3 shells, because a shell has\n * no box. `ButtonGroupSeparator extends Separator`.\n *\n * @tag pont2-prim-button-group\n * @attr orientation - horizontal (default) | vertical\n */\nexport class ButtonGroup extends HostElement {\n static override identity = \"button-group\";\n static override slotName = \"button-group\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n orientation: { type: String, reflect: true },\n };\n\n declare orientation: ButtonGroupOrientation;\n\n constructor() {\n super();\n this.orientation = \"horizontal\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"orientation\", this.orientation === \"vertical\" ? \"vertical\" : \"horizontal\");\n }\n}\n\n/**\n * For a link or label instead of a div, use the recipe on that element:\n * `<label data-pont2-button-group-text data-slot=\"button-group-text\">`.\n *\n * @tag pont2-prim-button-group-text\n */\nexport class ButtonGroupText extends HostElement {\n static override identity = \"button-group-text\";\n static override slotName = \"button-group-text\";\n}\n\n/**\n * A Separator whose default orientation is vertical.\n *\n * @tag pont2-prim-button-group-separator\n */\nexport class ButtonGroupSeparator extends Separator {\n static override identity = \"button-group-separator\";\n static override slotName = \"button-group-separator\";\n\n constructor() {\n super();\n this.orientation = \"vertical\";\n }\n}\n\ndefine(\"pont2-prim-button-group\", ButtonGroup);\ndefine(\"pont2-prim-button-group-text\", ButtonGroupText);\ndefine(\"pont2-prim-button-group-separator\", ButtonGroupSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-button-group\": ButtonGroup;\n \"pont2-prim-button-group-text\": ButtonGroupText;\n \"pont2-prim-button-group-separator\": ButtonGroupSeparator;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type CardSize = \"default\" | \"sm\";\n\n/**\n * # Card: Tier 1 (structural)\n *\n * shadcn: `<Card size>` → `<div data-slot=\"card\" data-size>` and the\n * `CardHeader | CardTitle | CardDescription | CardAction | CardContent |\n * CardFooter` divs. Every part here is host-as-root: same depth as shadcn.\n *\n * @tag pont2-prim-card\n * @attr size - default | sm\n * @cssprop --pont2-card-spacing - padding/gap unit (default 1.5rem)\n * @cssprop --pont2-card-sm-spacing - the same for size=\"sm\" (default 1rem)\n * @cssprop --pont2-card-bg, --pont2-card-fg, --pont2-card-border-color, --pont2-card-radius, --pont2-card-shadow - see docs/11-tokens.md\n */\nexport class Card extends HostElement {\n static override identity = \"card\";\n static override slotName = \"card\";\n\n static override properties: PropertyDeclarations = {\n size: { type: String, reflect: true },\n };\n\n declare size: CardSize;\n\n constructor() {\n super();\n this.size = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"size\", this.size || \"default\");\n }\n}\n\n/** @tag pont2-prim-card-header */\nexport class CardHeader extends HostElement {\n static override identity = \"card-header\";\n static override slotName = \"card-header\";\n}\n\n/** @tag pont2-prim-card-title */\nexport class CardTitle extends HostElement {\n static override identity = \"card-title\";\n static override slotName = \"card-title\";\n}\n\n/** @tag pont2-prim-card-description */\nexport class CardDescription extends HostElement {\n static override identity = \"card-description\";\n static override slotName = \"card-description\";\n}\n\n/** @tag pont2-prim-card-action */\nexport class CardAction extends HostElement {\n static override identity = \"card-action\";\n static override slotName = \"card-action\";\n}\n\n/** @tag pont2-prim-card-content */\nexport class CardContent extends HostElement {\n static override identity = \"card-content\";\n static override slotName = \"card-content\";\n}\n\n/** @tag pont2-prim-card-footer */\nexport class CardFooter extends HostElement {\n static override identity = \"card-footer\";\n static override slotName = \"card-footer\";\n}\n\ndefine(\"pont2-prim-card\", Card);\ndefine(\"pont2-prim-card-header\", CardHeader);\ndefine(\"pont2-prim-card-title\", CardTitle);\ndefine(\"pont2-prim-card-description\", CardDescription);\ndefine(\"pont2-prim-card-action\", CardAction);\ndefine(\"pont2-prim-card-content\", CardContent);\ndefine(\"pont2-prim-card-footer\", CardFooter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-card\": Card;\n \"pont2-prim-card-header\": CardHeader;\n \"pont2-prim-card-title\": CardTitle;\n \"pont2-prim-card-description\": CardDescription;\n \"pont2-prim-card-action\": CardAction;\n \"pont2-prim-card-content\": CardContent;\n \"pont2-prim-card-footer\": CardFooter;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type EmptyMediaVariant = \"default\" | \"icon\";\n\n/**\n * # Empty: Tier 1 (structural)\n *\n * shadcn: `<Empty>` → `<div data-slot=\"empty\">` with `EmptyHeader`,\n * `EmptyMedia` (`data-slot=\"empty-icon\"`, `data-variant`), `EmptyTitle`,\n * `EmptyDescription`, `EmptyContent`, all divs. All host-as-root here.\n *\n * @tag pont2-prim-empty\n */\nexport class Empty extends HostElement {\n static override identity = \"empty\";\n static override slotName = \"empty\";\n}\n\n/** @tag pont2-prim-empty-header */\nexport class EmptyHeader extends HostElement {\n static override identity = \"empty-header\";\n static override slotName = \"empty-header\";\n}\n\n/**\n * Note shadcn's slot name for the media part is `empty-icon` (kept verbatim).\n *\n * @tag pont2-prim-empty-media\n * @attr variant - default | icon\n */\nexport class EmptyMedia extends HostElement {\n static override identity = \"empty-media\";\n static override slotName = \"empty-icon\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n\n declare variant: EmptyMediaVariant;\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\n/** @tag pont2-prim-empty-title */\nexport class EmptyTitle extends HostElement {\n static override identity = \"empty-title\";\n static override slotName = \"empty-title\";\n}\n\n/** @tag pont2-prim-empty-description */\nexport class EmptyDescription extends HostElement {\n static override identity = \"empty-description\";\n static override slotName = \"empty-description\";\n}\n\n/** @tag pont2-prim-empty-content */\nexport class EmptyContent extends HostElement {\n static override identity = \"empty-content\";\n static override slotName = \"empty-content\";\n}\n\ndefine(\"pont2-prim-empty\", Empty);\ndefine(\"pont2-prim-empty-header\", EmptyHeader);\ndefine(\"pont2-prim-empty-media\", EmptyMedia);\ndefine(\"pont2-prim-empty-title\", EmptyTitle);\ndefine(\"pont2-prim-empty-description\", EmptyDescription);\ndefine(\"pont2-prim-empty-content\", EmptyContent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-empty\": Empty;\n \"pont2-prim-empty-header\": EmptyHeader;\n \"pont2-prim-empty-media\": EmptyMedia;\n \"pont2-prim-empty-title\": EmptyTitle;\n \"pont2-prim-empty-description\": EmptyDescription;\n \"pont2-prim-empty-content\": EmptyContent;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { HostElement, NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { applyLabel } from \"../label/label\";\n\n/**\n * # Field family\n *\n * shadcn's `field.tsx` is plain markup (no Base UI primitive):\n *\n * | shadcn | renders | pont2 | tier |\n * |-------------------|--------------------------------------------|-------------------------------|------|\n * | FieldSet | `<fieldset data-slot=\"field-set\">` | recipe/part on `<fieldset>`, `<pont2-prim-field-set>` enhancer | 3 |\n * | FieldLegend | `<legend data-slot=\"field-legend\" data-variant>` | recipe/part on `<legend>` only | 3 |\n * | FieldGroup | `<div data-slot=\"field-group\">` | `<pont2-prim-field-group>` | 1 |\n * | Field | `<div role=\"group\" data-slot=\"field\" data-orientation>` | `<pont2-prim-field>` | 1 |\n * | FieldContent | `<div data-slot=\"field-content\">` | `<pont2-prim-field-content>` | 1 |\n * | FieldLabel | `<label data-slot=\"field-label\">` (Label) | recipe/part on `<label>`, `<pont2-prim-field-label>` enhancer | 3 |\n * | FieldTitle | `<div data-slot=\"field-label\">` | `<pont2-prim-field-title>` | 1 |\n * | FieldDescription | `<p data-slot=\"field-description\">` | `<pont2-prim-field-description>` | 1 |\n * | FieldSeparator | `<div data-slot=\"field-separator\">` > Separator + `<span>` | `<pont2-prim-field-separator>` (lines drawn in CSS) | 1 |\n * | FieldError | `<div role=\"alert\" data-slot=\"field-error\">` | `<pont2-prim-field-error>` | 1 |\n *\n * Like shadcn, the family does no id wiring: you write `for`/`id` and\n * `aria-describedby` yourself (Base UI's own `Field` primitive does wire ids;\n * shadcn's Field does not use it). See docs/primitives/field.md.\n */\n\n/* ------------------------------------------------------------------ */\n/* FieldSet / FieldLegend (native) */\n/* ------------------------------------------------------------------ */\n\nexport function applyFieldSet(el: HTMLFieldSetElement): void {\n if (!el.hasAttribute(\"data-pont2-field-set\")) el.setAttribute(\"data-pont2-field-set\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", \"field-set\");\n}\n\nexport function fieldSet(o: { disabled?: boolean; attrs?: AttrMap }, content: unknown) {\n return html`<fieldset data-pont2-field-set data-slot=\"field-set\" ?disabled=${o.disabled} ${attrs(o.attrs ?? {})}>\n ${content}\n </fieldset>`;\n}\n\nexport function fieldLegend(o: { variant?: \"legend\" | \"label\"; attrs?: AttrMap }, content: unknown) {\n return html`<legend\n data-pont2-field-legend\n data-slot=\"field-legend\"\n data-variant=${o.variant ?? \"legend\"}\n ${attrs(o.attrs ?? {})}\n >${content}</legend\n >`;\n}\n\n/**\n * Applies the FieldSet recipe to the `<fieldset>` inside it. The legend must\n * be a direct child of that `<fieldset>` to name it, so write\n * `<legend data-pont2-field-legend>` (there is no legend element).\n *\n * @tag pont2-prim-field-set\n */\nexport class FieldSetElement extends NativeEnhancer<HTMLFieldSetElement> {\n static override nativeSelector = \"fieldset\";\n protected apply(control: HTMLFieldSetElement): void {\n applyFieldSet(control);\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* FieldGroup / Field / FieldContent */\n/* ------------------------------------------------------------------ */\n\n/** @tag pont2-prim-field-group */\nexport class FieldGroup extends HostElement {\n static override identity = \"field-group\";\n static override slotName = \"field-group\";\n}\n\nexport type FieldOrientation = \"vertical\" | \"horizontal\" | \"responsive\";\n\n/**\n * @tag pont2-prim-field\n * @attr orientation - vertical (default) | horizontal | responsive\n * @attr invalid - Sets `data-invalid` (destructive text colour), like shadcn's `data-invalid`.\n * @attr disabled - Sets `data-disabled` (dims the label/title), like shadcn's `data-disabled`.\n */\nexport class Field extends HostElement {\n static override identity = \"field\";\n static override slotName = \"field\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n orientation: { type: String, reflect: true },\n invalid: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare orientation: FieldOrientation;\n declare invalid: boolean;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.orientation = \"vertical\";\n this.invalid = false;\n this.disabled = false;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n this.setData(\"orientation\", this.orientation || \"vertical\");\n // Only manage the state attributes we own; an author's data-invalid=\"true\" stays.\n if (changed.has(\"invalid\") && (this.invalid || changed.get(\"invalid\"))) this.setData(\"invalid\", this.invalid);\n if (changed.has(\"disabled\") && (this.disabled || changed.get(\"disabled\"))) this.setData(\"disabled\", this.disabled);\n }\n}\n\n/** @tag pont2-prim-field-content */\nexport class FieldContent extends HostElement {\n static override identity = \"field-content\";\n static override slotName = \"field-content\";\n}\n\n/* ------------------------------------------------------------------ */\n/* FieldLabel (native) / FieldTitle */\n/* ------------------------------------------------------------------ */\n\nexport function applyFieldLabel(el: HTMLLabelElement): void {\n applyLabel(el, \"field-label\");\n if (!el.hasAttribute(\"data-pont2-field-label\")) el.setAttribute(\"data-pont2-field-label\", \"\");\n}\n\n/** `<label data-pont2-label data-pont2-field-label data-slot=\"field-label\">` */\nexport function fieldLabel(o: { for?: string; id?: string; attrs?: AttrMap }, content: unknown) {\n return html`<label\n data-pont2-label\n data-pont2-field-label\n data-slot=\"field-label\"\n for=${o.for ?? nothing}\n id=${o.id ?? nothing}\n ${attrs(o.attrs ?? {})}\n >${content}</label\n >`;\n}\n\n/** @tag pont2-prim-field-label */\nexport class FieldLabelElement extends NativeEnhancer<HTMLLabelElement> {\n static override nativeSelector = \"label\";\n protected apply(control: HTMLLabelElement): void {\n applyFieldLabel(control);\n }\n}\n\n/**\n * A label-styled title for a field that has no single control to label\n * (shadcn gives it `data-slot=\"field-label\"` too, kept verbatim).\n *\n * @tag pont2-prim-field-title\n */\nexport class FieldTitle extends HostElement {\n static override identity = \"field-title\";\n static override slotName = \"field-label\";\n}\n\n/* ------------------------------------------------------------------ */\n/* FieldDescription / FieldSeparator / FieldError */\n/* ------------------------------------------------------------------ */\n\n/** @tag pont2-prim-field-description */\nexport class FieldDescription extends HostElement {\n static override identity = \"field-description\";\n static override slotName = \"field-description\";\n}\n\n/**\n * shadcn renders `div > Separator + span`. pont2 draws the two rule halves\n * with `::before`/`::after`, so the only nodes are the host and your text.\n * `data-content` is set when the separator has text, as in shadcn.\n *\n * @tag pont2-prim-field-separator\n */\nexport class FieldSeparator extends HostElement {\n static override identity = \"field-separator\";\n static override slotName = \"field-separator\";\n\n private observer?: MutationObserver;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.sync());\n this.observer.observe(this, { childList: true, characterData: true, subtree: true });\n this.sync();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n private sync() {\n this.setAttribute(\"data-content\", String(!!this.textContent?.trim() || this.children.length > 0));\n }\n}\n\nexport interface FieldErrorItem {\n message?: string;\n}\n\n/**\n * Write the message as children, or set `.errors` (shadcn's `errors` prop:\n * de-duplicated by message; one renders as text, several as a list). Hidden\n * while empty, like shadcn returning `null`.\n *\n * @tag pont2-prim-field-error\n */\nexport class FieldError extends HostElement {\n static override identity = \"field-error\";\n static override slotName = \"field-error\";\n static override role = \"alert\";\n\n static override properties: PropertyDeclarations = {\n errors: { attribute: false },\n };\n\n declare errors: Array<FieldErrorItem | undefined> | undefined;\n\n override render() {\n if (!this.errors?.length) return nothing;\n const unique = [...new Map(this.errors.map(e => [e?.message, e])).values()].filter(e => e?.message);\n if (unique.length === 1) return unique[0]!.message;\n return html`<ul data-slot=\"field-error-list\">\n ${unique.map(e => html`<li>${e!.message}</li>`)}\n </ul>`;\n }\n}\n\ndefine(\"pont2-prim-field-set\", FieldSetElement);\ndefine(\"pont2-prim-field-group\", FieldGroup);\ndefine(\"pont2-prim-field\", Field);\ndefine(\"pont2-prim-field-content\", FieldContent);\ndefine(\"pont2-prim-field-label\", FieldLabelElement);\ndefine(\"pont2-prim-field-title\", FieldTitle);\ndefine(\"pont2-prim-field-description\", FieldDescription);\ndefine(\"pont2-prim-field-separator\", FieldSeparator);\ndefine(\"pont2-prim-field-error\", FieldError);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-field-set\": FieldSetElement;\n \"pont2-prim-field-group\": FieldGroup;\n \"pont2-prim-field\": Field;\n \"pont2-prim-field-content\": FieldContent;\n \"pont2-prim-field-label\": FieldLabelElement;\n \"pont2-prim-field-title\": FieldTitle;\n \"pont2-prim-field-description\": FieldDescription;\n \"pont2-prim-field-separator\": FieldSeparator;\n \"pont2-prim-field-error\": FieldError;\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { HostElement, NativeEnhancer } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { applyButton, button, Pont2Button, type ButtonOptions } from \"../button/button\";\nimport { applyInput, input, type InputOptions } from \"../input/input\";\nimport { applyTextarea, textarea, type TextareaOptions } from \"../textarea/textarea\";\n\nexport type InputGroupAddonAlign = \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\";\nexport type InputGroupButtonSize = \"xs\" | \"sm\" | \"icon-xs\" | \"icon-sm\";\n\n/**\n * # InputGroup family\n *\n * shadcn: `InputGroup` (`div role=\"group\" data-slot=\"input-group\"`),\n * `InputGroupAddon` (`div role=\"group\" data-align`, click focuses the input),\n * `InputGroupText` (a `span`), and the controls `InputGroupInput` /\n * `InputGroupTextarea` / `InputGroupButton`, which are shadcn's `Input`,\n * `Textarea` and `Button` with extra classes and\n * `data-slot=\"input-group-control\"` (button: ghost, size xs).\n *\n * pont2:\n * - `<pont2-prim-input-group>`, `<pont2-prim-input-group-addon>`, `<pont2-prim-input-group-text>`\n * are host-as-root (Tier 1).\n * - The controls stay native (Tier 3): the Input/Textarea/Button recipe plus\n * an extra identity. Write them as recipes\n * (`<input data-pont2-input data-pont2-input-group-input data-slot=\"input-group-control\">`),\n * parts (`inputGroupInput()`), or enhancers (`<pont2-prim-input-group-input><input></…>`).\n *\n * Like shadcn, the control must be a *direct* child of the group for the\n * group's `has-[>input]` padding rules; with an enhancer the shell is\n * `display: contents` and the rules also match through it.\n */\n\n/**\n * @tag pont2-prim-input-group\n * @attr disabled - Sets `data-disabled` (dims addons), like shadcn's `data-disabled=\"true\"`.\n */\nexport class InputGroup extends HostElement {\n static override identity = \"input-group\";\n static override slotName = \"input-group\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n disabled: { type: Boolean, reflect: true },\n };\n\n declare disabled: boolean;\n\n constructor() {\n super();\n this.disabled = false;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"disabled\") && (this.disabled || changed.get(\"disabled\"))) this.setData(\"disabled\", this.disabled);\n }\n}\n\n/**\n * @tag pont2-prim-input-group-addon\n * @attr align - inline-start (default) | inline-end | block-start | block-end\n */\nexport class InputGroupAddon extends HostElement {\n static override identity = \"input-group-addon\";\n static override slotName = \"input-group-addon\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n align: { type: String, reflect: true },\n };\n\n declare align: InputGroupAddonAlign;\n\n constructor() {\n super();\n this.align = \"inline-start\";\n // shadcn: clicking the addon (but not a button in it) focuses the group's input.\n this.addEventListener(\"click\", e => {\n if ((e.target as HTMLElement).closest(\"button\")) return;\n this.parentElement?.querySelector(\"input\")?.focus();\n });\n }\n\n protected override willUpdate(): void {\n this.setData(\"align\", this.align || \"inline-start\");\n }\n}\n\n/** shadcn's InputGroupText has no data-slot; pont2 keeps it that way. @tag pont2-prim-input-group-text */\nexport class InputGroupText extends HostElement {\n static override identity = \"input-group-text\";\n}\n\n/* ------------------------------------------------------------------ */\n/* Controls (native) */\n/* ------------------------------------------------------------------ */\n\nconst CONTROL = \"input-group-control\";\n\nfunction markControl(el: HTMLElement, identity: string) {\n if (!el.hasAttribute(`data-pont2-${identity}`)) el.setAttribute(`data-pont2-${identity}`, \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", CONTROL);\n}\n\nexport function inputGroupInput(o: InputOptions = {}) {\n return input({ ...o, slot: CONTROL, attrs: { \"data-pont2-input-group-input\": true, ...(o.attrs ?? {}) } });\n}\n\nexport function inputGroupTextarea(o: TextareaOptions = {}) {\n return textarea({ ...o, slot: CONTROL, attrs: { \"data-pont2-input-group-textarea\": true, ...(o.attrs ?? {}) } });\n}\n\nexport interface InputGroupButtonOptions extends Omit<ButtonOptions, \"size\"> {\n size?: InputGroupButtonSize;\n}\n\n/** shadcn defaults: `variant=\"ghost\"`, `size=\"xs\"`, `type=\"button\"`. */\nexport function inputGroupButton(o: InputGroupButtonOptions, content: unknown) {\n return button(\n {\n variant: \"ghost\",\n ...o,\n size: (o.size ?? \"xs\") as ButtonOptions[\"size\"],\n attrs: { \"data-pont2-input-group-button\": true, ...(o.attrs ?? {}) },\n },\n content,\n );\n}\n\n/** @tag pont2-prim-input-group-input */\nexport class InputGroupInput extends NativeEnhancer<HTMLInputElement> {\n static override nativeSelector = \"input\";\n protected apply(control: HTMLInputElement): void {\n if (!control.hasAttribute(\"data-slot\")) control.setAttribute(\"data-slot\", CONTROL);\n applyInput(control, CONTROL);\n markControl(control, \"input-group-input\");\n }\n}\n\n/** @tag pont2-prim-input-group-textarea */\nexport class InputGroupTextarea extends NativeEnhancer<HTMLTextAreaElement> {\n static override nativeSelector = \"textarea\";\n protected apply(control: HTMLTextAreaElement): void {\n if (!control.hasAttribute(\"data-slot\")) control.setAttribute(\"data-slot\", CONTROL);\n applyTextarea(control, CONTROL);\n markControl(control, \"input-group-textarea\");\n }\n}\n\n/**\n * `<pont2-prim-button>` with shadcn's InputGroupButton defaults (ghost, xs) and its\n * extra recipe. It *is* a Pont2Button enhancer, so everything else is inherited.\n *\n * @tag pont2-prim-input-group-button\n * @attr size - xs (default) | sm | icon-xs | icon-sm\n */\nexport class InputGroupButton extends Pont2Button {\n constructor() {\n super();\n this.variant = \"ghost\";\n this.size = \"xs\";\n }\n\n protected override apply(control: HTMLButtonElement | HTMLAnchorElement): void {\n applyButton(control, this);\n if (!control.hasAttribute(\"data-pont2-input-group-button\")) control.setAttribute(\"data-pont2-input-group-button\", \"\");\n if (control instanceof HTMLButtonElement && !control.hasAttribute(\"type\")) control.type = \"button\";\n }\n}\n\ndefine(\"pont2-prim-input-group\", InputGroup);\ndefine(\"pont2-prim-input-group-addon\", InputGroupAddon);\ndefine(\"pont2-prim-input-group-text\", InputGroupText);\ndefine(\"pont2-prim-input-group-input\", InputGroupInput);\ndefine(\"pont2-prim-input-group-textarea\", InputGroupTextarea);\ndefine(\"pont2-prim-input-group-button\", InputGroupButton);\n\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-input-group\": InputGroup;\n \"pont2-prim-input-group-addon\": InputGroupAddon;\n \"pont2-prim-input-group-text\": InputGroupText;\n \"pont2-prim-input-group-input\": InputGroupInput;\n \"pont2-prim-input-group-textarea\": InputGroupTextarea;\n \"pont2-prim-input-group-button\": InputGroupButton;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { Separator } from \"../separator/separator\";\n\nexport type ItemVariant = \"default\" | \"outline\" | \"muted\";\nexport type ItemSize = \"default\" | \"sm\" | \"xs\";\nexport type ItemMediaVariant = \"default\" | \"icon\" | \"image\";\n\n/**\n * # Item family: Tier 1 (structural)\n *\n * shadcn: `ItemGroup` (`div role=\"list\"`), `Item` (Base UI `useRender`, a div\n * by default, or the author's `<a>` through `render`), `ItemMedia`,\n * `ItemContent`, `ItemTitle`, `ItemDescription` (a `p`), `ItemActions`,\n * `ItemHeader`, `ItemFooter`, and `ItemSeparator` (a `Separator`).\n *\n * pont2: every part is host-as-root. A link item is the recipe on a real\n * anchor: `<a data-pont2-item data-variant=\"outline\" href=\"…\">`.\n * `ItemSeparator extends Separator`, so it *is* a separator (one node, role\n * separator) that keeps the separator look and adds `data-slot=\"item-separator\"`.\n */\n\n/** @tag pont2-prim-item-group */\nexport class ItemGroup extends HostElement {\n static override identity = \"item-group\";\n static override slotName = \"item-group\";\n static override role = \"list\";\n}\n\n/** @tag pont2-prim-item-separator */\nexport class ItemSeparator extends Separator {\n static override identity = \"item-separator\";\n static override slotName = \"item-separator\";\n}\n\n/**\n * @tag pont2-prim-item\n * @attr variant - default | outline | muted\n * @attr size - default | sm | xs\n */\nexport class Item extends HostElement {\n static override identity = \"item\";\n static override slotName = \"item\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n };\n\n declare variant: ItemVariant;\n declare size: ItemSize;\n\n constructor() {\n super();\n this.variant = \"default\";\n this.size = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n this.setData(\"size\", this.size || \"default\");\n }\n}\n\n/**\n * @tag pont2-prim-item-media\n * @attr variant - default | icon | image\n */\nexport class ItemMedia extends HostElement {\n static override identity = \"item-media\";\n static override slotName = \"item-media\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n\n declare variant: ItemMediaVariant;\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\n/** @tag pont2-prim-item-content */\nexport class ItemContent extends HostElement {\n static override identity = \"item-content\";\n static override slotName = \"item-content\";\n}\n\n/** @tag pont2-prim-item-title */\nexport class ItemTitle extends HostElement {\n static override identity = \"item-title\";\n static override slotName = \"item-title\";\n}\n\n/** @tag pont2-prim-item-description */\nexport class ItemDescription extends HostElement {\n static override identity = \"item-description\";\n static override slotName = \"item-description\";\n}\n\n/** @tag pont2-prim-item-actions */\nexport class ItemActions extends HostElement {\n static override identity = \"item-actions\";\n static override slotName = \"item-actions\";\n}\n\n/** @tag pont2-prim-item-header */\nexport class ItemHeader extends HostElement {\n static override identity = \"item-header\";\n static override slotName = \"item-header\";\n}\n\n/** @tag pont2-prim-item-footer */\nexport class ItemFooter extends HostElement {\n static override identity = \"item-footer\";\n static override slotName = \"item-footer\";\n}\n\ndefine(\"pont2-prim-item-group\", ItemGroup);\ndefine(\"pont2-prim-item-separator\", ItemSeparator);\ndefine(\"pont2-prim-item\", Item);\ndefine(\"pont2-prim-item-media\", ItemMedia);\ndefine(\"pont2-prim-item-content\", ItemContent);\ndefine(\"pont2-prim-item-title\", ItemTitle);\ndefine(\"pont2-prim-item-description\", ItemDescription);\ndefine(\"pont2-prim-item-actions\", ItemActions);\ndefine(\"pont2-prim-item-header\", ItemHeader);\ndefine(\"pont2-prim-item-footer\", ItemFooter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-item-group\": ItemGroup;\n \"pont2-prim-item-separator\": ItemSeparator;\n \"pont2-prim-item\": Item;\n \"pont2-prim-item-media\": ItemMedia;\n \"pont2-prim-item-content\": ItemContent;\n \"pont2-prim-item-title\": ItemTitle;\n \"pont2-prim-item-description\": ItemDescription;\n \"pont2-prim-item-actions\": ItemActions;\n \"pont2-prim-item-header\": ItemHeader;\n \"pont2-prim-item-footer\": ItemFooter;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type NativeSelectSize = \"default\" | \"sm\";\n\n/**\n * # NativeSelect: Tier 1 wrapper + native `<select>`\n *\n * shadcn: `<NativeSelect size>` renders\n * `div[data-slot=native-select-wrapper][data-size] > select[data-slot=native-select][data-size] + svg[data-slot=native-select-icon]`;\n * `NativeSelectOption` / `NativeSelectOptGroup` are `<option>` / `<optgroup>`.\n *\n * pont2: `<pont2-prim-native-select>` **is** the wrapper div; you write the native\n * `<select>` (and its options) inside, and the host applies the recipe to it.\n * The chevron is drawn by the wrapper's `::after`, so the DOM is\n * `pont2-prim-native-select > select`: one node fewer than shadcn, and the select\n * stays a real form control (submission, autofill, mobile pickers).\n *\n * ```html\n * <pont2-prim-native-select>\n * <select name=\"country\"><option>Norway</option><option>Japan</option></select>\n * </pont2-prim-native-select>\n * ```\n *\n * @tag pont2-prim-native-select\n * @attr size - default | sm\n * @cssprop --pont2-native-select-icon - mask image for the chevron\n */\nexport class NativeSelect extends HostElement {\n static override identity = \"native-select-wrapper\";\n static override slotName = \"native-select-wrapper\";\n\n static override properties: PropertyDeclarations = {\n size: { type: String, reflect: true },\n };\n\n declare size: NativeSelectSize;\n\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.size = \"default\";\n }\n\n /** The native `<select>`. */\n get control(): HTMLSelectElement | null {\n return this.querySelector(\":scope > select\");\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n override focus(options?: FocusOptions): void {\n this.control?.focus(options);\n }\n\n protected override willUpdate(): void {\n const size = this.size || \"default\";\n this.setData(\"size\", size);\n const select = this.control;\n if (select) applyNativeSelect(select, size);\n }\n}\n\nexport function applyNativeSelect(el: HTMLSelectElement, size: NativeSelectSize = \"default\"): void {\n if (!el.hasAttribute(\"data-pont2-native-select\")) el.setAttribute(\"data-pont2-native-select\", \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", \"native-select\");\n el.setAttribute(\"data-size\", size);\n}\n\nexport interface NativeSelectOptions {\n size?: NativeSelectSize;\n id?: string;\n name?: string;\n disabled?: boolean;\n required?: boolean;\n invalid?: boolean;\n attrs?: AttrMap;\n onChange?: (e: Event) => void;\n}\n\n/** Part: the wrapper div and the select in one template (options are the content). */\nexport function nativeSelect(o: NativeSelectOptions, options: unknown) {\n const size = o.size ?? \"default\";\n return html`<div data-pont2-native-select-wrapper data-slot=\"native-select-wrapper\" data-size=${size}>\n <select\n data-pont2-native-select\n data-slot=\"native-select\"\n data-size=${size}\n id=${o.id ?? nothing}\n name=${o.name ?? nothing}\n ?disabled=${o.disabled}\n ?required=${o.required}\n aria-invalid=${o.invalid ? \"true\" : nothing}\n ${attrs(o.attrs ?? {})}\n @change=${o.onChange ?? nothing}\n >\n ${options}\n </select>\n </div>`;\n}\n\ndefine(\"pont2-prim-native-select\", NativeSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-native-select\": NativeSelect;\n }\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/**\n * # Table: Tier 1 container + native table (recipe)\n *\n * shadcn: `<Table>` → `<div data-slot=\"table-container\"><table data-slot=\"table\">`,\n * and `TableHeader | TableBody | TableFooter | TableRow | TableHead |\n * TableCell | TableCaption` are the native `thead | tbody | tfoot | tr | th |\n * td | caption` with a `data-slot` each.\n *\n * Table parts cannot be custom elements: the HTML parser \"foster-parents\"\n * unknown elements out of a `<table>` (`<table><pont2-tr>` puts the\n * `pont2-tr` *before* the table). And `colspan`, `headers`, `scope` and the\n * native table semantics only exist on the native elements.\n *\n * So `<pont2-prim-table>` **is** the container div (host-as-root), and you write a\n * plain native `<table>` inside it:\n *\n * ```html\n * <pont2-prim-table>\n * <table>\n * <caption>Recent invoices</caption>\n * <thead><tr><th>Invoice</th><th>Amount</th></tr></thead>\n * <tbody><tr><td>INV001</td><td>$250.00</td></tr></tbody>\n * </table>\n * </pont2-prim-table>\n * ```\n *\n * The host stamps each part's recipe (`data-pont2-table-*` + shadcn's\n * `data-slot`) onto the native elements of *its own* table (not nested ones),\n * and keeps doing so as rows are added. Styling also works before upgrade and\n * with no JS, through `pont2-prim-table > table …` selectors, and outside the\n * element via the recipe attributes (`applyTable()`).\n *\n * @tag pont2-prim-table\n */\nexport class Table extends HostElement {\n static override identity = \"table-container\";\n static override slotName = \"table-container\";\n\n private observer?: MutationObserver;\n\n /** The native `<table>` this container holds. */\n get table(): HTMLTableElement | null {\n return this.querySelector(\":scope > table\");\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.stamp());\n this.observer.observe(this, { childList: true, subtree: true });\n this.stamp();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n private stamp() {\n const t = this.table;\n if (t) applyTable(t);\n }\n}\n\nconst PARTS: Record<string, string> = {\n CAPTION: \"table-caption\",\n THEAD: \"table-header\",\n TBODY: \"table-body\",\n TFOOT: \"table-footer\",\n TR: \"table-row\",\n TH: \"table-head\",\n TD: \"table-cell\",\n};\n\nfunction mark(el: Element, part: string) {\n if (!el.hasAttribute(`data-pont2-${part}`)) el.setAttribute(`data-pont2-${part}`, \"\");\n if (!el.hasAttribute(\"data-slot\")) el.setAttribute(\"data-slot\", part);\n}\n\n/**\n * Applies the table recipe to a native `<table>` and its own sections, rows\n * and cells (not those of nested tables). Idempotent.\n */\nexport function applyTable(table: HTMLTableElement): void {\n mark(table, \"table\");\n if (table.caption) mark(table.caption, PARTS.CAPTION);\n for (const section of [table.tHead, ...Array.from(table.tBodies), table.tFoot]) {\n if (section) mark(section, PARTS[section.tagName]);\n }\n for (const row of Array.from(table.rows)) {\n mark(row, PARTS.TR);\n for (const cell of Array.from(row.cells)) mark(cell, PARTS[cell.tagName]);\n }\n}\n\ndefine(\"pont2-prim-table\", Table);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-table\": Table;\n }\n}\n","import { html, type PropertyDeclarations } from \"lit\";\n\nimport { HostElement, NativeEnhancer } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { applyButton, isSoftDisabled, type ButtonSize } from \"../button/button\";\n\n/**\n * # Pagination\n *\n * shadcn: `<Pagination>` (`<nav aria-label=\"pagination\">`) > `<PaginationContent>`\n * (`<ul>`) > `<PaginationItem>` (`<li>`) > `<PaginationLink isActive>` (a Button\n * rendered as `<a>`), `<PaginationPrevious>`, `<PaginationNext>`,\n * `<PaginationEllipsis>`.\n *\n * pont2: the nav, list and items are hosts with their native roles; links are\n * Tier 3 enhancers around the native `<a>` (or `<button>`) you write, styled\n * with the Button recipe.\n *\n * ```html\n * <pont2-prim-pagination>\n * <pont2-prim-pagination-content>\n * <pont2-prim-pagination-item><pont2-prim-pagination-previous><a href=\"?page=1\">Previous</a></pont2-prim-pagination-previous></pont2-prim-pagination-item>\n * <pont2-prim-pagination-item><pont2-prim-pagination-link><a href=\"?page=1\">1</a></pont2-prim-pagination-link></pont2-prim-pagination-item>\n * <pont2-prim-pagination-item><pont2-prim-pagination-link active><a href=\"?page=2\">2</a></pont2-prim-pagination-link></pont2-prim-pagination-item>\n * <pont2-prim-pagination-item><pont2-prim-pagination-ellipsis></pont2-prim-pagination-ellipsis></pont2-prim-pagination-item>\n * <pont2-prim-pagination-item><pont2-prim-pagination-next><a href=\"?page=3\">Next</a></pont2-prim-pagination-next></pont2-prim-pagination-item>\n * </pont2-prim-pagination-content>\n * </pont2-prim-pagination>\n * ```\n *\n * For a pager driven by `page` / `page-count`, use the kit's `<pont2-pagination>`.\n *\n * @tag pont2-prim-pagination\n */\nexport class Pagination extends HostElement {\n static override identity = \"pagination\";\n static override slotName = \"pagination\";\n static override role = \"navigation\";\n\n protected readonly messages = new MessagesController(this);\n\n protected override updated(): void {\n // shadcn: aria-label=\"pagination\"; in the page's language here. An author aria-label wins.\n this.internals.ariaLabel = msg(\"pagination\");\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals.ariaLabel = msg(\"pagination\");\n }\n}\n\n/** shadcn `<ul data-slot=\"pagination-content\">`. @tag pont2-prim-pagination-content */\nexport class PaginationContent extends HostElement {\n static override identity = \"pagination-content\";\n static override slotName = \"pagination-content\";\n static override role = \"list\";\n}\n\n/** shadcn `<li data-slot=\"pagination-item\">`. @tag pont2-prim-pagination-item */\nexport class PaginationItem extends HostElement {\n static override identity = \"pagination-item\";\n static override slotName = \"pagination-item\";\n static override role = \"listitem\";\n}\n\n/**\n * shadcn `PaginationLink`: a Button (`ghost`, or `outline` when active) on\n * the native `<a>` or `<button>` inside, with `aria-current=\"page\"` and\n * `data-active` when active.\n *\n * @tag pont2-prim-pagination-link\n * @attr active - the current page (shadcn `isActive`)\n * @attr size - Button size (default `icon`)\n * @attr disabled\n */\nexport class PaginationLink extends NativeEnhancer<HTMLAnchorElement | HTMLButtonElement> {\n static override nativeSelector = \"a, button\";\n /** `data-slot` on the native element. */\n static controlSlot = \"pagination-link\";\n static defaultSize: ButtonSize = \"icon\";\n\n static override properties: PropertyDeclarations = {\n active: { type: Boolean, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n declare active: boolean;\n declare size: ButtonSize;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.active = false;\n this.size = (this.constructor as typeof PaginationLink).defaultSize;\n this.disabled = false;\n // A disabled link (aria-disabled) must not navigate.\n this.addEventListener(\n \"click\",\n e => {\n const c = this.control;\n if (c && this.disabled && (c === e.target || c.contains(e.target as Node)) && isSoftDisabled(c)) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n },\n { capture: true },\n );\n }\n\n protected apply(control: HTMLAnchorElement | HTMLButtonElement): void {\n control.setAttribute(\"data-slot\", (this.constructor as typeof PaginationLink).controlSlot);\n applyButton(control, { variant: this.active ? \"outline\" : \"ghost\", size: this.size, disabled: this.disabled });\n if (this.active) {\n control.setAttribute(\"aria-current\", \"page\");\n control.setAttribute(\"data-active\", \"true\");\n } else {\n control.removeAttribute(\"aria-current\");\n control.removeAttribute(\"data-active\");\n }\n if (control instanceof HTMLButtonElement && !control.hasAttribute(\"type\")) control.type = \"button\";\n }\n}\n\n/**\n * shadcn `PaginationPrevious`: a default-size link labelled \"Go to previous\n * page\", with a chevron before your text (drawn by CSS, so the native\n * element's content stays yours). Wrap the text in\n * `<span data-slot=\"pagination-previous-text\">` to hide it below 640px, as\n * shadcn does.\n *\n * @tag pont2-prim-pagination-previous\n */\nexport class PaginationPrevious extends PaginationLink {\n static override controlSlot = \"pagination-previous\";\n static override defaultSize: ButtonSize = \"default\";\n\n protected readonly messages = new MessagesController(this);\n\n protected override apply(control: HTMLAnchorElement | HTMLButtonElement): void {\n super.apply(control);\n if (!control.hasAttribute(\"aria-label\") || control.hasAttribute(\"data-pont2-default-label\")) {\n control.setAttribute(\"aria-label\", msg(\"pagination_previous_page\"));\n control.setAttribute(\"data-pont2-default-label\", \"\");\n }\n }\n}\n\n/** shadcn `PaginationNext`: as Previous, chevron after the text. @tag pont2-prim-pagination-next */\nexport class PaginationNext extends PaginationLink {\n static override controlSlot = \"pagination-next\";\n static override defaultSize: ButtonSize = \"default\";\n\n protected readonly messages = new MessagesController(this);\n\n protected override apply(control: HTMLAnchorElement | HTMLButtonElement): void {\n super.apply(control);\n if (!control.hasAttribute(\"aria-label\") || control.hasAttribute(\"data-pont2-default-label\")) {\n control.setAttribute(\"aria-label\", msg(\"pagination_next_page\"));\n control.setAttribute(\"data-pont2-default-label\", \"\");\n }\n }\n}\n\n/**\n * shadcn `PaginationEllipsis`: `<span aria-hidden>` with a \"more\" icon and\n * a screen-reader \"More pages\" (rendered by the host).\n *\n * @tag pont2-prim-pagination-ellipsis\n */\nexport class PaginationEllipsis extends HostElement {\n static override identity = \"pagination-ellipsis\";\n static override slotName = \"pagination-ellipsis\";\n\n protected readonly messages = new MessagesController(this);\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals.ariaHidden = \"true\";\n }\n\n override render() {\n return html`${icons.ellipsis()}<span data-pont2-sr-only>${msg(\"pagination_more\")}</span>`;\n }\n}\n\ndefine(\"pont2-prim-pagination\", Pagination);\ndefine(\"pont2-prim-pagination-content\", PaginationContent);\ndefine(\"pont2-prim-pagination-item\", PaginationItem);\ndefine(\"pont2-prim-pagination-link\", PaginationLink);\ndefine(\"pont2-prim-pagination-previous\", PaginationPrevious);\ndefine(\"pont2-prim-pagination-next\", PaginationNext);\ndefine(\"pont2-prim-pagination-ellipsis\", PaginationEllipsis);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-pagination\": Pagination;\n \"pont2-prim-pagination-content\": PaginationContent;\n \"pont2-prim-pagination-item\": PaginationItem;\n \"pont2-prim-pagination-link\": PaginationLink;\n \"pont2-prim-pagination-previous\": PaginationPrevious;\n \"pont2-prim-pagination-next\": PaginationNext;\n \"pont2-prim-pagination-ellipsis\": PaginationEllipsis;\n }\n}\n","/**\n * Pure InputOTP helpers (no DOM), unit-tested in node.\n *\n * `pattern` is a whole-string regular expression source, like the input-otp\n * library's `REGEXP_ONLY_DIGITS` (`^\\d+$`); each character is tested on its\n * own, so pasted \"123-456\" or \"12 34 56\" is cleaned to \"123456\".\n */\nexport const REGEXP_ONLY_DIGITS = \"^\\\\d+$\";\nexport const REGEXP_ONLY_CHARS = \"^[a-zA-Z]+$\";\nexport const REGEXP_ONLY_DIGITS_AND_CHARS = \"^[a-zA-Z0-9]+$\";\n\nexport function sanitizeOtp(raw: string, maxLength: number, pattern: string | null = REGEXP_ONLY_DIGITS): string {\n let re: RegExp | null = null;\n if (pattern) {\n try {\n re = new RegExp(pattern);\n } catch {\n re = null;\n }\n }\n let out = \"\";\n for (const ch of Array.from(raw)) {\n if (out.length >= maxLength) break;\n if (/\\s/.test(ch)) continue;\n if (re && !re.test(ch)) continue;\n out += ch;\n }\n return out;\n}\n\nexport interface OtpSlotState {\n char: string | null;\n isActive: boolean;\n hasFakeCaret: boolean;\n}\n\n/**\n * Per-slot state, as input-otp computes it: while focused, the slot(s) under\n * the selection are active; a collapsed selection on an empty slot shows the\n * fake caret. A full value with the caret at the end activates the last slot.\n */\nexport function otpSlots(\n value: string,\n maxLength: number,\n focused: boolean,\n selStart: number | null,\n selEnd: number | null,\n): OtpSlotState[] {\n const chars = Array.from(value);\n let start = selStart ?? chars.length;\n let end = selEnd ?? start;\n if (start === end && start >= maxLength) {\n start = maxLength - 1;\n end = maxLength;\n }\n const collapsed = start === end;\n return Array.from({ length: maxLength }, (_, i) => {\n const char = chars[i] ?? null;\n const isActive = focused && (collapsed ? i === start : i >= start && i < end);\n return { char, isActive, hasFakeCaret: isActive && collapsed && char === null };\n });\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport { live } from \"lit/directives/live.js\";\n\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { define, sel } from \"../../core/names\";\nimport { REGEXP_ONLY_DIGITS, otpSlots, sanitizeOtp, type OtpSlotState } from \"./otp\";\n\nexport { REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from \"./otp\";\n\nconst ROOT = sel(\"input-otp\");\nconst SLOT = sel(\"input-otp-slot\");\nconst FORWARDED = [\"aria-label\", \"aria-labelledby\", \"aria-describedby\", \"aria-invalid\"] as const;\n\nexport interface OtpCompleteDetail {\n value: string;\n}\n\n/**\n * # InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator\n *\n * shadcn wraps the `input-otp` library: a container `div` holding the author's\n * groups/slots plus ONE real `<input>` stretched transparently over them; the\n * slots only *draw* the characters and a fake caret.\n * ```\n * shadcn: div.cn-input-otp > [InputOTPGroup > InputOTPSlot ×n, InputOTPSeparator] + div > input[data-slot=input-otp]\n * pont2: pont2-prim-input-otp > [pont2-prim-input-otp-group > pont2-prim-input-otp-slot ×n, pont2-prim-input-otp-separator] + div > input[data-slot=input-otp]\n * ```\n * Same shape, same reason: the single native `<input autocomplete=\"one-time-code\">`\n * is what SMS autofill (iOS/Android), password managers, paste and form\n * submission need. It is a Tier 3 core inside a Tier 1 container; the slots\n * are Tier 1 hosts the container pushes state into.\n *\n * The input is rendered by the host (after the author's children, where\n * input-otp puts it), so the author never writes it; `name`, `required`,\n * `disabled`, `autocomplete`, `inputmode`, `pattern` and the ARIA naming\n * attributes are forwarded to it.\n *\n * @tag pont2-prim-input-otp\n * @attr maxlength - Number of characters (default 6).\n * @attr pattern - Per-character regex source (default `^\\d+$`, digits). `pattern=\"\"` accepts anything.\n * @attr value - Default value; `.value` is live.\n * @attr name, required, disabled, autocomplete (one-time-code), inputmode, input-id\n * @fires input, change - Native events from the inner input (bubble through the host).\n * @fires pont2-complete - `{ value }` when every slot is filled (input-otp `onComplete`).\n */\nexport class InputOTP extends HostElement {\n static override identity = \"input-otp\";\n\n static override properties: PropertyDeclarations = {\n maxLength: { type: Number, attribute: \"maxlength\" },\n pattern: { type: String },\n defaultValue: { type: String, attribute: \"value\" },\n name: { type: String },\n required: { type: Boolean },\n disabled: { type: Boolean, reflect: true },\n autocomplete: { type: String },\n keyboardMode: { type: String, attribute: \"inputmode\" },\n inputId: { type: String, attribute: \"input-id\" },\n current: { state: true },\n forwarded: { state: true },\n };\n\n declare maxLength: number;\n declare pattern: string | null;\n declare defaultValue: string | null;\n declare name: string | null;\n declare required: boolean;\n declare disabled: boolean;\n declare autocomplete: string;\n /** Forwarded to the input as `inputmode` (named so it does not shadow HTMLElement.inputMode). */\n declare keyboardMode: string | null;\n declare inputId: string | null;\n declare protected current: string;\n declare protected forwarded: Record<string, string | null>;\n\n private dirty = false;\n private focused = false;\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.maxLength = 6;\n this.pattern = REGEXP_ONLY_DIGITS;\n this.defaultValue = null;\n this.name = null;\n this.required = false;\n this.disabled = false;\n this.autocomplete = \"one-time-code\";\n this.keyboardMode = null;\n this.inputId = null;\n this.current = \"\";\n this.forwarded = {};\n }\n\n /** The native input (the real form control). */\n get input(): HTMLInputElement | null {\n return this.querySelector(\":scope > [data-pont2-input-otp-input-wrapper] > input\");\n }\n\n get value(): string {\n return this.current;\n }\n set value(v: string) {\n this.dirty = true;\n this.current = sanitizeOtp(String(v ?? \"\"), this.maxLength, this.pattern || null);\n }\n\n override focus(options?: FocusOptions): void {\n this.input?.focus(options);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.readForwarded();\n this.observer ??= new MutationObserver(m => {\n if (m.some(r => r.type === \"attributes\" && r.target === this)) this.readForwarded();\n else this.syncSlots();\n });\n this.observer.observe(this, { attributes: true, attributeFilter: [...FORWARDED], childList: true, subtree: true });\n document.addEventListener(\"selectionchange\", this.onSelectionChange);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n document.removeEventListener(\"selectionchange\", this.onSelectionChange);\n }\n\n private readForwarded(): void {\n const f: Record<string, string | null> = {};\n for (const a of FORWARDED) f[a] = this.getAttribute(a);\n this.forwarded = f;\n }\n\n private get slots(): InputOTPSlot[] {\n return Array.from(this.querySelectorAll<InputOTPSlot>(SLOT)).filter(s => s.closest(ROOT) === this);\n }\n\n /** Push per-slot state into the slot elements. */\n private syncSlots(): void {\n const input = this.input;\n const states = otpSlots(this.current, this.maxLength, this.focused, input?.selectionStart ?? null, input?.selectionEnd ?? null);\n const invalid = this.forwarded[\"aria-invalid\"] === \"true\";\n this.slots.forEach((slot, order) => {\n const i = slot.hasAttribute(\"index\") ? Number(slot.getAttribute(\"index\")) : order;\n if (typeof slot.sync === \"function\") slot.sync(states[i] ?? { char: null, isActive: false, hasFakeCaret: false }, invalid);\n });\n }\n\n /* -------------------------------------------------------------- */\n /* Input handling (what input-otp does) */\n /* -------------------------------------------------------------- */\n\n private setFromInput(raw: string, input: HTMLInputElement): void {\n const clean = sanitizeOtp(raw, this.maxLength, this.pattern || null);\n if (clean !== input.value) {\n input.value = clean;\n input.setSelectionRange(clean.length, clean.length);\n }\n const was = this.current;\n this.dirty = true;\n this.current = clean;\n if (clean !== was && clean.length === this.maxLength) {\n fire<OtpCompleteDetail>(this, \"pont2-complete\", { value: clean });\n }\n this.syncSlots();\n }\n\n private onInput = (e: Event) => {\n this.setFromInput((e.target as HTMLInputElement).value, e.target as HTMLInputElement);\n };\n\n private onPaste = (e: ClipboardEvent) => {\n const input = e.target as HTMLInputElement;\n const text = e.clipboardData?.getData(\"text/plain\");\n if (text == null) return;\n // The native maxlength would truncate \"123-456\" before we could clean it.\n e.preventDefault();\n const start = input.selectionStart ?? input.value.length;\n const end = input.selectionEnd ?? start;\n this.setFromInput(input.value.slice(0, start) + text + input.value.slice(end), input);\n input.dispatchEvent(new Event(\"input\", { bubbles: true, composed: true }));\n };\n\n private placeCaret = () => {\n const input = this.input;\n if (!input) return;\n const n = input.value.length;\n // Full: select the last character so the next key replaces it (input-otp behaviour).\n if (n >= this.maxLength) input.setSelectionRange(this.maxLength - 1, this.maxLength);\n else input.setSelectionRange(n, n);\n this.syncSlots();\n };\n\n private onFocus = () => {\n this.focused = true;\n this.setData(\"focused\", true);\n requestAnimationFrame(this.placeCaret);\n };\n\n private onBlur = () => {\n this.focused = false;\n this.setData(\"focused\", false);\n this.syncSlots();\n };\n\n private onSelectionChange = () => {\n if (this.focused && document.activeElement === this.input) this.syncSlots();\n };\n\n /* -------------------------------------------------------------- */\n /* Render */\n /* -------------------------------------------------------------- */\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.dirty && (changed.has(\"defaultValue\") || !this.hasUpdated)) {\n this.current = sanitizeOtp(this.defaultValue ?? \"\", this.maxLength, this.pattern || null);\n }\n this.setData(\"disabled\", this.disabled);\n this.setData(\"complete\", this.current.length === this.maxLength);\n }\n\n protected override updated(): void {\n this.syncSlots();\n }\n\n override render() {\n const digits = this.pattern === REGEXP_ONLY_DIGITS;\n const f = this.forwarded;\n return html`<div data-pont2-input-otp-input-wrapper>\n <input\n data-pont2-input-otp-input\n data-slot=\"input-otp\"\n id=${this.inputId ?? nothing}\n name=${this.name ?? nothing}\n .value=${live(this.current)}\n maxlength=${this.maxLength}\n pattern=${this.pattern || nothing}\n inputmode=${(this.keyboardMode ?? (digits ? \"numeric\" : \"text\")) as never}\n autocomplete=${this.autocomplete as never}\n spellcheck=\"false\"\n autocapitalize=\"off\"\n ?required=${this.required}\n ?disabled=${this.disabled}\n aria-label=${f[\"aria-label\"] ?? nothing}\n aria-labelledby=${f[\"aria-labelledby\"] ?? nothing}\n aria-describedby=${f[\"aria-describedby\"] ?? nothing}\n aria-invalid=${f[\"aria-invalid\"] ?? nothing}\n @input=${this.onInput}\n @paste=${this.onPaste}\n @focus=${this.onFocus}\n @blur=${this.onBlur}\n @click=${this.placeCaret}\n />\n </div>`;\n }\n}\n\n/**\n * @tag pont2-prim-input-otp-group\n */\nexport class InputOTPGroup extends HostElement {\n static override identity = \"input-otp-group\";\n static override slotName = \"input-otp-group\";\n}\n\n/**\n * Draws one character (and the fake caret). Purely visual: the native input\n * is what assistive technology and autofill interact with.\n *\n * @tag pont2-prim-input-otp-slot\n * @attr index - Character position; defaults to the slot's order in the InputOTP.\n */\nexport class InputOTPSlot extends HostElement {\n static override identity = \"input-otp-slot\";\n static override slotName = \"input-otp-slot\";\n\n static override properties: PropertyDeclarations = {\n state: { state: true },\n };\n\n declare protected state: OtpSlotState;\n\n constructor() {\n super();\n this.state = { char: null, isActive: false, hasFakeCaret: false };\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n (this.closest(ROOT) as InputOTP | null)?.requestUpdate();\n }\n\n /** @internal Called by the InputOTP. */\n sync(state: OtpSlotState, invalid: boolean): void {\n this.state = state;\n this.setData(\"active\", state.isActive ? \"true\" : \"false\");\n this.setData(\"filled\", state.char != null);\n this.setData(\"invalid\", invalid);\n }\n\n override render() {\n const { char, hasFakeCaret } = this.state;\n return html`${char ?? nothing}${hasFakeCaret\n ? html`<div data-pont2-input-otp-caret><div data-pont2-input-otp-caret-line></div></div>`\n : nothing}`;\n }\n}\n\n/**\n * @tag pont2-prim-input-otp-separator\n */\nexport class InputOTPSeparator extends HostElement {\n static override identity = \"input-otp-separator\";\n static override slotName = \"input-otp-separator\";\n static override role = \"separator\";\n\n override render() {\n return icons.minus();\n }\n}\n\ndefine(\"pont2-prim-input-otp\", InputOTP);\ndefine(\"pont2-prim-input-otp-group\", InputOTPGroup);\ndefine(\"pont2-prim-input-otp-slot\", InputOTPSlot);\ndefine(\"pont2-prim-input-otp-separator\", InputOTPSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-input-otp\": InputOTP;\n \"pont2-prim-input-otp-group\": InputOTPGroup;\n \"pont2-prim-input-otp-slot\": InputOTPSlot;\n \"pont2-prim-input-otp-separator\": InputOTPSeparator;\n }\n interface HTMLElementEventMap {\n \"pont2-complete\": CustomEvent<OtpCompleteDetail>;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel } from \"../../core/names\";\n\nexport type ProgressStatus = \"progressing\" | \"complete\" | \"indeterminate\";\n\nconst ROOT = sel(\"progress\");\n\n/**\n * # Progress, ProgressLabel, ProgressValue: Tier 1/2 (status widget)\n *\n * shadcn: `<Progress value>` → Base UI `<Progress.Root>` (div[role=progressbar])\n * holding the author's children, then `<Progress.Track>` > `<Progress.Indicator>`\n * which shadcn always appends. `<ProgressLabel>` / `<ProgressValue>` are optional\n * children (span).\n *\n * pont2:\n * ```\n * pont2-prim-progress[role=progressbar] ← root; aria-value* via ElementInternals\n * pont2-prim-progress-label? pont2-prim-progress-value? ← author-written, never moved\n * div[data-slot=progress-track] > div[data-slot=progress-indicator] ← rendered last, as shadcn does\n * ```\n * Status attributes are Base UI's: `data-progressing` | `data-complete` |\n * `data-indeterminate`, on every part. No `value` attribute = indeterminate.\n *\n * @tag pont2-prim-progress\n * @attr value - Current value; omit for indeterminate.\n * @attr min, max - Range (default 0–100).\n */\nexport class Progress extends HostElement {\n static override identity = \"progress\";\n static override slotName = \"progress\";\n static override role = \"progressbar\";\n\n static override properties: PropertyDeclarations = {\n value: { type: Number },\n min: { type: Number },\n max: { type: Number },\n };\n\n declare value: number | null;\n declare min: number;\n declare max: number;\n\n constructor() {\n super();\n this.value = null;\n this.min = 0;\n this.max = 100;\n }\n\n get status(): ProgressStatus {\n if (this.value == null || Number.isNaN(this.value)) return \"indeterminate\";\n return this.value >= this.max ? \"complete\" : \"progressing\";\n }\n\n /** 0..1, or null when indeterminate. */\n get fraction(): number | null {\n if (this.status === \"indeterminate\") return null;\n const span = this.max - this.min;\n return span > 0 ? Math.min(1, Math.max(0, (this.value! - this.min) / span)) : 0;\n }\n\n /** The value as Base UI formats it by default: a locale percentage. */\n get formattedValue(): string {\n const f = this.fraction;\n return f == null ? \"\" : new Intl.NumberFormat(undefined, { style: \"percent\" }).format(f);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n const status = this.status;\n const i = this.internals;\n i.ariaValueMin = String(this.min);\n i.ariaValueMax = String(this.max);\n i.ariaValueNow = status === \"indeterminate\" ? null : String(this.value);\n i.ariaValueText = status === \"indeterminate\" ? null : this.formattedValue;\n for (const s of [\"progressing\", \"complete\", \"indeterminate\"] as const) this.setData(s, s === status);\n }\n\n protected override updated(): void {\n const labels = this.own<ProgressLabel>(sel(\"progress-label\"));\n if (\"ariaLabelledByElements\" in ElementInternals.prototype) {\n (this.internals as unknown as { ariaLabelledByElements: Element[] | null }).ariaLabelledByElements = labels.length ? labels : null;\n } else if (labels.length && !this.hasAttribute(\"aria-labelledby\")) {\n this.setAttribute(\"aria-labelledby\", labels.map(l => ensureId(l, \"progress-label\")).join(\" \"));\n }\n const parts = [...labels, ...this.own<ProgressValue>(sel(\"progress-value\"))];\n for (const p of parts) if (typeof p.sync === \"function\") p.sync(this.status, this.formattedValue);\n }\n\n private own<T extends Element>(sel: string): T[] {\n return Array.from(this.querySelectorAll<T>(sel)).filter(el => el.closest(ROOT) === this);\n }\n\n override render() {\n const s = this.status;\n const f = this.fraction;\n return html`<div\n data-pont2-progress-track\n data-slot=\"progress-track\"\n ?data-progressing=${s === \"progressing\"}\n ?data-complete=${s === \"complete\"}\n ?data-indeterminate=${s === \"indeterminate\"}\n >\n <div\n data-pont2-progress-indicator\n data-slot=\"progress-indicator\"\n ?data-progressing=${s === \"progressing\"}\n ?data-complete=${s === \"complete\"}\n ?data-indeterminate=${s === \"indeterminate\"}\n style=${f == null ? nothing : styleMap({ insetInlineStart: \"0\", width: `${f * 100}%` })}\n ></div>\n </div>`;\n }\n}\n\n/** Shared status sync for the optional parts. */\nabstract class ProgressPart extends HostElement {\n override connectedCallback(): void {\n super.connectedCallback();\n (this.closest(ROOT) as Progress | null)?.requestUpdate();\n }\n\n /** @internal Called by the root. */\n sync(status: ProgressStatus, _formatted: string): void {\n for (const s of [\"progressing\", \"complete\", \"indeterminate\"] as const) this.setData(s, s === status);\n }\n}\n\n/**\n * Labels the progress bar (the root's accessible name points at it).\n * @tag pont2-prim-progress-label\n */\nexport class ProgressLabel extends ProgressPart {\n static override identity = \"progress-label\";\n static override slotName = \"progress-label\";\n}\n\n/**\n * Shows the formatted value (\"45%\") unless you write your own text inside it.\n * @tag pont2-prim-progress-value\n */\nexport class ProgressValue extends ProgressPart {\n static override identity = \"progress-value\";\n static override slotName = \"progress-value\";\n\n static override properties: PropertyDeclarations = {\n formatted: { state: true },\n };\n\n declare protected formatted: string;\n private authored = false;\n\n constructor() {\n super();\n this.formatted = \"\";\n }\n\n override connectedCallback(): void {\n // Author text wins (Base UI's `children`); decided once, before the first render.\n if (!this.hasUpdated) this.authored = (this.textContent ?? \"\").trim() !== \"\";\n super.connectedCallback();\n this.setAttribute(\"aria-hidden\", this.getAttribute(\"aria-hidden\") ?? \"true\");\n }\n\n override sync(status: ProgressStatus, formatted: string): void {\n super.sync(status, formatted);\n this.formatted = formatted;\n }\n\n override render() {\n return this.authored ? nothing : this.formatted;\n }\n}\n\ndefine(\"pont2-prim-progress\", Progress);\ndefine(\"pont2-prim-progress-label\", ProgressLabel);\ndefine(\"pont2-prim-progress-value\", ProgressValue);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-progress\": Progress;\n \"pont2-prim-progress-label\": ProgressLabel;\n \"pont2-prim-progress-value\": ProgressValue;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { RovingFocusController, type Orientation } from \"../../core/controllers/roving-focus\";\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement, type ValidityResult } from \"../../core/form-control\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define, sel } from \"../../core/names\";\n\n/**\n * # RadioGroup, RadioGroupItem: Tier 2 (widgets)\n *\n * shadcn: `<RadioGroup>` → Base UI `<RadioGroup>` (`<div role=\"radiogroup\">`\n * plus a hidden input) and `<RadioGroupItem value>` → Base UI `<Radio.Root>`\n * (`<span role=\"radio\">`) > `<Radio.Indicator>` > `<span>` (the dot).\n *\n * pont2:\n * ```\n * pont2-prim-radio-group[role=radiogroup] ← form-associated: submits name=value\n * pont2-prim-radio-group-item[role=radio] ← author-written, never moved\n * span[data-slot=radio-group-indicator] ← rendered while checked\n * span[data-pont2-radio-group-indicator-icon]\n * ```\n *\n * The group owns the value, the form value, validity and the roving tab stop.\n * Items are independent stateful widgets nested inside it, which is the one\n * kind of nesting the architecture keeps (04-composition.md); they find their\n * group with `closest()` and report presses to it. Items are also\n * form-associated (submitting nothing) purely so that they are *labelable*:\n * shadcn's `<RadioGroupItem id=\"r1\"/><Label htmlFor=\"r1\">` works unchanged.\n *\n * Keyboard (Base UI / APG): Tab enters at the checked item (or the first),\n * arrows move focus **and select** (wrapping), Space selects the focused item.\n */\nexport class RadioGroup extends FormControlElement {\n static override identity = \"radio-group\";\n static override slotName = \"radio-group\";\n static override role = \"radiogroup\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n orientation: { type: String },\n };\n\n /** The selected item's value; `\"\"` when nothing is selected. */\n declare value: string;\n /** Arrow-key axis. Base UI accepts both axes by default. */\n declare orientation: Orientation | undefined;\n\n private roving = new RovingFocusController(this, {\n items: () => this.items,\n orientation: () => this.orientation ?? \"both\",\n onNavigate: item => this.selectItem(item as RadioGroupItem),\n });\n\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.value = \"\";\n }\n\n /** The items that belong to this group (not to a nested group). */\n get items(): RadioGroupItem[] {\n return Array.from(this.querySelectorAll<RadioGroupItem>(sel(\"radio-group-item\"))).filter(\n i => i.closest(sel(\"radio-group\")) === this,\n );\n }\n\n protected override get hostFocusable(): boolean {\n return false;\n }\n\n protected override get validationAnchor(): HTMLElement | undefined {\n return this.items[0];\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, subtree: true });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n /** Called by an item when it is pressed. */\n selectItem(item: RadioGroupItem): void {\n if (this.isDisabled || this.readOnly || item.disabled) return;\n if (item.value === this.value) return;\n this.value = item.value;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n /** Called by items when they connect, so a late-upgrading item is synced. */\n itemsChanged(): void {\n this.requestUpdate();\n }\n\n protected formValue() {\n return this.value || null;\n }\n\n protected resetToDefault(): void {\n this.value = this.getAttribute(\"value\") ?? \"\";\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n if (typeof state === \"string\") this.value = state;\n }\n\n protected override validate(): ValidityResult | null {\n return this.required && !this.value\n ? { flags: { valueMissing: true }, message: \"Please select one of these options.\" }\n : null;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.internals.ariaOrientation = this.orientation === \"horizontal\" || this.orientation === \"vertical\" ? this.orientation : null;\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n const disabled = this.isDisabled;\n let checked: RadioGroupItem | null = null;\n for (const item of this.items) {\n item.checked = !!this.value && item.value === this.value;\n item.groupDisabled = disabled;\n item.groupReadOnly = this.readOnly;\n item.groupRequired = this.required;\n if (item.checked) checked = item;\n }\n this.roving.sync(checked);\n }\n}\n\n/**\n * @tag pont2-prim-radio-group-item\n * @attr value - The value the group takes when this item is selected.\n * @attr disabled\n */\nexport class RadioGroupItem extends HostElement {\n static formAssociated = true;\n static override identity = \"radio-group-item\";\n static override slotName = \"radio-group-item\";\n static override role = \"radio\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n checked: { state: true },\n groupDisabled: { state: true },\n groupReadOnly: { state: true },\n groupRequired: { state: true },\n formDisabled: { state: true },\n };\n\n declare value: string;\n declare disabled: boolean;\n declare checked: boolean;\n declare groupDisabled: boolean;\n declare groupReadOnly: boolean;\n declare groupRequired: boolean;\n declare protected formDisabled: boolean;\n\n constructor() {\n super();\n this.value = \"\";\n this.disabled = false;\n this.checked = false;\n this.groupDisabled = false;\n this.groupReadOnly = false;\n this.groupRequired = false;\n this.formDisabled = false;\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n }\n\n get group(): RadioGroup | null {\n return this.closest(sel(\"radio-group\")) as RadioGroup | null;\n }\n\n get isDisabled(): boolean {\n return this.disabled || this.groupDisabled || this.formDisabled;\n }\n\n get labels(): NodeList {\n return this.internals.labels;\n }\n\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.group?.itemsChanged();\n }\n\n private onClick = (e: MouseEvent) => {\n if (this.isDisabled) {\n e.preventDefault();\n return;\n }\n this.group?.selectItem(this);\n // A press focuses the item, as a native radio does (also when it came from a <label>).\n if (document.activeElement !== this) this.focus();\n };\n\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.target !== this) return;\n if (e.key === \" \") {\n e.preventDefault();\n this.click();\n }\n // Enter does not select a radio (native behaviour); it would submit the form natively,\n // so mirror that through the form's implicit submission.\n if (e.key === \"Enter\") this.internals.form?.requestSubmit();\n };\n\n protected override willUpdate(): void {\n const disabled = this.isDisabled;\n this.internals.ariaChecked = String(this.checked);\n this.internals.ariaDisabled = disabled ? \"true\" : null;\n this.internals.ariaReadOnly = this.groupReadOnly ? \"true\" : null;\n this.internals.ariaRequired = this.groupRequired ? \"true\" : null;\n this.setData(\"checked\", this.checked);\n this.setData(\"unchecked\", !this.checked);\n this.setData(\"disabled\", disabled);\n this.setData(\"readonly\", this.groupReadOnly);\n this.setData(\"required\", this.groupRequired);\n this.setState(\"checked\", this.checked);\n // The group decides the tab stop; a disabled item is never one.\n if (disabled) this.tabIndex = -1;\n else if (!this.hasAttribute(\"tabindex\")) this.tabIndex = -1;\n }\n\n override render() {\n if (!this.checked) return nothing;\n return html`<span data-pont2-radio-group-indicator data-slot=\"radio-group-indicator\" data-checked\n ><span data-pont2-radio-group-indicator-icon></span\n ></span>`;\n }\n}\n\ndefine(\"pont2-prim-radio-group\", RadioGroup);\ndefine(\"pont2-prim-radio-group-item\", RadioGroupItem);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-radio-group\": RadioGroup;\n \"pont2-prim-radio-group-item\": RadioGroupItem;\n }\n}\n","/**\n * Pure slider maths (no DOM), shared by <pont2-prim-slider> and unit-tested in node.\n * Mirrors Base UI's Slider value handling: values are clamped to [min, max],\n * snapped to `step` measured from `min`, and in a range slider a thumb can\n * neither cross nor come closer than `minStepsBetweenValues * step` to its\n * neighbours.\n */\n\nexport interface SliderRange {\n min: number;\n max: number;\n step: number;\n}\n\nexport const clamp = (v: number, min: number, max: number) => Math.min(max, Math.max(min, v));\n\n/** Decimal places of a number, so 0.1 + 0.2 snaps to 0.3 rather than 0.30000000000000004. */\nexport function decimals(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const s = String(n);\n if (s.includes(\"e-\")) return Number(s.split(\"e-\")[1]);\n const i = s.indexOf(\".\");\n return i < 0 ? 0 : s.length - i - 1;\n}\n\nexport function snap(value: number, { min, max, step }: SliderRange): number {\n if (!(step > 0)) return clamp(value, min, max);\n const snapped = Math.round((value - min) / step) * step + min;\n const d = Math.max(decimals(step), decimals(min));\n return clamp(Number(snapped.toFixed(d)), min, max);\n}\n\n/** 0..1 position of a value along the track. */\nexport function fraction(value: number, { min, max }: Pick<SliderRange, \"min\" | \"max\">): number {\n if (max <= min) return 0;\n return clamp((value - min) / (max - min), 0, 1);\n}\n\n/** Value at a 0..1 position along the track (before snapping). */\nexport function valueAt(f: number, { min, max }: Pick<SliderRange, \"min\" | \"max\">): number {\n return min + clamp(f, 0, 1) * (max - min);\n}\n\n/** Index of the thumb a pointer press at `value` should grab. Ties go to the later thumb when pressing above it. */\nexport function closestThumb(values: number[], value: number): number {\n let best = 0;\n let bestDist = Infinity;\n values.forEach((v, i) => {\n const d = Math.abs(v - value);\n if (d < bestDist || (d === bestDist && value > v)) {\n best = i;\n bestDist = d;\n }\n });\n return best;\n}\n\n/**\n * Sets thumb `index` to `value`, keeping the values ordered: the thumb is\n * clamped between its neighbours (Base UI's default \"none\" collision\n * behaviour), `minSteps` steps apart.\n */\nexport function setThumb(\n values: number[],\n index: number,\n value: number,\n range: SliderRange,\n minSteps = 0,\n): number[] {\n const gap = minSteps * range.step;\n const lo = index > 0 ? values[index - 1] + gap : range.min;\n const hi = index < values.length - 1 ? values[index + 1] - gap : range.max;\n const next = values.slice();\n next[index] = clamp(snap(value, range), lo, hi);\n return next;\n}\n\nexport type SliderKey = \"ArrowUp\" | \"ArrowDown\" | \"ArrowLeft\" | \"ArrowRight\" | \"PageUp\" | \"PageDown\" | \"Home\" | \"End\";\n\n/**\n * The value a key press moves a thumb to (APG slider pattern).\n * `rtl` flips Left/Right for horizontal sliders. Shift+Arrow moves by `largeStep`.\n */\nexport function keyValue(\n key: string,\n current: number,\n range: SliderRange & { largeStep: number },\n opts: { shift?: boolean; rtl?: boolean; vertical?: boolean } = {},\n): number | null {\n const small = opts.shift ? range.largeStep : range.step;\n const flip = opts.rtl && !opts.vertical ? -1 : 1;\n switch (key) {\n case \"ArrowUp\":\n return current + small;\n case \"ArrowDown\":\n return current - small;\n case \"ArrowRight\":\n return current + small * flip;\n case \"ArrowLeft\":\n return current - small * flip;\n case \"PageUp\":\n return current + range.largeStep;\n case \"PageDown\":\n return current - range.largeStep;\n case \"Home\":\n return range.min;\n case \"End\":\n return range.max;\n default:\n return null;\n }\n}\n\n/** Parses `value=\"25\"` or `value=\"25, 75\"` (the default value attribute). */\nexport function parseValues(attr: string | null | undefined, fallback: number): number[] {\n if (attr == null || attr.trim() === \"\") return [fallback];\n const out = attr\n .split(\",\")\n .map(s => Number(s.trim()))\n .filter(n => Number.isFinite(n));\n return out.length ? out.sort((a, b) => a - b) : [fallback];\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nimport { directionOf } from \"../../core/controllers/roving-focus\";\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement } from \"../../core/form-control\";\nimport { ensureId } from \"../../core/ids\";\nimport { define } from \"../../core/names\";\nimport { closestThumb, fraction, keyValue, parseValues, setThumb, valueAt, type SliderRange } from \"./slider-math\";\n\nexport type SliderOrientation = \"horizontal\" | \"vertical\";\n\n/**\n * # Slider: Tier 2 (widget, form-associated)\n *\n * shadcn: `<Slider defaultValue min max>` → Base UI\n * ```\n * Slider.Root div[data-slot=slider][data-orientation]\n * Control div\n * Track div[data-slot=slider-track]\n * Indicator div[data-slot=slider-range]\n * Thumb ×n div[data-slot=slider-thumb] > input[type=range] (the input carries role=slider)\n * ```\n * pont2:\n * ```\n * pont2-prim-slider ← root, form-associated (submits name=value per thumb)\n * div[data-slot=slider-control]\n * div[data-slot=slider-track] > div[data-slot=slider-range]\n * div[data-slot=slider-thumb][role=slider] ×n\n * ```\n * The thumbs carry `role=\"slider\"` and the ARIA values themselves, so Base UI's\n * per-thumb hidden `<input type=\"range\">` is not needed (one node fewer per\n * thumb); the root is the form control. Everything inside the root is\n * rendered by the slider (shadcn's Slider takes no children either).\n *\n * Single value: `value=\"40\"`. Range: `value=\"20, 80\"` (one thumb per value).\n * With no value, one thumb at `min`. Thumbs never cross.\n *\n * Keyboard (APG / Base UI): ←/↓ −step, →/↑ +step (← and → swap in RTL),\n * Shift+arrow and PageUp/PageDown ±largeStep, Home/End min/max.\n * Pointer: press anywhere on the control moves the closest thumb, then drags.\n *\n * @tag pont2-prim-slider\n * @attr value - Default value(s), comma-separated for a range. `.value` / `.values` are live.\n * @attr min, max, step, large-step, min-steps-between-values\n * @attr orientation - horizontal (default) | vertical\n * @attr name, disabled, readonly\n * @fires input - While the value changes (keyboard or drag).\n * @fires change - When a change is committed (key press, pointer release). Base UI `onValueCommitted`.\n */\nexport class Slider extends FormControlElement {\n static override identity = \"slider\";\n static override slotName = \"slider\";\n\n static override properties: PropertyDeclarations = {\n defaultValue: { type: String, attribute: \"value\" },\n min: { type: Number },\n max: { type: Number },\n step: { type: Number },\n largeStep: { type: Number, attribute: \"large-step\" },\n minStepsBetweenValues: { type: Number, attribute: \"min-steps-between-values\" },\n orientation: { type: String, reflect: true },\n values: { attribute: false },\n activeThumb: { state: true },\n };\n\n declare defaultValue: string | null;\n declare min: number;\n declare max: number;\n declare step: number;\n declare largeStep: number;\n declare minStepsBetweenValues: number;\n declare orientation: SliderOrientation;\n /** Live values, ascending; one per thumb. */\n declare values: number[];\n declare protected activeThumb: number;\n\n private dirty = false;\n private dragging = -1;\n\n constructor() {\n super();\n this.defaultValue = null;\n this.min = 0;\n this.max = 100;\n this.step = 1;\n this.largeStep = 10;\n this.minStepsBetweenValues = 0;\n this.orientation = \"horizontal\";\n this.values = [0];\n this.activeThumb = -1;\n }\n\n /** A number for a single-thumb slider, an array for a range (Base UI's shape). */\n get value(): number | number[] {\n return this.values.length === 1 ? this.values[0] : this.values.slice();\n }\n set value(v: number | number[]) {\n this.dirty = true;\n const arr = Array.isArray(v) ? v.slice() : [v];\n this.values = arr.map(n => setThumb([n], 0, n, this.range)[0]).sort((a, b) => a - b);\n }\n\n private get range(): SliderRange {\n return { min: this.min, max: this.max, step: this.step };\n }\n\n protected override get hostFocusable(): boolean {\n return false;\n }\n\n protected override get validationAnchor(): HTMLElement | undefined {\n return this.thumbs[0];\n }\n\n private get thumbs(): HTMLElement[] {\n return Array.from(this.querySelectorAll<HTMLElement>(\":scope > [data-slot=slider-control] > [data-slot=slider-thumb]\"));\n }\n\n private get control(): HTMLElement | null {\n return this.querySelector(\":scope > [data-slot=slider-control]\");\n }\n\n /* -------------------------------------------------------------- */\n /* Form */\n /* -------------------------------------------------------------- */\n\n protected formValue() {\n if (!this.name) return null;\n if (this.values.length === 1) return String(this.values[0]);\n const fd = new FormData();\n for (const v of this.values) fd.append(this.name, String(v));\n return fd;\n }\n\n protected resetToDefault(): void {\n this.dirty = false;\n this.values = this.initialValues();\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n if (typeof state === \"string\") this.value = Number(state);\n else if (state instanceof FormData) this.value = state.getAll(this.name).map(Number);\n }\n\n private initialValues(): number[] {\n return parseValues(this.defaultValue, this.min).map(v => setThumb([v], 0, v, this.range)[0]);\n }\n\n /* -------------------------------------------------------------- */\n /* Interaction */\n /* -------------------------------------------------------------- */\n\n private commit(index: number, raw: number, final: boolean): void {\n const next = setThumb(this.values, index, raw, this.range, this.minStepsBetweenValues);\n const changed = next[index] !== this.values[index];\n if (changed) {\n this.dirty = true;\n this.values = next;\n fireNative(this, \"input\");\n }\n if (final && (changed || this.dragging >= 0)) fireNative(this, \"change\");\n }\n\n private onKeyDown = (e: KeyboardEvent, index: number) => {\n if (this.isDisabled || this.readOnly) return;\n const vertical = this.orientation === \"vertical\";\n const v = keyValue(e.key, this.values[index], { ...this.range, largeStep: this.largeStep }, {\n shift: e.shiftKey,\n rtl: directionOf(this) === \"rtl\",\n vertical,\n });\n if (v == null) return;\n e.preventDefault();\n this.commit(index, v, true);\n };\n\n private valueFromPointer(e: PointerEvent): number {\n const rect = this.control!.getBoundingClientRect();\n const thumb = this.thumbs[0]?.getBoundingClientRect();\n // thumbAlignment=\"edge\": thumbs travel within the control, inset by half a thumb at each end.\n if (this.orientation === \"vertical\") {\n const t = thumb?.height ?? 0;\n return valueAt(1 - (e.clientY - rect.top - t / 2) / Math.max(1, rect.height - t), this.range);\n }\n const t = thumb?.width ?? 0;\n let f = (e.clientX - rect.left - t / 2) / Math.max(1, rect.width - t);\n if (directionOf(this) === \"rtl\") f = 1 - f;\n return valueAt(f, this.range);\n }\n\n private onPointerDown = (e: PointerEvent) => {\n if (this.isDisabled || this.readOnly || e.button !== 0) return;\n const control = this.control!;\n const raw = this.valueFromPointer(e);\n const onThumb = (e.target as HTMLElement).closest?.(\"[data-slot=slider-thumb]\") as HTMLElement | null;\n const index = onThumb ? this.thumbs.indexOf(onThumb) : closestThumb(this.values, raw);\n this.dragging = index;\n this.activeThumb = index;\n control.setPointerCapture(e.pointerId);\n e.preventDefault();\n this.thumbs[index]?.focus({ preventScroll: true });\n if (!onThumb) this.commit(index, raw, false);\n };\n\n private onPointerMove = (e: PointerEvent) => {\n if (this.dragging < 0) return;\n this.commit(this.dragging, this.valueFromPointer(e), false);\n };\n\n private onPointerUp = (e: PointerEvent) => {\n if (this.dragging < 0) return;\n this.control?.releasePointerCapture(e.pointerId);\n this.commit(this.dragging, this.values[this.dragging], true);\n this.dragging = -1;\n this.activeThumb = -1;\n };\n\n /* -------------------------------------------------------------- */\n /* Render */\n /* -------------------------------------------------------------- */\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n if (!this.dirty && (changed.has(\"defaultValue\") || changed.has(\"min\") || changed.has(\"max\") || !this.hasUpdated)) {\n this.values = this.initialValues();\n }\n this.setData(\"orientation\", this.orientation === \"vertical\" ? \"vertical\" : \"horizontal\");\n this.setData(\"dragging\", this.dragging >= 0);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n // Label the thumbs: <label for=\"slider-id\"> labels the root (it is form-associated);\n // the thumbs, which hold the focus, are labelled by the same elements.\n const labels = Array.from(this.labels) as HTMLElement[];\n const ids = labels.map(l => ensureId(l, \"slider-label\")).join(\" \");\n for (const t of this.thumbs) {\n if (ids) t.setAttribute(\"aria-labelledby\", ids);\n else t.removeAttribute(\"aria-labelledby\");\n }\n }\n\n override render() {\n const vertical = this.orientation === \"vertical\";\n const o = vertical ? \"vertical\" : \"horizontal\";\n const disabled = this.isDisabled;\n const fr = this.values.map(v => fraction(v, this.range));\n const thumbPos = (f: number) => `calc(${f} * (100% - var(--_pont2-slider-thumb)))`;\n const start = this.values.length > 1 ? fr[0] : 0;\n const end = fr[fr.length - 1];\n // Range: between thumb centres; single: from the start to the thumb centre.\n const rangeStyle = vertical\n ? { bottom: this.values.length > 1 ? `calc(${thumbPos(start)} + var(--_pont2-slider-thumb) / 2)` : \"0\", top: `calc(100% - ${thumbPos(end)} - var(--_pont2-slider-thumb) / 2)` }\n : { insetInlineStart: this.values.length > 1 ? `calc(${thumbPos(start)} + var(--_pont2-slider-thumb) / 2)` : \"0\", insetInlineEnd: `calc(100% - ${thumbPos(end)} - var(--_pont2-slider-thumb) / 2)` };\n const label = this.getAttribute(\"aria-label\");\n const names = this.values.length === 2 ? [\"Minimum\", \"Maximum\"] : [];\n\n return html`<div\n data-pont2-slider-control\n data-slot=\"slider-control\"\n data-orientation=${o}\n ?data-disabled=${disabled}\n @pointerdown=${this.onPointerDown}\n @pointermove=${this.onPointerMove}\n @pointerup=${this.onPointerUp}\n @pointercancel=${this.onPointerUp}\n >\n <div data-pont2-slider-track data-slot=\"slider-track\" data-orientation=${o} ?data-disabled=${disabled}>\n <div data-pont2-slider-range data-slot=\"slider-range\" data-orientation=${o} ?data-disabled=${disabled} style=${styleMap(rangeStyle)}></div>\n </div>\n ${repeat(\n this.values,\n (_v, i) => i,\n (v, i) => html`<div\n data-pont2-slider-thumb\n data-slot=\"slider-thumb\"\n data-index=${i}\n data-orientation=${o}\n ?data-disabled=${disabled}\n ?data-dragging=${this.activeThumb === i}\n role=\"slider\"\n tabindex=${disabled ? -1 : 0}\n aria-valuemin=${this.min}\n aria-valuemax=${this.max}\n aria-valuenow=${v}\n aria-orientation=${o}\n aria-disabled=${disabled ? \"true\" : \"false\"}\n aria-label=${label ? (names[i] ? `${label} ${names[i].toLowerCase()}` : label) : (names[i] ?? nothing)}\n style=${styleMap(vertical ? { bottom: thumbPos(fr[i]) } : { insetInlineStart: thumbPos(fr[i]) })}\n @keydown=${(e: KeyboardEvent) => this.onKeyDown(e, i)}\n ></div>`,\n )}\n </div>`;\n }\n}\n\ndefine(\"pont2-prim-slider\", Slider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-slider\": Slider;\n }\n}\n","import { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement, type ValidityResult } from \"../../core/form-control\";\nimport { define } from \"../../core/names\";\n\nexport type SwitchSize = \"default\" | \"sm\";\n\n/**\n * # Switch: Tier 2 (widget, form-associated)\n *\n * shadcn: `<Switch size>` → Base UI `<Switch.Root>` (`<span role=\"switch\">`\n * plus a hidden `<input type=\"checkbox\">`) > `<Switch.Thumb>` (`<span>`).\n *\n * pont2: the host **is** the `role=\"switch\"` root and a form-associated\n * custom element (no hidden input); it renders only the thumb.\n *\n * ```\n * shadcn/Base UI: span[role=switch][data-slot=switch] > span[data-slot=switch-thumb] + input[hidden]\n * pont2: pont2-prim-switch > span[data-slot=switch-thumb]\n * ```\n *\n * State attributes (Base UI): `data-checked` | `data-unchecked`, `data-disabled`,\n * `data-readonly`, `data-required`, on the root and the thumb. `data-size`\n * is shadcn's.\n *\n * @tag pont2-prim-switch\n * @attr checked - Initial state (`defaultChecked`); `.checked` is the live state.\n * @attr size - default | sm\n * @attr name, value, unchecked-value, disabled, required, readonly\n * @fires input - The state changed through interaction.\n * @fires change - Same moment as `input`, like a native checkbox.\n */\nexport class Switch extends FormControlElement {\n static override identity = \"switch\";\n static override slotName = \"switch\";\n static override role = \"switch\";\n\n static override properties: PropertyDeclarations = {\n checked: { type: Boolean },\n size: { type: String, reflect: true },\n value: { type: String },\n uncheckedValue: { type: String, attribute: \"unchecked-value\" },\n };\n\n declare checked: boolean;\n declare size: SwitchSize;\n declare value: string;\n declare uncheckedValue: string | undefined;\n\n constructor() {\n super();\n this.checked = false;\n this.size = \"default\";\n this.value = \"on\";\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"keyup\", this.onKeyUp);\n }\n\n /** Toggle as if the user clicked (fires input/change). */\n toggle(): void {\n if (this.isDisabled || this.readOnly) return;\n this.checked = !this.checked;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n protected formValue() {\n return this.checked ? this.value : (this.uncheckedValue ?? null);\n }\n\n protected resetToDefault(): void {\n this.checked = this.hasAttribute(\"checked\");\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n this.checked = state === this.value;\n }\n\n protected override validate(): ValidityResult | null {\n return this.required && !this.checked\n ? { flags: { valueMissing: true }, message: \"Please turn this on if you want to proceed.\" }\n : null;\n }\n\n private onClick = (e: MouseEvent) => {\n if (this.isDisabled || this.readOnly) {\n e.preventDefault();\n return;\n }\n this.toggle();\n };\n\n // Base UI's switch behaves like a button: Enter activates on keydown, Space on keyup.\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.target !== this) return;\n if (e.key === \" \") e.preventDefault();\n if (e.key === \"Enter\") {\n e.preventDefault();\n this.click();\n }\n };\n private onKeyUp = (e: KeyboardEvent) => {\n if (e.key === \" \" && e.target === this) this.click();\n };\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.internals.ariaChecked = String(this.checked);\n this.setData(\"checked\", this.checked);\n this.setData(\"unchecked\", !this.checked);\n this.setData(\"size\", this.size === \"sm\" ? \"sm\" : \"default\");\n this.setState(\"checked\", this.checked);\n }\n\n override render() {\n return html`<span\n data-pont2-switch-thumb\n data-slot=\"switch-thumb\"\n ?data-checked=${this.checked}\n ?data-unchecked=${!this.checked}\n ?data-disabled=${this.isDisabled}\n ></span>`;\n }\n}\n\ndefine(\"pont2-prim-switch\", Switch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-switch\": Switch;\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { RovingFocusController, type Orientation } from \"../../core/controllers/roving-focus\";\nimport { fireNative } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel } from \"../../core/names\";\n\nexport type TabsOrientation = \"horizontal\" | \"vertical\";\nexport type TabsListVariant = \"default\" | \"line\";\ntype ActivationDirection = \"left\" | \"right\" | \"up\" | \"down\" | \"none\";\n\nconst ROOT = sel(\"tabs\");\nconst TRIGGER = sel(\"tabs-trigger\");\nconst PANEL = sel(\"tabs-content\");\n\n/**\n * Wires an IDREF relation through ElementInternals when the engine supports\n * element reflection there, so no author-facing attribute is written; falls\n * back to the plain attribute (with generated ids) otherwise.\n */\nfunction relate(internals: ElementInternals, host: HTMLElement, prop: \"ariaControlsElements\" | \"ariaLabelledByElements\", attr: string, targets: Element[]) {\n if (prop in ElementInternals.prototype) {\n (internals as unknown as Record<string, Element[] | null>)[prop] = targets.length ? targets : null;\n } else if (targets.length) {\n host.setAttribute(attr, targets.map(t => ensureId(t, \"tabs\")).join(\" \"));\n } else {\n host.removeAttribute(attr);\n }\n}\n\n/**\n * # Tabs, TabsList, TabsTrigger, TabsContent: Tier 2 (widgets)\n *\n * shadcn: `<Tabs>` → Base UI `<Tabs.Root>` (div) > `<Tabs.List>` (div[role=tablist])\n * > `<Tabs.Tab>` (button[role=tab]) …, and `<Tabs.Panel>` (div[role=tabpanel]).\n *\n * pont2: every part is host-as-root, written by the author and never moved:\n * ```\n * pont2-prim-tabs[data-orientation]\n * pont2-prim-tabs-list[role=tablist][data-variant]\n * pont2-prim-tabs-trigger[role=tab][value] ×n (data-active on the active one)\n * pont2-prim-tabs-content[role=tabpanel][value] ×n (hidden unless active)\n * ```\n * The root owns the value; triggers and panels are matched by `value`.\n * ARIA relations (`aria-controls`, `aria-labelledby`) are wired through\n * ElementInternals, so the author's markup is not rewritten.\n *\n * Keyboard (Base UI / APG): the list is one tab stop (roving tabindex);\n * arrows along the orientation move focus (wrapping), Home/End jump, and\n * Enter/Space activate. With `activate-on-focus` on the list, moving focus\n * also activates (Base UI default: off).\n *\n * @tag pont2-prim-tabs\n * @attr value - The default active tab value; `.value` is live. Defaults to the first enabled trigger.\n * @attr orientation - horizontal (default) | vertical\n * @fires input, change - The active tab changed through interaction.\n */\nexport class Tabs extends HostElement {\n static override identity = \"tabs\";\n static override slotName = \"tabs\";\n\n static override properties: PropertyDeclarations = {\n defaultValue: { type: String, attribute: \"value\" },\n orientation: { type: String, reflect: true },\n current: { state: true },\n };\n\n declare defaultValue: string | null;\n declare orientation: TabsOrientation;\n declare protected current: string;\n\n /** The active tab's value. Setting it activates that tab without firing events. */\n get value(): string {\n return this.current;\n }\n set value(v: string) {\n this.dirty = true;\n this.current = v;\n }\n\n private dirty = false;\n private direction: ActivationDirection = \"none\";\n private observer?: MutationObserver;\n\n constructor() {\n super();\n this.defaultValue = null;\n this.orientation = \"horizontal\";\n this.current = \"\";\n }\n\n get triggers(): TabsTrigger[] {\n return this.own<TabsTrigger>(TRIGGER);\n }\n get panels(): TabsContent[] {\n return this.own<TabsContent>(PANEL);\n }\n get lists(): TabsList[] {\n return this.own<TabsList>(sel(\"tabs-list\"));\n }\n\n private own<T extends Element>(sel: string): T[] {\n return Array.from(this.querySelectorAll<T>(sel)).filter(el => el.closest(ROOT) === this);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.observer ??= new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: [\"value\", \"disabled\"] });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n /** Activate a trigger as the user would (fires input/change). */\n select(trigger: TabsTrigger): void {\n if (trigger.disabled || trigger.value === this.value) return;\n const triggers = this.triggers;\n const from = triggers.findIndex(t => t.value === this.value);\n const to = triggers.indexOf(trigger);\n const vertical = this.orientation === \"vertical\";\n this.direction = from < 0 || to === from ? \"none\" : to > from ? (vertical ? \"down\" : \"right\") : vertical ? \"up\" : \"left\";\n this.value = trigger.value;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.dirty && (changed.has(\"defaultValue\") || !this.hasUpdated)) {\n this.current = this.defaultValue ?? \"\";\n }\n }\n\n protected override updated(): void {\n const o = this.orientation === \"vertical\" ? \"vertical\" : \"horizontal\";\n const triggers = this.triggers;\n const panels = this.panels;\n // No (matching) value: fall back to the first enabled trigger, like Base UI.\n let value = this.current;\n if (!triggers.some(t => t.getAttribute(\"value\") === value)) {\n value = triggers.find(t => !t.hasAttribute(\"disabled\"))?.getAttribute(\"value\") ?? \"\";\n }\n\n this.setData(\"orientation\", o);\n this.setData(\"activation-direction\", this.direction);\n // Parts that have not upgraded yet are skipped; they request an update on connect.\n const ready = (el: Element) => typeof (el as TabsTrigger).sync === \"function\";\n for (const list of this.lists) if (ready(list)) list.sync(o, this.direction);\n\n let active: TabsTrigger | null = null;\n for (const t of triggers) {\n const on = t.getAttribute(\"value\") === value;\n const panel = panels.find(p => p.getAttribute(\"value\") === t.getAttribute(\"value\")) ?? null;\n if (ready(t)) t.sync(on, o, panel);\n if (on) active = t;\n }\n for (const p of panels) {\n const trigger = triggers.find(t => t.getAttribute(\"value\") === p.getAttribute(\"value\")) ?? null;\n if (ready(p)) p.sync(p.getAttribute(\"value\") === value, o, trigger);\n }\n for (const list of this.lists) if (ready(list)) list.focusSync(active);\n }\n}\n\n/**\n * @tag pont2-prim-tabs-list\n * @attr variant - default | line\n * @attr activate-on-focus - Arrow-key focus also activates the tab (Base UI `activateOnFocus`).\n * @attr loop - Set `loop=\"false\"` to stop focus wrapping (Base UI `loopFocus`).\n */\nexport class TabsList extends HostElement {\n static override identity = \"tabs-list\";\n static override slotName = \"tabs-list\";\n static override role = \"tablist\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n activateOnFocus: { type: Boolean, attribute: \"activate-on-focus\" },\n loop: { type: String },\n };\n\n declare variant: TabsListVariant;\n declare activateOnFocus: boolean;\n declare loop: string | null;\n\n private orientation: Orientation = \"horizontal\";\n\n private roving = new RovingFocusController(this, {\n items: () => this.root?.triggers.filter(t => this.contains(t)) ?? [],\n orientation: () => this.orientation,\n loop: () => this.loop !== \"false\",\n onNavigate: item => {\n if (this.activateOnFocus) this.root?.select(item as TabsTrigger);\n },\n });\n\n constructor() {\n super();\n this.variant = \"default\";\n this.activateOnFocus = false;\n this.loop = null;\n }\n\n get root(): Tabs | null {\n return this.closest(ROOT) as Tabs | null;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.root?.requestUpdate();\n }\n\n /** @internal Called by the root. */\n sync(orientation: TabsOrientation, direction: ActivationDirection): void {\n this.orientation = orientation;\n this.internals.ariaOrientation = orientation;\n this.setData(\"orientation\", orientation);\n this.setData(\"activation-direction\", direction);\n }\n\n /** @internal Called by the root. */\n focusSync(active: HTMLElement | null): void {\n // Keep the roving stop on the focused tab while the user is navigating.\n const focused = this.root?.triggers.find(t => t === document.activeElement);\n this.roving.sync(focused ?? active);\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant === \"line\" ? \"line\" : \"default\");\n }\n}\n\n/**\n * @tag pont2-prim-tabs-trigger\n * @attr value - Identifies the tab and its panel.\n * @attr disabled\n */\nexport class TabsTrigger extends HostElement {\n static override identity = \"tabs-trigger\";\n static override slotName = \"tabs-trigger\";\n static override role = \"tab\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare value: string;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.value = \"\";\n this.disabled = false;\n this.addEventListener(\"click\", this.onClick);\n this.addEventListener(\"keydown\", this.onKeyDown);\n }\n\n get root(): Tabs | null {\n return this.closest(ROOT) as Tabs | null;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.root?.requestUpdate();\n }\n\n private onClick = () => {\n if (!this.disabled) this.root?.select(this);\n };\n\n private onKeyDown = (e: KeyboardEvent) => {\n if (e.target !== this || this.disabled) return;\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this.root?.select(this);\n }\n };\n\n /** @internal Called by the root. */\n sync(active: boolean, orientation: TabsOrientation, panel: Element | null): void {\n this.internals.ariaSelected = String(active);\n this.internals.ariaDisabled = this.disabled ? \"true\" : null;\n relate(this.internals, this, \"ariaControlsElements\", \"aria-controls\", panel ? [panel] : []);\n this.setData(\"active\", active);\n this.setData(\"disabled\", this.disabled);\n this.setData(\"orientation\", orientation);\n this.setState(\"active\", active);\n }\n}\n\n/**\n * @tag pont2-prim-tabs-content\n * @attr value - The trigger value this panel belongs to.\n */\nexport class TabsContent extends HostElement {\n static override identity = \"tabs-content\";\n static override slotName = \"tabs-content\";\n static override role = \"tabpanel\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n };\n\n declare value: string;\n\n constructor() {\n super();\n this.value = \"\";\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n (this.closest(ROOT) as Tabs | null)?.requestUpdate();\n }\n\n /** @internal Called by the root. */\n sync(active: boolean, orientation: TabsOrientation, trigger: Element | null): void {\n relate(this.internals, this, \"ariaLabelledByElements\", \"aria-labelledby\", trigger ? [trigger] : []);\n // Base UI unmounts inactive panels; pont2 never removes author children, so it hides them.\n this.hidden = !active;\n this.setData(\"hidden\", !active);\n this.setData(\"orientation\", orientation);\n if (!this.hasAttribute(\"tabindex\")) this.tabIndex = 0;\n }\n}\n\ndefine(\"pont2-prim-tabs\", Tabs);\ndefine(\"pont2-prim-tabs-list\", TabsList);\ndefine(\"pont2-prim-tabs-trigger\", TabsTrigger);\ndefine(\"pont2-prim-tabs-content\", TabsContent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-tabs\": Tabs;\n \"pont2-prim-tabs-list\": TabsList;\n \"pont2-prim-tabs-trigger\": TabsTrigger;\n \"pont2-prim-tabs-content\": TabsContent;\n }\n}\n","/**\n * Pure anchored-positioning maths (no DOM). The same model as Floating UI /\n * Base UI's `<Positioner>`: place the floating box on a `side` of the anchor,\n * `align` it along that side, then `flip` to the opposite side and `shift`\n * along the cross axis to stay inside the viewport minus `collisionPadding`.\n *\n * Unit-tested in node: position.test.ts.\n */\n\nexport type PhysicalSide = \"top\" | \"bottom\" | \"left\" | \"right\";\n/** Base UI sides: physical, or logical (`inline-start`/`inline-end` follow `dir`). */\nexport type Side = PhysicalSide | \"inline-start\" | \"inline-end\";\nexport type Align = \"start\" | \"center\" | \"end\";\n\nexport interface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport interface PositionInput {\n anchor: Rect;\n floating: Size;\n viewport: Rect;\n side?: Side;\n align?: Align;\n /** Gap between anchor and floating box, on the main axis (px). */\n sideOffset?: number;\n /** Offset along the cross axis (px). Positive moves towards `end` for start/center, towards `start` for end. */\n alignOffset?: number;\n /** Minimum distance kept from the viewport edges (px). Base UI default: 5. */\n collisionPadding?: number;\n flip?: boolean;\n shift?: boolean;\n dir?: \"ltr\" | \"rtl\";\n}\n\nexport interface PositionResult {\n x: number;\n y: number;\n /** The side actually used, in the vocabulary it was requested in (logical stays logical). */\n side: Side;\n physicalSide: PhysicalSide;\n align: Align;\n /** Space between the floating box's anchored edge and the viewport edge (Base UI `--available-*`). */\n availableWidth: number;\n availableHeight: number;\n /** `--transform-origin`: the point of the anchor the box grows from. */\n transformOrigin: string;\n}\n\nconst OPPOSITE: Record<PhysicalSide, PhysicalSide> = { top: \"bottom\", bottom: \"top\", left: \"right\", right: \"left\" };\n\nexport function toPhysical(side: Side, dir: \"ltr\" | \"rtl\"): PhysicalSide {\n if (side === \"inline-start\") return dir === \"rtl\" ? \"right\" : \"left\";\n if (side === \"inline-end\") return dir === \"rtl\" ? \"left\" : \"right\";\n return side;\n}\n\nfunction toRequestedVocabulary(physical: PhysicalSide, requested: Side, dir: \"ltr\" | \"rtl\"): Side {\n if (requested !== \"inline-start\" && requested !== \"inline-end\") return physical;\n const start = dir === \"rtl\" ? \"right\" : \"left\";\n return physical === start ? \"inline-start\" : \"inline-end\";\n}\n\nconst isVertical = (s: PhysicalSide) => s === \"top\" || s === \"bottom\";\n\n/** Free space between the anchor (plus offset) and the padded viewport edge on `side`. */\nexport function spaceOn(side: PhysicalSide, anchor: Rect, viewport: Rect, offset: number, pad: number): number {\n switch (side) {\n case \"bottom\":\n return viewport.y + viewport.height - pad - (anchor.y + anchor.height + offset);\n case \"top\":\n return anchor.y - offset - (viewport.y + pad);\n case \"right\":\n return viewport.x + viewport.width - pad - (anchor.x + anchor.width + offset);\n case \"left\":\n return anchor.x - offset - (viewport.x + pad);\n }\n}\n\nexport function computePosition(input: PositionInput): PositionResult {\n const {\n anchor,\n floating,\n viewport,\n side: requested = \"bottom\",\n align = \"center\",\n sideOffset = 0,\n alignOffset = 0,\n collisionPadding = 5,\n flip = true,\n shift = true,\n dir = \"ltr\",\n } = input;\n const pad = collisionPadding;\n\n let side = toPhysical(requested, dir);\n\n // --- flip ------------------------------------------------------------\n if (flip) {\n const need = isVertical(side) ? floating.height : floating.width;\n const here = spaceOn(side, anchor, viewport, sideOffset, pad);\n const there = spaceOn(OPPOSITE[side], anchor, viewport, sideOffset, pad);\n if (here < need && there > here) side = OPPOSITE[side];\n }\n\n // --- main axis -------------------------------------------------------\n let x = 0;\n let y = 0;\n switch (side) {\n case \"bottom\":\n y = anchor.y + anchor.height + sideOffset;\n break;\n case \"top\":\n y = anchor.y - floating.height - sideOffset;\n break;\n case \"right\":\n x = anchor.x + anchor.width + sideOffset;\n break;\n case \"left\":\n x = anchor.x - floating.width - sideOffset;\n break;\n }\n\n // --- cross axis (align) ---------------------------------------------\n if (isVertical(side)) {\n // `start` is the inline-start edge, so it mirrors in RTL.\n const startEdge = dir === \"rtl\" ? anchor.x + anchor.width - floating.width : anchor.x;\n const endEdge = dir === \"rtl\" ? anchor.x : anchor.x + anchor.width - floating.width;\n const sign = dir === \"rtl\" ? -1 : 1;\n if (align === \"start\") x = startEdge + sign * alignOffset;\n else if (align === \"end\") x = endEdge - sign * alignOffset;\n else x = anchor.x + (anchor.width - floating.width) / 2 + sign * alignOffset;\n } else {\n if (align === \"start\") y = anchor.y + alignOffset;\n else if (align === \"end\") y = anchor.y + anchor.height - floating.height - alignOffset;\n else y = anchor.y + (anchor.height - floating.height) / 2 + alignOffset;\n }\n\n // --- shift (keep inside the padded viewport on the cross axis) -------\n if (shift) {\n if (isVertical(side)) {\n const min = viewport.x + pad;\n const max = viewport.x + viewport.width - pad - floating.width;\n x = max < min ? min : Math.min(Math.max(x, min), max);\n } else {\n const min = viewport.y + pad;\n const max = viewport.y + viewport.height - pad - floating.height;\n y = max < min ? min : Math.min(Math.max(y, min), max);\n }\n }\n\n // --- available space (Base UI --available-width / --available-height) -\n const mainSpace = Math.max(0, spaceOn(side, anchor, viewport, sideOffset, pad));\n const availableHeight = isVertical(side) ? mainSpace : Math.max(0, viewport.height - 2 * pad);\n const availableWidth = isVertical(side) ? Math.max(0, viewport.width - 2 * pad) : mainSpace;\n\n // --- transform origin: the anchor edge the box grows out of -----------\n const ax = anchor.x + anchor.width / 2 - x;\n const ay = anchor.y + anchor.height / 2 - y;\n const transformOrigin =\n side === \"bottom\"\n ? `${round(ax)}px ${-sideOffset}px`\n : side === \"top\"\n ? `${round(ax)}px ${floating.height + sideOffset}px`\n : side === \"right\"\n ? `${-sideOffset}px ${round(ay)}px`\n : `${floating.width + sideOffset}px ${round(ay)}px`;\n\n return {\n x: round(x),\n y: round(y),\n side: toRequestedVocabulary(side, requested, dir),\n physicalSide: side,\n align,\n availableWidth: round(availableWidth),\n availableHeight: round(availableHeight),\n transformOrigin,\n };\n}\n\n/**\n * Base UI Select's `alignItemWithTrigger`: place the popup so the selected\n * item sits exactly over the trigger (macOS-style). Returns `null` when that\n * is impossible inside the padded viewport, so the caller falls back to\n * normal side positioning (Base UI does the same).\n */\nexport function alignItemWithAnchor(input: {\n anchor: Rect;\n floating: Size;\n viewport: Rect;\n /** Offset of the item's top edge from the floating box's top edge (scroll already subtracted). */\n itemTop: number;\n itemHeight: number;\n collisionPadding?: number;\n}): { x: number; y: number } | null {\n const pad = input.collisionPadding ?? 5;\n const { anchor, floating, viewport } = input;\n const y = anchor.y + anchor.height / 2 - (input.itemTop + input.itemHeight / 2);\n const min = viewport.y + pad;\n const max = viewport.y + viewport.height - pad - floating.height;\n if (max < min) return null;\n if (y < min || y > max) return null;\n return { x: round(anchor.x), y: round(y) };\n}\n\nconst round = (n: number) => Math.round(n * 100) / 100;\n","import { directionOf } from \"../controllers/roving-focus\";\nimport { alignItemWithAnchor, computePosition, type Align, type Rect, type Side } from \"./position\";\n\nexport interface AnchoredOptions {\n side: Side;\n align: Align;\n sideOffset: number;\n alignOffset: number;\n collisionPadding: number;\n /** Select's `alignItemWithTrigger`: the item to lay over the anchor, if any. */\n alignItem?: HTMLElement | null;\n}\n\n/**\n * Keeps a floating element (a `popover` in the top layer, so `position:\n * fixed` against the viewport) attached to an anchor element.\n *\n * It only *writes CSS custom properties and data attributes* on the floating\n * element; the stylesheet turns them into `left`/`top`. Base UI's variables\n * are written under pont2's namespace (read by pont2 CSS) and also verbatim,\n * so shadcn classes (`max-h-(--available-height)`, `w-(--anchor-width)`,\n * `origin-(--transform-origin)`) port unchanged into app CSS:\n *\n * | Written | Meaning |\n * |-------------------------|--------------------------------------------|\n * | `--pont2-popup-x/y` | viewport position of the box (px) |\n * | `--pont2-anchor-width/height` (+ `--anchor-*`) | size of the anchor |\n * | `--pont2-available-width/height` (+ `--available-*`) | room left before the collision padding |\n * | `--pont2-transform-origin` (+ `--transform-origin`) | the anchor point the box grows from |\n * | `--pont2-arrow-x/y` | anchor centre relative to the box (for arrows) |\n * | `data-side`, `data-align` | the side/alignment actually used (after flip) |\n *\n * Updates are batched to one per animation frame and re-run on scroll (any\n * ancestor, captured), resize, and size changes of either element.\n */\nexport class AnchoredPositioner {\n private frame = 0;\n private running = false;\n private ro?: ResizeObserver;\n private observedAnchor: Element | null = null;\n\n constructor(\n private readonly floating: HTMLElement,\n private readonly anchor: () => Element | null,\n private readonly options: () => AnchoredOptions,\n ) {}\n\n start(): void {\n if (this.running) {\n this.update();\n return;\n }\n this.running = true;\n window.addEventListener(\"scroll\", this.schedule, { capture: true, passive: true });\n window.addEventListener(\"resize\", this.schedule, { passive: true });\n this.ro = new ResizeObserver(this.schedule);\n this.ro.observe(this.floating);\n this.observeAnchor();\n this.update();\n }\n\n stop(): void {\n if (!this.running) return;\n this.running = false;\n cancelAnimationFrame(this.frame);\n window.removeEventListener(\"scroll\", this.schedule, { capture: true });\n window.removeEventListener(\"resize\", this.schedule);\n this.ro?.disconnect();\n this.observedAnchor = null;\n }\n\n private observeAnchor() {\n const a = this.anchor();\n if (a && a !== this.observedAnchor) {\n this.ro?.observe(a);\n this.observedAnchor = a;\n }\n }\n\n private schedule = () => {\n if (!this.running) return;\n cancelAnimationFrame(this.frame);\n this.frame = requestAnimationFrame(() => this.update());\n };\n\n /** Measure and write synchronously (also called right after showPopover, before first paint). */\n update(): void {\n const anchorEl = this.anchor();\n if (!anchorEl || !this.floating.isConnected) return;\n this.observeAnchor();\n\n const a = anchorEl.getBoundingClientRect();\n const anchor: Rect = { x: a.left, y: a.top, width: a.width, height: a.height };\n // offsetWidth/Height ignore transforms, so a running zoom-in animation\n // does not feed back into the measurement.\n const floating = { width: this.floating.offsetWidth, height: this.floating.offsetHeight };\n const viewport: Rect = {\n x: 0,\n y: 0,\n width: document.documentElement.clientWidth,\n height: window.innerHeight,\n };\n const o = this.options();\n const style = this.floating.style;\n // Each Base UI variable is written twice: `--pont2-<name>` (what pont2's\n // own CSS reads, per the --pont2- namespace rule) and Base UI's verbatim\n // `--<name>`, so shadcn classes such as `max-h-(--available-height)` port\n // unchanged into consumer CSS.\n const set = (name: string, value: string) => {\n style.setProperty(`--pont2-${name}`, value);\n style.setProperty(`--${name}`, value);\n };\n set(\"anchor-width\", `${a.width}px`);\n set(\"anchor-height\", `${a.height}px`);\n\n if (o.alignItem) {\n const f = this.floating.getBoundingClientRect();\n const it = o.alignItem.getBoundingClientRect();\n const aligned = alignItemWithAnchor({\n anchor,\n floating,\n viewport,\n itemTop: it.top - f.top,\n itemHeight: it.height,\n collisionPadding: o.collisionPadding,\n });\n if (aligned) {\n style.setProperty(\"--pont2-popup-x\", `${aligned.x}px`);\n style.setProperty(\"--pont2-popup-y\", `${aligned.y}px`);\n set(\"available-height\", `${viewport.height - 2 * o.collisionPadding}px`);\n set(\"available-width\", `${viewport.width - 2 * o.collisionPadding}px`);\n set(\"transform-origin\", \"center\");\n this.floating.setAttribute(\"data-side\", \"none\");\n this.floating.setAttribute(\"data-align\", \"center\");\n return;\n }\n }\n\n const r = computePosition({\n anchor,\n floating,\n viewport,\n side: o.side,\n align: o.align,\n sideOffset: o.sideOffset,\n alignOffset: o.alignOffset,\n collisionPadding: o.collisionPadding,\n dir: directionOf(anchorEl),\n });\n style.setProperty(\"--pont2-popup-x\", `${r.x}px`);\n style.setProperty(\"--pont2-popup-y\", `${r.y}px`);\n set(\"available-width\", `${r.availableWidth}px`);\n set(\"available-height\", `${r.availableHeight}px`);\n set(\"transform-origin\", r.transformOrigin);\n style.setProperty(\"--pont2-arrow-x\", `${a.left + a.width / 2 - r.x}px`);\n style.setProperty(\"--pont2-arrow-y\", `${a.top + a.height / 2 - r.y}px`);\n if (this.floating.getAttribute(\"data-side\") !== r.side) this.floating.setAttribute(\"data-side\", r.side);\n if (this.floating.getAttribute(\"data-align\") !== r.align) this.floating.setAttribute(\"data-align\", r.align);\n }\n}\n","/**\n * List navigation and typeahead for popup lists (menus, select, combobox).\n *\n * Two focus models, as in Base UI:\n * - **real focus** (Menu, Select): the highlighted item *is* `document.activeElement`;\n * items carry `tabindex=\"-1\"` and `data-highlighted` follows focus;\n * - **virtual focus** (Combobox): focus stays in the `<input>`; the highlighted\n * item gets `data-highlighted` and the input points at it with\n * `aria-activedescendant`.\n *\n * Both share `moveIndex()` and `Typeahead`.\n */\n\nexport const isItemDisabled = (el: Element) =>\n el.hasAttribute(\"data-disabled\") || el.getAttribute(\"aria-disabled\") === \"true\";\n\nexport const isItemVisible = (el: HTMLElement) => !el.hidden && !el.closest(\"[hidden]\");\n\nexport type Move = \"next\" | \"prev\" | \"first\" | \"last\";\n\n/** Index of the next enabled item in `direction` from `current` (−1 = none yet). */\nexport function moveIndex(\n items: readonly Element[],\n current: number,\n move: Move,\n { loop = true, isDisabled = isItemDisabled }: { loop?: boolean; isDisabled?: (el: Element) => boolean } = {},\n): number {\n const n = items.length;\n if (!n) return -1;\n const ok = (i: number) => !isDisabled(items[i]);\n if (move === \"first\") {\n for (let i = 0; i < n; i++) if (ok(i)) return i;\n return -1;\n }\n if (move === \"last\") {\n for (let i = n - 1; i >= 0; i--) if (ok(i)) return i;\n return -1;\n }\n const step = move === \"next\" ? 1 : -1;\n if (current < 0) return moveIndex(items, -1, step === 1 ? \"first\" : \"last\", { loop, isDisabled });\n for (let k = 1; k <= n; k++) {\n let i = current + step * k;\n if (loop) i = (i + n) % n;\n else if (i < 0 || i >= n) return current;\n if (ok(i)) return i;\n }\n return current;\n}\n\n/** Keyboard key → move, for a vertical list. */\nexport function keyToMove(key: string): Move | null {\n switch (key) {\n case \"ArrowDown\":\n return \"next\";\n case \"ArrowUp\":\n return \"prev\";\n case \"Home\":\n return \"first\";\n case \"End\":\n return \"last\";\n default:\n return null;\n }\n}\n\n/**\n * Typeahead (APG): printable keys typed within 500ms build a prefix; the\n * first enabled item after the current one whose label starts with it wins.\n * Repeating one character cycles through items starting with it.\n */\nexport class Typeahead {\n private buffer = \"\";\n private timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor(private readonly timeout = 500) {}\n\n /** Whether a keyboard event is a typeahead character. */\n static isChar(e: KeyboardEvent): boolean {\n return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && e.key !== \" \";\n }\n\n get active(): boolean {\n return this.buffer.length > 0;\n }\n\n match(\n key: string,\n items: readonly Element[],\n current: number,\n label: (el: Element) => string = el => el.textContent ?? \"\",\n ): number {\n clearTimeout(this.timer);\n this.timer = setTimeout(() => (this.buffer = \"\"), this.timeout);\n this.buffer += key.toLowerCase();\n\n const repeated = this.buffer.split(\"\").every(c => c === this.buffer[0]);\n const search = repeated ? this.buffer[0] : this.buffer;\n const n = items.length;\n const start = repeated || current < 0 ? current + 1 : current;\n for (let k = 0; k < n; k++) {\n const i = (start + k + n) % n;\n const el = items[i];\n if (isItemDisabled(el)) continue;\n if (label(el).trim().toLowerCase().startsWith(search)) return i;\n }\n return -1;\n }\n\n reset(): void {\n clearTimeout(this.timer);\n this.buffer = \"\";\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport type { OpenChangeReason } from \"../events\";\nimport { HostElement } from \"../host-element\";\nimport { AnchoredPositioner } from \"./anchored\";\nimport type { Align, Side } from \"./position\";\n\n/** Popups currently open, bottom → top. Escape and outside presses are resolved against it. */\nconst stack: PopupContent[] = [];\n\nlet globalListeners = false;\nfunction installGlobalListeners() {\n if (globalListeners) return;\n globalListeners = true;\n\n // Escape closes only the top-most popup (a submenu before its menu).\n document.addEventListener(\"keydown\", e => {\n if (e.key !== \"Escape\" || e.defaultPrevented) return;\n const top = stack.at(-1);\n if (!top) return;\n e.preventDefault();\n e.stopPropagation();\n top.requestClose(\"escape-key\");\n });\n\n // Outside press: captured on pointerdown, before focus moves (Base UI\n // dismisses on pointerdown for mouse too).\n document.addEventListener(\n \"pointerdown\",\n e => {\n const path = e.composedPath();\n for (const popup of [...stack].reverse()) {\n if (popup.containsPath(path)) break; // inside: this one and everything below stay\n popup.requestClose(\"outside-press\");\n if (popup.isModal) break; // a modal shields what it covers (an alert dialog over a dialog)\n }\n },\n true,\n );\n}\n\n/**\n * # PopupContent: base for every popup surface\n *\n * DropdownMenuContent, SelectContent, ComboboxContent, PopoverContent and\n * TooltipContent all extend it. The host **is** the popup (shadcn's\n * `data-slot=\"…-content\"` element); Base UI's separate `Portal` and\n * `Positioner` wrappers have no counterpart, because:\n *\n * - **Portal → the native Popover API.** The host carries `popover=\"manual\"`\n * and `showPopover()` lifts it into the browser's top layer: it escapes\n * `overflow: hidden` and stacking contexts *without moving the node*. It\n * stays exactly where the author wrote it, so React/Lit/server HTML keep\n * owning it, and it inherits CSS custom properties from its real ancestors.\n * - **Positioner → AnchoredPositioner**, which writes position variables on\n * this same element (see anchored.ts).\n *\n * Base UI DOM: Portal > Positioner div > Popup div[data-slot=…-content] > children\n * pont2 DOM: pont2-…-content[popover][data-slot=…-content] > children\n *\n * Open/close states are Base UI's: `data-open` / `data-closed`, plus\n * `data-starting-style` (first frame after opening) and `data-ending-style`\n * (while closing). On close the element stays in the top layer until its\n * CSS animations/transitions finish, then `hidePopover()` runs, so shadcn's\n * `animate-out` classes port as plain keyframes.\n *\n * The content never decides it is open; its root does. It *requests*\n * closing (Escape, outside press, Tab) through `onRequestClose`, which the\n * root turns into a cancelable `pont2-open-change` event.\n */\nexport abstract class PopupContent extends HostElement {\n static override identity = \"popup\";\n\n static override properties: PropertyDeclarations = {\n side: { type: String, reflect: false },\n align: { type: String, reflect: false },\n sideOffset: { type: Number, attribute: \"side-offset\" },\n alignOffset: { type: Number, attribute: \"align-offset\" },\n collisionPadding: { type: Number, attribute: \"collision-padding\" },\n };\n\n declare side: Side;\n declare align: Align;\n declare sideOffset: number;\n declare alignOffset: number;\n declare collisionPadding: number;\n\n /** Set by the root: asked to close for `reason`. */\n onRequestClose?: (reason: OpenChangeReason) => void;\n /** Set by the root: elements that do not count as \"outside\" (the trigger). */\n insideElements: () => (Element | null | undefined)[] = () => [];\n /** Set by the root: what the popup is anchored to. */\n anchorElement: () => Element | null = () => null;\n\n protected readonly positioner = new AnchoredPositioner(\n this,\n () => this.anchorElement(),\n () => ({\n side: this.side,\n align: this.align,\n sideOffset: this.sideOffset,\n alignOffset: this.alignOffset,\n collisionPadding: this.collisionPadding,\n alignItem: this.alignItem(),\n }),\n );\n\n private closing?: Promise<void>;\n private generation = 0;\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"center\";\n this.sideOffset = 0;\n this.alignOffset = 0;\n this.collisionPadding = 5;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n installGlobalListeners();\n if (!this.hasAttribute(\"popover\")) this.setAttribute(\"popover\", \"manual\");\n if (!this.isOpen) this.setData(\"closed\", true);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.positioner.stop();\n const i = stack.indexOf(this);\n if (i >= 0) stack.splice(i, 1);\n }\n\n get isOpen(): boolean {\n return this.hasAttribute(\"data-open\");\n }\n\n /** A modal popup (Dialog, Sheet …): an outside press reaches it and nothing below it. */\n get isModal(): boolean {\n return false;\n }\n\n /**\n * Whether the popup is anchored to an element. Modal surfaces (Dialog,\n * Sheet, Drawer) and the toaster lay themselves out in CSS and return false.\n */\n protected get anchored(): boolean {\n return true;\n }\n\n /** Select overrides this to lay the selected item over the trigger. */\n protected alignItem(): HTMLElement | null {\n return null;\n }\n\n /** True if the event path is inside this popup or one of its inside elements. */\n containsPath(path: EventTarget[]): boolean {\n if (path.includes(this)) return true;\n return this.insideElements().some(el => el && path.includes(el));\n }\n\n requestClose(reason: OpenChangeReason): void {\n this.onRequestClose?.(reason);\n }\n\n /** Re-measure (e.g. after the content changed size). */\n reposition(): void {\n if (this.isOpen && this.anchored) this.positioner.update();\n }\n\n show(): void {\n this.generation++;\n this.closing = undefined;\n this.setData(\"ending-style\", false);\n this.setData(\"closed\", false);\n this.setData(\"open\", true);\n if (!this.matches(\":popover-open\")) {\n this.setData(\"starting-style\", true);\n try {\n this.showPopover();\n } catch {\n /* already open, or not connected */\n }\n requestAnimationFrame(() => this.setData(\"starting-style\", false));\n }\n if (!stack.includes(this)) stack.push(this);\n if (this.anchored) this.positioner.start();\n }\n\n /** Starts the close; resolves once the exit animation finished and the popover is hidden. */\n hide(): Promise<void> {\n if (!this.isOpen && !this.closing) {\n this.setData(\"closed\", true);\n return Promise.resolve();\n }\n if (this.closing) return this.closing;\n const gen = ++this.generation;\n this.setData(\"open\", false);\n this.setData(\"closed\", true);\n this.setData(\"ending-style\", true);\n const i = stack.indexOf(this);\n if (i >= 0) stack.splice(i, 1);\n\n this.closing = (async () => {\n // Let the closed styles apply, then wait for whatever they animate.\n await new Promise(r => requestAnimationFrame(() => r(null)));\n const anims = this.getAnimations().filter(a => a.playState !== \"finished\");\n await Promise.allSettled(anims.map(a => a.finished));\n if (gen !== this.generation) return; // re-opened meanwhile\n this.setData(\"ending-style\", false);\n this.positioner.stop();\n try {\n this.hidePopover();\n } catch {\n /* not open */\n }\n this.closing = undefined;\n })();\n return this.closing;\n }\n}\n\n/** Open popups, bottom → top (read-only view, for tests and devtools). */\nexport const openPopups = (): readonly PopupContent[] => stack;\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { fire, type OpenChangeDetail, type OpenChangeReason } from \"../events\";\nimport { HostElement, NativeEnhancer } from \"../host-element\";\nimport { ensureId } from \"../ids\";\nimport type { PopupContent } from \"./popup-content\";\n\n/**\n * Finds the first element matching `selector` under `root` that belongs to\n * `root` itself, i.e. whose closest `rootSelector` ancestor is `root` (so a\n * DropdownMenu never picks up its submenu's trigger or content).\n */\nexport function ownQuery<T extends Element>(root: Element, selector: string, rootSelector: string): T | null {\n for (const el of Array.from(root.querySelectorAll<T>(selector))) {\n if (el.parentElement?.closest(rootSelector) === root) return el;\n }\n return null;\n}\n\n/** All matches that belong to `root` (see ownQuery). */\nexport function ownQueryAll<T extends Element>(root: Element, selector: string, rootSelector: string): T[] {\n return Array.from(root.querySelectorAll<T>(selector)).filter(\n el => el.parentElement?.closest(rootSelector) === root,\n );\n}\n\n/**\n * # PopupRoot: the coordinator of a popup family\n *\n * Base UI's `<Menu.Root>`, `<Popover.Root>`, `<Select.Root>` render **no\n * element**; they are React context providers. A custom element cannot\n * render nothing, so pont2's roots are *coordinators*: they exist in the\n * DOM (authors need a tag to group trigger and content) but have no box and\n * no role:\n *\n * `[data-pont2-popup-root] { display: contents }` (core/popup/popup.css)\n *\n * That is the same reasoning as a Tier 3 shell, applied to an element whose\n * shadcn counterpart has no DOM at all. Instead of context, the root finds\n * its parts by DOM lookup (`ownQuery`), wires their ARIA, and owns the one\n * piece of state: `open`.\n *\n * `open` changes requested by the user (trigger press, Escape, outside press,\n * item press…) go through `setOpen(open, reason)`, which fires a cancelable\n * `pont2-open-change` ({ open, reason }) first: Base UI's\n * `onOpenChange(open, eventDetails)` + `eventDetails.cancel()`. Writing the\n * `open` property directly is the controlled form and fires nothing.\n */\nexport abstract class PopupRoot extends HostElement {\n static override identity = \"popup-root\";\n\n static override properties: PropertyDeclarations = {\n open: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare open: boolean;\n declare disabled: boolean;\n\n /** Why the popup last opened/closed (drives focus management). */\n protected lastReason: OpenChangeReason = \"imperative\";\n /** Whether the last open was keyboard-initiated (focus the first item, not the popup). */\n protected openedByKeyboard = false;\n\n constructor() {\n super();\n this.open = false;\n this.disabled = false;\n }\n\n /** The element the popup anchors to and returns focus to (a native button / input). */\n abstract get triggerElement(): HTMLElement | null;\n abstract get contentElement(): PopupContent | null;\n /** `aria-haspopup` value for the trigger. */\n protected abstract get popupKind(): \"menu\" | \"listbox\" | \"dialog\" | \"true\";\n\n /**\n * Request an open-state change, as the user did. Returns false if a\n * `pont2-open-change` listener cancelled it.\n */\n setOpen(open: boolean, reason: OpenChangeReason, opts: { keyboard?: boolean } = {}): boolean {\n if (open === this.open) return true;\n if (open && this.disabled) return false;\n const allowed = fire<OpenChangeDetail>(this, \"pont2-open-change\", { open, reason }, true);\n if (!allowed) return false;\n this.lastReason = reason;\n this.openedByKeyboard = !!opts.keyboard;\n this.open = open;\n return true;\n }\n\n toggle(reason: OpenChangeReason = \"trigger-press\", opts: { keyboard?: boolean } = {}): void {\n this.setOpen(!this.open, reason, opts);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n // Parts may upgrade after the root; wire once everything is defined.\n queueMicrotask(() => this.wire());\n }\n\n /** Connect trigger and content (idempotent). Call when parts change. */\n wire(): void {\n const content = this.contentElement;\n const trigger = this.triggerElement;\n if (content) {\n ensureId(content, \"popup\");\n content.onRequestClose = reason => this.setOpen(false, reason);\n content.anchorElement = () => this.anchorElement();\n content.insideElements = () => [this.triggerElement, ...this.extraInsideElements()];\n }\n if (trigger) {\n trigger.setAttribute(\"aria-haspopup\", this.popupKind);\n trigger.setAttribute(\"aria-expanded\", String(this.open));\n if (content) trigger.setAttribute(\"aria-controls\", content.id);\n trigger.toggleAttribute(\"data-popup-open\", this.open);\n trigger.toggleAttribute(\"data-disabled\", this.disabled);\n }\n }\n\n /** What the content positions against. Defaults to the trigger. */\n protected anchorElement(): Element | null {\n return this.triggerElement;\n }\n\n /** Further elements whose presses are not \"outside\" (e.g. a combobox input group). */\n protected extraInsideElements(): (Element | null)[] {\n return [];\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.wire();\n if (!changed.has(\"open\")) return;\n const content = this.contentElement;\n if (!content) return;\n if (this.open) {\n content.show();\n this.afterOpen();\n } else if (changed.get(\"open\") !== undefined) {\n const hadFocus = content.contains(document.activeElement) || document.activeElement === document.body;\n void content.hide();\n this.afterClose(hadFocus);\n }\n }\n\n /** Focus management after opening. Default: focus the popup itself. */\n protected afterOpen(): void {}\n\n /** Focus management after closing. Default: return focus to the trigger if it was inside. */\n protected afterClose(focusWasInside: boolean): void {\n if (focusWasInside && this.lastReason !== \"outside-press\") this.triggerElement?.focus({ preventScroll: true });\n }\n}\n\n/**\n * Trigger enhancer: `<pont2-x-trigger><button>…</button></pont2-x-trigger>`.\n * The native button is the trigger (Tier 3). It gets `data-slot`, and its\n * root sets `aria-haspopup` / `aria-expanded` / `aria-controls` /\n * `data-popup-open` on it. Pressing it toggles the root.\n */\nexport abstract class PopupTrigger extends NativeEnhancer<HTMLButtonElement> {\n static override nativeSelector = \"button\";\n /** Tag of the root this trigger belongs to. */\n static rootTag = \"\";\n /**\n * `data-slot` written on the *native button* (e.g. \"dropdown-menu-trigger\").\n * Deliberately not `slotName`: that would stamp the shell, and a shell is\n * never styled or selected.\n */\n static controlSlot = \"trigger\";\n\n get root(): PopupRoot | null {\n return this.closest((this.constructor as typeof PopupTrigger).rootTag) as PopupRoot | null;\n }\n\n constructor() {\n super();\n // Wrappers, not method references: subclass overrides are installed after\n // this constructor runs.\n this.addEventListener(\"click\", e => this.onClick(e));\n this.addEventListener(\"keydown\", e => this.onKeyDown(e));\n }\n\n protected apply(control: HTMLButtonElement): void {\n const slot = (this.constructor as typeof PopupTrigger).controlSlot;\n if (!control.hasAttribute(\"data-slot\") || control.getAttribute(\"data-slot\") === \"button\") {\n control.setAttribute(\"data-slot\", slot);\n }\n if (!control.hasAttribute(\"type\")) control.type = \"button\";\n this.root?.wire();\n }\n\n protected onClick(e: MouseEvent): void {\n const c = this.control;\n if (!c || !(c === e.target || c.contains(e.target as Node)) || c.disabled) return;\n // `detail === 0`: activated by keyboard (Enter/Space), not a pointer.\n this.root?.toggle(\"trigger-press\", { keyboard: e.detail === 0 });\n }\n\n protected onKeyDown(_e: KeyboardEvent): void {}\n}\n","/**\n * # Modal machinery: what Base UI's `modal` dialogs do beyond a popup\n *\n * Dialog, AlertDialog, Sheet and Drawer are popups (`PopupContent`: the top\n * layer through the Popover API, the shared Escape / outside-press stack) that\n * are also **modal**. Base UI gives a modal popup four extra behaviours, and\n * each is one function here, so every modal surface shares them:\n *\n * | Base UI behaviour | Here |\n * |------------------------------|-------------------------|\n * | the page behind is inert | `inertOthers(keep)` |\n * | the page does not scroll | `lockScroll()` |\n * | Tab cycles inside the popup | `trapFocus(container)` |\n * | initial / final focus | `tabbables()`, `initialFocusOf()` |\n *\n * Each returns its undo, so a root opens with `release = [a(), b(), c()]` and\n * closes with `release.forEach(f => f())`. All of them nest: a dialog opened\n * from a dialog keeps the outer one inert behind it, and closing the inner\n * one restores exactly what it changed.\n *\n * Why not a native `<dialog>`: the host is the component's root\n * (host-as-root), so the popup is the custom element itself, and a custom\n * element cannot be a `<dialog>`. `showModal()` would also make every other\n * top-layer element (a toast, a popup opened from inside) inert, which Base\n * UI does not.\n */\n\nconst TABBABLE = [\n \"a[href]\",\n \"area[href]\",\n \"button:not([disabled])\",\n 'input:not([disabled]):not([type=\"hidden\"])',\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"iframe\",\n \"audio[controls]\",\n \"video[controls]\",\n '[contenteditable]:not([contenteditable=\"false\"])',\n \"[tabindex]\",\n].join(\", \");\n\n/** Elements that stay interactive behind a modal (Base UI leaves toasts alone). */\nconst EXEMPT = \"[data-pont2-toaster], script, style, template, link\";\n\n/** Elements inside `root`, in tab order position, that Tab can reach (tabindex ≥ 0, visible, not inert). */\nexport function tabbables(root: Element): HTMLElement[] {\n const out: HTMLElement[] = [];\n for (const el of Array.from(root.querySelectorAll<HTMLElement>(TABBABLE))) {\n if (el.tabIndex < 0) continue;\n if (el.closest(\"[inert]\")) continue;\n // A closed popup inside the dialog (a select's list) is display: none.\n if (typeof el.checkVisibility === \"function\" ? !el.checkVisibility() : el.offsetParent === null && getComputedStyle(el).position !== \"fixed\") continue;\n out.push(el);\n }\n // Positive tabindex first, in order, then document order (the platform's tab order).\n const positive = out.filter(el => el.tabIndex > 0).sort((a, b) => a.tabIndex - b.tabIndex);\n return [...positive, ...out.filter(el => el.tabIndex === 0)];\n}\n\n/**\n * Where focus goes when a modal opens (Base UI `initialFocus` default): an\n * element marked `autofocus`, else the first tabbable element, else the popup.\n */\nexport function initialFocusOf(popup: HTMLElement): HTMLElement {\n const marked = popup.querySelector<HTMLElement>(\"[autofocus], [data-autofocus]\");\n if (marked && !marked.closest(\"[inert]\")) return marked;\n return tabbables(popup)[0] ?? popup;\n}\n\n/* ------------------------------------------------------------------ */\n/* Inert outside */\n/* ------------------------------------------------------------------ */\n\n/** How many open modals made each element inert (an element is restored when its count reaches 0). */\nconst inertCount = new Map<Element, number>();\n\n/**\n * Makes everything outside `keep` inert: every sibling of `keep` and of each\n * of its ancestors up to `<body>` (what `aria-hidden`'s `hideOthers` does,\n * with `inert` so it also blocks focus and pointer input). The popup stays\n * where the author wrote it, so its ancestors cannot be made inert\n * themselves; their other children are. Elements the author already made\n * inert are left alone and stay inert afterwards.\n */\nexport function inertOthers(keep: Element[]): () => void {\n const touched: Element[] = [];\n const kept = (el: Element) => keep.some(k => el === k || el.contains(k));\n const visit = (parent: Element) => {\n for (const child of Array.from(parent.children)) {\n if (kept(child)) {\n if (!keep.includes(child)) visit(child);\n continue;\n }\n if (child.matches(EXEMPT)) continue;\n const n = inertCount.get(child);\n if (n === undefined) {\n if (child.hasAttribute(\"inert\")) continue; // the author's own\n child.setAttribute(\"inert\", \"\");\n inertCount.set(child, 1);\n } else {\n inertCount.set(child, n + 1);\n }\n touched.push(child);\n }\n };\n visit(document.body);\n return () => {\n for (const el of touched) {\n const n = (inertCount.get(el) ?? 1) - 1;\n if (n <= 0) {\n inertCount.delete(el);\n el.removeAttribute(\"inert\");\n } else {\n inertCount.set(el, n);\n }\n }\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Scroll lock */\n/* ------------------------------------------------------------------ */\n\nlet locks = 0;\nlet saved: { overflow: string; paddingRight: string } | null = null;\n\n/**\n * Stops the page scrolling while a modal is open (Base UI's scroll lock).\n * The scrollbar's width is kept as padding, so the page does not shift\n * sideways. Reference-counted: nested modals unlock once, when the last one\n * closes.\n */\nexport function lockScroll(): () => void {\n const html = document.documentElement;\n if (locks++ === 0) {\n const scrollbar = window.innerWidth - html.clientWidth;\n saved = { overflow: html.style.overflow, paddingRight: html.style.paddingRight };\n html.style.overflow = \"hidden\";\n if (scrollbar > 0) {\n const current = parseFloat(getComputedStyle(html).paddingRight) || 0;\n html.style.paddingRight = `${current + scrollbar}px`;\n }\n html.setAttribute(\"data-pont2-scroll-locked\", \"\");\n }\n let released = false;\n return () => {\n if (released) return;\n released = true;\n if (--locks === 0 && saved) {\n html.style.overflow = saved.overflow;\n html.style.paddingRight = saved.paddingRight;\n html.removeAttribute(\"data-pont2-scroll-locked\");\n saved = null;\n }\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Focus trap */\n/* ------------------------------------------------------------------ */\n\nconst traps: HTMLElement[] = [];\nlet trapListener = false;\n\n/**\n * Tab and Shift+Tab cycle through the tabbable elements of the top-most\n * trapping container (Base UI's `FloatingFocusManager` with `modal`). Focus\n * that lands outside it (a programmatic `focus()` on an exempt element is\n * the only way, since the rest of the page is inert) is brought back.\n */\nexport function trapFocus(container: HTMLElement): () => void {\n traps.push(container);\n if (!trapListener) {\n trapListener = true;\n document.addEventListener(\"keydown\", onTrapKeyDown, true);\n document.addEventListener(\"focusin\", onTrapFocusIn, true);\n }\n return () => {\n const i = traps.lastIndexOf(container);\n if (i >= 0) traps.splice(i, 1);\n };\n}\n\nfunction onTrapKeyDown(e: KeyboardEvent): void {\n const trap = traps.at(-1);\n if (!trap || e.key !== \"Tab\" || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) return;\n const active = document.activeElement as HTMLElement | null;\n // A popup opened from inside the modal (a select, a menu) handles its own Tab.\n if (active && trap.contains(active) && active.closest(\"[data-pont2-popup]\") !== trap) return;\n const items = tabbables(trap);\n if (!items.length) {\n e.preventDefault();\n trap.focus({ preventScroll: true });\n return;\n }\n const first = items[0];\n const last = items[items.length - 1];\n const inside = !!active && trap.contains(active);\n if (e.shiftKey && (!inside || active === first || active === trap)) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && (!inside || active === last)) {\n e.preventDefault();\n first.focus();\n }\n}\n\nfunction onTrapFocusIn(e: FocusEvent): void {\n const trap = traps.at(-1);\n const target = e.target as Element | null;\n if (!trap || !target || trap.contains(target) || target.closest(EXEMPT)) return;\n // Another open popup in the top layer above the modal (opened from inside it) is fine.\n if (target.closest(\"[data-pont2-popup]:popover-open\")) return;\n (tabbables(trap)[0] ?? trap).focus({ preventScroll: true });\n}\n","import { HostElement } from \"../../core/host-element\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot, PopupTrigger } from \"../../core/popup/popup-root\";\n\nconst ROOT = sel(\"popover\");\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * # Popover\n *\n * shadcn: `<Popover>` (Base UI `Popover.Root`, renders nothing) >\n * `<PopoverTrigger>` (a `<button>`) + `<PopoverContent>` (Portal > Positioner >\n * `<div data-slot=\"popover-content\">`), with `PopoverHeader/Title/Description`.\n *\n * pont2:\n * ```html\n * <pont2-prim-popover> coordinator, display: contents\n * <pont2-prim-popover-trigger><button data-pont2-button data-variant=\"outline\">Open</button></pont2-prim-popover-trigger>\n * <pont2-prim-popover-content> the popup itself: [popover], role=dialog\n * <pont2-prim-popover-header>\n * <pont2-prim-popover-title>Dimensions</pont2-prim-popover-title>\n * <pont2-prim-popover-description>Set the dimensions for the layer.</pont2-prim-popover-description>\n * </pont2-prim-popover-header>\n * …\n * </pont2-prim-popover-content>\n * </pont2-prim-popover>\n * ```\n *\n * @tag pont2-prim-popover\n * @attr open - Open state (initially: Base UI `defaultOpen`; property: controlled `open`).\n * @fires pont2-open-change - cancelable, `{ open, reason }`.\n */\nexport class Popover extends PopupRoot {\n static override identity = \"popover\";\n\n get triggerElement(): HTMLButtonElement | null {\n return ownQuery<PopoverTrigger>(this, tags(\"popover-trigger\"), ROOT)?.control ?? null;\n }\n get contentElement(): PopoverContent | null {\n return ownQuery<PopoverContent>(this, sel(\"popover-content\"), ROOT);\n }\n protected get popupKind() {\n return \"dialog\" as const;\n }\n\n protected override afterOpen(): void {\n const content = this.contentElement;\n if (!content) return;\n // Base UI Popover: focus the first focusable element in the popup, else the popup.\n const first = content.querySelector<HTMLElement>(FOCUSABLE);\n (first ?? content).focus({ preventScroll: true });\n }\n}\n\n/** @tag pont2-prim-popover-trigger */\nexport class PopoverTrigger extends PopupTrigger {\n static override rootTag = ROOT;\n static override controlSlot = \"popover-trigger\";\n}\n\n/**\n * The popup. Non-modal, like Base UI's default: closes on Escape, on a press\n * outside, and when focus leaves both the popup and its trigger.\n *\n * @tag pont2-prim-popover-content\n * @attr side - bottom (default) | top | left | right | inline-start | inline-end\n * @attr align - center (default) | start | end\n * @attr side-offset - default 4\n * @attr align-offset - default 0\n * @cssprop --pont2-popover-bg, --pont2-popover-fg, --pont2-popover-border-color, --pont2-popover-radius, --pont2-popover-shadow - see docs/11-tokens.md\n * @cssprop --pont2-popover-width, --pont2-popover-padding-x, --pont2-popover-padding-y, --pont2-popover-gap - sizes (defaults 18rem, 1rem, 1rem, 1rem)\n */\nexport class PopoverContent extends PopupContent {\n static override identity = \"popover-content\";\n static override slotName = \"popover-content\";\n static override role = \"dialog\";\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"center\";\n this.sideOffset = 4;\n this.addEventListener(\"focusout\", this.onFocusOut);\n }\n\n override show(): void {\n this.tabIndex = -1;\n const title = this.querySelector(`${sel(\"popover-title\")}, [data-slot=popover-title]`);\n const desc = this.querySelector(`${sel(\"popover-description\")}, [data-slot=popover-description]`);\n if (title && !this.hasAttribute(\"aria-labelledby\")) this.setAttribute(\"aria-labelledby\", ensureId(title, \"popover-title\"));\n if (desc && !this.hasAttribute(\"aria-describedby\")) this.setAttribute(\"aria-describedby\", ensureId(desc, \"popover-desc\"));\n super.show();\n }\n\n private onFocusOut = (e: FocusEvent) => {\n const to = e.relatedTarget as Node | null;\n if (!to || !this.isOpen) return; // focus went to the page/body: keep open (Base UI)\n if (this.contains(to) || this.insideElements().some(el => el?.contains(to))) return;\n this.requestClose(\"focus-out\");\n };\n}\n\n/** @tag pont2-prim-popover-header */\nexport class PopoverHeader extends HostElement {\n static override identity = \"popover-header\";\n static override slotName = \"popover-header\";\n}\n\n/** Base UI `Popover.Title` renders an `<h2>`; pont2 keeps the heading semantics through internals. @tag pont2-prim-popover-title */\nexport class PopoverTitle extends HostElement {\n static override identity = \"popover-title\";\n static override slotName = \"popover-title\";\n static override role = \"heading\";\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.internals.ariaLevel) this.internals.ariaLevel = \"2\";\n }\n}\n\n/** Base UI `Popover.Description` renders a `<p>`. @tag pont2-prim-popover-description */\nexport class PopoverDescription extends HostElement {\n static override identity = \"popover-description\";\n static override slotName = \"popover-description\";\n}\n\ndefine(\"pont2-prim-popover\", Popover);\ndefine(\"pont2-prim-popover-trigger\", PopoverTrigger);\ndefine(\"pont2-prim-popover-content\", PopoverContent);\ndefine(\"pont2-prim-popover-header\", PopoverHeader);\ndefine(\"pont2-prim-popover-title\", PopoverTitle);\ndefine(\"pont2-prim-popover-description\", PopoverDescription);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-popover\": Popover;\n \"pont2-prim-popover-trigger\": PopoverTrigger;\n \"pont2-prim-popover-content\": PopoverContent;\n \"pont2-prim-popover-header\": PopoverHeader;\n \"pont2-prim-popover-title\": PopoverTitle;\n \"pont2-prim-popover-description\": PopoverDescription;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { directionOf } from \"../../core/controllers/roving-focus\";\nimport { fireNative } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { isItemDisabled, isItemVisible, keyToMove, moveIndex, Typeahead } from \"../../core/popup/list\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot, PopupTrigger } from \"../../core/popup/popup-root\";\nimport { Separator } from \"../separator/separator\";\n\nconst ROOTS = `${sel(\"dropdown-menu\")}, ${sel(\"dropdown-menu-sub\")}`;\nconst CONTENT = \"[data-pont2-dropdown-menu-content]\";\nconst ITEM = \"[data-pont2-menu-item]\";\n\n/** Boolean attribute that defaults to true and is turned off with `=\"false\"`. */\nconst trueUnlessFalse = { fromAttribute: (v: string | null) => v !== \"false\", toAttribute: (v: boolean) => String(v) };\n\ntype FocusTarget = \"first\" | \"last\" | \"popup\";\n\n/* ==================================================================== */\n/* Roots */\n/* ==================================================================== */\n\n/**\n * # DropdownMenu\n *\n * shadcn: `<DropdownMenu>` = Base UI `Menu.Root` (renders nothing).\n *\n * ```html\n * <pont2-prim-dropdown-menu>\n * <pont2-prim-dropdown-menu-trigger><button data-pont2-button data-variant=\"outline\">Open</button></pont2-prim-dropdown-menu-trigger>\n * <pont2-prim-dropdown-menu-content>\n * <pont2-prim-dropdown-menu-group>\n * <pont2-prim-dropdown-menu-label>My Account</pont2-prim-dropdown-menu-label>\n * <pont2-prim-dropdown-menu-item>Profile <pont2-prim-dropdown-menu-shortcut>⇧⌘P</pont2-prim-dropdown-menu-shortcut></pont2-prim-dropdown-menu-item>\n * </pont2-prim-dropdown-menu-group>\n * </pont2-prim-dropdown-menu-content>\n * </pont2-prim-dropdown-menu>\n * ```\n *\n * @tag pont2-prim-dropdown-menu\n * @fires pont2-open-change - cancelable `{ open, reason }`\n */\nexport class DropdownMenu extends PopupRoot {\n static override identity = \"dropdown-menu\";\n\n /** Where focus goes when the menu opens (set by the trigger's key handling). */\n focusOnOpen: FocusTarget = \"popup\";\n\n get triggerElement(): HTMLElement | null {\n return ownQuery<DropdownMenuTrigger>(this, tags(\"dropdown-menu-trigger\"), ROOTS)?.control ?? null;\n }\n get contentElement(): DropdownMenuContent | null {\n return ownQuery<DropdownMenuContent>(this, sel(\"dropdown-menu-content\"), ROOTS);\n }\n protected get popupKind() {\n return \"menu\" as const;\n }\n\n openWith(focus: FocusTarget, reason: \"trigger-press\" | \"list-navigation\" = \"trigger-press\"): void {\n this.focusOnOpen = focus;\n if (this.open) this.contentElement?.focusTarget(focus);\n else this.setOpen(true, reason, { keyboard: focus !== \"popup\" });\n }\n\n override toggle(reason: \"trigger-press\" = \"trigger-press\", opts: { keyboard?: boolean } = {}): void {\n // Base UI: opening with Enter/Space highlights the first item.\n this.focusOnOpen = opts.keyboard ? \"first\" : \"popup\";\n super.toggle(reason, opts);\n }\n\n protected override afterOpen(): void {\n this.contentElement?.focusTarget(this.focusOnOpen);\n }\n}\n\n/**\n * # DropdownMenuSub\n *\n * Base UI `Menu.SubmenuRoot` (renders nothing). Its trigger is a\n * `pont2-prim-dropdown-menu-sub-trigger` (a menuitem), its popup a\n * `pont2-prim-dropdown-menu-sub-content`.\n *\n * @tag pont2-prim-dropdown-menu-sub\n */\nexport class DropdownMenuSub extends PopupRoot {\n static override identity = \"dropdown-menu-sub\";\n\n focusOnOpen: FocusTarget = \"popup\";\n\n get triggerElement(): DropdownMenuSubTrigger | null {\n return ownQuery<DropdownMenuSubTrigger>(this, sel(\"dropdown-menu-sub-trigger\"), ROOTS);\n }\n get contentElement(): DropdownMenuSubContent | null {\n return ownQuery<DropdownMenuSubContent>(this, sel(\"dropdown-menu-sub-content\"), ROOTS);\n }\n protected get popupKind() {\n return \"menu\" as const;\n }\n\n openWith(focus: FocusTarget, reason: \"trigger-press\" | \"trigger-hover\" | \"list-navigation\"): void {\n this.focusOnOpen = focus;\n if (this.open) this.contentElement?.focusTarget(focus);\n else this.setOpen(true, reason, { keyboard: focus !== \"popup\" });\n }\n\n protected override afterOpen(): void {\n if (this.focusOnOpen !== \"popup\") this.contentElement?.focusTarget(this.focusOnOpen);\n }\n}\n\n/* ==================================================================== */\n/* Trigger */\n/* ==================================================================== */\n\n/**\n * Tier 3 enhancer around a native `<button>`; combine freely with the\n * button recipe (`<button data-pont2-button data-variant=\"outline\">`).\n * ArrowDown/ArrowUp open the menu and highlight the first/last item.\n *\n * @tag pont2-prim-dropdown-menu-trigger\n */\nexport class DropdownMenuTrigger extends PopupTrigger {\n static override rootTag = sel(\"dropdown-menu\");\n static override controlSlot = \"dropdown-menu-trigger\";\n\n protected override onKeyDown(e: KeyboardEvent): void {\n const root = this.root as DropdownMenu | null;\n if (!root || !this.control || e.target !== this.control) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n root.openWith(e.key === \"ArrowDown\" ? \"first\" : \"last\", \"list-navigation\");\n }\n }\n}\n\n/* ==================================================================== */\n/* Content */\n/* ==================================================================== */\n\n/**\n * The menu popup: Base UI `Menu.Popup` (`role=\"menu\"`). Items get real\n * focus (roving), so the highlighted item is `document.activeElement`.\n *\n * @tag pont2-prim-dropdown-menu-content\n * @attr side - bottom (default) … @attr align - start (default) …\n * @attr side-offset - 4 @attr align-offset - 0\n * @cssprop --pont2-dropdown-menu-bg, --pont2-dropdown-menu-fg, --pont2-dropdown-menu-border-color, --pont2-dropdown-menu-radius, --pont2-dropdown-menu-shadow - see docs/11-tokens.md\n * @cssprop --pont2-dropdown-menu-min-width, --pont2-dropdown-menu-padding-x, --pont2-dropdown-menu-padding-y - sizes (defaults 8rem, 0.25rem, 0.25rem)\n * @cssprop --pont2-dropdown-menu-sub-content-shadow - submenu shadow (default: the menu shadow token, else shadow-lg)\n * @cssprop --pont2-dropdown-menu-item-radius, --pont2-dropdown-menu-item-bg-focus, --pont2-dropdown-menu-item-fg-focus - items, inherited from the content\n * @cssprop --pont2-dropdown-menu-item-destructive-fg, --pont2-dropdown-menu-item-destructive-bg-focus - variant=\"destructive\" items\n */\nexport class DropdownMenuContent extends PopupContent {\n static override identity = \"dropdown-menu-content\";\n static override slotName = \"dropdown-menu-content\";\n static override role = \"menu\";\n\n private typeahead = new Typeahead();\n private subCloseTimer = 0;\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"start\";\n this.sideOffset = 4;\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"pointerleave\", this.onPointerLeave);\n this.addEventListener(\"pointerenter\", () => this.cancelSubClose());\n }\n\n /** This menu's own items (not its submenus'), visible, in order. */\n get items(): MenuItemBase[] {\n return Array.from(this.querySelectorAll<MenuItemBase>(ITEM)).filter(\n i => i.closest(CONTENT) === this && isItemVisible(i),\n );\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals.ariaOrientation = \"vertical\";\n }\n\n override show(): void {\n this.tabIndex = -1;\n super.show();\n }\n\n override hide(): Promise<void> {\n this.closeSubs();\n return super.hide();\n }\n\n focusTarget(target: FocusTarget): void {\n const items = this.items;\n const i = target === \"popup\" ? -1 : moveIndex(items, -1, target);\n (i >= 0 ? items[i] : this).focus({ preventScroll: i < 0 });\n }\n\n /** Close open submenus of this menu, optionally keeping one. */\n closeSubs(except?: Element | null): void {\n for (const sub of Array.from(this.querySelectorAll<DropdownMenuSub>(sel(\"dropdown-menu-sub\")))) {\n if (sub === except || sub.parentElement?.closest(CONTENT) !== this) continue;\n if (sub.open) sub.open = false;\n }\n }\n\n /** Called when the pointer rests on one of this menu's items. */\n scheduleSubClose(keep: Element | null): void {\n this.cancelSubClose();\n this.subCloseTimer = window.setTimeout(() => this.closeSubs(keep), 120);\n }\n\n cancelSubClose(): void {\n clearTimeout(this.subCloseTimer);\n }\n\n private onPointerLeave = () => {\n // Base UI: the highlight leaves with the pointer; focus stays in the menu.\n if (this.contains(document.activeElement) && document.activeElement !== this) {\n const active = document.activeElement as HTMLElement;\n if (active.closest(CONTENT) === this && !(active instanceof DropdownMenuSubTrigger && active.isSubOpen)) {\n this.focus({ preventScroll: true });\n }\n }\n };\n\n private onKeyDown = (e: KeyboardEvent) => {\n // Keys from a nested submenu are handled by that submenu.\n const owner = (e.target as Element).closest(CONTENT);\n if (owner !== this || e.defaultPrevented) return;\n\n const items = this.items;\n const current = items.indexOf(e.target as MenuItemBase);\n const rtl = directionOf(this) === \"rtl\";\n\n if (e.key === \"Tab\") {\n // Base UI: Tab closes the whole menu; focusing the trigger first lets the\n // browser's default Tab move on from it, like leaving any other control.\n const top = this.closest<DropdownMenu>(sel(\"dropdown-menu\"));\n top?.setOpen(false, \"focus-out\");\n top?.triggerElement?.focus();\n return;\n }\n\n const closeKey = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n if (e.key === closeKey && this instanceof DropdownMenuSubContent) {\n e.preventDefault();\n const sub = this.closest<DropdownMenuSub>(sel(\"dropdown-menu-sub\"));\n sub?.setOpen(false, \"list-navigation\");\n sub?.triggerElement?.focus();\n return;\n }\n\n const move = keyToMove(e.key);\n if (move) {\n e.preventDefault();\n const next = moveIndex(items, current, move);\n if (next >= 0) items[next].focus();\n return;\n }\n\n if ((e.key === \"Enter\" || e.key === \" \") && current >= 0) {\n e.preventDefault();\n if (e.key === \" \" && this.typeahead.active) return;\n items[current].click();\n return;\n }\n\n if (Typeahead.isChar(e)) {\n const i = this.typeahead.match(e.key, items, current, el => (el as MenuItemBase).label);\n if (i >= 0) items[i].focus();\n }\n };\n}\n\n/** @tag pont2-prim-dropdown-menu-sub-content */\nexport class DropdownMenuSubContent extends DropdownMenuContent {\n static override identity = \"dropdown-menu-sub-content\";\n static override slotName = \"dropdown-menu-sub-content\";\n\n constructor() {\n super();\n this.side = \"inline-end\";\n this.align = \"start\";\n this.sideOffset = 0;\n this.alignOffset = -3;\n this.addEventListener(\"pointerenter\", () =>\n this.parentElement?.closest<DropdownMenuContent>(CONTENT)?.cancelSubClose(),\n );\n }\n}\n\n/* ==================================================================== */\n/* Items */\n/* ==================================================================== */\n\n/**\n * Shared behaviour of every menu item (Base UI `Menu.Item` and friends):\n * host-as-root `role=menuitem*`, `tabindex=-1`, focus ⇄ `data-highlighted`,\n * pointer hover highlights, click activates and (optionally) closes the menu.\n */\nexport abstract class MenuItemBase extends HostElement {\n static override identity = \"menu-item\";\n static override role = \"menuitem\";\n\n static override properties: PropertyDeclarations = {\n disabled: { type: Boolean, reflect: true },\n inset: { type: Boolean, reflect: true },\n closeOnClick: { attribute: \"close-on-click\", converter: trueUnlessFalse },\n };\n\n declare disabled: boolean;\n declare inset: boolean;\n declare closeOnClick: boolean;\n\n constructor() {\n super();\n this.disabled = false;\n this.inset = false;\n this.closeOnClick = true;\n this.addEventListener(\"focus\", () => this.setData(\"highlighted\", true));\n this.addEventListener(\"blur\", () => this.setData(\"highlighted\", false));\n this.addEventListener(\"pointermove\", this.onPointerMove);\n this.addEventListener(\"click\", this.onClick);\n }\n\n /** Text used by typeahead (Base UI `label`): the `label` attribute, else the text content. */\n get label(): string {\n return this.getAttribute(\"label\") ?? (this.textContent ?? \"\").trim();\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"tabindex\")) this.tabIndex = -1;\n }\n\n protected get menu(): DropdownMenuContent | null {\n return this.closest<DropdownMenuContent>(CONTENT);\n }\n\n private onPointerMove = (e: PointerEvent) => {\n if (e.pointerType === \"touch\" || this.disabled) return;\n if (document.activeElement !== this) this.focus({ preventScroll: true });\n this.menu?.scheduleSubClose(this instanceof DropdownMenuSubTrigger ? this.parentElement : null);\n };\n\n private onClick = (e: MouseEvent) => {\n if (this.disabled || isItemDisabled(this)) {\n e.preventDefault();\n e.stopImmediatePropagation();\n return;\n }\n this.activate();\n if (this.closeOnClick) {\n this.closest<DropdownMenu>(sel(\"dropdown-menu\"))?.setOpen(false, \"item-press\");\n }\n };\n\n /** What pressing the item does beyond firing `click`. */\n protected activate(): void {}\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.setData(\"disabled\", this.disabled);\n this.setData(\"inset\", this.inset);\n this.internals.ariaDisabled = this.disabled ? \"true\" : null;\n }\n}\n\n/**\n * Base UI `Menu.Item`. Listen for `click` to act on it.\n *\n * @tag pont2-prim-dropdown-menu-item\n * @attr variant - default | destructive\n * @attr inset, disabled, close-on-click=\"false\"\n */\nexport class DropdownMenuItem extends MenuItemBase {\n static override identity = \"dropdown-menu-item\";\n static override slotName = \"dropdown-menu-item\";\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n };\n declare variant: \"default\" | \"destructive\";\n\n constructor() {\n super();\n this.variant = \"default\";\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.setData(\"variant\", this.variant || \"default\");\n }\n}\n\nconst indicator = (slot: string, on: boolean) =>\n html`<span data-pont2-dropdown-menu-item-indicator data-slot=${slot}>${on ? icons.check() : nothing}</span>`;\n\n/**\n * Base UI `Menu.CheckboxItem` (`role=menuitemcheckbox`). Stays open on\n * click by default, like Base UI. Fires `change` when toggled.\n *\n * @tag pont2-prim-dropdown-menu-checkbox-item\n * @attr checked\n * @fires change\n */\nexport class DropdownMenuCheckboxItem extends MenuItemBase {\n static override identity = \"dropdown-menu-checkbox-item\";\n static override slotName = \"dropdown-menu-checkbox-item\";\n static override role = \"menuitemcheckbox\";\n\n static override properties: PropertyDeclarations = {\n checked: { type: Boolean, reflect: true },\n };\n declare checked: boolean;\n\n constructor() {\n super();\n this.checked = false;\n this.closeOnClick = false;\n }\n\n protected override activate(): void {\n this.checked = !this.checked;\n fireNative(this, \"change\");\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.internals.ariaChecked = String(this.checked);\n this.setData(\"checked\", this.checked);\n this.setData(\"unchecked\", !this.checked);\n }\n\n override render() {\n return indicator(\"dropdown-menu-checkbox-item-indicator\", this.checked);\n }\n}\n\n/**\n * Base UI `Menu.RadioGroup` (`role=group`). Holds `value`; fires `change`\n * when a radio item is picked.\n *\n * @tag pont2-prim-dropdown-menu-radio-group\n * @attr value\n * @fires change\n */\nexport class DropdownMenuRadioGroup extends HostElement {\n static override identity = \"dropdown-menu-radio-group\";\n static override slotName = \"dropdown-menu-radio-group\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String, reflect: true },\n };\n declare value: string;\n\n constructor() {\n super();\n this.value = \"\";\n }\n\n select(value: string): void {\n if (value === this.value) return;\n this.value = value;\n fireNative(this, \"change\");\n }\n\n protected override updated(): void {\n for (const item of Array.from(this.querySelectorAll<DropdownMenuRadioItem>(sel(\"dropdown-menu-radio-item\")))) {\n if (item.closest(sel(\"dropdown-menu-radio-group\")) === this) item.requestUpdate();\n }\n }\n}\n\n/**\n * Base UI `Menu.RadioItem` (`role=menuitemradio`).\n *\n * @tag pont2-prim-dropdown-menu-radio-item\n * @attr value\n */\nexport class DropdownMenuRadioItem extends MenuItemBase {\n static override identity = \"dropdown-menu-radio-item\";\n static override slotName = \"dropdown-menu-radio-item\";\n static override role = \"menuitemradio\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n };\n declare value: string;\n\n constructor() {\n super();\n this.value = \"\";\n this.closeOnClick = false;\n }\n\n get group(): DropdownMenuRadioGroup | null {\n return this.closest(sel(\"dropdown-menu-radio-group\"));\n }\n get checked(): boolean {\n return !!this.group && this.group.value === this.value;\n }\n\n protected override activate(): void {\n this.group?.select(this.value);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.internals.ariaChecked = String(this.checked);\n this.setData(\"checked\", this.checked);\n this.setData(\"unchecked\", !this.checked);\n }\n\n override render() {\n return indicator(\"dropdown-menu-radio-item-indicator\", this.checked);\n }\n}\n\n/**\n * Base UI `Menu.SubmenuTrigger`: a menuitem that opens a submenu on hover\n * (100 ms), click, Enter/Space, or ArrowRight (ArrowLeft in RTL). Renders the\n * chevron after your content, as shadcn does.\n *\n * @tag pont2-prim-dropdown-menu-sub-trigger\n */\nexport class DropdownMenuSubTrigger extends MenuItemBase {\n static override identity = \"dropdown-menu-sub-trigger\";\n static override slotName = \"dropdown-menu-sub-trigger\";\n\n private hoverTimer = 0;\n\n constructor() {\n super();\n this.closeOnClick = false;\n this.addEventListener(\"keydown\", this.onKey);\n this.addEventListener(\"pointerenter\", this.onEnter);\n this.addEventListener(\"pointerleave\", () => clearTimeout(this.hoverTimer));\n }\n\n get sub(): DropdownMenuSub | null {\n return this.closest(sel(\"dropdown-menu-sub\"));\n }\n get isSubOpen(): boolean {\n return !!this.sub?.open;\n }\n\n protected override activate(): void {\n this.sub?.openWith(\"first\", \"trigger-press\");\n }\n\n private onEnter = (e: PointerEvent) => {\n if (e.pointerType === \"touch\" || this.disabled) return;\n clearTimeout(this.hoverTimer);\n this.hoverTimer = window.setTimeout(() => this.sub?.openWith(\"popup\", \"trigger-hover\"), 100);\n };\n\n private onKey = (e: KeyboardEvent) => {\n if (e.target !== this || this.disabled) return;\n const openKey = directionOf(this) === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n if (e.key === openKey) {\n e.preventDefault();\n e.stopPropagation();\n this.sub?.openWith(\"first\", \"list-navigation\");\n }\n };\n\n override render() {\n return icons.chevronRight();\n }\n}\n\n/** Base UI `Menu.Group` (`role=group`, labelled by its label). @tag pont2-prim-dropdown-menu-group */\nexport class DropdownMenuGroup extends HostElement {\n static override identity = \"dropdown-menu-group\";\n static override slotName = \"dropdown-menu-group\";\n static override role = \"group\";\n\n override connectedCallback(): void {\n super.connectedCallback();\n queueMicrotask(() => {\n const label = this.querySelector(`:scope > ${sel(\"dropdown-menu-label\")}`);\n if (label && !this.hasAttribute(\"aria-labelledby\")) {\n this.setAttribute(\"aria-labelledby\", ensureId(label, \"menu-label\"));\n }\n });\n }\n}\n\n/** Base UI `Menu.GroupLabel`. @tag pont2-prim-dropdown-menu-label @attr inset */\nexport class DropdownMenuLabel extends HostElement {\n static override identity = \"dropdown-menu-label\";\n static override slotName = \"dropdown-menu-label\";\n static override properties: PropertyDeclarations = { inset: { type: Boolean, reflect: true } };\n declare inset: boolean;\n constructor() {\n super();\n this.inset = false;\n }\n protected override willUpdate(): void {\n this.setData(\"inset\", this.inset);\n }\n}\n\n/**\n * Base UI `Menu.Separator`. **Is a** Separator (`extends Separator`), so it\n * carries `data-pont2-separator` (the look) and its own slot.\n *\n * @tag pont2-prim-dropdown-menu-separator\n */\nexport class DropdownMenuSeparator extends Separator {\n static override identity = \"dropdown-menu-separator\";\n static override slotName = \"dropdown-menu-separator\";\n}\n\n/** shadcn `DropdownMenuShortcut` (a `<span>`). @tag pont2-prim-dropdown-menu-shortcut */\nexport class DropdownMenuShortcut extends HostElement {\n static override identity = \"dropdown-menu-shortcut\";\n static override slotName = \"dropdown-menu-shortcut\";\n}\n\ndefine(\"pont2-prim-dropdown-menu\", DropdownMenu);\ndefine(\"pont2-prim-dropdown-menu-sub\", DropdownMenuSub);\ndefine(\"pont2-prim-dropdown-menu-trigger\", DropdownMenuTrigger);\ndefine(\"pont2-prim-dropdown-menu-content\", DropdownMenuContent);\ndefine(\"pont2-prim-dropdown-menu-sub-content\", DropdownMenuSubContent);\ndefine(\"pont2-prim-dropdown-menu-item\", DropdownMenuItem);\ndefine(\"pont2-prim-dropdown-menu-checkbox-item\", DropdownMenuCheckboxItem);\ndefine(\"pont2-prim-dropdown-menu-radio-group\", DropdownMenuRadioGroup);\ndefine(\"pont2-prim-dropdown-menu-radio-item\", DropdownMenuRadioItem);\ndefine(\"pont2-prim-dropdown-menu-sub-trigger\", DropdownMenuSubTrigger);\ndefine(\"pont2-prim-dropdown-menu-group\", DropdownMenuGroup);\ndefine(\"pont2-prim-dropdown-menu-label\", DropdownMenuLabel);\ndefine(\"pont2-prim-dropdown-menu-separator\", DropdownMenuSeparator);\ndefine(\"pont2-prim-dropdown-menu-shortcut\", DropdownMenuShortcut);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-dropdown-menu\": DropdownMenu;\n \"pont2-prim-dropdown-menu-sub\": DropdownMenuSub;\n \"pont2-prim-dropdown-menu-trigger\": DropdownMenuTrigger;\n \"pont2-prim-dropdown-menu-content\": DropdownMenuContent;\n \"pont2-prim-dropdown-menu-sub-content\": DropdownMenuSubContent;\n \"pont2-prim-dropdown-menu-item\": DropdownMenuItem;\n \"pont2-prim-dropdown-menu-checkbox-item\": DropdownMenuCheckboxItem;\n \"pont2-prim-dropdown-menu-radio-group\": DropdownMenuRadioGroup;\n \"pont2-prim-dropdown-menu-radio-item\": DropdownMenuRadioItem;\n \"pont2-prim-dropdown-menu-sub-trigger\": DropdownMenuSubTrigger;\n \"pont2-prim-dropdown-menu-group\": DropdownMenuGroup;\n \"pont2-prim-dropdown-menu-label\": DropdownMenuLabel;\n \"pont2-prim-dropdown-menu-separator\": DropdownMenuSeparator;\n \"pont2-prim-dropdown-menu-shortcut\": DropdownMenuShortcut;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { HostElement, ShellElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { isItemDisabled, isItemVisible, keyToMove, moveIndex, Typeahead } from \"../../core/popup/list\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot } from \"../../core/popup/popup-root\";\nimport { Separator } from \"../separator/separator\";\n\nconst ROOT = sel(\"select\");\nconst trueUnlessFalse = { fromAttribute: (v: string | null) => v !== \"false\", toAttribute: (v: boolean) => String(v) };\n\n/**\n * # Select\n *\n * shadcn: `<Select>` = Base UI `Select.Root` (renders a hidden `<input>` for\n * forms, nothing else) > `<SelectTrigger>` (`<button role=combobox>` with\n * `<SelectValue>` + chevron) + `<SelectContent>` (Portal > Positioner > Popup >\n * List > items).\n *\n * pont2:\n * ```html\n * <pont2-prim-select name=\"fruit\" value=\"apple\"> coordinator + form-associated, display: contents\n * <pont2-prim-select-trigger placeholder=\"Select a fruit\"></pont2-prim-select-trigger> shell > native <button>\n * <pont2-prim-select-content> the popup: [popover], role=listbox\n * <pont2-prim-select-group>\n * <pont2-prim-select-label>Fruits</pont2-prim-select-label>\n * <pont2-prim-select-item value=\"apple\">Apple</pont2-prim-select-item>\n * </pont2-prim-select-group>\n * </pont2-prim-select-content>\n * </pont2-prim-select>\n * ```\n *\n * The **root is the form control** (a form-associated custom element):\n * `name`/`value` submit with the form, `required` blocks submission,\n * `<fieldset disabled>` and form reset work, and `<label for=\"…\">` targets it\n * (the label's text becomes the trigger's accessible name). That replaces\n * Base UI's hidden `<input>`, one node fewer.\n *\n * @tag pont2-prim-select\n * @attr value - selected value (initially: Base UI `defaultValue`)\n * @attr name, required, disabled, open\n * @fires input, change - the user picked a value (read `.value`)\n * @fires pont2-open-change - cancelable `{ open, reason }`\n */\nexport class Select extends PopupRoot {\n static formAssociated = true;\n static override identity = \"select\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n name: { type: String, reflect: true },\n required: { type: Boolean, reflect: true },\n /** `aria-invalid` on the root is forwarded to the native trigger (which you do not write). */\n invalid: { type: String, attribute: \"aria-invalid\" },\n formDisabled: { state: true },\n };\n\n declare value: string;\n declare name: string;\n declare required: boolean;\n declare invalid: string | null;\n declare protected formDisabled: boolean;\n\n private typeahead = new Typeahead();\n private focusSelectedOnOpen = true;\n\n constructor() {\n super();\n this.value = \"\";\n this.name = \"\";\n this.required = false;\n this.formDisabled = false;\n // A <label for> click lands on the (box-less) root: forward focus to the trigger.\n this.addEventListener(\"click\", e => {\n if (e.target === this) this.triggerElement?.focus();\n });\n }\n\n /* ---------------- parts ---------------- */\n\n get triggerElement(): HTMLButtonElement | null {\n return ownQuery<SelectTrigger>(this, tags(\"select-trigger\"), ROOT)?.control ?? null;\n }\n get triggerHost(): SelectTrigger | null {\n return ownQuery<SelectTrigger>(this, tags(\"select-trigger\"), ROOT);\n }\n get contentElement(): SelectContent | null {\n return ownQuery<SelectContent>(this, sel(\"select-content\"), ROOT);\n }\n protected get popupKind() {\n return \"listbox\" as const;\n }\n get items(): SelectItem[] {\n return Array.from(this.querySelectorAll<SelectItem>(sel(\"select-item\"))).filter(\n i => i.closest(ROOT) === this && isItemVisible(i),\n );\n }\n get selectedItem(): SelectItem | null {\n return this.items.find(i => i.value === this.value) ?? null;\n }\n\n /* ---------------- form-associated API ---------------- */\n\n get form(): HTMLFormElement | null {\n return this.internals.form;\n }\n get labels(): NodeList {\n return this.internals.labels;\n }\n get validity(): ValidityState {\n return this.internals.validity;\n }\n get validationMessage(): string {\n return this.internals.validationMessage;\n }\n get isDisabled(): boolean {\n return this.disabled || this.formDisabled;\n }\n checkValidity(): boolean {\n return this.internals.checkValidity();\n }\n reportValidity(): boolean {\n return this.internals.reportValidity();\n }\n formResetCallback(): void {\n this.value = this.getAttribute(\"value\") ?? \"\";\n }\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n formStateRestoreCallback(state: string | null): void {\n if (typeof state === \"string\") this.value = state;\n }\n\n /* ---------------- behaviour ---------------- */\n\n override wire(): void {\n super.wire();\n // Labels of the (box-less) root name the trigger button.\n const trigger = this.triggerElement;\n if (trigger) {\n const ids = Array.from(this.internals.labels as NodeListOf<HTMLElement>).map(l => ensureId(l, \"select-label\"));\n if (ids.length && !trigger.hasAttribute(\"aria-label\")) trigger.setAttribute(\"aria-labelledby\", ids.join(\" \"));\n }\n }\n\n /** Pick `value` as the user did: updates, fires input/change, closes. */\n select(value: string): void {\n const changed = value !== this.value;\n this.value = value;\n if (changed) {\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n this.setOpen(false, \"item-press\");\n }\n\n /** Called by the trigger for keys pressed while it has focus. */\n handleTriggerKey(e: KeyboardEvent): void {\n if (this.isDisabled) return;\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n this.setOpen(true, \"list-navigation\", { keyboard: true });\n return;\n }\n // Base UI: typing on a closed select picks the matching item directly.\n if (!this.open && Typeahead.isChar(e)) {\n const items = this.items;\n const i = this.typeahead.match(e.key, items, items.indexOf(this.selectedItem!), el => (el as SelectItem).label);\n if (i >= 0 && items[i].value !== this.value) {\n this.value = items[i].value;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n }\n }\n\n override setOpen(open: boolean, reason: Parameters<PopupRoot[\"setOpen\"]>[1], opts?: { keyboard?: boolean }): boolean {\n if (open && this.isDisabled) return false;\n return super.setOpen(open, reason, opts);\n }\n\n protected override afterOpen(): void {\n const content = this.contentElement;\n if (!content) return;\n const target = (this.focusSelectedOnOpen && this.selectedItem) || (this.openedByKeyboard ? this.items.find(i => !isItemDisabled(i)) : null);\n (target ?? content).focus({ preventScroll: true });\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n const disabled = this.isDisabled;\n this.setData(\"disabled\", disabled);\n this.setData(\"required\", this.required);\n this.internals.setFormValue(this.value || null);\n if (this.required && !this.value) {\n this.internals.setValidity({ valueMissing: true }, \"Please select an item in the list.\", this.triggerElement ?? undefined);\n } else {\n this.internals.setValidity({});\n }\n if (changed.has(\"value\") || changed.has(\"disabled\") || changed.has(\"formDisabled\") || changed.has(\"invalid\")) {\n for (const item of this.items) item.requestUpdate();\n this.triggerHost?.requestUpdate();\n }\n }\n}\n\n/* ==================================================================== */\n\n/**\n * shadcn `SelectTrigger` + `SelectValue`. Tier 3, **self-rendering**: the\n * trigger generates all of its content (the selected item's label or the\n * placeholder, then the chevron), so it renders its own native `<button>`\n * rather than enhancing one you write (docs/02-conventions.md, \"Tier 3\n * entry points\").\n *\n * ```\n * shadcn: button[data-slot=select-trigger][role=combobox] > span[data-slot=select-value] + svg\n * pont2: pont2-prim-select-trigger (shell) > button[data-slot=select-trigger][role=combobox] > span[data-slot=select-value] + svg\n * ```\n *\n * @tag pont2-prim-select-trigger\n * @attr placeholder - shown when no value is selected (Base UI `Select.Value` placeholder)\n * @attr size - default | sm\n */\nexport class SelectTrigger extends ShellElement {\n static override properties: PropertyDeclarations = {\n placeholder: { type: String },\n size: { type: String },\n };\n declare placeholder: string;\n declare size: \"default\" | \"sm\";\n\n constructor() {\n super();\n this.placeholder = \"\";\n this.size = \"default\";\n }\n\n get root(): Select | null {\n return this.closest(ROOT);\n }\n\n override get control(): HTMLButtonElement | null {\n return this.querySelector(\":scope > [data-pont2-select-trigger]\");\n }\n\n private onClick = (e: MouseEvent) => {\n const root = this.root;\n if (!root || root.isDisabled) return;\n root.toggle(\"trigger-press\", { keyboard: e.detail === 0 });\n };\n\n private onKeyDown = (e: KeyboardEvent) => this.root?.handleTriggerKey(e);\n\n protected override updated(): void {\n this.root?.wire();\n }\n\n override render() {\n const root = this.root;\n const item = root?.selectedItem ?? null;\n const disabled = !!root?.isDisabled;\n return html`<button\n type=\"button\"\n role=\"combobox\"\n data-pont2-select-trigger\n data-slot=\"select-trigger\"\n data-size=${this.size || \"default\"}\n ?data-placeholder=${!item}\n aria-invalid=${root?.invalid ?? nothing}\n ?disabled=${disabled}\n ?data-disabled=${disabled}\n @click=${this.onClick}\n @keydown=${this.onKeyDown}\n ><span data-pont2-select-value data-slot=\"select-value\" ?data-placeholder=${!item}\n >${item ? item.labelNodes() : this.placeholder}</span\n >${icons.chevronDown()}</button>`;\n }\n}\n\n/* ==================================================================== */\n\n/**\n * The popup (`role=listbox`). By default the selected item is laid over the\n * trigger (Base UI `alignItemWithTrigger`, macOS-style); when that cannot fit\n * it falls back to opening below the trigger.\n *\n * @tag pont2-prim-select-content\n * @attr align-item-with-trigger - default true; `=\"false\"` always opens on `side`\n * @attr side - bottom @attr align - center @attr side-offset - 4\n */\nexport class SelectContent extends PopupContent {\n static override identity = \"select-content\";\n static override slotName = \"select-content\";\n static override role = \"listbox\";\n\n static override properties: PropertyDeclarations = {\n alignItemWithTrigger: { attribute: \"align-item-with-trigger\", converter: trueUnlessFalse },\n };\n declare alignItemWithTrigger: boolean;\n\n private typeahead = new Typeahead();\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"center\";\n this.sideOffset = 4;\n this.alignItemWithTrigger = true;\n this.addEventListener(\"keydown\", this.onKeyDown);\n this.addEventListener(\"pointerleave\", () => {\n if (this.contains(document.activeElement)) this.focus({ preventScroll: true });\n });\n }\n\n get root(): Select | null {\n return this.closest(ROOT);\n }\n\n protected override alignItem(): HTMLElement | null {\n if (!this.alignItemWithTrigger) return null;\n const root = this.root;\n return root?.selectedItem ?? root?.items[0] ?? null;\n }\n\n protected override willUpdate(): void {\n this.setData(\"align-trigger\", this.alignItemWithTrigger ? \"true\" : \"false\");\n }\n\n override show(): void {\n this.tabIndex = -1;\n super.show();\n // Bring the selected item into view inside the list, then re-measure.\n const item = this.root?.selectedItem;\n if (item) {\n const top = item.offsetTop;\n if (top < this.scrollTop || top + item.offsetHeight > this.scrollTop + this.clientHeight) {\n this.scrollTop = top - (this.clientHeight - item.offsetHeight) / 2;\n }\n }\n this.positioner.update();\n }\n\n private onKeyDown = (e: KeyboardEvent) => {\n const root = this.root;\n if (!root || e.defaultPrevented) return;\n const items = root.items;\n const current = items.indexOf(e.target as SelectItem);\n\n if (e.key === \"Tab\") {\n root.setOpen(false, \"focus-out\");\n root.triggerElement?.focus();\n return;\n }\n const move = keyToMove(e.key);\n if (move) {\n e.preventDefault();\n const next = moveIndex(items, current, move, { loop: false });\n if (next >= 0) items[next].focus();\n return;\n }\n if ((e.key === \"Enter\" || e.key === \" \") && current >= 0) {\n e.preventDefault();\n if (e.key === \" \" && this.typeahead.active) return;\n items[current].click();\n return;\n }\n if (Typeahead.isChar(e)) {\n const i = this.typeahead.match(e.key, items, current, el => (el as SelectItem).label);\n if (i >= 0) items[i].focus();\n }\n };\n}\n\n/* ==================================================================== */\n\n/**\n * Base UI `Select.Item` (`role=option`): host-as-root. Your content is the\n * item text (Base UI `ItemText`); the check indicator is rendered after it\n * when selected.\n *\n * @tag pont2-prim-select-item\n * @attr value - required\n * @attr label - text for typeahead and the trigger (defaults to the text content)\n * @attr disabled\n */\nexport class SelectItem extends HostElement {\n static override identity = \"select-item\";\n static override slotName = \"select-item\";\n static override role = \"option\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n };\n declare value: string;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.value = \"\";\n this.disabled = false;\n this.addEventListener(\"focus\", () => this.setData(\"highlighted\", true));\n this.addEventListener(\"blur\", () => this.setData(\"highlighted\", false));\n this.addEventListener(\"pointermove\", e => {\n if (e.pointerType !== \"touch\" && !this.disabled && document.activeElement !== this) this.focus({ preventScroll: true });\n });\n this.addEventListener(\"click\", e => {\n if (this.disabled) {\n e.stopImmediatePropagation();\n return;\n }\n this.root?.select(this.value);\n });\n }\n\n get root(): Select | null {\n return this.closest(ROOT);\n }\n get selected(): boolean {\n return !!this.root && this.root.value === this.value;\n }\n get label(): string {\n return this.getAttribute(\"label\") ?? this.textOf();\n }\n\n private textOf(): string {\n let t = \"\";\n for (const n of Array.from(this.childNodes)) {\n if (n instanceof Comment) continue; // lit-html part markers\n if (n instanceof Element && n.hasAttribute(\"data-pont2-select-item-indicator\")) continue;\n t += n.textContent ?? \"\";\n }\n return t.trim();\n }\n\n /** Copies of the author's content, for the trigger to display (Base UI renders the item label). */\n labelNodes(): Node[] {\n if (this.hasAttribute(\"label\")) return [document.createTextNode(this.getAttribute(\"label\")!)];\n return Array.from(this.childNodes)\n .filter(n => !(n instanceof Comment) && !(n instanceof Element && n.hasAttribute(\"data-pont2-select-item-indicator\")))\n .map(n => {\n const c = n.cloneNode(true);\n if (c instanceof Element) c.removeAttribute(\"id\");\n return c;\n });\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"tabindex\")) this.tabIndex = -1;\n }\n\n protected override willUpdate(): void {\n const selected = this.selected;\n this.internals.ariaSelected = String(selected);\n this.internals.ariaDisabled = this.disabled ? \"true\" : null;\n this.setData(\"selected\", selected);\n this.setData(\"disabled\", this.disabled);\n }\n\n override render() {\n return this.selected\n ? html`<span data-pont2-select-item-indicator data-slot=\"select-item-indicator\">${icons.check()}</span>`\n : nothing;\n }\n}\n\n/** Base UI `Select.Group` (`role=group`). @tag pont2-prim-select-group */\nexport class SelectGroup extends HostElement {\n static override identity = \"select-group\";\n static override slotName = \"select-group\";\n static override role = \"group\";\n override connectedCallback(): void {\n super.connectedCallback();\n queueMicrotask(() => {\n const label = this.querySelector(`:scope > ${sel(\"select-label\")}`);\n if (label && !this.hasAttribute(\"aria-labelledby\")) this.setAttribute(\"aria-labelledby\", ensureId(label, \"select-group-label\"));\n });\n }\n}\n\n/** Base UI `Select.GroupLabel`. @tag pont2-prim-select-label */\nexport class SelectLabel extends HostElement {\n static override identity = \"select-label\";\n static override slotName = \"select-label\";\n}\n\n/** Base UI `Select.Separator`; is-a Separator. @tag pont2-prim-select-separator */\nexport class SelectSeparator extends Separator {\n static override identity = \"select-separator\";\n static override slotName = \"select-separator\";\n}\n\ndefine(\"pont2-prim-select\", Select);\ndefine(\"pont2-prim-select-trigger\", SelectTrigger);\ndefine(\"pont2-prim-select-content\", SelectContent);\ndefine(\"pont2-prim-select-item\", SelectItem);\ndefine(\"pont2-prim-select-group\", SelectGroup);\ndefine(\"pont2-prim-select-label\", SelectLabel);\ndefine(\"pont2-prim-select-separator\", SelectSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-select\": Select;\n \"pont2-prim-select-trigger\": SelectTrigger;\n \"pont2-prim-select-content\": SelectContent;\n \"pont2-prim-select-item\": SelectItem;\n \"pont2-prim-select-group\": SelectGroup;\n \"pont2-prim-select-label\": SelectLabel;\n \"pont2-prim-select-separator\": SelectSeparator;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { ensureId, uid } from \"../../core/ids\";\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define, sel } from \"../../core/names\";\nimport { isItemDisabled, isItemVisible, keyToMove, moveIndex } from \"../../core/popup/list\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot } from \"../../core/popup/popup-root\";\nimport { button } from \"../button/button\";\nimport { Separator } from \"../separator/separator\";\n\nconst ROOT = sel(\"combobox\");\nconst trueUnlessFalse = { fromAttribute: (v: string | null) => v !== \"false\", toAttribute: (v: boolean) => String(v) };\n\n/**\n * # Combobox\n *\n * shadcn: `<Combobox>` = Base UI `Combobox.Root` (a hidden `<input>` for\n * forms, nothing else) > `<ComboboxInput>` (InputGroup > `<input\n * role=combobox>` + addon > trigger/clear buttons) + `<ComboboxContent>`\n * (Portal > Positioner > Popup) > `<ComboboxList role=listbox>` > items,\n * `<ComboboxEmpty>`, groups.\n *\n * pont2:\n * ```html\n * <pont2-prim-combobox name=\"framework\"> coordinator + form-associated, display: contents\n * <pont2-prim-combobox-input placeholder=\"Select a framework\"></pont2-prim-combobox-input> is the InputGroup; renders the native input + buttons\n * <pont2-prim-combobox-content> the popup: [popover]\n * <pont2-prim-combobox-empty>No items found.</pont2-prim-combobox-empty>\n * <pont2-prim-combobox-list> role=listbox\n * <pont2-prim-combobox-item value=\"next\">Next.js</pont2-prim-combobox-item>\n * </pont2-prim-combobox-list>\n * </pont2-prim-combobox-content>\n * </pont2-prim-combobox>\n * ```\n *\n * **Which element submits?** The root (a form-associated custom element)\n * submits `name` = the *selected item's value*, exactly what Base UI's hidden\n * input submits. The native `<input>` is the typing surface (IME, caret,\n * mobile keyboards, screen-reader combobox semantics) and has no `name`, so\n * the half-typed query never reaches the server.\n *\n * Focus stays in the input; the highlighted item is announced with\n * `aria-activedescendant` (virtual focus), as in Base UI.\n *\n * **Multiple selection** (`multiple`): the selection is `values` (an array),\n * the popup stays open while you pick, and the input is a\n * `<pont2-prim-combobox-chips>`, which shows a removable chip per value\n * (shadcn's `ComboboxChips` + `ComboboxValue` + `ComboboxChip` +\n * `ComboboxChipsInput`). The root submits one `name=value` entry per value.\n * A selected item that is `disabled` is **locked**: its chip has no remove\n * button and cannot be removed (pont2's addition, for roles a person may not\n * take away).\n *\n * Not implemented yet: async items, `autoHighlight`, creatable items. See\n * docs/primitives/combobox.md.\n *\n * @tag pont2-prim-combobox\n * @attr value - selected value (initially: Base UI `defaultValue`); single selection\n * @attr multiple - multiple selection: read and write the `values` property\n * @attr name, required, disabled, open\n * @fires input, change - the user picked (or cleared) a value\n * @fires pont2-open-change - cancelable `{ open, reason }`\n */\nexport class Combobox extends PopupRoot {\n static formAssociated = true;\n static override identity = \"combobox\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n values: { attribute: false },\n multiple: { type: Boolean, reflect: true },\n name: { type: String, reflect: true },\n required: { type: Boolean, reflect: true },\n query: { state: true },\n formDisabled: { state: true },\n };\n\n declare value: string;\n /** The selection when `multiple` (Base UI's array `value`). */\n declare values: string[];\n declare multiple: boolean;\n declare name: string;\n declare required: boolean;\n /** What the user typed since the popup opened; filters the items. */\n declare query: string;\n declare protected formDisabled: boolean;\n\n /** The virtually focused item. */\n highlighted: ComboboxItem | null = null;\n /** `values` as first set: what a form reset restores (multiple). */\n private defaultValues: string[] | null = null;\n\n constructor() {\n super();\n this.value = \"\";\n this.values = [];\n this.multiple = false;\n this.name = \"\";\n this.required = false;\n this.query = \"\";\n this.formDisabled = false;\n this.addEventListener(\"click\", e => {\n if (e.target === this) this.inputElement?.focus(); // <label for> on the root\n });\n }\n\n /* ---------------- parts ---------------- */\n\n /** The ComboboxInput, or the ComboboxChips (which is one) when `multiple`. */\n get inputHost(): ComboboxInput | null {\n return ownQuery<ComboboxInput>(this, sel(\"combobox-input\"), ROOT);\n }\n get inputElement(): HTMLInputElement | null {\n return this.inputHost?.control ?? null;\n }\n /** The input is the combobox element: it gets aria-expanded/controls and receives focus back. */\n get triggerElement(): HTMLInputElement | null {\n return this.inputElement;\n }\n get contentElement(): ComboboxContent | null {\n return ownQuery<ComboboxContent>(this, sel(\"combobox-content\"), ROOT);\n }\n get listElement(): ComboboxList | null {\n return ownQuery<ComboboxList>(this, sel(\"combobox-list\"), ROOT);\n }\n protected get popupKind() {\n return \"listbox\" as const;\n }\n protected override anchorElement(): Element | null {\n return this.inputHost;\n }\n protected override extraInsideElements(): (Element | null)[] {\n return [this.inputHost];\n }\n\n get allItems(): ComboboxItem[] {\n return Array.from(this.querySelectorAll<ComboboxItem>(sel(\"combobox-item\"))).filter(i => i.closest(ROOT) === this);\n }\n /** Items matching the current query. */\n get items(): ComboboxItem[] {\n return this.allItems.filter(i => isItemVisible(i));\n }\n get selectedItem(): ComboboxItem | null {\n return this.allItems.find(i => i.value === this.value) ?? null;\n }\n /** The selected values, in either mode. */\n get selectedValues(): string[] {\n if (this.multiple) return [...(this.values ?? [])];\n return this.value ? [this.value] : [];\n }\n isSelected(value: string): boolean {\n return !!value && (this.multiple ? (this.values ?? []).includes(value) : this.value === value);\n }\n /** A selected value whose item is disabled cannot be removed (multiple). */\n isLocked(value: string): boolean {\n return !!this.allItems.find(i => i.value === value)?.disabled;\n }\n /** The text shown for a value: its item's label, else the value itself. */\n labelOf(value: string): string {\n return this.allItems.find(i => i.value === value)?.label || value;\n }\n\n /* ---------------- form-associated API ---------------- */\n\n get form(): HTMLFormElement | null {\n return this.internals.form;\n }\n get labels(): NodeList {\n return this.internals.labels;\n }\n get validity(): ValidityState {\n return this.internals.validity;\n }\n get isDisabled(): boolean {\n return this.disabled || this.formDisabled;\n }\n checkValidity(): boolean {\n return this.internals.checkValidity();\n }\n reportValidity(): boolean {\n return this.internals.reportValidity();\n }\n formResetCallback(): void {\n if (this.multiple) this.values = [...(this.defaultValues ?? [])];\n else this.value = this.getAttribute(\"value\") ?? \"\";\n this.syncInputText();\n }\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n formStateRestoreCallback(state: string | FormData | null): void {\n if (typeof state === \"string\") this.value = state;\n else if (state instanceof FormData && this.multiple) this.values = state.getAll(this.name).map(String);\n }\n\n /* ---------------- behaviour ---------------- */\n\n /** Base UI default filter: case- and accent-insensitive \"contains\". */\n static filter(label: string, query: string): boolean {\n const norm = (s: string) => s.normalize(\"NFD\").replace(/\\p{Diacritic}/gu, \"\").toLowerCase();\n return norm(label).includes(norm(query.trim()));\n }\n\n select(item: ComboboxItem | null): void {\n if (this.multiple) {\n if (!item) return;\n const has = this.isSelected(item.value);\n if (has && this.isLocked(item.value)) return;\n this.values = has ? this.values.filter(v => v !== item.value) : [...this.values, item.value];\n this.query = \"\";\n this.syncInputText();\n this.applyFilter();\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n return; // Base UI: the popup stays open while picking several\n }\n const value = item?.value ?? \"\";\n const changed = value !== this.value;\n this.value = value;\n this.query = \"\";\n this.syncInputText();\n if (changed) {\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n this.setOpen(false, \"item-press\");\n }\n\n /**\n * Remove one value (a chip's remove button, Backspace). Returns false for a\n * locked or unselected value.\n */\n removeValue(value: string): boolean {\n if (!this.multiple || !this.isSelected(value) || this.isLocked(value) || this.isDisabled) return false;\n this.values = this.values.filter(v => v !== value);\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n return true;\n }\n\n /** Show the selected item's label in the input (after select/close/reset); empty in multiple mode. */\n syncInputText(): void {\n const input = this.inputElement;\n if (input) input.value = this.multiple ? this.query : (this.selectedItem?.label ?? \"\");\n }\n\n highlight(item: ComboboxItem | null, scroll = true): void {\n if (this.highlighted === item) return;\n this.highlighted?.setHighlighted(false);\n this.highlighted = item;\n item?.setHighlighted(true);\n const input = this.inputElement;\n if (input) {\n if (item) input.setAttribute(\"aria-activedescendant\", ensureId(item, \"combobox-item\"));\n else input.removeAttribute(\"aria-activedescendant\");\n }\n if (item && scroll) item.scrollIntoView({ block: \"nearest\" });\n }\n\n /** From the input: the user typed. */\n handleQuery(text: string): void {\n this.query = text;\n if (!this.open) this.setOpen(true, \"input-change\");\n // Keep the highlight only if it is still visible.\n this.applyFilter();\n if (this.highlighted && !isItemVisible(this.highlighted)) this.highlight(null);\n }\n\n /** From the input: keyboard. */\n handleKey(e: KeyboardEvent): void {\n if (this.isDisabled) return;\n const move = e.key === \"ArrowDown\" || e.key === \"ArrowUp\" ? keyToMove(e.key) : null;\n if (move) {\n e.preventDefault();\n if (!this.open) {\n this.setOpen(true, \"list-navigation\", { keyboard: true });\n this.applyFilter();\n }\n const items = this.items;\n const current = this.highlighted ? items.indexOf(this.highlighted) : -1;\n const next = moveIndex(items, current, move);\n this.highlight(next >= 0 ? items[next] : null);\n return;\n }\n if (e.key === \"Enter\" && this.open) {\n e.preventDefault(); // never submit the form while choosing\n if (this.highlighted && !isItemDisabled(this.highlighted)) this.select(this.highlighted);\n return;\n }\n if (e.key === \"Tab\" && this.open) this.setOpen(false, \"focus-out\");\n const input = e.target as HTMLInputElement;\n if (this.multiple && !input.value && input.selectionStart === 0) {\n // Backspace on an empty input removes the last chip; ArrowLeft moves to it.\n const last = this.values.at(-1);\n if (e.key === \"Backspace\" && last !== undefined) {\n e.preventDefault();\n this.removeValue(last);\n } else if (e.key === \"ArrowLeft\" && last !== undefined) {\n e.preventDefault();\n (this.inputHost as ComboboxChips | null)?.focusChip?.(this.values.length - 1);\n }\n }\n }\n\n /** Hide items (and empty groups) that do not match the query. */\n applyFilter(): void {\n const q = this.query;\n let visible = 0;\n for (const item of this.allItems) {\n const show = !q || Combobox.filter(item.label, q);\n item.hidden = !show;\n if (show) visible++;\n }\n for (const group of Array.from(this.querySelectorAll<HTMLElement>(sel(\"combobox-group\")))) {\n if (group.closest(ROOT) !== this) continue;\n group.hidden = !group.querySelector(`${sel(\"combobox-item\")}:not([hidden])`);\n }\n const empty = visible === 0;\n this.listElement?.toggleAttribute(\"data-empty\", empty);\n this.contentElement?.toggleAttribute(\"data-empty\", empty);\n this.contentElement?.reposition();\n }\n\n override wire(): void {\n super.wire();\n const input = this.inputElement;\n const list = this.listElement;\n if (input && list) input.setAttribute(\"aria-controls\", ensureId(list, \"combobox-list\"));\n if (list) list.toggleAttribute(\"aria-multiselectable\", this.multiple);\n if (list && this.multiple) list.setAttribute(\"aria-multiselectable\", \"true\");\n if (input) {\n const ids = Array.from(this.internals.labels as NodeListOf<HTMLElement>).map(l => ensureId(l, \"combobox-label\"));\n if (ids.length && !input.hasAttribute(\"aria-label\")) input.setAttribute(\"aria-labelledby\", ids.join(\" \"));\n }\n }\n\n protected override afterOpen(): void {\n this.applyFilter();\n if (this.openedByKeyboard && !this.highlighted) {\n const sel = this.selectedItem;\n this.highlight(sel && isItemVisible(sel) ? sel : null);\n }\n }\n\n protected override afterClose(): void {\n this.highlight(null);\n this.query = \"\";\n this.syncInputText();\n // Unfiltered again for next time, once the exit animation is done.\n setTimeout(() => {\n if (!this.open) this.applyFilter();\n }, 200);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.setData(\"disabled\", this.isDisabled);\n if (this.multiple) {\n this.defaultValues ??= [...(this.values ?? [])];\n if (this.name && this.values.length) {\n const data = new FormData();\n for (const v of this.values) data.append(this.name, v);\n this.internals.setFormValue(data);\n } else {\n this.internals.setFormValue(null);\n }\n } else {\n this.internals.setFormValue(this.value || null);\n }\n if (this.required && !this.selectedValues.length) {\n this.internals.setValidity({ valueMissing: true }, \"Please select an item in the list.\", this.inputElement ?? undefined);\n } else {\n this.internals.setValidity({});\n }\n if (changed.has(\"value\") || changed.has(\"values\") || changed.has(\"multiple\")) {\n for (const item of this.allItems) item.requestUpdate();\n this.inputHost?.requestUpdate();\n if (changed.get(\"value\") === undefined) queueMicrotask(() => this.syncInputText());\n }\n if (changed.has(\"disabled\") || changed.has(\"formDisabled\")) this.inputHost?.requestUpdate();\n }\n}\n\n/* ==================================================================== */\n\n/**\n * shadcn `ComboboxInput`: an InputGroup holding the native `<input>` and an\n * inline-end addon with the trigger (and optionally clear) button. The host\n * **is** the InputGroup (`role=group`, `data-slot=\"input-group\"`); it renders\n * the input and buttons because shadcn's ComboboxInput generates them too.\n *\n * ```\n * shadcn: div[data-slot=input-group] > input + div[data-slot=input-group-addon] > button[data-slot=input-group-button]\n * pont2: pont2-prim-combobox-input > input + div[data-slot=input-group-addon] > button[data-slot=input-group-button]\n * ```\n *\n * @tag pont2-prim-combobox-input\n * @attr placeholder\n * @attr show-trigger - default true; `=\"false\"` hides the chevron button\n * @attr show-clear - shows a clear (×) button while a value is selected\n */\nexport class ComboboxInput extends HostElement {\n static override identity = \"combobox-input\";\n static override slotName = \"input-group\";\n static override role = \"group\";\n\n static override properties: PropertyDeclarations = {\n placeholder: { type: String },\n showTrigger: { attribute: \"show-trigger\", converter: trueUnlessFalse },\n showClear: { type: Boolean, attribute: \"show-clear\" },\n };\n declare placeholder: string;\n declare showTrigger: boolean;\n declare showClear: boolean;\n\n protected readonly inputId = uid(\"combobox-input\");\n\n constructor() {\n super();\n this.placeholder = \"\";\n this.showTrigger = true;\n this.showClear = false;\n }\n\n get root(): Combobox | null {\n return this.closest(ROOT);\n }\n get control(): HTMLInputElement | null {\n return this.querySelector(\":scope > input\");\n }\n\n override focus(options?: FocusOptions): void {\n this.control?.focus(options);\n }\n\n protected override updated(): void {\n this.root?.wire();\n }\n\n protected onInput = (e: Event) => this.root?.handleQuery((e.target as HTMLInputElement).value);\n protected onKeyDown = (e: KeyboardEvent) => this.root?.handleKey(e);\n protected onInputClick = () => {\n const root = this.root;\n if (root && !root.open) root.setOpen(true, \"trigger-press\");\n };\n protected onFocusOut = (e: FocusEvent) => {\n const root = this.root;\n const to = e.relatedTarget as Node | null;\n if (!root?.open) return;\n if (to && (this.contains(to) || root.contentElement?.contains(to))) return;\n root.setOpen(false, \"focus-out\");\n };\n protected onTrigger = () => {\n const root = this.root;\n if (!root) return;\n root.query = \"\";\n root.toggle(\"trigger-press\");\n this.control?.focus();\n };\n protected onClear = () => {\n const root = this.root;\n if (!root) return;\n root.select(null);\n this.control?.focus();\n };\n protected onAddonClick = (e: MouseEvent) => {\n // InputGroupAddon: clicks on the addon (not its buttons) focus the input.\n if (!(e.target as Element).closest(\"button\")) this.control?.focus();\n };\n\n override render() {\n const root = this.root;\n const disabled = !!root?.isDisabled;\n const hasValue = !!root?.value;\n return html`<input\n id=${this.inputId}\n data-pont2-combobox-input-control\n data-slot=\"input-group-control\"\n type=\"text\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autocomplete=\"off\"\n placeholder=${this.placeholder || nothing}\n ?disabled=${disabled}\n aria-invalid=${root?.getAttribute(\"aria-invalid\") ?? nothing}\n @input=${this.onInput}\n @keydown=${this.onKeyDown}\n @click=${this.onInputClick}\n @focusout=${this.onFocusOut}\n /><div data-pont2-combobox-input-addon data-slot=\"input-group-addon\" data-align=\"inline-end\" role=\"group\" @click=${this.onAddonClick}>\n ${this.showTrigger && !(this.showClear && hasValue)\n ? html`<button\n type=\"button\"\n tabindex=\"-1\"\n data-pont2-button\n data-variant=\"ghost\"\n data-size=\"icon-xs\"\n data-slot=\"input-group-button\"\n data-combobox-trigger\n aria-label=\"Open\"\n ?disabled=${disabled}\n @mousedown=${(e: Event) => e.preventDefault()}\n @click=${this.onTrigger}\n >${icons.chevronDown()}</button>`\n : nothing}\n ${this.showClear && hasValue\n ? html`<button\n type=\"button\"\n data-pont2-button\n data-variant=\"ghost\"\n data-size=\"icon-xs\"\n data-slot=\"combobox-clear\"\n aria-label=\"Clear\"\n ?disabled=${disabled}\n @mousedown=${(e: Event) => e.preventDefault()}\n @click=${this.onClear}\n >${icons.x()}</button>`\n : nothing}\n </div>`;\n }\n}\n\n/* ==================================================================== */\n\n/**\n * shadcn `ComboboxChips` for a `multiple` combobox: the input box that holds a\n * chip per selected value and the text input after them. It **is** a\n * ComboboxInput (same input behaviour, same tokens), laid out as a wrapping\n * row.\n *\n * shadcn writes the chips with a render prop (`<ComboboxValue>{values =>\n * values.map(v => <ComboboxChip>…)}</ComboboxValue><ComboboxChipsInput/>`).\n * HTML has no render prop, so the host renders them from the root's\n * `values`, as parts with shadcn's slots:\n *\n * ```\n * shadcn: div[data-slot=combobox-chips] > div[data-slot=combobox-chip] (> button[data-slot=combobox-chip-remove])… + input[data-slot=combobox-chip-input]\n * pont2: pont2-prim-combobox-chips > div[data-slot=combobox-chip] (> button[data-slot=combobox-chip-remove])… + input[data-slot=combobox-chip-input]\n * ```\n *\n * Keyboard (Base UI): Backspace in the empty input removes the last chip;\n * ArrowLeft moves to the chips, ArrowLeft / ArrowRight move between them,\n * Backspace / Delete remove the focused one, ArrowRight past the last\n * returns to the input. A locked chip (its item is `disabled`) has no remove\n * button and is skipped by removal.\n *\n * @tag pont2-prim-combobox-chips\n * @attr placeholder - shown while nothing is selected\n */\nexport class ComboboxChips extends ComboboxInput {\n static override identity = \"combobox-chips\";\n static override slotName = \"combobox-chips\";\n\n protected readonly messages = new MessagesController(this);\n\n override get control(): HTMLInputElement | null {\n return this.querySelector(\":scope > input\");\n }\n\n private get chipElements(): HTMLElement[] {\n return Array.from(this.querySelectorAll<HTMLElement>(\":scope > [data-slot=combobox-chip]\"));\n }\n\n /** Focus the chip at `index` (clamped); past the end focuses the input. */\n focusChip(index: number): void {\n const chips = this.chipElements;\n if (index >= chips.length) this.control?.focus();\n else chips[Math.max(0, index)]?.focus();\n }\n\n private onChipKeyDown(e: KeyboardEvent, value: string, index: number): void {\n const root = this.root;\n if (!root) return;\n if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n this.focusChip(index - 1);\n } else if (e.key === \"ArrowRight\") {\n e.preventDefault();\n this.focusChip(index + 1);\n } else if (e.key === \"Backspace\" || e.key === \"Delete\") {\n e.preventDefault();\n if (root.removeValue(value)) {\n void this.updateComplete.then(() => this.focusChip(e.key === \"Backspace\" ? index - 1 : index));\n }\n } else if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {\n this.control?.focus(); // typing goes to the input\n }\n }\n\n private onChipsClick = (e: MouseEvent) => {\n // A press on the box (not a chip or its button) focuses the input, as InputGroup does.\n if (e.target === this) this.control?.focus();\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"click\", this.onChipsClick);\n }\n\n override render() {\n const root = this.root;\n const disabled = !!root?.isDisabled;\n const values = root?.selectedValues ?? [];\n return html`${values.map((value, index) => {\n const label = root!.labelOf(value);\n const locked = root!.isLocked(value);\n return html`<div\n data-pont2-combobox-chip\n data-slot=\"combobox-chip\"\n data-value=${value}\n tabindex=\"-1\"\n ?data-locked=${locked}\n ?data-disabled=${disabled}\n @keydown=${(e: KeyboardEvent) => this.onChipKeyDown(e, value, index)}\n @mousedown=${(e: Event) => e.preventDefault()}\n >${label}${locked || disabled\n ? nothing\n : button(\n {\n variant: \"ghost\",\n size: \"icon-xs\",\n slot: \"combobox-chip-remove\",\n attrs: { tabindex: \"-1\", \"aria-label\": `${msg(\"action_remove\")} ${label}` },\n onClick: () => {\n root!.removeValue(value);\n this.control?.focus();\n },\n },\n icons.x(),\n )}</div>`;\n })}<input\n id=${this.inputId}\n data-pont2-combobox-chip-input\n data-slot=\"combobox-chip-input\"\n type=\"text\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autocomplete=\"off\"\n placeholder=${!values.length && this.placeholder ? this.placeholder : nothing}\n ?disabled=${disabled}\n aria-invalid=${root?.getAttribute(\"aria-invalid\") ?? nothing}\n @input=${this.onInput}\n @keydown=${this.onKeyDown}\n @click=${this.onInputClick}\n @focusout=${this.onFocusOut}\n />`;\n }\n}\n\n/* ==================================================================== */\n\n/**\n * The popup (Base UI `Combobox.Popup`, no role of its own: the list inside\n * is the listbox). Opens below the input, start-aligned, 6px away.\n *\n * @tag pont2-prim-combobox-content\n */\nexport class ComboboxContent extends PopupContent {\n static override identity = \"combobox-content\";\n static override slotName = \"combobox-content\";\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"start\";\n this.sideOffset = 6;\n // Keep focus in the input while the pointer interacts with the list.\n this.addEventListener(\"mousedown\", e => e.preventDefault());\n }\n}\n\n/** Base UI `Combobox.List` (`role=listbox`). @tag pont2-prim-combobox-list */\nexport class ComboboxList extends HostElement {\n static override identity = \"combobox-list\";\n static override slotName = \"combobox-list\";\n static override role = \"listbox\";\n}\n\n/**\n * Base UI `Combobox.Item` (`role=option`), host-as-root, never focused\n * (virtual focus). The check indicator is rendered after your content when\n * selected.\n *\n * @tag pont2-prim-combobox-item\n * @attr value, label, disabled\n */\nexport class ComboboxItem extends HostElement {\n static override identity = \"combobox-item\";\n static override slotName = \"combobox-item\";\n static override role = \"option\";\n\n static override properties: PropertyDeclarations = {\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n };\n declare value: string;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.value = \"\";\n this.disabled = false;\n this.addEventListener(\"pointermove\", e => {\n if (e.pointerType !== \"touch\" && !this.disabled) this.root?.highlight(this, false);\n });\n this.addEventListener(\"click\", () => {\n if (!this.disabled) this.root?.select(this);\n });\n }\n\n get root(): Combobox | null {\n return this.closest(ROOT);\n }\n get selected(): boolean {\n return !!this.root && this.root.isSelected(this.value);\n }\n get label(): string {\n if (this.hasAttribute(\"label\")) return this.getAttribute(\"label\")!;\n let t = \"\";\n for (const n of Array.from(this.childNodes)) {\n if (n instanceof Comment) continue; // lit-html part markers\n if (n instanceof Element && n.hasAttribute(\"data-pont2-combobox-item-indicator\")) continue;\n t += n.textContent ?? \"\";\n }\n return t.trim();\n }\n\n setHighlighted(on: boolean): void {\n this.setData(\"highlighted\", on);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n ensureId(this, \"combobox-item\");\n }\n\n protected override willUpdate(): void {\n const selected = this.selected;\n this.internals.ariaSelected = String(selected);\n this.internals.ariaDisabled = this.disabled ? \"true\" : null;\n this.setData(\"selected\", selected);\n this.setData(\"disabled\", this.disabled);\n }\n\n override render() {\n return this.selected\n ? html`<span data-pont2-combobox-item-indicator data-slot=\"combobox-item-indicator\">${icons.check()}</span>`\n : nothing;\n }\n}\n\n/** Base UI `Combobox.Empty`: shown only while no item matches. @tag pont2-prim-combobox-empty */\nexport class ComboboxEmpty extends HostElement {\n static override identity = \"combobox-empty\";\n static override slotName = \"combobox-empty\";\n override connectedCallback(): void {\n super.connectedCallback();\n // Announced politely when it appears (Base UI renders it with role=status).\n this.internals.role = \"status\";\n this.internals.ariaLive = \"polite\";\n }\n}\n\n/** Base UI `Combobox.Group`. @tag pont2-prim-combobox-group */\nexport class ComboboxGroup extends HostElement {\n static override identity = \"combobox-group\";\n static override slotName = \"combobox-group\";\n static override role = \"group\";\n override connectedCallback(): void {\n super.connectedCallback();\n queueMicrotask(() => {\n const label = this.querySelector(`:scope > ${sel(\"combobox-label\")}`);\n if (label && !this.hasAttribute(\"aria-labelledby\")) this.setAttribute(\"aria-labelledby\", ensureId(label, \"combobox-group-label\"));\n });\n }\n}\n\n/** Base UI `Combobox.GroupLabel`. @tag pont2-prim-combobox-label */\nexport class ComboboxLabel extends HostElement {\n static override identity = \"combobox-label\";\n static override slotName = \"combobox-label\";\n}\n\n/** Base UI `Combobox.Separator`; is-a Separator. @tag pont2-prim-combobox-separator */\nexport class ComboboxSeparator extends Separator {\n static override identity = \"combobox-separator\";\n static override slotName = \"combobox-separator\";\n}\n\ndefine(\"pont2-prim-combobox\", Combobox);\ndefine(\"pont2-prim-combobox-input\", ComboboxInput);\ndefine(\"pont2-prim-combobox-chips\", ComboboxChips);\ndefine(\"pont2-prim-combobox-content\", ComboboxContent);\ndefine(\"pont2-prim-combobox-list\", ComboboxList);\ndefine(\"pont2-prim-combobox-item\", ComboboxItem);\ndefine(\"pont2-prim-combobox-empty\", ComboboxEmpty);\ndefine(\"pont2-prim-combobox-group\", ComboboxGroup);\ndefine(\"pont2-prim-combobox-label\", ComboboxLabel);\ndefine(\"pont2-prim-combobox-separator\", ComboboxSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-combobox\": Combobox;\n \"pont2-prim-combobox-input\": ComboboxInput;\n \"pont2-prim-combobox-chips\": ComboboxChips;\n \"pont2-prim-combobox-content\": ComboboxContent;\n \"pont2-prim-combobox-list\": ComboboxList;\n \"pont2-prim-combobox-item\": ComboboxItem;\n \"pont2-prim-combobox-empty\": ComboboxEmpty;\n \"pont2-prim-combobox-group\": ComboboxGroup;\n \"pont2-prim-combobox-label\": ComboboxLabel;\n \"pont2-prim-combobox-separator\": ComboboxSeparator;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot, PopupTrigger } from \"../../core/popup/popup-root\";\n\nconst ROOT = sel(\"tooltip\");\n\n/**\n * # Tooltip\n *\n * shadcn: `<TooltipProvider delay={0}>` > `<Tooltip>` (Base UI `Tooltip.Root`,\n * renders nothing) > `<TooltipTrigger>` (a `<button>`) + `<TooltipContent>`\n * (Portal > Positioner > Popup > children + `<Tooltip.Arrow>`).\n *\n * pont2: no Provider (a per-root `delay`, default 0 like shadcn's provider);\n * the arrow is the content's `::before`, so the popup is one node.\n *\n * ```html\n * <pont2-prim-tooltip>\n * <pont2-prim-tooltip-trigger><button data-pont2-button data-variant=\"outline\">Hover</button></pont2-prim-tooltip-trigger>\n * <pont2-prim-tooltip-content>Add to library</pont2-prim-tooltip-content>\n * </pont2-prim-tooltip>\n * ```\n *\n * Opens on pointer hover and on keyboard focus; closes on leave, blur,\n * Escape or press. The trigger is described by the content\n * (`aria-describedby`) while it is open.\n *\n * @tag pont2-prim-tooltip\n * @attr delay - ms before opening on hover (default 0)\n * @attr close-delay - ms before closing (default 0)\n */\nexport class Tooltip extends PopupRoot {\n static override identity = \"tooltip\";\n\n static override properties: PropertyDeclarations = {\n delay: { type: Number },\n closeDelay: { type: Number, attribute: \"close-delay\" },\n };\n declare delay: number;\n declare closeDelay: number;\n\n private timer = 0;\n\n constructor() {\n super();\n this.delay = 0;\n this.closeDelay = 0;\n }\n\n get triggerElement(): HTMLElement | null {\n return ownQuery<TooltipTrigger>(this, tags(\"tooltip-trigger\"), ROOT)?.control ?? null;\n }\n get contentElement(): TooltipContent | null {\n return ownQuery<TooltipContent>(this, sel(\"tooltip-content\"), ROOT);\n }\n protected get popupKind() {\n return \"true\" as const;\n }\n\n /** A tooltip is not a popup the trigger \"has\": no aria-haspopup/expanded, just a description. */\n override wire(): void {\n const content = this.contentElement;\n const trigger = this.triggerElement;\n if (content) {\n ensureId(content, \"tooltip\");\n content.onRequestClose = reason => this.setOpen(false, reason);\n content.anchorElement = () => this.triggerElement;\n content.insideElements = () => [];\n }\n if (trigger && content) {\n const ids = new Set((trigger.getAttribute(\"aria-describedby\") ?? \"\").split(/\\s+/).filter(Boolean));\n if (this.open) ids.add(content.id);\n else ids.delete(content.id);\n if (ids.size) trigger.setAttribute(\"aria-describedby\", [...ids].join(\" \"));\n else trigger.removeAttribute(\"aria-describedby\");\n trigger.toggleAttribute(\"data-popup-open\", this.open);\n }\n }\n\n schedule(open: boolean, reason: \"trigger-hover\" | \"trigger-focus\" | \"focus-out\"): void {\n clearTimeout(this.timer);\n const ms = open ? this.delay : this.closeDelay;\n if (ms <= 0) this.setOpen(open, reason);\n else this.timer = window.setTimeout(() => this.setOpen(open, reason), ms);\n }\n\n // Focus stays where it is: a tooltip never takes focus.\n protected override afterClose(): void {}\n}\n\n/** @tag pont2-prim-tooltip-trigger */\nexport class TooltipTrigger extends PopupTrigger {\n static override rootTag = ROOT;\n static override controlSlot = \"tooltip-trigger\";\n\n constructor() {\n super();\n this.addEventListener(\"pointerenter\", e => {\n if (e.pointerType !== \"touch\") (this.root as Tooltip | null)?.schedule(true, \"trigger-hover\");\n });\n this.addEventListener(\"pointerleave\", () => (this.root as Tooltip | null)?.schedule(false, \"trigger-hover\"));\n this.addEventListener(\"focusin\", e => {\n if ((e.target as Element).matches(\":focus-visible\")) (this.root as Tooltip | null)?.schedule(true, \"trigger-focus\");\n });\n this.addEventListener(\"focusout\", () => (this.root as Tooltip | null)?.schedule(false, \"focus-out\"));\n }\n\n /** Pressing the trigger closes the tooltip (Base UI), it never toggles it open. */\n protected override onClick(): void {\n const root = this.root;\n if (root?.open) root.setOpen(false, \"trigger-press\");\n }\n}\n\n/**\n * The tooltip popup (`role=tooltip`), `side=\"top\"` by default.\n *\n * @tag pont2-prim-tooltip-content\n * @cssprop --pont2-tooltip-bg, --pont2-tooltip-fg, --pont2-tooltip-radius - see docs/11-tokens.md (the arrow shares the background)\n * @cssprop --pont2-tooltip-max-width, --pont2-tooltip-padding-x, --pont2-tooltip-padding-y - sizes (defaults 20rem, 0.75rem, 0.375rem)\n */\nexport class TooltipContent extends PopupContent {\n static override identity = \"tooltip-content\";\n static override slotName = \"tooltip-content\";\n static override role = \"tooltip\";\n\n constructor() {\n super();\n this.side = \"top\";\n this.align = \"center\";\n this.sideOffset = 4;\n }\n}\n\ndefine(\"pont2-prim-tooltip\", Tooltip);\ndefine(\"pont2-prim-tooltip-trigger\", TooltipTrigger);\ndefine(\"pont2-prim-tooltip-content\", TooltipContent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-tooltip\": Tooltip;\n \"pont2-prim-tooltip-trigger\": TooltipTrigger;\n \"pont2-prim-tooltip-content\": TooltipContent;\n }\n}\n\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { HostElement, NativeEnhancer } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { ensureId } from \"../../core/ids\";\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { initialFocusOf, inertOthers, lockScroll, trapFocus } from \"../../core/popup/modal\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot, PopupTrigger } from \"../../core/popup/popup-root\";\nimport { button } from \"../button/button\";\n\n/** Boolean attribute that defaults to true and is turned off with `=\"false\"`. */\nexport const trueUnlessFalse = { fromAttribute: (v: string | null) => v !== \"false\", toAttribute: (v: boolean) => String(v) };\n\n/** Every modal family's root, so a Close finds the dialog it sits in, whichever family. */\nconst MODAL_ROOTS = [\"dialog\", \"alert-dialog\", \"sheet\", \"drawer\"].map(sel).join(\", \");\n\n/* ==================================================================== */\n/* Shared bases: Dialog, AlertDialog, Sheet and Drawer are one machine */\n/* ==================================================================== */\n\n/**\n * # ModalRoot: the coordinator of a modal popup family\n *\n * Base UI's `Dialog.Root` / `AlertDialog.Root` / `Drawer.Root` render no\n * element; like every pont2 popup root this is a `display: contents`\n * coordinator (core/popup/popup-root.ts). On top of a popup root it adds what\n * Base UI's `modal` (default `true`) does, from core/popup/modal.ts:\n *\n * - everything outside the popup is `inert` (and so hidden from assistive tech);\n * - the page does not scroll;\n * - Tab and Shift+Tab cycle inside the popup;\n * - on open, focus moves to the `autofocus` element, else the first tabbable\n * element, else the popup; on close it returns to the element that had it\n * (normally the trigger).\n *\n * `modal=\"false\"` keeps the popup but drops all four (Base UI `modal={false}`).\n * Subclasses name their family (`static family`), which their trigger,\n * content and close are looked up by.\n */\nexport abstract class ModalRoot extends PopupRoot {\n static family = \"dialog\";\n\n static override properties: PropertyDeclarations = {\n modal: { converter: trueUnlessFalse },\n };\n declare modal: boolean;\n\n private release: (() => void)[] = [];\n private returnTo: HTMLElement | null = null;\n\n constructor() {\n super();\n this.modal = true;\n }\n\n protected get family(): string {\n return (this.constructor as typeof ModalRoot).family;\n }\n\n get triggerElement(): HTMLButtonElement | null {\n return ownQuery<ModalTrigger>(this, tags(`${this.family}-trigger`), sel(this.family))?.control ?? null;\n }\n get contentElement(): ModalContent | null {\n return ownQuery<ModalContent>(this, sel(`${this.family}-content`), sel(this.family));\n }\n protected get popupKind() {\n return \"dialog\" as const;\n }\n\n /** Whether a press outside the popup closes it (Base UI: yes for Dialog, no for AlertDialog). */\n protected get dismissOnOutsidePress(): boolean {\n return true;\n }\n\n override wire(): void {\n super.wire();\n const content = this.contentElement;\n if (!content) return;\n content.modal = this.modal;\n content.onRequestClose = reason => {\n if (reason === \"outside-press\" && !this.dismissOnOutsidePress) return;\n this.setOpen(false, reason);\n };\n }\n\n protected override afterOpen(): void {\n const content = this.contentElement;\n if (!content) return;\n const active = document.activeElement as HTMLElement | null;\n this.returnTo = active && active !== document.body && !content.contains(active) ? active : null;\n this.releaseModal();\n if (this.modal) this.release = [inertOthers([content]), lockScroll(), trapFocus(content)];\n // After the popup is shown (it is in the top layer and visible now).\n initialFocusOf(content).focus({ preventScroll: true });\n }\n\n /** Base UI `finalFocus`: back to the element that opened it, whatever closed it. */\n protected override afterClose(focusWasInside: boolean): void {\n this.releaseModal();\n const to = this.returnTo ?? this.triggerElement;\n this.returnTo = null;\n if (!to?.isConnected) return;\n if (this.modal || focusWasInside) to.focus({ preventScroll: true });\n }\n\n private releaseModal(): void {\n this.release.forEach(undo => undo());\n this.release = [];\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.releaseModal();\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.setData(\"modal\", this.modal ? false : \"false\");\n }\n}\n\n/** Tier 3 enhancer around a native `<button>` that toggles its modal root. */\nexport abstract class ModalTrigger extends PopupTrigger {}\n\n/**\n * # ModalContent: the modal popup itself\n *\n * shadcn renders `Portal > Overlay + Popup`. In pont2 the popup **is** the\n * content element, shown in the top layer with the Popover API (it is never\n * moved), and the overlay is its `::backdrop`: the same box (fixed, full\n * viewport, under the popup, above the page) with no element to write.\n *\n * It is labelled by its title and described by its description, has\n * `aria-modal` while modal, and renders shadcn's close button (an × in the\n * corner) after your content unless `show-close-button=\"false\"`.\n */\nexport abstract class ModalContent extends PopupContent {\n static override role = \"dialog\";\n /** The family this content belongs to (its title, description and close are named after it). */\n static family = \"dialog\";\n /** AlertDialog has no corner close button. */\n static closeButton = true;\n\n static override properties: PropertyDeclarations = {\n showCloseButton: { attribute: \"show-close-button\", converter: trueUnlessFalse },\n };\n declare showCloseButton: boolean;\n\n /** Set by the root. */\n modal = true;\n\n protected readonly messages = new MessagesController(this);\n\n constructor() {\n super();\n this.showCloseButton = true;\n }\n\n protected get family(): string {\n return (this.constructor as typeof ModalContent).family;\n }\n\n override get isModal(): boolean {\n return this.modal;\n }\n protected override get anchored(): boolean {\n return false;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"tabindex\")) this.tabIndex = -1;\n }\n\n override show(): void {\n const title = this.querySelector(`${sel(`${this.family}-title`)}, [data-slot=${this.family}-title]`);\n const desc = this.querySelector(`${sel(`${this.family}-description`)}, [data-slot=${this.family}-description]`);\n if (title && !this.hasAttribute(\"aria-labelledby\")) this.setAttribute(\"aria-labelledby\", ensureId(title, `${this.family}-title`));\n if (desc && !this.hasAttribute(\"aria-describedby\")) this.setAttribute(\"aria-describedby\", ensureId(desc, `${this.family}-desc`));\n this.internals.ariaModal = this.modal ? \"true\" : null;\n this.setData(\"modal\", this.modal ? false : \"false\");\n super.show();\n }\n\n protected closeButton(): unknown {\n const ctor = this.constructor as typeof ModalContent;\n if (!ctor.closeButton || !this.showCloseButton) return nothing;\n return button(\n {\n variant: \"ghost\",\n size: \"icon-sm\",\n slot: `${this.family}-close`,\n attrs: { \"data-pont2-modal-close\": true },\n onClick: () => this.requestClose(\"close-press\"),\n },\n html`${icons.x()}<span data-pont2-sr-only>${msg(\"action_close\")}</span>`,\n );\n }\n\n override render() {\n return this.closeButton();\n }\n}\n\n/** Tier 3 enhancer: the native `<button>` inside closes the modal it is in (Base UI `Close`). */\nexport abstract class ModalClose extends NativeEnhancer<HTMLButtonElement> {\n static override nativeSelector = \"button\";\n static controlSlot = \"dialog-close\";\n\n constructor() {\n super();\n this.addEventListener(\"click\", e => {\n const c = this.control;\n if (!c || c.disabled || !(c === e.target || c.contains(e.target as Node))) return;\n this.closest<ModalRoot>(MODAL_ROOTS)?.setOpen(false, \"close-press\");\n });\n }\n\n protected apply(control: HTMLButtonElement): void {\n const slot = (this.constructor as typeof ModalClose).controlSlot;\n if (!control.hasAttribute(\"data-slot\") || control.getAttribute(\"data-slot\") === \"button\") control.setAttribute(\"data-slot\", slot);\n if (!control.hasAttribute(\"type\")) control.type = \"button\";\n }\n}\n\n/** A modal's title: Base UI renders an `<h2>`, pont2 keeps the heading semantics through internals. */\nexport abstract class ModalTitle extends HostElement {\n static override role = \"heading\";\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.internals.ariaLevel) this.internals.ariaLevel = \"2\";\n }\n}\n\n/* ==================================================================== */\n/* Dialog */\n/* ==================================================================== */\n\n/**\n * # Dialog\n *\n * shadcn: `<Dialog>` (Base UI `Dialog.Root`, renders nothing) >\n * `<DialogTrigger>` (a `<button>`) + `<DialogContent>` (Portal > Overlay +\n * Popup > children + close button), with `DialogHeader/Footer/Title/\n * Description/Close`.\n *\n * pont2:\n * ```html\n * <pont2-prim-dialog> coordinator, display: contents\n * <pont2-prim-dialog-trigger><button data-pont2-button data-variant=\"outline\">Edit profile</button></pont2-prim-dialog-trigger>\n * <pont2-prim-dialog-content> the popup: [popover], role=dialog, ::backdrop = the overlay\n * <pont2-prim-dialog-header>\n * <pont2-prim-dialog-title>Edit profile</pont2-prim-dialog-title>\n * <pont2-prim-dialog-description>Make changes to your profile here.</pont2-prim-dialog-description>\n * </pont2-prim-dialog-header>\n * …\n * <pont2-prim-dialog-footer>\n * <pont2-prim-dialog-close><button data-pont2-button data-variant=\"outline\">Cancel</button></pont2-prim-dialog-close>\n * <button data-pont2-button type=\"submit\">Save changes</button>\n * </pont2-prim-dialog-footer>\n * </pont2-prim-dialog-content>\n * </pont2-prim-dialog>\n * ```\n *\n * @tag pont2-prim-dialog\n * @attr open - Open state (initially: Base UI `defaultOpen`; property: controlled `open`).\n * @attr modal - default true; `=\"false\"`: no inert page, scroll lock or focus trap.\n * @fires pont2-open-change - cancelable, `{ open, reason }` (reasons: trigger-press, escape-key, outside-press, close-press).\n */\nexport class Dialog extends ModalRoot {\n static override identity = \"dialog\";\n static override family = \"dialog\";\n}\n\n/** @tag pont2-prim-dialog-trigger */\nexport class DialogTrigger extends ModalTrigger {\n static override rootTag = sel(\"dialog\");\n static override controlSlot = \"dialog-trigger\";\n}\n\n/**\n * The dialog popup, centred, with the overlay as its `::backdrop`.\n *\n * @tag pont2-prim-dialog-content\n * @attr show-close-button - default true; `=\"false\"` hides the × button.\n * @cssprop --pont2-dialog-bg, --pont2-dialog-fg, --pont2-dialog-border-color, --pont2-dialog-radius, --pont2-dialog-shadow - see docs/11-tokens.md\n * @cssprop --pont2-dialog-max-width, --pont2-dialog-padding-x, --pont2-dialog-padding-y, --pont2-dialog-gap - sizes\n * @cssprop --pont2-dialog-overlay-bg - the overlay colour\n */\nexport class DialogContent extends ModalContent {\n static override identity = \"dialog-content\";\n static override slotName = \"dialog-content\";\n static override family = \"dialog\";\n}\n\n/** @tag pont2-prim-dialog-header */\nexport class DialogHeader extends HostElement {\n static override identity = \"dialog-header\";\n static override slotName = \"dialog-header\";\n}\n\n/**\n * @tag pont2-prim-dialog-footer\n * @attr show-close-button - renders shadcn's outline \"Close\" button after your content (default false).\n */\nexport class DialogFooter extends HostElement {\n static override identity = \"dialog-footer\";\n static override slotName = \"dialog-footer\";\n\n static override properties: PropertyDeclarations = {\n showCloseButton: { type: Boolean, attribute: \"show-close-button\" },\n };\n declare showCloseButton: boolean;\n\n protected readonly messages = new MessagesController(this);\n\n constructor() {\n super();\n this.showCloseButton = false;\n }\n\n override render() {\n if (!this.showCloseButton) return nothing;\n return button(\n {\n variant: \"outline\",\n slot: \"dialog-close\",\n onClick: () => this.closest<ModalRoot>(MODAL_ROOTS)?.setOpen(false, \"close-press\"),\n },\n msg(\"action_close\"),\n );\n }\n}\n\n/** @tag pont2-prim-dialog-title */\nexport class DialogTitle extends ModalTitle {\n static override identity = \"dialog-title\";\n static override slotName = \"dialog-title\";\n}\n\n/** @tag pont2-prim-dialog-description */\nexport class DialogDescription extends HostElement {\n static override identity = \"dialog-description\";\n static override slotName = \"dialog-description\";\n}\n\n/** @tag pont2-prim-dialog-close */\nexport class DialogClose extends ModalClose {\n static override controlSlot = \"dialog-close\";\n}\n\ndefine(\"pont2-prim-dialog\", Dialog);\ndefine(\"pont2-prim-dialog-trigger\", DialogTrigger);\ndefine(\"pont2-prim-dialog-content\", DialogContent);\ndefine(\"pont2-prim-dialog-header\", DialogHeader);\ndefine(\"pont2-prim-dialog-footer\", DialogFooter);\ndefine(\"pont2-prim-dialog-title\", DialogTitle);\ndefine(\"pont2-prim-dialog-description\", DialogDescription);\ndefine(\"pont2-prim-dialog-close\", DialogClose);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-dialog\": Dialog;\n \"pont2-prim-dialog-trigger\": DialogTrigger;\n \"pont2-prim-dialog-content\": DialogContent;\n \"pont2-prim-dialog-header\": DialogHeader;\n \"pont2-prim-dialog-footer\": DialogFooter;\n \"pont2-prim-dialog-title\": DialogTitle;\n \"pont2-prim-dialog-description\": DialogDescription;\n \"pont2-prim-dialog-close\": DialogClose;\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define, sel } from \"../../core/names\";\nimport { Pont2Button } from \"../button/button\";\nimport { ModalContent, ModalRoot, ModalTitle, ModalTrigger } from \"../dialog/dialog\";\n\n/**\n * # AlertDialog\n *\n * shadcn: `<AlertDialog>` (Base UI `AlertDialog.Root`) > `<AlertDialogTrigger>`\n * + `<AlertDialogContent size>` (Portal > Overlay + Popup) with\n * `AlertDialogHeader/Media/Title/Description/Footer/Action/Cancel`.\n *\n * A Dialog (dialog.ts) that interrupts: `role=alertdialog`, always modal, and\n * **a press outside does not close it** (Base UI). Escape and Cancel do.\n * `AlertDialogAction` is a plain button (shadcn's is a `<Button>`, not a\n * Close): the app decides when the dialog closes, so an action that can fail\n * keeps the dialog open to show the error.\n *\n * ```html\n * <pont2-prim-alert-dialog>\n * <pont2-prim-alert-dialog-trigger><button data-pont2-button data-variant=\"outline\">Remove member</button></pont2-prim-alert-dialog-trigger>\n * <pont2-prim-alert-dialog-content>\n * <pont2-prim-alert-dialog-header>\n * <pont2-prim-alert-dialog-title>Remove this member?</pont2-prim-alert-dialog-title>\n * <pont2-prim-alert-dialog-description>They lose access immediately.</pont2-prim-alert-dialog-description>\n * </pont2-prim-alert-dialog-header>\n * <pont2-prim-alert-dialog-footer>\n * <pont2-prim-alert-dialog-cancel><button>Cancel</button></pont2-prim-alert-dialog-cancel>\n * <pont2-prim-alert-dialog-action variant=\"destructive\"><button>Remove</button></pont2-prim-alert-dialog-action>\n * </pont2-prim-alert-dialog-footer>\n * </pont2-prim-alert-dialog-content>\n * </pont2-prim-alert-dialog>\n * ```\n *\n * @tag pont2-prim-alert-dialog\n * @attr open\n * @fires pont2-open-change - cancelable, `{ open, reason }`\n */\nexport class AlertDialog extends ModalRoot {\n static override identity = \"alert-dialog\";\n static override family = \"alert-dialog\";\n\n constructor() {\n super();\n this.modal = true;\n }\n\n protected override get dismissOnOutsidePress(): boolean {\n return false;\n }\n\n /** An alert dialog is always modal (Base UI has no `modal` prop on it). */\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.modal = true;\n }\n}\n\n/** @tag pont2-prim-alert-dialog-trigger */\nexport class AlertDialogTrigger extends ModalTrigger {\n static override rootTag = sel(\"alert-dialog\");\n static override controlSlot = \"alert-dialog-trigger\";\n}\n\n/**\n * The popup (`role=alertdialog`), no corner close button.\n *\n * @tag pont2-prim-alert-dialog-content\n * @attr size - default | sm\n * @cssprop --pont2-alert-dialog-bg, --pont2-alert-dialog-fg, --pont2-alert-dialog-border-color, --pont2-alert-dialog-radius - see docs/11-tokens.md\n * @cssprop --pont2-alert-dialog-max-width, --pont2-alert-dialog-sm-max-width, --pont2-alert-dialog-padding-x, --pont2-alert-dialog-padding-y, --pont2-alert-dialog-gap - sizes\n * @cssprop --pont2-alert-dialog-overlay-bg - the overlay colour\n */\nexport class AlertDialogContent extends ModalContent {\n static override identity = \"alert-dialog-content\";\n static override slotName = \"alert-dialog-content\";\n static override role = \"alertdialog\";\n static override family = \"alert-dialog\";\n static override closeButton = false;\n\n static override properties: PropertyDeclarations = {\n size: { type: String, reflect: true },\n };\n declare size: \"default\" | \"sm\";\n\n constructor() {\n super();\n this.size = \"default\";\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.setData(\"size\", this.size || \"default\");\n }\n}\n\n/** @tag pont2-prim-alert-dialog-header */\nexport class AlertDialogHeader extends HostElement {\n static override identity = \"alert-dialog-header\";\n static override slotName = \"alert-dialog-header\";\n}\n\n/** @tag pont2-prim-alert-dialog-footer */\nexport class AlertDialogFooter extends HostElement {\n static override identity = \"alert-dialog-footer\";\n static override slotName = \"alert-dialog-footer\";\n}\n\n/** An icon tile beside (default size) or above (sm) the title. @tag pont2-prim-alert-dialog-media */\nexport class AlertDialogMedia extends HostElement {\n static override identity = \"alert-dialog-media\";\n static override slotName = \"alert-dialog-media\";\n}\n\n/** @tag pont2-prim-alert-dialog-title */\nexport class AlertDialogTitle extends ModalTitle {\n static override identity = \"alert-dialog-title\";\n static override slotName = \"alert-dialog-title\";\n}\n\n/** @tag pont2-prim-alert-dialog-description */\nexport class AlertDialogDescription extends HostElement {\n static override identity = \"alert-dialog-description\";\n static override slotName = \"alert-dialog-description\";\n}\n\n/**\n * shadcn `AlertDialogAction`: a Button (the button enhancer, so `variant` and\n * `size` work) that does **not** close the dialog by itself. Listen for\n * `click`, do the work, then set `open = false`.\n *\n * @tag pont2-prim-alert-dialog-action\n * @attr variant, size, disabled - the Button's\n */\nexport class AlertDialogAction extends Pont2Button {\n protected override apply(control: HTMLButtonElement | HTMLAnchorElement): void {\n if (!control.hasAttribute(\"data-slot\")) control.setAttribute(\"data-slot\", \"alert-dialog-action\");\n super.apply(control);\n }\n}\n\n/**\n * shadcn `AlertDialogCancel`: Base UI `AlertDialog.Close` rendered as an\n * outline Button. Closes the dialog (`reason: \"close-press\"`).\n *\n * @tag pont2-prim-alert-dialog-cancel\n * @attr variant - default outline\n * @attr size\n */\nexport class AlertDialogCancel extends Pont2Button {\n constructor() {\n super();\n this.variant = \"outline\";\n this.addEventListener(\"click\", e => {\n const c = this.control;\n if (!c || this.disabled || !(c === e.target || c.contains(e.target as Node))) return;\n this.closest<AlertDialog>(sel(\"alert-dialog\"))?.setOpen(false, \"close-press\");\n });\n }\n\n protected override apply(control: HTMLButtonElement | HTMLAnchorElement): void {\n if (!control.hasAttribute(\"data-slot\")) control.setAttribute(\"data-slot\", \"alert-dialog-cancel\");\n if (control instanceof HTMLButtonElement && !control.hasAttribute(\"type\")) control.type = \"button\";\n super.apply(control);\n }\n}\n\ndefine(\"pont2-prim-alert-dialog\", AlertDialog);\ndefine(\"pont2-prim-alert-dialog-trigger\", AlertDialogTrigger);\ndefine(\"pont2-prim-alert-dialog-content\", AlertDialogContent);\ndefine(\"pont2-prim-alert-dialog-header\", AlertDialogHeader);\ndefine(\"pont2-prim-alert-dialog-footer\", AlertDialogFooter);\ndefine(\"pont2-prim-alert-dialog-media\", AlertDialogMedia);\ndefine(\"pont2-prim-alert-dialog-title\", AlertDialogTitle);\ndefine(\"pont2-prim-alert-dialog-description\", AlertDialogDescription);\ndefine(\"pont2-prim-alert-dialog-action\", AlertDialogAction);\ndefine(\"pont2-prim-alert-dialog-cancel\", AlertDialogCancel);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-alert-dialog\": AlertDialog;\n \"pont2-prim-alert-dialog-trigger\": AlertDialogTrigger;\n \"pont2-prim-alert-dialog-content\": AlertDialogContent;\n \"pont2-prim-alert-dialog-header\": AlertDialogHeader;\n \"pont2-prim-alert-dialog-footer\": AlertDialogFooter;\n \"pont2-prim-alert-dialog-media\": AlertDialogMedia;\n \"pont2-prim-alert-dialog-title\": AlertDialogTitle;\n \"pont2-prim-alert-dialog-description\": AlertDialogDescription;\n \"pont2-prim-alert-dialog-action\": AlertDialogAction;\n \"pont2-prim-alert-dialog-cancel\": AlertDialogCancel;\n }\n}\n","import type { PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define, sel } from \"../../core/names\";\nimport { ModalClose, ModalContent, ModalRoot, ModalTitle, ModalTrigger } from \"../dialog/dialog\";\n\nexport type SheetSide = \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/**\n * # Sheet\n *\n * shadcn: `<Sheet>` is Base UI's `Dialog.Root` again, with a popup that\n * slides in from one edge of the screen (`<SheetContent side>`). In pont2 it\n * is the Dialog machine (dialog.ts: modal, inert page, scroll lock, focus\n * trap, Escape and outside press close it) with the sheet's layout.\n *\n * ```html\n * <pont2-prim-sheet>\n * <pont2-prim-sheet-trigger><button data-pont2-button data-variant=\"outline\">Invite members</button></pont2-prim-sheet-trigger>\n * <pont2-prim-sheet-content side=\"right\">\n * <pont2-prim-sheet-header>\n * <pont2-prim-sheet-title>Invite members</pont2-prim-sheet-title>\n * <pont2-prim-sheet-description>They get an email with a link.</pont2-prim-sheet-description>\n * </pont2-prim-sheet-header>\n * …\n * <pont2-prim-sheet-footer>…</pont2-prim-sheet-footer>\n * </pont2-prim-sheet-content>\n * </pont2-prim-sheet>\n * ```\n *\n * @tag pont2-prim-sheet\n * @attr open, modal\n * @fires pont2-open-change - cancelable, `{ open, reason }`\n */\nexport class Sheet extends ModalRoot {\n static override identity = \"sheet\";\n static override family = \"sheet\";\n}\n\n/** @tag pont2-prim-sheet-trigger */\nexport class SheetTrigger extends ModalTrigger {\n static override rootTag = sel(\"sheet\");\n static override controlSlot = \"sheet-trigger\";\n}\n\n/**\n * The sliding panel.\n *\n * @tag pont2-prim-sheet-content\n * @attr side - right (default) | left | top | bottom\n * @attr show-close-button - default true\n * @cssprop --pont2-sheet-bg, --pont2-sheet-fg, --pont2-sheet-border-color, --pont2-sheet-shadow - see docs/11-tokens.md\n * @cssprop --pont2-sheet-width, --pont2-sheet-max-width - left/right sheets (defaults 75%, 24rem)\n * @cssprop --pont2-sheet-overlay-bg - the overlay colour\n */\nexport class SheetContent extends ModalContent {\n static override identity = \"sheet-content\";\n static override slotName = \"sheet-content\";\n static override family = \"sheet\";\n\n constructor() {\n super();\n this.side = \"right\";\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n const side = ([\"top\", \"right\", \"bottom\", \"left\"] as const).includes(this.side as SheetSide) ? this.side : \"right\";\n this.setData(\"side\", side);\n }\n}\n\n/** @tag pont2-prim-sheet-header */\nexport class SheetHeader extends HostElement {\n static override identity = \"sheet-header\";\n static override slotName = \"sheet-header\";\n}\n\n/** @tag pont2-prim-sheet-footer */\nexport class SheetFooter extends HostElement {\n static override identity = \"sheet-footer\";\n static override slotName = \"sheet-footer\";\n}\n\n/** @tag pont2-prim-sheet-title */\nexport class SheetTitle extends ModalTitle {\n static override identity = \"sheet-title\";\n static override slotName = \"sheet-title\";\n}\n\n/** @tag pont2-prim-sheet-description */\nexport class SheetDescription extends HostElement {\n static override identity = \"sheet-description\";\n static override slotName = \"sheet-description\";\n}\n\n/** @tag pont2-prim-sheet-close */\nexport class SheetClose extends ModalClose {\n static override controlSlot = \"sheet-close\";\n}\n\ndefine(\"pont2-prim-sheet\", Sheet);\ndefine(\"pont2-prim-sheet-trigger\", SheetTrigger);\ndefine(\"pont2-prim-sheet-content\", SheetContent);\ndefine(\"pont2-prim-sheet-header\", SheetHeader);\ndefine(\"pont2-prim-sheet-footer\", SheetFooter);\ndefine(\"pont2-prim-sheet-title\", SheetTitle);\ndefine(\"pont2-prim-sheet-description\", SheetDescription);\ndefine(\"pont2-prim-sheet-close\", SheetClose);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-sheet\": Sheet;\n \"pont2-prim-sheet-trigger\": SheetTrigger;\n \"pont2-prim-sheet-content\": SheetContent;\n \"pont2-prim-sheet-header\": SheetHeader;\n \"pont2-prim-sheet-footer\": SheetFooter;\n \"pont2-prim-sheet-title\": SheetTitle;\n \"pont2-prim-sheet-description\": SheetDescription;\n \"pont2-prim-sheet-close\": SheetClose;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define, sel } from \"../../core/names\";\nimport { ModalClose, ModalContent, ModalRoot, ModalTitle, ModalTrigger } from \"../dialog/dialog\";\n\nexport type DrawerSwipeDirection = \"down\" | \"up\" | \"left\" | \"right\";\nconst DIRECTIONS: readonly DrawerSwipeDirection[] = [\"down\", \"up\", \"left\", \"right\"];\n\n/**\n * # Drawer\n *\n * shadcn: `<Drawer swipeDirection showSwipeHandle>` (Base UI `Drawer.Root`) >\n * `<DrawerTrigger>` + `<DrawerContent>` (Portal > Overlay + Viewport > Popup >\n * [swipe handle] + Content > children), with `DrawerHeader/Footer/Title/\n * Description/Close`.\n *\n * In pont2 the drawer is the Dialog machine (dialog.ts) docked to the edge it\n * is swiped towards (`swipe-direction`, default `down`: a bottom drawer). The\n * popup is the content element itself; Base UI's viewport and inner content\n * wrappers have no counterpart.\n *\n * **Not yet:** dragging to dismiss, snap points and nested-drawer stacking\n * (docs/primitives/drawer.md). Escape, the overlay, Close and the trigger\n * close it.\n *\n * ```html\n * <pont2-prim-drawer>\n * <pont2-prim-drawer-trigger><button data-pont2-button data-variant=\"outline\">Open</button></pont2-prim-drawer-trigger>\n * <pont2-prim-drawer-content>\n * <pont2-prim-drawer-header>\n * <pont2-prim-drawer-title>Move goal</pont2-prim-drawer-title>\n * <pont2-prim-drawer-description>Set your daily activity goal.</pont2-prim-drawer-description>\n * </pont2-prim-drawer-header>\n * <pont2-prim-drawer-footer>…</pont2-prim-drawer-footer>\n * </pont2-prim-drawer-content>\n * </pont2-prim-drawer>\n * ```\n *\n * @tag pont2-prim-drawer\n * @attr open, modal\n * @attr swipe-direction - down (default) | up | left | right: the edge the drawer is docked to\n * @attr show-swipe-handle - shows the grab handle\n * @fires pont2-open-change - cancelable, `{ open, reason }`\n */\nexport class Drawer extends ModalRoot {\n static override identity = \"drawer\";\n static override family = \"drawer\";\n\n static override properties: PropertyDeclarations = {\n swipeDirection: { type: String, attribute: \"swipe-direction\" },\n showSwipeHandle: { type: Boolean, attribute: \"show-swipe-handle\" },\n };\n declare swipeDirection: DrawerSwipeDirection;\n declare showSwipeHandle: boolean;\n\n constructor() {\n super();\n this.swipeDirection = \"down\";\n this.showSwipeHandle = false;\n }\n\n override wire(): void {\n super.wire();\n const content = this.contentElement as DrawerContent | null;\n if (!content) return;\n const direction = DIRECTIONS.includes(this.swipeDirection) ? this.swipeDirection : \"down\";\n if (content.swipeDirection !== direction) content.swipeDirection = direction;\n if (content.showSwipeHandle !== this.showSwipeHandle) content.showSwipeHandle = this.showSwipeHandle;\n }\n}\n\n/** @tag pont2-prim-drawer-trigger */\nexport class DrawerTrigger extends ModalTrigger {\n static override rootTag = sel(\"drawer\");\n static override controlSlot = \"drawer-trigger\";\n}\n\n/**\n * The drawer popup (shadcn's `drawer-popup`; its inner `drawer-content`\n * wrapper is this same element). Carries `data-swipe-direction` and\n * `data-swipe-axis` from the root.\n *\n * @tag pont2-prim-drawer-content\n * @cssprop --pont2-drawer-bg, --pont2-drawer-fg, --pont2-drawer-border-color, --pont2-drawer-radius - see docs/11-tokens.md\n * @cssprop --pont2-drawer-width, --pont2-drawer-max-height - left/right width (75%, 24rem from sm) and up/down height cap\n * @cssprop --pont2-drawer-overlay-bg - the overlay colour\n */\nexport class DrawerContent extends ModalContent {\n static override identity = \"drawer-content\";\n static override slotName = \"drawer-popup\";\n static override family = \"drawer\";\n static override closeButton = false;\n\n static override properties: PropertyDeclarations = {\n swipeDirection: { state: true },\n showSwipeHandle: { state: true },\n };\n declare swipeDirection: DrawerSwipeDirection;\n declare showSwipeHandle: boolean;\n\n constructor() {\n super();\n this.swipeDirection = \"down\";\n this.showSwipeHandle = false;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.setData(\"swipe-direction\", this.swipeDirection);\n this.setData(\"swipe-axis\", this.swipeDirection === \"left\" || this.swipeDirection === \"right\" ? \"x\" : \"y\");\n }\n\n override render() {\n return this.showSwipeHandle\n ? html`<div data-pont2-drawer-swipe-handle data-slot=\"drawer-swipe-handle\" aria-hidden=\"true\"></div>`\n : nothing;\n }\n}\n\n/** @tag pont2-prim-drawer-header */\nexport class DrawerHeader extends HostElement {\n static override identity = \"drawer-header\";\n static override slotName = \"drawer-header\";\n}\n\n/** @tag pont2-prim-drawer-footer */\nexport class DrawerFooter extends HostElement {\n static override identity = \"drawer-footer\";\n static override slotName = \"drawer-footer\";\n}\n\n/** @tag pont2-prim-drawer-title */\nexport class DrawerTitle extends ModalTitle {\n static override identity = \"drawer-title\";\n static override slotName = \"drawer-title\";\n}\n\n/** @tag pont2-prim-drawer-description */\nexport class DrawerDescription extends HostElement {\n static override identity = \"drawer-description\";\n static override slotName = \"drawer-description\";\n}\n\n/** @tag pont2-prim-drawer-close */\nexport class DrawerClose extends ModalClose {\n static override controlSlot = \"drawer-close\";\n}\n\ndefine(\"pont2-prim-drawer\", Drawer);\ndefine(\"pont2-prim-drawer-trigger\", DrawerTrigger);\ndefine(\"pont2-prim-drawer-content\", DrawerContent);\ndefine(\"pont2-prim-drawer-header\", DrawerHeader);\ndefine(\"pont2-prim-drawer-footer\", DrawerFooter);\ndefine(\"pont2-prim-drawer-title\", DrawerTitle);\ndefine(\"pont2-prim-drawer-description\", DrawerDescription);\ndefine(\"pont2-prim-drawer-close\", DrawerClose);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-drawer\": Drawer;\n \"pont2-prim-drawer-trigger\": DrawerTrigger;\n \"pont2-prim-drawer-content\": DrawerContent;\n \"pont2-prim-drawer-header\": DrawerHeader;\n \"pont2-prim-drawer-footer\": DrawerFooter;\n \"pont2-prim-drawer-title\": DrawerTitle;\n \"pont2-prim-drawer-description\": DrawerDescription;\n \"pont2-prim-drawer-close\": DrawerClose;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { ensureId } from \"../../core/ids\";\nimport { define, sel, tags } from \"../../core/names\";\nimport { PopupContent } from \"../../core/popup/popup-content\";\nimport { ownQuery, PopupRoot, PopupTrigger } from \"../../core/popup/popup-root\";\n\nconst ROOT = sel(\"hover-card\");\n\ntype Reason = \"trigger-hover\" | \"trigger-focus\" | \"focus-out\";\n\n/**\n * # HoverCard (Base UI Preview Card)\n *\n * shadcn: `<HoverCard>` = Base UI `PreviewCard.Root` (renders nothing) >\n * `<HoverCardTrigger>` (an `<a>`) + `<HoverCardContent>` (Portal > Positioner\n * > Popup).\n *\n * ```html\n * <pont2-prim-hover-card>\n * <pont2-prim-hover-card-trigger><a href=\"https://github.com/nextjs\" data-pont2-button data-variant=\"link\">@nextjs</a></pont2-prim-hover-card-trigger>\n * <pont2-prim-hover-card-content>The React Framework – created and maintained by @vercel.</pont2-prim-hover-card-content>\n * </pont2-prim-hover-card>\n * ```\n *\n * A preview of what the trigger points at, for sighted pointer users: it\n * opens after `delay` when the pointer rests on the trigger (or the trigger\n * gets keyboard focus), stays open while the pointer is over the trigger or\n * the card, and closes `close-delay` after it leaves both, on Escape, on a\n * press outside, or when focus leaves. Like Base UI's, it is not announced\n * and takes no focus: put nothing in it that is only there.\n *\n * @tag pont2-prim-hover-card\n * @attr delay - ms before opening (default 600, Base UI's)\n * @attr close-delay - ms before closing (default 300)\n * @fires pont2-open-change - cancelable `{ open, reason }`\n */\nexport class HoverCard extends PopupRoot {\n static override identity = \"hover-card\";\n\n static override properties: PropertyDeclarations = {\n delay: { type: Number },\n closeDelay: { type: Number, attribute: \"close-delay\" },\n };\n declare delay: number;\n declare closeDelay: number;\n\n private timer = 0;\n\n constructor() {\n super();\n this.delay = 600;\n this.closeDelay = 300;\n }\n\n get triggerElement(): HTMLElement | null {\n return ownQuery<HoverCardTrigger>(this, tags(\"hover-card-trigger\"), ROOT)?.control ?? null;\n }\n get contentElement(): HoverCardContent | null {\n return ownQuery<HoverCardContent>(this, sel(\"hover-card-content\"), ROOT);\n }\n protected get popupKind() {\n return \"true\" as const;\n }\n\n /** A preview card is not a popup the trigger \"has\": no aria-haspopup / aria-expanded (Base UI). */\n override wire(): void {\n const content = this.contentElement;\n const trigger = this.triggerElement;\n if (content) {\n ensureId(content, \"hover-card\");\n content.onRequestClose = reason => this.setOpen(false, reason);\n content.anchorElement = () => this.triggerElement;\n content.insideElements = () => [this.triggerElement];\n }\n trigger?.toggleAttribute(\"data-popup-open\", this.open);\n }\n\n /** Open or close after the delay; a later call replaces a pending one. */\n schedule(open: boolean, reason: Reason): void {\n clearTimeout(this.timer);\n const ms = open ? this.delay : this.closeDelay;\n if (open === this.open) return;\n if (ms <= 0) this.setOpen(open, reason);\n else this.timer = window.setTimeout(() => this.setOpen(open, reason), ms);\n }\n\n /** Keep the current state (the pointer moved between trigger and card). */\n cancelScheduled(): void {\n clearTimeout(this.timer);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearTimeout(this.timer);\n }\n\n // Focus stays where it is: a preview card never takes it.\n protected override afterClose(): void {}\n}\n\n/**\n * Tier 3 enhancer around the native `<a>` (Base UI renders a link) or `<button>`.\n *\n * @tag pont2-prim-hover-card-trigger\n */\nexport class HoverCardTrigger extends PopupTrigger {\n static override nativeSelector = \"a, button\";\n static override rootTag = ROOT;\n static override controlSlot = \"hover-card-trigger\";\n\n constructor() {\n super();\n const root = () => this.root as HoverCard | null;\n this.addEventListener(\"pointerenter\", e => {\n if (e.pointerType !== \"touch\") root()?.schedule(true, \"trigger-hover\");\n });\n this.addEventListener(\"pointerleave\", e => {\n if (e.pointerType !== \"touch\") root()?.schedule(false, \"trigger-hover\");\n });\n this.addEventListener(\"focusin\", e => {\n if ((e.target as Element).matches(\":focus-visible\")) root()?.schedule(true, \"trigger-focus\");\n });\n this.addEventListener(\"focusout\", () => root()?.schedule(false, \"focus-out\"));\n }\n\n protected override apply(control: HTMLButtonElement): void {\n const slot = (this.constructor as typeof HoverCardTrigger).controlSlot;\n if (!control.hasAttribute(\"data-slot\") || control.getAttribute(\"data-slot\") === \"button\") control.setAttribute(\"data-slot\", slot);\n if (control instanceof HTMLButtonElement && !control.hasAttribute(\"type\")) control.type = \"button\";\n (this.root as HoverCard | null)?.wire();\n }\n\n /** Activating the trigger follows the link; it never toggles the card (Base UI). */\n protected override onClick(): void {}\n}\n\n/**\n * The card. `side=\"bottom\"`, `side-offset` 4, `align=\"center\"`, `align-offset` 4 (shadcn).\n *\n * @tag pont2-prim-hover-card-content\n * @cssprop --pont2-hover-card-bg, --pont2-hover-card-fg, --pont2-hover-card-border-color, --pont2-hover-card-radius, --pont2-hover-card-shadow - see docs/11-tokens.md\n * @cssprop --pont2-hover-card-width, --pont2-hover-card-padding-x, --pont2-hover-card-padding-y - sizes (defaults 16rem, 1rem, 1rem)\n */\nexport class HoverCardContent extends PopupContent {\n static override identity = \"hover-card-content\";\n static override slotName = \"hover-card-content\";\n\n constructor() {\n super();\n this.side = \"bottom\";\n this.align = \"center\";\n this.sideOffset = 4;\n this.alignOffset = 4;\n const root = () => this.closest<HoverCard>(ROOT);\n this.addEventListener(\"pointerenter\", e => {\n if (e.pointerType !== \"touch\") root()?.cancelScheduled();\n });\n this.addEventListener(\"pointerleave\", e => {\n if (e.pointerType !== \"touch\") root()?.schedule(false, \"trigger-hover\");\n });\n }\n}\n\ndefine(\"pont2-prim-hover-card\", HoverCard);\ndefine(\"pont2-prim-hover-card-trigger\", HoverCardTrigger);\ndefine(\"pont2-prim-hover-card-content\", HoverCardContent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-hover-card\": HoverCard;\n \"pont2-prim-hover-card-trigger\": HoverCardTrigger;\n \"pont2-prim-hover-card-content\": HoverCardContent;\n }\n}\n","/**\n * # The toast queue behind `toast()` (Sonner's `toast` function)\n *\n * Page-wide, like Sonner's: `toast(\"Saved\")` anywhere reaches every mounted\n * `<pont2-prim-toaster>`. The queue holds data only (no DOM, no timers), so it\n * is unit-tested (toast-store.test.ts); the toaster renders it and runs the\n * auto-dismiss timers.\n */\n\nexport type ToastType = \"default\" | \"success\" | \"info\" | \"warning\" | \"error\" | \"loading\";\n\nexport interface ToastAction {\n label: string;\n onClick: (event: MouseEvent) => void;\n}\n\nexport interface ToastOptions {\n /** Reuse an id to update a toast in place (e.g. loading → success). */\n id?: string | number;\n description?: string;\n type?: ToastType;\n /** ms before it closes itself; `Infinity` keeps it. Default: the toaster's `duration` (loading: Infinity). */\n duration?: number;\n /** A button in the toast; pressing it runs `onClick` and closes the toast unless the handler calls `preventDefault()`. */\n action?: ToastAction;\n /** A secondary, outline button that closes the toast. */\n cancel?: ToastAction;\n /** Show the × button on this toast (also a toaster-wide attribute). */\n closeButton?: boolean;\n /** Whether a press of × or a timeout may close it (default true). */\n dismissible?: boolean;\n onDismiss?: (toast: ToastData) => void;\n onAutoClose?: (toast: ToastData) => void;\n}\n\nexport interface ToastData extends ToastOptions {\n id: string | number;\n title: string;\n type: ToastType;\n /** Set when the toast is leaving (its exit animation runs before it is removed). */\n dismissed?: boolean;\n /** Increases on every update, so a toaster restarts the timer. */\n version: number;\n createdAt: number;\n}\n\ntype Listener = (toasts: readonly ToastData[]) => void;\n\nexport class ToastStore {\n private toasts: ToastData[] = [];\n private listeners = new Set<Listener>();\n private counter = 0;\n\n get all(): readonly ToastData[] {\n return this.toasts;\n }\n\n subscribe(listener: Listener): () => void {\n this.listeners.add(listener);\n listener(this.toasts);\n return () => this.listeners.delete(listener);\n }\n\n private emit(): void {\n const snapshot = [...this.toasts];\n this.listeners.forEach(l => l(snapshot));\n }\n\n /** Adds a toast, or updates the one with the same `id`. Returns the id. */\n add(title: string, options: ToastOptions = {}): string | number {\n const id = options.id ?? ++this.counter;\n const existing = this.toasts.find(t => t.id === id);\n const type = options.type ?? existing?.type ?? \"default\";\n if (existing) {\n const next: ToastData = { ...existing, ...options, id, title, type, dismissed: false, version: existing.version + 1 };\n // An update that no longer says \"loading\" falls back to the toaster's duration.\n if (options.type && options.type !== \"loading\" && options.duration === undefined && existing.type === \"loading\") {\n delete next.duration;\n }\n this.toasts = this.toasts.map(t => (t.id === id ? next : t));\n } else {\n this.toasts = [...this.toasts, { ...options, id, title, type, version: 0, createdAt: Date.now() }];\n }\n this.emit();\n return id;\n }\n\n /** Starts closing one toast (or all): it is marked `dismissed`, then `remove()`d by the toaster. */\n dismiss(id?: string | number): void {\n let changed = false;\n this.toasts = this.toasts.map(t => {\n if ((id === undefined || t.id === id) && !t.dismissed) {\n changed = true;\n return { ...t, dismissed: true };\n }\n return t;\n });\n if (changed) this.emit();\n }\n\n /** Drops a toast for good (after its exit animation). */\n remove(id: string | number): void {\n const before = this.toasts.length;\n this.toasts = this.toasts.filter(t => t.id !== id);\n if (this.toasts.length !== before) this.emit();\n }\n\n /** Forgets every toast. For tests and stories. */\n clear(): void {\n this.toasts = [];\n this.emit();\n }\n}\n\n/** The page's queue. */\nexport const toasts = new ToastStore();\n\ntype Typed = (title: string, options?: Omit<ToastOptions, \"type\">) => string | number;\n\n/**\n * Sonner's `toast()`: `toast(\"Event created\")`, `toast.success(…)`,\n * `toast.error(…)`, `toast.info(…)`, `toast.warning(…)`, `toast.loading(…)`,\n * `toast.dismiss(id?)`, `toast.promise(p, { loading, success, error })`.\n */\nexport const toast = Object.assign((title: string, options?: ToastOptions) => toasts.add(title, options), {\n success: ((t, o) => toasts.add(t, { ...o, type: \"success\" })) as Typed,\n info: ((t, o) => toasts.add(t, { ...o, type: \"info\" })) as Typed,\n warning: ((t, o) => toasts.add(t, { ...o, type: \"warning\" })) as Typed,\n error: ((t, o) => toasts.add(t, { ...o, type: \"error\" })) as Typed,\n loading: ((t, o) => toasts.add(t, { ...o, type: \"loading\" })) as Typed,\n dismiss: (id?: string | number) => toasts.dismiss(id),\n /** One toast that says \"loading\", then success or error, as Sonner's `toast.promise`. */\n promise<T>(\n promise: Promise<T>,\n messages: { loading: string; success: string | ((value: T) => string); error: string | ((error: unknown) => string) },\n options: Omit<ToastOptions, \"type\" | \"id\"> = {},\n ): string | number {\n const id = toasts.add(messages.loading, { ...options, type: \"loading\" });\n promise.then(\n value => toasts.add(typeof messages.success === \"function\" ? messages.success(value) : messages.success, { ...options, id, type: \"success\" }),\n error => toasts.add(typeof messages.error === \"function\" ? messages.error(error) : messages.error, { ...options, id, type: \"error\" }),\n );\n return id;\n },\n});\n","import { html, nothing, type PropertyDeclarations, type PropertyValues, type TemplateResult } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { toasts, type ToastData, type ToastType } from \"./toast-store\";\n\nexport { toast, toasts, ToastStore, type ToastAction, type ToastData, type ToastOptions, type ToastType } from \"./toast-store\";\n\nexport type ToasterPosition = \"top-left\" | \"top-center\" | \"top-right\" | \"bottom-left\" | \"bottom-center\" | \"bottom-right\";\nconst POSITIONS: readonly ToasterPosition[] = [\"top-left\", \"top-center\", \"top-right\", \"bottom-left\", \"bottom-center\", \"bottom-right\"];\n\n/** How long a toast's exit animation runs before it is removed (Sonner's TIME_BEFORE_UNMOUNT). */\nconst EXIT_MS = 200;\n\n/** shadcn's Toaster icons (lucide). */\nconst TYPE_ICON: Partial<Record<ToastType, () => TemplateResult>> = {\n success: () => icons.circleCheck(),\n info: () => icons.info(),\n warning: () => icons.triangleAlert(),\n error: () => icons.octagonX(),\n loading: () => icons.loaderCircle({ \"data-spin\": true }),\n};\n\n/**\n * # Toaster (shadcn's Sonner)\n *\n * shadcn: `<Toaster />` (`components/ui/sonner.tsx`, Sonner themed with the\n * popover colours and lucide icons) + `toast()` from `sonner`.\n *\n * pont2: `<pont2-prim-toaster>` once per page, and `toast()` exported from\n * pont2 (toast-store.ts), with Sonner's API:\n *\n * ```html\n * <pont2-prim-toaster></pont2-prim-toaster>\n * <script type=\"module\">\n * import { toast } from \"@pontive/pontkit-core/pont2\";\n * toast.success(\"Invitation sent\", { description: \"ann@example.com\" });\n * const id = toast.loading(\"Saving…\"); toast.success(\"Saved\", { id });\n * toast.error(\"We couldn't remove this member.\", { action: { label: \"Retry\", onClick: retry } });\n * </script>\n * ```\n *\n * The host **is** Sonner's `<section aria-label=\"Notifications alt+T\">`\n * (`role=region`), holding the `<ol>` of toasts. It shows itself in the top\n * layer (Popover API) while it has toasts, so toasts sit above dialogs, and\n * a modal dialog leaves it interactive (core/popup/modal.ts exempts it).\n *\n * - Toasts close after `duration` (loading toasts stay until updated);\n * hovering or focusing the toaster pauses every timer, as does a hidden tab.\n * - Alt+T moves focus to the toaster (Sonner's hotkey); Escape there\n * dismisses the focused toast.\n * - Toasts are announced politely (`aria-live=\"polite\"` on the list).\n * - The newest `visible-toasts` (default 3) show.\n *\n * Not yet: Sonner's collapsed stack (toasts here are always listed, Sonner's\n * `expand`), swipe to dismiss, `richColors`, custom JSX toasts.\n *\n * @tag pont2-prim-toaster\n * @attr position - bottom-right (default) | bottom-left | bottom-center | top-right | top-left | top-center\n * @attr duration - ms before a toast closes itself (default 4000)\n * @attr visible-toasts - how many show at once (default 3)\n * @attr close-button - show the × button on every toast\n * @cssprop --pont2-toast-bg, --pont2-toast-fg, --pont2-toast-border-color, --pont2-toast-radius, --pont2-toast-shadow, --pont2-toast-width - see docs/11-tokens.md\n */\nexport class Toaster extends HostElement {\n static override identity = \"toaster\";\n static override slotName = \"toaster\";\n static override role = \"region\";\n\n static override properties: PropertyDeclarations = {\n position: { type: String, reflect: true },\n duration: { type: Number },\n visibleToasts: { type: Number, attribute: \"visible-toasts\" },\n closeButton: { type: Boolean, attribute: \"close-button\" },\n items: { state: true },\n };\n declare position: ToasterPosition;\n declare duration: number;\n declare visibleToasts: number;\n declare closeButton: boolean;\n declare protected items: readonly ToastData[];\n\n protected readonly messages = new MessagesController(this);\n\n private unsubscribe?: () => void;\n /** Per toast: the timer, when it started and how long was left. */\n private timers = new Map<string | number, { handle?: number; started: number; remaining: number; version: number }>();\n private removing = new Set<string | number>();\n private paused = false;\n private hovered = false;\n private focusedWithin = false;\n\n constructor() {\n super();\n this.position = \"bottom-right\";\n this.duration = 4000;\n this.visibleToasts = 3;\n this.closeButton = false;\n this.items = [];\n this.addEventListener(\"pointerenter\", () => {\n this.hovered = true;\n this.syncPause();\n });\n this.addEventListener(\"pointerleave\", () => {\n this.hovered = false;\n this.syncPause();\n });\n this.addEventListener(\"focusin\", () => {\n this.focusedWithin = true;\n this.syncPause();\n });\n this.addEventListener(\"focusout\", e => {\n if (!this.contains(e.relatedTarget as Node | null)) {\n this.focusedWithin = false;\n this.syncPause();\n }\n });\n this.addEventListener(\"keydown\", e => {\n if (e.key !== \"Escape\") return;\n const li = (e.target as Element).closest<HTMLElement>(\"[data-sonner-toast]\");\n const item = li && this.items.find(t => String(t.id) === li.dataset.id);\n if (item && item.dismissible !== false) {\n e.preventDefault();\n this.dismiss(item);\n }\n });\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"popover\")) this.setAttribute(\"popover\", \"manual\");\n this.internals.ariaLabel = `${msg(\"notifications\")} alt+T`;\n if (!this.hasAttribute(\"tabindex\")) this.tabIndex = -1;\n document.addEventListener(\"keydown\", this.onHotkey);\n document.addEventListener(\"visibilitychange\", this.onVisibility);\n this.unsubscribe = toasts.subscribe(list => (this.items = list));\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"keydown\", this.onHotkey);\n document.removeEventListener(\"visibilitychange\", this.onVisibility);\n this.unsubscribe?.();\n for (const t of this.timers.values()) clearTimeout(t.handle);\n this.timers.clear();\n }\n\n private onHotkey = (e: KeyboardEvent) => {\n if (e.altKey && e.code === \"KeyT\" && this.items.length) {\n e.preventDefault();\n (this.querySelector<HTMLElement>(\"[data-sonner-toast]:not([data-removed])\") ?? this).focus();\n }\n };\n\n private onVisibility = () => this.syncPause();\n\n private syncPause(): void {\n const pause = this.hovered || this.focusedWithin || document.visibilityState === \"hidden\";\n if (pause === this.paused) return;\n this.paused = pause;\n this.setData(\"paused\", pause);\n if (pause) {\n for (const t of this.timers.values()) {\n if (t.handle === undefined) continue;\n clearTimeout(t.handle);\n t.handle = undefined;\n t.remaining -= Date.now() - t.started;\n }\n } else {\n for (const [id, t] of this.timers) this.startTimer(id, t);\n }\n }\n\n private durationOf(t: ToastData): number {\n if (t.duration !== undefined) return t.duration;\n return t.type === \"loading\" ? Infinity : this.duration;\n }\n\n private startTimer(id: string | number, t: { handle?: number; started: number; remaining: number }): void {\n if (this.paused || !Number.isFinite(t.remaining)) return;\n t.started = Date.now();\n t.handle = window.setTimeout(() => {\n const item = this.items.find(x => x.id === id);\n if (!item) return;\n item.onAutoClose?.(item);\n toasts.dismiss(id);\n }, Math.max(0, t.remaining));\n }\n\n private dismiss(t: ToastData): void {\n t.onDismiss?.(t);\n toasts.dismiss(t.id);\n }\n\n /** The toasts shown: the newest `visible-toasts`, not counting those already leaving. */\n get shown(): ToastData[] {\n const live = this.items.filter(t => !t.dismissed);\n const max = Math.max(1, this.visibleToasts || 3);\n const keep = new Set(live.slice(-max).map(t => t.id));\n return this.items.filter(t => t.dismissed || keep.has(t.id)); // leaving toasts finish their exit\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"position\")) {\n const pos = POSITIONS.includes(this.position) ? this.position : \"bottom-right\";\n const [y, x] = pos.split(\"-\");\n this.setData(\"y-position\", y);\n this.setData(\"x-position\", x);\n }\n if (!changed.has(\"items\")) return;\n // Timers: start for new or updated toasts, drop for gone or dismissed ones.\n const live = new Set<string | number>();\n for (const t of this.items) {\n if (t.dismissed) {\n const timer = this.timers.get(t.id);\n if (timer) clearTimeout(timer.handle);\n this.timers.delete(t.id);\n if (!this.removing.has(t.id)) {\n this.removing.add(t.id);\n window.setTimeout(() => {\n this.removing.delete(t.id);\n toasts.remove(t.id);\n }, EXIT_MS);\n }\n continue;\n }\n live.add(t.id);\n const timer = this.timers.get(t.id);\n if (!timer || timer.version !== t.version) {\n if (timer) clearTimeout(timer.handle);\n const next = { started: Date.now(), remaining: this.durationOf(t), version: t.version };\n this.timers.set(t.id, next);\n this.startTimer(t.id, next);\n }\n }\n for (const [id, timer] of this.timers) {\n if (!live.has(id)) {\n clearTimeout(timer.handle);\n this.timers.delete(id);\n }\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n this.internals.ariaLabel = `${msg(\"notifications\")} alt+T`;\n if (!changed.has(\"items\")) return;\n const any = this.items.length > 0;\n const prev = (changed.get(\"items\") as readonly ToastData[] | undefined) ?? [];\n const added = this.items.some(t => !prev.some(p => p.id === t.id));\n try {\n if (!any && this.matches(\":popover-open\")) {\n this.hidePopover();\n // A hidden toaster gets no pointerleave / focusout: start the next toast unpaused.\n this.hovered = false;\n this.focusedWithin = false;\n this.syncPause();\n }\n else if (any && (!this.matches(\":popover-open\") || added)) {\n // Re-show on a new toast, so the toaster is above anything opened since (a dialog).\n if (this.matches(\":popover-open\")) this.hidePopover();\n this.showPopover();\n }\n } catch {\n /* not connected */\n }\n }\n\n private renderToast(t: ToastData): TemplateResult {\n const icon = TYPE_ICON[t.type];\n const close = (t.closeButton ?? this.closeButton) && t.dismissible !== false;\n return html`<li\n data-sonner-toast\n data-pont2-toast\n data-slot=\"toast\"\n data-id=${String(t.id)}\n data-type=${t.type}\n ?data-removed=${!!t.dismissed}\n tabindex=\"0\"\n aria-atomic=\"true\"\n role=${t.type === \"error\" || t.type === \"warning\" ? \"alert\" : \"status\"}\n >\n ${close\n ? html`<button\n type=\"button\"\n data-close-button\n aria-label=${msg(\"action_close\")}\n @click=${() => this.dismiss(t)}\n >${icons.x()}</button>`\n : nothing}\n ${icon ? html`<div data-icon>${icon()}</div>` : nothing}\n <div data-content>\n <div data-title>${t.title}</div>\n ${t.description ? html`<div data-description>${t.description}</div>` : nothing}\n </div>\n ${t.cancel\n ? html`<button\n type=\"button\"\n data-button\n data-cancel\n @click=${(e: MouseEvent) => {\n t.cancel!.onClick(e);\n this.dismiss(t);\n }}\n >${t.cancel.label}</button>`\n : nothing}\n ${t.action\n ? html`<button\n type=\"button\"\n data-button\n @click=${(e: MouseEvent) => {\n t.action!.onClick(e);\n if (!e.defaultPrevented) this.dismiss(t);\n }}\n >${t.action.label}</button>`\n : nothing}\n </li>`;\n }\n\n override render() {\n const list = this.shown;\n // Sonner lists the newest nearest the edge it is anchored to.\n const ordered = this.position.startsWith(\"top\") ? [...list].reverse() : list;\n return html`<ol data-sonner-toaster aria-live=\"polite\" aria-relevant=\"additions text\">\n ${repeat(ordered, t => t.id, t => this.renderToast(t))}\n </ol>`;\n }\n}\n\ndefine(\"pont2-prim-toaster\", Toaster);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-prim-toaster\": Toaster;\n }\n}\n","import { defineAlias } from \"../core/names\";\nimport { Badge } from \"../primitives/badge/badge\";\nimport { Pont2Button } from \"../primitives/button/button\";\nimport { Checkbox } from \"../primitives/checkbox/checkbox\";\nimport { Pont2Input } from \"../primitives/input/input\";\nimport { Kbd, KbdGroup } from \"../primitives/kbd/kbd\";\nimport { Pont2Label } from \"../primitives/label/label\";\nimport { NativeSelect } from \"../primitives/native-select/native-select\";\nimport { Separator } from \"../primitives/separator/separator\";\nimport { Skeleton } from \"../primitives/skeleton/skeleton\";\nimport { Slider } from \"../primitives/slider/slider\";\nimport { Spinner } from \"../primitives/spinner/spinner\";\nimport { Switch } from \"../primitives/switch/switch\";\nimport { Table } from \"../primitives/table/table\";\nimport { Pont2Textarea } from \"../primitives/textarea/textarea\";\n\n/**\n * # Kit aliases: primitives promoted to the kit surface unchanged\n *\n * Each line gives a primitive a second tag without the `prim` segment.\n * The alias is an empty subclass (see `defineAlias`), so it behaves, styles,\n * announces and submits exactly like the primitive.\n *\n * What may be aliased (docs/10-primitives-and-kit.md, \"Promotion rules\"):\n *\n * 1. **Whole families only.** Every tag a primitive folder defines is aliased\n * together, so kit markup never mixes `pont2-*` and `pont2-prim-*`.\n * 2. **Only families that can never get a same-name composite**, because\n * turning an alias into a composite later is a breaking change. In\n * practice: families with no structural children to abstract (a button,\n * an input, a switch). A family with title/description/item children\n * (Card, Field, Select…) stays primitive-only until it is decided whether\n * it gets a composite.\n * 3. The alias tag is listed in the primitive's CSS selectors, so it is\n * styled before upgrade like the primitive tag (guardrail-checked).\n */\ndefineAlias(\"pont2-badge\", Badge);\ndefineAlias(\"pont2-button\", Pont2Button);\ndefineAlias(\"pont2-checkbox\", Checkbox);\ndefineAlias(\"pont2-input\", Pont2Input);\ndefineAlias(\"pont2-kbd\", Kbd);\ndefineAlias(\"pont2-kbd-group\", KbdGroup);\ndefineAlias(\"pont2-label\", Pont2Label);\ndefineAlias(\"pont2-native-select\", NativeSelect);\ndefineAlias(\"pont2-separator\", Separator);\ndefineAlias(\"pont2-skeleton\", Skeleton);\ndefineAlias(\"pont2-slider\", Slider);\ndefineAlias(\"pont2-spinner\", Spinner);\ndefineAlias(\"pont2-switch\", Switch);\ndefineAlias(\"pont2-table\", Table);\ndefineAlias(\"pont2-textarea\", Pont2Textarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-badge\": Badge;\n \"pont2-button\": Pont2Button;\n \"pont2-checkbox\": Checkbox;\n \"pont2-input\": Pont2Input;\n \"pont2-kbd\": Kbd;\n \"pont2-kbd-group\": KbdGroup;\n \"pont2-label\": Pont2Label;\n \"pont2-native-select\": NativeSelect;\n \"pont2-separator\": Separator;\n \"pont2-skeleton\": Skeleton;\n \"pont2-slider\": Slider;\n \"pont2-spinner\": Spinner;\n \"pont2-switch\": Switch;\n \"pont2-table\": Table;\n \"pont2-textarea\": Pont2Textarea;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { Alert, AlertDescription, AlertTitle } from \"../../primitives/alert/alert\";\n\nexport const ALERT_STATUSES = [\"default\", \"error\", \"warning\", \"success\", \"info\"] as const;\nexport type AlertStatus = (typeof ALERT_STATUSES)[number];\n\nconst STATUS_ICON: Record<AlertStatus, () => TemplateResult> = {\n default: icons.circleAlert,\n error: icons.circleX,\n warning: icons.triangleAlert,\n success: icons.circleCheck,\n info: icons.info,\n};\n\n/**\n * # `<pont2-alert>`: kit composite over `<pont2-prim-alert>`\n *\n * The props-driven form of shadcn's Alert, and pont2's version of the legacy\n * `pont-alert` (which composed `pont-callout`, the legacy shadcn alert).\n *\n * ```html\n * <pont2-alert status=\"error\" icon heading=\"Payment failed\"\n * description=\"Check your card details and try again.\"></pont2-alert>\n * ```\n *\n * renders exactly the DOM the primitive form produces:\n *\n * ```html\n * <pont2-alert data-pont2-alert data-slot=\"alert\" data-variant=\"destructive\" data-status=\"error\">\n * <svg …/>\n * <div data-pont2-alert-title data-slot=\"alert-title\">Payment failed</div>\n * <div data-pont2-alert-description data-slot=\"alert-description\">Check your…</div>\n * </pont2-alert>\n * ```\n *\n * - **It is a primitive Alert** (`extends Alert`): same identity, slot, recipe\n * and `variant`. Title and description are rendered as *parts* (plain divs\n * with the primitive's attributes), not nested elements.\n * - **What it adds** over shadcn: `status` (`error` maps to shadcn's\n * `destructive` variant; `warning`/`success`/`info` are coloured in\n * `@layer pont2.kit` with the `--pont2-sem-color-success|warning|info` tokens), a\n * status icon, and a status-appropriate role (`alert` for error/warning,\n * `status` otherwise, as the legacy `pont-alert` did). An author `role`\n * attribute still wins.\n * - **What it leaves out:** rich content (links, an action button). Use the\n * primitive form for those; a composite ignores author children.\n *\n * `heading` instead of `title`: `title` is a global HTML attribute that shows\n * a native tooltip, so the attribute would leak onto the whole alert.\n *\n * @tag pont2-alert\n * @attr status - default | error | warning | success | info\n * @attr heading - the alert title text\n * @attr description - the description text\n * @attr icon - show the status icon\n * @cssprop --pont2-alert-warning-fg, --pont2-alert-success-fg, --pont2-alert-info-fg - status colours (default the sem status colours)\n */\nexport class KitAlert extends Alert {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n status: { type: String, reflect: true },\n heading: { type: String },\n description: { type: String },\n icon: { type: Boolean, reflect: true },\n };\n\n declare status: AlertStatus;\n declare heading: string;\n declare description: string;\n declare icon: boolean;\n\n constructor() {\n super();\n this.status = \"default\";\n this.heading = \"\";\n this.description = \"\";\n this.icon = false;\n }\n\n protected override willUpdate(): void {\n const status = ALERT_STATUSES.includes(this.status) ? this.status : \"default\";\n // The primitive's `variant` stays its public styling contract; status drives it.\n this.variant = status === \"error\" ? \"destructive\" : \"default\";\n super.willUpdate();\n this.setData(\"status\", status);\n this.internals.role = status === \"error\" || status === \"warning\" ? \"alert\" : \"status\";\n }\n\n protected override render() {\n const status = ALERT_STATUSES.includes(this.status) ? this.status : \"default\";\n return html`${this.icon ? STATUS_ICON[status]() : nothing}${this.heading\n ? html`<div ${AlertTitle.part()}>${this.heading}</div>`\n : nothing}${this.description ? html`<div ${AlertDescription.part()}>${this.description}</div>` : nothing}`;\n }\n}\n\ndefine(\"pont2-alert\", KitAlert);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-alert\": KitAlert;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { define } from \"../../core/names\";\nimport { Avatar, AvatarBadge, AvatarFallback } from \"../../primitives/avatar/avatar\";\n\n/** \"Ada Lovelace\" → \"AL\", \"ada\" → \"A\". At most two letters, upper-cased. */\nexport function initials(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const letters = words.length > 1 ? [words[0], words[words.length - 1]] : words;\n return letters.map(w => Array.from(w)[0] ?? \"\").join(\"\").toLocaleUpperCase();\n}\n\n/**\n * # `<pont2-avatar>`: kit composite over `<pont2-prim-avatar>`\n *\n * ```html\n * <pont2-avatar src=\"/u/42.png\" alt=\"Ada Lovelace\" badge></pont2-avatar>\n * ```\n *\n * renders the primitive's DOM:\n *\n * ```html\n * <pont2-avatar data-pont2-avatar data-slot=\"avatar\" data-size=\"default\" data-image-loading-status=\"loaded\">\n * <img src=\"/u/42.png\" alt=\"Ada Lovelace\" data-pont2-avatar-image data-slot=\"avatar-image\">\n * <span data-pont2-avatar-fallback data-slot=\"avatar-fallback\">AL</span>\n * <span data-pont2-avatar-badge data-slot=\"avatar-badge\"></span>\n * </pont2-avatar>\n * ```\n *\n * - **It is a primitive Avatar** (`extends Avatar`): the primitive watches the\n * rendered `<img>` and swaps image and fallback on\n * `data-image-loading-status` as usual.\n * - **Fallback text:** `fallback`, else the initials of `alt`. When `alt` is\n * set the fallback is announced as an image named by `alt` (not as \"AL\"):\n * only one of image and fallback is ever displayed, so nothing is read twice.\n * - **Badge:** `badge` shows shadcn's status dot. For an icon inside the\n * badge, use the primitive form.\n *\n * @tag pont2-avatar\n * @attr src - image URL (no image is rendered without it)\n * @attr alt - image alternative text; also the source of the default initials\n * @attr fallback - fallback text (defaults to the initials of `alt`)\n * @attr size - default | sm | lg (primitive)\n * @attr badge - show the badge dot\n */\nexport class KitAvatar extends Avatar {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n src: { type: String },\n alt: { type: String },\n fallback: { type: String },\n badge: { type: Boolean, reflect: true },\n };\n\n declare src: string;\n declare alt: string;\n declare fallback: string;\n declare badge: boolean;\n\n constructor() {\n super();\n this.src = \"\";\n this.alt = \"\";\n this.fallback = \"\";\n this.badge = false;\n }\n\n protected override render() {\n const text = this.fallback || initials(this.alt);\n return html`${this.src ? html`<img src=${this.src} alt=${this.alt} />` : nothing}<span\n ${AvatarFallback.part(this.alt ? { role: \"img\", \"aria-label\": this.alt } : {})}\n >${text}</span\n >${this.badge ? html`<span ${AvatarBadge.part()}></span>` : nothing}`;\n }\n}\n\ndefine(\"pont2-avatar\", KitAvatar);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-avatar\": KitAvatar;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { InputOTP, InputOTPGroup, InputOTPSeparator } from \"../../primitives/input-otp/input-otp\";\n\n/** `groupSizes(6, 3)` → `[3, 3]`; `groupSizes(7, 3)` → `[3, 3, 1]`; size ≤ 0 → one group. */\nexport function groupSizes(length: number, size: number): number[] {\n const n = Math.max(0, Math.floor(length));\n const g = Math.floor(size);\n if (!(g > 0) || g >= n) return n ? [n] : [];\n const out: number[] = [];\n for (let left = n; left > 0; left -= g) out.push(Math.min(g, left));\n return out;\n}\n\n/**\n * The slot structure for `length` characters: groups of `groupSize` (one group\n * when 0), separators between groups when `separator`. Groups and separators\n * are parts; slots are `pont2-prim-input-otp-slot` elements (they have\n * behaviour). Shared with the OTP field (kit/otp-field).\n */\nexport function otpGroups(length: number, groupSize: number, separator: boolean) {\n let index = 0;\n return groupSizes(length, groupSize).map((n, g) => {\n const slots = Array.from({ length: n }, () => {\n const i = index++;\n return html`<pont2-prim-input-otp-slot index=${i}></pont2-prim-input-otp-slot>`;\n });\n const sep = g > 0 && separator ? html`<div ${InputOTPSeparator.part()}>${icons.minus()}</div>` : nothing;\n return html`${sep}<div ${InputOTPGroup.part()}>${slots}</div>`;\n });\n}\n\n/**\n * # `<pont2-input-otp>`: kit composite over `<pont2-prim-input-otp>`\n *\n * ```html\n * <pont2-input-otp name=\"code\" maxlength=\"6\" group-size=\"3\" separator aria-label=\"Verification code\"></pont2-input-otp>\n * ```\n *\n * renders the primitive's DOM, which is shadcn's:\n *\n * ```html\n * <pont2-input-otp data-pont2-input-otp …>\n * <div data-pont2-input-otp-group data-slot=\"input-otp-group\">\n * <pont2-prim-input-otp-slot index=\"0\"></pont2-prim-input-otp-slot> ×3\n * </div>\n * <div data-pont2-input-otp-separator data-slot=\"input-otp-separator\" role=\"separator\"><svg/></div>\n * <div data-pont2-input-otp-group …> …×3 </div>\n * <div data-pont2-input-otp-input-wrapper><input data-slot=\"input-otp\" autocomplete=\"one-time-code\" …></div>\n * </pont2-input-otp>\n * ```\n *\n * - **It is a primitive InputOTP** (`extends InputOTP`): the one native input,\n * form participation, paste cleaning, `pont2-complete` and every primitive\n * attribute (`maxlength`, `pattern`, `value`, `name`, `required`,\n * `disabled`, `aria-*`) work unchanged.\n * - **What it adds:** the slots are generated from `maxlength`, split into\n * groups of `group-size` (one group when absent), with a separator between\n * groups when `separator` is set.\n * - Groups and separators are **parts** (plain divs). Slots are rendered as\n * `pont2-prim-input-otp-slot` **elements**, because each slot has behaviour\n * (it draws its character and the fake caret from state the root pushes in).\n *\n * @tag pont2-input-otp\n * @attr group-size - characters per group (default: all in one group)\n * @attr separator - draw a separator between groups\n */\nexport class KitInputOTP extends InputOTP {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n groupSize: { type: Number, attribute: \"group-size\" },\n separator: { type: Boolean },\n };\n\n declare groupSize: number;\n declare separator: boolean;\n\n constructor() {\n super();\n this.groupSize = 0;\n this.separator = false;\n }\n\n override render() {\n // The primitive renders the native input last, where input-otp puts it.\n return html`${otpGroups(this.maxLength, this.groupSize, this.separator)}${super.render()}`;\n }\n}\n\ndefine(\"pont2-input-otp\", KitInputOTP);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-input-otp\": KitInputOTP;\n }\n}\n","import { html, svg, type SVGTemplateResult } from \"lit\";\n\nimport { attrs, type AttrMap } from \"../../core/attrs\";\n\n/**\n * Sign-in providers: display names and brand marks.\n *\n * The marks are Simple Icons (https://simpleicons.org, CC0-1.0), the same\n * geometry the legacy kit ships (src/components/renderers/auth/button/\n * button.defs.ts). pont2 keeps its own copy because it imports nothing from\n * the legacy kit (docs/08-parallel-constraints.md).\n */\nexport const AUTH_PROVIDERS = [\"apple\", \"discord\", \"facebook\", \"github\", \"google\", \"linkedin\", \"meta\", \"microsoft\", \"x\"] as const;\nexport type AuthProvider = (typeof AUTH_PROVIDERS)[number];\n\nexport const PROVIDER_NAMES: Record<AuthProvider, string> = {\n apple: \"Apple\",\n discord: \"Discord\",\n facebook: \"Facebook\",\n github: \"GitHub\",\n google: \"Google\",\n linkedin: \"LinkedIn\",\n meta: \"Meta\",\n microsoft: \"Microsoft\",\n x: \"X\",\n};\n\nconst MARKS: Record<AuthProvider, SVGTemplateResult> = {\n apple: svg`<path d=\"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701\" />`,\n discord: svg`<path d=\"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z\" />`,\n facebook: svg`<path d=\"M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z\" />`,\n github: svg`<path d=\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\" />`,\n google: svg`<path d=\"M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z\" />`,\n linkedin: svg`<path d=\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z\" />`,\n meta: svg`<path d=\"M6.915 4.03c-1.968 0-3.683 1.28-4.871 3.113C.704 9.208 0 11.883 0 14.449c0 .706.07 1.369.21 1.973a6.624 6.624 0 0 0 .265.86 5.297 5.297 0 0 0 .371.761c.696 1.159 1.818 1.927 3.593 1.927 1.497 0 2.633-.671 3.965-2.444.76-1.012 1.144-1.626 2.663-4.32l.756-1.339.186-.325c.061.1.121.196.183.3l2.152 3.595c.724 1.21 1.665 2.556 2.47 3.314 1.046.987 1.992 1.22 3.06 1.22 1.075 0 1.876-.355 2.455-.843a3.743 3.743 0 0 0 .81-.973c.542-.939.861-2.127.861-3.745 0-2.72-.681-5.357-2.084-7.45-1.282-1.912-2.957-2.93-4.716-2.93-1.047 0-2.088.467-3.053 1.308-.652.57-1.257 1.29-1.82 2.05-.69-.875-1.335-1.547-1.958-2.056-1.182-.966-2.315-1.303-3.454-1.303zm10.16 2.053c1.147 0 2.188.758 2.992 1.999 1.132 1.748 1.647 4.195 1.647 6.4 0 1.548-.368 2.9-1.839 2.9-.58 0-1.027-.23-1.664-1.004-.496-.601-1.343-1.878-2.832-4.358l-.617-1.028a44.908 44.908 0 0 0-1.255-1.98c.07-.109.141-.224.211-.327 1.12-1.667 2.118-2.602 3.358-2.602zm-10.201.553c1.265 0 2.058.791 2.675 1.446.307.327.737.871 1.234 1.579l-1.02 1.566c-.757 1.163-1.882 3.017-2.837 4.338-1.191 1.649-1.81 1.817-2.486 1.817-.524 0-1.038-.237-1.383-.794-.263-.426-.464-1.13-.464-2.046 0-2.221.63-4.535 1.66-6.088.454-.687.964-1.226 1.533-1.533a2.264 2.264 0 0 1 1.088-.285z\" />`,\n microsoft: svg`<path d=\"M11.4 24H0V12.6h11.4V24zM24 24H12.6V12.6H24V24zM11.4 11.4H0V0h11.4v11.4zM24 11.4H12.6V0H24v11.4z\" />`,\n x: svg`<path d=\"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.763l7.726-8.835L1.254 2.25H8.08l4.713 6.231 5.45-6.231zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77z\" />`,\n};\n\nexport const isAuthProvider = (p: unknown): p is AuthProvider => AUTH_PROVIDERS.includes(p as AuthProvider);\n\n/** A provider's brand mark as an `<svg>` (filled with `currentColor`, aria-hidden). */\nexport function providerIcon(provider: AuthProvider, extra: AttrMap = {}) {\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-provider-icon=${provider}\n ${attrs(extra)}\n >${MARKS[provider]}</svg>`;\n}\n","import { html, nothing, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { ButtonBase, type ButtonOptions } from \"../../primitives/button/button\";\nimport { Spinner } from \"../../primitives/spinner/spinner\";\nimport { PROVIDER_NAMES, isAuthProvider, providerIcon, type AuthProvider } from \"./providers\";\n\nexport { AUTH_PROVIDERS, PROVIDER_NAMES, providerIcon, type AuthProvider } from \"./providers\";\n\n/** What the button shows: the legacy kit's `content` prop. */\nexport const AUTH_BUTTON_CONTENTS = [\"label\", \"icon-label\", \"icon\"] as const;\nexport type AuthButtonContent = (typeof AUTH_BUTTON_CONTENTS)[number];\nexport const AUTH_BUTTON_ICON_ALIGNS = [\"start\", \"end\"] as const;\nexport type AuthButtonIconAlign = (typeof AUTH_BUTTON_ICON_ALIGNS)[number];\n\n/**\n * # AuthButton: the shared base of the auth-flow buttons\n *\n * An auth button **is a Button** (`extends ButtonBase`: variant, size,\n * disabled, type… inherited, nothing forwarded) and **has action behaviour**\n * (`ActionController`: the `pont2-action` request/response protocol, see\n * core/controllers/action.ts). Its DOM is the button primitive's:\n *\n * ```html\n * <pont2-provider-button provider=\"google\" data-pont2-shell> ← display: contents\n * <button data-pont2-button data-slot=\"button\" data-variant=\"outline\" data-provider=\"google\" type=\"button\">\n * <svg data-icon=\"inline-start\" …/>Continue with Google\n * </button>\n * </pont2-provider-button>\n * ```\n *\n * Two nodes; the legacy `pont-provider-button > pont-button > button` has three.\n *\n * While busy (a `respondWith()` promise is pending, or `loading` is set) the\n * button shows a spinner in place of its icon, sets `aria-busy`, and is\n * disabled *focusably* (`aria-disabled`, Base UI's `focusableWhenDisabled`),\n * so keyboard focus is not lost mid-request and a second press is ignored.\n *\n * Subclasses provide the default copy, the icon, and what a press does.\n */\nexport abstract class AuthButton extends ButtonBase {\n static override composite = true;\n\n // Lit merges these with ButtonBase's (variant, size, disabled, type …).\n static override properties: PropertyDeclarations = {\n content: { type: String },\n iconAlign: { type: String, attribute: \"icon-align\" },\n label: { type: String },\n event: { type: String },\n loading: { type: Boolean, reflect: true },\n };\n\n /**\n * `label` (default), `icon-label` or `icon` (icon only; the label becomes the\n * accessible name). Icon-only keeps the text size, as shadcn's login blocks\n * do: at the default size it is already near-square (38×36px, as shadcn's),\n * and it can still stretch to fill a grid cell (`w-full`). Set\n * `size=\"icon\"` for a fixed square.\n */\n declare content: AuthButtonContent;\n declare iconAlign: AuthButtonIconAlign;\n /** Visible text (and accessible name). Each button has a default. */\n declare label: string;\n /** The action requested on press (a login-flow event id). */\n declare event: string | undefined;\n /** Busy state set by the owner, in addition to a pending `respondWith()`. */\n declare loading: boolean;\n\n protected readonly action = new ActionController(this);\n\n constructor() {\n super();\n this.content = \"label\";\n this.iconAlign = \"start\";\n this.label = \"\";\n this.event = undefined;\n this.loading = false;\n }\n\n /** True while a request is pending or `loading` is set. */\n get busy(): boolean {\n return this.loading || this.action.busy;\n }\n\n /** The text used when `label` is empty. */\n protected abstract defaultLabel(): string;\n /** The button's icon, with the attributes shadcn's button CSS keys on. */\n protected abstract renderIcon(attrs: Record<string, string>): TemplateResult | typeof nothing;\n /** Data sent with the `pont2-action` request. */\n protected actionData(): Record<string, unknown> {\n return {};\n }\n /** What a press does. The default requests the action. */\n protected onPress(_e: MouseEvent): void {\n this.action.request(this.event, this.actionData());\n }\n\n protected get text(): string {\n return this.label || this.defaultLabel();\n }\n\n protected override buttonOptions(): ButtonOptions {\n const base = super.buttonOptions();\n const iconOnly = this.content === \"icon\";\n const busy = this.busy;\n return {\n ...base,\n disabled: base.disabled || busy,\n // Busy is a transient disabled state: keep focus where the user left it.\n focusableWhenDisabled: base.focusableWhenDisabled || (busy && !base.disabled),\n attrs: {\n \"data-event\": this.event,\n \"data-loading\": busy,\n \"aria-busy\": busy ? \"true\" : null,\n \"aria-label\": iconOnly ? this.text : null,\n ...this.extraAttrs(),\n },\n onClick: e => this.onPress(e),\n };\n }\n\n /** Extra attributes for the native button (`data-provider` …). */\n protected extraAttrs(): Record<string, string | boolean | null | undefined> {\n return {};\n }\n\n protected override renderContent() {\n const showIcon = this.content !== \"label\";\n const showLabel = this.content !== \"icon\";\n // The icon slot holds the spinner while busy, even for label-only buttons.\n const slot = this.content === \"icon\" ? null : this.iconAlign === \"end\" ? \"inline-end\" : \"inline-start\";\n const mark = (a: Record<string, string>) =>\n this.busy\n ? html`<span ${Spinner.part({ ...a, role: false, \"aria-hidden\": \"true\" })}></span>`\n : showIcon\n ? this.renderIcon(a)\n : nothing;\n const icon = mark(slot ? { \"data-icon\": slot } : {});\n return this.iconAlign === \"end\"\n ? html`${showLabel ? this.text : nothing}${icon}`\n : html`${icon}${showLabel ? this.text : nothing}`;\n }\n}\n\n/* ==================================================================== */\n\n/**\n * # `<pont2-provider-button>`: sign in with an identity provider\n *\n * ```html\n * <pont2-provider-button provider=\"google\" event=\"oauth_google\"></pont2-provider-button>\n * ```\n *\n * Defaults: `variant=\"outline\"`, `content=\"icon-label\"`, label\n * \"`prompt` + provider name\" (\"Continue with Google\"). Pressing requests\n * `event` with `{ provider }` (see AuthButton).\n *\n * @tag pont2-provider-button\n * @attr provider - apple | discord | facebook | github | google | linkedin | meta | microsoft | x\n * @attr prompt - text before the provider name in the default label (default \"Continue with\")\n * @attr label - replaces the whole default label\n * @attr event - the action requested on press\n * @attr content - label | icon-label (default) | icon\n * @attr icon-align - start (default) | end\n * @attr loading - busy state set by the owner\n * @fires pont2-action - `{ action, data: { provider }, respondWith }` on press\n * @fires pont2-action-success - `{ action, data, result }`\n * @fires pont2-action-error - `{ action, data, error, message }`\n */\nexport class ProviderButton extends AuthButton {\n static override properties: PropertyDeclarations = {\n provider: { type: String, reflect: true },\n prompt: { type: String },\n };\n\n declare provider: AuthProvider;\n declare prompt: string;\n\n /** Design mode (core/design-mode.ts): a sample provider until the author picks one. */\n protected readonly design = new DesignModeController(this);\n\n /** The provider shown: `provider`, or \"google\" in design mode when none is set (the legacy sample). */\n get shownProvider(): AuthProvider {\n return !this.provider && this.design.active ? \"google\" : this.provider;\n }\n\n constructor() {\n super();\n this.variant = \"outline\";\n this.content = \"icon-label\";\n this.prompt = \"Continue with\";\n }\n\n protected defaultLabel(): string {\n const provider = this.shownProvider;\n const name = isAuthProvider(provider) ? PROVIDER_NAMES[provider] : (provider ?? \"\");\n return `${this.prompt || \"Continue with\"} ${name}`.trim();\n }\n\n protected renderIcon(a: Record<string, string>) {\n const provider = this.shownProvider;\n return isAuthProvider(provider) ? providerIcon(provider, a) : nothing;\n }\n\n protected override actionData() {\n return { provider: this.provider };\n }\n\n protected override extraAttrs() {\n return { \"data-provider\": this.shownProvider };\n }\n}\n\n/* ==================================================================== */\n\n/**\n * # `<pont2-passkey-button>`: sign in with a passkey\n *\n * ```html\n * <pont2-passkey-button event=\"passkey_login\"></pont2-passkey-button>\n * ```\n *\n * Defaults: `variant=\"secondary\"`, `content=\"label\"`, label \"Continue with\n * Passkey\", icon lucide `user-round-key`. Pressing requests `event`.\n *\n * The listener must start the WebAuthn call synchronously (call\n * `respondWith()` with the promise straight away). The request is dispatched\n * inside the click, so the call keeps the user activation that\n * `navigator.credentials.get()` needs in Safari.\n *\n * @tag pont2-passkey-button\n * @attr label, event, content, icon-align, loading - see ProviderButton\n * @fires pont2-action, pont2-action-success, pont2-action-error\n */\nexport class PasskeyButton extends AuthButton {\n constructor() {\n super();\n this.variant = \"secondary\";\n }\n\n protected defaultLabel(): string {\n return \"Continue with Passkey\";\n }\n\n protected renderIcon(a: Record<string, string>) {\n return icons.userRoundKey(a);\n }\n}\n\n/* ==================================================================== */\n\n/**\n * # `<pont2-submit-button>`: submit an auth form\n *\n * ```html\n * <form>\n * …fields…\n * <pont2-submit-button event=\"submit_password\"></pont2-submit-button>\n * </form>\n * ```\n *\n * A real `<button type=\"submit\">`, so the browser's own submission rules\n * apply: Enter in a field submits, constraint validation (`required`,\n * `type=\"email\"` …) blocks an invalid form, and `SubmitEvent.submitter` is\n * this button.\n *\n * When its form **submits** (not merely when it is clicked), the button\n * requests `event` with `{ form, formData }` (the FormData includes this\n * button's `name`/`value`, if any):\n *\n * - a listener calls `respondWith()` → the native submission is prevented\n * (the flow is handled in-page) and the button is busy until it settles;\n * - nobody responds → the form submits natively (progressive enhancement:\n * a plain `<form action>` still works).\n *\n * A submission without a submitter (`form.requestSubmit()`, e.g. an OTP\n * auto-submit) is handled by the form's **default button** (its first submit\n * button), as the browser does for implicit submission.\n *\n * Outside a form, a press requests the action directly.\n *\n * Defaults: `variant=\"default\"`, `content=\"label\"`, `icon-align=\"end\"`,\n * label \"Submit\", icon lucide `arrow-right`.\n *\n * @tag pont2-submit-button\n * @attr label, event, content, icon-align, loading - see ProviderButton\n * @fires pont2-action - `{ action, data: { form, formData }, respondWith }` on submit\n * @fires pont2-action-success, pont2-action-error\n */\nexport class SubmitButton extends AuthButton {\n constructor() {\n super();\n this.type = \"submit\";\n this.iconAlign = \"end\";\n }\n\n protected defaultLabel(): string {\n return \"Submit\";\n }\n\n protected renderIcon(a: Record<string, string>) {\n return icons.arrowRight(a);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n // Capture on the document: runs before the form's own submit listeners,\n // and catches implicit submission (Enter) where this is the default button.\n document.addEventListener(\"submit\", this.onSubmit, true);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"submit\", this.onSubmit, true);\n }\n\n protected override onPress(_e: MouseEvent): void {\n const c = this.control;\n // In a form, the submit event drives the request (after validation passes).\n if (c instanceof HTMLButtonElement && c.form && this.type === \"submit\") return;\n this.action.request(this.event, {});\n }\n\n private onSubmit = (e: SubmitEvent) => {\n const c = this.control;\n const form = c instanceof HTMLButtonElement ? c.form : null;\n if (!c || !form || form !== e.target) return;\n // A submit without a submitter (`form.requestSubmit()`, an OTP auto-submit)\n // belongs to the form's default button, as implicit submission does.\n const isDefault = !e.submitter && Array.from(form.elements).find(el => (el as HTMLButtonElement).type === \"submit\") === c;\n if (e.submitter !== c && !isDefault) return;\n if (this.busy) {\n e.preventDefault(); // a second submit while the first is pending\n return;\n }\n const formData = new FormData(form, c);\n if (this.action.request(this.event, { form, formData })) e.preventDefault();\n };\n}\n\ndefine(\"pont2-provider-button\", ProviderButton);\ndefine(\"pont2-passkey-button\", PasskeyButton);\ndefine(\"pont2-submit-button\", SubmitButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-provider-button\": ProviderButton;\n \"pont2-passkey-button\": PasskeyButton;\n \"pont2-submit-button\": SubmitButton;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues, type TemplateResult } from \"lit\";\n\nimport { parseList } from \"../../core/attrs\";\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { fire } from \"../../core/events\";\nimport { uid } from \"../../core/ids\";\nimport { define } from \"../../core/names\";\nimport { Field, FieldDescription, FieldError, fieldLabel } from \"../../primitives/field/field\";\nimport { input, type InputOptions } from \"../../primitives/input/input\";\n\n/* ==================================================================== */\n/* Messages */\n/* ==================================================================== */\n\nconst cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n\n/**\n * Default error copy, identical to the legacy kit's (field.defs.ts), so\n * existing screens read the same. Every message is overridable per field\n * (`required-error`, `format-error` …). Localised copy is expected from the\n * render spec / widget.\n */\nexport const fieldMessages = {\n required: (label: string) => `${cap(label)} is a required field.`,\n format: (label: string) => `Please enter a valid ${label.toLowerCase()}.`,\n minlength: (label: string, n?: number) =>\n n ? `${cap(label)} must be at least ${n} characters.` : `Please enter a longer ${label.toLowerCase()}.`,\n maxlength: (label: string, n?: number) =>\n n ? `${cap(label)} can have at most ${n} characters.` : `Please enter a shorter ${label.toLowerCase()}.`,\n};\n\n/* ==================================================================== */\n/* Types */\n/* ==================================================================== */\n\nexport type FieldIssueType = \"required\" | \"minlength\" | \"maxlength\" | \"format\" | \"rule\" | \"match\" | \"incomplete\";\n\nexport interface FieldIssue {\n type: FieldIssueType;\n message: string;\n}\n\n/** `pont2-field-validate` detail. The value is deliberately not included (passwords). */\nexport interface FieldValidateDetail {\n name: string;\n valid: boolean;\n issues: FieldIssue[];\n}\n\n/** \"default\": every rule; \"simple\": `required` only (the legacy `validation` attribute). */\nexport const FIELD_VALIDATION_MODES = [\"default\", \"simple\"] as const;\nexport type FieldValidationMode = (typeof FIELD_VALIDATION_MODES)[number];\n\n/** Compiles a pattern source, preferring Unicode mode (needed for `\\p{L}`). */\nexport function compilePattern(source: string): RegExp | null {\n if (!source) return null;\n try {\n return new RegExp(source, \"u\");\n } catch {\n try {\n return new RegExp(source);\n } catch {\n return null;\n }\n }\n}\n\n/** Positive integers only (legacy: values ≤ 0 are ignored). */\nconst positive = { fromAttribute: (v: string | null) => (v != null && Number(v) > 0 ? Number(v) : undefined) };\n\n/* The first invalid field of a validation pass takes focus (see onInvalid). */\nlet focusClaimed = false;\n\n/* ==================================================================== */\n/* AuthField */\n/* ==================================================================== */\n\n/**\n * # AuthField: the shared base of the auth-flow text fields\n *\n * An auth field **is a Field** (`extends Field`: the host is shadcn's\n * `div[role=group][data-slot=field]`, styled by the field recipe, with\n * `data-invalid` / `data-disabled`) that renders its label, control,\n * description and error from properties, as parts:\n *\n * ```html\n * <pont2-email-field data-pont2-field data-slot=\"field\" data-orientation=\"vertical\" [data-invalid]>\n * <label data-pont2-label data-pont2-field-label data-slot=\"field-label\" for=\"…-input\">Email</label>\n * <input data-pont2-input data-slot=\"input\" id=\"…-input\" name=\"email\" type=\"email\"\n * autocomplete=\"email\" aria-describedby=\"…-description …-error\" [aria-invalid=\"true\"]>\n * <p data-pont2-field-description data-slot=\"field-description\" id=\"…-description\">…</p>\n * <div data-pont2-field-error data-slot=\"field-error\" role=\"alert\" id=\"…-error\">Please enter a valid email.</div>\n * </pont2-email-field>\n * ```\n *\n * **The native `<input name>` is the form control.** There is no hidden\n * input and no form-association: the form's own FormData, autofill and\n * password managers, `form.reset()` and `<fieldset disabled>` all work\n * natively.\n *\n * **Validation is the platform's.** The field computes its issues on every\n * change and mirrors the first into `input.setCustomValidity()`, so\n * `form.checkValidity()`, `:invalid` and interactive validation are always\n * right, and the submit button never sends an invalid form. The field cancels\n * the browser's bubble (`invalid` event) and shows its own error instead.\n * Errors are **shown** after the user commits a change (`change`), when the\n * form is submitted, or on `reportValidity()`; once shown they update live\n * while typing.\n *\n * **Normalisation** (trimming, lower-casing an email…) is applied to the\n * submitted value through the form's `formdata` event, without rewriting what\n * the user sees.\n *\n * Subclasses supply defaults and rules through the protected hooks.\n *\n * @fires pont2-field-validate - `{ name, valid, issues }` whenever validity is shown (change, submit, reportValidity)\n */\nexport abstract class AuthField extends Field {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n inputId: { type: String, attribute: \"input-id\" },\n name: { type: String },\n defaultValue: { type: String, attribute: \"value\" },\n label: { type: String },\n placeholder: { type: String },\n description: { type: String },\n mark: { type: String },\n caret: { type: Boolean },\n autocomplete: { type: String },\n required: { type: Boolean, reflect: true },\n validation: { type: String },\n pattern: { type: String },\n minlength: { attribute: \"minlength\", converter: positive },\n maxlength: { attribute: \"maxlength\", converter: positive },\n requiredError: { type: String, attribute: \"required-error\" },\n formatError: { type: String, attribute: \"format-error\" },\n minlengthError: { type: String, attribute: \"minlength-error\" },\n maxlengthError: { type: String, attribute: \"maxlength-error\" },\n current: { state: true },\n shown: { state: true },\n };\n\n /** `id` of the native input (generated when absent), for `<label for>` elsewhere. */\n declare inputId: string;\n /** Form-data key. Each field has a default (`email`, `password`, `login_id` …). */\n declare name: string;\n /** Initial value (the `value` attribute, as on a native input). `.value` is live. */\n declare defaultValue: string;\n declare label: string;\n declare placeholder: string;\n declare description: string;\n /** Text after the label, e.g. \"(optional)\". */\n declare mark: string;\n /** Show a `*` after the label when `required` (and no `mark`). */\n declare caret: boolean;\n declare autocomplete: string;\n declare required: boolean;\n declare validation: FieldValidationMode;\n /** Regex source for the format rule. Each field has a default where the legacy kit had one. */\n declare pattern: string;\n declare minlength: number | undefined;\n declare maxlength: number | undefined;\n declare requiredError: string;\n declare formatError: string;\n declare minlengthError: string;\n declare maxlengthError: string;\n\n declare protected current: string;\n /** Whether issues are displayed (after change / submit / reportValidity). */\n declare protected shown: boolean;\n\n private dirty = false;\n private generatedId = uid(\"auth-field\");\n private boundForm: HTMLFormElement | null = null;\n\n constructor() {\n super();\n this.inputId = \"\";\n this.name = \"\";\n this.defaultValue = \"\";\n this.label = \"\";\n this.placeholder = \"\";\n this.description = \"\";\n this.mark = \"\";\n this.caret = false;\n this.autocomplete = \"\";\n this.required = false;\n this.validation = \"default\";\n this.pattern = \"\";\n this.minlength = undefined;\n this.maxlength = undefined;\n this.requiredError = \"\";\n this.formatError = \"\";\n this.minlengthError = \"\";\n this.maxlengthError = \"\";\n this.current = \"\";\n this.shown = false;\n }\n\n /* ---------------------------------------------------------------- */\n /* Hooks for subclasses */\n /* ---------------------------------------------------------------- */\n\n protected abstract defaultName(): string;\n protected abstract defaultLabel(): string;\n protected inputType(): string {\n return \"text\";\n }\n protected defaultAutocomplete(): string {\n return \"\";\n }\n protected defaultPattern(): string {\n return \"\";\n }\n /** Extra attributes for the input (inputmode, autocapitalize, spellcheck …). */\n protected inputAttrs(): Record<string, string | boolean | null | undefined> {\n return {};\n }\n /** The submitted form of a raw value. Identity by default. */\n normalizeValue(raw: string): string {\n return raw;\n }\n /**\n * Rules for a non-empty value, after `required`. The default is the legacy\n * order: minlength, then maxlength, then the format pattern; first failure only.\n */\n protected valueIssues(value: string): FieldIssue[] {\n const label = this.text;\n if (this.minlength && value.length < this.minlength) {\n return [{ type: \"minlength\", message: this.minlengthError || fieldMessages.minlength(label, this.minlength) }];\n }\n // A maxlength below minlength is raised to it, as in the legacy kit.\n const maxlength = this.maxlength ? Math.max(this.maxlength, this.minlength ?? 0) : undefined;\n if (maxlength && value.length > maxlength) {\n return [{ type: \"maxlength\", message: this.maxlengthError || fieldMessages.maxlength(label, maxlength) }];\n }\n const re = compilePattern(this.pattern || this.defaultPattern());\n if (re && !re.test(value)) return [{ type: \"format\", message: this.formatError || fieldMessages.format(label) }];\n return [];\n }\n\n /* ---------------------------------------------------------------- */\n /* Public API */\n /* ---------------------------------------------------------------- */\n\n /** The native input. */\n get control(): HTMLInputElement | null {\n return this.querySelector<HTMLInputElement>(`input[data-auth-field-control]`);\n }\n\n /** The normalised value (what is submitted). */\n get value(): string {\n return this.normalizeValue(this.current);\n }\n set value(v: string) {\n this.dirty = true;\n this.setCurrent(String(v ?? \"\"));\n }\n\n /** The effective form-data key. */\n get fieldName(): string {\n return this.name || this.defaultName();\n }\n\n /** The effective label text. */\n get text(): string {\n return this.label || this.defaultLabel();\n }\n\n /** Current issues (empty when valid). Independent of whether they are shown. */\n get issues(): FieldIssue[] {\n return this.computeIssues();\n }\n\n checkValidity(): boolean {\n return this.computeIssues().length === 0;\n }\n\n /** Shows the field's errors (or clears them) and returns validity. Legacy name: `validate()`. */\n reportValidity(): boolean {\n this.show();\n return this.checkValidity();\n }\n\n validate(): boolean {\n return this.reportValidity();\n }\n\n override focus(options?: FocusOptions): void {\n this.control?.focus(options);\n }\n\n /* ---------------------------------------------------------------- */\n /* Validation */\n /* ---------------------------------------------------------------- */\n\n protected computeIssues(): FieldIssue[] {\n if (this.disabled) return [];\n const value = this.normalizeValue(this.current);\n if (!value) {\n return this.required ? [{ type: \"required\", message: this.requiredError || fieldMessages.required(this.text) }] : [];\n }\n if (this.validation === \"simple\") return [];\n return this.valueIssues(value);\n }\n\n private show(): void {\n this.shown = true;\n const issues = this.computeIssues();\n fire<FieldValidateDetail>(this, \"pont2-field-validate\", { name: this.fieldName, valid: !issues.length, issues });\n }\n\n /* ---------------------------------------------------------------- */\n /* Events */\n /* ---------------------------------------------------------------- */\n\n protected onInput = (e: Event) => {\n this.dirty = true;\n this.setCurrent((e.target as HTMLInputElement).value);\n };\n\n /**\n * Sets the raw value and mirrors validity to the input **synchronously**:\n * code that submits in the same task (an OTP auto-submit, `requestSubmit()`\n * in an `input` listener) must not see the previous render's validity.\n */\n protected setCurrent(raw: string): void {\n this.current = raw;\n this.syncValidity();\n }\n\n protected syncValidity(): void {\n this.control?.setCustomValidity(this.computeIssues()[0]?.message ?? \"\");\n }\n\n protected onChange = () => this.show();\n\n private onInvalid = (e: Event) => {\n // Our inline error replaces the browser's bubble.\n e.preventDefault();\n this.show();\n if (!focusClaimed) {\n focusClaimed = true;\n this.control?.focus();\n // The pass fires one `invalid` per control, possibly with microtask\n // checkpoints in between, so release on the next task.\n setTimeout(() => (focusClaimed = false));\n }\n };\n\n private onFormData = (e: FormDataEvent) => {\n const c = this.control;\n if (!c || c.disabled || !c.name) return;\n e.formData.set(c.name, this.value);\n };\n\n protected onReset = () => {\n // `reset` fires before the controls are reset.\n setTimeout(() => {\n this.dirty = false;\n this.shown = false;\n this.current = this.control?.value ?? this.defaultValue;\n });\n };\n\n private bindForm(form: HTMLFormElement | null): void {\n if (form === this.boundForm) return;\n this.boundForm?.removeEventListener(\"formdata\", this.onFormData);\n this.boundForm?.removeEventListener(\"reset\", this.onReset);\n this.boundForm = form;\n form?.addEventListener(\"formdata\", this.onFormData);\n form?.addEventListener(\"reset\", this.onReset);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.bindForm(null);\n }\n\n /* ---------------------------------------------------------------- */\n /* Render */\n /* ---------------------------------------------------------------- */\n\n protected get controlId(): string {\n return this.inputId || `${this.id || this.generatedId}-input`;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.dirty && (changed.has(\"defaultValue\") || !this.hasUpdated)) this.current = this.defaultValue ?? \"\";\n this.invalid = this.shown && this.computeIssues().length > 0;\n super.willUpdate(changed);\n }\n\n protected override updated(): void {\n const c = this.control;\n if (c) {\n // The platform's validity mirrors ours: blocks submission, drives :invalid.\n this.syncValidity();\n this.bindForm(c.form);\n }\n }\n\n /** Options for the control part; subclasses render it differently (password: input group). */\n protected controlOptions(describedBy: string | undefined): InputOptions {\n return {\n id: this.controlId,\n name: this.fieldName,\n type: this.inputType(),\n value: this.current,\n placeholder: this.placeholder || undefined,\n autocomplete: this.autocomplete || this.defaultAutocomplete() || undefined,\n required: this.required,\n disabled: this.disabled,\n invalid: this.invalid,\n describedBy,\n attrs: {\n \"data-auth-field-control\": true,\n // The default value, so form.reset() restores it natively.\n value: this.defaultValue || null,\n ...this.inputAttrs(),\n },\n onInput: this.onInput,\n onChange: this.onChange,\n };\n }\n\n protected renderControl(o: InputOptions): TemplateResult {\n return input(o);\n }\n\n protected renderLabel(): TemplateResult | typeof nothing {\n const mark = this.mark\n ? html`<span data-slot=\"field-mark\">${this.mark}</span>`\n : this.caret && this.required\n ? html`<span data-slot=\"field-mark\" data-caret aria-hidden=\"true\">*</span>`\n : nothing;\n return fieldLabel({ for: this.controlId }, html`${this.text}${mark}`);\n }\n\n protected renderError(id: string, issues: FieldIssue[]): TemplateResult {\n const messages = [...new Set(issues.map(i => i.message))];\n return html`<div ${FieldError.part({ id })}>${messages.length === 1\n ? messages[0]\n : html`<ul data-slot=\"field-error-list\">${messages.map(m => html`<li>${m}</li>`)}</ul>`}</div>`;\n }\n\n override render() {\n const id = this.controlId;\n const descId = `${id}-description`;\n const errId = `${id}-error`;\n const issues = this.shown ? this.computeIssues() : [];\n const describedBy = [this.description ? descId : \"\", issues.length ? errId : \"\"].filter(Boolean).join(\" \") || undefined;\n return html`${this.renderLabel()}${this.renderControl(this.controlOptions(describedBy))}${this.description\n ? html`<p ${FieldDescription.part({ id: descId })}>${this.description}</p>`\n : nothing}${issues.length ? this.renderError(errId, issues) : nothing}`;\n }\n\n /** The `invalid` event does not bubble, so it is listened to on the input itself. */\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"invalid\", this.onInvalid, true);\n }\n}\n\n/* ==================================================================== */\n/* Text fields */\n/* ==================================================================== */\n\n/**\n * `<pont2-email-field>`: `type=\"email\"`, `autocomplete=\"email\"`, name\n * `email`. Normalised to trimmed lower case. Format rule: the legacy pattern\n * `^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$`.\n *\n * @tag pont2-email-field\n */\nexport class EmailField extends AuthField {\n protected defaultName() {\n return \"email\";\n }\n protected defaultLabel() {\n return \"Email\";\n }\n protected override inputType() {\n return \"email\";\n }\n protected override defaultAutocomplete() {\n return \"email\";\n }\n protected override defaultPattern() {\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.source;\n }\n override normalizeValue(raw: string) {\n return raw.trim().toLowerCase();\n }\n}\n\n/**\n * `<pont2-phone-field>`: `type=\"tel\"`, `autocomplete=\"tel\"`, name `phone`.\n * Normalised by removing whitespace. Format rule: the legacy pattern.\n *\n * @tag pont2-phone-field\n */\nexport class PhoneField extends AuthField {\n protected defaultName() {\n return \"phone\";\n }\n protected defaultLabel() {\n return \"Phone\";\n }\n protected override inputType() {\n return \"tel\";\n }\n protected override defaultAutocomplete() {\n return \"tel\";\n }\n protected override defaultPattern() {\n return /^\\+?(\\d[\\d-.() ]+)?(\\([\\d-.() ]+\\))?[\\d-.() ]+\\d$/.source;\n }\n override normalizeValue(raw: string) {\n return raw.replace(/\\s+/g, \"\");\n }\n}\n\n/**\n * `<pont2-username-field>`: `autocomplete=\"username\"`, name `username`,\n * no autocapitalisation or spellcheck. Normalised to trimmed lower case.\n * Rules: `minlength`, `maxlength`, then the pattern `^[a-z0-9_]*$`.\n *\n * @tag pont2-username-field\n */\nexport class UsernameField extends AuthField {\n protected defaultName() {\n return \"username\";\n }\n protected defaultLabel() {\n return \"Username\";\n }\n protected override defaultAutocomplete() {\n return \"username\";\n }\n protected override defaultPattern() {\n return /^[a-z0-9_]*$/.source;\n }\n protected override inputAttrs() {\n return { autocapitalize: \"none\", spellcheck: \"false\" };\n }\n override normalizeValue(raw: string) {\n return raw.trim().toLowerCase();\n }\n}\n\n/**\n * `<pont2-name-field>`: `autocomplete=\"name\"`, name `name`. Normalised by\n * trimming and collapsing whitespace. Rules: `minlength`, `maxlength`, then\n * the Unicode pattern `^[\\p{L} .'-]*$` (letters in any script).\n *\n * @tag pont2-name-field\n */\nexport class NameField extends AuthField {\n protected defaultName() {\n return \"name\";\n }\n protected defaultLabel() {\n return \"Name\";\n }\n protected override defaultAutocomplete() {\n return \"name\";\n }\n protected override defaultPattern() {\n return /^[\\p{L} .'-]*$/u.source;\n }\n override normalizeValue(raw: string) {\n return raw.trim().replace(/\\s+/g, \" \");\n }\n}\n\nexport const IDENTIFIER_KINDS = [\"email\", \"phone\", \"username\"] as const;\nexport type IdentifierKind = (typeof IDENTIFIER_KINDS)[number];\n\n/** `[\"email\",\"phone\"]` → \"Email or phone\"; three → \"Email, phone, or username\" (legacy copy). */\nexport function identifierLabel(kinds: readonly IdentifierKind[]): string {\n if (!kinds.length) return \"Identifier\";\n const list =\n kinds.length === 1\n ? kinds[0]\n : kinds.length === 2\n ? `${kinds[0]} or ${kinds[1]}`\n : `${kinds.slice(0, -1).join(\", \")}, or ${kinds[kinds.length - 1]}`;\n return list.charAt(0).toUpperCase() + list.slice(1);\n}\n\n/**\n * `<pont2-identifier-field>`: the sign-in identifier (email, phone or\n * username), submitted as `login_id` (the platform's contract).\n *\n * `identifiers` (attribute: a JSON array, as the platform writes it, or space- or\n * comma-separated; property: array) picks\n * the label (\"Email or phone\") and the input type: `email` or `tel` when it\n * is exactly one of those, `text` otherwise. `autocomplete=\"username\"`, which\n * is what password managers look for next to a password. Normalised to\n * trimmed lower case. Rule: `required` only (no format), as in the legacy kit.\n *\n * @tag pont2-identifier-field\n * @attr identifiers - e.g. `[\"email\",\"phone\"]` or \"email phone username\"\n */\nexport class IdentifierField extends AuthField {\n static override properties: PropertyDeclarations = {\n identifiers: {\n converter: {\n fromAttribute: (v: string | null) =>\n parseList(v).filter((k): k is IdentifierKind => IDENTIFIER_KINDS.includes(k as IdentifierKind)),\n },\n },\n };\n\n declare identifiers: IdentifierKind[];\n\n /** Design mode (core/design-mode.ts): sample identifiers when none are set. */\n protected readonly design = new DesignModeController(this);\n\n /**\n * The identifiers shown: `identifiers`, or email, username and phone in design mode when none are\n * set. At serve time the platform narrows the authored list to the app's login methods; the\n * designer narrows nothing, and \"Identifier\" would tell the author nothing (the legacy samples).\n */\n get shownIdentifiers(): IdentifierKind[] {\n const list = this.identifiers ?? [];\n return list.length === 0 && this.design.active ? [\"email\", \"username\", \"phone\"] : list;\n }\n\n constructor() {\n super();\n this.identifiers = [];\n }\n\n protected defaultName() {\n return \"login_id\";\n }\n protected defaultLabel() {\n return identifierLabel(this.shownIdentifiers);\n }\n protected override inputType() {\n const k = this.shownIdentifiers;\n return k.length === 1 && k[0] === \"email\" ? \"email\" : k.length === 1 && k[0] === \"phone\" ? \"tel\" : \"text\";\n }\n protected override defaultAutocomplete() {\n return \"username\";\n }\n protected override inputAttrs() {\n return { autocapitalize: \"none\", spellcheck: \"false\" };\n }\n protected override valueIssues() {\n return [];\n }\n override normalizeValue(raw: string) {\n return raw.trim().toLowerCase();\n }\n}\n\ndefine(\"pont2-email-field\", EmailField);\ndefine(\"pont2-phone-field\", PhoneField);\ndefine(\"pont2-username-field\", UsernameField);\ndefine(\"pont2-name-field\", NameField);\ndefine(\"pont2-identifier-field\", IdentifierField);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-email-field\": EmailField;\n \"pont2-phone-field\": PhoneField;\n \"pont2-username-field\": UsernameField;\n \"pont2-name-field\": NameField;\n \"pont2-identifier-field\": IdentifierField;\n }\n interface HTMLElementEventMap {\n \"pont2-field-validate\": CustomEvent<FieldValidateDetail>;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { icons } from \"../../core/icons\";\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\nimport { InputGroup, InputGroupAddon, inputGroupButton, inputGroupInput } from \"../../primitives/input-group/input-group\";\nimport type { InputOptions } from \"../../primitives/input/input\";\nimport { AuthField, fieldMessages, type FieldIssue } from \"./auth-field\";\n\n/* ==================================================================== */\n/* Password rules */\n/* ==================================================================== */\n\nexport type PasswordRuleName = \"uppercase\" | \"lowercase\" | \"number\" | \"special\";\n\n/** A rule: a named one, or your own `pattern`, each with an optional message. */\nexport type PasswordRule = { name: PasswordRuleName; error?: string } | { pattern: string; error?: string };\n\n/** The legacy named patterns (field.defs.ts). */\nexport const PASSWORD_RULE_PATTERNS: Record<PasswordRuleName, RegExp> = {\n uppercase: /[A-Z]/,\n lowercase: /[a-z]/,\n number: /[0-9]/,\n special: /[!@#$%^&*()_=+{}[\\]|\\\\;:\"<>,./?-]/,\n};\n\nexport const DEFAULT_PASSWORD_RULES: PasswordRule[] = [\n { name: \"uppercase\", error: \"Must contain an uppercase letter.\" },\n { name: \"lowercase\", error: \"Must contain a lowercase letter.\" },\n { name: \"number\", error: \"Must contain a number.\" },\n { name: \"special\", error: \"Must contain a special character.\" },\n];\n\nconst ruleRegExp = (r: PasswordRule): RegExp | null => {\n if (\"name\" in r) return PASSWORD_RULE_PATTERNS[r.name] ?? null;\n try {\n return new RegExp(r.pattern, \"u\");\n } catch {\n return null;\n }\n};\n\n/** `rules` attribute: JSON, e.g. `rules='[{\"name\":\"number\"},{\"pattern\":\".{12,}\",\"error\":\"12+ characters\"}]'`. */\nconst rulesConverter = {\n fromAttribute: (v: string | null): PasswordRule[] => {\n if (v == null) return DEFAULT_PASSWORD_RULES;\n try {\n const parsed = JSON.parse(v);\n return Array.isArray(parsed) ? parsed : DEFAULT_PASSWORD_RULES;\n } catch {\n return DEFAULT_PASSWORD_RULES;\n }\n },\n};\n\n/* ==================================================================== */\n/* SecretField: the show/hide toggle shared by password and confirm */\n/* ==================================================================== */\n\nexport const SECRET_FIELD_VARIANTS = [\"toggle\", \"simple\"] as const;\nexport type SecretFieldVariant = (typeof SECRET_FIELD_VARIANTS)[number];\n\n/**\n * A field whose value is secret: `type=\"password\"`, and with\n * `variant=\"toggle\"` (default) a show/hide button, built as shadcn builds it,\n * from InputGroup parts:\n *\n * ```html\n * <div data-pont2-input-group data-slot=\"input-group\" role=\"group\">\n * <input data-pont2-input data-pont2-input-group-input data-slot=\"input-group-control\" type=\"password\" …>\n * <div data-pont2-input-group-addon data-slot=\"input-group-addon\" data-align=\"inline-end\" role=\"group\">\n * <button data-pont2-button data-pont2-input-group-button data-variant=\"ghost\" data-size=\"icon-xs\"\n * aria-label=\"Show password\" aria-pressed=\"false\" aria-controls=\"…-input\"><svg/></button>\n * </div>\n * </div>\n * ```\n *\n * The toggle is a *toggle button* (`aria-pressed`, a stable name), the\n * WAI-ARIA pattern, rather than a button whose name flips. The value is\n * never normalised.\n *\n * @attr variant - toggle (default) | simple\n * @attr show-label - the toggle's accessible name (default: the `show_password` message, \"Show password\" in English)\n */\nexport abstract class SecretField extends AuthField {\n static override properties: PropertyDeclarations = {\n variant: { type: String },\n showLabel: { type: String, attribute: \"show-label\" },\n revealed: { type: Boolean, reflect: true },\n };\n\n declare variant: SecretFieldVariant;\n declare showLabel: string;\n /** Whether the value is currently shown as text. */\n declare revealed: boolean;\n\n /** Re-renders when the page's message table changes (the toggle's name). */\n protected readonly messagesController = new MessagesController(this);\n\n constructor() {\n super();\n this.variant = \"toggle\";\n this.showLabel = \"\";\n this.revealed = false;\n }\n\n protected override inputType() {\n return this.variant === \"toggle\" && this.revealed ? \"text\" : \"password\";\n }\n\n protected override inputAttrs() {\n return { autocapitalize: \"none\", spellcheck: \"false\" };\n }\n\n private toggle = () => {\n this.revealed = !this.revealed;\n // Keep the caret where it was (the input is re-rendered with a new type).\n void this.updateComplete.then(() => this.control?.focus());\n };\n\n protected override renderControl(o: InputOptions): TemplateResult {\n if (this.variant !== \"toggle\") return super.renderControl(o);\n return html`<div ${InputGroup.part({ \"data-disabled\": this.disabled })}>\n ${inputGroupInput(o)}\n <div ${InputGroupAddon.part({ \"data-align\": \"inline-end\" })}>\n ${inputGroupButton(\n {\n size: \"icon-xs\",\n disabled: this.disabled,\n attrs: {\n \"aria-label\": this.showLabel || msg(\"show_password\"),\n \"aria-pressed\": String(this.revealed),\n \"aria-controls\": this.controlId,\n },\n onClick: this.toggle,\n },\n this.revealed ? icons.eyeOff() : icons.eye(),\n )}\n </div>\n </div>`;\n }\n}\n\n/* ==================================================================== */\n/* PasswordField */\n/* ==================================================================== */\n\n/**\n * # `<pont2-password-field>`\n *\n * `autocomplete=\"current-password\"` by default (set `new-password` on\n * sign-up screens), name `password`. Rules: `minlength`, `maxlength`, then\n * **every** `rules` entry; all failing rules are listed (shadcn's FieldError\n * list). Defaults are the legacy four: uppercase, lowercase, number, special.\n *\n * `forgot` adds a \"Forgot your password?\" link-styled button beside the label\n * (shadcn's login block layout). It requests `forgot-event` through the\n * action protocol (`pont2-action` with `data: { forgot: true }`), exactly\n * like the auth buttons, and is busy until the response settles.\n *\n * @tag pont2-password-field\n * @attr rules - JSON array of `{ name }` / `{ pattern }` rules with optional `error`; `rules=\"[]\"` disables them\n * @attr forgot - show the forgot-password link\n * @attr forgot-label - its text (default \"Forgot your password?\")\n * @attr forgot-event - the action it requests\n * @fires pont2-action, pont2-action-success, pont2-action-error - from the forgot link\n */\nexport class PasswordField extends SecretField {\n static override properties: PropertyDeclarations = {\n rules: { converter: rulesConverter },\n forgot: { type: Boolean },\n forgotLabel: { type: String, attribute: \"forgot-label\" },\n forgotEvent: { type: String, attribute: \"forgot-event\" },\n };\n\n declare rules: PasswordRule[];\n declare forgot: boolean;\n declare forgotLabel: string;\n declare forgotEvent: string | undefined;\n\n protected readonly forgotAction = new ActionController(this);\n\n constructor() {\n super();\n this.rules = DEFAULT_PASSWORD_RULES;\n this.forgot = false;\n this.forgotLabel = \"\";\n this.forgotEvent = undefined;\n }\n\n protected defaultName() {\n return \"password\";\n }\n protected defaultLabel() {\n return \"Password\";\n }\n protected override defaultAutocomplete() {\n return \"current-password\";\n }\n\n protected override valueIssues(value: string): FieldIssue[] {\n const label = this.text;\n if (this.minlength && value.length < this.minlength) {\n return [{ type: \"minlength\", message: this.minlengthError || fieldMessages.minlength(label, this.minlength) }];\n }\n // A maxlength below minlength is raised to it, as in the legacy kit.\n const maxlength = this.maxlength ? Math.max(this.maxlength, this.minlength ?? 0) : undefined;\n if (maxlength && value.length > maxlength) {\n return [{ type: \"maxlength\", message: this.maxlengthError || fieldMessages.maxlength(label, maxlength) }];\n }\n const failing = (this.rules ?? []).filter(r => {\n const re = ruleRegExp(r);\n return re ? !re.test(value) : false;\n });\n if (!failing.length) return [];\n const messages = failing.map(r => r.error).filter((m): m is string => !!m);\n return messages.length\n ? messages.map(message => ({ type: \"rule\" as const, message }))\n : [{ type: \"rule\", message: this.formatError || fieldMessages.format(label) }];\n }\n\n protected override renderLabel(): TemplateResult | typeof nothing {\n if (!this.forgot) return super.renderLabel();\n const busy = this.forgotAction.busy;\n return html`<div data-pont2-auth-field-label-row>\n ${super.renderLabel()}\n ${button(\n {\n variant: \"link\",\n size: \"sm\",\n slot: \"field-forgot\",\n disabled: busy,\n focusableWhenDisabled: busy,\n attrs: { \"data-event\": this.forgotEvent, \"data-loading\": busy, \"aria-busy\": busy ? \"true\" : null },\n onClick: () => this.forgotAction.request(this.forgotEvent, { forgot: true, name: this.fieldName }),\n },\n this.forgotLabel || \"Forgot your password?\",\n )}\n </div>`;\n }\n}\n\n/* ==================================================================== */\n/* ConfirmField */\n/* ==================================================================== */\n\n/**\n * # `<pont2-confirm-field>`: repeat a password\n *\n * Valid when its value equals the `pair` field's (default: the first\n * `pont2-password-field` in the same form, else in the document). It\n * re-validates as either changes. `autocomplete=\"new-password\"`, name\n * `confirm`. Unlike the legacy kit, the pair's value is never put in an event.\n *\n * @tag pont2-confirm-field\n * @attr pair - CSS selector of the field to match (default \"pont2-password-field\")\n * @attr match-error - default \"Passwords do not match.\"\n */\nexport class ConfirmField extends SecretField {\n static override properties: PropertyDeclarations = {\n pair: { type: String },\n matchError: { type: String, attribute: \"match-error\" },\n };\n\n declare pair: string;\n declare matchError: string;\n\n private scope: Document | HTMLFormElement | null = null;\n\n constructor() {\n super();\n this.pair = \"pont2-password-field\";\n this.matchError = \"\";\n }\n\n protected defaultName() {\n return \"confirm\";\n }\n protected defaultLabel() {\n return \"Confirm Password\";\n }\n protected override defaultAutocomplete() {\n return \"new-password\";\n }\n\n /** The element being matched (a pont2 field or any element with `.value`). */\n get pairElement(): (Element & { value?: string }) | null {\n const root = this.closest(\"form\") ?? document;\n return this.pair ? root.querySelector(this.pair) : null;\n }\n\n protected override valueIssues(value: string): FieldIssue[] {\n const other = this.pairElement?.value ?? \"\";\n return value === other ? [] : [{ type: \"match\", message: this.matchError || \"Passwords do not match.\" }];\n }\n\n // Re-validate when the pair changes (its input events bubble through the form).\n private onScopeInput = (e: Event) => {\n const pair = this.pairElement;\n if (pair && e.target instanceof Node && pair.contains(e.target)) this.requestUpdate();\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.scope = this.closest(\"form\") ?? document;\n this.scope.addEventListener(\"input\", this.onScopeInput);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.scope?.removeEventListener(\"input\", this.onScopeInput);\n this.scope = null;\n }\n}\n\ndefine(\"pont2-password-field\", PasswordField);\ndefine(\"pont2-confirm-field\", ConfirmField);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-password-field\": PasswordField;\n \"pont2-confirm-field\": ConfirmField;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { define } from \"../../core/names\";\nimport type { InputOTP } from \"../../primitives/input-otp/input-otp\";\nimport { REGEXP_ONLY_DIGITS } from \"../../primitives/input-otp/otp\";\nimport type { InputOptions } from \"../../primitives/input/input\";\nimport { AuthField, type FieldIssue } from \"../auth-field/auth-field\";\nimport { otpGroups } from \"../input-otp/input-otp\";\n\n/** The legacy `pont-otp` layouts, kept for render-spec parity. */\nexport const OTP_LAYOUTS = [\"digits_only\", \"simple\", \"with_separator\", \"with_spacing\"] as const;\nexport type OtpLayout = (typeof OTP_LAYOUTS)[number];\n\n/**\n * # `<pont2-otp-field>`: a verification-code field\n *\n * ```html\n * <form>\n * <pont2-otp-field label=\"Verification code\" length=\"6\" layout=\"with_separator\" required></pont2-otp-field>\n * <pont2-submit-button event=\"verify_code\" label=\"Verify\"></pont2-submit-button>\n * </form>\n * ```\n *\n * **Is a Field** (`extends AuthField extends Field`) holding the Input OTP\n * primitive, as shadcn composes it (`<Field><FieldLabel/><InputOTP/>\n * <FieldDescription/></Field>`):\n *\n * ```html\n * <pont2-otp-field data-pont2-field data-slot=\"field\">\n * <label data-pont2-field-label for=\"…-input\">Verification code</label>\n * <pont2-prim-input-otp maxlength=\"6\" name=\"code\" input-id=\"…-input\" …>\n * <div data-pont2-input-otp-group …> <pont2-prim-input-otp-slot index=\"0\"> …×3 </div>\n * <div data-pont2-input-otp-separator …><svg/></div>\n * <div data-pont2-input-otp-group …> …×3 </div>\n * <div data-pont2-input-otp-input-wrapper><input autocomplete=\"one-time-code\" name=\"code\" …></div>\n * </pont2-prim-input-otp>\n * <div data-pont2-field-error role=\"alert\">Please enter the complete verification code.</div>\n * </pont2-otp-field>\n * ```\n *\n * The Input OTP is rendered as its **primitive element** (it has behaviour);\n * its groups and separators are parts, and its slots are elements (kit/input-otp).\n * Everything an auth field does applies: the one native\n * `autocomplete=\"one-time-code\"` input is the form control, validation is\n * native (`required`, then *incomplete*), errors are inline.\n *\n * **Auto-submit** (`auto-submit`): when every slot is filled,\n * - with `event`: requests it through the action protocol, with the same\n * `data: { form, formData }` shape as the submit button (so one flow\n * handler serves both);\n * - without `event`: submits the enclosing form (`form.requestSubmit()`), so\n * its submit button handles the request.\n *\n * @tag pont2-otp-field\n * @attr length - number of characters (default 6)\n * @attr layout - digits_only (one group, default) | simple (2 groups) | with_separator (3 groups) | with_spacing (one slot per group)\n * @attr group-size, separator - explicit grouping (override `layout`)\n * @attr pattern - per-character regex source (default digits; `pattern=\"\"` accepts anything)\n * @attr auto-submit - submit when complete\n * @attr event - the action requested on auto-submit\n * @attr incomplete-error - default \"Please enter the complete verification code.\"\n * @fires pont2-complete - from the Input OTP, `{ value }`\n * @fires pont2-action, pont2-action-success, pont2-action-error - on auto-submit with `event`\n */\nexport class OtpField extends AuthField {\n static override properties: PropertyDeclarations = {\n length: { type: Number },\n layout: { type: String },\n groupSize: { type: Number, attribute: \"group-size\" },\n separator: { type: Boolean },\n autoSubmit: { type: Boolean, attribute: \"auto-submit\" },\n event: { type: String },\n incompleteError: { type: String, attribute: \"incomplete-error\" },\n };\n\n declare length: number;\n declare layout: OtpLayout;\n declare groupSize: number | undefined;\n declare separator: boolean | undefined;\n declare autoSubmit: boolean;\n declare event: string | undefined;\n declare incompleteError: string;\n\n protected readonly action = new ActionController(this);\n\n constructor() {\n super();\n this.length = 6;\n this.layout = \"digits_only\";\n this.groupSize = undefined;\n this.separator = undefined;\n this.autoSubmit = false;\n this.event = undefined;\n this.incompleteError = \"\";\n this.pattern = REGEXP_ONLY_DIGITS;\n this.requiredError = \"\";\n // The input lives inside the Input OTP; its events bubble to us.\n this.addEventListener(\"input\", e => {\n if (e.target === this.control) this.onInput(e);\n });\n this.addEventListener(\"change\", e => {\n if (e.target === this.control) this.onChange();\n });\n this.addEventListener(\"pont2-complete\", e => this.onComplete(e.detail.value));\n }\n\n protected defaultName() {\n return \"code\";\n }\n protected defaultLabel() {\n return \"Code\";\n }\n\n /** The Input OTP primitive element. */\n get otp(): InputOTP | null {\n return this.querySelector(\"pont2-prim-input-otp\");\n }\n\n override get control(): HTMLInputElement | null {\n return this.otp?.input ?? null;\n }\n\n /** `true` while an auto-submit request is pending. */\n get busy(): boolean {\n return this.action.busy;\n }\n\n protected override computeIssues(): FieldIssue[] {\n if (this.disabled) return [];\n const value = this.current;\n if (!value) {\n return this.required ? [{ type: \"required\", message: this.requiredError || \"Code is required.\" }] : [];\n }\n if (this.validation === \"simple\") return [];\n return this.valueIssues(value);\n }\n\n protected override valueIssues(value: string): FieldIssue[] {\n return value.length === this.length\n ? []\n : [{ type: \"incomplete\", message: this.incompleteError || \"Please enter the complete verification code.\" }];\n }\n\n /** Group size and separators from `layout`, unless set explicitly. */\n get grouping(): { size: number; separator: boolean } {\n const n = this.length;\n const byLayout: Record<OtpLayout, { size: number; separator: boolean }> = {\n digits_only: { size: 0, separator: false },\n simple: { size: Math.ceil(n / 2), separator: true },\n with_separator: { size: Math.ceil(n / 3), separator: true },\n with_spacing: { size: 1, separator: false },\n };\n const base = byLayout[this.layout] ?? byLayout.digits_only;\n return { size: this.groupSize ?? base.size, separator: this.separator ?? base.separator };\n }\n\n private onComplete(value: string): void {\n this.setCurrent(value);\n if (!this.autoSubmit) return;\n const form = this.control?.form ?? null;\n if (this.event) {\n const formData = form ? new FormData(form) : new FormData();\n if (!form) formData.set(this.fieldName, value);\n this.action.request(this.event, { form, formData });\n } else {\n form?.requestSubmit();\n }\n }\n\n protected override onReset = () => {\n setTimeout(() => {\n const otp = this.otp;\n if (otp) otp.value = this.defaultValue;\n this.shown = false;\n this.current = this.defaultValue;\n });\n };\n\n protected override renderLabel(): TemplateResult | typeof nothing {\n // The label is optional for a code field; the input is then named by aria-label.\n return this.label ? super.renderLabel() : nothing;\n }\n\n protected override renderControl(o: InputOptions): TemplateResult {\n const { size, separator } = this.grouping;\n return html`<pont2-prim-input-otp\n input-id=${o.id!}\n name=${o.name ?? nothing}\n maxlength=${this.length}\n pattern=${this.pattern}\n value=${this.defaultValue || nothing}\n ?required=${this.required}\n ?disabled=${this.disabled}\n aria-label=${this.label ? nothing : \"Verification code\"}\n aria-describedby=${o.describedBy ?? nothing}\n aria-invalid=${o.invalid ? \"true\" : nothing}\n aria-busy=${this.busy ? \"true\" : nothing}\n >${otpGroups(this.length, size, separator)}</pont2-prim-input-otp\n >`;\n }\n}\n\ndefine(\"pont2-otp-field\", OtpField);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-otp-field\": OtpField;\n }\n}\n","import { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\n\n/**\n * # `<pont2-otp-resend>`: \"Resend code in 42s\", then a resend link\n *\n * ```html\n * <pont2-otp-resend event=\"resend_code\" duration=\"60\"></pont2-otp-resend>\n * ```\n *\n * ```html\n * <pont2-otp-resend data-pont2-otp-resend data-slot=\"otp-resend\">\n * <span data-slot=\"otp-resend-countdown\" role=\"timer\">Resend code in 42s</span>\n * ⟶ when it reaches 0:\n * <button data-pont2-button data-variant=\"link\" data-slot=\"otp-resend-button\" type=\"button\">Resend code</button>\n * </pont2-otp-resend>\n * ```\n *\n * The root is a plain row, so this is a new-name composite on `HostElement`\n * (06-higher-layers: layout renderers). The button is the button primitive's\n * part and requests `event` through the action protocol (`data: { resend:\n * true }`); the countdown restarts when it is pressed, as in the legacy kit.\n *\n * The countdown is `role=\"timer\"` (not announced every second). When it\n * ends, the button appears; focus is not moved.\n *\n * @tag pont2-otp-resend\n * @attr duration - seconds before the button appears (default 60; 0 shows it at once)\n * @attr event - the action requested on press\n * @attr label - button text (default \"Resend code\")\n * @attr countdown-text - text before the seconds (default \"Resend code in \")\n * @cssprop --pont2-otp-resend-fg - the row's text (default muted-foreground)\n * @cssprop --pont2-otp-resend-button-fg, --pont2-otp-resend-button-fg-hover - the link (default the row's colour; primary on hover)\n * @fires pont2-action, pont2-action-success, pont2-action-error\n */\nexport class OtpResend extends HostElement {\n static override identity = \"otp-resend\";\n static override slotName = \"otp-resend\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n duration: { type: Number },\n event: { type: String },\n label: { type: String },\n countdownText: { type: String, attribute: \"countdown-text\" },\n remaining: { state: true },\n };\n\n declare duration: number;\n declare event: string | undefined;\n declare label: string;\n declare countdownText: string;\n /** Seconds left. */\n declare remaining: number;\n\n protected readonly action = new ActionController(this);\n private timer: ReturnType<typeof setInterval> | undefined;\n\n constructor() {\n super();\n this.duration = 60;\n this.event = undefined;\n this.label = \"\";\n this.countdownText = \"\";\n this.remaining = 0;\n }\n\n /** Starts (or restarts) the countdown from `duration`. */\n restart(): void {\n this.stop();\n this.remaining = Math.max(0, Math.floor(this.duration || 0));\n if (this.remaining > 0) {\n this.timer = setInterval(() => {\n this.remaining = Math.max(0, this.remaining - 1);\n if (!this.remaining) this.stop();\n }, 1000);\n }\n }\n\n private stop(): void {\n if (this.timer !== undefined) clearInterval(this.timer);\n this.timer = undefined;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.restart();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.stop();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"duration\") && this.hasUpdated) this.restart();\n }\n\n private press = () => {\n this.action.request(this.event, { resend: true });\n this.restart();\n };\n\n override render() {\n if (this.remaining > 0) {\n return html`<span data-slot=\"otp-resend-countdown\" role=\"timer\"\n >${this.countdownText || \"Resend code in \"}${this.remaining}s</span\n >`;\n }\n const busy = this.action.busy;\n return button(\n {\n variant: \"link\",\n slot: \"otp-resend-button\",\n disabled: busy,\n focusableWhenDisabled: busy,\n attrs: { \"data-event\": this.event, \"data-loading\": busy, \"aria-busy\": busy ? \"true\" : null },\n onClick: this.press,\n },\n this.label || \"Resend code\",\n );\n }\n}\n\ndefine(\"pont2-otp-resend\", OtpResend);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-otp-resend\": OtpResend;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { safeExternalUrl, safeUrl } from \"../../core/url\";\nimport { button } from \"../../primitives/button/button\";\n\nexport const LINK_ALIGNS = [\"start\", \"center\", \"end\"] as const;\nexport type LinkAlign = (typeof LINK_ALIGNS)[number];\nexport const LINK_SERVICES = [\"auth\", \"other\"] as const;\nexport type LinkService = (typeof LINK_SERVICES)[number];\n\n/**\n * # `<pont2-link>`: \"Don't have an account? Sign up\"\n *\n * ```html\n * <pont2-link prompt=\"Don't have an account?\" label=\"Sign up\" event=\"goto_signup\"></pont2-link>\n * <pont2-link label=\"Privacy policy\" href=\"/privacy\" target=\"_blank\"></pont2-link>\n * ```\n *\n * shadcn's login blocks write this as `<div class=\"text-center text-sm\">\n * Don't have an account? <a class=\"underline underline-offset-4\">Sign\n * up</a></div>`. pont2's host is that row; the link is the button\n * primitive's part:\n *\n * - **with `href`**: a real `<a href>` (navigation, middle-click, \"open in\n * new tab\" work), styled as a link. Only an http(s) URL, absolute or\n * relative, is linked (`safeUrl`): a `javascript:`, `data:` or other\n * scheme renders **nothing** and the row is hidden (`data-invalid-href`),\n * because an `href` from a render spec is data, not trusted markup;\n * - **otherwise**: a `<button type=\"button\">` that requests `event` through\n * the action protocol (`data: { service }`), busy until it settles, like\n * the auth buttons. The legacy `service=\"other\"` (no auth call) maps to:\n * don't set `event`, or don't respond.\n *\n * @tag pont2-link\n * @attr label - link text (default \"Link\")\n * @attr prompt - text before the link\n * @attr event - the action requested on press (button form)\n * @attr service - auth (default) | other: passed in the request's data\n * @attr href, target, rel - render a real link instead (http(s) only; anything else renders nothing)\n * @attr align - start | center (default) | end\n * @attr disabled, loading\n * @cssprop --pont2-link-fg - the row's text (default muted-foreground)\n * @cssprop --pont2-link-button-fg, --pont2-link-button-fg-hover - the link (default the row's colour; primary on hover)\n * @fires pont2-action, pont2-action-success, pont2-action-error\n */\nexport class Link extends HostElement {\n static override identity = \"link\";\n static override slotName = \"link\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n label: { type: String },\n prompt: { type: String },\n event: { type: String },\n service: { type: String },\n href: { type: String },\n target: { type: String },\n rel: { type: String },\n align: { type: String },\n disabled: { type: Boolean, reflect: true },\n loading: { type: Boolean, reflect: true },\n };\n\n declare label: string;\n declare prompt: string;\n declare event: string | undefined;\n declare service: LinkService;\n declare href: string | undefined;\n declare target: string | undefined;\n declare rel: string | undefined;\n declare align: LinkAlign;\n declare disabled: boolean;\n declare loading: boolean;\n\n protected readonly action = new ActionController(this);\n\n constructor() {\n super();\n this.label = \"\";\n this.prompt = \"\";\n this.event = undefined;\n this.service = \"auth\";\n this.href = undefined;\n this.target = undefined;\n this.rel = undefined;\n this.align = \"center\";\n this.disabled = false;\n this.loading = false;\n }\n\n get busy(): boolean {\n return this.loading || this.action.busy;\n }\n\n /** The native `<a>` or `<button>`. */\n get control(): HTMLAnchorElement | HTMLButtonElement | null {\n return this.querySelector(\"[data-pont2-button]\");\n }\n\n /** `href` is set but is not an http(s) URL: the link renders nothing. */\n protected get invalidHref(): boolean {\n return this.href !== undefined && safeUrl(this.href) === null;\n }\n\n protected override willUpdate(_changed: PropertyValues): void {\n this.setData(\"align\", this.align || \"center\");\n this.setData(\"invalid-href\", this.invalidHref);\n }\n\n override render() {\n if (this.invalidHref) return nothing;\n const busy = this.busy;\n return html`${this.prompt ? html`<span data-slot=\"link-prompt\">${this.prompt}</span>` : nothing}${button(\n {\n variant: \"link\",\n slot: \"link-button\",\n href: this.href,\n target: this.target,\n rel: this.rel ?? (this.target === \"_blank\" ? \"noopener noreferrer\" : undefined),\n disabled: this.disabled || busy,\n focusableWhenDisabled: busy && !this.disabled,\n attrs: { \"data-event\": this.event, \"data-service\": this.service, \"data-loading\": busy, \"aria-busy\": busy ? \"true\" : null },\n onClick: this.href === undefined ? () => this.action.request(this.event, { service: this.service }) : undefined,\n },\n this.label || \"Link\",\n )}`;\n }\n}\n\ndefine(\"pont2-link\", Link);\n\n/**\n * # `<pont2-external-link>`: a page outside the flow, in a new tab\n *\n * ```html\n * <pont2-external-link label=\"Privacy policy\" href=\"{{consent_privacy_policy_url}}\"></pont2-external-link>\n * ```\n *\n * The consent screen's links to an app's privacy policy, terms or homepage. It\n * is `pont2-link`'s `href` form with the rules of the legacy\n * `pont-external-link` (carry-over §7):\n *\n * - only an **absolute** http(s) URL with a host renders (`safeExternalUrl`).\n * The href is usually a server placeholder filled from the app's settings,\n * so empty, still a placeholder, relative or any other scheme renders\n * **nothing** and the row is hidden (`data-invalid-href`);\n * - it always opens a new tab, with `rel=\"noopener noreferrer\"`;\n * - `label` falls back to the URL;\n * - it never requests an action and fires no event, so it is safe on screens\n * that are not an auth flow.\n *\n * Styled by `pont2-link`'s recipe and tokens, so the two read as one kind of\n * thing on a screen.\n *\n * @tag pont2-external-link\n * @attr href - absolute http(s) URL; anything else renders nothing\n * @attr label - link text (default: the URL)\n * @attr prompt - text before the link\n * @attr align - start | center (default) | end\n */\nexport class ExternalLink extends Link {\n protected override get invalidHref(): boolean {\n return safeExternalUrl(this.href) === null;\n }\n\n override render() {\n const href = safeExternalUrl(this.href);\n if (!href) return nothing;\n return html`${this.prompt ? html`<span data-slot=\"link-prompt\">${this.prompt}</span>` : nothing}${button(\n { variant: \"link\", slot: \"link-button\", href, target: \"_blank\", rel: \"noopener noreferrer\" },\n this.label?.trim() || href,\n )}`;\n }\n}\n\ndefine(\"pont2-external-link\", ExternalLink);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-link\": Link;\n \"pont2-external-link\": ExternalLink;\n }\n}\n","import { type PropertyDeclarations } from \"lit\";\n\nimport { define } from \"../../core/names\";\nimport { FieldSeparator } from \"../../primitives/field/field\";\n\n/**\n * # `<pont2-divider>`: \"Or continue with\"\n *\n * ```html\n * <pont2-divider label=\"Or continue with\"></pont2-divider>\n * ```\n *\n * **Is a FieldSeparator** (`extends FieldSeparator`), as shadcn's login\n * blocks write it (`<FieldSeparator>Or continue with</FieldSeparator>`): one\n * node, the rule halves drawn by the primitive's `::before`/`::after`, the\n * label a text node. Without a label it is a plain rule\n * (`data-content=\"false\"`).\n *\n * @tag pont2-divider\n * @attr label - text in the middle\n */\nexport class Divider extends FieldSeparator {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n label: { type: String },\n };\n\n declare label: string;\n\n constructor() {\n super();\n this.label = \"\";\n }\n\n override render() {\n return this.label;\n }\n}\n\ndefine(\"pont2-divider\", Divider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-divider\": Divider;\n }\n}\n","import { html, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { ShellElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport type TitleLevel = \"1\" | \"2\" | \"3\" | \"4\";\nexport type TextAlign = \"auto\" | \"start\" | \"center\" | \"end\";\n\n/**\n * Title and subtitle: a heading and its supporting line.\n *\n * shadcn has no typography *components* (its typography page is classes), and\n * its login blocks write `<h1 class=\"text-2xl font-bold\">Welcome back</h1>\n * <p class=\"text-muted-foreground text-balance\">Login to your Acme Inc\n * account</p>`. pont2 keeps the **native** `<h1>`–`<h4>` / `<p>` (document\n * outline, heading navigation, reader modes), so these are Tier 3 shells:\n * the host has no box (`display: contents`), the native element is styled.\n *\n * The text comes from `content` (the legacy attribute, and what render\n * specs emit); a composite owns its children.\n */\nabstract class TextShell extends ShellElement {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n content: { type: String },\n align: { type: String },\n };\n\n declare content: string;\n declare align: TextAlign;\n\n constructor() {\n super();\n this.content = \"\";\n this.align = \"auto\";\n }\n\n override get control(): HTMLElement | null {\n return this.firstElementChild as HTMLElement | null;\n }\n\n}\n\n/**\n * # `<pont2-title>`\n *\n * ```html\n * <pont2-title level=\"1\" content=\"Welcome back\"></pont2-title>\n * → <pont2-title data-pont2-shell><h1 data-pont2-title data-level=\"1\" data-align=\"auto\">Welcome back</h1></pont2-title>\n * ```\n *\n * Sizes follow shadcn's auth blocks: level 1 is the block heading (`text-2xl\n * font-bold`), 2–4 step down (`text-xl`/`text-lg`/`text-base`, semibold).\n *\n * @tag pont2-title\n * @attr level - 1 (default) | 2 | 3 | 4: the native heading level\n * @attr content - the heading text\n * @attr align - auto (default: inherit) | start | center | end\n * @cssprop --pont2-title-fg, --pont2-title-font-weight - colour and weight (default foreground, semibold)\n * @cssprop --pont2-title-h1-font-size … --pont2-title-h4-font-size - size per level (default text-2xl, -xl, -lg, -base)\n * @cssprop --pont2-title-h1-font-weight - level 1 weight (default the title weight, else bold)\n */\nexport class Title extends TextShell {\n static override properties: PropertyDeclarations = {\n level: { type: String },\n };\n\n declare level: TitleLevel;\n\n constructor() {\n super();\n this.level = \"1\";\n }\n\n override render(): TemplateResult {\n const level = ([\"1\", \"2\", \"3\", \"4\"] as const).includes(this.level) ? this.level : \"1\";\n const a = this.align || \"auto\";\n const c = this.content;\n switch (level) {\n case \"2\":\n return html`<h2 data-pont2-title data-level=\"2\" data-align=${a}>${c}</h2>`;\n case \"3\":\n return html`<h3 data-pont2-title data-level=\"3\" data-align=${a}>${c}</h3>`;\n case \"4\":\n return html`<h4 data-pont2-title data-level=\"4\" data-align=${a}>${c}</h4>`;\n default:\n return html`<h1 data-pont2-title data-level=\"1\" data-align=${a}>${c}</h1>`;\n }\n }\n}\n\n/**\n * # `<pont2-subtitle>`\n *\n * ```html\n * <pont2-subtitle content=\"Login to your Acme Inc account\"></pont2-subtitle>\n * → <pont2-subtitle data-pont2-shell><p data-pont2-subtitle data-align=\"auto\">…</p></pont2-subtitle>\n * ```\n *\n * shadcn's block description: `text-muted-foreground text-balance` (text-sm).\n *\n * @tag pont2-subtitle\n * @attr content, align - as Title\n * @cssprop --pont2-subtitle-fg, --pont2-subtitle-font-size - colour and size (default muted-foreground, text-sm)\n */\nexport class Subtitle extends TextShell {\n override render(): TemplateResult {\n return html`<p data-pont2-subtitle data-align=${this.align || \"auto\"}>${this.content}</p>`;\n }\n}\n\ndefine(\"pont2-title\", Title);\ndefine(\"pont2-subtitle\", Subtitle);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-title\": Title;\n \"pont2-subtitle\": Subtitle;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\n\nimport { parseList } from \"../../core/attrs\";\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { define } from \"../../core/names\";\nimport type { ButtonSize, ButtonVariant } from \"../../primitives/button/button\";\nimport { Field } from \"../../primitives/field/field\";\nimport type { AuthButtonContent, AuthButtonIconAlign } from \"../auth-button/auth-button\";\nimport \"../auth-button/auth-button\";\nimport { AUTH_PROVIDERS, type AuthProvider } from \"../auth-button/providers\";\n\n/** Per-provider settings that override the field-wide ones (the legacy `overrides`). */\nexport interface ProviderOverride {\n provider: AuthProvider;\n label?: string;\n prompt?: string;\n event?: string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n content?: AuthButtonContent;\n iconAlign?: AuthButtonIconAlign;\n disabled?: boolean;\n loading?: boolean;\n}\n\n/** The legacy column layouts of a 12-column grid, by provider count. */\nexport type ProviderColumns = \"one\" | \"three\" | \"four\" | \"two-three\" | \"three-four\";\n\n/** 1–2 → one per row; multiples of 3 → three; 5 → 2 + 3; 7 → 3 + 4; otherwise four (legacy rule). */\nexport function providerColumns(count: number): ProviderColumns {\n if (count < 3) return \"one\";\n if (count % 3 === 0) return \"three\";\n if (count === 5) return \"two-three\";\n if (count === 7) return \"three-four\";\n return \"four\";\n}\n\n/** The legacy default event per provider: the platform's OAuth sign-in action. */\nexport const providerEvent = (p: AuthProvider) => `signin_with_oauth(${p})`;\n\nconst listConverter = {\n fromAttribute: (v: string | null): AuthProvider[] =>\n parseList(v).filter((p): p is AuthProvider => AUTH_PROVIDERS.includes(p as AuthProvider)),\n};\n\nconst jsonArray = {\n fromAttribute: (v: string | null): ProviderOverride[] => {\n try {\n const parsed = JSON.parse(v ?? \"[]\");\n return Array.isArray(parsed) ? parsed : [];\n } catch {\n return [];\n }\n },\n};\n\n/**\n * # `<pont2-provider-field>`: the \"continue with…\" button grid\n *\n * ```html\n * <pont2-provider-field providers=\"apple google meta\"></pont2-provider-field>\n * <pont2-provider-field providers='[\"google\",\"github\"]'></pont2-provider-field> (the form the platform injects)\n * ```\n *\n * **Is a Field** (`extends Field`), as in shadcn's login blocks (`<Field\n * className=\"grid grid-cols-3 gap-4\">` holding the buttons), laid out on the\n * legacy kit's 12-column grid (`data-columns`, see `providerColumns`). It\n * renders one **`<pont2-provider-button>` element** per provider:\n *\n * ```html\n * <pont2-provider-field data-pont2-field data-slot=\"field\" role=\"group\" data-columns=\"three\">\n * <pont2-provider-button provider=\"apple\" content=\"icon\" event=\"signin_with_oauth(apple)\" data-pont2-shell>\n * <button data-pont2-button data-variant=\"outline\" data-provider=\"apple\" aria-label=\"Continue with Apple\">…</button>\n * </pont2-provider-button>\n * …\n * </pont2-provider-field>\n * ```\n *\n * Nesting kit elements is normally forbidden in kit templates. This is the\n * documented exception (docs/10-primitives-and-kit.md §5): each button is an\n * **independent, stateful** element (its own busy state and action request),\n * repeated per item, and its host is `display: contents`, so the grid items\n * are the native buttons and the DOM is shadcn's.\n *\n * Field-wide settings apply to every button; `overrides` (JSON attribute or\n * array property) replaces them for one provider. With more than two\n * providers the buttons default to icon-only (legacy).\n *\n * @tag pont2-provider-field\n * @attr providers - e.g. \"apple google github\" (duplicates and unknown names are dropped)\n * @attr event - one event for every button (default: `signin_with_oauth(<provider>)` each)\n * @attr variant, size, content, icon-align, prompt, label, disabled, loading - passed to every button\n * @attr overrides - JSON array of per-provider settings, e.g. `[{\"provider\":\"google\",\"label\":\"Google Workspace\"}]`\n */\nexport class ProviderField extends Field {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n providers: { converter: listConverter },\n overrides: { converter: jsonArray },\n event: { type: String },\n variant: { type: String },\n size: { type: String },\n content: { type: String },\n iconAlign: { type: String, attribute: \"icon-align\" },\n prompt: { type: String },\n label: { type: String },\n loading: { type: Boolean },\n };\n\n declare providers: AuthProvider[];\n declare overrides: ProviderOverride[];\n declare event: string | undefined;\n declare variant: ButtonVariant | undefined;\n declare size: ButtonSize | undefined;\n declare content: AuthButtonContent | undefined;\n declare iconAlign: AuthButtonIconAlign | undefined;\n declare prompt: string | undefined;\n declare label: string | undefined;\n declare loading: boolean;\n\n constructor() {\n super();\n this.providers = [];\n this.overrides = [];\n this.event = undefined;\n this.variant = undefined;\n this.size = undefined;\n this.content = undefined;\n this.iconAlign = undefined;\n this.prompt = undefined;\n this.label = undefined;\n this.loading = false;\n }\n\n /** Design mode (core/design-mode.ts): sample providers when none are set. */\n protected readonly design = new DesignModeController(this);\n\n /**\n * The providers actually rendered: known names, first occurrence only. In design mode with none\n * set, three samples (google, apple, github): at serve time the platform injects the app's\n * providers, and three is where the grid switches to icon-only buttons, the arrangement most\n * real screens end up with (the legacy samples).\n */\n get list(): AuthProvider[] {\n const list = [...new Set((this.providers ?? []).filter(p => AUTH_PROVIDERS.includes(p)))];\n return list.length === 0 && this.design.active ? ([\"google\", \"apple\", \"github\"] as AuthProvider[]) : list;\n }\n\n /** The rendered `<pont2-provider-button>` elements. */\n get buttons(): HTMLElementTagNameMap[\"pont2-provider-button\"][] {\n return Array.from(this.querySelectorAll(\":scope > pont2-provider-button\"));\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.setData(\"columns\", providerColumns(this.list.length));\n }\n\n override render() {\n const list = this.list;\n // The first override for a provider wins, as in the legacy kit (a later duplicate is ignored).\n const overrides = new Map<string, ProviderOverride>();\n for (const o of this.overrides ?? []) if (!overrides.has(o.provider)) overrides.set(o.provider, o);\n const iconOnly = list.length > 2 ? \"icon\" : undefined;\n return repeat(\n list,\n p => p,\n p => {\n const o = overrides.get(p) ?? ({ provider: p } as ProviderOverride);\n const opt = <T>(v: T | undefined) => (v === undefined || v === null || v === \"\" ? nothing : v);\n return html`<pont2-provider-button\n provider=${p}\n event=${o.event ?? this.event ?? providerEvent(p)}\n variant=${opt(o.variant ?? this.variant)}\n size=${opt(o.size ?? this.size)}\n content=${opt(o.content ?? this.content ?? iconOnly)}\n icon-align=${opt(o.iconAlign ?? this.iconAlign)}\n prompt=${opt(o.prompt ?? this.prompt)}\n label=${opt(o.label ?? this.label)}\n ?disabled=${!!(o.disabled || this.disabled)}\n ?loading=${!!(o.loading || this.loading)}\n ></pont2-provider-button>`;\n },\n );\n }\n}\n\ndefine(\"pont2-provider-field\", ProviderField);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-provider-field\": ProviderField;\n }\n}\n","import { html, svg } from \"lit\";\n\n/**\n * The Pontive logo (mark + wordmark), the same geometry as the legacy\n * watermark. Pontive's own asset, so it is inlined (no image request) and the\n * mark and wordmark can be coloured separately in CSS.\n */\nexport const PONTIVE_MARK = svg`<polygon points=\"113.15,120.26 72.47,190.69 72.46,190.71 61.31,210.02 34.66,256.16 0,196.08 78.48,60.19\" /><polygon points=\"256.23,117.67 179.4,250.76 107.12,250.76 72.46,190.71 72.47,190.69 144.73,190.69 186.89,117.67 153.68,60.07 78.48,60.07 34.65,0 188.35,0\" />`;\nexport const PONTIVE_WORDMARK = svg`<path d=\"M305.95,36.62h76.01c37.22,0,63.16,24.13,63.16,58.64c0,35.19-25.94,59.77-63.16,59.77h-40.83v62.03h-35.19V36.62z M381.51,123.46c16.24,0,27.52-11.28,27.52-27.74c0-16.24-11.28-27.52-27.52-27.52h-40.37v55.26H381.51z\" /><path d=\"M454.59,143.76c0-45.11,31.58-75.79,76.91-75.79c45.34,0,76.91,30.68,76.91,75.79c0,45.34-31.58,75.79-76.91,75.79C486.17,219.54,454.59,189.09,454.59,143.76z M531.51,187.74c24.13,0,41.05-17.59,41.05-43.98c0-26.16-16.92-43.98-41.05-43.98c-23.91,0-40.83,17.82-40.83,43.98C490.68,170.15,507.6,187.74,531.51,187.74z\" /><path d=\"M635.48,70.45h34.96v18.72c3.61-8.8,17.14-21.2,40.37-21.2c33.38,0,59.1,25.71,59.1,63.83v85.26h-35.19v-84.58c0-19.85-12.86-33.16-32.03-33.16c-19.17,0-32.03,13.31-32.03,33.16v84.58h-35.19V70.45z\" /><path d=\"M815.02,102.03h-27.07V70.45h27.07V36.62h35.19v33.83h26.84v31.58h-26.84v115.03h-35.19V102.03z\" /><path d=\"M899.6,36.62h35.19V68.2H899.6V36.62z M899.6,89.85h35.19v127.21H899.6V89.85z\" /><path d=\"M955.09,70.45h36.31l39.7,103.76l39.47-103.76h36.31l-58.19,146.61h-35.19L955.09,70.45z\" /><path d=\"M1117.49,144.21c0-45.56,32.03-76.24,76.46-76.24c49.85,0,81.65,39.25,76.24,87.29h-116.16c2.48,20.53,20.3,33.16,39.47,33.16c15.56,0,30.68-8.12,37.22-22.33h36.99c-9.92,32.48-36.99,53.46-74.66,53.46C1148.39,219.54,1117.49,188.87,1117.49,144.21z M1232.75,127.97c-5.64-17.59-20.07-28.87-38.34-28.87c-18.5,0-33.38,11.05-38.8,29.1L1232.75,127.97z\" />`;\n\nexport const pontiveLogo = () => html`<svg\n data-slot=\"watermark-logo\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 1270.79 256.16\"\n role=\"img\"\n aria-label=\"Pontive\"\n><g data-logo-mark>${PONTIVE_MARK}</g><g data-logo-wordmark>${PONTIVE_WORDMARK}</g></svg>`;\n","import { html, type PropertyDeclarations, type TemplateResult } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { pontiveLogo } from \"./pontive-logo\";\n\nexport const WATERMARK_VARIANTS = [\"brand\", \"theme\", \"muted\"] as const;\nexport type WatermarkVariant = (typeof WATERMARK_VARIANTS)[number];\nexport const WATERMARK_LOGO_ALIGNS = [\"start\", \"end\"] as const;\nexport type WatermarkLogoAlign = (typeof WATERMARK_LOGO_ALIGNS)[number];\n\n/** The watermark's content (label + logo), shared with the block's footer. */\nexport function watermarkContent(label: string, logoAlign: WatermarkLogoAlign): TemplateResult {\n const text = html`<span data-slot=\"watermark-label\">${label || \"Powered by\"}</span>`;\n return logoAlign === \"start\" ? html`${pontiveLogo()}${text}` : html`${text}${pontiveLogo()}`;\n}\n\n/**\n * # `<pont2-watermark>`: \"Powered by [Pontive]\"\n *\n * ```html\n * <pont2-watermark variant=\"muted\"></pont2-watermark>\n * → <pont2-watermark data-pont2-watermark data-slot=\"watermark\" data-variant=\"muted\">\n * <span data-slot=\"watermark-label\">Powered by</span><svg data-slot=\"watermark-logo\" role=\"img\" aria-label=\"Pontive\">…</svg>\n * </pont2-watermark>\n * ```\n *\n * Host-as-root (the legacy element wrapped a `<span>` in its tag). The block\n * renders the same content as a *part* in its footer (`Watermark.part()` +\n * `watermarkContent()`), so the screen shell needs no nested element.\n *\n * @tag pont2-watermark\n * @attr variant - brand (default: the mark in Pontive indigo) | theme (currentColor) | muted (muted text)\n * @attr logo-align - start | end (default)\n * @attr label - default \"Powered by\"\n * @cssprop --pont2-watermark-brand-icon-color - the mark in the brand variant (default #6366f1)\n * @cssprop --pont2-watermark-muted-fg - text and mark in the muted variant (default muted-foreground)\n */\nexport class Watermark extends HostElement {\n static override identity = \"watermark\";\n static override slotName = \"watermark\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n variant: { type: String, reflect: true },\n logoAlign: { type: String, attribute: \"logo-align\" },\n label: { type: String },\n };\n\n declare variant: WatermarkVariant;\n declare logoAlign: WatermarkLogoAlign;\n declare label: string;\n\n constructor() {\n super();\n this.variant = \"brand\";\n this.logoAlign = \"end\";\n this.label = \"\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"variant\", this.variant || \"brand\");\n }\n\n override render() {\n return watermarkContent(this.label, this.logoAlign);\n }\n}\n\ndefine(\"pont2-watermark\", Watermark);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-watermark\": Watermark;\n }\n}\n","import { ContextConsumer, createContext } from \"@lit/context\";\nimport type { ReactiveElement } from \"lit\";\n\n/**\n * Account-level branding entitlements, the pont2 side of\n * docs/branding-entitlements.md (same rule, same shape):\n *\n * > A branding entitlement is a fact about the account, resolved by the\n * > backend, delivered as context. An element that renders branding *asks*\n * > for it. It is never *told* by its own markup.\n *\n * So there is no attribute, property or other escape hatch on any pont2\n * element; the flow host (the future pont2 widgets/layout) provides\n * `brandingContext` from the backend response, and Storybook provides it with\n * a `ContextProvider`.\n *\n * The context is the Context Community Protocol (`context-request` events)\n * through `@lit/context`. Its key is `pont2:branding`, separate from the\n * legacy `pont:branding` (docs/08-parallel-constraints.md §4).\n */\nexport interface BrandingEntitlements {\n /** Whether the Pontive watermark must be rendered on the screen shell. */\n showWatermark: boolean;\n}\n\n/** Fail closed: no provider, or an old backend, means the watermark shows. */\nexport const DEFAULT_BRANDING: BrandingEntitlements = { showWatermark: true };\n\nexport const brandingContext = createContext<BrandingEntitlements>(\"pont2:branding\");\n\n/**\n * Reads the entitlements for one element (subscribing, so a late or changed\n * provider value re-renders it). Deliberately no attribute override.\n */\nexport class BrandingController {\n private consumer: ContextConsumer<typeof brandingContext, ReactiveElement>;\n\n constructor(host: ReactiveElement) {\n this.consumer = new ContextConsumer(host, { context: brandingContext, subscribe: true });\n }\n\n get showWatermark(): boolean {\n return this.consumer.value?.showWatermark ?? DEFAULT_BRANDING.showWatermark;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { define } from \"../../core/names\";\nimport { Card, CardFooter } from \"../../primitives/card/card\";\nimport { Watermark, watermarkContent } from \"../watermark/watermark\";\nimport { BrandingController } from \"./branding\";\n\nexport { BrandingController, brandingContext, DEFAULT_BRANDING, type BrandingEntitlements } from \"./branding\";\n\nexport type BlockAlign = \"stretch\" | \"start\" | \"center\" | \"end\";\nexport type BlockJustify = \"start\" | \"center\" | \"end\";\n\n/**\n * # `<pont2-block>`: the screen shell\n *\n * ```html\n * <pont2-block>\n * <pont2-header>…</pont2-header>\n * <form>…</form>\n * </pont2-block>\n * ```\n *\n * **Is a Card** (`extends Card`): the host is the card, the screen's content\n * is its children, **left where they are**, and the block adds one thing of\n * its own, the watermark footer:\n *\n * ```html\n * <pont2-block data-pont2-card data-slot=\"card\" data-align=\"stretch\" data-justify=\"start\">\n * …the screen (author / render-spec content)…\n * <div data-pont2-card-footer data-slot=\"card-footer\" data-border=\"top\">\n * <span data-pont2-watermark data-slot=\"watermark\" data-variant=\"muted\">Powered by <svg/></span>\n * </div>\n * </pont2-block>\n * ```\n *\n * The legacy `pont-block` rendered `pont-card > [card] > pont-card-content >\n * [card-content]` and then **moved** the spec's children into it\n * (`moveLightDomChildrenInto`), the relocation pattern host-as-root exists to\n * remove. pont2 moves nothing: the card's inline padding (CardContent's\n * `px-(--card-spacing)`) is on the host, and the footer bleeds to the edges.\n *\n * **Watermark entitlement** (docs/branding-entitlements.md): the footer is\n * rendered unless the branding context says `showWatermark: false`. There is\n * no attribute or property for it, and it fails closed. It is part of the\n * shell, not the content, so a screen author cannot delete it.\n *\n * Not a props-driven composite (`composite = false`): a block *contains* the\n * screen. Lit renders the footer after the author's children.\n *\n * @tag pont2-block\n * @attr align - stretch (default) | start | center | end: the content's cross-axis alignment\n * @attr justify - start (default) | center | end: when the block is taller than its content\n * @attr size - default | sm (the Card primitive's spacing)\n * @cssprop --pont2-block-max-width - max width on wider screens (default 24rem)\n * @cssprop --pont2-block-gap - gap between children (default 1rem)\n * @cssprop --pont2-block-bg, --pont2-block-fg, --pont2-block-border-color, --pont2-block-radius, --pont2-block-shadow, --pont2-block-spacing - the screen card (fall back to the Card's tokens)\n * @cssprop --pont2-block-footer-bg - the watermark band\n */\nexport class Block extends Card {\n static override composite = false;\n\n static override properties: PropertyDeclarations = {\n align: { type: String },\n justify: { type: String },\n };\n\n declare align: BlockAlign;\n declare justify: BlockJustify;\n\n private branding = new BrandingController(this);\n\n constructor() {\n super();\n this.align = \"stretch\";\n this.justify = \"start\";\n }\n\n protected override willUpdate(): void {\n super.willUpdate();\n this.setData(\"align\", this.align || \"stretch\");\n this.setData(\"justify\", this.justify || \"start\");\n }\n\n override render() {\n if (!this.branding.showWatermark) return nothing;\n return html`<div ${CardFooter.part({ \"data-border\": \"top\", \"data-block-footer\": true })}>\n <span ${Watermark.part({ \"data-variant\": \"muted\" })}>${watermarkContent(\"\", \"end\")}</span>\n </div>`;\n }\n}\n\ndefine(\"pont2-block\", Block);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-block\": Block;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\n/** The legacy render-spec values. */\nexport const CONTAINER_TYPES = [\"flex_column\", \"flex_row\"] as const;\nexport type ContainerType = (typeof CONTAINER_TYPES)[number];\nexport type ContainerAlign = \"stretch\" | \"start\" | \"center\" | \"end\";\nexport type ContainerJustify = \"start\" | \"center\" | \"end\" | \"between\";\n\n/**\n * # `<pont2-container>`: a flex group of screen elements\n *\n * ```html\n * <pont2-container type=\"flex_row\" justify=\"between\">…</pont2-container>\n * → <pont2-container data-pont2-container data-slot=\"container\" data-type=\"flex_row\" data-justify=\"between\">…</pont2-container>\n * ```\n *\n * Tier 1 host-as-root: the host is the flex box and the children stay where\n * they are (the legacy element rendered an inner `div` and moved the children\n * into it). Not a composite: it contains content.\n *\n * @tag pont2-container\n * @attr type - flex_column (default) | flex_row\n * @attr align - stretch (default) | start | center | end (cross axis)\n * @attr justify - start (default) | center | end | between (main axis)\n * @cssprop --pont2-container-gap - default 1rem\n */\nexport class Container extends HostElement {\n static override identity = \"container\";\n static override slotName = \"container\";\n static override composite = false;\n\n static override properties: PropertyDeclarations = {\n type: { type: String },\n align: { type: String },\n justify: { type: String },\n };\n\n declare type: ContainerType;\n declare align: ContainerAlign;\n declare justify: ContainerJustify;\n\n /** Design mode (core/design-mode.ts): outlined and inset on the designer's canvas. */\n protected readonly design = new DesignModeController(this);\n\n constructor() {\n super();\n this.type = \"flex_column\";\n this.align = \"stretch\";\n this.justify = \"start\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"type\", this.type === \"flex_row\" ? \"flex_row\" : \"flex_column\");\n this.setData(\"align\", this.align || \"stretch\");\n this.setData(\"justify\", this.justify || \"start\");\n // A container draws nothing of its own, so on the designer's canvas it would be invisible, and\n // an empty one would have no extent to drop into. Design mode outlines and insets it, and labels\n // an empty one (container.css). Never on a served screen.\n const design = this.design.active;\n this.setData(\"design\", design);\n this.setData(\"design-empty\", design && this.childElementCount === 0);\n }\n}\n\ndefine(\"pont2-container\", Container);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-container\": Container;\n }\n}\n","import type { PropertyDeclarations } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const HEADER_ALIGNS = [\"start\", \"center\", \"end\"] as const;\nexport type HeaderAlign = (typeof HEADER_ALIGNS)[number];\n\n/**\n * # `<pont2-header>`: the screen's heading group (logo, title, subtitle)\n *\n * ```html\n * <pont2-header>\n * <pont2-logo image-url=\"/logo.svg\"></pont2-logo>\n * <pont2-title content=\"Welcome back\"></pont2-title>\n * <pont2-subtitle content=\"Login to your Acme Inc account\"></pont2-subtitle>\n * </pont2-header>\n * ```\n *\n * shadcn's login blocks: `<div class=\"flex flex-col items-center gap-2\n * text-center\">`. Tier 1 host-as-root (the legacy element moved its children\n * into an inner `div`); `align` sets both the boxes' and the text's alignment,\n * as the legacy header does. Not a composite: it contains content.\n *\n * @tag pont2-header\n * @attr align - start | center (default) | end\n * @cssprop --pont2-header-gap - default 0.5rem\n */\nexport class Header extends HostElement {\n static override identity = \"header\";\n static override slotName = \"header\";\n static override composite = false;\n\n static override properties: PropertyDeclarations = {\n align: { type: String },\n };\n\n declare align: HeaderAlign;\n\n constructor() {\n super();\n this.align = \"center\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"align\", this.align || \"center\");\n }\n}\n\ndefine(\"pont2-header\", Header);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-header\": Header;\n }\n}\n","import type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const GAP_TYPES = [\"vertical\", \"horizontal\"] as const;\nexport type GapType = (typeof GAP_TYPES)[number];\n\n/**\n * # `<pont2-gap>`: a fixed spacer\n *\n * ```html\n * <pont2-gap size=\"24px\"></pont2-gap>\n * → <pont2-gap data-pont2-gap data-type=\"vertical\" style=\"--pont2-gap-size: 24px\"></pont2-gap>\n * ```\n *\n * The host *is* the spacer (the legacy element rendered a sized `div` inside\n * itself). The size is any CSS length, passed through the `--pont2-gap-size`\n * custom property on the host, so no inline width/height overrides author CSS.\n * Decorative: `aria-hidden`.\n *\n * @tag pont2-gap\n * @attr size - CSS length (default 8px)\n * @attr type - vertical (default: takes height) | horizontal (takes width)\n */\nexport class Gap extends HostElement {\n static override identity = \"gap\";\n static override slotName = \"gap\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n size: { type: String },\n type: { type: String },\n };\n\n declare size: string;\n declare type: GapType;\n\n constructor() {\n super();\n this.size = \"8px\";\n this.type = \"vertical\";\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals.ariaHidden = \"true\";\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n this.setData(\"type\", this.type === \"horizontal\" ? \"horizontal\" : \"vertical\");\n if (changed.has(\"size\")) this.style.setProperty(\"--pont2-gap-size\", this.size || \"8px\");\n }\n}\n\ndefine(\"pont2-gap\", Gap);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-gap\": Gap;\n }\n}\n","import { html, nothing, svg, type PropertyDeclarations } from \"lit\";\nimport { styleMap } from \"lit/directives/style-map.js\";\n\nimport { DesignModeController } from \"../../core/design-mode\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\n\nexport const LOGO_ALIGNS = [\"start\", \"center\", \"end\"] as const;\nexport type LogoAlign = (typeof LOGO_ALIGNS)[number];\n\n/**\n * A logo source as an `<img src>`: URLs and `data:` URIs pass through; a bare\n * base64 string is treated as an SVG (the legacy `resolveIconSource` rule).\n * `{{theme}}` in a URL is replaced with `light` or `dark`.\n */\nexport function logoSource(raw: string | undefined, theme: \"light\" | \"dark\"): string {\n if (!raw) return \"\";\n const url = raw.replace(\"{{theme}}\", theme);\n if (/^(https?:|data:|blob:|\\/|\\.{1,2}\\/)/.test(url)) return url;\n return `data:image/svg+xml;base64,${url}`;\n}\n\n/**\n * # `<pont2-logo>`: the application's logo\n *\n * ```html\n * <pont2-logo image-url=\"https://cdn.example.com/logo-{{theme}}.svg\" alt=\"Acme\"></pont2-logo>\n * → <pont2-logo data-pont2-logo data-slot=\"logo\" data-align=\"center\">\n * <img data-logo-theme=\"light\" src=\"…logo-light.svg\" alt=\"Acme\">\n * <img data-logo-theme=\"dark\" src=\"…logo-dark.svg\" alt=\"Acme\"> (only when it differs)\n * </pont2-logo>\n * ```\n *\n * **Always an `<img>`.** The legacy element decoded base64 SVG and injected\n * it as markup (`unsafeSVG`), which runs whatever the SVG contains in the\n * page. An `<img>` renders the same SVG sandboxed (no script, no external\n * fetches), and needs no decoding.\n *\n * **Dark mode by CSS**, not by watching `<html data-theme>`: when the dark\n * source differs (`image-url-dark`, or `{{theme}}` in the URL), both images\n * are rendered and the stylesheet shows the right one under `.dark` /\n * `[data-theme=\"dark\"]` (the pont2 dark-mode switches).\n *\n * @tag pont2-logo\n * @attr image-url - URL, `data:` URI or bare base64 SVG; `{{theme}}` is replaced\n * @attr image-url-dark - dark-mode source (default: `image-url` with `{{theme}}` = dark)\n * @attr alt - default \"Logo\" (legacy); set the brand name\n * @attr align - start | center (default) | end\n * @attr width, height - CSS lengths for the image\n */\nexport class Logo extends HostElement {\n static override identity = \"logo\";\n static override slotName = \"logo\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n imageUrl: { type: String, attribute: \"image-url\" },\n imageUrlDark: { type: String, attribute: \"image-url-dark\" },\n alt: { type: String },\n align: { type: String },\n width: { type: String },\n height: { type: String },\n };\n\n declare imageUrl: string;\n declare imageUrlDark: string;\n declare alt: string;\n declare align: LogoAlign;\n declare width: string;\n declare height: string;\n\n /** Design mode (core/design-mode.ts): a placeholder mark when no image is set. */\n protected readonly design = new DesignModeController(this);\n\n constructor() {\n super();\n this.imageUrl = \"\";\n this.imageUrlDark = \"\";\n this.alt = \"\";\n this.align = \"center\";\n this.width = \"\";\n this.height = \"\";\n }\n\n protected override willUpdate(): void {\n this.setData(\"align\", this.align || \"center\");\n }\n\n override render() {\n const light = logoSource(this.imageUrl, \"light\");\n // At serve time a bare logo gets the brand's logo injected, or is pruned. The designer has\n // neither, so it shows a placeholder mark (the legacy one) rather than nothing.\n if (!light) return this.design.active ? PLACEHOLDER : nothing;\n const dark = logoSource(this.imageUrlDark || this.imageUrl, \"dark\");\n const style = styleMap({ width: this.width || undefined, height: this.height || undefined });\n const alt = this.alt || \"Logo\";\n return html`<img data-logo-theme=\"light\" src=${light} alt=${alt} style=${style} />${dark !== light\n ? html`<img data-logo-theme=\"dark\" src=${dark} alt=${alt} style=${style} />`\n : nothing}`;\n }\n}\n\n/** The design-mode placeholder: inline, static, `currentColor` so it follows the theme. */\nconst PLACEHOLDER = html`<span data-slot=\"logo-placeholder\" role=\"img\" aria-label=\"Logo placeholder\">${svg`<svg\n viewBox=\"0 0 120 32\" width=\"120\" height=\"32\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <rect x=\"0.75\" y=\"0.75\" width=\"118.5\" height=\"30.5\" rx=\"6\" fill=\"none\" stroke=\"currentColor\"\n stroke-opacity=\"0.28\" stroke-width=\"1.5\" stroke-dasharray=\"4 3\"/>\n <circle cx=\"20\" cy=\"16\" r=\"6\" fill=\"currentColor\" fill-opacity=\"0.3\"/>\n <rect x=\"32\" y=\"11\" width=\"52\" height=\"4\" rx=\"2\" fill=\"currentColor\" fill-opacity=\"0.3\"/>\n <rect x=\"32\" y=\"19\" width=\"34\" height=\"4\" rx=\"2\" fill=\"currentColor\" fill-opacity=\"0.18\"/>\n</svg>`}</span>`;\n\ndefine(\"pont2-logo\", Logo);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-logo\": Logo;\n }\n}\n","import { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { safeUrl } from \"../../core/url\";\n\nexport interface CountdownEndDetail {\n /** Where the countdown will navigate (already resolved), or null. */\n url: string | null;\n}\n\n/** Kept as countdown's export; the check itself is `safeUrl` (core/url.ts), shared with `pont2-link`. */\nexport const safeRedirect = (raw: string, base?: string): string | null => safeUrl(raw, base);\n\n/**\n * # `<pont2-countdown>`: \"Redirecting in 5s…\"\n *\n * ```html\n * <pont2-countdown content=\"Redirecting you in\" duration=\"5\" redirect-url=\"/dashboard\"></pont2-countdown>\n * → <pont2-countdown data-pont2-countdown data-slot=\"countdown\" role=\"timer\">Redirecting you in 5s…</pont2-countdown>\n * ```\n *\n * Host-as-root (the legacy element rendered a `div` inside its tag). Counts\n * down once a second; at zero it fires a **cancelable** `pont2-countdown-end`\n * and, unless a listener prevents it, navigates to `redirect-url`.\n *\n * **Only http(s) URLs are followed.** Render specs are author-editable HTML,\n * so a `javascript:` or `data:` redirect would be script injection; those are\n * refused (the event still fires, with `url: null`). The legacy element\n * assigned `location.href` unconditionally and defaulted to `/`; pont2 has no\n * default: without `redirect-url` it only fires the event.\n *\n * `role=\"timer\"`: assistive technology is not interrupted every second.\n *\n * @tag pont2-countdown\n * @attr duration - seconds (default 5)\n * @attr content - text before the seconds\n * @attr redirect-url - where to go at zero (http/https, relative URLs resolve against the page)\n * @fires pont2-countdown-end - `{ url }`, cancelable: `preventDefault()` stops the redirect\n */\nexport class Countdown extends HostElement {\n static override identity = \"countdown\";\n static override slotName = \"countdown\";\n static override role = \"timer\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n duration: { type: Number },\n content: { type: String },\n redirectUrl: { type: String, attribute: \"redirect-url\" },\n remaining: { state: true },\n };\n\n declare duration: number;\n declare content: string;\n declare redirectUrl: string;\n /** Seconds left. */\n declare remaining: number;\n\n private timer: ReturnType<typeof setInterval> | undefined;\n\n constructor() {\n super();\n this.duration = 5;\n this.content = \"\";\n this.redirectUrl = \"\";\n this.remaining = 0;\n }\n\n /** (Re)starts from `duration`. */\n restart(): void {\n this.stop();\n this.remaining = Math.max(0, Math.floor(this.duration || 0));\n if (!this.remaining) {\n this.end();\n return;\n }\n this.timer = setInterval(() => {\n this.remaining -= 1;\n if (this.remaining <= 0) {\n this.stop();\n this.end();\n }\n }, 1000);\n }\n\n private stop(): void {\n if (this.timer !== undefined) clearInterval(this.timer);\n this.timer = undefined;\n }\n\n private end(): void {\n const url = safeRedirect(this.redirectUrl);\n const go = fire<CountdownEndDetail>(this, \"pont2-countdown-end\", { url }, true);\n if (go && url) location.assign(url);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.restart();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.stop();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"duration\") && this.hasUpdated) this.restart();\n }\n\n override render() {\n return html`${this.content ? `${this.content} ` : \"\"}${this.remaining}s…`;\n }\n}\n\ndefine(\"pont2-countdown\", Countdown);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-countdown\": Countdown;\n }\n interface HTMLElementEventMap {\n \"pont2-countdown-end\": CustomEvent<CountdownEndDetail>;\n }\n}\n","import { html, type PropertyDeclarations } from \"lit\";\n\nimport { ActionController } from \"../../core/controllers/action\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\n\n/**\n * # `<pont2-edit-identifier>`: \"ada@example.com ✎\"\n *\n * The identifier the user entered on the previous step, with a button to go\n * back and change it.\n *\n * ```html\n * <pont2-edit-identifier identifier=\"ada@example.com\" event=\"change_identifier\"></pont2-edit-identifier>\n * → <pont2-edit-identifier data-pont2-edit-identifier data-slot=\"edit-identifier\">\n * <span data-slot=\"edit-identifier-value\">ada@example.com</span>\n * <button data-pont2-button data-variant=\"ghost\" data-size=\"icon-xs\" aria-label=\"Change ada@example.com\" type=\"button\"><svg/></button>\n * </pont2-edit-identifier>\n * ```\n *\n * The button is the button primitive's part and requests `event` through the\n * action protocol (`data: { identifier }`), busy until it settles. The\n * legacy element made the *whole* element a click target and its icon button\n * had no accessible name; here only the button acts, and it is named\n * (\"Change ada@example.com\", `label` + the identifier).\n *\n * @tag pont2-edit-identifier\n * @attr identifier - the value shown\n * @attr event - the action requested on press\n * @attr label - the button's accessible name prefix (default \"Change\")\n * @fires pont2-action, pont2-action-success, pont2-action-error\n */\nexport class EditIdentifier extends HostElement {\n static override identity = \"edit-identifier\";\n static override slotName = \"edit-identifier\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n identifier: { type: String },\n event: { type: String },\n label: { type: String },\n };\n\n declare identifier: string;\n declare event: string | undefined;\n declare label: string;\n\n protected readonly action = new ActionController(this);\n\n constructor() {\n super();\n this.identifier = \"\";\n this.event = undefined;\n this.label = \"\";\n }\n\n get control(): HTMLButtonElement | null {\n return this.querySelector(\"[data-pont2-button]\");\n }\n\n override render() {\n const busy = this.action.busy;\n return html`<span data-slot=\"edit-identifier-value\">${this.identifier}</span>${button(\n {\n variant: \"ghost\",\n size: \"icon-xs\",\n slot: \"edit-identifier-button\",\n disabled: busy,\n focusableWhenDisabled: busy,\n attrs: {\n \"aria-label\": `${this.label || \"Change\"} ${this.identifier}`.trim(),\n \"data-event\": this.event,\n \"aria-busy\": busy ? \"true\" : null,\n },\n onClick: () => this.action.request(this.event, { identifier: this.identifier }),\n },\n icons.pencil(),\n )}`;\n }\n}\n\ndefine(\"pont2-edit-identifier\", EditIdentifier);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-edit-identifier\": EditIdentifier;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { CopyController } from \"../../core/controllers/copy\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { uid } from \"../../core/ids\";\nimport { define } from \"../../core/names\";\nimport { InputGroup, InputGroupAddon, inputGroupButton, inputGroupInput } from \"../../primitives/input-group/input-group\";\n\n/**\n * # `<pont2-secret>`: the \"Can't scan?\" manual TOTP secret\n *\n * ```html\n * <pont2-secret secret=\"JBSWY3DPEHPK3PXP\" issuer=\"Acme\" account=\"ada@example.com\"></pont2-secret>\n * ```\n *\n * ```html\n * <pont2-secret data-pont2-secret data-slot=\"secret\">\n * <p data-slot=\"secret-title\">Can't scan?</p>\n * <div data-pont2-input-group …>\n * <input data-pont2-input-group-input readonly value=\"JBSWY3DPEHPK3PXP\" aria-label=\"Manual secret\">\n * <div data-pont2-input-group-addon data-align=\"inline-end\">\n * <button … aria-label=\"Copy secret\"><svg/></button>\n * </div>\n * </div>\n * <span data-slot=\"secret-copied\" role=\"status\">Copied!</span> (after copying)\n * <dl data-slot=\"secret-metadata\"><div><dt>Issuer</dt><dd>Acme</dd></div><div><dt>Account</dt><dd>…</dd></div></dl>\n * </pont2-secret>\n * ```\n *\n * Built from InputGroup parts (shadcn's input + addon button). Differences\n * from the legacy element, each deliberate:\n * - the input is **readonly**, not disabled: it can be focused and selected\n * (copy by hand, screen readers read it); monospace, spaced for reading;\n * - \"Copied!\" is a `role=\"status\"` live region, so it is announced;\n * - the copy events (`pont2-copied` / `pont2-copy-error`, `{ kind: \"secret\" }`)\n * **do not carry the secret** (the legacy `pont-secret:copied` did);\n * - issuer/account are a description list (`<dl>`), their semantic form.\n *\n * @tag pont2-secret\n * @attr secret, issuer, account\n * @attr title-text - default \"Can't scan?\" (`title` would be a native tooltip)\n * @attr secret-label, issuer-label, account-label, copy-label, copied-text - copy\n * @attr disabled - disables the copy button\n * @fires pont2-copied, pont2-copy-error - `{ kind: \"secret\" }`\n */\nexport class Secret extends HostElement {\n static override identity = \"secret\";\n static override slotName = \"secret\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n secret: { type: String },\n issuer: { type: String },\n account: { type: String },\n titleText: { type: String, attribute: \"title-text\" },\n secretLabel: { type: String, attribute: \"secret-label\" },\n issuerLabel: { type: String, attribute: \"issuer-label\" },\n accountLabel: { type: String, attribute: \"account-label\" },\n copyLabel: { type: String, attribute: \"copy-label\" },\n copiedText: { type: String, attribute: \"copied-text\" },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare secret: string;\n declare issuer: string;\n declare account: string;\n declare titleText: string;\n declare secretLabel: string;\n declare issuerLabel: string;\n declare accountLabel: string;\n declare copyLabel: string;\n declare copiedText: string;\n declare disabled: boolean;\n\n protected readonly clipboard = new CopyController(this, \"secret\");\n private inputId = uid(\"secret\");\n\n constructor() {\n super();\n this.secret = \"\";\n this.issuer = \"\";\n this.account = \"\";\n this.titleText = \"\";\n this.secretLabel = \"\";\n this.issuerLabel = \"\";\n this.accountLabel = \"\";\n this.copyLabel = \"\";\n this.copiedText = \"\";\n this.disabled = false;\n }\n\n /** Copies the secret (also what the button does). */\n copy(): Promise<boolean> {\n return this.secret && !this.disabled ? this.clipboard.copy(this.secret) : Promise.resolve(false);\n }\n\n override render() {\n const copied = this.clipboard.copied;\n const meta = (label: string, value: string) =>\n value ? html`<div><dt>${label}</dt><dd>${value}</dd></div>` : nothing;\n return html`<p data-slot=\"secret-title\">${this.titleText || \"Can't scan?\"}</p>\n <div ${InputGroup.part()}>\n ${inputGroupInput({\n id: this.inputId,\n value: this.secret,\n readonly: true,\n attrs: { \"aria-label\": this.secretLabel || \"Manual secret\", spellcheck: \"false\", \"data-secret\": true },\n })}\n <div ${InputGroupAddon.part({ \"data-align\": \"inline-end\" })}>\n ${inputGroupButton(\n {\n size: \"icon-xs\",\n disabled: this.disabled || !this.secret,\n attrs: { \"aria-label\": this.copyLabel || \"Copy secret\", \"aria-controls\": this.inputId },\n onClick: () => void this.copy(),\n },\n copied ? icons.check() : icons.copy(),\n )}\n </div>\n </div>\n <span data-slot=\"secret-copied\" role=\"status\">${copied ? this.copiedText || \"Copied!\" : \"\"}</span>\n ${this.issuer || this.account\n ? html`<dl data-slot=\"secret-metadata\">\n ${meta(this.issuerLabel || \"Issuer\", this.issuer)}${meta(this.accountLabel || \"Account\", this.account)}\n </dl>`\n : nothing}`;\n }\n}\n\ndefine(\"pont2-secret\", Secret);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-secret\": Secret;\n }\n}\n","import { html, nothing, svg, type PropertyDeclarations, type PropertyValues } from \"lit\";\nimport QRCode from \"qrcode\";\n\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\n\nexport const QR_ERROR_CORRECTIONS = [\"L\", \"M\", \"Q\", \"H\"] as const;\nexport type QrErrorCorrection = (typeof QR_ERROR_CORRECTIONS)[number];\n\n/** Quiet zone, in modules, around the code (the QR spec asks for 4). */\nconst QUIET = 4;\n\n/**\n * One SVG path covering every dark module of `text`'s QR code, plus the\n * code's size. `null` when the text cannot be encoded.\n */\nexport function qrPath(text: string, level: QrErrorCorrection): { d: string; size: number } | null {\n if (!text) return null;\n try {\n const { modules } = QRCode.create(text, { errorCorrectionLevel: level });\n const n = modules.size;\n let d = \"\";\n for (let y = 0; y < n; y++) {\n for (let x = 0; x < n; x++) {\n if (modules.data[y * n + x]) d += `M${x + QUIET} ${y + QUIET}h1v1h-1z`;\n }\n }\n return { d, size: n + QUIET * 2 };\n } catch {\n return null;\n }\n}\n\nexport interface QrDetail {\n url: string;\n}\n\n/**\n * # `<pont2-qr-code>`: the authenticator-app enrolment QR code\n *\n * ```html\n * <pont2-qr-code url=\"otpauth://totp/Acme:ada@example.com?secret=…&issuer=Acme\" timeout=\"30\"></pont2-qr-code>\n * ```\n *\n * ```html\n * <pont2-qr-code data-pont2-qr-code data-slot=\"qr-code\" [data-obscured]>\n * <svg data-slot=\"qr-code-image\" role=\"img\" aria-label=\"QR code\" viewBox=\"0 0 37 37\">\n * <rect …white…/><path d=\"M4 4h1v1h-1z…\"/>\n * </svg>\n * <div data-slot=\"qr-code-overlay\"> (when obscured)\n * <button data-pont2-button type=\"button\">Show QR code</button>\n * </div>\n * </pont2-qr-code>\n * ```\n *\n * **An SVG built from the code's modules** (`qrcode`'s `create()` matrix →\n * one `<path>`), not a canvas: crisp at any size and zoom, no pixel-ratio\n * maths, nothing injected as markup. Always dark-on-white with the\n * 4-module quiet zone, whatever the theme: inverted codes do not scan\n * everywhere.\n *\n * **Obscured after `timeout` seconds** (it encodes the TOTP secret): the\n * code fades and a \"Show QR code\" button brings it back for another\n * `timeout`. `timeout=\"0\"` never obscures.\n *\n * @tag pont2-qr-code\n * @attr url - the text to encode (an `otpauth://` URI)\n * @attr timeout - seconds before obscuring (default 10)\n * @attr error-correction - L | M (default) | Q | H\n * @attr label - accessible name of the image (default \"QR code\")\n * @attr reveal-label - the button text (default \"Show QR code\")\n * @attr disabled - never obscures, and disables the button\n * @cssprop --pont2-qr-code-width - the image width (default 12rem)\n * @fires pont2-qr-obscured, pont2-qr-revealed - `{ url }`\n * @fires pont2-qr-error - `{ url }` when the text cannot be encoded\n */\nexport class QrCode extends HostElement {\n static override identity = \"qr-code\";\n static override slotName = \"qr-code\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n url: { type: String },\n timeout: { type: Number },\n errorCorrection: { type: String, attribute: \"error-correction\" },\n label: { type: String },\n revealLabel: { type: String, attribute: \"reveal-label\" },\n disabled: { type: Boolean, reflect: true },\n obscured: { state: true },\n };\n\n declare url: string;\n declare timeout: number;\n declare errorCorrection: QrErrorCorrection;\n declare label: string;\n declare revealLabel: string;\n declare disabled: boolean;\n declare obscured: boolean;\n\n private timer: ReturnType<typeof setTimeout> | undefined;\n private path: ReturnType<typeof qrPath> = null;\n\n constructor() {\n super();\n this.url = \"\";\n this.timeout = 10;\n this.errorCorrection = \"M\";\n this.label = \"\";\n this.revealLabel = \"\";\n this.disabled = false;\n this.obscured = false;\n }\n\n /** Shows the code again and restarts the timeout. */\n reveal(): void {\n this.obscured = false;\n this.startTimer();\n }\n\n private startTimer(): void {\n if (this.timer !== undefined) clearTimeout(this.timer);\n this.timer = undefined;\n if (!(this.timeout > 0) || this.disabled) return;\n this.timer = setTimeout(() => {\n this.timer = undefined;\n this.obscured = true;\n fire<QrDetail>(this, \"pont2-qr-obscured\", { url: this.url });\n }, this.timeout * 1000);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.startTimer();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.timer !== undefined) clearTimeout(this.timer);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"url\") || changed.has(\"errorCorrection\")) {\n this.path = qrPath(this.url, this.errorCorrection || \"M\");\n if (this.url && !this.path) fire<QrDetail>(this, \"pont2-qr-error\", { url: this.url });\n if (this.hasUpdated) this.reveal();\n } else if ((changed.has(\"timeout\") || changed.has(\"disabled\")) && this.hasUpdated) {\n this.reveal();\n }\n this.setData(\"obscured\", this.obscured && !this.disabled);\n }\n\n private onReveal = () => {\n this.reveal();\n fire<QrDetail>(this, \"pont2-qr-revealed\", { url: this.url });\n };\n\n override render() {\n const p = this.path;\n if (!p) return nothing;\n const obscured = this.obscured && !this.disabled;\n return html`<svg\n data-slot=\"qr-code-image\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 ${p.size} ${p.size}\"\n shape-rendering=\"crispEdges\"\n role=\"img\"\n aria-label=${this.label || \"QR code\"}\n aria-hidden=${obscured ? \"true\" : nothing}\n >${svg`<rect width=\"${p.size}\" height=\"${p.size}\" fill=\"#fff\" /><path d=\"${p.d}\" fill=\"#000\" />`}</svg\n >${obscured\n ? html`<div data-slot=\"qr-code-overlay\">\n ${button(\n { variant: \"default\", slot: \"qr-code-reveal\", onClick: this.onReveal },\n this.revealLabel || \"Show QR code\",\n )}\n </div>`\n : nothing}`;\n }\n}\n\ndefine(\"pont2-qr-code\", QrCode);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-qr-code\": QrCode;\n }\n interface HTMLElementEventMap {\n \"pont2-qr-obscured\": CustomEvent<QrDetail>;\n \"pont2-qr-revealed\": CustomEvent<QrDetail>;\n \"pont2-qr-error\": CustomEvent<QrDetail>;\n }\n}\n","import { html, type PropertyDeclarations } from \"lit\";\n\nimport { parseList } from \"../../core/attrs\";\nimport { CopyController } from \"../../core/controllers/copy\";\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { icons } from \"../../core/icons\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\n\n/** `codes` attribute: JSON array, or whitespace/comma separated. */\nconst codesConverter = {\n fromAttribute: (v: string | null): string[] => parseList(v),\n};\n\n/**\n * # `<pont2-recovery-codes>`: one-time recovery codes after MFA enrolment\n *\n * ```html\n * <pont2-recovery-codes codes='[\"a1b2-c3d4\",\"e5f6-g7h8\"]'></pont2-recovery-codes>\n * ```\n *\n * ```html\n * <pont2-recovery-codes data-pont2-recovery-codes data-slot=\"recovery-codes\">\n * <p data-slot=\"recovery-codes-title\">Recovery codes</p>\n * <p data-slot=\"recovery-codes-description\">Use these codes if you lose access…</p>\n * <ul data-slot=\"recovery-codes-list\"><li>a1b2-c3d4</li>…</ul>\n * <div data-slot=\"recovery-codes-actions\">\n * <button data-pont2-button data-variant=\"outline\">Copy codes</button>\n * <button data-pont2-button data-variant=\"outline\">Download codes</button>\n * </div>\n * <span data-slot=\"recovery-codes-copied\" role=\"status\">Copied!</span>\n * </pont2-recovery-codes>\n * ```\n *\n * Buttons are the button primitive's parts, the list is a monospace grid,\n * \"Copied!\" is announced (`role=\"status\"`). Events carry **no codes**\n * (`pont2-copied` / `pont2-copy-error` with `{ kind: \"recovery-codes\" }`,\n * `pont2-recovery-codes-downloaded`); the legacy events included them.\n *\n * @tag pont2-recovery-codes\n * @attr codes - JSON array or whitespace-separated list; `.codes` is an array\n * @attr title-text, description, empty-text, copy-label, download-label, copied-text - copy\n * @attr filename - download file name (default \"recovery-codes.txt\")\n * @attr disabled\n * @cssprop --pont2-recovery-codes-list-bg, --pont2-recovery-codes-list-radius - the code list's surface (default muted, radius-md)\n * @fires pont2-copied, pont2-copy-error, pont2-recovery-codes-downloaded\n */\nexport class RecoveryCodes extends HostElement {\n static override identity = \"recovery-codes\";\n static override slotName = \"recovery-codes\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n codes: { converter: codesConverter },\n titleText: { type: String, attribute: \"title-text\" },\n description: { type: String },\n emptyText: { type: String, attribute: \"empty-text\" },\n copyLabel: { type: String, attribute: \"copy-label\" },\n downloadLabel: { type: String, attribute: \"download-label\" },\n copiedText: { type: String, attribute: \"copied-text\" },\n filename: { type: String },\n disabled: { type: Boolean, reflect: true },\n };\n\n declare codes: string[];\n declare titleText: string;\n declare description: string;\n declare emptyText: string;\n declare copyLabel: string;\n declare downloadLabel: string;\n declare copiedText: string;\n declare filename: string;\n declare disabled: boolean;\n\n protected readonly clipboard = new CopyController(this, \"recovery-codes\");\n\n constructor() {\n super();\n this.codes = [];\n this.titleText = \"\";\n this.description = \"\";\n this.emptyText = \"\";\n this.copyLabel = \"\";\n this.downloadLabel = \"\";\n this.copiedText = \"\";\n this.filename = \"\";\n this.disabled = false;\n }\n\n private get text(): string {\n return (this.codes ?? []).join(\"\\n\");\n }\n\n copy(): Promise<boolean> {\n return this.codes?.length && !this.disabled ? this.clipboard.copy(this.text) : Promise.resolve(false);\n }\n\n download(): void {\n if (!this.codes?.length || this.disabled) return;\n const url = URL.createObjectURL(new Blob([this.text], { type: \"text/plain\" }));\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = this.filename || \"recovery-codes.txt\";\n a.click();\n setTimeout(() => URL.revokeObjectURL(url));\n fire(this, \"pont2-recovery-codes-downloaded\", {});\n }\n\n override render() {\n const codes = this.codes ?? [];\n const off = this.disabled || !codes.length;\n return html`<p data-slot=\"recovery-codes-title\">${this.titleText || \"Recovery codes\"}</p>\n <p data-slot=\"recovery-codes-description\">\n ${this.description || \"Use these codes if you lose access to your authenticator app.\"}\n </p>\n ${codes.length\n ? html`<ul data-slot=\"recovery-codes-list\">${codes.map(c => html`<li>${c}</li>`)}</ul>`\n : html`<p data-slot=\"recovery-codes-empty\">${this.emptyText || \"No recovery codes available.\"}</p>`}\n <div data-slot=\"recovery-codes-actions\">\n ${button(\n { variant: \"outline\", disabled: off, onClick: () => void this.copy() },\n html`${this.clipboard.copied ? icons.check({ \"data-icon\": \"inline-start\" }) : icons.copy({ \"data-icon\": \"inline-start\" })}${this.copyLabel || \"Copy codes\"}`,\n )}\n ${button(\n { variant: \"outline\", disabled: off, onClick: () => this.download() },\n html`${icons.download({ \"data-icon\": \"inline-start\" })}${this.downloadLabel || \"Download codes\"}`,\n )}\n </div>\n <span data-slot=\"recovery-codes-copied\" role=\"status\"\n >${this.clipboard.copied ? this.copiedText || \"Copied!\" : \"\"}</span\n >`;\n }\n}\n\ndefine(\"pont2-recovery-codes\", RecoveryCodes);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-recovery-codes\": RecoveryCodes;\n }\n interface HTMLElementEventMap {\n \"pont2-recovery-codes-downloaded\": CustomEvent<Record<string, never>>;\n }\n}\n","/**\n * Pure value logic of the scope list (ported from the legacy\n * scope-list.value.ts, which has the same tests).\n */\nexport interface ConsentScope {\n scope: string;\n label: string;\n granted?: boolean;\n required?: boolean;\n}\n\n/** Drops malformed and duplicate entries; trims names; label defaults to the scope. */\nexport function normalizeScopes(scopes: unknown): ConsentScope[] {\n if (!Array.isArray(scopes)) return [];\n const seen = new Set<string>();\n return scopes.flatMap(s => {\n if (!s || typeof s !== \"object\") return [];\n const { scope, label, granted, required } = s as Record<string, unknown>;\n if (typeof scope !== \"string\" || !scope.trim()) return [];\n const name = scope.trim();\n if (seen.has(name)) return [];\n seen.add(name);\n return [{ scope: name, label: typeof label === \"string\" && label ? label : name, granted: granted === true, required: required === true }];\n });\n}\n\n/** Required scopes are always ticked; others unless the user unticked them. */\nexport function isScopeChecked(scope: ConsentScope, unticked: ReadonlySet<string>): boolean {\n return !!scope.required || !unticked.has(scope.scope);\n}\n\n/** The submitted value: ticked scope names, space-separated (OAuth `scope` syntax). */\nexport function scopeListValue(scopes: ConsentScope[], unticked: ReadonlySet<string>): string {\n return Array.from(new Set(scopes.filter(s => isScopeChecked(s, unticked)).map(s => s.scope))).join(\" \");\n}\n","import { html, type PropertyDeclarations } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\n\nimport { FormControlElement } from \"../../core/form-control\";\nimport { define } from \"../../core/names\";\nimport type { Checkbox } from \"../../primitives/checkbox/checkbox\";\nimport { isScopeChecked, normalizeScopes, scopeListValue, type ConsentScope } from \"./scope-value\";\n\nexport { isScopeChecked, normalizeScopes, scopeListValue, type ConsentScope } from \"./scope-value\";\n\nconst scopesConverter = {\n fromAttribute: (v: string | null): ConsentScope[] => {\n try {\n return normalizeScopes(JSON.parse(v ?? \"[]\"));\n } catch {\n return [];\n }\n },\n};\n\n/**\n * # `<pont2-scope-list>`: OAuth consent scopes\n *\n * ```html\n * <form>\n * <pont2-scope-list name=\"scope\"\n * scopes='[{\"scope\":\"openid\",\"label\":\"Sign you in\",\"required\":true},{\"scope\":\"email\",\"label\":\"See your email\"}]'>\n * </pont2-scope-list>\n * </form>\n * → FormData: scope=openid email\n * ```\n *\n * ```html\n * <pont2-scope-list data-pont2-scope-list data-slot=\"scope-list\" role=\"list\">\n * <div role=\"listitem\" data-slot=\"scope-list-item\" data-scope=\"openid\" data-required>\n * <label data-slot=\"scope-list-label\">\n * <pont2-prim-checkbox checked disabled required></pont2-prim-checkbox>\n * <span data-slot=\"scope-list-text\">Sign you in</span>\n * </label>\n * </div>\n * …\n * </pont2-scope-list>\n * ```\n *\n * **Form-associated** (`extends FormControlElement`): it submits the ticked\n * scopes, space-separated (OAuth `scope` syntax), under `name` (default\n * `scope`), resets, restores and follows `<fieldset disabled>` natively. The\n * legacy element exposed `.value` for its custom form to read.\n *\n * Each row is a **Checkbox primitive element** (it has behaviour) inside a\n * native `<label>`; the checkboxes have no `name`, so only the list submits.\n * Required scopes are always ticked and disabled. Scopes default to ticked;\n * the user unticks what they do not grant.\n *\n * @tag pont2-scope-list\n * @attr scopes - JSON array of `{ scope, label?, required?, granted? }`; `.scopes` is an array\n * @attr name - default \"scope\"\n * @attr disabled\n * @fires input, change - when a scope is toggled (read `.value`)\n */\nexport class ScopeList extends FormControlElement {\n static override identity = \"scope-list\";\n static override slotName = \"scope-list\";\n static override role = \"list\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n scopes: { converter: scopesConverter },\n unticked: { state: true },\n };\n\n declare scopes: ConsentScope[];\n declare protected unticked: Set<string>;\n\n constructor() {\n super();\n this.name = \"scope\";\n this.scopes = [];\n this.unticked = new Set();\n }\n\n /** The normalised scope list. */\n get list(): ConsentScope[] {\n return normalizeScopes(this.scopes);\n }\n\n /** The submitted value: ticked scopes, space-separated. */\n get value(): string {\n return scopeListValue(this.list, this.unticked);\n }\n\n protected override get hostFocusable(): boolean {\n return false; // the checkboxes are the tab stops\n }\n\n protected formValue(): string | null {\n return this.name ? this.value : null;\n }\n\n protected resetToDefault(): void {\n this.unticked = new Set();\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n const ticked = new Set(state.split(\" \"));\n this.unticked = new Set(this.list.filter(s => !ticked.has(s.scope)).map(s => s.scope));\n }\n\n private toggle(scope: string, e: Event): void {\n e.stopPropagation(); // the list's own input/change replace the checkbox's\n const next = new Set(this.unticked);\n if ((e.target as Checkbox).checked) next.delete(scope);\n else next.add(scope);\n this.unticked = next;\n // As native controls: `input` then `change`, from the list itself.\n this.dispatchEvent(new Event(\"input\", { bubbles: true, composed: true }));\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\n }\n\n override render() {\n return repeat(\n this.list,\n s => s.scope,\n s => html`<div\n role=\"listitem\"\n data-slot=\"scope-list-item\"\n data-scope=${s.scope}\n ?data-required=${s.required}\n ?data-granted=${s.granted}\n >\n <label data-slot=\"scope-list-label\">\n <pont2-prim-checkbox\n .checked=${isScopeChecked(s, this.unticked)}\n ?disabled=${this.isDisabled || s.required}\n ?required=${s.required}\n @input=${(e: Event) => e.stopPropagation()}\n @change=${(e: Event) => this.toggle(s.scope, e)}\n ></pont2-prim-checkbox>\n <span data-slot=\"scope-list-text\">${s.label}</span>\n </label>\n </div>`,\n );\n }\n}\n\ndefine(\"pont2-scope-list\", ScopeList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-scope-list\": ScopeList;\n }\n}\n","/**\n * Turning a failed flow request into words for the user: the legacy\n * `describeFlowError` (src/utils/flow-error.ts), ported (pont2 imports nothing\n * from the legacy kit), with the same English and the same message codes, so\n * a flow's localised `messages` (keyed by code) apply unchanged.\n */\n\nimport { KIT_MESSAGES_EN, msg as kitMsg, setMessages } from \"../../core/messages\";\n\nexport type FlowMessageCode =\n | \"connection_failed\"\n | \"too_many_attempts\"\n | \"server_error\"\n | \"instance_unavailable\"\n | \"generic_error\"\n | \"flow_ended\"\n | \"passkey_cancelled\"\n | \"start_again\"\n | \"continued_elsewhere_title\"\n | \"continued_elsewhere_subtitle\"\n | \"continue_here\";\n\n/** The flow codes' English (a subset of `KIT_MESSAGES_EN`, core/messages.ts). */\nexport const FLOW_MESSAGES_EN: Record<FlowMessageCode, string> = {\n connection_failed: KIT_MESSAGES_EN.connection_failed,\n too_many_attempts: KIT_MESSAGES_EN.too_many_attempts,\n server_error: KIT_MESSAGES_EN.server_error,\n instance_unavailable: KIT_MESSAGES_EN.instance_unavailable,\n generic_error: KIT_MESSAGES_EN.generic_error,\n flow_ended: KIT_MESSAGES_EN.flow_ended,\n passkey_cancelled: KIT_MESSAGES_EN.passkey_cancelled,\n start_again: KIT_MESSAGES_EN.start_again,\n continued_elsewhere_title: KIT_MESSAGES_EN.continued_elsewhere_title,\n continued_elsewhere_subtitle: KIT_MESSAGES_EN.continued_elsewhere_subtitle,\n continue_here: KIT_MESSAGES_EN.continue_here,\n};\n\nexport interface FlowErrorDescription {\n message: string;\n /** The flow is over (409): offer \"Start again\". */\n restartable: boolean;\n /** The instance has stopped: nothing will work, so offer nothing to retry. */\n unavailable?: boolean;\n}\n\nconst FLOW_ENDED_STATUS = 409;\n\n/**\n * A stopped instance (paused, or its owner's Pontive account paused, cancelled or\n * deleted) refuses everything it serves to end users with this one code and no\n * reason (pontive-spec 01, \"Who is told why\"; carry-over §6).\n */\nexport const INSTANCE_UNAVAILABLE = \"instance_unavailable\";\n\n/** Whether a failed call was refused because the instance has stopped (its own `code`, or its body's). */\nexport function isInstanceUnavailable(error: unknown): boolean {\n return readError(error).code === INSTANCE_UNAVAILABLE;\n}\n\n/**\n * Keeps the sentence a stopped instance was refused with. Once stopped, the page\n * can no longer ask for its text, so the auth service words the refusal itself\n * (in the page's language and the instance's copy). Kept in the message table,\n * it is what every widget says for the code from then on, including for\n * refusals from services that only send English.\n */\nexport function rememberUnavailable(sentence?: string): void {\n const text = sentence?.trim();\n if (text) setMessages({ [INSTANCE_UNAVAILABLE]: text });\n}\n\n/**\n * - a cancelled or timed-out WebAuthn prompt (`NotAllowedError` / `AbortError`) → passkey_cancelled\n * - `instance_unavailable` → the refusal's own sentence, kept for the page (rememberUnavailable); not restartable\n * - 409 → the server's sentence, else flow_ended; restartable\n * - no response at all (NETWORK_ERROR / TIMEOUT) → connection_failed\n * - 429 → too_many_attempts; ≥ 500 → server_error\n * - anything else → the server's sentence, else generic_error\n *\n * Text comes from `messages` when given (a set a caller holds), else the\n * page-wide message table (core/messages.ts), else English.\n */\nexport function describeFlowError(\n error: unknown,\n messages: Partial<Record<string, string>> = {},\n): FlowErrorDescription {\n const msg = (code: FlowMessageCode) => messages[code] || kitMsg(code);\n if (typeof DOMException !== \"undefined\" && error instanceof DOMException) {\n if (error.name === \"NotAllowedError\" || error.name === \"AbortError\") {\n return { message: msg(\"passkey_cancelled\"), restartable: false };\n }\n }\n const { status, code, message } = readError(error);\n if (code === INSTANCE_UNAVAILABLE) {\n rememberUnavailable(message);\n // The refusal's sentence wins over any set the caller held: it is the newest word.\n return { message: kitMsg(INSTANCE_UNAVAILABLE), restartable: false, unavailable: true };\n }\n if (status === FLOW_ENDED_STATUS) return { message: serverSentence(message) ?? msg(\"flow_ended\"), restartable: true };\n if (status === undefined && (code === \"NETWORK_ERROR\" || code === \"TIMEOUT\")) {\n return { message: msg(\"connection_failed\"), restartable: false };\n }\n if (status === 429) return { message: msg(\"too_many_attempts\"), restartable: false };\n if (status !== undefined && status >= 500) return { message: msg(\"server_error\"), restartable: false };\n return { message: serverSentence(message) ?? msg(\"generic_error\"), restartable: false };\n}\n\nfunction readError(error: unknown): { status?: number; code?: string; message?: string } {\n if (typeof error === \"string\") return { message: error };\n if (!error || typeof error !== \"object\") return {};\n const e = error as { status?: unknown; code?: unknown; message?: unknown; data?: { error?: { code?: unknown; message?: unknown } } };\n const nested = e.data?.error;\n return {\n status: typeof e.status === \"number\" ? e.status : undefined,\n code: typeof e.code === \"string\" ? e.code : typeof nested?.code === \"string\" ? nested.code : undefined,\n message: typeof e.message === \"string\" ? e.message : typeof nested?.message === \"string\" ? nested.message : undefined,\n };\n}\n\n/** A server message fit to show: a sentence, not \"HTTP 400\" or something with code in backticks. */\nfunction serverSentence(message?: string): string | undefined {\n const text = message?.trim();\n if (!text) return undefined;\n if (/^HTTP \\d{3}\\b/.test(text) || text.includes(\"`\")) return undefined;\n const sentence = text.charAt(0).toUpperCase() + text.slice(1);\n return /[.!?。!?]$/u.test(sentence) ? sentence : `${sentence}.`;\n}\n","import { ContextProvider } from \"@lit/context\";\nimport { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport type { ActionErrorDetail, ActionRequestDetail } from \"../../core/controllers/action\";\nimport { designModeContext } from \"../../core/design-mode\";\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { brandingContext, DEFAULT_BRANDING, type BrandingEntitlements } from \"../block/branding\";\nimport { describeFlowError } from \"./flow-error\";\n\nexport {\n describeFlowError,\n FLOW_MESSAGES_EN,\n INSTANCE_UNAVAILABLE,\n isInstanceUnavailable,\n rememberUnavailable,\n type FlowErrorDescription,\n type FlowMessageCode,\n} from \"./flow-error\";\n\n/**\n * What the layout needs from an auth client: one method. `Auth` from\n * `@pontive/oidc-client` satisfies it structurally, so pont2 never imports an\n * auth client (option (b), docs/kit/layout.md).\n */\nexport interface FlowClient {\n processLoginflowEvent(request: FlowEventRequest): Promise<FlowEventResponse>;\n}\n\nexport interface FlowEventRequest {\n event: string;\n data?: Record<string, unknown>;\n}\n\n/** The parts of the SDK's `ProcessEventResponse` the layout reads. */\nexport interface FlowEventResponse {\n state?: string;\n render_spec?: unknown;\n}\n\nexport interface UnregisteredElementDetail {\n tag: string;\n}\n\n/** FormData → the plain object the flow API takes (last value wins, files dropped). */\nexport function formDataToObject(fd: FormData | undefined | null): Record<string, unknown> | undefined {\n if (!fd) return undefined;\n const out: Record<string, unknown> = {};\n for (const [k, v] of fd.entries()) if (typeof v === \"string\") out[k] = v;\n return Object.keys(out).length ? out : undefined;\n}\n\nconst BANNER = \"data-flow-error\";\nconst reported = new Set<string>();\n/** One warning per page for an unanswered submission (onFormSubmit). */\nlet warnedUnanswered = false;\n\n/**\n * # `<pont2-layout>`: renders a flow screen and runs its requests\n *\n * ```ts\n * import { Auth } from \"@pontive/oidc-client\";\n * const layout = document.createElement(\"pont2-layout\");\n * layout.client = Auth; // anything with processLoginflowEvent()\n * layout.branding = response.branding; // the account's entitlements (fail closed)\n * layout.renderSpec = response.render_spec; // the server's HTML for the screen\n * ```\n *\n * ```html\n * <pont2-layout data-pont2-layout data-slot=\"layout\">\n * <form data-slot=\"layout-form\" aria-busy=\"false\">\n * …the render spec (e.g. <pont2-block>…</pont2-block>)…\n * </form>\n * </pont2-layout>\n * ```\n *\n * The **flow host** for one screen. It:\n *\n * 1. **renders the spec** (server HTML) inside one native `<form>`, upgrading\n * pont2 elements and reporting tags this bundle does not define\n * (`pont2-unregistered-element` on `document`, once per tag);\n * 2. **answers every `pont2-action`** from inside the screen (submit, provider,\n * passkey, link, OTP, resend, forgot, edit-identifier) with\n * `client.processLoginflowEvent({ event, data })`, where `data` is the\n * form's normalised FormData when the request carries one (submit, OTP\n * auto-submit); while a request is pending, another one joins it (no double\n * submit) and the form is `aria-busy`;\n * 3. **renders the next screen** when a response carries `render_spec`;\n * 4. **shows flow errors** (every `pont2-action-error` from inside) as an\n * error `pont2-alert` banner at the top of the screen, with \"Start again\"\n * (`pont2-layout-restart`) when the flow is over (409);\n * 5. **provides the branding entitlements** (`pont2:branding` context) to the\n * screen's block. Fails closed: without `branding`, the watermark shows.\n *\n * Trust boundary: the render spec is **server HTML** and is inserted as such\n * (as in the legacy `pont-layout`); everything a user types goes through\n * native inputs, never into markup. The spec must not contain its own\n * `<form>` (the layout's form is the one form).\n *\n * @tag pont2-layout\n * @prop client - `FlowClient` (e.g. the SDK's `Auth`). Without one, actions are not answered.\n * @prop renderSpec - the screen's HTML\n * @prop branding - `BrandingEntitlements` (attribute-less on purpose)\n * @prop messages - localised flow messages by code (the flow's `messages`)\n * @prop loginHint - the identifier to pre-fill email and identifier fields with (the URL's `login_hint`, from the provider)\n * @fires pont2-flow-response - `{ action, result }` after every successful request\n * @fires pont2-layout-restart - \"Start again\" pressed (the widget restarts the flow)\n * @fires pont2-unregistered-element - on `document`, `{ tag }`\n */\nexport class Layout extends HostElement {\n static override identity = \"layout\";\n static override slotName = \"layout\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n client: { attribute: false },\n renderSpec: { attribute: false },\n branding: { attribute: false },\n messages: { attribute: false },\n loginHint: { attribute: false },\n designMode: { type: Boolean, attribute: \"design-mode\", reflect: true },\n busy: { state: true },\n };\n\n declare client: FlowClient | undefined;\n declare renderSpec: string;\n declare branding: BrandingEntitlements;\n /**\n * The screen is on the designer's canvas: elements render representative examples of themselves\n * instead of their empty state (core/design-mode.ts). The dashboard's widget builder sets it.\n */\n declare designMode: boolean;\n declare messages: Partial<Record<string, string>>;\n /**\n * The identifier the page was opened with (OpenID Connect's `login_hint`). Email and identifier\n * fields the screen leaves without a `value` are pre-filled with it, as the legacy fields did by\n * reading the URL themselves (migration tracker F-11). A server prefill (`value`) wins.\n */\n declare loginHint: string | undefined;\n declare protected busy: boolean;\n\n private provider = new ContextProvider(this, { context: brandingContext, initialValue: DEFAULT_BRANDING });\n private designProvider = new ContextProvider(this, { context: designModeContext, initialValue: false });\n private pending: Promise<FlowEventResponse> | null = null;\n\n constructor() {\n super();\n this.client = undefined;\n this.renderSpec = \"\";\n this.branding = DEFAULT_BRANDING;\n this.designMode = false;\n this.messages = {};\n this.loginHint = undefined;\n this.busy = false;\n this.addEventListener(\"pont2-action\", e => this.onAction(e));\n this.addEventListener(\"pont2-action-error\", e => this.onError(e));\n }\n\n /** The layout's form (holds the screen). */\n get form(): HTMLFormElement | null {\n return this.querySelector(\":scope > form\");\n }\n\n /** Runs one flow request (what a `pont2-action` from inside triggers). */\n run(event: string, data?: Record<string, unknown>): Promise<FlowEventResponse> {\n const client = this.client;\n if (!client) return Promise.reject(new Error(\"pont2-layout has no client\"));\n if (this.pending) return this.pending;\n this.clearBanner();\n this.busy = true;\n // Synchronously, not on the next render: the request has started now.\n this.form?.setAttribute(\"aria-busy\", \"true\");\n // After the requesting button has become busy (it does so once its listener has answered).\n queueMicrotask(() => this.lockScreen());\n const request = client\n .processLoginflowEvent(data ? { event, data } : { event })\n .then(result => {\n if (typeof result?.render_spec === \"string\" && result.render_spec) this.renderSpec = result.render_spec;\n fire(this, \"pont2-flow-response\", { action: event, result });\n return result;\n })\n .finally(() => {\n this.unlockScreen();\n this.pending = null;\n this.busy = false;\n this.form?.setAttribute(\"aria-busy\", \"false\");\n });\n this.pending = request;\n return request;\n }\n\n /** The elements `lockScreen` disabled, to give back exactly those. */\n private locked: Array<HTMLElement & { disabled: boolean }> = [];\n\n /**\n * While a request runs, the screen's fields and its other buttons are disabled, as in the legacy\n * kit: nothing can be edited or pressed mid-request (migration tracker F-20, F-35). The button\n * that asked stays busy, focusably (it is not disabled). Elements already disabled are left\n * alone and stay disabled afterwards. The values were read before the request started, so\n * disabling the fields doesn't change what was sent.\n */\n private lockScreen(): void {\n const form = this.form;\n if (!form || !this.pending) return;\n for (const el of Array.from(form.querySelectorAll<HTMLElement>(\"*\"))) {\n if (!el.localName.startsWith(\"pont2-\") || !(\"disabled\" in el)) continue;\n const control = el as HTMLElement & { disabled: boolean; busy?: boolean };\n if (control.disabled || control.busy) continue;\n control.disabled = true;\n this.locked.push(control);\n }\n }\n\n private unlockScreen(): void {\n for (const el of this.locked) if (el.isConnected) el.disabled = false;\n this.locked = [];\n }\n\n private onAction(e: CustomEvent<ActionRequestDetail>): void {\n const { action, data } = e.detail;\n if (!action || !this.client) return;\n // A link with service=\"other\" is the app's, not the flow's (the legacy meaning): the layout\n // doesn't answer it, so the app can, through the same pont2-action (migration tracker F-16).\n if ((data as { service?: unknown } | undefined)?.service === \"other\") return;\n e.detail.respondWith(this.run(action, formDataToObject(data.formData as FormData | undefined)));\n }\n\n private onError(e: CustomEvent<ActionErrorDetail>): void {\n const { message, restartable } = describeFlowError(e.detail.error, this.messages);\n this.showError(message, restartable);\n }\n\n /**\n * Shows a flow error at the top of the screen (after its logo/header). It replaces any error\n * already there, the server's injected banner included (`pont2-alert[status=\"error\"]`), so the\n * screen holds one error at a time, as in the legacy kit (migration tracker F-21).\n */\n showError(message: string, restartable = false): void {\n const form = this.form;\n if (!form) return;\n this.clearBanner();\n form.querySelectorAll('pont2-alert[status=\"error\"]').forEach(el => el.remove());\n const alert = document.createElement(\"pont2-alert\");\n alert.setAttribute(\"status\", \"error\");\n alert.setAttribute(\"icon\", \"\");\n alert.setAttribute(\"description\", message);\n alert.setAttribute(BANNER, \"\");\n const banner: HTMLElement[] = [alert];\n if (restartable) {\n const shell = document.createElement(\"pont2-button\");\n shell.setAttribute(\"variant\", \"outline\");\n shell.setAttribute(BANNER, \"\");\n const b = document.createElement(\"button\");\n b.type = \"button\";\n b.textContent = this.messages.start_again || msg(\"start_again\");\n b.addEventListener(\"click\", () => fire(this, \"pont2-layout-restart\", {}));\n shell.append(b);\n banner.push(shell);\n }\n const block = form.querySelector(\":scope > pont2-block\");\n const parent = block ?? form;\n let anchor = parent.firstElementChild;\n while (anchor && /^pont2-(logo|header)$/.test(anchor.localName)) anchor = anchor.nextElementSibling;\n for (const el of banner) parent.insertBefore(el, anchor);\n }\n\n private clearBanner(): void {\n this.form?.querySelectorAll(`[${BANNER}]`).forEach(el => el.remove());\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"branding\")) this.provider.setValue(this.branding ?? DEFAULT_BRANDING);\n if (changed.has(\"designMode\")) this.designProvider.setValue(!!this.designMode);\n this.setData(\"busy\", this.busy);\n }\n\n protected override updated(changed: PropertyValues): void {\n const form = this.form;\n if (!form) return;\n form.setAttribute(\"aria-busy\", String(this.busy));\n if (changed.has(\"renderSpec\")) this.renderScreen(form);\n }\n\n private renderScreen(form: HTMLFormElement): void {\n form.innerHTML = this.renderSpec || \"\";\n const hint = this.loginHint?.trim();\n if (hint) {\n // Before the fields first render, so each takes it as its initial value (form.reset() restores it).\n for (const field of Array.from(form.querySelectorAll(\"pont2-email-field, pont2-identifier-field\"))) {\n if (!field.hasAttribute(\"value\")) field.setAttribute(\"value\", hint);\n }\n }\n for (const el of Array.from(form.querySelectorAll(\"*\"))) {\n if (!el.localName.includes(\"-\")) continue;\n if (customElements.get(el.localName)) customElements.upgrade(el);\n else if (!reported.has(el.localName)) {\n reported.add(el.localName);\n console.warn(`[pont2] <${el.localName}> is in the render spec but is not defined in this bundle.`);\n document.dispatchEvent(\n new CustomEvent<UnregisteredElementDetail>(\"pont2-unregistered-element\", { detail: { tag: el.localName } }),\n );\n }\n }\n }\n\n /**\n * The layout's form never submits natively. Every submission is either answered here (a\n * `pont2-action` the layout responds to, which prevents it) or it is a mistake: no `client`\n * yet, or a submit button without `event`. A native submission would then be a GET to the\n * current URL with every field, password included, in the query string. So whatever is left\n * unhandled is stopped here, at the form, after the submit buttons' own listeners have run.\n */\n private onFormSubmit = (e: SubmitEvent) => {\n if (e.defaultPrevented) return;\n e.preventDefault();\n if (!warnedUnanswered) {\n warnedUnanswered = true;\n console.warn(\n \"[pont2] a submission in <pont2-layout> was not answered (no client, or the submit button has no `event`). \" +\n \"Native submission is blocked.\",\n );\n }\n };\n\n override render() {\n // The form's children are the render spec, written by renderScreen(), never by this template.\n return html`<form data-slot=\"layout-form\" @submit=${this.onFormSubmit}></form>`;\n }\n}\n\ndefine(\"pont2-layout\", Layout);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-layout\": Layout;\n }\n interface HTMLElementEventMap {\n \"pont2-flow-response\": CustomEvent<{ action: string; result: FlowEventResponse }>;\n \"pont2-layout-restart\": CustomEvent<Record<string, never>>;\n }\n interface DocumentEventMap {\n \"pont2-unregistered-element\": CustomEvent<UnregisteredElementDetail>;\n }\n}\n","/**\n * The consent screen's two calls to auth-api (pontive-spec 40 §4.3), ported\n * from the legacy `pont-consent` (carry-over §8).\n *\n * Plain `fetch` rather than the auth SDK: the screen is not an auth flow. The\n * person already has a session, and the session cookie is what proves the\n * consent request is theirs, so every call is same-origin and carries it.\n *\n * GET {base}/auth/v1/consent/{id}?locales=… → { render_spec, locale?, dir? }\n * POST {base}/auth/v1/consent/{id} { event, data } → { redirect_to } | a view to render\n *\n * Errors use the platform envelope `{ error: { code, message } }` (or flat).\n * A 404 means the request expired, was already answered, or isn't this\n * session's; the server doesn't say which, and the way on is the same.\n */\n\nimport { msg } from \"../../core/messages\";\n\n/** What `GET /auth/v1/consent/{id}` answers, and a re-rendered screen. */\nexport interface ConsentView {\n render_spec: string;\n locale?: string;\n dir?: string;\n}\n\n/** What `POST /auth/v1/consent/{id}` answers. */\nexport type ConsentOutcome = { redirect_to: string } | ConsentView;\n\n/** A refused or failed consent call, shaped as `describeFlowError` reads one (`status`, `code`, `message`). */\nexport class ConsentError extends Error {\n constructor(\n message: string,\n readonly code: string,\n readonly status?: number,\n ) {\n super(message);\n this.name = \"ConsentError\";\n }\n}\n\n/** The person-facing sentence for an expired request (a 404). */\nexport const CONSENT_EXPIRED_EN = \"This request has expired. Go back to the app and try again.\";\n\n/** `consent_expired` from the page's message table, else English. */\nexport const consentExpired = () => msg(\"consent_expired\", CONSENT_EXPIRED_EN);\n\nexport function consentEndpoint(baseUrl: string, id: string): string {\n return `${baseUrl.replace(/\\/+$/, \"\")}/auth/v1/consent/${encodeURIComponent(id)}`;\n}\n\n/** Loads the screen for a consent request. */\nexport async function fetchConsent(baseUrl: string, id: string, options: { locales?: string } = {}): Promise<ConsentView> {\n const query = options.locales ? `?${new URLSearchParams({ locales: options.locales })}` : \"\";\n const body = await call(`${consentEndpoint(baseUrl, id)}${query}`, { method: \"GET\" });\n if (isView(body)) return body;\n throw new ConsentError(\"Unexpected consent response.\", \"UNEXPECTED_RESPONSE\");\n}\n\n/**\n * Answers a consent request: `allow` with the ticked scopes (`data.scope`, one\n * space-separated string, which auth-api requires), or `deny`. A 404 is reworded\n * as the expired-request sentence, so the layout's banner shows it as is.\n */\nexport async function submitConsent(\n baseUrl: string,\n id: string,\n event: string,\n data: Record<string, unknown> = {},\n): Promise<ConsentOutcome> {\n let body: unknown;\n try {\n body = await call(consentEndpoint(baseUrl, id), { method: \"POST\", body: JSON.stringify({ event, data }) });\n } catch (err) {\n if (err instanceof ConsentError && err.status === 404) throw new ConsentError(consentExpired(), err.code, err.status);\n throw err;\n }\n if (isObject(body) && typeof body.redirect_to === \"string\" && body.redirect_to) return { redirect_to: body.redirect_to };\n if (isView(body)) return body;\n throw new ConsentError(\"Unexpected consent response.\", \"UNEXPECTED_RESPONSE\");\n}\n\n/**\n * Whether the browser may be sent to a `redirect_to`. It is the app's\n * registered redirect URI, which may be a native app's custom scheme\n * (`com.example.app:/callback`), so this is not limited to http(s); it only\n * refuses the schemes that run code or read local data in this page.\n */\nexport function isNavigableRedirect(url: string, base = globalThis.location?.href): boolean {\n try {\n const { protocol } = new URL(url, base);\n return ![\"javascript:\", \"data:\", \"vbscript:\", \"blob:\", \"file:\"].includes(protocol);\n } catch {\n return false;\n }\n}\n\n/* ------------------------------------------------------------------ */\n\nasync function call(url: string, init: RequestInit): Promise<unknown> {\n let response: Response;\n try {\n response = await fetch(url, {\n ...init,\n credentials: \"same-origin\",\n headers: { Accept: \"application/json\", ...(init.body ? { \"Content-Type\": \"application/json\" } : {}) },\n });\n } catch (err) {\n throw new ConsentError(err instanceof Error ? err.message : String(err), \"NETWORK_ERROR\");\n }\n const body: unknown = await response.json().catch(() => undefined);\n if (!response.ok) {\n const flat = isObject(body) ? body : {};\n const envelope = isObject(flat.error) ? flat.error : {};\n const code = text(envelope.code) ?? text(flat.code) ?? \"API_ERROR\";\n const message = text(envelope.message) ?? text(flat.message) ?? `HTTP ${response.status}: ${response.statusText}`;\n throw new ConsentError(message, code, response.status);\n }\n return body;\n}\n\nfunction isView(body: unknown): body is ConsentView {\n return isObject(body) && typeof body.render_spec === \"string\";\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === \"string\" && value !== \"\" ? value : undefined;\n}\n","import { ContextConsumer } from \"@lit/context\";\nimport { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { Spinner } from \"../../primitives/spinner/spinner\";\nimport { brandingContext, DEFAULT_BRANDING, type BrandingEntitlements } from \"../block/branding\";\nimport { describeFlowError } from \"../layout/flow-error\";\nimport type { FlowClient, FlowEventRequest, FlowEventResponse, Layout } from \"../layout/layout\";\nimport \"../layout/layout\";\nimport { ConsentError, consentExpired, fetchConsent, isNavigableRedirect, submitConsent, type ConsentView } from \"./consent-api\";\n\nexport {\n CONSENT_EXPIRED_EN,\n ConsentError,\n consentEndpoint,\n consentExpired,\n fetchConsent,\n isNavigableRedirect,\n submitConsent,\n type ConsentOutcome,\n type ConsentView,\n} from \"./consent-api\";\n\n/**\n * # `<pont2-consent>`: an app asks for access; the person allows or denies\n *\n * ```html\n * <pont2-consent consent-request=\"cr_123\"></pont2-consent>\n * ```\n *\n * The OAuth consent screen (pontive-spec 40 §4.3), ported from the legacy\n * `pont-consent` (carry-over §8). **Not a flow widget:** the person already has\n * a session, so there is no flow to start and no SDK to wait for. The screen is\n * one consent request, which auth-api renders like a flow view (the built-in\n * `authorize_app` widget in the instance's brand and copy) and answers with a\n * redirect.\n *\n * It still renders through `pont2-layout`, with a consent-specific **client**,\n * so the markup, the error banner, the busy state and the branding entitlement\n * work as on every other screen:\n *\n * - **Load:** `GET {base-url}/auth/v1/consent/{consent-request}?locales=…`, same\n * origin with the session cookie (`fetchConsent`). The view's `locale` and\n * `dir` become the element's `lang` and `dir`.\n * - **Answer:** Allow and Deny are submit buttons naming the `allow` / `deny`\n * event; `pont2-scope-list` submits the ticked scopes as `scope`, one\n * space-separated string. The client posts `{ event, data }`\n * (`submitConsent`) and then either sends the browser to `redirect_to` (the\n * app's redirect URI, which may be a custom scheme; only code-running schemes\n * are refused) or renders the screen the server sent back.\n * - **Errors:** a request that expired, was already answered or isn't this\n * session's (404) says \"This request has expired. Go back to the app and try\n * again.\" (`consent_expired`) and offers nothing to retry. Any other failure\n * is worded by `describeFlowError` and offers \"Start again\", which reloads the\n * request.\n *\n * @tag pont2-consent\n * @attr consent-request - the consent request's id (the page's `consent_request` parameter)\n * @attr base-url - where auth-api is; empty (default) means same origin, which the session cookie needs\n * @attr locales - preferred languages, passed to the load (`?locales=`)\n * @prop branding - the account's branding entitlements (this, else a `pont2-provider`'s; fail closed: the watermark shows)\n */\nexport class Consent extends HostElement {\n static override identity = \"consent\";\n\n static override properties: PropertyDeclarations = {\n consentRequest: { type: String, attribute: \"consent-request\" },\n baseUrl: { type: String, attribute: \"base-url\" },\n locales: { type: String },\n branding: { attribute: false },\n renderSpec: { state: true },\n loadError: { state: true },\n };\n\n declare consentRequest: string;\n declare baseUrl: string;\n declare locales: string;\n declare branding: BrandingEntitlements | undefined;\n private readonly brandingConsumer = new ContextConsumer(this, { context: brandingContext, subscribe: true });\n declare protected renderSpec: string;\n declare protected loadError: { message: string; retryable: boolean } | null;\n\n protected readonly messagesController = new MessagesController(this);\n\n /** Bumped per load, so only the latest answer lands on the screen. */\n private loadSeq = 0;\n /** The request, server and languages last loaded: a change means load again. */\n private loadedKey: string | null = null;\n\n /**\n * What the layout calls for Allow / Deny. Stable for the element's lifetime:\n * the layout keeps it across screens.\n */\n readonly client: FlowClient = {\n processLoginflowEvent: (request: FlowEventRequest) => this.answer(request),\n };\n\n constructor() {\n super();\n this.consentRequest = \"\";\n this.baseUrl = \"\";\n this.locales = \"\";\n this.branding = undefined;\n this.renderSpec = \"\";\n this.loadError = null;\n this.addEventListener(\"pont2-layout-restart\", () => void this.load());\n }\n\n /** The element's layout. */\n get layout(): Layout | null {\n return this.querySelector(\"pont2-layout\");\n }\n\n /** Loads (or reloads) the consent request. */\n async load(): Promise<void> {\n const seq = ++this.loadSeq;\n this.loadError = null;\n try {\n if (!this.consentRequest) throw new ConsentError(\"No consent request was given.\", \"MISSING_REQUEST\");\n const view = await fetchConsent(this.baseUrl, this.consentRequest, { locales: this.locales || undefined });\n if (seq === this.loadSeq) this.show(view);\n } catch (err) {\n if (seq !== this.loadSeq) return;\n console.error(`[pont2] <${this.localName}>: loading the consent request failed:`, err);\n const expired = (err as { status?: number })?.status === 404;\n const { message, unavailable } = describeFlowError(err);\n // An empty shell to show the error in. An expired request stays expired; a stopped instance stays stopped.\n this.renderSpec = \"<pont2-block></pont2-block>\";\n this.loadError = expired ? { message: consentExpired(), retryable: false } : { message, retryable: !unavailable };\n }\n }\n\n private show(view: ConsentView): void {\n if (view.locale) this.lang = view.locale;\n if (view.dir === \"rtl\" || view.dir === \"ltr\") this.dir = view.dir;\n this.renderSpec = view.render_spec;\n }\n\n private async answer({ event, data }: FlowEventRequest): Promise<FlowEventResponse> {\n const outcome = await submitConsent(this.baseUrl, this.consentRequest, event, data);\n if (\"redirect_to\" in outcome) {\n if (!isNavigableRedirect(outcome.redirect_to)) {\n throw new ConsentError(\"Unexpected consent response.\", \"UNSAFE_REDIRECT\");\n }\n location.assign(outcome.redirect_to);\n return {};\n }\n this.show(outcome);\n return { render_spec: outcome.render_spec };\n }\n\n protected override willUpdate(_changed: PropertyValues): void {\n this.setData(\"state\", this.loadError ? \"error\" : this.renderSpec ? \"screen\" : \"loading\");\n // First render, or a different request, server or language: load (again).\n const key = JSON.stringify([this.consentRequest, this.baseUrl, this.locales]);\n if (key !== this.loadedKey) {\n this.loadedKey = key;\n void this.load();\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n // The app's placeholder (`<… ><div part=\"fallback\">…</div></…>`, which the pontkit bindings\n // rely on) goes once there is a screen or an error to show (migration tracker F-17).\n if (this.renderSpec) this.querySelector(':scope > [part=\"fallback\"]')?.remove();\n if (changed.has(\"loadError\") && this.loadError) {\n const { message, retryable } = this.loadError;\n const layout = this.layout;\n void layout?.updateComplete.then(() => layout.showError(message, retryable));\n }\n }\n\n override render() {\n if (!this.renderSpec) {\n // The app's own placeholder stands in for the spinner while it is there.\n if (this.querySelector(':scope > [part=\"fallback\"]')) return nothing;\n return html`<div data-slot=\"flow-widget-loading\">\n <span ${Spinner.part({ \"aria-label\": msg(\"loading\") })}></span>\n </div>`;\n }\n return html`<pont2-layout .client=${this.client} .branding=${this.branding ?? this.brandingConsumer.value ?? DEFAULT_BRANDING} .renderSpec=${this.renderSpec}></pont2-layout>`;\n }\n}\n\ndefine(\"pont2-consent\", Consent);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-consent\": Consent;\n }\n}\n","import { createContext } from \"@lit/context\";\n\nimport type { WidgetClient } from \"../flow-widget/flow-widget\";\n\n/**\n * The contexts `<pont2-provider>` provides (docs/kit/provider.md), beside the\n * `pont2:branding` one the block reads (`kit/block/branding.ts`).\n *\n * They are the Context Community Protocol (`context-request` events) through\n * `@lit/context`, keyed `pont2:*`, apart from the legacy `pont:*` keys\n * (docs/08-parallel-constraints.md §4). A consumer that connects before the\n * provider is defined still finds it: `core/context-root.ts` replays the\n * requests nobody answered.\n */\n\n/**\n * Whether this browser is signed in, as the provider knows it.\n *\n * `resolved` is the provider's knowledge, not the SDK's: it means\n * `restoreSession()` has come back. Until then `isAuthenticated` is `false` for\n * everyone, so nothing may act on it (a signed-in user with an HttpOnly refresh\n * cookie holds no session locally on a fresh page).\n */\nexport interface AuthState {\n isAuthenticated: boolean;\n resolved: boolean;\n}\n\n/** Before the provider has asked: nobody is known to be signed in, and nobody may act on it. */\nexport const UNRESOLVED_AUTH: AuthState = { isAuthenticated: false, resolved: false };\n\n/** `pont2:auth`: the auth state, read by `pont2-signed-in` / `pont2-signed-out`. */\nexport const authStateContext = createContext<AuthState>(\"pont2:auth\");\n\n/**\n * `pont2:client`: the flow widgets' client (the injected SDK). A widget given\n * its own `client` keeps it; one without uses this. Undefined until the\n * provider has configured the SDK, so no widget starts a flow on an\n * unconfigured one.\n */\nexport const clientContext = createContext<WidgetClient | undefined>(\"pont2:client\");\n\n/**\n * `pont2:login-hint`: the identifier the page was opened with (OpenID Connect's\n * `login_hint`), which the flow host pre-fills the email and identifier fields\n * with (migration tracker F-11).\n */\nexport const loginHintContext = createContext<string | undefined>(\"pont2:login-hint\");\n","import { ContextConsumer } from \"@lit/context\";\nimport { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { MessagesController, msg, setMessages } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { Spinner } from \"../../primitives/spinner/spinner\";\nimport { brandingContext, DEFAULT_BRANDING, type BrandingEntitlements } from \"../block/branding\";\nimport { describeFlowError, type FlowMessageCode } from \"../layout/flow-error\";\nimport type { FlowClient, Layout } from \"../layout/layout\";\nimport \"../layout/layout\";\nimport { clientContext, loginHintContext } from \"../provider/contexts\";\n\n/**\n * What a widget needs from an auth client: the layout's `processLoginflowEvent`\n * plus `startLoginflow`, and optionally `whenConfigured`. The SDK's `Auth`\n * satisfies it structurally (docs/kit/layout.md, option (b)).\n */\nexport interface WidgetClient extends FlowClient {\n startLoginflow(flowId?: string): Promise<FlowStart>;\n whenConfigured?(): Promise<void>;\n}\n\n/** The parts of the SDK's `StartLoginflowResponse` a widget reads. */\nexport interface FlowStart {\n render_spec?: unknown;\n messages?: Record<string, string>;\n}\n\n/** The parts of the SDK's `FlowStateChangeEvent` a widget reads. */\nexport interface FlowStateEvent {\n eventType: string;\n flowType?: string;\n render_spec?: unknown;\n messages?: Record<string, string>;\n}\n\n/**\n * Feeds the SDK's asynchronous flow-state changes (a resumed flow, a flow an\n * emailed link continued, \"continued in another tab\") to every connected\n * pont2 flow widget of that `flowType`.\n *\n * The SDK reports them only through the one `onFlowStateChange` callback of\n * `Auth.configure()` (which replaces the whole configuration), so the widget\n * cannot subscribe by itself; the app that configures `Auth` passes this:\n *\n * ```ts\n * Auth.configure({ …config, onFlowStateChange: dispatchFlowState });\n * ```\n */\nexport function dispatchFlowState(event: FlowStateEvent): void {\n document.dispatchEvent(new CustomEvent<FlowStateEvent>(\"pont2-flow-state\", { detail: event }));\n}\n\n/** Text placed in a double-quoted attribute of markup built as a string. */\nexport function escapeAttr(value: string): string {\n return value.replace(/&/g, \"&\").replace(/\"/g, \""\").replace(/</g, \"<\").replace(/>/g, \">\");\n}\n\n/** How long to wait for `client.whenConfigured()` before warning and trying anyway. */\nconst CONFIGURE_TIMEOUT = 5000;\n\n/**\n * # FlowWidget: the base of `<pont2-signin>` / `<pont2-signup>`\n *\n * ```ts\n * import { Auth } from \"@pontive/oidc-client\";\n * import { dispatchFlowState } from \"@pontive/pontkit-core/pont2\";\n *\n * Auth.configure({ …, onFlowStateChange: dispatchFlowState });\n * document.querySelector(\"pont2-signin\")!.client = Auth;\n * ```\n *\n * ```html\n * <pont2-signin data-pont2-flow-widget data-slot=\"flow-widget\" data-state=\"screen\">\n * <pont2-layout>…the current screen…</pont2-layout>\n * </pont2-signin>\n * ```\n *\n * It **starts the flow** (`client.startLoginflow(flowId)`, after\n * `client.whenConfigured()` when the client has one), renders **one\n * `pont2-layout`** with the screen, the client, the branding entitlements and\n * the flow's localised messages, and keeps it current:\n *\n * - each request's next screen is rendered by the layout itself;\n * - asynchronous changes arrive through `dispatchFlowState` (see above): a new\n * `render_spec`, new `messages`, or `flow_continued_elsewhere`, which shows\n * \"You continued in another tab\" with a \"Continue here instead\" link\n * (`continue_here`, handled by the SDK);\n * - \"Start again\" in the layout (`pont2-layout-restart`), or `restart()`,\n * starts the flow over;\n * - a flow that fails to start shows the error in the layout, restartable.\n *\n * Until the first screen arrives it shows a spinner (`data-state=\"loading\"`).\n *\n * Nesting `pont2-layout` in a kit template is the allow-listed case (docs/10\n * §5 rule 6): the layout is the stateful flow host, one per widget.\n *\n * Inside a `<pont2-provider>` it needs nothing: the provider's client\n * (`pont2:client`), branding entitlements (`pont2:branding`) and login hint\n * (`pont2:login-hint`) are used unless the widget is given its own.\n *\n * @prop client - `WidgetClient` (e.g. the SDK's `Auth`); the flow starts once there is one (this, else the provider's) and the widget is connected\n * @prop branding - `BrandingEntitlements` from the backend (attribute-less; this, else the provider's, else fail closed)\n * @attr flow-id - the flow to start (each widget has a default)\n * @fires pont2-flow-response - (from the layout) after every successful request\n */\nexport abstract class FlowWidget extends HostElement {\n static override identity = \"flow-widget\";\n static override slotName = \"flow-widget\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n client: { attribute: false },\n branding: { attribute: false },\n flowId: { type: String, attribute: \"flow-id\" },\n renderSpec: { state: true },\n messages: { state: true },\n starting: { state: true },\n startError: { state: true },\n providedClient: { state: true },\n };\n\n /** The app's own client. Wins over the provider's. */\n declare client: WidgetClient | undefined;\n /** The app's own entitlements. Win over the provider's; without either, the watermark shows. */\n declare branding: BrandingEntitlements | undefined;\n declare flowId: string;\n declare protected renderSpec: string;\n declare protected messages: Partial<Record<string, string>>;\n declare protected starting: boolean;\n declare protected startError: { message: string; restartable: boolean } | null;\n /** Re-renders when the page's message table changes (the loading label). */\n protected readonly messagesController = new MessagesController(this);\n /** The provider's client (`pont2:client`), undefined until it has configured the SDK. */\n declare protected providedClient: WidgetClient | undefined;\n private readonly brandingConsumer = new ContextConsumer(this, { context: brandingContext, subscribe: true });\n private readonly hintConsumer = new ContextConsumer(this, { context: loginHintContext, subscribe: true });\n\n /** The SDK's `flowType` this widget runs (\"signin\", \"signup\"): which flow-state events apply. */\n protected abstract readonly flowType: string;\n\n private started = false;\n\n constructor() {\n super();\n this.client = undefined;\n this.branding = undefined;\n this.providedClient = undefined;\n new ContextConsumer(this, {\n context: clientContext,\n subscribe: true,\n callback: value => (this.providedClient = value),\n });\n this.flowId = \"\";\n this.renderSpec = \"\";\n this.messages = {};\n this.starting = false;\n this.startError = null;\n this.addEventListener(\"pont2-layout-restart\", () => void this.restart());\n }\n\n /** The widget's layout. */\n get layout(): Layout | null {\n return this.querySelector(\"pont2-layout\");\n }\n\n /** The client the flow runs on: the widget's own, else the provider's. */\n get effectiveClient(): WidgetClient | undefined {\n return this.client ?? this.providedClient;\n }\n\n /** Whether the flow runs on the provider's client (which restarts it on a locale change). */\n get usesProvidedClient(): boolean {\n return !this.client && !!this.providedClient;\n }\n\n /** Starts the flow over. */\n async restart(): Promise<void> {\n this.started = false;\n await this.start();\n }\n\n /** Applies an SDK flow-state change (what `dispatchFlowState` delivers). */\n applyFlowState(event: FlowStateEvent): void {\n if (event.flowType && event.flowType !== this.flowType) return;\n if (event.messages) this.receiveMessages(event.messages);\n if (event.eventType === \"flow_continued_elsewhere\") {\n this.startError = null;\n this.renderSpec = this.continuedElsewhereSpec();\n return;\n }\n if (typeof event.render_spec === \"string\" && event.render_spec) {\n this.startError = null;\n this.renderSpec = event.render_spec;\n }\n }\n\n /** A set the flow sent: this widget's, and the page's message table (core/messages.ts). */\n private receiveMessages(messages: Record<string, string>): void {\n this.messages = { ...messages };\n setMessages(messages);\n }\n\n private msg(code: FlowMessageCode): string {\n return this.messages[code] || msg(code);\n }\n\n private continuedElsewhereSpec(): string {\n return `<pont2-block>\n <pont2-header>\n <pont2-title content=\"${escapeAttr(this.msg(\"continued_elsewhere_title\"))}\"></pont2-title>\n <pont2-subtitle content=\"${escapeAttr(this.msg(\"continued_elsewhere_subtitle\"))}\"></pont2-subtitle>\n </pont2-header>\n <pont2-link label=\"${escapeAttr(this.msg(\"continue_here\"))}\" event=\"continue_here\"></pont2-link>\n</pont2-block>`;\n }\n\n private onFlowState = (e: Event) => this.applyFlowState((e as CustomEvent<FlowStateEvent>).detail);\n\n override connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener(\"pont2-flow-state\", this.onFlowState);\n void this.start();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"pont2-flow-state\", this.onFlowState);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n this.setData(\"state\", this.startError ? \"error\" : this.renderSpec ? \"screen\" : \"loading\");\n // Only a newly set client starts the flow; a failed start waits for \"Start again\"\n // (re-renders must never retry on their own).\n if ((changed.has(\"client\") || changed.has(\"providedClient\")) && this.effectiveClient && this.isConnected && !this.started) {\n void this.start();\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n // The app's placeholder (`<… ><div part=\"fallback\">…</div></…>`, which the pontkit bindings\n // rely on) goes once there is a screen or an error to show (migration tracker F-17).\n if (this.renderSpec) this.querySelector(':scope > [part=\"fallback\"]')?.remove();\n // The layout renders its form on its own update; show the error once it has.\n if (changed.has(\"startError\") && this.startError) {\n const { message, restartable } = this.startError;\n const layout = this.layout;\n // \"Start again\", unless the instance has stopped: starting again would only be refused again.\n void layout?.updateComplete.then(() => layout.showError(message, restartable));\n }\n }\n\n private async start(): Promise<void> {\n const client = this.effectiveClient;\n if (!client || this.started) return;\n this.started = true;\n this.starting = true;\n this.startError = null;\n try {\n if (client.whenConfigured) {\n const configured = await Promise.race([\n client.whenConfigured().then(() => true),\n new Promise<false>(r => setTimeout(() => r(false), CONFIGURE_TIMEOUT)),\n ]);\n if (!configured) console.warn(`[pont2] <${this.localName}>: the client is not configured after ${CONFIGURE_TIMEOUT}ms.`);\n }\n const flowId = this.flowId || this.defaultFlowId();\n // No id at all (an invitation): the SDK picks the flow from the page's path.\n const res = await (flowId ? client.startLoginflow(flowId) : client.startLoginflow());\n if (res?.messages) this.receiveMessages(res.messages);\n if (typeof res?.render_spec === \"string\") this.renderSpec = res.render_spec;\n } catch (err) {\n console.error(`[pont2] <${this.localName}>: starting the flow failed:`, err);\n this.started = false;\n // An empty shell to show the error in, with \"Start again\" (restartable).\n this.renderSpec = \"<pont2-block></pont2-block>\";\n const { message, unavailable } = describeFlowError(err, this.messages);\n this.startError = { message, restartable: !unavailable };\n } finally {\n this.starting = false;\n }\n }\n\n /** The flow id used when `flow-id` is not set; `undefined` lets the SDK choose (an invitation). */\n protected abstract defaultFlowId(): string | undefined;\n\n override render() {\n if (!this.renderSpec) {\n // The app's own placeholder stands in for the spinner while it is there.\n if (this.querySelector(':scope > [part=\"fallback\"]')) return nothing;\n return html`<div data-slot=\"flow-widget-loading\">\n <span ${Spinner.part({ \"aria-label\": msg(\"loading\") })}></span>\n </div>`;\n }\n return html`<pont2-layout\n .client=${this.effectiveClient}\n .branding=${this.branding ?? this.brandingConsumer.value ?? DEFAULT_BRANDING}\n .loginHint=${this.hintConsumer.value}\n .messages=${this.messages}\n .renderSpec=${this.renderSpec}\n ></pont2-layout>`;\n }\n}\n\n/**\n * # `<pont2-signin>`: the sign-in widget\n *\n * Runs `sys_signin-flow-passkey` (the legacy default) unless `flow-id` says otherwise.\n *\n * @tag pont2-signin\n */\nexport class SignIn extends FlowWidget {\n protected readonly flowType = \"signin\";\n protected defaultFlowId() {\n return \"sys_signin-flow-passkey\";\n }\n}\n\n/**\n * # `<pont2-signup>`: the sign-up widget\n *\n * Runs `sys_signup-flow` (the legacy default) unless `flow-id` says otherwise.\n *\n * @tag pont2-signup\n */\nexport class SignUp extends FlowWidget {\n protected readonly flowType = \"signup\";\n protected defaultFlowId() {\n return \"sys_signup-flow\";\n }\n}\n\n/**\n * # `<pont2-invitation>`: accepting an invitation\n *\n * The invitee arrives from an emailed link holding a token and nothing else.\n * They aren't asked who they are, since the invitation already knows: the widget\n * starts the **invitation flow**, which resolves the token, decides whether the\n * invitee signs in or registers, and accepts the invitation once they are\n * authenticated. A port of the legacy `pont-invitation` (migration tracker W-4).\n *\n * It starts with **no flow id**: the SDK takes the invitation flow from the\n * page's path, so the app names that path as `invitationUrl` when it configures\n * the SDK (`<pont2-provider invitation-url>`). An invitation answered by the\n * sign-in flow would sign the invitee in and join them to nothing, which is why\n * this is its own element. The page should also drop an existing session before\n * the flow, which `<pont2-provider>` does on a page opened with `?invite_token=`.\n *\n * Everything on screen comes from the flow's render spec: the instance's own\n * invitation widgets if it published any, else the built-in ones.\n *\n * @tag pont2-invitation\n */\nexport class Invitation extends FlowWidget {\n protected readonly flowType = \"invitation\";\n protected defaultFlowId() {\n return undefined;\n }\n}\n\ndefine(\"pont2-signin\", SignIn);\ndefine(\"pont2-signup\", SignUp);\ndefine(\"pont2-invitation\", Invitation);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-signin\": SignIn;\n \"pont2-signup\": SignUp;\n \"pont2-invitation\": Invitation;\n }\n interface DocumentEventMap {\n \"pont2-flow-state\": CustomEvent<FlowStateEvent>;\n }\n}\n","/**\n * Previewing pont2 screens without a server: what the dashboard's branding\n * editor shows (docs/12-theming-integration.md §3).\n *\n * The backend does not emit pont2 render specs yet (docs/09 decision 2), so a\n * preview cannot ask a real flow for its screens. These sample screens are\n * written the way a render spec would write them, and between them they use\n * every auth element whose tokens a brand is likely to change.\n *\n * Preview inside a real `<pont2-signin>` / `<pont2-signup>`, not a bare\n * `pont2-layout`: widget-scope theme values (`widgets.signin` …) apply to the\n * widget's tag, so only a widget shows them.\n *\n * ```ts\n * import { previewClient, PREVIEW_SCREENS } from \"@pontive/pontkit-core/pont2\";\n *\n * const widget = document.querySelector(\"pont2-signin\")!;\n * widget.client = previewClient(PREVIEW_SCREENS.signin.spec);\n * // switching screens later:\n * widget.client = previewClient(PREVIEW_SCREENS.verify.spec);\n * void widget.restart();\n * ```\n *\n * Pure data and a plain object: no DOM, no Lit, no network.\n */\nimport type { FlowEventRequest, FlowEventResponse } from \"../layout/layout\";\nimport type { FlowStart, WidgetClient } from \"./flow-widget\";\n\nexport interface PreviewScreen {\n /** A name for a screen picker. */\n label: string;\n /** The widget to preview it in (its tag is `pont2-<flow>`). */\n flow: \"signin\" | \"signup\";\n /** The screen, as a render spec would write it. */\n spec: string;\n}\n\nconst signin = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Welcome back\"></pont2-title>\n <pont2-subtitle content=\"Sign in to your account\"></pont2-subtitle>\n </pont2-header>\n <pont2-provider-field providers=\"google apple github\"></pont2-provider-field>\n <pont2-divider label=\"Or continue with\"></pont2-divider>\n <pont2-identifier-field identifiers=\"email username\" required></pont2-identifier-field>\n <pont2-submit-button event=\"submit_identifier\" label=\"Continue\"></pont2-submit-button>\n <pont2-passkey-button content=\"icon-label\" event=\"passkey\"></pont2-passkey-button>\n <pont2-link prompt=\"Don't have an account?\" label=\"Sign up\" event=\"goto_signup\"></pont2-link>\n</pont2-block>`;\n\nconst password = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Enter your password\"></pont2-title>\n </pont2-header>\n <pont2-edit-identifier identifier=\"ada@example.com\" event=\"change_identifier\"></pont2-edit-identifier>\n <pont2-password-field required rules=\"[]\" forgot forgot-event=\"forgot_password\"></pont2-password-field>\n <pont2-submit-button event=\"submit_password\" label=\"Sign in\"></pont2-submit-button>\n</pont2-block>`;\n\nconst verify = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Check your email\"></pont2-title>\n <pont2-subtitle content=\"We sent a 6-digit code to ada@example.com\"></pont2-subtitle>\n </pont2-header>\n <pont2-alert status=\"info\" icon description=\"The code expires in 10 minutes.\"></pont2-alert>\n <pont2-container align=\"center\">\n <pont2-otp-field layout=\"simple\" required></pont2-otp-field>\n </pont2-container>\n <pont2-submit-button event=\"verify_code\" label=\"Verify\"></pont2-submit-button>\n <pont2-otp-resend duration=\"30\" event=\"resend_code\"></pont2-otp-resend>\n</pont2-block>`;\n\nconst signup = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Create an account\"></pont2-title>\n <pont2-subtitle content=\"It only takes a minute\"></pont2-subtitle>\n </pont2-header>\n <pont2-name-field required></pont2-name-field>\n <pont2-email-field required></pont2-email-field>\n <pont2-password-field required></pont2-password-field>\n <pont2-confirm-field required></pont2-confirm-field>\n <pont2-submit-button event=\"submit_signup\" label=\"Create account\"></pont2-submit-button>\n <pont2-link prompt=\"Already have an account?\" label=\"Sign in\" event=\"goto_signin\"></pont2-link>\n</pont2-block>`;\n\n/** Sample screens for a branding preview, keyed by id. */\nexport const PREVIEW_SCREENS = {\n signin: { label: \"Sign in\", flow: \"signin\", spec: signin },\n password: { label: \"Password\", flow: \"signin\", spec: password },\n verify: { label: \"Verification code\", flow: \"signin\", spec: verify },\n signup: { label: \"Sign up\", flow: \"signup\", spec: signup },\n} as const satisfies Record<string, PreviewScreen>;\n\nexport type PreviewScreenId = keyof typeof PREVIEW_SCREENS;\n\nexport interface PreviewClientOptions {\n /** How long each request stays busy, in ms, so busy states can be seen (default 600). */\n delay?: number;\n /** The flow's localised messages (flow errors, \"Start again\" …). */\n messages?: Record<string, string>;\n}\n\n/**\n * A `WidgetClient` that shows one screen and never leaves it. Every request\n * (a submit, a provider button, a link) is busy for `delay` ms and then\n * resolves without a new screen, so the screen and what was typed stay put.\n * Nothing is sent anywhere.\n */\nexport function previewClient(spec: string, options: PreviewClientOptions = {}): WidgetClient {\n const delay = options.delay ?? 600;\n const messages = { ...options.messages };\n return {\n async whenConfigured() {},\n async startLoginflow(): Promise<FlowStart> {\n return { render_spec: spec, messages };\n },\n processLoginflowEvent(_request: FlowEventRequest): Promise<FlowEventResponse> {\n return new Promise(resolve => setTimeout(() => resolve({ state: \"preview\" }), delay));\n },\n };\n}\n","/**\n * Preview specimens: one component at a time, for the dashboard's Component\n * scope (docs/14-dashboard-branding.md §\"Previews\").\n *\n * `PREVIEW_SCREENS` shows whole sign-in screens, which is right for the\n * Global scope. When the branding editor is open on one component (\"Button\",\n * \"Alert\" …) it shows that component's specimen instead: its variants, sizes\n * and states side by side, so every token in its panel has something visible\n * to change.\n *\n * - **Keyed by token component** (a manifest `component`, `tokens.json`), not\n * by tag: that is what the editor's items are. A guardrail checks every key\n * is one.\n * - **pont2 owns the markup.** The dashboard renders `html` as given and never\n * writes pont2 markup itself, so a markup change here never needs a\n * dashboard change.\n * - Specimens sit at the global scope (no widget around them): the editor's\n * Component scope edits `:root` tokens.\n * - Nothing in a specimen reaches a server: there is no flow host, so action\n * buttons only show their busy state, if anything.\n *\n * Pure data: no DOM, no Lit, no network.\n */\n\nexport interface PreviewSpecimen {\n /** A name for the specimen. */\n label: string;\n /** The markup to render, inside a `<form>` that does not submit. */\n html: string;\n}\n\nconst row = (items: string) => `<div style=\"display:flex;flex-wrap:wrap;gap:.75rem;align-items:center\">${items}</div>`;\nconst stack = (items: string, width = \"24rem\") =>\n `<div style=\"display:grid;gap:1.5rem;max-width:${width}\">${items}</div>`;\nconst caption = (text: string) =>\n `<p style=\"margin:0 0 .5rem;font-size:.75rem;opacity:.6\">${text}</p>`;\nconst section = (title: string, body: string) => `<section>${caption(title)}${body}</section>`;\n\nconst VARIANTS = [\"default\", \"secondary\", \"outline\", \"ghost\", \"destructive\", \"link\"];\nconst SIZES = [\"xs\", \"sm\", \"default\", \"lg\"];\n\nconst button = stack(\n [\n section(\n \"Variants\",\n row(VARIANTS.map(v => `<button type=\"button\" data-pont2-button data-variant=\"${v}\">${v[0].toUpperCase()}${v.slice(1)}</button>`).join(\"\")),\n ),\n section(\n \"Sizes\",\n row(SIZES.map(s => `<button type=\"button\" data-pont2-button data-size=\"${s}\">Size ${s}</button>`).join(\"\")),\n ),\n section(\n \"Disabled\",\n row(`<button type=\"button\" data-pont2-button disabled>Default</button><button type=\"button\" data-pont2-button data-variant=\"outline\" disabled>Outline</button>`),\n ),\n ].join(\"\"),\n \"40rem\",\n);\n\nconst field = (id: string, label: string, input: string, description = \"\") =>\n `<pont2-prim-field>\n <label data-pont2-label data-pont2-field-label data-slot=\"field-label\" for=\"${id}\">${label}</label>\n ${input}\n ${description ? `<pont2-prim-field-description>${description}</pont2-prim-field-description>` : \"\"}\n </pont2-prim-field>`;\n\nconst inputs = stack(\n [\n section(\"Default\", `<input data-pont2-input id=\"s-input\" placeholder=\"you@example.com\">`),\n section(\"Filled\", `<input data-pont2-input value=\"ada@example.com\">`),\n section(\"Invalid\", `<input data-pont2-input aria-invalid=\"true\" value=\"not-an-email\">`),\n section(\"Disabled\", `<input data-pont2-input disabled value=\"Disabled\">`),\n ].join(\"\"),\n);\n\nconst fields = stack(\n [\n field(\"s-email\", \"Email\", `<input data-pont2-input id=\"s-email\" type=\"email\" placeholder=\"you@example.com\">`, \"We'll never share it.\"),\n field(\"s-name\", \"Name\", `<input data-pont2-input id=\"s-name\" aria-invalid=\"true\">`, \"This field is required.\"),\n `<pont2-email-field required></pont2-email-field>`,\n `<pont2-password-field required rules=\"[]\" forgot></pont2-password-field>`,\n ].join(\"\"),\n);\n\nconst checkbox = stack(\n [\n row(`<pont2-checkbox id=\"s-c1\" checked></pont2-checkbox><label data-pont2-label for=\"s-c1\">Remember me</label>`),\n row(`<pont2-checkbox id=\"s-c2\"></pont2-checkbox><label data-pont2-label for=\"s-c2\">Unchecked</label>`),\n row(`<pont2-checkbox id=\"s-c3\" aria-invalid=\"true\"></pont2-checkbox><label data-pont2-label for=\"s-c3\">Invalid</label>`),\n row(`<pont2-checkbox id=\"s-c4\" checked disabled></pont2-checkbox><label data-pont2-label for=\"s-c4\">Disabled</label>`),\n ].join(\"\"),\n);\n\nconst alerts = stack(\n [\n `<pont2-alert icon heading=\"Default\" description=\"A neutral message.\"></pont2-alert>`,\n `<pont2-alert icon status=\"info\" heading=\"New sign-in\" description=\"We noticed a sign-in from a new device.\"></pont2-alert>`,\n `<pont2-alert icon status=\"success\" heading=\"Saved\" description=\"Your changes have been saved.\"></pont2-alert>`,\n `<pont2-alert icon status=\"warning\" heading=\"Almost out\" description=\"Your code expires in one minute.\"></pont2-alert>`,\n `<pont2-alert icon status=\"error\" heading=\"Sign-in failed\" description=\"Check your email and password.\"></pont2-alert>`,\n ].join(\"\"),\n \"28rem\",\n);\n\nconst badges = row(\n [\"default\", \"secondary\", \"outline\", \"destructive\", \"ghost\", \"link\"]\n .map(v => `<pont2-badge variant=\"${v}\">${v}</pont2-badge>`)\n .join(\"\"),\n);\n\nconst block = `<pont2-block>\n <pont2-header>\n <pont2-title content=\"Welcome back\"></pont2-title>\n <pont2-subtitle content=\"Sign in to your account\"></pont2-subtitle>\n </pont2-header>\n <pont2-email-field required></pont2-email-field>\n <pont2-submit-button event=\"submit\" label=\"Continue\"></pont2-submit-button>\n</pont2-block>`;\n\nconst typography = stack(\n [\n `<pont2-title content=\"Welcome back\"></pont2-title>`,\n `<pont2-subtitle content=\"Sign in to your account\"></pont2-subtitle>`,\n ].join(\"\"),\n);\n\nexport const PREVIEW_SPECIMENS: Readonly<Record<string, PreviewSpecimen>> = {\n button: { label: \"Button\", html: button },\n \"provider-button\": {\n label: \"Provider buttons\",\n html: stack(\n [\n `<pont2-provider-button provider=\"google\"></pont2-provider-button>`,\n `<pont2-provider-button provider=\"apple\"></pont2-provider-button>`,\n row(`<pont2-provider-button provider=\"google\" content=\"icon\"></pont2-provider-button><pont2-provider-button provider=\"github\" content=\"icon\"></pont2-provider-button>`),\n `<pont2-passkey-button content=\"icon-label\"></pont2-passkey-button>`,\n ].join(\"\"),\n ),\n },\n input: { label: \"Input\", html: inputs },\n field: { label: \"Field\", html: fields },\n label: { label: \"Label\", html: fields },\n checkbox: { label: \"Checkbox\", html: checkbox },\n \"input-otp\": {\n label: \"One-time code\",\n html: stack(\n [\n `<pont2-input-otp aria-label=\"Verification code\"></pont2-input-otp>`,\n `<pont2-input-otp group-size=\"3\" separator aria-label=\"Code\"></pont2-input-otp>`,\n ].join(\"\"),\n ),\n },\n \"otp-resend\": { label: \"Resend code\", html: `<pont2-otp-resend duration=\"5\" event=\"resend_code\"></pont2-otp-resend>` },\n link: {\n label: \"Link\",\n html: stack(\n [\n `<pont2-link prompt=\"Don't have an account?\" label=\"Sign up\" event=\"goto_signup\"></pont2-link>`,\n `<pont2-link label=\"Forgot password?\" event=\"forgot\"></pont2-link>`,\n ].join(\"\"),\n ),\n },\n alert: { label: \"Alert\", html: alerts },\n separator: {\n label: \"Separator\",\n html: stack(`<pont2-separator></pont2-separator><pont2-divider label=\"Or continue with\"></pont2-divider>`),\n },\n badge: { label: \"Badge\", html: badges },\n block: { label: \"Block\", html: block },\n header: { label: \"Header\", html: block },\n container: { label: \"Container\", html: block },\n title: { label: \"Title\", html: typography },\n subtitle: { label: \"Subtitle\", html: typography },\n avatar: {\n label: \"Avatar\",\n html: row(\n `<pont2-avatar alt=\"Ada Lovelace\" size=\"sm\"></pont2-avatar><pont2-avatar alt=\"Grace Hopper\"></pont2-avatar><pont2-avatar alt=\"Katherine Johnson\" size=\"lg\"></pont2-avatar>`,\n ),\n },\n \"qr-code\": {\n label: \"QR code\",\n html: `<pont2-qr-code url=\"otpauth://totp/Pontive:ada@example.com?secret=JBSWY3DPEHPK3PXP\" timeout=\"0\" label=\"Scan with your authenticator app\"></pont2-qr-code>`,\n },\n \"recovery-codes\": {\n label: \"Recovery codes\",\n html: `<pont2-recovery-codes codes='[\"3f9a-81c2\",\"7d01-4be9\",\"a6c4-02f7\",\"5e88-c13d\",\"90b2-7fa6\",\"1c5e-d840\"]'></pont2-recovery-codes>`,\n },\n watermark: {\n label: \"Watermark\",\n html: stack(`<pont2-watermark></pont2-watermark><pont2-watermark variant=\"muted\" label=\"Secured by\"></pont2-watermark>`),\n },\n};\n","/**\n * `<pont-provider>` (the legacy kit) and `<pont2-provider>` drive **one** SDK:\n * `Auth` is a singleton, and `configure()` replaces its whole configuration. On\n * one page, whichever configures last owns the callbacks, the locale and the\n * flow-state events, and the other's widgets stop hearing them. So the two must\n * never be mounted together (migration tracker W-15). Each provider warns, once\n * per page, when it finds the other.\n *\n * This file is the one place pont2 names a legacy tag (a guardrail exception\n * with this reason). It goes when the legacy kit does (migration plan S7, R-3).\n */\nexport const LEGACY_PROVIDER_TAG = \"pont-provider\";\n\nlet warned = false;\n\n/**\n * Warns (once per page) when `root` holds the legacy provider. Returns whether\n * it found one.\n */\nexport function warnIfLegacyProvider(root: Pick<ParentNode, \"querySelector\"> | undefined = globalThis.document): boolean {\n if (!root?.querySelector(LEGACY_PROVIDER_TAG)) return false;\n if (!warned) {\n warned = true;\n console.warn(\n `[pont2] <pont2-provider> and <${LEGACY_PROVIDER_TAG}> are both on this page. They share one Auth, ` +\n \"and each configure() replaces the other's configuration, so their widgets miss each other's flow \" +\n \"events and locale. Mount one provider per page.\",\n );\n }\n return true;\n}\n\n/** Forgets that the warning was given. For tests. */\nexport function resetCoexistenceWarning(): void {\n warned = false;\n}\n","/**\n * Where `<pont2-provider>` sends the browser once someone is signed in, and how\n * it notices that the destination sent them straight back.\n *\n * A port of the legacy rules (`src/utils/post-auth-destination.ts` and the\n * provider's `wasBouncedBackFrom`), as pure functions with injected browser\n * state so they are unit-tested in Node. pont2 may not import `src/`\n * (guardrail), so the code is copied, with its tests (docs/13-provider.md §3).\n *\n * **One change from the legacy kit (a security fix).** The legacy provider\n * assigned `?redirect_url=` to `window.location` unchecked, so a link could send\n * a freshly signed-in user to `javascript:` or to any site (hosted login strips\n * the parameter for that reason). Here the query's `redirect_url` is honoured\n * only when it is on the page's own origin, and the configured\n * `signinRedirectUrl` only when it is http(s). Anything else is ignored, as if\n * it had not been given.\n */\n\n/** The configuration the destination depends on. */\nexport interface PostAuthEnv {\n signinUrl?: string;\n signupUrl?: string;\n invitationUrl?: string;\n signinRedirectUrl?: string;\n}\n\nexport interface PostAuthPage {\n /** The page's path, e.g. `location.pathname`. */\n pathname: string;\n /** The page's query, e.g. `location.search`. */\n search: string;\n /** The page's origin, e.g. `location.origin`. Relative targets resolve against it. */\n origin: string;\n env: PostAuthEnv;\n}\n\n/**\n * Where to send the browser once a flow has authenticated someone, or `null`\n * to stay put.\n *\n * - On the sign-in, sign-up or invitation page: to the target, else `/`.\n * - On any other page opened to answer an invitation (`?invite_token=`): to the\n * target if there is one. Without one, staying put is better than sending the\n * app's own page to `/`.\n * - Anywhere else: nowhere. The app decides.\n *\n * The target is the query's `redirect_url` (same origin only), else\n * `env.signinRedirectUrl` (http(s) only).\n */\nexport function postAuthDestination({ pathname, search, origin, env }: PostAuthPage): string | null {\n const target = sameOriginUrl(new URLSearchParams(search).get(\"redirect_url\"), origin) ?? httpUrl(env.signinRedirectUrl, origin);\n const authPages = [env.signinUrl, env.signupUrl, env.invitationUrl].filter((url): url is string => !!url);\n if (authPages.some(url => pathname.includes(url))) return target ?? \"/\";\n if (answersInvitation(search) && target) return target;\n return null;\n}\n\n/**\n * Whether the page was opened to answer an invitation: its query carries the\n * token an invitation link does. Any page mounting a widget can be one.\n */\nexport function answersInvitation(search: string): boolean {\n return new URLSearchParams(search).has(\"invite_token\");\n}\n\n/**\n * The identifier the page was opened with as OpenID Connect's `login_hint`, or\n * `undefined`. `/oauth2/authorize` forwards an app's hint to the hosted pages,\n * and an accepted invitation sends the invitee to the app's sign-in page with\n * the address it was sent to. It only pre-fills: nothing is trusted because of\n * it (legacy `src/utils/login-hint.ts`, ported; migration tracker F-11).\n */\nexport function loginHint(search: string | undefined): string | undefined {\n if (!search) return undefined;\n const hint = new URLSearchParams(search).get(\"login_hint\")?.trim();\n return hint ? hint : undefined;\n}\n\n/** An http(s) URL, resolved against `origin`, or `null`. */\nfunction httpUrl(raw: string | null | undefined, origin: string): string | null {\n if (!raw) return null;\n try {\n const url = new URL(raw, origin);\n return url.protocol === \"http:\" || url.protocol === \"https:\" ? url.href : null;\n } catch {\n return null;\n }\n}\n\n/** A URL on `origin` (relative, or absolute with the same origin), or `null`. */\nfunction sameOriginUrl(raw: string | null | undefined, origin: string): string | null {\n const url = httpUrl(raw, origin);\n if (!url) return null;\n try {\n return new URL(url).origin === new URL(origin).origin ? url : null;\n } catch {\n return null;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Redirect loop breaking\n// ---------------------------------------------------------------------------\n\n/**\n * The browser state the loop protection reads, injectable for tests.\n *\n * - `storage`: sessionStorage, not localStorage. A redirect is one navigation\n * in one tab: the marker must not outlive the tab, nor be seen by a second tab\n * signing in on its own.\n * - `navigationType`: how the browser reached this page (Navigation Timing).\n */\nexport interface RedirectGuardEnv {\n storage: Pick<Storage, \"getItem\" | \"setItem\" | \"removeItem\"> | null;\n now: () => number;\n navigationType: () => string;\n}\n\n/** The marker's key. Not the legacy kit's: the two providers never share a page (W-15). */\nexport const REDIRECT_ATTEMPT_KEY = \"pont2_auth_redirect_attempt\";\n\n/**\n * How recently a redirect must have been attempted for a return to count as a\n * bounce. A bounce is two server round trips, so seconds at most; minutes later\n * is a new visit.\n */\nexport const REDIRECT_BOUNCE_WINDOW_MS = 10_000;\n\n/** The page's own browser state (sessionStorage, Date.now, Navigation Timing). */\nexport function browserGuardEnv(): RedirectGuardEnv {\n let storage: RedirectGuardEnv[\"storage\"] = null;\n try {\n storage = globalThis.sessionStorage ?? null;\n } catch {\n // Storage blocked (private mode, a policy): no loop protection, redirects still work.\n }\n return {\n storage,\n now: () => Date.now(),\n navigationType: () => {\n // Anything unreadable is \"navigate\", the conservative answer: it keeps the protection\n // working on a browser that won't say, at the cost of the Back case we can't detect there.\n try {\n const [entry] = performance.getEntriesByType(\"navigation\") as PerformanceNavigationTiming[];\n return entry?.type ?? \"navigate\";\n } catch {\n return \"navigate\";\n }\n },\n };\n}\n\n/** Notes that the browser is being sent to `target`. */\nexport function recordRedirectAttempt(target: string, env: RedirectGuardEnv): void {\n try {\n env.storage?.setItem(REDIRECT_ATTEMPT_KEY, JSON.stringify({ target, at: env.now() }));\n } catch {\n // Losing the marker only costs the loop protection; the redirect still works.\n }\n}\n\n/** Forgets the marker. */\nexport function clearRedirectAttempt(env: RedirectGuardEnv): void {\n try {\n env.storage?.removeItem(REDIRECT_ATTEMPT_KEY);\n } catch {\n // See recordRedirectAttempt.\n }\n}\n\n/**\n * Whether we are here because `target` sent us back. Three things must hold,\n * each ruling out an arrival that looks like a bounce but isn't:\n *\n * - a redirect to **this** target was recorded;\n * - it was **recent** (within `REDIRECT_BOUNCE_WINDOW_MS`);\n * - the browser **navigated** here. Back (`back_forward`) or a reload right\n * after a successful sign-in leaves the same marker, and signing that user out\n * would be worse than the loop. A server redirect chain is always `navigate`.\n *\n * The marker is consumed either way, so a stale one can't go on counting.\n */\nexport function wasBouncedBackFrom(target: string, env: RedirectGuardEnv): boolean {\n let raw: string | null = null;\n try {\n raw = env.storage?.getItem(REDIRECT_ATTEMPT_KEY) ?? null;\n } catch {\n return false;\n }\n if (!raw) return false;\n clearRedirectAttempt(env);\n if (env.navigationType() !== \"navigate\") return false;\n try {\n const attempt = JSON.parse(raw) as { target?: unknown; at?: unknown };\n if (attempt.target !== target || typeof attempt.at !== \"number\") return false;\n return env.now() - attempt.at < REDIRECT_BOUNCE_WINDOW_MS;\n } catch {\n return false;\n }\n}\n\n/** What the provider does about a signed-in user on this page. */\nexport type RedirectDecision =\n | { kind: \"stay\" }\n /** The destination refused the session and sent us back: drop it and show the sign-in form. */\n | { kind: \"bounced\"; target: string }\n | { kind: \"go\"; target: string };\n\n/**\n * The whole post-sign-in decision. `isAuthenticated()` is a local check (memory\n * and an expiry time), while the destination decides the same question with the\n * server's knowledge (a revoked session, `prompt=login`). When they disagree,\n * redirecting on the local answer is an infinite loop, so the server wins:\n * `bounced` means drop the stale session and let the sign-in form render.\n *\n * A `go` decision has already recorded its attempt.\n */\nexport function decideRedirect(page: PostAuthPage, guard: RedirectGuardEnv): RedirectDecision {\n const target = postAuthDestination(page);\n if (!target) return { kind: \"stay\" };\n if (wasBouncedBackFrom(target, guard)) return { kind: \"bounced\", target };\n recordRedirectAttempt(target, guard);\n return { kind: \"go\", target };\n}\n","import { DEFAULT_BRANDING, type BrandingEntitlements } from \"../block/branding\";\n\n/**\n * The instance's branding entitlements, read by `<pont2-provider>` from\n * `GET {auth}/auth/v1/runtime-config` (`branding: { show_watermark }`, pontive-spec\n * 21 §9.1, 18 \"Branding entitlement\"; migration tracker T-5).\n *\n * The answer is the server's: resolved from the workspace's plan, never from\n * anything the page or the app supplies (docs/branding-entitlements.md). It\n * **fails closed**: a failed read, an older backend without the field, or any\n * value but `false` keeps the watermark.\n *\n * One request per auth base per page: the provider configures itself more than\n * once, and every configuration asks.\n */\n\ntype Fetch = (url: string, init?: RequestInit) => Promise<Pick<Response, \"ok\" | \"json\">>;\n\nconst answers = new Map<string, Promise<BrandingEntitlements>>();\n\n/** The runtime-config URL for an auth base. */\nexport function runtimeConfigUrl(authBaseUrl: string): string {\n return `${authBaseUrl}/auth/v1/runtime-config`;\n}\n\n/** The entitlements for an auth base (once per base). Never rejects. */\nexport function loadBrandingEntitlements(\n authBaseUrl: string,\n fetchImpl: Fetch = (url, init) => globalThis.fetch(url, init),\n): Promise<BrandingEntitlements> {\n const url = runtimeConfigUrl(authBaseUrl);\n let answer = answers.get(url);\n if (!answer) {\n answer = read(url, fetchImpl);\n answers.set(url, answer);\n }\n return answer;\n}\n\n/** The entitlements a runtime-config body grants: only an explicit `false` hides the watermark. */\nexport function brandingFrom(body: unknown): BrandingEntitlements {\n const branding = (body as { branding?: { show_watermark?: unknown } } | null)?.branding;\n return branding?.show_watermark === false ? { showWatermark: false } : DEFAULT_BRANDING;\n}\n\nasync function read(url: string, fetchImpl: Fetch): Promise<BrandingEntitlements> {\n try {\n // No credentials: the answer is the instance's, not the user's (CORS `*`).\n const res = await fetchImpl(url, { credentials: \"omit\" });\n if (!res.ok) return forget(url);\n return brandingFrom(await res.json());\n } catch {\n return forget(url);\n }\n}\n\n/** A failed read keeps the watermark, and is forgotten so the next configuration asks again. */\nfunction forget(url: string): BrandingEntitlements {\n answers.delete(url);\n return DEFAULT_BRANDING;\n}\n\n/** Forgets every answer. For tests and stories. */\nexport function resetBrandingEntitlements(): void {\n answers.clear();\n}\n","import type { FlowStateEvent, WidgetClient } from \"../flow-widget/flow-widget\";\n\n/**\n * What `<pont2-provider>` needs from the auth SDK, structurally. The SDK's\n * `Auth` (`@pontive/oidc-client`) satisfies it as-is, which\n * `flow-widget/sdk-compat.test.ts` pins against the real types. pont2 never\n * imports the SDK: the app injects it (`provider.sdk = Auth`, docs/13-provider.md).\n *\n * No index signatures, on purpose: they are what made `Auth` fail to type-check\n * as a `WidgetClient` before (migration tracker W-13).\n */\nexport interface ProviderSdk extends WidgetClient {\n /** Replaces the whole configuration (it does not merge). */\n configure(config: ProviderSdkConfig): void;\n /** Turns an HttpOnly refresh cookie back into a session. Resolves null when there is none. */\n restoreSession(): Promise<unknown>;\n /** A local check: memory and an expiry time. */\n isAuthenticated(): boolean;\n /** Drops the stored session without reloading or tearing the flow machinery down. */\n invalidateSession(): void;\n}\n\n/** The parts of the SDK's `ConfigOptions` the provider writes. */\nexport interface ProviderSdkConfig {\n domain: string;\n appId: string;\n signinUrl: string;\n signupUrl: string;\n invitationUrl?: string;\n locales?: string;\n headers?: Record<string, string>;\n scope?: string | string[];\n organizationId?: string;\n continueHereUrl?: string;\n onFlowStateChange?: (event: FlowStateEvent) => void;\n onAuthenticated?: (session: unknown) => void;\n}\n\n/** What the app passes through `provider.config`: anything the SDK takes, and its own callbacks. */\nexport type AppSdkConfig = Partial<ProviderSdkConfig>;\n\n/** The provider's own inputs (its attributes and properties). Empty values are \"not given\". */\nexport interface ProviderInputs {\n domain: string;\n appId: string;\n locales?: string;\n signinUrl?: string;\n signupUrl?: string;\n invitationUrl?: string;\n signinRedirectUrl?: string;\n continueHereUrl?: string;\n scope?: string | string[];\n headers?: Record<string, string>;\n organizationId?: string;\n}\n\n/** The provider's own reactions to the SDK's two callbacks. */\nexport interface ProviderHooks {\n onFlowStateChange(event: FlowStateEvent): void;\n onAuthenticated(session: unknown): void;\n}\n\n/**\n * The configuration the provider passes to `sdk.configure()`.\n *\n * `configure()` **replaces** the SDK's whole configuration, and the SDK has only\n * these two callbacks, so whoever configures last owns them (migration tracker\n * W-14). An app that needs either passes it in `provider.config`, and the\n * provider **chains** it: its own reaction first, then the app's. A throwing\n * callback is reported and never stops the other one.\n *\n * Precedence: the provider's non-empty inputs, over `app` (anything else the\n * SDK takes, such as an option this interface doesn't name yet), over the\n * required defaults (`signinUrl` / `signupUrl` empty). `continueHereUrl`\n * defaults to `signinRedirectUrl`, as in the legacy provider.\n *\n * Note that passing `onAuthenticated` at all replaces the SDK's default (a page\n * reload). The provider always passes one, because it refreshes the auth state\n * in place, as the legacy provider does.\n */\nexport function buildSdkConfig(inputs: ProviderInputs, own: ProviderHooks, app: AppSdkConfig = {}): ProviderSdkConfig {\n const given = <T>(v: T | undefined | null | \"\"): v is T => v !== undefined && v !== null && v !== \"\";\n const pick: Partial<ProviderSdkConfig> = {};\n const set = <K extends keyof ProviderSdkConfig>(key: K, value: ProviderSdkConfig[K] | undefined | \"\") => {\n if (given(value) && !(Array.isArray(value) && value.length === 0)) pick[key] = value as ProviderSdkConfig[K];\n };\n set(\"domain\", inputs.domain);\n set(\"appId\", inputs.appId);\n set(\"locales\", inputs.locales);\n set(\"signinUrl\", inputs.signinUrl);\n set(\"signupUrl\", inputs.signupUrl);\n set(\"invitationUrl\", inputs.invitationUrl);\n set(\"scope\", inputs.scope);\n set(\"headers\", inputs.headers && Object.keys(inputs.headers).length ? inputs.headers : undefined);\n set(\"organizationId\", inputs.organizationId);\n set(\"continueHereUrl\", inputs.continueHereUrl || inputs.signinRedirectUrl);\n\n const { onFlowStateChange: appFlow, onAuthenticated: appAuth, ...appRest } = app;\n return {\n signinUrl: \"\",\n signupUrl: \"\",\n domain: \"\",\n appId: \"\",\n ...appRest,\n ...pick,\n onFlowStateChange: chain(\"onFlowStateChange\", own.onFlowStateChange, appFlow),\n onAuthenticated: chain(\"onAuthenticated\", own.onAuthenticated, appAuth),\n };\n}\n\nfunction chain<A>(name: string, first: (arg: A) => void, then?: (arg: A) => void): (arg: A) => void {\n return arg => {\n try {\n first(arg);\n } catch (err) {\n console.error(`[pont2] <pont2-provider>: its ${name} failed:`, err);\n }\n if (!then) return;\n try {\n then(arg);\n } catch (err) {\n console.error(`[pont2] <pont2-provider>: the app's ${name} failed:`, err);\n }\n };\n}\n\n/**\n * The base the auth endpoints hang off, as an absolute URL without a trailing\n * slash, or `null` when `domain` can't be resolved.\n *\n * A port of the SDK's `resolveAuthBaseUrl`, which is a module export and not a\n * method of `Auth`, so it can't be injected with it (docs/13-provider.md §3).\n * The three shapes: a hostname (`tenant.idp.us.pontive.app`, `https://`, or\n * `http://` for loopback), a path on the page's origin (`/__pontive`), or a full\n * base URL. Query and fragment are dropped.\n */\nexport function authBaseUrl(domain: string | undefined, pageOrigin = globalThis.location?.origin): string | null {\n const configured = (domain ?? \"\").trim();\n if (!configured) return null;\n const baseOf = (url: URL) => `${url.origin}${url.pathname}`.replace(/\\/+$/, \"\");\n try {\n if (configured.startsWith(\"/\")) return pageOrigin ? baseOf(new URL(configured, pageOrigin)) : null;\n const authority = configured.split(\"/\")[0];\n const loopback = /^(localhost|127\\.0\\.0\\.1|\\[::1\\])(:\\d+)?$/i.test(authority);\n const scheme = /^https?:\\/\\//i.test(configured) ? \"\" : loopback ? \"http://\" : \"https://\";\n return baseOf(new URL(`${scheme}${configured}`));\n } catch {\n return null;\n }\n}\n","import { setMessages } from \"../../core/messages\";\nimport { INSTANCE_UNAVAILABLE, rememberUnavailable } from \"../layout/flow-error\";\n\n/**\n * The signed-in widgets' own text (account menu, account settings, organization\n * switcher, member management), which no flow response carries: `<pont2-provider>`\n * reads it from `GET {auth}/auth/v1/widget-messages?locales=…` and hands it to\n * the page's message table (`setMessages`, core/messages.ts). A port of the\n * legacy `loadWidgetMessages` (carry-over §3, migration tracker I-2).\n *\n * **One request per language per page.** The provider configures itself more\n * than once (its inputs, then its locales, settle), and every configuration\n * asks. A URL already asked, or being asked, is not asked again: its answer is\n * kept and applied again, so switching back to a language already loaded\n * restores its text without a request. (The legacy loader remembered only the\n * last URL, so en → de → en asked for English twice.)\n *\n * A failed read is forgotten, so the next configuration can try again. A\n * stopped instance refuses this read too, with its one sentence in the page's\n * language (carry-over §6): that sentence is kept (`rememberUnavailable`).\n */\n\n/** The read's answer: the language it was served in, and its messages by code. */\nexport interface WidgetMessages {\n locale?: string;\n messages?: Record<string, string>;\n}\n\ntype Fetch = (url: string, init?: RequestInit) => Promise<Pick<Response, \"ok\" | \"json\">>;\n\n/** Answers by URL: the one request per language, shared by every caller. */\nconst answers = new Map<string, Promise<WidgetMessages | null>>();\n\n/** The widget-messages URL for an auth base and a language preference. */\nexport function widgetMessagesUrl(authBaseUrl: string, locales?: string): string {\n const query = locales ? `?locales=${encodeURIComponent(locales)}` : \"\";\n return `${authBaseUrl}/auth/v1/widget-messages${query}`;\n}\n\n/**\n * Loads (once per URL) and applies the widget messages. Resolves when they are\n * in the message table, or when the read failed (the page keeps English, or\n * whatever it was last served in). Never rejects.\n */\nexport async function loadWidgetMessages(\n authBaseUrl: string,\n locales?: string,\n fetchImpl: Fetch = (url, init) => globalThis.fetch(url, init),\n): Promise<void> {\n const url = widgetMessagesUrl(authBaseUrl, locales);\n let answer = answers.get(url);\n if (!answer) {\n answer = read(url, fetchImpl);\n answers.set(url, answer);\n }\n const body = await answer;\n if (!body) {\n // Forget the question so the next configuration can ask again.\n if (answers.get(url) === answer) answers.delete(url);\n return;\n }\n setMessages(body.messages, body.locale);\n}\n\nasync function read(url: string, fetchImpl: Fetch): Promise<WidgetMessages | null> {\n try {\n // No credentials: the text is the instance's, not the user's (CORS `*`).\n const res = await fetchImpl(url, { credentials: \"omit\" });\n if (!res.ok) {\n const refusal = (await res.json().catch(() => undefined)) as { error?: { code?: string; message?: string } } | undefined;\n if (refusal?.error?.code === INSTANCE_UNAVAILABLE) rememberUnavailable(refusal.error.message);\n return null;\n }\n return ((await res.json()) as WidgetMessages) ?? null;\n } catch {\n // Offline or blocked.\n return null;\n }\n}\n\n/** Forgets every answer. For tests and stories. */\nexport function resetWidgetMessages(): void {\n answers.clear();\n}\n","import { ContextProvider } from \"@lit/context\";\nimport type { PropertyDeclarations, PropertyValues } from \"lit\";\n\nimport \"../../core/context-root\";\nimport { fire } from \"../../core/events\";\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { brandingContext, DEFAULT_BRANDING } from \"../block/branding\";\nimport { dispatchFlowState, FlowWidget, type FlowStateEvent } from \"../flow-widget/flow-widget\";\nimport { warnIfLegacyProvider } from \"./coexistence\";\nimport { authStateContext, clientContext, loginHintContext, UNRESOLVED_AUTH, type AuthState } from \"./contexts\";\nimport { answersInvitation, browserGuardEnv, decideRedirect, loginHint } from \"./redirect\";\nimport { loadBrandingEntitlements } from \"./runtime-config\";\nimport { authBaseUrl, buildSdkConfig, type AppSdkConfig, type ProviderInputs, type ProviderSdk } from \"./sdk\";\nimport { loadWidgetMessages } from \"./widget-messages\";\n\nexport * from \"./contexts\";\nexport * from \"./coexistence\";\nexport * from \"./redirect\";\nexport * from \"./sdk\";\nexport * from \"./widget-messages\";\n\n/** Detail of `pont2-set-locales` (on `document`) and `pont2-locale-changed`. */\nexport interface LocalesDetail {\n locales: string;\n}\n\n/** Detail of `pont2-redirect`. Cancel it to navigate yourself (a client-side router). */\nexport interface RedirectDetail {\n url: string;\n}\n\n/** The inputs that, when they change, configure the SDK again. */\nconst CONFIG_INPUTS = [\n \"sdk\",\n \"appId\",\n \"domain\",\n \"locales\",\n \"signinUrl\",\n \"signupUrl\",\n \"invitationUrl\",\n \"signinRedirectUrl\",\n \"continueHereUrl\",\n \"scope\",\n \"headers\",\n \"organizationId\",\n \"config\",\n] as const;\n\n/** `auto-redirect=\"false\"` turns it off; any other value, or none, leaves it on. */\nconst onUnlessFalse = { fromAttribute: (v: string | null) => v !== \"false\", toAttribute: (v: boolean) => (v ? null : \"false\") };\n\n/**\n * # `<pont2-provider>`: configures the auth SDK and provides it to the page\n *\n * ```html\n * <pont2-provider app-id=\"app_123\" domain=\"auth.acme.com\" signin-url=\"/sign-in\" signup-url=\"/sign-up\">\n * <pont2-signed-out><pont2-signin></pont2-signin></pont2-signed-out>\n * <pont2-signed-in>…the app…</pont2-signed-in>\n * </pont2-provider>\n * <script type=\"module\">\n * import { Auth } from \"@pontive/oidc-client\";\n * document.querySelector(\"pont2-provider\").sdk = Auth; // the one line pont2 can't do for you\n * </script>\n * ```\n *\n * pont2's version of the legacy `pont-provider` (docs/13-provider.md; migration\n * tracker W-1). The SDK is **injected**, never imported. Once it has `sdk`,\n * `domain` and `app-id`, it:\n *\n * - **configures the SDK** (`sdk.configure(…)`), again whenever an input\n * changes. `configure()` replaces the whole configuration, so the app's own\n * options and callbacks go in `config` and are **chained** after the\n * provider's (W-14);\n * - **provides the SDK** to every flow widget inside it as their `client`\n * (`pont2:client`; an explicit `widget.client` wins), with the branding\n * entitlements (`pont2:branding`) and the URL's `login_hint`\n * (`pont2:login-hint`, F-11);\n * - **resolves the auth state**: `restoreSession()`, then `isAuthenticated()`,\n * provided as `pont2:auth` (read by `pont2-signed-in` / `-out`), readable as\n * `.auth`, and announced as `pont2-auth-changed`. A page opened to answer an\n * invitation drops the existing session first;\n * - **redirects** a signed-in user away from the sign-in, sign-up or invitation\n * page (`auto-redirect`, on by default), with the legacy destination rules\n * and redirect-loop protection (`redirect.ts`);\n * - **follows the locale**: `locales`, `setLocale()` or a `pont2-set-locales`\n * event on `document` reconfigure the SDK, fire `pont2-locale-changed` and\n * `restart()` every flow widget it provides for (F-19);\n * - **loads the widgets' own text** (`/auth/v1/widget-messages`, one request\n * per language per page, I-2) and the published **theme**\n * (`/auth/v1/theme.css`; `theme=\"none\"` opts out);\n * - **reads the branding entitlements** from `/auth/v1/runtime-config`, the\n * server's answer from the workspace's plan. There is deliberately no\n * property for them: an app cannot switch the watermark off, and anything\n * but the server saying so keeps it (docs/branding-entitlements.md, T-5).\n *\n * The host adds no box (`display: contents`). Mount **one** provider per page,\n * and never beside the legacy `pont-provider`: both drive the one `Auth` (W-15).\n *\n * @tag pont2-provider\n * @prop sdk - the auth SDK (`Auth` from `@pontive/oidc-client`), injected\n * @prop config - the app's own SDK options and callbacks (`onFlowStateChange`, `onAuthenticated`), chained after the provider's\n * @prop headers - extra request headers for the SDK\n * @prop auth - `AuthState` (read-only): `{ isAuthenticated, resolved }`\n * @attr app-id - the app's id\n * @attr domain - where the auth endpoints answer: a hostname, `/path` on this origin, or a base URL\n * @attr locales - space-separated BCP-47 tags in preference order; empty lets the server negotiate\n * @attr signin-url - the app's sign-in page path\n * @attr signup-url - the app's sign-up page path\n * @attr invitation-url - the app's invitation page path, when it has one\n * @attr signin-redirect-url - where a signed-in user goes from those pages (http(s))\n * @attr continue-here-url - where \"Continue here instead\" goes (default: `signin-redirect-url`)\n * @attr scope - OAuth scopes every flow asks for (space-separated; replaces the server's default)\n * @attr organization-id - the organization a sign-in starts in\n * @attr api-base-url - the management gateway, for the account widgets (held for them; not an SDK option)\n * @attr login-hint - the identifier to pre-fill (default: the URL's `login_hint`)\n * @attr auto-redirect - `\"false\"` turns the post-sign-in redirect off (default on)\n * @attr theme - `\"none\"` opts out of linking the published theme (default: link it)\n * @fires pont2-auth-changed - `AuthState` (a copy), whenever it changes\n * @fires pont2-locale-changed - `{ locales }`, whenever the configured locales change\n * @fires pont2-redirect - `{ url }`, cancelable, before a post-sign-in navigation\n */\nexport class Provider extends HostElement {\n static override identity = \"provider\";\n static override slotName = \"provider\";\n static override composite = false;\n\n static override properties: PropertyDeclarations = {\n sdk: { attribute: false },\n config: { attribute: false },\n headers: { attribute: false },\n appId: { type: String, attribute: \"app-id\" },\n domain: { type: String },\n locales: { type: String },\n signinUrl: { type: String, attribute: \"signin-url\" },\n signupUrl: { type: String, attribute: \"signup-url\" },\n invitationUrl: { type: String, attribute: \"invitation-url\" },\n signinRedirectUrl: { type: String, attribute: \"signin-redirect-url\" },\n continueHereUrl: { type: String, attribute: \"continue-here-url\" },\n scope: { attribute: \"scope\" },\n organizationId: { type: String, attribute: \"organization-id\" },\n apiBaseUrl: { type: String, attribute: \"api-base-url\" },\n loginHint: { type: String, attribute: \"login-hint\" },\n autoRedirect: { attribute: \"auto-redirect\", converter: onUnlessFalse },\n theme: { type: String },\n auth: { state: true },\n };\n\n declare sdk: ProviderSdk | undefined;\n declare config: AppSdkConfig;\n declare headers: Record<string, string> | undefined;\n declare appId: string;\n declare domain: string;\n declare locales: string;\n declare signinUrl: string;\n declare signupUrl: string;\n declare invitationUrl: string;\n declare signinRedirectUrl: string;\n declare continueHereUrl: string;\n declare scope: string | string[];\n declare organizationId: string;\n declare apiBaseUrl: string;\n declare loginHint: string | undefined;\n declare autoRedirect: boolean;\n declare theme: string;\n /** The auth state (read it; the provider writes it). */\n declare auth: AuthState;\n\n private authProvider = new ContextProvider(this, { context: authStateContext, initialValue: UNRESOLVED_AUTH });\n private clientProvider = new ContextProvider(this, { context: clientContext, initialValue: undefined });\n private brandingProvider = new ContextProvider(this, { context: brandingContext, initialValue: DEFAULT_BRANDING });\n private hintProvider = new ContextProvider(this, { context: loginHintContext, initialValue: undefined });\n\n /** The SDK the auth state was last resolved for: a new one resolves again. */\n private resolvedFor: ProviderSdk | undefined;\n /** The locales of the last configuration (`undefined`: not configured yet). */\n private configuredLocales: string | undefined;\n /** The auth base the branding entitlements were last asked for. */\n private brandingBase: string | null = null;\n\n /** Bumped per resolution, so only the latest answer is published. */\n private authSeq = 0;\n\n constructor() {\n super();\n this.sdk = undefined;\n this.config = {};\n this.headers = undefined;\n this.appId = \"\";\n this.domain = \"\";\n this.locales = \"\";\n this.signinUrl = \"\";\n this.signupUrl = \"\";\n this.invitationUrl = \"\";\n this.signinRedirectUrl = \"\";\n this.continueHereUrl = \"\";\n this.scope = \"\";\n this.organizationId = \"\";\n this.apiBaseUrl = \"\";\n this.loginHint = undefined;\n this.autoRedirect = true;\n this.theme = \"\";\n this.auth = UNRESOLVED_AUTH;\n }\n\n // -------------------------------------------------------------------------\n // Public API\n // -------------------------------------------------------------------------\n\n /** Changes the language: reconfigures the SDK and restarts the flow widgets it provides for. */\n setLocale(locales: string): void {\n this.locales = locales;\n }\n\n /**\n * Reads the auth state from the SDK again (a local check). The SDK has no\n * auth-state subscription (W-14): call this after `Auth.signOut()`,\n * `Auth.switchOrganization()` or anything else that changes the session\n * outside a flow.\n */\n refresh(): void {\n if (this.sdk) this.publishAuth(this.sdk);\n }\n\n /** The base the auth endpoints hang off, or `null` while `domain` is unset or invalid. */\n get authBaseUrl(): string | null {\n return authBaseUrl(this.domain);\n }\n\n // -------------------------------------------------------------------------\n // Lifecycle\n // -------------------------------------------------------------------------\n\n override connectedCallback(): void {\n super.connectedCallback();\n warnIfLegacyProvider();\n document.addEventListener(\"pont2-set-locales\", this.onSetLocales);\n document.addEventListener(\"visibilitychange\", this.onVisible);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"pont2-set-locales\", this.onSetLocales);\n document.removeEventListener(\"visibilitychange\", this.onVisible);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has(\"loginHint\") || !this.hasUpdated) {\n this.hintProvider.setValue(this.loginHint ?? loginHint(globalThis.location?.search));\n }\n if (changed.has(\"auth\")) this.authProvider.setValue(this.auth);\n }\n\n protected override updated(changed: PropertyValues): void {\n if (CONFIG_INPUTS.some(key => changed.has(key))) this.configureSdk();\n if (changed.has(\"domain\") || changed.has(\"theme\")) this.linkTheme();\n if (changed.has(\"auth\")) this.redirectIfDone();\n }\n\n // -------------------------------------------------------------------------\n // Configuring the SDK\n // -------------------------------------------------------------------------\n\n private inputs(): ProviderInputs {\n return {\n domain: this.domain,\n appId: this.appId,\n locales: this.locales,\n signinUrl: this.signinUrl,\n signupUrl: this.signupUrl,\n invitationUrl: this.invitationUrl,\n signinRedirectUrl: this.signinRedirectUrl,\n continueHereUrl: this.continueHereUrl,\n scope: this.scope,\n headers: this.headers,\n organizationId: this.organizationId,\n };\n }\n\n private configureSdk(): void {\n const sdk = this.sdk;\n if (!sdk || !this.domain || !this.appId) return;\n const config = buildSdkConfig(\n this.inputs(),\n {\n // The widgets follow resumed flows, emailed links and \"continued in another tab\" through this.\n onFlowStateChange: (event: FlowStateEvent) => dispatchFlowState(event),\n // Take the hand-off in place instead of the SDK's page reload.\n onAuthenticated: () => this.refresh(),\n },\n this.config ?? {},\n );\n try {\n sdk.configure(config);\n } catch (err) {\n console.error(\"[pont2] <pont2-provider>: configuring the SDK failed:\", err);\n return;\n }\n // Only now: a widget given the client before configure() would start a flow the SDK refuses.\n this.clientProvider.setValue(sdk);\n\n const locales = config.locales ?? \"\";\n const before = this.configuredLocales;\n this.configuredLocales = locales;\n if (before !== locales) {\n fire<LocalesDetail>(this, \"pont2-locale-changed\", { locales });\n // Not on the first configuration: the widgets start by themselves then.\n if (before !== undefined) this.restartWidgets();\n }\n\n const base = this.authBaseUrl;\n if (base) {\n void loadWidgetMessages(base, locales || undefined);\n const asked = base;\n // Another instance's answer never carries over: back to the watermark until this one answers.\n if (this.brandingBase !== base) this.brandingProvider.setValue(DEFAULT_BRANDING);\n this.brandingBase = base;\n void loadBrandingEntitlements(base).then(branding => {\n // A later domain's answer wins; never an earlier one's.\n if (this.authBaseUrl === asked) this.brandingProvider.setValue(branding);\n });\n }\n\n if (this.resolvedFor !== sdk) {\n this.resolvedFor = sdk;\n void this.resolveAuth(sdk);\n }\n }\n\n /** Every flow widget inside that runs on the provided client (an explicit `client` is the app's). */\n private restartWidgets(): void {\n for (const el of Array.from(this.querySelectorAll(\"*\"))) {\n if (el instanceof FlowWidget && el.usesProvidedClient) void el.restart();\n }\n }\n\n private onSetLocales = (e: Event) => {\n const locales = (e as CustomEvent<Partial<LocalesDetail>>).detail?.locales;\n if (typeof locales === \"string\" && locales) this.setLocale(locales);\n };\n\n // -------------------------------------------------------------------------\n // Auth state\n // -------------------------------------------------------------------------\n\n /**\n * Asks the authorization server whether this browser is signed in before\n * publishing an answer: an app whose refresh token is an HttpOnly cookie holds\n * nothing locally on a fresh page, so the local answer alone reports every\n * reload as a sign-out. Publishing \"signed out\" first and correcting it a\n * moment later would flash the signed-out branch for every signed-in user.\n *\n * A page opened with an invitation drops whoever was signed in first: the\n * invitation is for the invitee, and restoring another session would send the\n * page on to the app before the flow ran.\n */\n private async resolveAuth(sdk: ProviderSdk): Promise<void> {\n const seq = ++this.authSeq;\n if (answersInvitation(globalThis.location?.search ?? \"\")) {\n sdk.invalidateSession();\n this.publishAuth(sdk);\n return;\n }\n try {\n await sdk.restoreSession();\n } catch {\n // It resolves null for \"nothing to restore\"; anything thrown is unexpected and must not stop\n // the provider from reporting what it can tell locally.\n }\n if (seq === this.authSeq && this.sdk === sdk) this.publishAuth(sdk);\n }\n\n private publishAuth(sdk: ProviderSdk): void {\n let isAuthenticated = false;\n try {\n isAuthenticated = !!sdk.isAuthenticated();\n } catch {\n // Not configured yet: nobody is signed in as far as we can tell.\n }\n const next: AuthState = { isAuthenticated, resolved: true };\n if (next.isAuthenticated === this.auth.isAuthenticated && next.resolved === this.auth.resolved) return;\n this.auth = next;\n // A copy: a listener must not be able to change the state every element reads.\n fire<AuthState>(this, \"pont2-auth-changed\", { ...next });\n }\n\n /**\n * The SDK can't say when a session ends elsewhere (W-14). When the tab comes\n * back and the local answer has turned to \"signed out\", ask the server again\n * (a refresh cookie may still hold) before publishing it.\n */\n private onVisible = () => {\n const sdk = this.sdk;\n if (document.visibilityState !== \"visible\" || !sdk || !this.auth.resolved || !this.auth.isAuthenticated) return;\n let still = true;\n try {\n still = sdk.isAuthenticated();\n } catch {\n return;\n }\n if (!still) void this.resolveAuth(sdk);\n };\n\n // -------------------------------------------------------------------------\n // Post-sign-in redirect\n // -------------------------------------------------------------------------\n\n private redirectIfDone(): void {\n const sdk = this.sdk;\n if (!this.autoRedirect || !sdk || !this.auth.resolved || !this.auth.isAuthenticated) return;\n const decision = decideRedirect(\n {\n pathname: location.pathname,\n search: location.search,\n origin: location.origin,\n env: {\n signinUrl: this.signinUrl,\n signupUrl: this.signupUrl,\n invitationUrl: this.invitationUrl,\n signinRedirectUrl: this.signinRedirectUrl,\n },\n },\n browserGuardEnv(),\n );\n if (decision.kind === \"stay\") return;\n if (decision.kind === \"bounced\") {\n // The destination refused the session and sent us straight back: the server wins. Drop the\n // stale session and let the sign-in form render, which is what the user came to see.\n sdk.invalidateSession();\n this.publishAuth(sdk);\n return;\n }\n if (fire<RedirectDetail>(this, \"pont2-redirect\", { url: decision.target }, true)) location.assign(decision.target);\n }\n\n // -------------------------------------------------------------------------\n // Theme\n // -------------------------------------------------------------------------\n\n /**\n * Links the instance's published theme (`GET {auth}/auth/v1/theme.css`: the\n * host names the instance; an empty 200 when nothing is published;\n * docs/12-theming-integration.md). The same `<link data-pont2-theme=\"brand\">`\n * that `linkTheme()` writes, so the two never stack.\n */\n private linkTheme(): void {\n if (this.theme === \"none\") return;\n const base = this.authBaseUrl;\n if (!base) return;\n const href = `${base}/auth/v1/theme.css`;\n let link = document.head.querySelector<HTMLLinkElement>('link[data-pont2-theme=\"brand\"]');\n if (!link) {\n link = document.createElement(\"link\");\n link.setAttribute(\"data-pont2-theme\", \"brand\");\n link.rel = \"stylesheet\";\n document.head.append(link);\n }\n if (link.href !== href) link.href = href;\n }\n}\n\ndefine(\"pont2-provider\", Provider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-provider\": Provider;\n }\n interface HTMLElementEventMap {\n \"pont2-auth-changed\": CustomEvent<AuthState>;\n \"pont2-locale-changed\": CustomEvent<LocalesDetail>;\n \"pont2-redirect\": CustomEvent<RedirectDetail>;\n }\n interface DocumentEventMap {\n \"pont2-set-locales\": CustomEvent<LocalesDetail>;\n }\n}\n","import { ContextConsumer } from \"@lit/context\";\nimport type { PropertyValues } from \"lit\";\n\nimport { HostElement } from \"../../core/host-element\";\nimport { define } from \"../../core/names\";\nimport { authStateContext, UNRESOLVED_AUTH, type AuthState } from \"./contexts\";\n\n/**\n * # AuthGate: the base of `<pont2-signed-in>` / `<pont2-signed-out>`\n *\n * ```html\n * <pont2-provider …>\n * <pont2-signed-out><pont2-signin></pont2-signin></pont2-signed-out>\n * <pont2-signed-in><a href=\"/account\">Your account</a></pont2-signed-in>\n * </pont2-provider>\n * ```\n *\n * Shows its children for one answer of the provider's auth state\n * (`pont2:auth`), and holds them **detached** otherwise, so that a widget inside\n * the branch that doesn't apply never connects: a `pont2-signin` in\n * `pont2-signed-out` never starts a flow for a signed-in user (migration tracker\n * W-2).\n *\n * - **Nothing until the provider has asked** (`resolved`): its interim answer is\n * \"signed out\", so either branch would flash for some users on every load.\n * Without a provider it stays closed.\n * - **No wrapper:** the children go back exactly where the author wrote them,\n * as the host's own children, and the host adds no box (`display: contents`).\n * (The legacy elements re-rendered them inside a `<div>` of their own.)\n * - **A placeholder:** a direct child `[part=\"fallback\"]` stays while the answer\n * is pending and is removed once it arrives, the widgets' contract (F-17).\n * - `data-state`: `pending`, `open` or `closed`.\n *\n * **Framework hosts** (React) should branch on the provider's\n * `pont2-auth-changed` event instead, as the pontkit bindings do: an element\n * that detaches children takes them away from a framework that still thinks it\n * owns them.\n */\nexport abstract class AuthGate extends HostElement {\n static override identity = \"auth-gate\";\n static override composite = false;\n\n private consumer = new ContextConsumer(this, { context: authStateContext, subscribe: true });\n /** The children held while closed, in order. */\n private held: Node[] = [];\n /** Catches children a host adds while the gate is closed. */\n private observer: MutationObserver | null = null;\n\n /** Whether this gate opens for `auth` (only asked once `auth.resolved`). */\n protected abstract opensFor(auth: AuthState): boolean;\n\n /** The auth state the gate is following. */\n get auth(): AuthState {\n return this.consumer.value ?? UNRESOLVED_AUTH;\n }\n\n /** Whether the children are shown. */\n get open(): boolean {\n return this.auth.resolved && this.opensFor(this.auth);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.apply();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.observer = null;\n }\n\n protected override updated(_changed: PropertyValues): void {\n this.apply();\n }\n\n private apply(): void {\n const auth = this.auth;\n const open = this.open;\n this.setData(\"state\", !auth.resolved ? \"pending\" : open ? \"open\" : \"closed\");\n if (auth.resolved) this.querySelector(':scope > [part=\"fallback\"]')?.remove();\n if (open) {\n this.observer?.disconnect();\n this.observer = null;\n if (this.held.length) this.append(...this.held);\n this.held = [];\n return;\n }\n this.hold();\n if (!this.observer && this.isConnected) {\n this.observer = new MutationObserver(() => this.hold());\n this.observer.observe(this, { childList: true });\n }\n }\n\n /** Detaches every child but the pending placeholder. */\n private hold(): void {\n if (this.open) return;\n const pending = !this.auth.resolved;\n for (const node of Array.from(this.childNodes)) {\n if (pending && node instanceof Element && node.getAttribute(\"part\") === \"fallback\") continue;\n this.held.push(node);\n node.remove();\n }\n }\n}\n\n/**\n * # `<pont2-signed-in>`: shown once the provider knows someone is signed in\n *\n * @tag pont2-signed-in\n */\nexport class SignedIn extends AuthGate {\n static override identity = \"signed-in\";\n static override slotName = \"signed-in\";\n protected opensFor(auth: AuthState): boolean {\n return auth.isAuthenticated;\n }\n}\n\n/**\n * # `<pont2-signed-out>`: shown once the provider knows nobody is signed in\n *\n * @tag pont2-signed-out\n */\nexport class SignedOut extends AuthGate {\n static override identity = \"signed-out\";\n static override slotName = \"signed-out\";\n protected opensFor(auth: AuthState): boolean {\n return !auth.isAuthenticated;\n }\n}\n\ndefine(\"pont2-signed-in\", SignedIn);\ndefine(\"pont2-signed-out\", SignedOut);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-signed-in\": SignedIn;\n \"pont2-signed-out\": SignedOut;\n }\n}\n","/**\n * The page numbers a pager shows, with gaps. Pure, so it is unit-tested\n * (range.test.ts).\n *\n * Always shows the first and last `boundaries` pages and `siblings` pages on\n * each side of the current one; a run of hidden pages becomes one\n * `\"ellipsis\"`, except that a gap of exactly one page shows that page (an\n * ellipsis standing for a single number saves nothing). The number of slots\n * is constant while there are enough pages, so the pager does not change\n * width as you page through (the MUI / Mantine `usePagination` rule).\n *\n * `paginationRange(5, 10)` → `[1, \"ellipsis\", 4, 5, 6, \"ellipsis\", 10]`\n */\nexport type PageSlot = number | \"ellipsis\";\n\nexport function paginationRange(page: number, pageCount: number, siblings = 1, boundaries = 1): PageSlot[] {\n const count = Math.max(0, Math.floor(pageCount));\n if (count === 0) return [];\n const sib = Math.max(0, Math.floor(siblings));\n const bnd = Math.max(0, Math.floor(boundaries));\n const current = clampPage(page, count);\n const range = (from: number, to: number) => Array.from({ length: Math.max(0, to - from + 1) }, (_, i) => from + i);\n\n // Everything fits: boundaries on both sides, siblings, the current page and two gaps.\n const slots = 2 * bnd + 2 * sib + 3;\n if (count <= slots) return range(1, count);\n\n const start = range(1, bnd);\n const end = range(count - bnd + 1, count);\n // Keep the window of siblings the same size near the edges.\n const lo = Math.max(Math.min(current - sib, count - bnd - 2 * sib - 1), bnd + 2);\n const hi = Math.min(Math.max(current + sib, bnd + 2 * sib + 2), count - bnd - 1);\n\n const out: PageSlot[] = [...start];\n if (lo > bnd + 2) out.push(\"ellipsis\");\n else if (lo === bnd + 2) out.push(bnd + 1);\n out.push(...range(lo, hi));\n if (hi < count - bnd - 1) out.push(\"ellipsis\");\n else if (hi === count - bnd - 1) out.push(count - bnd);\n out.push(...end);\n return out;\n}\n\n/** `page` as a whole page number within `1…pageCount` (1 when there are no pages). */\nexport function clampPage(page: number, pageCount: number): number {\n const count = Math.max(1, Math.floor(pageCount) || 1);\n const p = Math.floor(Number.isFinite(page) ? page : 1);\n return Math.min(Math.max(p, 1), count);\n}\n","import { html, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fire } from \"../../core/events\";\nimport { icons } from \"../../core/icons\";\nimport { currentLocale, MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\nimport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n} from \"../../primitives/pagination/pagination\";\nimport { clampPage, paginationRange } from \"./range\";\n\nexport { clampPage, paginationRange, type PageSlot } from \"./range\";\n\nexport interface PageChangeDetail {\n page: number;\n}\n\n/**\n * # `<pont2-pagination>`: kit composite over `<pont2-prim-pagination>`\n *\n * A pager from two numbers. It **is** the primitive's nav (`extends\n * Pagination`) and renders shadcn's DOM inside it: the list, its items,\n * Previous / page buttons / ellipses / Next. The page links are `<button>`s\n * (a pager in an app pages data, it does not navigate).\n *\n * ```html\n * <pont2-pagination page=\"3\" page-count=\"12\"></pont2-pagination>\n * ```\n *\n * Which pages show is `paginationRange()` (range.ts): first and last, the\n * current page with `siblings` on each side, and an ellipsis for each longer\n * gap, in a constant number of slots. Page numbers are formatted for the page's\n * language (`Intl.NumberFormat`), and every word is a `msg()` code: `pagination`,\n * `pagination_previous` / `_next` (button text), `pagination_previous_page` /\n * `_next_page` (their labels), `pagination_more`.\n *\n * Pressing a page fires a cancelable `pont2-page-change` `{ page }`; unless it\n * is cancelled, `page` becomes the new page (uncontrolled). Set `page` from\n * the handler instead (and cancel) to control it.\n *\n * @tag pont2-pagination\n * @attr page - the current page, 1-based (default 1)\n * @attr page-count - how many pages there are (default 1)\n * @attr siblings - pages shown on each side of the current one (default 1)\n * @attr boundaries - pages always shown at each end (default 1)\n * @attr disabled - every control disabled (for example while a page loads)\n * @fires pont2-page-change - cancelable `{ page }`, the user pressed a page, Previous or Next\n */\nexport class KitPagination extends Pagination {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n page: { type: Number, reflect: true },\n pageCount: { type: Number, attribute: \"page-count\" },\n siblings: { type: Number },\n boundaries: { type: Number },\n disabled: { type: Boolean, reflect: true },\n };\n declare page: number;\n declare pageCount: number;\n declare siblings: number;\n declare boundaries: number;\n declare disabled: boolean;\n\n protected readonly kitMessages = new MessagesController(this);\n\n constructor() {\n super();\n this.page = 1;\n this.pageCount = 1;\n this.siblings = 1;\n this.boundaries = 1;\n this.disabled = false;\n }\n\n /** Request a page, as the user did. Returns false if a listener cancelled it. */\n goTo(page: number): boolean {\n const target = clampPage(page, this.pageCount);\n if (target === clampPage(this.page, this.pageCount) || this.disabled) return false;\n if (!fire<PageChangeDetail>(this, \"pont2-page-change\", { page: target }, true)) return false;\n this.page = target;\n return true;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate?.(changed);\n this.setData(\"disabled\", this.disabled);\n }\n\n override render() {\n const count = Math.max(1, Math.floor(this.pageCount) || 1);\n const page = clampPage(this.page, count);\n const format = new Intl.NumberFormat(currentLocale());\n const item = (content: unknown) => html`<li ${PaginationItem.part()}>${content}</li>`;\n const pageButton = (n: number) =>\n button(\n {\n variant: n === page ? \"outline\" : \"ghost\",\n size: \"icon\",\n slot: \"pagination-link\",\n disabled: this.disabled,\n attrs: { \"aria-current\": n === page ? \"page\" : null, \"data-active\": n === page ? \"true\" : null, \"data-page\": String(n) },\n onClick: () => this.goTo(n),\n },\n format.format(n),\n );\n return html`<ul ${PaginationContent.part()}>\n ${item(\n button(\n {\n size: \"default\",\n variant: \"ghost\",\n slot: \"pagination-previous\",\n disabled: this.disabled || page <= 1,\n focusableWhenDisabled: true,\n attrs: { \"aria-label\": msg(\"pagination_previous_page\") },\n onClick: () => this.goTo(page - 1),\n },\n html`<span data-slot=\"pagination-previous-text\">${msg(\"pagination_previous\")}</span>`,\n ),\n )}\n ${paginationRange(page, count, this.siblings, this.boundaries).map(slot =>\n item(\n slot === \"ellipsis\"\n ? html`<span ${PaginationEllipsis.part({ \"aria-hidden\": \"true\" })}>${icons.ellipsis()}<span data-pont2-sr-only>${msg(\"pagination_more\")}</span></span>`\n : pageButton(slot),\n ),\n )}\n ${item(\n button(\n {\n size: \"default\",\n variant: \"ghost\",\n slot: \"pagination-next\",\n disabled: this.disabled || page >= count,\n focusableWhenDisabled: true,\n attrs: { \"aria-label\": msg(\"pagination_next_page\") },\n onClick: () => this.goTo(page + 1),\n },\n html`<span data-slot=\"pagination-next-text\">${msg(\"pagination_next\")}</span>`,\n ),\n )}\n </ul>`;\n }\n}\n\ndefine(\"pont2-pagination\", KitPagination);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-pagination\": KitPagination;\n }\n interface HTMLElementEventMap {\n \"pont2-page-change\": CustomEvent<PageChangeDetail>;\n }\n}\n","/**\n * The data table's pure logic (rows.test.ts): sorting and the three-step\n * sort cycle. Kept out of the element so it runs without a DOM.\n */\nexport type SortDirection = \"asc\" | \"desc\";\n\nexport interface SortState {\n key: string | null;\n direction: SortDirection;\n}\n\n/**\n * The next sort after pressing a column's header: a new column sorts\n * ascending, then the same column descending, then unsorted (the legacy\n * `pont-data-table` cycle, and TanStack's default).\n */\nexport function nextSort(current: SortState, key: string): SortState {\n if (current.key !== key) return { key, direction: \"asc\" };\n if (current.direction === \"asc\") return { key, direction: \"desc\" };\n return { key: null, direction: \"asc\" };\n}\n\n/** A value comparable across types: numbers and dates by value, strings by the locale's collation, empty last. */\nexport function compareValues(a: unknown, b: unknown, collator: Intl.Collator): number {\n const empty = (v: unknown) => v === null || v === undefined || v === \"\";\n if (empty(a) || empty(b)) return empty(a) === empty(b) ? 0 : empty(a) ? 1 : -1;\n const num = (v: unknown) => (v instanceof Date ? v.getTime() : typeof v === \"number\" || typeof v === \"bigint\" ? Number(v) : NaN);\n const na = num(a);\n const nb = num(b);\n if (!Number.isNaN(na) && !Number.isNaN(nb)) return na - nb;\n if (typeof a === \"boolean\" && typeof b === \"boolean\") return Number(a) - Number(b);\n return collator.compare(String(a), String(b));\n}\n\n/**\n * `rows` sorted by `sortValue(row)` in `direction`, stably (rows that compare\n * equal keep their order). Empty values sort last in both directions. Returns\n * a new array; with no key, the rows as given.\n */\nexport function sortRows<T>(\n rows: readonly T[],\n sort: SortState,\n sortValue: (row: T, key: string) => unknown,\n locale?: string,\n): T[] {\n if (!sort.key) return [...rows];\n const key = sort.key;\n const collator = new Intl.Collator(locale, { numeric: true, sensitivity: \"base\" });\n const sign = sort.direction === \"desc\" ? -1 : 1;\n return rows\n .map((row, index) => ({ row, index, value: sortValue(row, key) }))\n .sort((x, y) => {\n const xe = x.value === null || x.value === undefined || x.value === \"\";\n const ye = y.value === null || y.value === undefined || y.value === \"\";\n if (xe || ye) return xe === ye ? x.index - y.index : xe ? 1 : -1;\n return sign * compareValues(x.value, y.value, collator) || x.index - y.index;\n })\n .map(e => e.row);\n}\n\n/** What the body shows: skeleton rows while loading, the empty row when there is nothing, else the rows. */\nexport function bodyState(loading: boolean, rowCount: number): \"loading\" | \"empty\" | \"rows\" {\n if (loading) return \"loading\";\n return rowCount === 0 ? \"empty\" : \"rows\";\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues, type TemplateResult } from \"lit\";\nimport { repeat } from \"lit/directives/repeat.js\";\n\nimport { fire } from \"../../core/events\";\nimport { icons } from \"../../core/icons\";\nimport { currentLocale, MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\nimport \"../../primitives/dropdown-menu/dropdown-menu\";\nimport { Skeleton } from \"../../primitives/skeleton/skeleton\";\nimport { Table } from \"../../primitives/table/table\";\nimport { bodyState, nextSort, sortRows, type SortDirection } from \"./rows\";\n\nexport { bodyState, nextSort, sortRows, type SortDirection, type SortState } from \"./rows\";\n\n// The row type is the app's; `any` keeps columns and actions assignable from typed arrays.\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport type DataTableRow = any;\n\n/** One column. Everything but `key` and `header` is optional. */\nexport interface DataTableColumn<T = DataTableRow> {\n /** The row field shown (and sorted on) by default; also the column's id in events. */\n key: string;\n /** Header text. */\n header: string;\n /** What the cell shows: text or a Lit template. Default: `row[key]` as text. */\n cell?: (row: T, index: number) => unknown;\n /** The header becomes a sort button. */\n sortable?: boolean;\n /** What the column sorts by (default `row[key]`): numbers and dates by value, text by the page's collation. */\n sortValue?: (row: T) => unknown;\n /** Cell alignment (default start). */\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/** One entry in each row's actions menu. */\nexport interface DataTableAction<T = DataTableRow> {\n /** Sent in `pont2-row-action`. */\n action: string;\n label: string;\n variant?: \"default\" | \"destructive\";\n /** Leave the action out of this row's menu. */\n hidden?: (row: T) => boolean;\n disabled?: (row: T) => boolean;\n}\n\nexport interface RowActionDetail<T = DataTableRow> {\n action: string;\n row: T;\n key: string;\n}\n\nexport interface SortChangeDetail {\n key: string | null;\n direction: SortDirection;\n}\n\n/**\n * # `<pont2-data-table>`: kit composite over `<pont2-prim-table>`\n *\n * shadcn's \"Data Table\" is a recipe (TanStack Table + `<Table>`), not a\n * component. This is that recipe as one element, with what the account\n * widgets need (tracker W-11): columns, rows, sortable headers, a per-row\n * actions menu, a loading state and an empty state. It **is** the table\n * container (`extends Table`) and renders a native `<table>` inside it, which\n * the Table primitive's recipe styles as it does any table.\n *\n * ```ts\n * table.columns = [\n * { key: \"name\", header: \"Name\", sortable: true },\n * { key: \"joined\", header: \"Joined\", sortable: true, cell: r => formatDate(r.joined) },\n * ];\n * table.actions = [{ action: \"remove\", label: \"Remove member\", variant: \"destructive\", hidden: r => r.isOwner }];\n * table.rows = members;\n * ```\n *\n * - **Sorting:** pressing a sortable header cycles ascending → descending →\n * unsorted and fires a cancelable `pont2-sort-change` `{ key, direction }`.\n * Rows are sorted here unless `manual-sort` is set (server-side sorting:\n * sort in the handler and set `rows`). The header carries `aria-sort`.\n * - **Actions:** with `actions`, each row ends in a \"⋯\" menu (a Dropdown Menu\n * primitive) labelled `actions-label`; an item fires `pont2-row-action`\n * `{ action, row, key }`.\n * - **Loading:** `loading` shows `loading-rows` skeleton rows and sets\n * `aria-busy`.\n * - **Empty:** no rows shows one full-width row with `empty-label`.\n *\n * Default words are `msg()` codes: `no_results`, `actions_menu`.\n *\n * @tag pont2-data-table\n * @attr row-key - the row field that identifies a row (default `id`); the `rowKey` property may also be a function\n * @attr sort-key, sort-direction - the current sort (`asc` | `desc`); set them to sort initially or to control it\n * @attr manual-sort - don't sort the rows here, only report `pont2-sort-change`\n * @attr loading - show skeleton rows\n * @attr loading-rows - how many (default 5)\n * @attr empty-label - shown when there are no rows (default `msg(\"no_results\")`)\n * @attr actions-label - the accessible name of each row's actions button (default `msg(\"actions_menu\")`)\n * @attr caption - a caption under the table\n * @fires pont2-sort-change - cancelable `{ key, direction }`, a sortable header was pressed\n * @fires pont2-row-action - `{ action, row, key }`, a row action was chosen\n */\nexport class DataTable extends Table {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n columns: { attribute: false },\n rows: { attribute: false },\n actions: { attribute: false },\n rowKey: { attribute: \"row-key\" },\n sortKey: { type: String, attribute: \"sort-key\" },\n sortDirection: { type: String, attribute: \"sort-direction\" },\n manualSort: { type: Boolean, attribute: \"manual-sort\" },\n loading: { type: Boolean, reflect: true },\n loadingRows: { type: Number, attribute: \"loading-rows\" },\n emptyLabel: { type: String, attribute: \"empty-label\" },\n actionsLabel: { type: String, attribute: \"actions-label\" },\n caption: { type: String },\n };\n declare columns: DataTableColumn[];\n declare rows: DataTableRow[];\n declare actions: DataTableAction[];\n declare rowKey: string | ((row: DataTableRow) => string);\n declare sortKey: string | null;\n declare sortDirection: SortDirection;\n declare manualSort: boolean;\n declare loading: boolean;\n declare loadingRows: number;\n declare emptyLabel: string;\n declare actionsLabel: string;\n declare caption: string;\n\n protected readonly messages = new MessagesController(this);\n\n constructor() {\n super();\n this.columns = [];\n this.rows = [];\n this.actions = [];\n this.rowKey = \"id\";\n this.sortKey = null;\n this.sortDirection = \"asc\";\n this.manualSort = false;\n this.loading = false;\n this.loadingRows = 5;\n this.emptyLabel = \"\";\n this.actionsLabel = \"\";\n this.caption = \"\";\n }\n\n /** The rows in the order shown. */\n get visibleRows(): DataTableRow[] {\n if (this.manualSort) return [...(this.rows ?? [])];\n const column = this.columns.find(c => c.key === this.sortKey);\n return sortRows(\n this.rows ?? [],\n { key: column?.sortable ? column.key : null, direction: this.sortDirection },\n row => (column?.sortValue ? column.sortValue(row) : row?.[column!.key]),\n currentLocale(),\n );\n }\n\n /** Press a column's sort, as the user did. Returns false if a listener cancelled it. */\n toggleSort(key: string): boolean {\n const next = nextSort({ key: this.sortKey, direction: this.sortDirection }, key);\n if (!fire<SortChangeDetail>(this, \"pont2-sort-change\", next, true)) return false;\n this.sortKey = next.key;\n this.sortDirection = next.direction;\n return true;\n }\n\n private keyOf(row: DataTableRow, index: number): string {\n if (typeof this.rowKey === \"function\") return String(this.rowKey(row));\n const v = row?.[this.rowKey || \"id\"];\n return v === undefined || v === null ? `#${index}` : String(v);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate?.(changed);\n this.setData(\"loading\", this.loading);\n }\n\n private headerCell(column: DataTableColumn): TemplateResult {\n const align = column.align && column.align !== \"start\" ? column.align : nothing;\n if (!column.sortable) return html`<th scope=\"col\" data-align=${align}>${column.header}</th>`;\n const sorted = this.sortKey === column.key;\n const ariaSort = sorted ? (this.sortDirection === \"asc\" ? \"ascending\" : \"descending\") : \"none\";\n const icon = sorted ? (this.sortDirection === \"asc\" ? icons.arrowUp() : icons.arrowDown()) : icons.arrowUpDown();\n return html`<th scope=\"col\" aria-sort=${ariaSort} data-align=${align} data-sortable>\n ${button(\n {\n variant: \"ghost\",\n size: \"sm\",\n attrs: { \"data-pont2-data-table-sort\": true, \"data-sort-key\": column.key },\n onClick: () => this.toggleSort(column.key),\n },\n html`${column.header}${icon}`,\n )}\n </th>`;\n }\n\n private actionsCell(row: DataTableRow, key: string): TemplateResult {\n const items = this.actions.filter(a => !a.hidden?.(row));\n const label = this.actionsLabel || msg(\"actions_menu\");\n if (!items.length) return html`<td data-pont2-data-table-actions></td>`;\n return html`<td data-pont2-data-table-actions>\n <pont2-prim-dropdown-menu>\n <pont2-prim-dropdown-menu-trigger>\n ${button({ variant: \"ghost\", size: \"icon-sm\", attrs: { \"aria-label\": label } }, icons.ellipsis())}\n </pont2-prim-dropdown-menu-trigger>\n <pont2-prim-dropdown-menu-content align=\"end\">\n ${items.map(\n a => html`<pont2-prim-dropdown-menu-item\n variant=${a.variant ?? \"default\"}\n ?disabled=${!!a.disabled?.(row)}\n data-action=${a.action}\n @click=${() => fire<RowActionDetail>(this, \"pont2-row-action\", { action: a.action, row, key })}\n >${a.label}</pont2-prim-dropdown-menu-item\n >`,\n )}\n </pont2-prim-dropdown-menu-content>\n </pont2-prim-dropdown-menu>\n </td>`;\n }\n\n override render() {\n const columns = this.columns ?? [];\n const hasActions = (this.actions ?? []).length > 0;\n const span = columns.length + (hasActions ? 1 : 0) || 1;\n const rows = this.visibleRows;\n const state = bodyState(this.loading, rows.length);\n const actionsLabel = this.actionsLabel || msg(\"actions_menu\");\n const cell = (column: DataTableColumn, row: DataTableRow, index: number) => {\n const value = column.cell ? column.cell(row, index) : row?.[column.key];\n const align = column.align && column.align !== \"start\" ? column.align : nothing;\n return html`<td data-align=${align}>${value ?? \"\"}</td>`;\n };\n let body: unknown;\n if (state === \"loading\") {\n body = Array.from(\n { length: Math.max(1, this.loadingRows || 1) },\n () => html`<tr data-pont2-data-table-loading-row>\n ${columns.map(() => html`<td><div ${Skeleton.part()} data-pont2-data-table-skeleton></div></td>`)}${hasActions ? html`<td></td>` : nothing}\n </tr>`,\n );\n } else if (state === \"empty\") {\n body = html`<tr data-pont2-data-table-empty><td colspan=${span}>${this.emptyLabel || msg(\"no_results\")}</td></tr>`;\n } else {\n body = repeat(\n rows,\n (row, i) => this.keyOf(row, i),\n (row, i) => {\n const key = this.keyOf(row, i);\n return html`<tr data-row-key=${key}>\n ${columns.map(c => cell(c, row, i))}${hasActions ? this.actionsCell(row, key) : nothing}\n </tr>`;\n },\n );\n }\n return html`<table aria-busy=${this.loading ? \"true\" : nothing}>\n ${this.caption ? html`<caption>${this.caption}</caption>` : nothing}\n <thead>\n <tr>\n ${columns.map(c => this.headerCell(c))}${hasActions\n ? html`<th scope=\"col\" data-pont2-data-table-actions><span data-pont2-sr-only>${actionsLabel}</span></th>`\n : nothing}\n </tr>\n </thead>\n <tbody>\n ${body}\n </tbody>\n </table>`;\n }\n}\n\ndefine(\"pont2-data-table\", DataTable);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-data-table\": DataTable;\n }\n interface HTMLElementEventMap {\n \"pont2-sort-change\": CustomEvent<SortChangeDetail>;\n \"pont2-row-action\": CustomEvent<RowActionDetail>;\n }\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { Combobox } from \"../../primitives/combobox/combobox\";\n\nexport interface BadgeOption {\n value: string;\n label: string;\n /**\n * Can't be added, and **locked** when selected: its badge has no remove\n * button (a role the person may not assign or take away).\n */\n disabled?: boolean;\n}\n\n/**\n * # `<pont2-badge-selector>`: kit composite over a multiple `<pont2-prim-combobox>`\n *\n * Pick several options as badges, with type-to-filter: the account widgets'\n * role picker (legacy `pont-badge-selector`). It **is** the Combobox\n * primitive's root in `multiple` mode (form-associated: it submits one\n * `name=value` per selected value), and renders shadcn's multiple-combobox\n * DOM inside it: the chips input, then the popup with the list of options.\n *\n * ```html\n * <pont2-badge-selector name=\"roles\" placeholder=\"Search roles\"></pont2-badge-selector>\n * <script>\n * el.options = [{ value: \"owner\", label: \"Owner\", disabled: true }, { value: \"admin\", label: \"Admin\" }];\n * el.values = [\"owner\"]; // owner is locked in\n * el.addEventListener(\"change\", () => save(el.values));\n * </script>\n * ```\n *\n * - **Locked badges:** a selected option with `disabled` can't be removed\n * (no remove button, Backspace skips it) and a disabled option can't be\n * added.\n * - **`max-selections`:** once reached, the unselected options are disabled.\n * - Events are the Combobox's: `input` and `change` when the selection\n * changes (read `values`), `pont2-open-change`.\n *\n * Default words are `msg()` codes: `search_roles` (placeholder), `no_options`\n * (nothing matches).\n *\n * @tag pont2-badge-selector\n * @attr name, required, disabled - as the Combobox's\n * @attr placeholder - shown while nothing is selected (default `msg(\"search_roles\")`)\n * @attr empty-label - shown when no option matches (default `msg(\"no_options\")`)\n * @attr max-selections - the most values that can be selected\n * @fires input, change - the selection changed (read `values`)\n */\nexport class BadgeSelector extends Combobox {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n options: { attribute: false },\n placeholder: { type: String },\n emptyLabel: { type: String, attribute: \"empty-label\" },\n maxSelections: { type: Number, attribute: \"max-selections\" },\n };\n declare options: BadgeOption[];\n declare placeholder: string;\n declare emptyLabel: string;\n declare maxSelections: number | undefined;\n\n protected readonly messages = new MessagesController(this);\n\n constructor() {\n super();\n this.multiple = true;\n this.options = [];\n this.placeholder = \"\";\n this.emptyLabel = \"\";\n this.maxSelections = undefined;\n }\n\n get maxReached(): boolean {\n return this.maxSelections != null && this.maxSelections > 0 && (this.values ?? []).length >= this.maxSelections;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.multiple = true; // a badge selector always selects several\n }\n\n override render() {\n const selected = new Set(this.values ?? []);\n return html`<pont2-prim-combobox-chips placeholder=${this.placeholder || msg(\"search_roles\")}></pont2-prim-combobox-chips>\n <pont2-prim-combobox-content>\n <pont2-prim-combobox-empty>${this.emptyLabel || msg(\"no_options\")}</pont2-prim-combobox-empty>\n <pont2-prim-combobox-list>\n ${(this.options ?? []).map(\n o => html`<pont2-prim-combobox-item\n value=${o.value}\n label=${o.label}\n ?disabled=${!!o.disabled || (this.maxReached && !selected.has(o.value))}\n data-locked=${o.disabled && selected.has(o.value) ? \"\" : nothing}\n >${o.label}</pont2-prim-combobox-item\n >`,\n )}\n </pont2-prim-combobox-list>\n </pont2-prim-combobox-content>`;\n }\n}\n\ndefine(\"pont2-badge-selector\", BadgeSelector);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-badge-selector\": BadgeSelector;\n }\n}\n","/**\n * The multi-email input's pure logic (emails.test.ts).\n */\n\n/** What a person types or pastes between addresses: spaces, commas, semicolons, new lines. */\nconst SEPARATORS = /[\\s,;]+/;\n\n/**\n * The HTML spec's \"valid email address\" (what `<input type=\"email\">` checks),\n * plus a dot in the domain, as the legacy input required: an invitation to\n * `ann@localhost` is a typo, not an address.\n */\nconst EMAIL = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/;\n\n/** `text` split into candidate addresses (trimmed, empty pieces dropped). */\nexport function splitEmails(text: string): string[] {\n return text.split(SEPARATORS).map(s => s.trim()).filter(Boolean);\n}\n\nexport function isEmail(text: string): boolean {\n return EMAIL.test(text.trim());\n}\n\nexport interface AddResult {\n /** The new list (`current` plus what was accepted). */\n values: string[];\n /** Candidates that are not valid addresses, in the order given. */\n invalid: string[];\n /** Valid candidates left out because `max` was reached. */\n overflow: string[];\n}\n\n/**\n * Adds `candidates` to `current`: valid addresses only, each once (compared\n * case-insensitively, the first spelling kept), up to `max` in total.\n */\nexport function addEmails(current: readonly string[], candidates: readonly string[], max = Infinity): AddResult {\n const values = [...current];\n const seen = new Set(values.map(v => v.toLowerCase()));\n const invalid: string[] = [];\n const overflow: string[] = [];\n for (const raw of candidates) {\n const email = raw.trim();\n if (!email) continue;\n if (!isEmail(email)) {\n if (!invalid.includes(email)) invalid.push(email);\n continue;\n }\n const key = email.toLowerCase();\n if (seen.has(key)) continue;\n if (values.length >= max) {\n overflow.push(email);\n continue;\n }\n seen.add(key);\n values.push(email);\n }\n return { values, invalid, overflow };\n}\n","import { html, nothing, type PropertyDeclarations, type PropertyValues } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { FormControlElement, type ValidityResult } from \"../../core/form-control\";\nimport { icons } from \"../../core/icons\";\nimport { ensureId, uid } from \"../../core/ids\";\nimport { currentLocale, MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { button } from \"../../primitives/button/button\";\nimport { ComboboxChips } from \"../../primitives/combobox/combobox\";\nimport { FieldDescription, FieldError } from \"../../primitives/field/field\";\nimport { addEmails, splitEmails } from \"./emails\";\n\nexport { addEmails, isEmail, splitEmails, type AddResult } from \"./emails\";\n\n/**\n * # `<pont2-multi-email-input>`: several email addresses as removable chips\n *\n * The account widgets' \"invite members\" field (legacy `pont-multi-email-input`).\n * Type or paste addresses: Enter, a comma, a semicolon, a space, a paste or\n * leaving the field turns what was typed into chips; invalid addresses stay\n * out and are named in an error below. Backspace in the empty input removes\n * the last chip.\n *\n * It is a form control (form-associated: one `name=address` entry per\n * address, `required`, `disabled`, reset), labelled by its `<label for>`. It\n * reuses the multiple Combobox's chips recipe (`ComboboxChips.part()`: the\n * same box, chips and input as `<pont2-badge-selector>`), with a Field\n * description (a count, `3 / 50`) or error under it.\n *\n * ```html\n * <label data-pont2-label for=\"invite\">Email addresses</label>\n * <pont2-multi-email-input id=\"invite\" name=\"emails\" max=\"50\" required></pont2-multi-email-input>\n * ```\n *\n * Words are `msg()` codes: `invite_emails_placeholder`, `invalid_emails`,\n * `email_limit_reached`, `action_remove`. The counter is formatted for the\n * page's language.\n *\n * @tag pont2-multi-email-input\n * @attr name, required, disabled - as a native control's\n * @attr placeholder - shown while empty (default `msg(\"invite_emails_placeholder\")`)\n * @attr max - the most addresses (default 50)\n * @fires input, change - the list changed (read `values`)\n */\nexport class MultiEmailInput extends FormControlElement {\n static override identity = \"multi-email-input\";\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n values: { attribute: false },\n placeholder: { type: String },\n max: { type: Number },\n invalid: { state: true },\n limitReached: { state: true },\n };\n declare values: string[];\n declare placeholder: string;\n declare max: number;\n /** What the last attempt could not add. */\n declare protected invalid: string[];\n declare protected limitReached: boolean;\n\n protected readonly messages = new MessagesController(this);\n private readonly inputId = uid(\"multi-email\");\n private readonly hintId = uid(\"multi-email-hint\");\n private defaultValues: string[] | null = null;\n\n constructor() {\n super();\n this.values = [];\n this.placeholder = \"\";\n this.max = 50;\n this.invalid = [];\n this.limitReached = false;\n this.addEventListener(\"click\", e => {\n if (e.target === this) this.input?.focus(); // <label for> on the host\n });\n }\n\n protected override get hostFocusable(): boolean {\n return false;\n }\n\n get input(): HTMLInputElement | null {\n return this.querySelector(\"[data-pont2-combobox-chip-input]\");\n }\n\n override focus(options?: FocusOptions): void {\n this.input?.focus(options);\n }\n\n /** Add addresses (as if typed). Returns what could not be added. */\n add(text: string | string[]): { invalid: string[]; overflow: string[] } {\n const candidates = Array.isArray(text) ? text : splitEmails(text);\n const r = addEmails(this.values, candidates, this.max > 0 ? this.max : Infinity);\n this.invalid = r.invalid;\n this.limitReached = r.overflow.length > 0 || (this.max > 0 && r.values.length >= this.max);\n if (r.values.length !== this.values.length) this.commit(r.values);\n return { invalid: r.invalid, overflow: r.overflow };\n }\n\n removeEmail(email: string): void {\n if (this.isDisabled) return;\n this.invalid = [];\n this.limitReached = false;\n this.commit(this.values.filter(v => v !== email));\n }\n\n private commit(values: string[]): void {\n this.values = values;\n fireNative(this, \"input\");\n fireNative(this, \"change\");\n }\n\n /** Turn the typed text into chips; keeps anything invalid in the input to fix. */\n private flush(): void {\n const input = this.input;\n if (!input || !input.value.trim()) return;\n const { invalid } = this.add(input.value);\n input.value = invalid.join(\" \");\n }\n\n private onKeyDown = (e: KeyboardEvent) => {\n const input = e.target as HTMLInputElement;\n if (e.key === \"Enter\" || e.key === \",\" || e.key === \";\" || (e.key === \" \" && input.value.trim())) {\n if (e.isComposing) return;\n e.preventDefault(); // never submit the form from here\n this.flush();\n return;\n }\n if (e.key === \"Backspace\" && !input.value && this.values.length) {\n e.preventDefault();\n this.removeEmail(this.values[this.values.length - 1]);\n }\n };\n\n private onPaste = (e: ClipboardEvent) => {\n const text = e.clipboardData?.getData(\"text\") ?? \"\";\n if (!text) return;\n e.preventDefault();\n const input = e.target as HTMLInputElement;\n const { invalid } = this.add(`${input.value} ${text}`);\n input.value = invalid.join(\" \");\n };\n\n private onInput = () => {\n if (this.invalid.length) this.invalid = [];\n };\n\n /* ---------------- form control ---------------- */\n\n protected formValue(): FormData | null {\n if (!this.name || !this.values.length) return null;\n const data = new FormData();\n for (const v of this.values) data.append(this.name, v);\n return data;\n }\n\n protected resetToDefault(): void {\n this.values = [...(this.defaultValues ?? [])];\n this.invalid = [];\n this.limitReached = false;\n const input = this.input;\n if (input) input.value = \"\";\n }\n\n protected override restoreState(state: string | File | FormData | null): void {\n if (state instanceof FormData) this.values = state.getAll(this.name).map(String);\n }\n\n protected override validate(): ValidityResult | null {\n if (this.required && !this.values.length) {\n return { flags: { valueMissing: true }, message: msg(\"invite_emails_required\") };\n }\n return null;\n }\n\n protected override get validationAnchor(): HTMLElement | undefined {\n return this.input ?? undefined;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n this.defaultValues ??= [...(this.values ?? [])];\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n const input = this.input;\n if (input) {\n const ids = Array.from(this.internals.labels as NodeListOf<HTMLElement>).map(l => ensureId(l, \"multi-email-label\"));\n if (ids.length && !input.hasAttribute(\"aria-label\")) input.setAttribute(\"aria-labelledby\", ids.join(\" \"));\n }\n }\n\n override render() {\n const disabled = this.isDisabled;\n const full = this.max > 0 && this.values.length >= this.max;\n const error = this.invalid.length\n ? `${msg(\"invalid_emails\")} ${this.invalid.join(\", \")}`\n : this.limitReached\n ? msg(\"email_limit_reached\")\n : \"\";\n const count = new Intl.NumberFormat(currentLocale());\n return html`<div ${ComboboxChips.part()} data-pont2-multi-email-box ?data-disabled=${disabled}>\n ${this.values.map(\n email => html`<div data-pont2-combobox-chip data-slot=\"combobox-chip\" data-value=${email}>${email}${disabled\n ? nothing\n : button(\n {\n variant: \"ghost\",\n size: \"icon-xs\",\n slot: \"combobox-chip-remove\",\n attrs: { tabindex: \"-1\", \"aria-label\": `${msg(\"action_remove\")} ${email}` },\n onClick: () => {\n this.removeEmail(email);\n this.input?.focus();\n },\n },\n icons.x(),\n )}</div>`,\n )}<input\n id=${this.inputId}\n data-pont2-combobox-chip-input\n data-slot=\"combobox-chip-input\"\n type=\"text\"\n inputmode=\"email\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n placeholder=${this.values.length ? nothing : this.placeholder || msg(\"invite_emails_placeholder\")}\n ?disabled=${disabled || full}\n aria-invalid=${error ? \"true\" : nothing}\n aria-describedby=${this.hintId}\n @keydown=${this.onKeyDown}\n @paste=${this.onPaste}\n @input=${this.onInput}\n @blur=${() => this.flush()}\n />\n </div>\n ${error\n ? html`<div ${FieldError.part({ id: this.hintId, role: \"alert\" })}>${error}</div>`\n : html`<div ${FieldDescription.part({ id: this.hintId })} data-pont2-multi-email-count>\n ${count.format(this.values.length)} / ${count.format(this.max)}\n </div>`}`;\n }\n}\n\ndefine(\"pont2-multi-email-input\", MultiEmailInput);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-multi-email-input\": MultiEmailInput;\n }\n}\n","import { html, nothing, type PropertyDeclarations } from \"lit\";\n\nimport { fireNative } from \"../../core/events\";\nimport { icons } from \"../../core/icons\";\nimport { currentLocale, MessagesController, msg } from \"../../core/messages\";\nimport { define } from \"../../core/names\";\nimport { Badge } from \"../../primitives/badge/badge\";\nimport { button } from \"../../primitives/button/button\";\nimport { DropdownMenu } from \"../../primitives/dropdown-menu/dropdown-menu\";\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\n/**\n * # `<pont2-multi-select-filter>`: a \"filter by\" menu of checkboxes\n *\n * The account widgets' role filter (legacy `pont-multi-select-filter`), as\n * shadcn builds a faceted filter: an outline button with the filter's name\n * and a count badge, opening a Dropdown Menu of checkbox items, plus \"Clear\n * filters\" when something is chosen. It **is** the Dropdown Menu primitive's\n * root (`extends DropdownMenu`, a `display: contents` coordinator) and\n * renders its trigger and content, so keyboard, focus and dismissal are the\n * menu's. The menu stays open while you tick items.\n *\n * ```html\n * <pont2-multi-select-filter label=\"Roles\"></pont2-multi-select-filter>\n * <script>\n * el.options = [{ value: \"admin\", label: \"Admin\" }, { value: \"member\", label: \"Member\" }];\n * el.addEventListener(\"change\", () => reload({ roles: el.values }));\n * </script>\n * ```\n *\n * Default words are `msg()` codes: `filter` (the label), `clear_filters`. The\n * count is formatted for the page's language.\n *\n * @tag pont2-multi-select-filter\n * @attr label - the button's text and the menu's heading (default `msg(\"filter\")`)\n * @attr disabled - as the menu's\n * @fires change - the chosen values changed (read `values`)\n * @fires pont2-open-change - cancelable `{ open, reason }`\n */\nexport class MultiSelectFilter extends DropdownMenu {\n static override composite = true;\n\n static override properties: PropertyDeclarations = {\n options: { attribute: false },\n values: { attribute: false },\n label: { type: String },\n };\n declare options: FilterOption[];\n declare values: string[];\n declare label: string;\n\n protected readonly messages = new MessagesController(this);\n\n constructor() {\n super();\n this.options = [];\n this.values = [];\n this.label = \"\";\n }\n\n private toggleValue(value: string, on: boolean): void {\n const has = this.values.includes(value);\n if (on === has) return;\n // Keep the options' order, whatever order they were ticked in.\n const next = new Set(on ? [...this.values, value] : this.values.filter(v => v !== value));\n this.values = this.options.map(o => o.value).filter(v => next.has(v));\n fireNative(this, \"change\");\n }\n\n /** Untick everything, as the \"Clear filters\" item does. */\n clear(): void {\n if (!this.values.length) return;\n this.values = [];\n fireNative(this, \"change\");\n }\n\n override render() {\n const label = this.label || msg(\"filter\");\n const chosen = new Set(this.values ?? []);\n const count = chosen.size;\n return html`<pont2-prim-dropdown-menu-trigger>\n ${button(\n { variant: \"outline\", disabled: this.disabled, attrs: { \"data-pont2-multi-select-filter-trigger\": true } },\n html`${icons.listFilter({ \"data-icon\": \"inline-start\" })}${label}${count\n ? html`<span ${Badge.part({ \"data-variant\": \"secondary\" })} data-pont2-multi-select-filter-count\n >${new Intl.NumberFormat(currentLocale()).format(count)}</span\n >`\n : nothing}`,\n )}\n </pont2-prim-dropdown-menu-trigger>\n <pont2-prim-dropdown-menu-content align=\"start\">\n <pont2-prim-dropdown-menu-group>\n <pont2-prim-dropdown-menu-label>${label}</pont2-prim-dropdown-menu-label>\n ${(this.options ?? []).map(\n o => html`<pont2-prim-dropdown-menu-checkbox-item\n data-value=${o.value}\n .checked=${chosen.has(o.value)}\n @change=${(e: Event) => {\n e.stopPropagation(); // the filter reports one change for itself\n this.toggleValue(o.value, (e.currentTarget as HTMLElement & { checked: boolean }).checked);\n }}\n >${o.label}</pont2-prim-dropdown-menu-checkbox-item\n >`,\n )}\n </pont2-prim-dropdown-menu-group>\n ${count\n ? html`<pont2-prim-dropdown-menu-separator></pont2-prim-dropdown-menu-separator>\n <pont2-prim-dropdown-menu-item data-pont2-multi-select-filter-clear @click=${() => this.clear()}\n >${msg(\"clear_filters\")}</pont2-prim-dropdown-menu-item\n >`\n : nothing}\n </pont2-prim-dropdown-menu-content>`;\n }\n}\n\ndefine(\"pont2-multi-select-filter\", MultiSelectFilter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pont2-multi-select-filter\": MultiSelectFilter;\n }\n}\n"],"names":["KEY","attachContextRoot","root","_a","marked","ContextRoot","AttrsDirective","Directive","info","PartType","_attrs","noChange","part","map","applyAttrs","attrs","directive","el","previous","k","v","s","parseList","value","raw","parsed","item","PREFIX","PRIM","tag","name","primTag","identityAttr","identity","sel","tags","define","ctor","aliases","defineAlias","kitTag","base","alias","_HostElement","LitElement","extra","id","identitiesOf","changed","ReactiveElement","attr","on","HostElement","out","c","_ShellElement","options","ShellElement","_NativeEnhancer","child","NativeEnhancer","_FormControlElement","message","disabled","state","_state","own","FormControlElement","designModeContext","createContext","DesignModeController","host","ContextConsumer","counter","uid","scope","ensureId","toggleIdRef","ids","fireNative","target","type","fire","detail","cancelable","icon","body","html","icons","a","svg","KIT_MESSAGES_EN","current","currentLocaleTag","listeners","setMessages","messages","locale","listener","msg","code","fallback","currentLocale","onMessagesChanged","resetMessages","MessagesController","safeUrl","url","safeExternalUrl","directionOf","owner","defaultDisabled","RovingFocusController","e","i","items","orientation","rtl","horizontal","vertical","step","next","_b","active","enabled","stop","from","ok","n","loop","ActionController","action","data","response","open","result","error","CopyController","kind","duration","text","BADGE_VARIANTS","_Badge","Badge","BUTTON_VARIANTS","BUTTON_SIZES","applyButton","o","native","isSoftDisabled","button","content","variant","size","slot","soft","onClick","nothing","recipeProperties","_Pont2Button","control","Pont2Button","_ButtonBase","focusableWhenDisabled","href","rel","ButtonBase","_Checkbox","Checkbox","applyInput","input","live","_Pont2Input","Pont2Input","_Kbd","Kbd","_KbdGroup","KbdGroup","applyLabel","label","_Pont2Label","Pont2Label","_Separator","Separator","_Skeleton","Skeleton","_Spinner","Spinner","applyTextarea","textarea","_Pont2Textarea","Pont2Textarea","ALERT_VARIANTS","_Alert","Alert","_AlertTitle","AlertTitle","_AlertDescription","AlertDescription","_AlertAction","AlertAction","_Avatar","img","status","Avatar","_AvatarFallback","AvatarFallback","_AvatarBadge","AvatarBadge","_AvatarGroup","AvatarGroup","_AvatarGroupCount","AvatarGroupCount","_ButtonGroup","ButtonGroup","_ButtonGroupText","ButtonGroupText","_ButtonGroupSeparator","ButtonGroupSeparator","_Card","Card","_CardHeader","CardHeader","_CardTitle","CardTitle","_CardDescription","CardDescription","_CardAction","CardAction","_CardContent","CardContent","_CardFooter","CardFooter","_Empty","Empty","_EmptyHeader","EmptyHeader","_EmptyMedia","EmptyMedia","_EmptyTitle","EmptyTitle","_EmptyDescription","EmptyDescription","_EmptyContent","EmptyContent","applyFieldSet","fieldSet","fieldLegend","_FieldSetElement","FieldSetElement","_FieldGroup","FieldGroup","_Field","Field","_FieldContent","FieldContent","applyFieldLabel","fieldLabel","_FieldLabelElement","FieldLabelElement","_FieldTitle","FieldTitle","_FieldDescription","FieldDescription","_FieldSeparator","FieldSeparator","_FieldError","unique","FieldError","_InputGroup","InputGroup","_InputGroupAddon","InputGroupAddon","_InputGroupText","InputGroupText","CONTROL","markControl","inputGroupInput","inputGroupTextarea","inputGroupButton","_InputGroupInput","InputGroupInput","_InputGroupTextarea","InputGroupTextarea","InputGroupButton","_ItemGroup","ItemGroup","_ItemSeparator","ItemSeparator","_Item","Item","_ItemMedia","ItemMedia","_ItemContent","ItemContent","_ItemTitle","ItemTitle","_ItemDescription","ItemDescription","_ItemActions","ItemActions","_ItemHeader","ItemHeader","_ItemFooter","ItemFooter","_NativeSelect","select","applyNativeSelect","NativeSelect","nativeSelect","_Table","Table","PARTS","mark","applyTable","table","section","row","cell","_Pagination","Pagination","_PaginationContent","PaginationContent","_PaginationItem","PaginationItem","_PaginationLink","PaginationLink","_PaginationPrevious","PaginationPrevious","_PaginationNext","PaginationNext","_PaginationEllipsis","PaginationEllipsis","REGEXP_ONLY_DIGITS","REGEXP_ONLY_CHARS","REGEXP_ONLY_DIGITS_AND_CHARS","sanitizeOtp","maxLength","pattern","re","ch","otpSlots","focused","selStart","selEnd","chars","start","end","collapsed","_","char","isActive","ROOT","SLOT","FORWARDED","_InputOTP","m","r","f","states","invalid","order","clean","was","digits","InputOTP","_InputOTPGroup","InputOTPGroup","_InputOTPSlot","hasFakeCaret","InputOTPSlot","_InputOTPSeparator","InputOTPSeparator","_Progress","span","labels","l","parts","p","styleMap","Progress","ProgressPart","_formatted","_ProgressLabel","ProgressLabel","_ProgressValue","formatted","ProgressValue","_RadioGroup","checked","RadioGroup","_RadioGroupItem","RadioGroupItem","clamp","min","max","decimals","snap","snapped","d","fraction","valueAt","closestThumb","values","best","bestDist","setThumb","index","range","minSteps","gap","lo","hi","keyValue","key","opts","small","flip","parseValues","b","_Slider","onThumb","_c","arr","fd","final","rect","thumb","t","fr","thumbPos","rangeStyle","names","repeat","_v","Slider","_Switch","Switch","TRIGGER","PANEL","relate","internals","prop","targets","_Tabs","trigger","triggers","to","panels","ready","list","panel","Tabs","_TabsList","direction","TabsList","_TabsTrigger","TabsTrigger","_TabsContent","TabsContent","OPPOSITE","toPhysical","side","dir","toRequestedVocabulary","physical","requested","isVertical","spaceOn","anchor","viewport","offset","pad","computePosition","floating","align","sideOffset","alignOffset","collisionPadding","shift","need","here","there","x","y","startEdge","endEdge","sign","mainSpace","availableHeight","availableWidth","ax","ay","transformOrigin","round","alignItemWithAnchor","AnchoredPositioner","anchorEl","style","set","it","aligned","isItemDisabled","isItemVisible","moveIndex","move","isDisabled","keyToMove","Typeahead","timeout","repeated","search","stack","globalListeners","installGlobalListeners","top","path","popup","_PopupContent","reason","gen","anims","PopupContent","openPopups","ownQuery","selector","rootSelector","ownQueryAll","_PopupRoot","hadFocus","focusWasInside","PopupRoot","_PopupTrigger","_e","PopupTrigger","TABBABLE","EXEMPT","tabbables","initialFocusOf","inertCount","inertOthers","keep","touched","kept","visit","parent","locks","saved","lockScroll","scrollbar","released","traps","trapListener","trapFocus","container","onTrapKeyDown","onTrapFocusIn","trap","first","last","inside","FOCUSABLE","_Popover","Popover","_PopoverTrigger","PopoverTrigger","_PopoverContent","title","desc","PopoverContent","_PopoverHeader","PopoverHeader","_PopoverTitle","PopoverTitle","_PopoverDescription","PopoverDescription","ROOTS","CONTENT","ITEM","trueUnlessFalse","_DropdownMenu","focus","DropdownMenu","_DropdownMenuSub","DropdownMenuSub","_DropdownMenuTrigger","DropdownMenuTrigger","_DropdownMenuContent","DropdownMenuSubTrigger","closeKey","DropdownMenuSubContent","sub","except","DropdownMenuContent","_DropdownMenuSubContent","_MenuItemBase","MenuItemBase","_DropdownMenuItem","DropdownMenuItem","indicator","_DropdownMenuCheckboxItem","DropdownMenuCheckboxItem","_DropdownMenuRadioGroup","DropdownMenuRadioGroup","_DropdownMenuRadioItem","DropdownMenuRadioItem","_DropdownMenuSubTrigger","openKey","_DropdownMenuGroup","DropdownMenuGroup","_DropdownMenuLabel","DropdownMenuLabel","_DropdownMenuSeparator","DropdownMenuSeparator","_DropdownMenuShortcut","DropdownMenuShortcut","_Select","Select","_SelectTrigger","SelectTrigger","_SelectContent","SelectContent","_SelectItem","selected","SelectItem","_SelectGroup","SelectGroup","_SelectLabel","SelectLabel","_SelectSeparator","SelectSeparator","_Combobox","query","norm","has","scroll","q","visible","show","group","empty","Combobox","_ComboboxInput","hasValue","ComboboxInput","_ComboboxChips","chips","locked","ComboboxChips","_ComboboxContent","ComboboxContent","_ComboboxList","ComboboxList","_ComboboxItem","ComboboxItem","_ComboboxEmpty","ComboboxEmpty","_ComboboxGroup","ComboboxGroup","_ComboboxLabel","ComboboxLabel","_ComboboxSeparator","ComboboxSeparator","_Tooltip","ms","Tooltip","_TooltipTrigger","TooltipTrigger","_TooltipContent","TooltipContent","MODAL_ROOTS","_ModalRoot","undo","ModalRoot","ModalTrigger","_ModalContent","ModalContent","_ModalClose","ModalClose","_ModalTitle","ModalTitle","_Dialog","Dialog","_DialogTrigger","DialogTrigger","_DialogContent","DialogContent","_DialogHeader","DialogHeader","_DialogFooter","DialogFooter","_DialogTitle","DialogTitle","_DialogDescription","DialogDescription","_DialogClose","DialogClose","_AlertDialog","AlertDialog","_AlertDialogTrigger","AlertDialogTrigger","_AlertDialogContent","AlertDialogContent","_AlertDialogHeader","AlertDialogHeader","_AlertDialogFooter","AlertDialogFooter","_AlertDialogMedia","AlertDialogMedia","_AlertDialogTitle","AlertDialogTitle","_AlertDialogDescription","AlertDialogDescription","AlertDialogAction","AlertDialogCancel","_Sheet","Sheet","_SheetTrigger","SheetTrigger","_SheetContent","SheetContent","_SheetHeader","SheetHeader","_SheetFooter","SheetFooter","_SheetTitle","SheetTitle","_SheetDescription","SheetDescription","_SheetClose","SheetClose","DIRECTIONS","_Drawer","Drawer","_DrawerTrigger","DrawerTrigger","_DrawerContent","DrawerContent","_DrawerHeader","DrawerHeader","_DrawerFooter","DrawerFooter","_DrawerTitle","DrawerTitle","_DrawerDescription","DrawerDescription","_DrawerClose","DrawerClose","_HoverCard","HoverCard","_HoverCardTrigger","HoverCardTrigger","_HoverCardContent","HoverCardContent","ToastStore","snapshot","existing","before","toasts","toast","promise","POSITIONS","EXIT_MS","TYPE_ICON","_Toaster","li","pause","pos","timer","any","prev","added","close","ordered","Toaster","ALERT_STATUSES","STATUS_ICON","_KitAlert","KitAlert","initials","words","w","_KitAvatar","KitAvatar","groupSizes","length","g","left","otpGroups","groupSize","separator","slots","sep","_KitInputOTP","KitInputOTP","AUTH_PROVIDERS","PROVIDER_NAMES","MARKS","isAuthProvider","providerIcon","provider","AUTH_BUTTON_CONTENTS","AUTH_BUTTON_ICON_ALIGNS","_AuthButton","iconOnly","busy","showIcon","showLabel","AuthButton","_ProviderButton","ProviderButton","PasskeyButton","SubmitButton","form","isDefault","formData","cap","fieldMessages","FIELD_VALIDATION_MODES","compilePattern","source","positive","focusClaimed","_AuthField","maxlength","issues","describedBy","descId","errId","AuthField","EmailField","PhoneField","UsernameField","NameField","IDENTIFIER_KINDS","identifierLabel","kinds","_IdentifierField","IdentifierField","PASSWORD_RULE_PATTERNS","DEFAULT_PASSWORD_RULES","ruleRegExp","rulesConverter","SECRET_FIELD_VARIANTS","_SecretField","SecretField","_PasswordField","failing","PasswordField","_ConfirmField","pair","other","ConfirmField","OTP_LAYOUTS","_OtpField","otp","byLayout","OtpField","_OtpResend","OtpResend","LINK_ALIGNS","LINK_SERVICES","_Link","_changed","Link","ExternalLink","_Divider","Divider","_TextShell","TextShell","_Title","level","Title","Subtitle","providerColumns","count","providerEvent","listConverter","jsonArray","_ProviderField","overrides","opt","ProviderField","PONTIVE_MARK","PONTIVE_WORDMARK","pontiveLogo","WATERMARK_VARIANTS","WATERMARK_LOGO_ALIGNS","watermarkContent","logoAlign","_Watermark","Watermark","DEFAULT_BRANDING","brandingContext","BrandingController","_Block","Block","CONTAINER_TYPES","_Container","design","Container","HEADER_ALIGNS","_Header","Header","GAP_TYPES","_Gap","Gap","LOGO_ALIGNS","logoSource","theme","_Logo","light","PLACEHOLDER","dark","alt","Logo","safeRedirect","_Countdown","Countdown","_EditIdentifier","EditIdentifier","_Secret","copied","meta","Secret","QR_ERROR_CORRECTIONS","QUIET","qrPath","modules","QRCode","_QrCode","obscured","QrCode","codesConverter","_RecoveryCodes","codes","off","RecoveryCodes","normalizeScopes","scopes","seen","granted","required","isScopeChecked","unticked","scopeListValue","scopesConverter","_ScopeList","ticked","ScopeList","FLOW_MESSAGES_EN","FLOW_ENDED_STATUS","INSTANCE_UNAVAILABLE","isInstanceUnavailable","readError","rememberUnavailable","sentence","describeFlowError","kitMsg","serverSentence","nested","formDataToObject","BANNER","reported","warnedUnanswered","_Layout","ContextProvider","event","client","request","restartable","alert","banner","shell","hint","field","Layout","ConsentError","CONSENT_EXPIRED_EN","consentExpired","consentEndpoint","baseUrl","fetchConsent","call","isView","submitConsent","err","isObject","isNavigableRedirect","protocol","init","flat","envelope","_Consent","seq","view","expired","unavailable","outcome","retryable","layout","Consent","UNRESOLVED_AUTH","authStateContext","clientContext","loginHintContext","dispatchFlowState","escapeAttr","CONFIGURE_TIMEOUT","_FlowWidget","flowId","res","FlowWidget","SignIn","SignUp","Invitation","signin","password","verify","signup","PREVIEW_SCREENS","previewClient","spec","delay","_request","resolve","width","caption","VARIANTS","SIZES","description","inputs","fields","checkbox","alerts","badges","block","typography","PREVIEW_SPECIMENS","LEGACY_PROVIDER_TAG","warned","warnIfLegacyProvider","resetCoexistenceWarning","postAuthDestination","pathname","origin","env","sameOriginUrl","httpUrl","answersInvitation","loginHint","REDIRECT_ATTEMPT_KEY","REDIRECT_BOUNCE_WINDOW_MS","browserGuardEnv","storage","entry","recordRedirectAttempt","clearRedirectAttempt","wasBouncedBackFrom","attempt","decideRedirect","page","guard","answers","runtimeConfigUrl","authBaseUrl","loadBrandingEntitlements","fetchImpl","answer","read","brandingFrom","branding","forget","buildSdkConfig","app","given","pick","appFlow","appAuth","appRest","chain","then","arg","domain","pageOrigin","configured","baseOf","authority","loopback","scheme","widgetMessagesUrl","locales","loadWidgetMessages","refusal","resetWidgetMessages","CONFIG_INPUTS","onUnlessFalse","_Provider","sdk","still","config","asked","isAuthenticated","decision","link","Provider","_AuthGate","auth","pending","node","AuthGate","_SignedIn","SignedIn","_SignedOut","SignedOut","paginationRange","pageCount","siblings","boundaries","sib","bnd","clampPage","_KitPagination","format","pageButton","KitPagination","nextSort","compareValues","collator","num","na","nb","sortRows","rows","sort","sortValue","xe","ye","bodyState","loading","rowCount","_DataTable","column","sorted","ariaSort","columns","hasActions","actionsLabel","DataTable","_BadgeSelector","BadgeSelector","SEPARATORS","EMAIL","splitEmails","isEmail","addEmails","candidates","overflow","email","_MultiEmailInput","full","MultiEmailInput","_MultiSelectFilter","chosen","MultiSelectFilter"],"mappings":";;;;;;;AAqBA,MAAMA,KAAM,OAAO,IAAI,oBAAoB;AAEpC,SAASC,GAAkBC,KAA4B,CAAAC,WAAA,WAAW,aAAX,gBAAAA,EAAqB,oBAAuB;AACxG,MAAI,CAACD,EAAM;AACX,QAAME,IAASF;AACf,EAAIE,EAAOJ,EAAG,MACdI,EAAOJ,EAAG,IAAI,IACd,IAAIK,GAAA,EAAc,OAAOH,CAAmB;AAC9C;AAEAD,GAAA;AChBA,MAAMK,WAAuBC,GAAU;AAAA,EAGrC,YAAYC,GAAgB;AAE1B,QADA,MAAMA,CAAI,GAHZ,KAAQ,2BAAW,IAAA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