@digdir/designsystemet-web 1.13.1 → 1.13.3
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/README.md +12 -1
- package/dist/cjs/_vendors/invokers-polyfill/invoker.cjs +2 -0
- package/dist/cjs/_vendors/invokers-polyfill/invoker.cjs.map +1 -0
- package/dist/cjs/breadcrumbs/breadcrumbs.cjs +1 -1
- package/dist/cjs/breadcrumbs/breadcrumbs.cjs.map +1 -1
- package/dist/cjs/clickdelegatefor/clickdelegatefor.cjs +1 -1
- package/dist/cjs/clickdelegatefor/clickdelegatefor.cjs.map +1 -1
- package/dist/cjs/dialog/dialog.cjs +1 -1
- package/dist/cjs/dialog/dialog.cjs.map +1 -1
- package/dist/cjs/error-summary/error-summary.cjs +1 -1
- package/dist/cjs/error-summary/error-summary.cjs.map +1 -1
- package/dist/cjs/field/field.cjs +1 -1
- package/dist/cjs/field/field.cjs.map +1 -1
- package/dist/cjs/fieldset/fieldset.cjs +2 -0
- package/dist/cjs/fieldset/fieldset.cjs.map +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/pagination/pagination.cjs +1 -1
- package/dist/cjs/pagination/pagination.cjs.map +1 -1
- package/dist/cjs/popover/popover.cjs +1 -1
- package/dist/cjs/popover/popover.cjs.map +1 -1
- package/dist/cjs/readonly/readonly.cjs +1 -1
- package/dist/cjs/readonly/readonly.cjs.map +1 -1
- package/dist/cjs/suggestion/suggestion.cjs +1 -1
- package/dist/cjs/suggestion/suggestion.cjs.map +1 -1
- package/dist/cjs/toggle-group/toggle-group.cjs +1 -1
- package/dist/cjs/toggle-group/toggle-group.cjs.map +1 -1
- package/dist/cjs/tooltip/tooltip.cjs +1 -1
- package/dist/cjs/tooltip/tooltip.cjs.map +1 -1
- package/dist/cjs/utils/utils.cjs +1 -1
- package/dist/cjs/utils/utils.cjs.map +1 -1
- package/dist/custom-elements.json +18 -12
- package/dist/esm/_vendors/invokers-polyfill/invoker.js +2 -0
- package/dist/esm/_vendors/invokers-polyfill/invoker.js.map +1 -0
- package/dist/esm/breadcrumbs/breadcrumbs.js +1 -1
- package/dist/esm/breadcrumbs/breadcrumbs.js.map +1 -1
- package/dist/esm/clickdelegatefor/clickdelegatefor.js +1 -1
- package/dist/esm/clickdelegatefor/clickdelegatefor.js.map +1 -1
- package/dist/esm/dialog/dialog.js +1 -1
- package/dist/esm/dialog/dialog.js.map +1 -1
- package/dist/esm/error-summary/error-summary.js +1 -1
- package/dist/esm/error-summary/error-summary.js.map +1 -1
- package/dist/esm/field/field.js +1 -1
- package/dist/esm/field/field.js.map +1 -1
- package/dist/esm/fieldset/fieldset.js +2 -0
- package/dist/esm/fieldset/fieldset.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pagination/pagination.js +1 -1
- package/dist/esm/pagination/pagination.js.map +1 -1
- package/dist/esm/popover/popover.js +1 -1
- package/dist/esm/popover/popover.js.map +1 -1
- package/dist/esm/readonly/readonly.js +1 -1
- package/dist/esm/readonly/readonly.js.map +1 -1
- package/dist/esm/suggestion/suggestion.js +1 -1
- package/dist/esm/suggestion/suggestion.js.map +1 -1
- package/dist/esm/toggle-group/toggle-group.js +1 -1
- package/dist/esm/toggle-group/toggle-group.js.map +1 -1
- package/dist/esm/tooltip/tooltip.js +1 -1
- package/dist/esm/tooltip/tooltip.js.map +1 -1
- package/dist/esm/utils/utils.js +1 -1
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/index.d.ts +115 -93
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +948 -713
- package/dist/index.js.map +1 -0
- package/dist/umd/index.js +6 -4
- package/dist/umd/index.js.map +1 -1
- package/package.json +20 -16
- package/dist/web.manifest.json +0 -997
- package/dist/web.vscode.json +0 -60
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["handleAriaAttributes","ARIA_LABEL","handleAriaAttributes","ATTR_LABEL","render","render","render"],"sources":["../../../node_modules/.pnpm/invokers-polyfill@1.0.2_patch_hash=d5677be15320f04cdc552d82cb4a79242bd1cf8b26bcbb0a13e1153e7bed3b5a/node_modules/invokers-polyfill/invoker.js","../src/utils/utils.ts","../src/clickdelegatefor/clickdelegatefor.ts","../src/dialog/dialog.ts","../src/fieldset/fieldset.ts","../src/popover/popover.ts","../src/readonly/readonly.ts","../src/toggle-group/toggle-group.ts","../src/tooltip/tooltip.ts","../src/breadcrumbs/breadcrumbs.ts","../src/error-summary/error-summary.ts","../src/field/field.ts","../src/pagination/pagination.ts","../src/suggestion/suggestion.ts","../src/tabs/tabs.ts","../src/index.ts"],"sourcesContent":["export function isSupported() {\n return (\n typeof HTMLButtonElement !== \"undefined\" &&\n \"command\" in HTMLButtonElement.prototype &&\n \"source\" in ((globalThis.CommandEvent || {}).prototype || {})\n );\n}\n\nexport function isPolyfilled() {\n return !/native code/i.test((globalThis.CommandEvent || {}).toString());\n}\n\nexport function apply() {\n // XXX: Invoker Buttons used to dispatch 'invoke' events instead of\n // 'command' events. We should ensure to prevent 'invoke' events being\n // fired in those browsers.\n // XXX: https://bugs.chromium.org/p/chromium/issues/detail?id=1523183\n // Chrome will dispatch invoke events even with the flag disabled; so\n // we need to capture those to prevent duplicate events.\n document.addEventListener(\n \"invoke\",\n (e) => {\n if (e.type == \"invoke\" && e.isTrusted) {\n e.stopImmediatePropagation();\n e.preventDefault();\n }\n },\n true,\n );\n document.addEventListener(\n \"command\",\n (e) => {\n if (e.type == \"command\" && e.isTrusted) {\n e.stopImmediatePropagation();\n e.preventDefault();\n }\n },\n true,\n );\n\n function enumerate(obj, key, enumerable = true) {\n Object.defineProperty(obj, key, {\n ...Object.getOwnPropertyDescriptor(obj, key),\n enumerable,\n });\n }\n\n function getRootNode(node) {\n if (node && typeof node.getRootNode === \"function\") {\n return node.getRootNode();\n }\n if (node && node.parentNode) return getRootNode(node.parentNode);\n return node;\n }\n\n const commandEventSourceElements = new WeakMap();\n const commandEventActions = new WeakMap();\n\n class CommandEvent extends Event {\n constructor(type, invokeEventInit = {}) {\n super(type, invokeEventInit);\n const { source, command } = invokeEventInit;\n if (source != null && !(source instanceof Element)) {\n throw new TypeError(`source must be an element`);\n }\n commandEventSourceElements.set(this, source || null);\n commandEventActions.set(\n this,\n command !== undefined ? String(command) : \"\",\n );\n }\n\n get [Symbol.toStringTag]() {\n return \"CommandEvent\";\n }\n\n get source() {\n if (!commandEventSourceElements.has(this)) {\n throw new TypeError(\"illegal invocation\");\n }\n const source = commandEventSourceElements.get(this);\n if (!(source instanceof Element)) return null;\n const invokerRoot = getRootNode(source);\n if (invokerRoot !== getRootNode(this.target || document)) {\n return invokerRoot.host;\n }\n return source;\n }\n\n get command() {\n if (!commandEventActions.has(this)) {\n throw new TypeError(\"illegal invocation\");\n }\n return commandEventActions.get(this);\n }\n }\n enumerate(CommandEvent.prototype, \"source\");\n enumerate(CommandEvent.prototype, \"command\");\n\n const invokerAssociatedElements = new WeakMap();\n\n function applyInvokerMixin(ElementClass) {\n Object.defineProperties(ElementClass.prototype, {\n commandForElement: {\n enumerable: true,\n configurable: true,\n set(targetElement) {\n if (targetElement === null) {\n this.removeAttribute(\"commandfor\");\n invokerAssociatedElements.delete(this);\n } else if (!(targetElement instanceof Element)) {\n throw new TypeError(`commandForElement must be an element or null`);\n } else {\n this.setAttribute(\"commandfor\", \"\");\n const targetRootNode = getRootNode(targetElement);\n const thisRootNode = getRootNode(this);\n if (\n thisRootNode === targetRootNode ||\n targetRootNode === this.ownerDocument\n ) {\n invokerAssociatedElements.set(this, targetElement);\n } else {\n invokerAssociatedElements.delete(this);\n }\n }\n },\n get() {\n if (this.localName !== \"button\") {\n return null;\n }\n if (this.disabled) {\n return null;\n }\n if (this.form && this.getAttribute(\"type\") !== \"button\") {\n console.warn(\n \"Element with `commandFor` is a form participant. \" +\n \"It should explicitly set `type=button` in order for `commandFor` to work\",\n );\n return null;\n }\n const targetElement = invokerAssociatedElements.get(this);\n if (targetElement) {\n if (targetElement.isConnected) {\n return targetElement;\n } else {\n invokerAssociatedElements.delete(this);\n return null;\n }\n }\n const root = getRootNode(this);\n const idref = this.getAttribute(\"commandfor\");\n if (\n (root instanceof Document || root instanceof ShadowRoot) &&\n idref\n ) {\n return root.getElementById(idref) || null;\n }\n return null;\n },\n },\n command: {\n enumerable: true,\n configurable: true,\n get() {\n const value = this.getAttribute(\"command\") || \"\";\n if (value.startsWith(\"--\")) return value;\n const valueLower = value.toLowerCase();\n switch (valueLower) {\n case \"show-modal\":\n case \"request-close\":\n case \"close\":\n case \"toggle-popover\":\n case \"hide-popover\":\n case \"show-popover\":\n return valueLower;\n }\n return \"\";\n },\n set(value) {\n this.setAttribute(\"command\", value);\n },\n },\n });\n }\n\n const onHandlers = new WeakMap();\n Object.defineProperties(HTMLElement.prototype, {\n oncommand: {\n enumerable: true,\n configurable: true,\n get() {\n oncommandObserver.takeRecords();\n return onHandlers.get(this) || null;\n },\n set(handler) {\n const existing = onHandlers.get(this) || null;\n if (existing) {\n this.removeEventListener(\"command\", existing);\n }\n onHandlers.set(\n this,\n typeof handler === \"object\" || typeof handler === \"function\"\n ? handler\n : null,\n );\n if (typeof handler == \"function\") {\n this.addEventListener(\"command\", handler);\n }\n },\n },\n });\n function applyOnCommandHandler(els) {\n for (const el of els) {\n el.oncommand = new Function(\"event\", el.getAttribute(\"oncommand\"));\n }\n }\n const oncommandObserver = new MutationObserver((records) => {\n for (const record of records) {\n const { target } = record;\n if (record.type === \"childList\") {\n applyOnCommandHandler(target.querySelectorAll(\"[oncommand]\"));\n } else {\n applyOnCommandHandler([target]);\n }\n }\n });\n oncommandObserver.observe(document, {\n subtree: true,\n childList: true,\n attributeFilter: [\"oncommand\"],\n });\n applyOnCommandHandler(document.querySelectorAll(\"[oncommand]\"));\n\n const processedEvents = new WeakSet();\n\n function handleInvokerActivation(event) {\n if (processedEvents.has(event)) return;\n\n processedEvents.add(event);\n\n if (event.defaultPrevented) return;\n if (event.type !== \"click\") return;\n const source = event.composedPath().find((el) => el.matches?.(\"button[commandfor], button[command]\"));\n if (!source) return;\n\n if (source.form && source.getAttribute(\"type\") !== \"button\") {\n event.preventDefault();\n throw new Error(\n \"Element with `commandFor` is a form participant. \" +\n \"It should explicitly set `type=button` in order for `commandFor` to work. \" +\n \"In order for it to act as a Submit button, it must not have command or commandfor attributes\",\n );\n }\n\n if (source.hasAttribute(\"command\") !== source.hasAttribute(\"commandfor\")) {\n const attr = source.hasAttribute(\"command\") ? \"command\" : \"commandfor\";\n const missing = source.hasAttribute(\"command\") ? \"commandfor\" : \"command\";\n throw new Error(\n `Element with ${attr} attribute must also have a ${missing} attribute to function.`,\n );\n }\n\n if (\n source.command !== \"show-popover\" &&\n source.command !== \"hide-popover\" &&\n source.command !== \"toggle-popover\" &&\n source.command !== \"show-modal\" &&\n source.command !== \"request-close\" &&\n source.command !== \"close\" &&\n !source.command.startsWith(\"--\")\n ) {\n console.warn(\n `\"${source.command}\" is not a valid command value. Custom commands must begin with --`,\n );\n return;\n }\n\n const invokee = source.commandForElement;\n if (!invokee) return;\n const invokeEvent = new CommandEvent(\"command\", {\n command: source.command,\n source,\n cancelable: true,\n });\n invokee.dispatchEvent(invokeEvent);\n if (invokeEvent.defaultPrevented) return;\n\n const command = invokeEvent.command.toLowerCase();\n\n if (invokee.popover) {\n const canShow = !invokee.matches(\":popover-open\");\n const shouldShow =\n canShow && (command === \"toggle-popover\" || command === \"show-popover\");\n const shouldHide = !canShow && command === \"hide-popover\";\n\n if (shouldShow) {\n invokee.showPopover({ source });\n } else if (shouldHide) {\n invokee.hidePopover();\n }\n } else if (invokee.localName === \"dialog\") {\n const canShow = !invokee.hasAttribute(\"open\");\n\n if (canShow && command == \"show-modal\") {\n invokee.showModal();\n } else if (!canShow && command == \"close\") {\n invokee.close(source.value ? source.value : undefined);\n } else if (!canShow && command == \"request-close\") {\n // requestClose is only supported from Safari 18.4, so we polyfill it on older browsers\n if (!HTMLDialogElement.prototype.requestClose) {\n HTMLDialogElement.prototype.requestClose = function () {\n const cancelEvent = new Event(\"cancel\", { cancelable: true });\n this.dispatchEvent(cancelEvent);\n\n if (!cancelEvent.defaultPrevented) {\n this.close();\n }\n };\n }\n\n invokee.requestClose(source.value ? source.value : undefined);\n }\n }\n }\n\n function setupInvokeListeners(target) {\n target.addEventListener(\"click\", handleInvokerActivation, true);\n }\n\n function observeShadowRoots(ElementClass, callback) {\n const attachShadow = ElementClass.prototype.attachShadow;\n ElementClass.prototype.attachShadow = function (init) {\n const shadow = attachShadow.call(this, init);\n callback(shadow);\n return shadow;\n };\n const attachInternals = ElementClass.prototype.attachInternals;\n ElementClass.prototype.attachInternals = function () {\n const internals = attachInternals.call(this);\n if (internals.shadowRoot) callback(internals.shadowRoot);\n return internals;\n };\n }\n\n applyInvokerMixin(HTMLButtonElement);\n\n observeShadowRoots(HTMLElement, (shadow) => {\n setupInvokeListeners(shadow);\n oncommandObserver.observe(shadow, { attributeFilter: [\"oncommand\"] });\n applyOnCommandHandler(shadow.querySelectorAll(\"[oncommand]\"));\n });\n\n setupInvokeListeners(document);\n\n Object.assign(globalThis, { CommandEvent });\n}\n","export const QUICK_EVENT = { passive: true, capture: true };\n\n// Using function instead of constant to support evnironments where DOM can be unloaded (like Vitest with jsdom)\nexport const isBrowser = () =>\n typeof window !== 'undefined' && typeof document !== 'undefined';\n\nexport const isWindows = () =>\n isBrowser() &&\n // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474\n /^Win/i.test(navigator.userAgentData?.platform || navigator.platform);\n\n// Make sure we have a HTMLElement to extend (for server side rendering)\nexport const DSElement =\n typeof HTMLElement === 'undefined'\n ? (class {} as typeof HTMLElement)\n : HTMLElement;\n\nexport function debounce<T extends unknown[]>(\n callback: (...args: T) => void,\n delay: number,\n) {\n let timer: ReturnType<typeof setTimeout>;\n\n return function (this: unknown, ...args: T) {\n clearTimeout(timer);\n timer = setTimeout(() => callback.apply(this, args), delay);\n };\n}\n\n/**\n * warn\n * @description Utility to console.log, but can be silenced in production with window.dsWarnings = false;\n */\ndeclare global {\n interface Window {\n dsWarnings?: boolean;\n }\n}\nexport const warn = (\n message: string,\n ...args: Parameters<typeof console.log> // Using console.log, not console.warn, to prevent stopping test runners such as Jest\n) =>\n !isBrowser() ||\n window.dsWarnings === false ||\n console.log(`\\x1B[1mDesignsystemet:\\x1B[m ${message}`, ...args);\n\n/**\n * attr\n * @description Utility to quickly get, set and remove attributes\n * @param el The Element to read/write attributes from\n * @param name The attribute name to get, set or remove, or a object to set multiple attributes\n * @param value A valid attribute value or null to remove attribute\n */\nexport const attr = (\n el: Element,\n name: string,\n value?: string | null,\n): string | null => {\n if (value === undefined) return el.getAttribute(name) ?? null; // Fallback to null only if el is undefined\n if (value === null) el.removeAttribute(name);\n else if (el.getAttribute(name) !== value) el.setAttribute(name, value);\n return null;\n};\n\n/**\n * getCSSProp\n * @description Retrieves and CSS property value and trims it\n * @param el The Element to read attributes/CSS from\n * @param name Attribute or CSS property to get\n * @return string CSS property value\n */\nexport const getCSSProp = (el: Element, prop: string) =>\n getComputedStyle(el).getPropertyValue(prop).trim();\n\nconst STRIP_QUOTES = /^[\"']|[\"']$/g; // Matches surrounding single or double quotes\n/**\n * attrOrCSS\n * @description Retrieves and updates attribute based on attribute or CSS property value\n * @param el The Element to read attributes/CSS from\n * @param name Attribute or CSS property to get\n * @return string attribute or CSS property value\n */\nexport const attrOrCSS = (el: Element, name: string) => {\n let value = attr(el, name);\n if (!value)\n value = getCSSProp(el, `--_ds-${name}`).replace(STRIP_QUOTES, '').trim();\n if (!value) warn(`Missing ${name} on:`, el);\n return value || null;\n};\n\n/**\n * on\n * @param el The Element to use as EventTarget\n * @param types A space separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n el: Node | Window | ShadowRoot,\n ...rest: Parameters<typeof Element.prototype.addEventListener>\n): (() => void) => {\n const [types, ...options] = rest;\n for (const type of types.split(' ')) el.addEventListener(type, ...options);\n return () => off(el, ...rest);\n};\n\n/**\n * off\n * @param el The Element to use as EventTarget\n * @param types A space separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n el: Node | Window | ShadowRoot,\n ...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => {\n const [types, ...options] = rest;\n for (const type of types.split(' ')) el.removeEventListener(type, ...options);\n};\n\n// Used to store cleanup functions for hot-reloading\ndeclare global {\n interface Window {\n _dsHotReloadCleanup?: Map<string, Array<() => void>>;\n }\n}\n\n/**\n * onHotReload\n * @description Runs a callback when window is loaded in browser, and ensures cleanup when hot-reloading\n * @param key The key to identify setup and corresponding cleanup\n * @param callback The callback to run when the page is ready\n */\nexport const onHotReload = (key: string, setup: () => Array<() => void>) => {\n if (!isBrowser()) return; // Skip if not in modern browser environment, but on each call as Vitest might have unloaded jsdom between tests\n if (!window._dsHotReloadCleanup) window._dsHotReloadCleanup = new Map(); // Hot reload cleanup support supporting all build tools\n\n window._dsHotReloadCleanup?.get(key)?.map((cleanup) => cleanup()); // Run previous cleanup\n window._dsHotReloadCleanup?.set(key, setup()); // Store new cleanup\n};\n\n/**\n * MutationObserver wrapper with automatic cleanup\n * @return new MutaionObserver\n */\nexport const onMutation = <T extends Node>(\n el: T,\n callback: (el: T, records?: MutationRecord[]) => void,\n options: MutationObserverInit,\n) => {\n const cleanup = () => observer.disconnect();\n const observer = new MutationObserver((records) => {\n if (!isBrowser() || !el.isConnected) return cleanup(); // Stop observing if element is removed from DOM or document is removed by jdsom tests\n callback(el, records);\n });\n\n callback(el); // Initial is run instantly to make test markup predictable\n observer.observe(el, options);\n return cleanup;\n};\n\n/**\n * tag\n * @description creates element and assigns properties\n * @param tagName The tagname of element to create\n * @param attrs Optional attributes to add to the element\n * @param text Optional text content to add to the element\n * @return HTMLElement with props\n */\nexport const tag = <TagName extends keyof HTMLElementTagNameMap>(\n tagName: TagName,\n attrs?: Record<string, string | null> | null,\n): HTMLElementTagNameMap[TagName] => {\n const el = document.createElement(tagName);\n if (attrs) for (const [key, val] of Object.entries(attrs)) attr(el, key, val);\n return el;\n};\n\n/**\n * customElements.define\n * @description Defines a customElement if running in browser and if not already registered\n * Scoped/named \"customElements.define\" so @custom-elements-manifest/analyzer can find tag names\n */\nexport const customElements = {\n define: (name: string, instance: CustomElementConstructor) =>\n !isBrowser() ||\n window.customElements.get(name) ||\n window.customElements.define(name, instance),\n};\n\n/**\n * useId\n * @return A generated unique ID\n */\ndeclare global {\n interface Window {\n dsUseId?: number; // Use a global counter to ensure this works even when loading designsystemet multiple times\n }\n}\nlet id = 0;\nexport function useId(el?: Element | null) {\n if (!isBrowser()) return `:ds:${++id}`; // Emulate browser environment if window not available\n if (!window.dsUseId) window.dsUseId = 0; // Make sure we have a global to support multiple instances of designsystemet in same page\n if (el && !el.id) el.id = `:ds:${++window.dsUseId}`;\n return el?.id || '';\n}\n\n/**\n * @description Based off speak function from [U-elements](https://github.com/u-elements/u-elements/blob/main/packages/utils.ts#L210)\n * @param text The text to announce\n */\nlet LIVE_EL: HTMLElement | undefined;\nlet LIVE_FIX = 0;\nlet LIVE_CLEAR: ReturnType<typeof setTimeout> | number = 0;\nexport const announce = (text: string) => {\n clearTimeout(LIVE_CLEAR);\n if (LIVE_EL) LIVE_EL.textContent = `${text}${LIVE_FIX++ % 2 ? '\\u00A0' : ''}`; // Non-breaking space to ensure screen reader announces\n if (text) LIVE_CLEAR = setTimeout(announce, 2000, ''); // Clear prevent old announcements being found by screen readers, with 2 seconds brace period to avoid cutting of Android Talkback\n};\n\n// Mount live region on first focus so its ready to be used\nconst announceMount = () => {\n if (document.readyState !== 'complete') return; // Ensure page is loaded trying to avoid issues with React hydration\n if (!LIVE_EL) {\n LIVE_EL = tag('div', { 'aria-live': 'assertive' });\n LIVE_EL.style.overflow = 'hidden'; // Settings styles individually to prevent issues with CSP\n LIVE_EL.style.position = 'fixed';\n LIVE_EL.style.whiteSpace = 'nowrap';\n LIVE_EL.style.width = '1px';\n }\n if (!LIVE_EL.isConnected) document.body.appendChild(LIVE_EL);\n};\nonHotReload('announce', () => [\n on(document, 'focus mouseover', announceMount, QUICK_EVENT),\n]);\n","// Adding support for click deletagtion, following\n// https://open-ui.org/components/link-area-delegation-explainer/\n// and https://github.com/openui/open-ui/issues/1104#issuecomment-3151387080\nimport { on, onHotReload, QUICK_EVENT } from '../utils/utils';\n\nconst CLASS_HOVER = ':click-delegate-hover';\nconst ATTR_CLICKDELEGATEFOR = 'data-clickdelegatefor';\nconst SELECTOR_CLICKDELEGATEFOR = `[${ATTR_CLICKDELEGATEFOR}]`;\nconst SELECTOR_SKIP =\n 'a,button,label,input,select,textarea,details,dialog,[role=\"button\"],[popover],[contenteditable]';\n\nconst handleClickDelegateFor = (event: MouseEvent) => {\n const isNewTab = event.button === 1 || event.metaKey || event.ctrlKey; // Middle click or cmd/ctrl + click should open in new tab\n const delegateTarget = event.button < 2 && getDelegateTarget(event); // Only accept left or middle clicks\n\n if (!delegateTarget || delegateTarget.contains(event.target as Node)) return; // Only proxy event if delegated target isn't part of the original target\n if (isNewTab && delegateTarget instanceof HTMLAnchorElement)\n return window.open(delegateTarget.href, undefined, delegateTarget.rel); // If middle click or cmd/ctrl click on link, open in new tab\n event.stopImmediatePropagation(); // We'll trigger a new click event anyway, so prevent actions on this one\n delegateTarget.click(); // Forward click to the clickable element\n};\n\nlet HOVER: Element | undefined;\nconst handleMouseOver = (event: Event) => {\n const delegateTarget = getDelegateTarget(event);\n if (HOVER === delegateTarget) return; // No change\n if (HOVER) HOVER.classList.remove(CLASS_HOVER);\n if (delegateTarget) delegateTarget.classList.add(CLASS_HOVER);\n HOVER = delegateTarget;\n};\n\nconst getDelegateTarget = ({ target: el }: Event) => {\n const scope =\n el instanceof Element ? el.closest(SELECTOR_CLICKDELEGATEFOR) : null;\n const id = scope?.getAttribute(ATTR_CLICKDELEGATEFOR);\n const target = (id && document.getElementById(id)) || undefined;\n const skip = target && (el as Element).closest(SELECTOR_SKIP); // Ignore if interactive\n\n return (!skip || skip === target) && !(target as HTMLInputElement)?.disabled\n ? target\n : undefined; // Skip disabled inputs\n};\n\nonHotReload('clickdelegatefor', () => [\n on(window, 'click auxclick', handleClickDelegateFor as EventListener, true), // Use capture to ensure we run before other click listeners\n on(document, 'mouseover', handleMouseOver, QUICK_EVENT), // Use passive for better performance\n]);\n","import {\n attr,\n isBrowser,\n on,\n onHotReload,\n onMutation,\n QUICK_EVENT,\n} from '../utils/utils';\n\n// Polyfill closedby functionaliy in Safari\n// Also in Safari 26.2 where `closedBy` property is supported natively,\n// but no corresponding functionality/behavior is implemented.\nlet DOWN_INSIDE = false; // Prevent close if selecting text inside dialog\nconst handleClosedbyAny = ({\n type,\n target: el,\n clientX: x = 0,\n clientY: y = 0,\n}: Partial<MouseEvent>) => {\n if (type === 'pointerdown') {\n const r = (el as Element)?.closest?.('dialog')?.getBoundingClientRect();\n const isInside =\n r && r.top <= y && y <= r.bottom && r.left <= x && x <= r.right;\n\n DOWN_INSIDE = !!isInside;\n } else {\n const isDialog = el instanceof HTMLDialogElement;\n const isClose = isDialog && !DOWN_INSIDE && attr(el, 'closedby') === 'any';\n\n DOWN_INSIDE = false; // Reset on every pointerup\n if (isClose) requestAnimationFrame(() => el.open && el.close()); // Close if browser did not do it\n }\n};\n\n// Ensure buttons that trigger a modeal dialog has aria-haspopup=\"dialog\" for better screen reader experience\nconst BUTTONS = isBrowser() ? document.getElementsByTagName('button') : [];\nconst handleAriaAttributes = () => {\n for (const btn of BUTTONS)\n if (btn.getAttribute('command')?.endsWith('-modal'))\n btn.setAttribute('aria-haspopup', 'dialog'); // Using get/setAttribute for performance\n};\n\nconst handleCommand = ({ command, target }: Event & { command?: string }) =>\n command === '--show-non-modal' &&\n target instanceof HTMLDialogElement &&\n target.show();\n\nonHotReload('dialog', () => [\n on(document, 'command', handleCommand, QUICK_EVENT),\n on(document, 'pointerdown pointerup', handleClosedbyAny, QUICK_EVENT),\n onMutation(document, handleAriaAttributes, {\n attributeFilter: ['command'],\n attributes: true,\n childList: true,\n subtree: true,\n }),\n]);\n","import {\n attr,\n isBrowser,\n onHotReload,\n onMutation,\n useId,\n} from '../utils/utils';\n\nconst FIELDSETS = isBrowser() ? document.getElementsByTagName('fieldset') : [];\n\n// NOTE:\n// <fieldset> descriptions should be accessible to screen reader users. However, using aria-describedby\n// on <fieldset> causes all child <input> elements to inherit the same description, resulting in redundant and confusing announcements.\n// To avoid this, we use aria-labelledby to reference both the legend and the description.\n// aria-labelledby is only announced when screen readers enter the fieldset, not when navigating its child elements.\n// This means the accessible name of <fieldset> includes both the legend and description, which may differ from some test expectations,\n// but as of March 2026, this approach provides the best user experience across assistive technologies.\n// This approach is also verified by the chief of accessibility at NRK and the accessibility expert at NAV\nconst handleFieldsetMutations = () => {\n for (const el of FIELDSETS) {\n if (el.hasAttribute('aria-labelledby')) continue; // Speed up by skipping labelled fieldsets\n const labelledby = `${useId(el.querySelector('legend'))} ${useId(el.querySelector(':scope > :is([data-field=\"description\"],legend + p)'))}`;\n attr(el, 'aria-labelledby', labelledby.trim() || null);\n }\n};\n\nonHotReload('fieldset', () => [\n onMutation(document, handleFieldsetMutations, {\n childList: true,\n subtree: true,\n }),\n]);\n","import type { ComputePositionConfig, MiddlewareState } from '@floating-ui/dom';\nimport {\n autoUpdate,\n computePosition,\n flip,\n limitShift,\n offset,\n shift,\n size,\n} from '@floating-ui/dom';\nimport { attr, getCSSProp, on, onHotReload, QUICK_EVENT } from '../utils/utils';\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'ds-toggle-source': CustomEvent<Element>;\n }\n}\n\nconst ATTR_PLACE = 'data-placement';\nconst ATTR_AUTO = 'data-autoplacement';\nconst POPOVERS = new Map<HTMLElement, () => void>();\n\n// Sometimes use \"ds-toggle\" event while waiting for better support of\n// event.source (https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/source)\nfunction handleToggle(\n event: Partial<ToggleEvent> & {\n detail?: HTMLElement;\n source?: HTMLElement;\n },\n) {\n let { newState, oldState, target: el, source = event.detail } = event;\n const isPopover = el instanceof HTMLElement && attr(el, 'popover') !== null;\n const float = isPopover && getCSSProp(el, '--_ds-floating');\n\n if (!float) return;\n if (newState === 'closed') return POPOVERS.get(el)?.(); // Cleanup on close\n if (!source) {\n const root = el.getRootNode() as Document; // Support shadow DOM\n const css = `[popovertarget=\"${el.id}\"],[commandfor=\"${el.id}\"]`;\n source = (el.id && root?.querySelector?.<HTMLElement>(css)) || undefined; // Polyfill ToggleEvent .source for older browsers\n }\n if (!source || source === el || (oldState && oldState === newState)) return; // No need to update\n const padding = 10;\n const overscroll = getCSSProp(el, '--_ds-floating-overscroll');\n const placement = attr(el, ATTR_PLACE) || attr(source, ATTR_PLACE) || float;\n const auto = attr(el, ATTR_AUTO) || attr(source, ATTR_AUTO);\n const arrowSize = parseFloat(getComputedStyle(el, '::before').height) || 0;\n const shiftProp = placement.match(/left|right/gi) ? 'Height' : 'Width';\n const shiftLimit = source[`offset${shiftProp}`] / 2 + arrowSize;\n\n if (placement === 'none') return; // No need to position\n\n const options = {\n strategy: 'absolute',\n placement,\n middleware: [\n offset(arrowSize || 0), // Add space for arrow or default to 8px\n shift({\n padding,\n limiter: limitShift({ offset: { mainAxis: shiftLimit } }), // Prevent from shifing away from source\n }),\n arrowPseudo(),\n ...(auto !== 'false' ? [flip({ padding, crossAxis: false })] : []),\n ...(overscroll\n ? [\n size({\n apply({ availableHeight }) {\n if (overscroll === 'fit')\n el.style.width = `${source.clientWidth}px`;\n el.style.maxHeight = `${Math.max(50, availableHeight - padding * 2)}px`;\n },\n }),\n ]\n : []),\n ],\n } as ComputePositionConfig;\n const unfloat = autoUpdate(source, el, async () => {\n if (!source?.isConnected) return POPOVERS.get(el)?.(); // Cleanup if source element is removed\n const { x, y } = await computePosition(source, el, options);\n el.style.translate = `${x}px ${y}px`;\n });\n POPOVERS.set(el, () => POPOVERS.delete(el) && unfloat());\n}\n\n// Prevent closing when mouse interacts with scrollbar\nlet IS_SCROLL: boolean | undefined;\nconst handleScrollbar = ({ type }: Event) => {\n if (type === 'mousedown') IS_SCROLL = false;\n if (type === 'scroll' && IS_SCROLL === false) IS_SCROLL = true;\n if (type === 'mouseup' && IS_SCROLL)\n for (const [popover] of POPOVERS) popover.showPopover(); // Immediately show again to prevent flicker\n};\n\nonHotReload('popover', () => [\n on(document, 'mousedown scroll mouseup', handleScrollbar, true),\n on(document, 'toggle ds-toggle-source', handleToggle, QUICK_EVENT), // Use capture since the toggle event does not bubble\n]);\n\nconst arrowPseudo = () => ({\n name: 'arrowPseudo',\n fn(data: MiddlewareState) {\n const target = data.elements.floating;\n const source = data.rects.reference;\n const x = `${Math.round(source.width / 2 + source.x - data.x)}px`;\n const y = `${Math.round(source.height / 2 + source.y - data.y)}px`;\n\n target.style.setProperty('--_ds-floating-arrow-x', x);\n target.style.setProperty('--_ds-floating-arrow-y', y);\n attr(target, 'data-floating', data.placement);\n return data;\n },\n});\n","import { attr, on, onHotReload } from '../utils/utils';\n\nconst isReadOnly = (el: unknown): el is HTMLInputElement | HTMLSelectElement =>\n (el instanceof HTMLSelectElement || el instanceof HTMLInputElement) &&\n (el.hasAttribute('readonly') || attr(el, 'aria-readonly') === 'true');\n\n// Allow tabbing when readonly, and only fix readonly input/select elements (since type select and non-text-inputs do not support readonly)\n// If radio buttons, move focus without changing checked state\nconst handleKeyDown = (e: Event & Partial<KeyboardEvent>) => {\n if (e.key !== 'Tab' && isReadOnly(e.target)) {\n const isArrow = e.key?.startsWith('Arrow'); // Always control arrow keys\n const isModifier = e.altKey || e.ctrlKey || e.metaKey; // Allow modifier keys so native functions like CMD + D to bookmark etc. still works\n\n if (isArrow || !isModifier) e.preventDefault(); // Prevent changing <select> value with keyboard, but allow non-arrow modifier keys\n if (isArrow && attr(e.target, 'type') === 'radio') {\n const all = document.querySelectorAll(`input[name=\"${e.target.name}\"]`);\n const move = e.key?.match(/Arrow(Right|Down)/) ? 1 : -1;\n const next = all.length + [...all].indexOf(e.target) + move;\n (all[next % all.length] as HTMLElement)?.focus();\n }\n }\n};\n\nconst handleClick = (e: Event) => {\n const input = (e.target as Element)?.closest?.('label')?.control || e.target;\n if (isReadOnly(input)) {\n e.preventDefault();\n input.focus();\n }\n};\n\nconst handleMouseDown = (e: Event) => {\n if (e.target instanceof HTMLSelectElement && isReadOnly(e.target))\n e.preventDefault();\n};\n\nonHotReload('readonly', () => [\n on(document, 'keydown', handleKeyDown),\n on(document, 'click', handleClick), // click needed for <label> and <input>\n on(document, 'mousedown', handleMouseDown), // mousedown needed for <select>\n]);\n","import { attr, attrOrCSS, on, onHotReload, onMutation } from '../utils/utils';\n\nconst ARIA_LABELLEDBY = 'aria-labelledby';\nconst ARIA_LABEL = 'aria-label';\nconst ATTR_TOGGLEGROUP = 'data-toggle-group';\nconst SELECTOR_TOGGLEGROUP = `[${ATTR_TOGGLEGROUP}]`;\n\nconst handleAriaAttributes = () => {\n for (const group of document.querySelectorAll(SELECTOR_TOGGLEGROUP))\n attr(group, 'aria-label', attrOrCSS(group, ATTR_TOGGLEGROUP));\n};\n\nconst handleKeydown = (event: Partial<KeyboardEvent>) => {\n const { key, target: el } = event;\n const group =\n el instanceof HTMLInputElement && el.closest(SELECTOR_TOGGLEGROUP);\n\n if (!group) return;\n if (!attr(group, ARIA_LABEL) && !attr(group, ARIA_LABELLEDBY))\n attr(group, ARIA_LABEL, attrOrCSS(group, ATTR_TOGGLEGROUP));\n if (key === 'Enter') el.click(); // Forward Enter, but no need to listen for space key, as this is handled by the browser\n if (key?.startsWith('Arrow')) {\n event.preventDefault?.();\n const inputs = [...group.getElementsByTagName('input')];\n const index = inputs.indexOf(el);\n const move = key.match(/Arrow(Right|Down)/) ? 1 : -1;\n let nextIndex = index;\n\n for (let i = 0; i < inputs.length; i++) {\n nextIndex = (inputs.length + nextIndex + move) % inputs.length;\n if (!inputs[nextIndex]?.disabled) {\n inputs[nextIndex]?.focus();\n break;\n }\n }\n }\n};\n\nonHotReload('toggle-group', () => [\n on(document, 'keydown', handleKeydown),\n onMutation(document, handleAriaAttributes, {\n attributeFilter: [ATTR_TOGGLEGROUP],\n attributes: true,\n childList: true,\n subtree: true,\n }),\n]);\n","import {\n announce,\n attr,\n attrOrCSS,\n isBrowser,\n on,\n onHotReload,\n onMutation,\n QUICK_EVENT,\n tag,\n warn,\n} from '../utils/utils';\n\nlet TIP: HTMLElement | undefined;\nlet SOURCE: Element | undefined;\nlet IS_HOVERING = false;\nlet HOVER_TIMER: number | ReturnType<typeof setTimeout> = 0;\nlet SKIP_TIMER: number | ReturnType<typeof setTimeout> = 0;\nconst IS_IOS = isBrowser() && /iPad|iPhone|iPod/.test(navigator.userAgent); // Needed to omit DELAY_HOVER since iOS triggers mouseover before click\nconst ATTR_TOOLTIP = 'data-tooltip';\nconst ATTR_COLOR = 'data-color';\nconst ARIA_LABEL = 'aria-label';\nconst ARIA_DESC = 'aria-description';\nconst SELECTOR_COLOR = `[${ATTR_COLOR}]`;\nconst SELECTOR_TOOLTIP = `[${ATTR_TOOLTIP}]`;\nconst ATTR_SCHEME = 'data-color-scheme';\nconst SELECTOR_SCHEME = `[${ATTR_SCHEME}]`;\nconst SELECTOR_INTERACTIVE = 'a,button,input,label,select,textarea,[tabindex]';\nconst DELAY_HOVER = 300;\nconst DELAY_SKIP = 300;\n\n/**\n * setTooltipElement\n * @description Allows setting a custom tooltip element. It does not need to, and should not, be injected to document.body, as we inject on hover to ensure React hydration works as expected.\n * @param el The HTMLElement to use as tooltip\n */\nexport const setTooltipElement = (el?: HTMLElement | null) => {\n if (el && !(el instanceof HTMLElement))\n warn('setTooltipElement expects an HTMLElement, got: ', el);\n clearTimeout(SKIP_TIMER); // Reset when changing source\n clearTimeout(HOVER_TIMER);\n SOURCE = undefined;\n IS_HOVERING = false;\n TIP = el || undefined;\n};\n\nconst handleAriaAttributes = () => {\n for (const el of document.querySelectorAll(SELECTOR_TOOLTIP)) {\n const text = attrOrCSS(el, ATTR_TOOLTIP);\n\n if (!text) return; // Early return if no tooltip text\n if (text !== (el.getAttribute(ARIA_LABEL) || el.getAttribute(ARIA_DESC))) {\n const hasText = attr(el, 'role') !== 'img' && el.textContent?.trim(); // If role=\"img\", ignore text\n attr(el, ATTR_TOOLTIP, text); // Set data-tooltip attribute to speed up future mutations\n attr(el, ARIA_LABEL, hasText ? null : text); // Set aria-label if element does not have text\n attr(el, ARIA_DESC, hasText ? text : null); // Set aria-description if element has text\n if (!el.matches(SELECTOR_INTERACTIVE))\n warn('Missing tabindex=\"0\" attribute on: ', el);\n }\n\n // If an existing tooltip has changed programmatically, update tooltip text and announce change\n const isCurrent = el === SOURCE && TIP?.offsetHeight && TIP?.offsetWidth; // Using offsetHeight+Width to check visibility as :popover-open is not well supported by JSDOM\n const isChanged = isCurrent && text && TIP?.textContent !== text; // Only update if mutation is on source element and tooltip is open to avoid unnecessary updates\n if (isCurrent && isChanged) {\n if (TIP) TIP.textContent = text;\n if (document.activeElement === el) announce(text); // Only announce if focus is on the button\n }\n }\n};\n\nconst handleInterest = ({ type, target }: Event) => {\n clearTimeout(HOVER_TIMER);\n\n if (target === TIP) return; // Allow tooltip to be hovered, following https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus\n if (type === 'mouseover' && !IS_HOVERING && !IS_IOS) {\n HOVER_TIMER = setTimeout(handleInterest, DELAY_HOVER, { target }); // Delay mouse showing tooltip if not already shown\n return;\n }\n\n const source = (target as Element)?.closest?.(`[${ATTR_TOOLTIP}]`);\n if (source === SOURCE) return; // No need to update\n if (!source) return hideTooltip(); // If no new anchor, cleanup previous autoUpdate\n if (!TIP) TIP = tag('div', { class: 'ds-tooltip' });\n if (!TIP.isConnected) document.body.appendChild(TIP); // Ensure connected\n\n const color = source.closest(SELECTOR_COLOR); // Match source color of source element\n const scheme = source.closest(SELECTOR_SCHEME); // Match source color-scheme of source element\n const isReset = color !== scheme && color?.contains(scheme as Node); // If data-scheme is closer to target, it will reset data-color\n\n clearTimeout(SKIP_TIMER);\n attr(TIP, 'popover', 'manual'); // Ensure popover behavior\n attr(TIP, ATTR_SCHEME, scheme?.getAttribute(ATTR_SCHEME) || null); // Fallback to null to reset if not scheme found\n attr(TIP, ATTR_COLOR, (isReset && color?.getAttribute(ATTR_COLOR)) || null); // Fallback to null to reset if not scheme found\n TIP.textContent = attr(source, ATTR_TOOLTIP);\n TIP.showPopover();\n TIP.dispatchEvent(new CustomEvent('ds-toggle-source', { detail: source })); // Since showPopover({ source }) is not supported in all browsers yet\n IS_HOVERING = true;\n SOURCE = source;\n};\n\nconst hideTooltip = () => TIP?.isConnected && TIP.popover && TIP.hidePopover(); // Only hide if connected and activated\n\nconst handleClose = (event?: Partial<ToggleEvent & KeyboardEvent>) => {\n if (event?.type === 'keydown')\n return event?.key === 'Escape' && hideTooltip();\n if (!event) IS_HOVERING = false;\n else if (event.target === TIP && event.newState === 'closed') {\n SOURCE = undefined;\n SKIP_TIMER = setTimeout(handleClose, DELAY_SKIP);\n }\n};\n\nonHotReload('tooltip', () => [\n on(document, 'blur focus mouseover', handleInterest, QUICK_EVENT),\n on(document, 'toggle keydown', handleClose, QUICK_EVENT),\n onMutation(document, handleAriaAttributes, {\n attributeFilter: [ATTR_TOOLTIP],\n attributes: true,\n childList: true,\n subtree: true,\n }),\n]);\n","import {\n attr,\n attrOrCSS,\n customElements,\n DSElement,\n debounce,\n on,\n onMutation,\n} from '../utils/utils';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-breadcrumbs': DSBreadcrumbsElement;\n }\n}\n\nconst ATTR_LABEL = 'aria-label';\n\nexport class DSBreadcrumbsElement extends DSElement {\n _items?: HTMLCollectionOf<HTMLAnchorElement>; // Using underscore instead of private fields for backwards compatibility\n _label: string | null = null;\n _unresize?: () => void;\n _unmutate?: () => void;\n\n static get observedAttributes() {\n return [ATTR_LABEL]; // Using ES2015 syntax for backwards compatibility\n }\n connectedCallback() {\n const resize = debounce(() => render(this), 100);\n this._label = attrOrCSS(this, ATTR_LABEL); // Label can have been set by attributeChangedCallback before connectedCallback\n this._items = this.getElementsByTagName('a'); // Speed up by caching HTMLCollection\n this._unresize = on(window, 'resize', resize);\n this._unmutate = onMutation(this, render, {\n childList: true,\n subtree: true,\n });\n }\n attributeChangedCallback(_name: string, _prev?: string, next?: string) {\n if (!this._unmutate || !next) return; // Ensure we do not run unless connected and we have a label to set\n this._label = next; // Update cacheed label if aria-label attribute changes\n render(this);\n }\n disconnectedCallback() {\n this._unresize?.();\n this._unmutate?.();\n this._unresize = this._unmutate = this._items = undefined;\n }\n}\n\nconst render = (self: DSBreadcrumbsElement) => {\n const lastItem = self._items?.[self._items.length - 1];\n const lastItemInList = lastItem?.parentElement === self ? null : lastItem;\n const isListHidden = !lastItemInList?.offsetHeight;\n\n attr(self, 'role', isListHidden ? null : 'navigation');\n attr(self, ATTR_LABEL, isListHidden ? null : self._label); // Remove aria-label if list is hidden to prevent screen readers from announcing as breadcrumbs\n\n for (const item of self._items || [])\n attr(item, 'aria-current', item === lastItemInList ? 'page' : null);\n};\n\ncustomElements.define('ds-breadcrumbs', DSBreadcrumbsElement);\n","import {\n attr,\n customElements,\n DSElement,\n off,\n on,\n onMutation,\n QUICK_EVENT,\n useId,\n} from '../utils/utils';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-error-summary': DSErrorSummaryElement;\n }\n}\n\nexport class DSErrorSummaryElement extends DSElement {\n _unmutate?: () => void; // Using underscore instead of private fields for backwards compatibility\n\n connectedCallback() {\n on(this, 'animationend', this, QUICK_EVENT); // Using animationend to detect when element is visible\n attr(this, 'tabindex', '-1');\n this._unmutate = onMutation(this, render, {\n childList: true,\n subtree: true,\n });\n this.focus();\n }\n handleEvent({ target }: Event) {\n if (target === this) this.focus(); // Ignore if animation event was triggered by child\n }\n disconnectedCallback() {\n off(this, 'animationend', this, QUICK_EVENT);\n this._unmutate?.();\n this._unmutate = undefined;\n }\n}\n\nconst render = (self: DSErrorSummaryElement) => {\n const heading = self.querySelector('h2,h3,h4,h5,h6');\n if (heading) attr(self, 'aria-labelledby', useId(heading));\n};\n\ncustomElements.define('ds-error-summary', DSErrorSummaryElement);\n","import {\n announce,\n attr,\n attrOrCSS,\n customElements,\n DSElement,\n debounce,\n isWindows,\n on,\n onHotReload,\n onMutation,\n QUICK_EVENT,\n useId,\n warn,\n} from '../utils/utils';\n\n// TODO: Document that Validation must be hidden with \"hidden\" attribute (or completely removed from DOM), not display: none\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-field': DSFieldElement;\n }\n}\n\nconst ATTR_INVALID = 'aria-invalid';\nconst ATTR_DESCRIBEDBY = 'aria-describedby';\nconst ATTR_INDETERMINATE = 'data-indeterminate';\nconst COUNTER_DEBOUNCE = isWindows() ? 800 : 200; // Longer debounce on Windows due to NVDA performance\nconst COUNTS = new WeakMap<HTMLInputElement, Element>(); // Using WeakMap so removed inputs/counts does not cause memory leaks\nconst FIELDS = new Map<DSFieldElement, string[]>(); // Map of Field and its describedby IDs so we can identify the ones we add/remove\nconst VALIDATIONS = new WeakSet<HTMLInputElement>(); // Used to ensure we only take control of aria-invalid if the current is or has been a validation element\nconst WARNING_MULTIPLE_INPUTS = `Fields should only have one input element. Use <fieldset> to group multiple fields:`;\n\nconst handleFieldMutations = (_doc: Node, records: MutationRecord[] = []) => {\n for (const { target } of records) {\n const isFieldset = target instanceof HTMLFieldSetElement;\n for (const [field] of FIELDS)\n if (isFieldset ? target.contains(field) : field.contains(target))\n handleFieldMutation(field);\n }\n};\n\nconst handleFieldMutation = (field: DSFieldElement) => {\n const labels: HTMLLabelElement[] = [];\n const nextDescs: string[] = []; // Keep track of descriptions we are adding in this mutation\n const prevDescs = FIELDS.get(field) || []; // Retrieve previously managed IDs for this field\n let input: HTMLInputElement | undefined;\n let counter: Element | undefined;\n let hasValidation = false;\n let invalid = false;\n\n for (const el of field.getElementsByTagName('*')) {\n if (el instanceof HTMLLabelElement) labels.push(el);\n if ((el as HTMLElement).hidden) continue; // Skip hidden elements except labels\n if (isInputLike(el)) {\n if (input) warn(WARNING_MULTIPLE_INPUTS, field);\n else input = el; // Only register if visible input\n } else {\n const type = el.getAttribute('data-field'); // Using getAttribute instead of attr for best performance\n if (type === 'counter') counter = el;\n if (type === 'validation') {\n nextDescs.unshift(useId(el));\n hasValidation = true;\n invalid = invalid || isInvalid(el);\n } else if (type) nextDescs.push(useId(el)); // Adds both counter and descriptions\n }\n }\n\n if (!input) return; // Do not warn about missing input as virtual DOM libraries might give false positives\n if (counter) COUNTS.set(input, counter);\n for (const label of labels) attr(label, 'for', useId(input));\n\n const fieldsetValidation = field\n .closest('fieldset')\n ?.querySelector<HTMLElement>(':scope > [data-field=\"validation\"]');\n\n // Connect fieldset validation to inputs\n if (fieldsetValidation && !fieldsetValidation?.hidden) {\n hasValidation = true;\n invalid = invalid || isInvalid(fieldsetValidation);\n nextDescs.unshift(useId(fieldsetValidation));\n }\n\n // Add support for data-indeterminate attribute as this normally can only be set by javascript\n const indeterminate = attr(input, ATTR_INDETERMINATE);\n if (indeterminate) input.indeterminate = indeterminate === 'true';\n\n // Expand click area to ds-field if radio/checkbox\n const isBoolish = input.type === 'radio' || input.type === 'checkbox';\n if (isBoolish) attr(field, 'data-clickdelegatefor', useId(input));\n\n // Setup aria-describedby, but repsect existing ids in aria-describedby\n const describedby = attr(input, ATTR_DESCRIBEDBY)?.trim().split(/\\s+/);\n const keep = describedby?.filter((id) => !prevDescs.includes(id)) || []; // Find non-ds-field-managed aria-describedby IDs\n attr(input, ATTR_DESCRIBEDBY, [...nextDescs, ...keep].join(' ') || null);\n FIELDS.set(field, nextDescs);\n\n // Only manage aria-invalid when field has validation elements, and aria-invalid does not already exist\n const hadValidation = VALIDATIONS.has(input);\n if (hasValidation && !hadValidation && !input.hasAttribute(ATTR_INVALID)) {\n attr(input, ATTR_INVALID, 'true');\n VALIDATIONS.add(input);\n } else if (!hasValidation && hadValidation) {\n attr(input, ATTR_INVALID, null); // Remove aria-invalid\n VALIDATIONS.delete(input);\n }\n\n handleFieldInput(input); // Update counter and textarea sizing\n};\n\n// Used as fallback in tests when CSS is not loaded\nconst TEXTS = {\n over: '%d tegn for mye',\n under: '%d tegn igjen',\n};\n\nconst handleFieldInput = (e: Event | Element) => {\n const input = ((e as Event).target || e) as HTMLInputElement;\n const counter = COUNTS.get(input);\n\n if (counter?.isConnected) {\n const limit = Number(attr(counter, 'data-limit')) || 0;\n const count = limit - input.value.length;\n const state = count < 0 ? 'over' : 'under';\n const label = (\n attrOrCSS(counter, `data-${state}`) || TEXTS[state]\n )?.replace('%d', `${Math.abs(count)}`);\n\n attr(counter, 'data-label', label); // Using attribute to prevent hydation errors, not using aria-label to make axe tests happy\n attr(counter, 'data-state', state);\n attr(counter, 'data-color', count < 0 ? 'danger' : null);\n\n // Only update live region when user is actually typing\n if ((e as Event).type === 'input' && label)\n debouncedCounterLiveRegion(input, label); // Debounce live region to avoid NVDA interupting announcing typed text\n }\n if (input instanceof HTMLTextAreaElement) {\n input.style.setProperty('--_ds-field-sizing', 'auto');\n input.style.setProperty('--_ds-field-sizing', `${input.scrollHeight}px`);\n }\n};\n\nconst debouncedCounterLiveRegion = debounce((input: Element, text: string) => {\n if (document.activeElement === input) announce(text); // Only announce if input is still focused\n}, COUNTER_DEBOUNCE);\n\nconst isInvalid = (el: Element) => el.getAttribute('data-color') !== 'success';\nconst isInputLike = (el: unknown): el is HTMLInputElement =>\n el instanceof HTMLElement &&\n 'validity' in el && // Adds support for custom elements implemeted with attachInternals()\n !(el instanceof HTMLButtonElement) && // But skip <button> elements\n (el as HTMLInputElement).type !== 'hidden'; // And skip input type=\"hidden\"\n\n// Custom element is used to performantly keep track of fields on the page\nexport class DSFieldElement extends DSElement {\n connectedCallback() {\n FIELDS.set(this, []); // Register field\n handleFieldMutation(this); // Initial setup\n }\n disconnectedCallback() {\n FIELDS.delete(this);\n }\n}\n\ncustomElements.define('ds-field', DSFieldElement);\n\nonHotReload('field', () => [\n on(document, 'input', handleFieldInput, QUICK_EVENT),\n onMutation(document, handleFieldMutations, {\n attributeFilter: [\n 'data-field',\n 'data-limit',\n 'hidden', // Needed to check validation visibility\n 'id', // Needed to sync label \"for\" when ID of input/selec/textarea changes\n 'value', // Needed to detect changes in controlled React inputs as they do not trigger input events\n ATTR_INDETERMINATE,\n ],\n attributes: true,\n childList: true,\n subtree: true,\n }),\n]);\n","import {\n attr,\n attrOrCSS,\n customElements,\n DSElement,\n onMutation,\n warn,\n} from '../utils/utils';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-pagination': DSPaginationElement;\n }\n}\n\nconst ATTR_LABEL = 'aria-label';\nconst ATTR_CURRENT = 'data-current';\nconst ATTR_TOTAL = 'data-total';\nconst ATTR_HREF = 'data-href';\n\n// Expose pagination logic if wanting to do custom rendering (i.e. in React/Vue/etc)\nexport const pagination = ({ current = 1, total = 10, show = 7 }) => ({\n prev: current > 1 ? current - 1 : 0,\n next: current < total ? current + 1 : 0,\n pages: getSteps(current, total, show).map((page, index) => ({\n current: page === current && ('page' as const),\n key: `key-${page}-${index}`,\n page,\n })),\n});\n\nexport class DSPaginationElement extends DSElement {\n _unmutate?: () => void; // Using underscore instead of private fields for backwards compatibility\n _render?: () => void;\n\n static get observedAttributes() {\n return [ATTR_LABEL, ATTR_CURRENT, ATTR_TOTAL, ATTR_HREF]; // Using ES2015 syntax for backwards compatibility\n }\n connectedCallback() {\n // Check for required attributes\n const total = attr(this, ATTR_TOTAL);\n const current = attr(this, ATTR_CURRENT);\n if (current && !total) warn(`Missing ${ATTR_TOTAL} attribute on:`, this);\n if (total && !current) warn(`Missing ${ATTR_CURRENT} attribute on:`, this);\n\n attr(this, ATTR_LABEL, attrOrCSS(this, ATTR_LABEL));\n attr(this, 'role', 'navigation');\n this._unmutate = onMutation(this, render, {\n childList: true,\n subtree: true,\n });\n }\n attributeChangedCallback() {\n if (this._unmutate) render(this); // Ensure we do not run any renders before connectedCallback\n }\n disconnectedCallback() {\n this._unmutate?.();\n this._unmutate = this._render = undefined;\n }\n}\n\nconst render = (self: DSPaginationElement) => {\n const current = Number(attr(self, ATTR_CURRENT));\n const total = Number(attr(self, ATTR_TOTAL));\n\n // Allowing server side generated pagination, buy only doing client side updates if total/current attributes are provided\n if (current && total) {\n const items = self.querySelectorAll('button,a');\n const show = items.length - 2;\n const href = attr(self, ATTR_HREF);\n const { next, prev, pages } = pagination({ current, total, show });\n items.forEach((item, i) => {\n const page = i ? (items[i + 1] ? pages[i - 1]?.page : next) : prev; // First is prev, last is next\n attr(item, 'aria-current', pages[i - 1]?.current ? 'true' : null);\n attr(item, 'aria-label', `${page ?? 'hidden'}`); // Used for CSS content and to hide if more items than pages, using aria-label to make Axe tests and VoiceOver rotor happy\n attr(item, 'role', page ? null : 'none'); // Prevent validation errors for aria-hidden buttons\n attr(item, 'tabindex', page ? null : '-1');\n if (item instanceof HTMLButtonElement) attr(item, 'value', `${page}`);\n if (href && item instanceof HTMLAnchorElement)\n attr(item, 'href', href.replace('%d', `${page}`));\n });\n }\n};\n\nconst getSteps = (\n now: number,\n max: number,\n show = Number.POSITIVE_INFINITY,\n) => {\n const offset = (show - 1) / 2;\n const start = Math.max(Math.min(now - Math.floor(offset), max - show + 1), 1);\n const end = Math.min(Math.max(now + Math.ceil(offset), show), max);\n const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);\n\n if (show > 4 && start > 1) pages.splice(0, 2, 1, 0);\n if (show > 3 && end < max) pages.splice(-2, 2, 0, max);\n return pages;\n};\n\ncustomElements.define('ds-pagination', DSPaginationElement);\n","import { UHTMLComboboxElement } from '@u-elements/u-combobox';\nimport {\n attr,\n customElements,\n off,\n on,\n onMutation,\n QUICK_EVENT,\n useId,\n} from '../utils/utils';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-suggestion': DSSuggestionElement;\n }\n}\n\nexport class DSSuggestionElement extends UHTMLComboboxElement {\n _render?: () => void;\n _unmutate?: ReturnType<typeof onMutation>; // Using underscore instead of private fields for backwards compatibility\n\n connectedCallback() {\n super.connectedCallback();\n this._unmutate = onMutation(this, render, { childList: true }); // .control and .list are direct children of the custom element\n on(this, 'toggle', polyfillToggleSource, QUICK_EVENT);\n }\n disconnectedCallback() {\n super.disconnectedCallback();\n this._unmutate?.();\n this._unmutate = this._render = undefined;\n off(this, 'toggle', polyfillToggleSource, QUICK_EVENT);\n }\n}\n\n// A non-empty placeholder attribute is required to activate the :placeholder-shown pseudo selector used in our chevron styling\nconst render = ({ control, list }: DSSuggestionElement) => {\n if (control && !control.placeholder) attr(control, 'placeholder', ' '); // .control comes from UHTMLComboboxElement\n if (control) attr(control, 'popovertarget', useId(list) || null);\n if (list) attr(list, 'popover', 'manual'); // Ensure popover attribute is set on the list\n};\n\n// Since showPopover({ source }) is not supported in all browsers yet:\nconst polyfillToggleSource = (event: Partial<ToggleEvent>) => {\n const self = event.currentTarget as DSSuggestionElement;\n const detail = event.newState === 'open' && self.control; // .control comes from UHTMLComboboxElement\n\n if (detail)\n self.list?.dispatchEvent(new CustomEvent('ds-toggle-source', { detail }));\n};\n\ncustomElements.define('ds-suggestion', DSSuggestionElement);\n","import * as UTabs from '@u-elements/u-tabs';\nimport { customElements } from '../utils/utils';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-tabs': DSTabsElement;\n 'ds-tablist': DSTabListElement;\n 'ds-tab': DSTabElement;\n 'ds-tabpanel': DSTabPanelElement;\n }\n}\n\nexport class DSTabsElement extends UTabs.UHTMLTabsElement {}\nexport class DSTabListElement extends UTabs.UHTMLTabListElement {}\nexport class DSTabElement extends UTabs.UHTMLTabElement {}\nexport class DSTabPanelElement extends UTabs.UHTMLTabPanelElement {}\n\ncustomElements.define('ds-tabs', DSTabsElement);\ncustomElements.define('ds-tablist', DSTabListElement);\ncustomElements.define('ds-tab', DSTabElement);\ncustomElements.define('ds-tabpanel', DSTabPanelElement);\n","import { isSupported, apply as polyfillInvokers } from 'invokers-polyfill/fn';\nimport { isBrowser } from './utils/utils';\nimport '@u-elements/u-details/polyfill'; // Polyfill for <details> element for Android Firefox + Talkback\nimport './clickdelegatefor/clickdelegatefor';\nimport './dialog/dialog';\nimport './fieldset/fieldset';\nimport './popover/popover';\nimport './readonly/readonly';\nimport './toggle-group/toggle-group';\nimport './tooltip/tooltip';\n\nexport * from '@u-elements/u-datalist'; // Re-export u-datalist since this is a pure polyfill and not custom Designsystemet elements\nexport * from './breadcrumbs/breadcrumbs';\nexport * from './error-summary/error-summary';\nexport * from './field/field';\nexport * from './pagination/pagination';\nexport * from './suggestion/suggestion';\nexport * from './tabs/tabs';\nexport * from './tooltip/tooltip';\n\nif (isBrowser() && !isSupported()) polyfillInvokers(); // Ensure invoker commands polyfill is loaded in browser environment only\n"],"x_google_ignoreList":[0],"mappings":";;;;;;AAAA,SAAgB,cAAc;AAC5B,QACE,OAAO,sBAAsB,eAC7B,aAAa,kBAAkB,aAC/B,cAAc,WAAW,gBAAgB,EAAE,EAAE,aAAa,EAAE;;AAQhE,SAAgB,QAAQ;AAOtB,UAAS,iBACP,WACC,MAAM;AACL,MAAI,EAAE,QAAQ,YAAY,EAAE,WAAW;AACrC,KAAE,0BAA0B;AAC5B,KAAE,gBAAgB;;IAGtB,KACD;AACD,UAAS,iBACP,YACC,MAAM;AACL,MAAI,EAAE,QAAQ,aAAa,EAAE,WAAW;AACtC,KAAE,0BAA0B;AAC5B,KAAE,gBAAgB;;IAGtB,KACD;CAED,SAAS,UAAU,KAAK,KAAK,aAAa,MAAM;AAC9C,SAAO,eAAe,KAAK,KAAK;GAC9B,GAAG,OAAO,yBAAyB,KAAK,IAAI;GAC5C;GACD,CAAC;;CAGJ,SAAS,YAAY,MAAM;AACzB,MAAI,QAAQ,OAAO,KAAK,gBAAgB,WACtC,QAAO,KAAK,aAAa;AAE3B,MAAI,QAAQ,KAAK,WAAY,QAAO,YAAY,KAAK,WAAW;AAChE,SAAO;;CAGT,MAAM,6CAA6B,IAAI,SAAS;CAChD,MAAM,sCAAsB,IAAI,SAAS;CAEzC,MAAM,qBAAqB,MAAM;EAC/B,YAAY,MAAM,kBAAkB,EAAE,EAAE;AACtC,SAAM,MAAM,gBAAgB;GAC5B,MAAM,EAAE,QAAQ,YAAY;AAC5B,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AAe,OAAO,eAAe,kBAAkB;;;ACAvD,IAAI,WAAW,IAAI,CAAC,aAAa,CAAE,QAAkB"}
|
package/dist/umd/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Designsystemet={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(){return typeof HTMLButtonElement<`u`&&`command`in HTMLButtonElement.prototype&&`source`in((globalThis.CommandEvent||{}).prototype||{})}function n(){document.addEventListener(`invoke`,e=>{e.type==`invoke`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0),document.addEventListener(`command`,e=>{e.type==`command`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0);function e(e,t,n=!0){Object.defineProperty(e,t,{...Object.getOwnPropertyDescriptor(e,t),enumerable:n})}function t(e){return e&&typeof e.getRootNode==`function`?e.getRootNode():e&&e.parentNode?t(e.parentNode):e}let n=new WeakMap,r=new WeakMap;class i extends Event{constructor(e,t={}){super(e,t);let{source:i,command:a}=t;if(i!=null&&!(i instanceof Element))throw TypeError(`source must be an element`);n.set(this,i||null),r.set(this,a===void 0?``:String(a))}get[Symbol.toStringTag](){return`CommandEvent`}get source(){if(!n.has(this))throw TypeError(`illegal invocation`);let e=n.get(this);if(!(e instanceof Element))return null;let r=t(e);return r===t(this.target||document)?e:r.host}get command(){if(!r.has(this))throw TypeError(`illegal invocation`);return r.get(this)}get action(){throw Error(`CommandEvent#action was renamed to CommandEvent#command`)}get invoker(){throw Error(`CommandEvent#invoker was renamed to CommandEvent#source`)}}e(i.prototype,`source`),e(i.prototype,`command`);class a extends Event{constructor(e,t={}){throw super(e,t),Error("InvokeEvent has been deprecated, it has been renamed to `CommandEvent`")}}let o=new WeakMap;function s(e){Object.defineProperties(e.prototype,{commandForElement:{enumerable:!0,configurable:!0,set(e){if(this.hasAttribute(`invokeaction`))throw TypeError("Element has deprecated `invokeaction` attribute, replace with `command`");if(this.hasAttribute(`invoketarget`))throw TypeError("Element has deprecated `invoketarget` attribute, replace with `commandfor`");if(e===null)this.removeAttribute(`commandfor`),o.delete(this);else if(e instanceof Element){this.setAttribute(`commandfor`,``);let n=t(e);t(this)===n||n===this.ownerDocument?o.set(this,e):o.delete(this)}else throw TypeError(`commandForElement must be an element or null`)},get(){if(this.localName!==`button`)return null;if(this.hasAttribute(`invokeaction`)||this.hasAttribute(`invoketarget`))return console.warn("Element has deprecated `invoketarget` or `invokeaction` attribute, use `commandfor` and `command` instead"),null;if(this.disabled)return null;if(this.form&&this.getAttribute(`type`)!==`button`)return console.warn("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work"),null;let e=o.get(this);if(e)return e.isConnected?e:(o.delete(this),null);let n=t(this),r=this.getAttribute(`commandfor`);return(n instanceof Document||n instanceof ShadowRoot)&&r&&n.getElementById(r)||null}},command:{enumerable:!0,configurable:!0,get(){let e=this.getAttribute(`command`)||``;if(e.startsWith(`--`))return e;let t=e.toLowerCase();switch(t){case`show-modal`:case`request-close`:case`close`:case`toggle-popover`:case`hide-popover`:case`show-popover`:return t}return``},set(e){this.setAttribute(`command`,e)}},invokeAction:{enumerable:!1,configurable:!0,get(){throw Error(`invokeAction is deprecated. It has been renamed to command`)},set(e){throw Error(`invokeAction is deprecated. It has been renamed to command`)}},invokeTargetElement:{enumerable:!1,configurable:!0,get(){throw Error(`invokeTargetElement is deprecated. It has been renamed to command`)},set(e){throw Error(`invokeTargetElement is deprecated. It has been renamed to command`)}}})}let c=new WeakMap;Object.defineProperties(HTMLElement.prototype,{oncommand:{enumerable:!0,configurable:!0,get(){return u.takeRecords(),c.get(this)||null},set(e){let t=c.get(this)||null;t&&this.removeEventListener(`command`,t),c.set(this,typeof e==`object`||typeof e==`function`?e:null),typeof e==`function`&&this.addEventListener(`command`,e)}}});function l(e){for(let t of e)t.oncommand=Function(`event`,t.getAttribute(`oncommand`))}let u=new MutationObserver(e=>{for(let t of e){let{target:e}=t;t.type===`childList`?l(e.querySelectorAll(`[oncommand]`)):l([e])}});u.observe(document,{subtree:!0,childList:!0,attributeFilter:[`oncommand`]}),l(document.querySelectorAll(`[oncommand]`));let d=new WeakSet;function f(e){if(d.has(e)||(d.add(e),e.defaultPrevented)||e.type!==`click`)return;let t=e.target.closest(`button[invoketarget], button[invokeaction], input[invoketarget], input[invokeaction]`);if(t&&(console.warn("Elements with `invoketarget` or `invokeaction` are deprecated and should be renamed to use `commandfor` and `command` respectively"),t.matches(`input`)))throw Error("Input elements no longer support `commandfor`");let n=e.target.closest(`button[commandfor], button[command]`);if(!n)return;if(n.form&&n.getAttribute(`type`)!==`button`)throw e.preventDefault(),Error("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work. In order for it to act as a Submit button, it must not have command or commandfor attributes");if(n.hasAttribute(`command`)!==n.hasAttribute(`commandfor`)){let e=n.hasAttribute(`command`)?`command`:`commandfor`,t=n.hasAttribute(`command`)?`commandfor`:`command`;throw Error(`Element with ${e} attribute must also have a ${t} attribute to function.`)}if(n.command!==`show-popover`&&n.command!==`hide-popover`&&n.command!==`toggle-popover`&&n.command!==`show-modal`&&n.command!==`request-close`&&n.command!==`close`&&!n.command.startsWith(`--`)){console.warn(`"${n.command}" is not a valid command value. Custom commands must begin with --`);return}let r=n.commandForElement;if(!r)return;let a=new i(`command`,{command:n.command,source:n,cancelable:!0});if(r.dispatchEvent(a),a.defaultPrevented)return;let o=a.command.toLowerCase();if(r.popover){let e=!r.matches(`:popover-open`);e&&(o===`toggle-popover`||o===`show-popover`)?r.showPopover({source:n}):!e&&o===`hide-popover`&&r.hidePopover()}else if(r.localName===`dialog`){let e=!r.hasAttribute(`open`);e&&o==`show-modal`?r.showModal():!e&&o==`close`?r.close(n.value?n.value:void 0):!e&&o==`request-close`&&(HTMLDialogElement.prototype.requestClose||(HTMLDialogElement.prototype.requestClose=function(){let e=new Event(`cancel`,{cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||this.close()}),r.requestClose(n.value?n.value:void 0))}}function p(e){e.addEventListener(`click`,f,!0)}function m(e,t){let n=e.prototype.attachShadow;e.prototype.attachShadow=function(e){let r=n.call(this,e);return t(r),r};let r=e.prototype.attachInternals;e.prototype.attachInternals=function(){let e=r.call(this);return e.shadowRoot&&t(e.shadowRoot),e}}s(HTMLButtonElement),m(HTMLElement,e=>{p(e),u.observe(e,{attributeFilter:[`oncommand`]}),l(e.querySelectorAll(`[oncommand]`))}),p(document),Object.assign(globalThis,{CommandEvent:i,InvokeEvent:a})}let r={passive:!0,capture:!0},i=()=>typeof window<`u`&&typeof document<`u`,a=()=>i()&&/^Win/i.test(navigator.userAgentData?.platform||navigator.platform),o=typeof HTMLElement>`u`?class{}:HTMLElement;function s(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}let c=(e,...t)=>!i()||window.dsWarnings===!1||console.warn(`Designsystemet: ${e}`,...t),l=(e,t,n)=>n===void 0?e.getAttribute(t)??null:(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),u=/^["']|["']$/g,d=(e,t)=>{let n=l(e,t);return n||=getComputedStyle(e).getPropertyValue(`--_ds-${t}`).replace(u,``).trim()||null,n||c(`Missing ${t} on:`,e),n},f=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.addEventListener(t,...r);return()=>p(e,...t)},p=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.removeEventListener(t,...r)},m=(e,t)=>{i()&&(window._dsHotReloadCleanup||(window._dsHotReloadCleanup=new Map),window._dsHotReloadCleanup?.get(e)?.map(e=>e()),window._dsHotReloadCleanup?.set(e,t()))},h=!1,g=(e,t,n)=>{let r=0,i=()=>{if(!e.isConnected)return a();t(o),o.takeRecords(),r=0},a=()=>o?.disconnect?.(),o=new MutationObserver(()=>{!h&&!r&&(r=requestAnimationFrame(i))});return o.observe(e,n),requestAnimationFrame(i),a},_=(e,t)=>{h=!0,e.textContent=t,requestAnimationFrame(v)},v=()=>{h=!1},y=(e,t)=>{let n=document.createElement(e);if(t)for(let[e,r]of Object.entries(t))l(n,e,r);return n},b={define:(e,t)=>!i()||window.customElements.get(e)||window.customElements.define(e,t)},x=0;function S(e){return i()?(window.dsUseId||(window.dsUseId=0),e&&!e.id&&(e.id=`:ds:${++window.dsUseId}`),e?.id||``):`:ds:${++x}`}let C,w=0,T=0,ee=e=>{clearTimeout(T),C&&_(C,`${e}${w++%2?`\xA0`:``}`),e&&(T=setTimeout(ee,2e3,``))},te=()=>{document.readyState===`complete`&&(C||(C=y(`div`,{"aria-live":`assertive`}),C.style.overflow=`hidden`,C.style.position=`fixed`,C.style.whiteSpace=`nowrap`,C.style.width=`1px`),C.isConnected||document.body.appendChild(C))};m(`announce`,()=>[f(document,`focus mouseover`,te,r)]);var ne=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,re=ne&&/android/i.test(navigator.userAgent),ie=ne&&/firefox/i.test(navigator.userAgent);ne&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);function ae(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var oe=`__uDetailsPolyfillSummarys`;if(ne&&re&&ie&&!window[oe]){window[oe]=document.getElementsByTagName(`summary`);let e=()=>{if(window[oe])for(let e of window[oe]){let t=e.parentElement;ae(e,`role`,`button`),ae(e,`aria-expanded`,`${!!t&&!!t.open}`)}};requestAnimationFrame(e),new MutationObserver(e).observe(document,{attributeFilter:[`open`],attributes:!0,childList:!0,subtree:!0})}let se=`:click-delegate-hover`,ce=`data-clickdelegatefor`,le=`[${ce}]`,ue=e=>{let t=e.button===1||e.metaKey||e.ctrlKey,n=e.isTrusted&&e.button<2&&pe(e);if(!(!n||n.contains(e.target))){if(t&&n instanceof HTMLAnchorElement)return window.open(n.href,void 0,n.rel);e.stopImmediatePropagation(),n.click()}},de,fe=e=>{let t=pe(e);de!==t&&(de&&de.classList.remove(se),t&&t.classList.add(se),de=t)},pe=({target:e})=>{let t=(e instanceof Element?e.closest(le):null)?.getAttribute(ce),n=t&&document.getElementById(t)||void 0,r=n&&e.closest(`a,button,label,input,select,textarea,details,dialog,[role="button"],[popover],[contenteditable]`);return(!r||r===n)&&!n?.disabled?n:void 0};m(`clickdelegatefor`,()=>[f(window,`click auxclick`,ue,!0),f(document,`mouseover`,fe,r)]);let me=!1,he=({type:e,target:t,clientX:n=0,clientY:r=0})=>{if(e===`pointerdown`){let e=t?.closest?.(`dialog`)?.getBoundingClientRect();me=!!(e&&e.top<=r&&r<=e.bottom&&e.left<=n&&n<=e.right)}else{let e=t instanceof HTMLDialogElement&&!me&&l(t,`closedby`)===`any`;me=!1,e&&requestAnimationFrame(()=>t.open&&t.close())}},ge=()=>{for(let e of document.querySelectorAll(`button[command="show-modal"]`))l(e,`aria-haspopup`,`dialog`)},_e=({command:e,target:t})=>e===`--show-non-modal`&&t instanceof HTMLDialogElement&&t.show();m(`dialog`,()=>[f(document,`command`,_e,r),f(document,`pointerdown pointerup`,he,r),g(document,ge,{attributeFilter:[`command`],attributes:!0,childList:!0,subtree:!0})]);let E=Math.min,D=Math.max,ve=Math.round,ye=Math.floor,O=e=>({x:e,y:e}),be={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function xe(e,t,n){return D(e,E(t,n))}function k(e,t){return typeof e==`function`?e(t):e}function A(e){return e.split(`-`)[0]}function Se(e){return e.split(`-`)[1]}function Ce(e){return e===`x`?`y`:`x`}function we(e){return e===`y`?`height`:`width`}function j(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Te(e){return Ce(j(e))}function Ee(e,t,n){n===void 0&&(n=!1);let r=Se(e),i=Te(e),a=we(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Fe(o)),[o,Fe(o)]}function De(e){let t=Fe(e);return[Oe(e),t,Oe(t)]}function Oe(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}let ke=[`left`,`right`],Ae=[`right`,`left`],je=[`top`,`bottom`],Me=[`bottom`,`top`];function Ne(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ae:ke:t?ke:Ae;case`left`:case`right`:return t?je:Me;default:return[]}}function Pe(e,t,n,r){let i=Se(e),a=Ne(A(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Oe)))),a}function Fe(e){let t=A(e);return be[t]+e.slice(t.length)}function Ie(e){return{top:0,right:0,bottom:0,left:0,...e}}function Le(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ie(e)}function Re(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ze(e,t,n){let{reference:r,floating:i}=e,a=j(t),o=Te(t),s=we(o),c=A(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Se(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Be(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=k(t,e),p=Le(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Re(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Re(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}let Ve=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Be},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ze(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<50&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ze(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},He=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=k(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=A(r),_=j(o),v=A(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Fe(o)]:De(o)),x=p!==`none`;!d&&x&&b.push(...Pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ee(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==j(t))||T.every(e=>j(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=j(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}},Ue=new Set([`left`,`top`]);async function We(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=A(n),s=Se(n),c=j(n)===`y`,l=Ue.has(o)?-1:1,u=a&&c?-1:1,d=k(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}let Ge=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await We(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ke=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=k(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=j(A(i)),p=Ce(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=xe(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=xe(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},qe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=k(e,t),u={x:n,y:r},d=j(i),f=Ce(d),p=u[f],m=u[d],h=k(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ue.has(A(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Je=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=k(e,t),u=await o.detectOverflow(t,l),d=A(i),f=Se(i),p=j(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=E(h-u[g],v),x=E(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=D(u.left,0),t=D(u.right,0),n=D(u.top,0),r=D(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:D(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:D(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Ye(){return typeof window<`u`}function M(e){return Xe(e)?(e.nodeName||``).toLowerCase():`#document`}function N(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function P(e){return((Xe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Xe(e){return Ye()?e instanceof Node||e instanceof N(e).Node:!1}function F(e){return Ye()?e instanceof Element||e instanceof N(e).Element:!1}function I(e){return Ye()?e instanceof HTMLElement||e instanceof N(e).HTMLElement:!1}function Ze(e){return!Ye()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof N(e).ShadowRoot}function Qe(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function $e(e){return/^(table|td|th)$/.test(M(e))}function et(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}let tt=/transform|translate|scale|rotate|perspective|filter/,nt=/paint|layout|strict|content/,L=e=>!!e&&e!==`none`,rt;function it(e){let t=F(e)?z(e):e;return L(t.transform)||L(t.translate)||L(t.scale)||L(t.rotate)||L(t.perspective)||!ot()&&(L(t.backdropFilter)||L(t.filter))||tt.test(t.willChange||``)||nt.test(t.contain||``)}function at(e){let t=B(e);for(;I(t)&&!R(t);){if(it(t))return t;if(et(t))return null;t=B(t)}return null}function ot(){return rt??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),rt}function R(e){return/^(html|body|#document)$/.test(M(e))}function z(e){return N(e).getComputedStyle(e)}function st(e){return F(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function B(e){if(M(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ze(e)&&e.host||P(e);return Ze(t)?t.host:t}function ct(e){let t=B(e);return R(t)?e.ownerDocument?e.ownerDocument.body:e.body:I(t)&&Qe(t)?t:ct(t)}function lt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ct(e),i=r===e.ownerDocument?.body,a=N(r);if(i){let e=ut(a);return t.concat(a,a.visualViewport||[],Qe(r)?r:[],e&&n?lt(e):[])}else return t.concat(r,lt(r,[],n))}function ut(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dt(e){let t=z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=I(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ve(n)!==a||ve(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ft(e){return F(e)?e:e.contextElement}function V(e){let t=ft(e);if(!I(t))return O(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dt(t),o=(a?ve(n.width):n.width)/r,s=(a?ve(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let pt=O(0);function mt(e){let t=N(e);return!ot()||!t.visualViewport?pt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ht(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==N(e)?!1:t}function H(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ft(e),o=O(1);t&&(r?F(r)&&(o=V(r)):o=V(e));let s=ht(a,n,r)?mt(a):O(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=N(a),t=r&&F(r)?N(r):r,n=e,i=ut(n);for(;i&&r&&t!==n;){let e=V(i),t=i.getBoundingClientRect(),r=z(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=N(i),i=ut(n)}}return Re({width:u,height:d,x:c,y:l})}function gt(e,t){let n=st(e).scrollLeft;return t?t.left+n:H(P(e)).left+n}function _t(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-gt(e,n),y:n.top+t.scrollTop}}function vt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=P(r),s=t?et(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=O(1),u=O(0),d=I(r);if((d||!d&&!a)&&((M(r)!==`body`||Qe(o))&&(c=st(r)),d)){let e=H(r);l=V(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?_t(o,c):O(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function yt(e){return Array.from(e.getClientRects())}function bt(e){let t=P(e),n=st(e),r=e.ownerDocument.body,i=D(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=D(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+gt(e),s=-n.scrollTop;return z(r).direction===`rtl`&&(o+=D(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function xt(e,t){let n=N(e),r=P(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ot();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=gt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}function St(e,t){let n=H(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=I(e)?V(e):O(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ct(e,t,n){let r;if(t===`viewport`)r=xt(e,n);else if(t===`document`)r=bt(P(e));else if(F(t))r=St(t,n);else{let n=mt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Re(r)}function wt(e,t){let n=B(e);return n===t||!F(n)||R(n)?!1:z(n).position===`fixed`||wt(n,t)}function Tt(e,t){let n=t.get(e);if(n)return n;let r=lt(e,[],!1).filter(e=>F(e)&&M(e)!==`body`),i=null,a=z(e).position===`fixed`,o=a?B(e):e;for(;F(o)&&!R(o);){let t=z(o),n=it(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Qe(o)&&!n&&wt(e,o))?r=r.filter(e=>e!==o):i=t,o=B(o)}return t.set(e,r),r}function Et(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?et(t)?[]:Tt(t,this._c):[].concat(n),r],o=Ct(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ct(t,a[e],i);s=D(n.top,s),c=E(n.right,c),l=E(n.bottom,l),u=D(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Dt(e){let{width:t,height:n}=dt(e);return{width:t,height:n}}function Ot(e,t,n){let r=I(t),i=P(t),a=n===`fixed`,o=H(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=O(0);function l(){c.x=gt(i)}if(r||!r&&!a)if((M(t)!==`body`||Qe(i))&&(s=st(t)),r){let e=H(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?_t(i,s):O(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function kt(e){return z(e).position===`static`}function At(e,t){if(!I(e)||z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function jt(e,t){let n=N(e);if(et(e))return n;if(!I(e)){let t=B(e);for(;t&&!R(t);){if(F(t)&&!kt(t))return t;t=B(t)}return n}let r=At(e,t);for(;r&&$e(r)&&kt(r);)r=At(r,t);return r&&R(r)&&kt(r)&&!it(r)?n:r||at(e)||n}let Mt=async function(e){let t=this.getOffsetParent||jt,n=this.getDimensions,r=await n(e.floating);return{reference:Ot(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Nt(e){return z(e).direction===`rtl`}let Pt={convertOffsetParentRelativeRectToViewportRelativeRect:vt,getDocumentElement:P,getClippingRect:Et,getOffsetParent:jt,getElementRects:Mt,getClientRects:yt,getDimensions:Dt,getScale:V,isElement:F,isRTL:Nt};function Ft(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function It(e,t){let n=null,r,i=P(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=ye(d),h=ye(i.clientWidth-(u+f)),g=ye(i.clientHeight-(d+p)),_=ye(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:D(0,E(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Ft(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Lt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ft(e),u=i||a?[...l?lt(l):[],...t?lt(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?It(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?H(e):null;c&&g();function g(){let t=H(e);h&&!Ft(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Rt=Ge,zt=Ke,Bt=He,Vt=Je,Ht=qe,Ut=(e,t,n)=>{let r=new Map,i={platform:Pt,...n},a={...i.platform,_c:r};return Ve(e,t,{...i,platform:a})},Wt=`data-placement`,Gt=`data-autoplacement`,Kt=new Map;function qt(e){let{newState:t,oldState:n,target:r,source:i=e.detail}=e,a=r instanceof HTMLElement&&l(r,`popover`)!==null&&Xt(r,`--_ds-floating`);if(!a)return;if(t===`closed`)return Kt.get(r)?.();if(!i){let e=r.getRootNode(),t=`[popovertarget="${r.id}"],[commandfor="${r.id}"]`;i=r.id&&e?.querySelector?.(t)||void 0}if(!i||i===r||n&&n===t)return;let o=Xt(r,`--_ds-floating-overscroll`),s=l(r,Wt)||l(i,Wt)||a,c=l(r,Gt)||l(i,Gt),u=parseFloat(getComputedStyle(r,`::before`).height)||0,d=s.match(/left|right/gi)?`Height`:`Width`,f=i[`offset${d}`]/2+u;if(s===`none`)return;let p={strategy:`absolute`,placement:s,middleware:[Rt(u||0),zt({padding:10,limiter:Ht({offset:{mainAxis:f}})}),Zt(),...c===`false`?[]:[Bt({padding:10,crossAxis:!1})],...o?[Vt({apply({availableHeight:e}){o===`fit`&&(r.style.width=`${i.clientWidth}px`),r.style.maxHeight=`${Math.max(50,e-20)}px`}})]:[]]},m=Lt(i,r,async()=>{if(!i?.isConnected)return Kt.get(r)?.();let{x:e,y:t}=await Ut(i,r,p);r.style.translate=`${e}px ${t}px`});Kt.set(r,()=>Kt.delete(r)&&m())}let Jt,Yt=({type:e})=>{if(e===`mousedown`&&(Jt=!1),e===`scroll`&&Jt===!1&&(Jt=!0),e===`mouseup`&&Jt)for(let[e]of Kt)e.showPopover()};m(`popover`,()=>[f(document,`mousedown scroll mouseup`,Yt,!0),f(document,`toggle ds-toggle-source`,qt,r)]);let Xt=(e,t)=>getComputedStyle(e).getPropertyValue(t).trim(),Zt=()=>({name:`arrowPseudo`,fn(e){let t=e.elements.floating,n=e.rects.reference,r=`${Math.round(n.width/2+n.x-e.x)}px`,i=`${Math.round(n.height/2+n.y-e.y)}px`;return t.style.setProperty(`--_ds-floating-arrow-x`,r),t.style.setProperty(`--_ds-floating-arrow-y`,i),l(t,`data-floating`,e.placement),e}}),Qt=e=>(e instanceof HTMLSelectElement||e instanceof HTMLInputElement)&&(e.hasAttribute(`readonly`)||l(e,`aria-readonly`)===`true`),$t=e=>{if(e.key!==`Tab`&&Qt(e.target)&&(e.preventDefault(),e.key?.startsWith(`Arrow`)&&l(e.target,`type`)===`radio`)){let t=document.querySelectorAll(`input[name="${e.target.name}"]`),n=e.key?.match(/Arrow(Right|Down)/)?1:-1;t[(t.length+[...t].indexOf(e.target)+n)%t.length]?.focus()}},en=e=>{let t=e.target?.closest?.(`label`)?.control||e.target;Qt(t)&&(e.preventDefault(),t.focus())},tn=e=>{e.target instanceof HTMLSelectElement&&Qt(e.target)&&e.preventDefault()};m(`readonly`,()=>[f(document,`keydown`,$t),f(document,`click`,en),f(document,`mousedown`,tn)]);let nn=`data-toggle-group`,rn=`[${nn}]`,an=s(()=>{for(let e of document.querySelectorAll(rn))l(e,`aria-label`,d(e,nn))},0),on=e=>{let t=e.target instanceof HTMLInputElement&&e.target.closest(rn);if(t&&(e.key===`Enter`&&e.target.click(),e.key?.startsWith(`Arrow`))){e.preventDefault?.();let n=[...t.getElementsByTagName(`input`)],r=n.indexOf(e.target),i=e.key.match(/Arrow(Right|Down)/)?1:-1,a=r;for(let e=0;e<n.length;e++)if(a=(n.length+a+i)%n.length,!n[a]?.disabled){n[a]?.focus();break}}};m(`toggle-group`,()=>[f(document,`keydown`,on),g(document,an,{attributeFilter:[nn],attributes:!0,childList:!0,subtree:!0})]);let U,sn,cn=0,ln=0,un=i()&&/iPad|iPhone|iPod/.test(navigator.userAgent),W=`data-tooltip`,dn=`data-color`,fn=`aria-label`,pn=`aria-description`,mn=`[${dn}]`,hn=`[${W}]`,gn=`data-color-scheme`,_n=`[${gn}]`,vn=e=>{e&&!(e instanceof HTMLElement)&&c(`setTooltipElement expects an HTMLElement, got: `,e),U=e||void 0},yn=s(()=>{for(let e of document.querySelectorAll(hn)){let t=e.getAttribute(fn)||e.getAttribute(pn),n=e.getAttribute(W)||d(e,W);if(t!==n){let t=l(e,`role`)!==`img`&&e.textContent?.trim();l(e,W,n),l(e,fn,t?null:n),l(e,pn,t?n:null),e.matches(`a,button,input,label,select,textarea,[tabindex]`)||c(`Missing tabindex="0" attribute on: `,e)}let r=e===sn&&U?.matches(`:popover-open`),i=r&&n&&U?.textContent!==n;r&&i&&(U&&_(U,n),document.activeElement===e&&ee(n))}},0),bn=({type:e,target:t})=>{if(clearTimeout(cn),t===U)return;if(e===`mouseover`&&!sn&&!un){cn=setTimeout(bn,300,{target:t});return}let n=t?.closest?.(`[${W}]`);if(n===sn)return;if(!n)return xn();U||=y(`div`,{class:`ds-tooltip`}),U.isConnected||document.body.appendChild(U);let r=n.closest(mn),i=n.closest(_n),a=r!==i&&r?.contains(i);clearTimeout(ln),l(U,`popover`,`manual`),l(U,gn,i?.getAttribute(gn)||null),l(U,dn,a&&r?.getAttribute(dn)||null),_(U,l(n,W)),U.showPopover(),U.dispatchEvent(new CustomEvent(`ds-toggle-source`,{detail:n})),sn=n},xn=()=>U?.isConnected&&U.popover&&U.hidePopover(),Sn=e=>{if(e?.type===`keydown`)return e?.key===`Escape`&&xn();e?e.target===U&&e.newState===`closed`&&(ln=setTimeout(Sn,300)):sn=void 0};m(`tooltip`,()=>[f(document,`blur focus mouseover`,bn,r),f(document,`toggle keydown`,Sn,r),g(document,yn,{attributeFilter:[W],attributes:!0,childList:!0,subtree:!0})]);var Cn=Object.defineProperty,wn=Object.getOwnPropertySymbols,Tn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,Dn=(e,t,n)=>t in e?Cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,On=(e,t)=>{for(var n in t||={})Tn.call(t,n)&&Dn(e,n,t[n]);if(wn)for(var n of wn(t))En.call(t,n)&&Dn(e,n,t[n]);return e},kn=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,An=kn&&/android/i.test(navigator.userAgent),jn=kn&&/iPad|iPhone|iPod/.test(navigator.userAgent);kn&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var Mn=`${An?`data`:`aria`}-labelledby`,Nn=`:host(:not([hidden])) { display: block }`,Pn=`outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color`,Fn=typeof HTMLElement>`u`?class{}:HTMLElement;function G(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var In=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},Ln=(e,...t)=>In(`add`,e,t),Rn=(e,...t)=>In(`remove`,e,t),zn=(e,t)=>e.shadowRoot||e.attachShadow({mode:`open`}).append(Gn(`slot`),Gn(`style`,t)),Bn=new WeakMap,Vn=(e,t)=>{if(t===void 0)return Bn.get(e);try{Bn.get(e).disconnect(),Bn.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),Bn.set(e,n)}},Hn=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},Un=0,Wn=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++Un).toString(32)}`,e.id):``,Gn=(e,t,n)=>{let r=document.createElement(e);return t&&(r[e===`style`?`textContent`:`innerHTML`]=t),r},Kn={define:(e,t)=>!kn||window.customElements.get(e)||window.customElements.define(e,t)},K,qn=0,Jn=e=>{K||(K=Gn(`div`),K.style.cssText=`position:fixed;overflow:hidden;width:1px;white-space:nowrap`,G(K,`aria-live`,`assertive`)),K.isConnected||document.body.append(K),e&&(K.textContent=`${e}${qn++%2?`\xA0`:``}`)},Yn=(e,t,n=``)=>{var r;let i={bubbles:!0,composed:!0,data:t,inputType:n},a=HTMLInputElement.prototype;e.dispatchEvent(new InputEvent(`beforeinput`,i)),(r=Object.getOwnPropertyDescriptor(a,`value`)?.set)==null||r.call(e,t),e.dispatchEvent(new InputEvent(`input`,i)),e.dispatchEvent(new Event(`change`,{bubbles:!0}))},Xn=!1,Zn=e=>(e?.type===`mouseup`&&(Xn=!1),e?.type===`mousedown`&&(Xn=!0,Ln(document,`mouseup`,Zn,{once:!0})),Xn),Qn=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,$n=`disabled`,er=`selected`,tr=class extends Fn{static get observedAttributes(){return[$n,er]}connectedCallback(){jn||(this.tabIndex=-1),this.hasAttribute(`role`)||G(this,`role`,`option`),this.attributeChangedCallback()}attributeChangedCallback(){G(this,`aria-disabled`,`${this.disabled}`),G(this,`aria-selected`,`${this.selected}`)}get defaultSelected(){return this[er]}set defaultSelected(e){this[er]=e}get disabled(){return G(this,$n)!==null}set disabled(e){G(this,$n,e?``:null)}get form(){return this.closest(`form`)}get index(){return[...this.parentElement?.options||[this]].indexOf(this)}get label(){return G(this,`label`)??this.text}set label(e){G(this,`label`,e)}get selected(){return G(this,er)!==null}set selected(e){G(this,er,e?``:null)}get text(){return this.textContent?.trim()||``}set text(e){this.textContent=e}get value(){return G(this,`value`)??this.text}set value(e){G(this,`value`,e)}};Kn.define(`u-option`,tr);var nr=`${Nn}
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Designsystemet={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(){return typeof HTMLButtonElement<`u`&&`command`in HTMLButtonElement.prototype&&`source`in((globalThis.CommandEvent||{}).prototype||{})}function n(){document.addEventListener(`invoke`,e=>{e.type==`invoke`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0),document.addEventListener(`command`,e=>{e.type==`command`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0);function e(e,t,n=!0){Object.defineProperty(e,t,{...Object.getOwnPropertyDescriptor(e,t),enumerable:n})}function t(e){return e&&typeof e.getRootNode==`function`?e.getRootNode():e&&e.parentNode?t(e.parentNode):e}let n=new WeakMap,r=new WeakMap;class i extends Event{constructor(e,t={}){super(e,t);let{source:i,command:a}=t;if(i!=null&&!(i instanceof Element))throw TypeError(`source must be an element`);n.set(this,i||null),r.set(this,a===void 0?``:String(a))}get[Symbol.toStringTag](){return`CommandEvent`}get source(){if(!n.has(this))throw TypeError(`illegal invocation`);let e=n.get(this);if(!(e instanceof Element))return null;let r=t(e);return r===t(this.target||document)?e:r.host}get command(){if(!r.has(this))throw TypeError(`illegal invocation`);return r.get(this)}}e(i.prototype,`source`),e(i.prototype,`command`);let a=new WeakMap;function o(e){Object.defineProperties(e.prototype,{commandForElement:{enumerable:!0,configurable:!0,set(e){if(e===null)this.removeAttribute(`commandfor`),a.delete(this);else if(e instanceof Element){this.setAttribute(`commandfor`,``);let n=t(e);t(this)===n||n===this.ownerDocument?a.set(this,e):a.delete(this)}else throw TypeError(`commandForElement must be an element or null`)},get(){if(this.localName!==`button`||this.disabled)return null;if(this.form&&this.getAttribute(`type`)!==`button`)return console.warn("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work"),null;let e=a.get(this);if(e)return e.isConnected?e:(a.delete(this),null);let n=t(this),r=this.getAttribute(`commandfor`);return(n instanceof Document||n instanceof ShadowRoot)&&r&&n.getElementById(r)||null}},command:{enumerable:!0,configurable:!0,get(){let e=this.getAttribute(`command`)||``;if(e.startsWith(`--`))return e;let t=e.toLowerCase();switch(t){case`show-modal`:case`request-close`:case`close`:case`toggle-popover`:case`hide-popover`:case`show-popover`:return t}return``},set(e){this.setAttribute(`command`,e)}}})}let s=new WeakMap;Object.defineProperties(HTMLElement.prototype,{oncommand:{enumerable:!0,configurable:!0,get(){return l.takeRecords(),s.get(this)||null},set(e){let t=s.get(this)||null;t&&this.removeEventListener(`command`,t),s.set(this,typeof e==`object`||typeof e==`function`?e:null),typeof e==`function`&&this.addEventListener(`command`,e)}}});function c(e){for(let t of e)t.oncommand=Function(`event`,t.getAttribute(`oncommand`))}let l=new MutationObserver(e=>{for(let t of e){let{target:e}=t;t.type===`childList`?c(e.querySelectorAll(`[oncommand]`)):c([e])}});l.observe(document,{subtree:!0,childList:!0,attributeFilter:[`oncommand`]}),c(document.querySelectorAll(`[oncommand]`));let u=new WeakSet;function d(e){if(u.has(e)||(u.add(e),e.defaultPrevented)||e.type!==`click`)return;let t=e.composedPath().find(e=>e.matches?.(`button[commandfor], button[command]`));if(!t)return;if(t.form&&t.getAttribute(`type`)!==`button`)throw e.preventDefault(),Error("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work. In order for it to act as a Submit button, it must not have command or commandfor attributes");if(t.hasAttribute(`command`)!==t.hasAttribute(`commandfor`)){let e=t.hasAttribute(`command`)?`command`:`commandfor`,n=t.hasAttribute(`command`)?`commandfor`:`command`;throw Error(`Element with ${e} attribute must also have a ${n} attribute to function.`)}if(t.command!==`show-popover`&&t.command!==`hide-popover`&&t.command!==`toggle-popover`&&t.command!==`show-modal`&&t.command!==`request-close`&&t.command!==`close`&&!t.command.startsWith(`--`)){console.warn(`"${t.command}" is not a valid command value. Custom commands must begin with --`);return}let n=t.commandForElement;if(!n)return;let r=new i(`command`,{command:t.command,source:t,cancelable:!0});if(n.dispatchEvent(r),r.defaultPrevented)return;let a=r.command.toLowerCase();if(n.popover){let e=!n.matches(`:popover-open`);e&&(a===`toggle-popover`||a===`show-popover`)?n.showPopover({source:t}):!e&&a===`hide-popover`&&n.hidePopover()}else if(n.localName===`dialog`){let e=!n.hasAttribute(`open`);e&&a==`show-modal`?n.showModal():!e&&a==`close`?n.close(t.value?t.value:void 0):!e&&a==`request-close`&&(HTMLDialogElement.prototype.requestClose||(HTMLDialogElement.prototype.requestClose=function(){let e=new Event(`cancel`,{cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||this.close()}),n.requestClose(t.value?t.value:void 0))}}function f(e){e.addEventListener(`click`,d,!0)}function p(e,t){let n=e.prototype.attachShadow;e.prototype.attachShadow=function(e){let r=n.call(this,e);return t(r),r};let r=e.prototype.attachInternals;e.prototype.attachInternals=function(){let e=r.call(this);return e.shadowRoot&&t(e.shadowRoot),e}}o(HTMLButtonElement),p(HTMLElement,e=>{f(e),l.observe(e,{attributeFilter:[`oncommand`]}),c(e.querySelectorAll(`[oncommand]`))}),f(document),Object.assign(globalThis,{CommandEvent:i})}let r={passive:!0,capture:!0},i=()=>typeof window<`u`&&typeof document<`u`,a=()=>i()&&/^Win/i.test(navigator.userAgentData?.platform||navigator.platform),o=typeof HTMLElement>`u`?class{}:HTMLElement;function s(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}let c=(e,...t)=>!i()||window.dsWarnings===!1||console.log(`\x1B[1mDesignsystemet:\x1B[m ${e}`,...t),l=(e,t,n)=>n===void 0?e.getAttribute(t)??null:(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),u=(e,t)=>getComputedStyle(e).getPropertyValue(t).trim(),d=/^["']|["']$/g,f=(e,t)=>{let n=l(e,t);return n||=u(e,`--_ds-${t}`).replace(d,``).trim(),n||c(`Missing ${t} on:`,e),n||null},p=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.addEventListener(t,...r);return()=>m(e,...t)},m=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.removeEventListener(t,...r)},h=(e,t)=>{i()&&(window._dsHotReloadCleanup||(window._dsHotReloadCleanup=new Map),window._dsHotReloadCleanup?.get(e)?.map(e=>e()),window._dsHotReloadCleanup?.set(e,t()))},g=(e,t,n)=>{let r=()=>a.disconnect(),a=new MutationObserver(n=>{if(!i()||!e.isConnected)return r();t(e,n)});return t(e),a.observe(e,n),r},_=(e,t)=>{let n=document.createElement(e);if(t)for(let[e,r]of Object.entries(t))l(n,e,r);return n},v={define:(e,t)=>!i()||window.customElements.get(e)||window.customElements.define(e,t)},y=0;function b(e){return i()?(window.dsUseId||(window.dsUseId=0),e&&!e.id&&(e.id=`:ds:${++window.dsUseId}`),e?.id||``):`:ds:${++y}`}let x,ee=0,S=0,C=e=>{clearTimeout(S),x&&(x.textContent=`${e}${ee++%2?`\xA0`:``}`),e&&(S=setTimeout(C,2e3,``))},w=()=>{document.readyState===`complete`&&(x||(x=_(`div`,{"aria-live":`assertive`}),x.style.overflow=`hidden`,x.style.position=`fixed`,x.style.whiteSpace=`nowrap`,x.style.width=`1px`),x.isConnected||document.body.appendChild(x))};h(`announce`,()=>[p(document,`focus mouseover`,w,r)]);var te=()=>typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,ne=te(),re=ne?navigator.userAgent:``,ie=/android/i.test(re),ae=/firefox/i.test(re);ne&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var oe=(e,t,n)=>n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),se=(e,t,n)=>{let r=new MutationObserver(n=>{if(!te()||!e.isConnected)return i();t(e,n)}),i=Object.assign(()=>r.disconnect(),{takeRecords:()=>r.takeRecords()});return t(e),r.observe(e,n),i},ce=`__uDetailsPolyfillSummarys`;if(te()&&ie&&ae&&!window[ce]){let e=document.getElementsByTagName(`summary`);window[ce]=se(document,()=>{for(let t of e){let e=t.parentElement;oe(t,`role`,`button`),oe(t,`aria-expanded`,`${!!e?.open}`)}},{attributeFilter:[`open`],attributes:!0,childList:!0,subtree:!0})}let le=`:click-delegate-hover`,ue=`data-clickdelegatefor`,de=`[${ue}]`,fe=e=>{let t=e.button===1||e.metaKey||e.ctrlKey,n=e.button<2&&he(e);if(!(!n||n.contains(e.target))){if(t&&n instanceof HTMLAnchorElement)return window.open(n.href,void 0,n.rel);e.stopImmediatePropagation(),n.click()}},pe,me=e=>{let t=he(e);pe!==t&&(pe&&pe.classList.remove(le),t&&t.classList.add(le),pe=t)},he=({target:e})=>{let t=(e instanceof Element?e.closest(de):null)?.getAttribute(ue),n=t&&document.getElementById(t)||void 0,r=n&&e.closest(`a,button,label,input,select,textarea,details,dialog,[role="button"],[popover],[contenteditable]`);return(!r||r===n)&&!n?.disabled?n:void 0};h(`clickdelegatefor`,()=>[p(window,`click auxclick`,fe,!0),p(document,`mouseover`,me,r)]);let ge=!1,_e=({type:e,target:t,clientX:n=0,clientY:r=0})=>{if(e===`pointerdown`){let e=t?.closest?.(`dialog`)?.getBoundingClientRect();ge=!!(e&&e.top<=r&&r<=e.bottom&&e.left<=n&&n<=e.right)}else{let e=t instanceof HTMLDialogElement&&!ge&&l(t,`closedby`)===`any`;ge=!1,e&&requestAnimationFrame(()=>t.open&&t.close())}},ve=i()?document.getElementsByTagName(`button`):[],ye=()=>{for(let e of ve)e.getAttribute(`command`)?.endsWith(`-modal`)&&e.setAttribute(`aria-haspopup`,`dialog`)},be=({command:e,target:t})=>e===`--show-non-modal`&&t instanceof HTMLDialogElement&&t.show();h(`dialog`,()=>[p(document,`command`,be,r),p(document,`pointerdown pointerup`,_e,r),g(document,ye,{attributeFilter:[`command`],attributes:!0,childList:!0,subtree:!0})]);let xe=i()?document.getElementsByTagName(`fieldset`):[],Se=()=>{for(let e of xe)e.hasAttribute(`aria-labelledby`)||l(e,`aria-labelledby`,`${b(e.querySelector(`legend`))} ${b(e.querySelector(`:scope > :is([data-field="description"],legend + p)`))}`.trim()||null)};h(`fieldset`,()=>[g(document,Se,{childList:!0,subtree:!0})]);let T=Math.min,E=Math.max,Ce=Math.round,we=Math.floor,D=e=>({x:e,y:e}),Te={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ee(e,t,n){return E(e,T(t,n))}function O(e,t){return typeof e==`function`?e(t):e}function k(e){return e.split(`-`)[0]}function De(e){return e.split(`-`)[1]}function Oe(e){return e===`x`?`y`:`x`}function ke(e){return e===`y`?`height`:`width`}function A(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ae(e){return Oe(A(e))}function je(e,t,n){n===void 0&&(n=!1);let r=De(e),i=Ae(e),a=ke(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Be(o)),[o,Be(o)]}function Me(e){let t=Be(e);return[Ne(e),t,Ne(t)]}function Ne(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}let Pe=[`left`,`right`],Fe=[`right`,`left`],Ie=[`top`,`bottom`],Le=[`bottom`,`top`];function Re(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Fe:Pe:t?Pe:Fe;case`left`:case`right`:return t?Ie:Le;default:return[]}}function ze(e,t,n,r){let i=De(e),a=Re(k(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ne)))),a}function Be(e){let t=k(e);return Te[t]+e.slice(t.length)}function Ve(e){return{top:0,right:0,bottom:0,left:0,...e}}function He(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ve(e)}function Ue(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function We(e,t,n){let{reference:r,floating:i}=e,a=A(t),o=Ae(t),s=ke(o),c=k(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(De(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Ge(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=O(t,e),p=He(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ue(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ue(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}let Ke=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ge},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=We(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<50&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=We(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},qe=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=O(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=k(r),_=A(o),v=k(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Be(o)]:Me(o)),x=p!==`none`;!d&&x&&b.push(...ze(o,m,p,y));let ee=[o,...b],S=await s.detectOverflow(t,h),C=[],w=i.flip?.overflows||[];if(l&&C.push(S[g]),u){let e=je(r,a,y);C.push(S[e[0]],S[e[1]])}if(w=[...w,{placement:r,overflows:C}],!C.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=ee[e];if(t&&(!(u===`alignment`&&_!==A(t))||w.every(e=>A(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:w},reset:{placement:t}};let n=w.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=w.filter(e=>{if(x){let t=A(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}},Je=new Set([`left`,`top`]);async function Ye(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=k(n),s=De(n),c=A(n)===`y`,l=Je.has(o)?-1:1,u=a&&c?-1:1,d=O(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}let Xe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ye(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ze=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=O(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=A(k(i)),p=Oe(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ee(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ee(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Qe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=O(e,t),u={x:n,y:r},d=A(i),f=Oe(d),p=u[f],m=u[d],h=O(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Je.has(k(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},$e=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=O(e,t),u=await o.detectOverflow(t,l),d=k(i),f=De(i),p=A(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=T(h-u[g],v),x=T(m-u[_],y),ee=!t.middlewareData.shift,S=b,C=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(C=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=v),ee&&!f){let e=E(u.left,0),t=E(u.right,0),n=E(u.top,0),r=E(u.bottom,0);p?C=m-2*(e!==0||t!==0?e+t:E(u.left,u.right)):S=h-2*(n!==0||r!==0?n+r:E(u.top,u.bottom))}await c({...t,availableWidth:C,availableHeight:S});let w=await o.getDimensions(s.floating);return m!==w.width||h!==w.height?{reset:{rects:!0}}:{}}}};function et(){return typeof window<`u`}function j(e){return tt(e)?(e.nodeName||``).toLowerCase():`#document`}function M(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function N(e){return((tt(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function tt(e){return et()?e instanceof Node||e instanceof M(e).Node:!1}function P(e){return et()?e instanceof Element||e instanceof M(e).Element:!1}function F(e){return et()?e instanceof HTMLElement||e instanceof M(e).HTMLElement:!1}function nt(e){return!et()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof M(e).ShadowRoot}function rt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=R(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function it(e){return/^(table|td|th)$/.test(j(e))}function at(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}let ot=/transform|translate|scale|rotate|perspective|filter/,st=/paint|layout|strict|content/,I=e=>!!e&&e!==`none`,ct;function lt(e){let t=P(e)?R(e):e;return I(t.transform)||I(t.translate)||I(t.scale)||I(t.rotate)||I(t.perspective)||!dt()&&(I(t.backdropFilter)||I(t.filter))||ot.test(t.willChange||``)||st.test(t.contain||``)}function ut(e){let t=z(e);for(;F(t)&&!L(t);){if(lt(t))return t;if(at(t))return null;t=z(t)}return null}function dt(){return ct??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ct}function L(e){return/^(html|body|#document)$/.test(j(e))}function R(e){return M(e).getComputedStyle(e)}function ft(e){return P(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function z(e){if(j(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||nt(e)&&e.host||N(e);return nt(t)?t.host:t}function pt(e){let t=z(e);return L(t)?e.ownerDocument?e.ownerDocument.body:e.body:F(t)&&rt(t)?t:pt(t)}function mt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=pt(e),i=r===e.ownerDocument?.body,a=M(r);if(i){let e=ht(a);return t.concat(a,a.visualViewport||[],rt(r)?r:[],e&&n?mt(e):[])}else return t.concat(r,mt(r,[],n))}function ht(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gt(e){let t=R(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=F(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ce(n)!==a||Ce(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function _t(e){return P(e)?e:e.contextElement}function B(e){let t=_t(e);if(!F(t))return D(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=gt(t),o=(a?Ce(n.width):n.width)/r,s=(a?Ce(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let vt=D(0);function yt(e){let t=M(e);return!dt()||!t.visualViewport?vt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==M(e)?!1:t}function V(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=_t(e),o=D(1);t&&(r?P(r)&&(o=B(r)):o=B(e));let s=bt(a,n,r)?yt(a):D(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=M(a),t=r&&P(r)?M(r):r,n=e,i=ht(n);for(;i&&r&&t!==n;){let e=B(i),t=i.getBoundingClientRect(),r=R(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=M(i),i=ht(n)}}return Ue({width:u,height:d,x:c,y:l})}function xt(e,t){let n=ft(e).scrollLeft;return t?t.left+n:V(N(e)).left+n}function St(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-xt(e,n),y:n.top+t.scrollTop}}function Ct(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=N(r),s=t?at(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=D(1),u=D(0),d=F(r);if((d||!d&&!a)&&((j(r)!==`body`||rt(o))&&(c=ft(r)),d)){let e=V(r);l=B(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?St(o,c):D(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function wt(e){return Array.from(e.getClientRects())}function Tt(e){let t=N(e),n=ft(e),r=e.ownerDocument.body,i=E(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=E(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+xt(e),s=-n.scrollTop;return R(r).direction===`rtl`&&(o+=E(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Et(e,t){let n=M(e),r=N(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=dt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=xt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}function Dt(e,t){let n=V(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=F(e)?B(e):D(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ot(e,t,n){let r;if(t===`viewport`)r=Et(e,n);else if(t===`document`)r=Tt(N(e));else if(P(t))r=Dt(t,n);else{let n=yt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ue(r)}function kt(e,t){let n=z(e);return n===t||!P(n)||L(n)?!1:R(n).position===`fixed`||kt(n,t)}function At(e,t){let n=t.get(e);if(n)return n;let r=mt(e,[],!1).filter(e=>P(e)&&j(e)!==`body`),i=null,a=R(e).position===`fixed`,o=a?z(e):e;for(;P(o)&&!L(o);){let t=R(o),n=lt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||rt(o)&&!n&&kt(e,o))?r=r.filter(e=>e!==o):i=t,o=z(o)}return t.set(e,r),r}function jt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?at(t)?[]:At(t,this._c):[].concat(n),r],o=Ot(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ot(t,a[e],i);s=E(n.top,s),c=T(n.right,c),l=T(n.bottom,l),u=E(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Mt(e){let{width:t,height:n}=gt(e);return{width:t,height:n}}function Nt(e,t,n){let r=F(t),i=N(t),a=n===`fixed`,o=V(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=D(0);function l(){c.x=xt(i)}if(r||!r&&!a)if((j(t)!==`body`||rt(i))&&(s=ft(t)),r){let e=V(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?St(i,s):D(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Pt(e){return R(e).position===`static`}function Ft(e,t){if(!F(e)||R(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return N(e)===n&&(n=n.ownerDocument.body),n}function It(e,t){let n=M(e);if(at(e))return n;if(!F(e)){let t=z(e);for(;t&&!L(t);){if(P(t)&&!Pt(t))return t;t=z(t)}return n}let r=Ft(e,t);for(;r&&it(r)&&Pt(r);)r=Ft(r,t);return r&&L(r)&&Pt(r)&&!lt(r)?n:r||ut(e)||n}let Lt=async function(e){let t=this.getOffsetParent||It,n=this.getDimensions,r=await n(e.floating);return{reference:Nt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rt(e){return R(e).direction===`rtl`}let zt={convertOffsetParentRelativeRectToViewportRelativeRect:Ct,getDocumentElement:N,getClippingRect:jt,getOffsetParent:It,getElementRects:Lt,getClientRects:wt,getDimensions:Mt,getScale:B,isElement:P,isRTL:Rt};function Bt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vt(e,t){let n=null,r,i=N(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=we(d),h=we(i.clientWidth-(u+f)),g=we(i.clientHeight-(d+p)),_=we(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:E(0,T(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Bt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Ht(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=_t(e),u=i||a?[...l?mt(l):[],...t?mt(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Vt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?V(e):null;c&&g();function g(){let t=V(e);h&&!Bt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Ut=Xe,Wt=Ze,Gt=qe,Kt=$e,qt=Qe,Jt=(e,t,n)=>{let r=new Map,i={platform:zt,...n},a={...i.platform,_c:r};return Ke(e,t,{...i,platform:a})},Yt=`data-placement`,Xt=`data-autoplacement`,Zt=new Map;function Qt(e){let{newState:t,oldState:n,target:r,source:i=e.detail}=e,a=r instanceof HTMLElement&&l(r,`popover`)!==null&&u(r,`--_ds-floating`);if(!a)return;if(t===`closed`)return Zt.get(r)?.();if(!i){let e=r.getRootNode(),t=`[popovertarget="${r.id}"],[commandfor="${r.id}"]`;i=r.id&&e?.querySelector?.(t)||void 0}if(!i||i===r||n&&n===t)return;let o=u(r,`--_ds-floating-overscroll`),s=l(r,Yt)||l(i,Yt)||a,c=l(r,Xt)||l(i,Xt),d=parseFloat(getComputedStyle(r,`::before`).height)||0,f=s.match(/left|right/gi)?`Height`:`Width`,p=i[`offset${f}`]/2+d;if(s===`none`)return;let m={strategy:`absolute`,placement:s,middleware:[Ut(d||0),Wt({padding:10,limiter:qt({offset:{mainAxis:p}})}),tn(),...c===`false`?[]:[Gt({padding:10,crossAxis:!1})],...o?[Kt({apply({availableHeight:e}){o===`fit`&&(r.style.width=`${i.clientWidth}px`),r.style.maxHeight=`${Math.max(50,e-20)}px`}})]:[]]},h=Ht(i,r,async()=>{if(!i?.isConnected)return Zt.get(r)?.();let{x:e,y:t}=await Jt(i,r,m);r.style.translate=`${e}px ${t}px`});Zt.set(r,()=>Zt.delete(r)&&h())}let $t,en=({type:e})=>{if(e===`mousedown`&&($t=!1),e===`scroll`&&$t===!1&&($t=!0),e===`mouseup`&&$t)for(let[e]of Zt)e.showPopover()};h(`popover`,()=>[p(document,`mousedown scroll mouseup`,en,!0),p(document,`toggle ds-toggle-source`,Qt,r)]);let tn=()=>({name:`arrowPseudo`,fn(e){let t=e.elements.floating,n=e.rects.reference,r=`${Math.round(n.width/2+n.x-e.x)}px`,i=`${Math.round(n.height/2+n.y-e.y)}px`;return t.style.setProperty(`--_ds-floating-arrow-x`,r),t.style.setProperty(`--_ds-floating-arrow-y`,i),l(t,`data-floating`,e.placement),e}}),nn=e=>(e instanceof HTMLSelectElement||e instanceof HTMLInputElement)&&(e.hasAttribute(`readonly`)||l(e,`aria-readonly`)===`true`),rn=e=>{if(e.key!==`Tab`&&nn(e.target)){let t=e.key?.startsWith(`Arrow`),n=e.altKey||e.ctrlKey||e.metaKey;if((t||!n)&&e.preventDefault(),t&&l(e.target,`type`)===`radio`){let t=document.querySelectorAll(`input[name="${e.target.name}"]`),n=e.key?.match(/Arrow(Right|Down)/)?1:-1;t[(t.length+[...t].indexOf(e.target)+n)%t.length]?.focus()}}},an=e=>{let t=e.target?.closest?.(`label`)?.control||e.target;nn(t)&&(e.preventDefault(),t.focus())},on=e=>{e.target instanceof HTMLSelectElement&&nn(e.target)&&e.preventDefault()};h(`readonly`,()=>[p(document,`keydown`,rn),p(document,`click`,an),p(document,`mousedown`,on)]);let sn=`aria-label`,cn=`data-toggle-group`,ln=`[${cn}]`,un=()=>{for(let e of document.querySelectorAll(ln))l(e,`aria-label`,f(e,cn))},dn=e=>{let{key:t,target:n}=e,r=n instanceof HTMLInputElement&&n.closest(ln);if(r&&(!l(r,sn)&&!l(r,`aria-labelledby`)&&l(r,sn,f(r,cn)),t===`Enter`&&n.click(),t?.startsWith(`Arrow`))){e.preventDefault?.();let i=[...r.getElementsByTagName(`input`)],a=i.indexOf(n),o=t.match(/Arrow(Right|Down)/)?1:-1,s=a;for(let e=0;e<i.length;e++)if(s=(i.length+s+o)%i.length,!i[s]?.disabled){i[s]?.focus();break}}};h(`toggle-group`,()=>[p(document,`keydown`,dn),g(document,un,{attributeFilter:[cn],attributes:!0,childList:!0,subtree:!0})]);let H,fn,pn=!1,mn=0,hn=0,gn=i()&&/iPad|iPhone|iPod/.test(navigator.userAgent),U=`data-tooltip`,_n=`data-color`,vn=`aria-label`,yn=`aria-description`,bn=`[${_n}]`,xn=`[${U}]`,Sn=`data-color-scheme`,Cn=`[${Sn}]`,wn=e=>{e&&!(e instanceof HTMLElement)&&c(`setTooltipElement expects an HTMLElement, got: `,e),clearTimeout(hn),clearTimeout(mn),fn=void 0,pn=!1,H=e||void 0},Tn=()=>{for(let e of document.querySelectorAll(xn)){let t=f(e,U);if(!t)return;if(t!==(e.getAttribute(vn)||e.getAttribute(yn))){let n=l(e,`role`)!==`img`&&e.textContent?.trim();l(e,U,t),l(e,vn,n?null:t),l(e,yn,n?t:null),e.matches(`a,button,input,label,select,textarea,[tabindex]`)||c(`Missing tabindex="0" attribute on: `,e)}let n=e===fn&&H?.offsetHeight&&H?.offsetWidth,r=n&&t&&H?.textContent!==t;n&&r&&(H&&(H.textContent=t),document.activeElement===e&&C(t))}},En=({type:e,target:t})=>{if(clearTimeout(mn),t===H)return;if(e===`mouseover`&&!pn&&!gn){mn=setTimeout(En,300,{target:t});return}let n=t?.closest?.(`[${U}]`);if(n===fn)return;if(!n)return Dn();H||=_(`div`,{class:`ds-tooltip`}),H.isConnected||document.body.appendChild(H);let r=n.closest(bn),i=n.closest(Cn),a=r!==i&&r?.contains(i);clearTimeout(hn),l(H,`popover`,`manual`),l(H,Sn,i?.getAttribute(Sn)||null),l(H,_n,a&&r?.getAttribute(_n)||null),H.textContent=l(n,U),H.showPopover(),H.dispatchEvent(new CustomEvent(`ds-toggle-source`,{detail:n})),pn=!0,fn=n},Dn=()=>H?.isConnected&&H.popover&&H.hidePopover(),On=e=>{if(e?.type===`keydown`)return e?.key===`Escape`&&Dn();e?e.target===H&&e.newState===`closed`&&(fn=void 0,hn=setTimeout(On,300)):pn=!1};h(`tooltip`,()=>[p(document,`blur focus mouseover`,En,r),p(document,`toggle keydown`,On,r),g(document,Tn,{attributeFilter:[U],attributes:!0,childList:!0,subtree:!0})]);var kn=Object.defineProperty,An=Object.getOwnPropertySymbols,jn=Object.prototype.hasOwnProperty,Mn=Object.prototype.propertyIsEnumerable,Nn=(e,t,n)=>t in e?kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pn=(e,t)=>{for(var n in t||={})jn.call(t,n)&&Nn(e,n,t[n]);if(An)for(var n of An(t))Mn.call(t,n)&&Nn(e,n,t[n]);return e},Fn=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,In=Fn&&/android/i.test(navigator.userAgent),Ln=Fn&&/iPad|iPhone|iPod/.test(navigator.userAgent);Fn&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var Rn=`${In?`data`:`aria`}-labelledby`,zn=`:host(:not([hidden])) { display: block }`,Bn=`outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color`,Vn=typeof HTMLElement>`u`?class{}:HTMLElement;function W(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var Hn=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},Un=(e,...t)=>Hn(`add`,e,t),Wn=(e,...t)=>Hn(`remove`,e,t),Gn=(e,t)=>e.shadowRoot||e.attachShadow({mode:`open`}).append(Zn(`slot`),Zn(`style`,t)),Kn=new WeakMap,qn=(e,t)=>{if(t===void 0)return Kn.get(e);try{Kn.get(e).disconnect(),Kn.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),Kn.set(e,n)}},Jn=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},Yn=0,Xn=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++Yn).toString(32)}`,e.id):``,Zn=(e,t,n)=>{let r=document.createElement(e);return t&&(r[e===`style`?`textContent`:`innerHTML`]=t),r},Qn={define:(e,t)=>!Fn||window.customElements.get(e)||window.customElements.define(e,t)},G,$n=0,er=e=>{G||(G=Zn(`div`),G.style.cssText=`position:fixed;overflow:hidden;width:1px;white-space:nowrap`,W(G,`aria-live`,`assertive`)),G.isConnected||document.body.append(G),e&&(G.textContent=`${e}${$n++%2?`\xA0`:``}`)},tr=(e,t,n=``)=>{var r;let i={bubbles:!0,composed:!0,data:t,inputType:n},a=HTMLInputElement.prototype;e.dispatchEvent(new InputEvent(`beforeinput`,i)),(r=Object.getOwnPropertyDescriptor(a,`value`)?.set)==null||r.call(e,t),e.dispatchEvent(new InputEvent(`input`,i)),e.dispatchEvent(new Event(`change`,{bubbles:!0}))},nr=!1,rr=e=>(e?.type===`mouseup`&&(nr=!1),e?.type===`mousedown`&&(nr=!0,Un(document,`mouseup`,rr,{once:!0})),nr),ir=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,ar=`disabled`,or=`selected`,sr=class extends Vn{static get observedAttributes(){return[ar,or]}connectedCallback(){Ln||(this.tabIndex=-1),this.hasAttribute(`role`)||W(this,`role`,`option`),this.attributeChangedCallback()}attributeChangedCallback(){W(this,`aria-disabled`,`${this.disabled}`),W(this,`aria-selected`,`${this.selected}`)}get defaultSelected(){return this[or]}set defaultSelected(e){this[or]=e}get disabled(){return W(this,ar)!==null}set disabled(e){W(this,ar,e?``:null)}get form(){return this.closest(`form`)}get index(){return[...this.parentElement?.options||[this]].indexOf(this)}get label(){return W(this,`label`)??this.text}set label(e){W(this,`label`,e)}get selected(){return W(this,or)!==null}set selected(e){W(this,or,e?``:null)}get text(){return this.textContent?.trim()||``}set text(e){this.textContent=e}get value(){return W(this,`value`)??this.text}set value(e){W(this,`value`,e)}};Qn.define(`u-option`,sr);var cr=`${zn}
|
|
2
2
|
::slotted([role="option"]) { display: block; cursor: pointer }
|
|
3
|
-
::slotted([role="option"]:focus) { ${
|
|
3
|
+
::slotted([role="option"]:focus) { ${Bn} }
|
|
4
4
|
::slotted([role="option"][aria-hidden="true"]),
|
|
5
5
|
::slotted([role="option"][disabled]),
|
|
6
|
-
::slotted([role="option"][hidden]) { display: none !important }`,rr=Qn(nr),ir,ar=0,or=jn||An,sr=`click,focusout,input,keydown,mousedown,mouseup`,cr=`focus,focusin,blur,focusout`,lr={singular:`%d hit`,plural:`%d hits`},ur=class extends Fn{constructor(){super(),this._texts=On({},lr),this._value=``,this._of=`/`,zn(this,nr)}static get observedAttributes(){return[`id`,...Object.keys(lr).map(e=>`data-sr-${e}`)]}connectedCallback(){this.hidden=!0,this._root=Hn(this),G(this,`role`,`listbox`),G(this,`tabindex`,`-1`),Ln(this._root,`focusin`,this),Ln(this._root,`focus`,this,!0),Vn(this,{attributeFilter:[`disabled`,`hidden`,`label`,`value`],attributes:!0,characterData:!0,childList:!0,subtree:!0}),setTimeout(()=>this.attributeChangedCallback())}disconnectedCallback(){Rn(this._root||this,`focus`,this,!0),Rn(this._root||this,`focusin`,this),Vn(this,!1),pr(this),this._root=void 0}attributeChangedCallback(e,t,n){let r=e?.split(`data-sr-`)[1],i=`input[list="${this.id}"]`;if(lr[r])this._texts[r]=n||lr[r];else if(this._root){this._input&&mr(this,this._input);for(let e of this._root.querySelectorAll(i))mr(this,e)}}handleEvent(e){let{target:t,type:n}=e;e.defaultPrevented||(n===`click`&&vr(this,e),(n===`focus`||n===`focusin`)&&hr(this,e),(n===`blur`||n===`focusout`)&&gr(this,e),n===`keydown`&&yr(this,e),n===`mousedown`&&this.contains(t)&&Zn(e),(n===`mutation`||n===`input`)&&(clearTimeout(ar),ar=setTimeout(br,0,this,e)))}get options(){if(!this._options){let e=this.querySelector(`[role="option"],option`)?.nodeName;e&&(this._options=this.getElementsByTagName(e))}return this._options||this.getElementsByTagName(`option`)}},dr=e=>e?.disabled||e?.readOnly||!1,fr=(e,t)=>{var n;if(e.hidden!==t)return;e.hidden=dr(e?._input)||!t,(n=Vn(e))==null||n.takeRecords();let r=e.isConnected&&e.popover&&e._input?.isConnected&&e._input?.popoverTargetElement===e;e._input&&mr(e,e._input,t),r&&G(e,`popover`,`manual`),r&&e.togglePopover(t),t&&br(e)},pr=e=>{e._input&&=(Rn(e._input||e,cr,e),Rn(e._root||e,sr,e),fr(e,!1),void 0)},mr=(e,t,n=!1)=>{e.popover&&G(t,`popovertarget`,Wn(e)),Ln(t,cr,e,!0),G(t,`aria-autocomplete`,`list`),G(t,`aria-controls`,Wn(e)),G(t,`aria-expanded`,`${!or||n}`),G(t,`autocomplete`,`off`),G(t,`role`,dr(t)?null:`combobox`)},hr=(e,t)=>{let n=t.target instanceof HTMLInputElement;n&&t.isTrusted&&t.stopImmediatePropagation(),e._input!==t.target&&n&&t.target.list===e&&(e._input&&pr(e),e._input=t.target,e._input.dispatchEvent(new FocusEvent(`focus`)),e._input.dispatchEvent(new FocusEvent(`focusin`,{bubbles:!0})),G(e,Mn,Wn(e._input.labels?.[0])),Ln(e._root||e,sr,e),fr(e,G(e._input,`inputmode`)!==`none`),Jn())},gr=(e,t)=>{!An&&!Zn()&&e._input&&setTimeout(_r,0,e),t.target===e._input&&t.isTrusted&&t.stopImmediatePropagation()},_r=e=>{let t=e._root?.activeElement||null,n=e._input;n&&n!==t&&!e.contains(t)&&(n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:t})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:t})),pr(e))},vr=(e,{target:t})=>{var n;if(!e._input||e._input===t)return fr(e,!0);for(let r of e.options)if(r.contains(t))return G(e,`aria-multiselectable`)!==`true`&&((n=e._input)==null||n.focus(),fr(e,!1)),Yn(e._input,r.value);An&&_r(e)},yr=(e,t)=>{var n;let{key:r,target:i,altKey:a,ctrlKey:o,shiftKey:s,metaKey:c}=t,l=r===`Escape`||r===`Esc`;if(a||o||c||s||r===`Tab`)return;l&&!e.hidden&&t?.preventDefault(),fr(e,!l);let u=[...e.options].filter(e=>G(e,`aria-hidden`)!==`true`&&e.offsetHeight),d=u.indexOf(i),f=-1;if(r===`ArrowDown`&&(f=(d+1)%u.length),r===`ArrowUp`&&(f=(~d?d:u.length)-1),~d&&((r===`Home`||r===`PageUp`)&&(f=0),(r===`End`||r===`PageDown`)&&(f=u.length-1),r===`Enter`))return u[d].click(),t.preventDefault();if(u[f])for(let e of u)e.tabIndex=-1;u[f]&&t.preventDefault(),(n=u[f]||e._input)==null||n.focus(),!u[f]&&r===`ArrowUp`&&setTimeout(()=>e._input?.setSelectionRange(999,999))},br=(e,t)=>{let{_texts:n,_root:r,_input:i,options:a}=e,o=i?.value.toLowerCase().trim()||``,s=!e.hasAttribute(`data-nofilter`),c=[],l=[];for(let e of a)(e.disabled||e.hidden||s&&!e.label.toLowerCase().includes(o)?c:l).push(e);for(let e of c)G(e,`aria-hidden`,`true`);for(let e of l)G(e,`aria-hidden`,`false`);let u=l.length;clearTimeout(ir),t?.type===`input`&&o!==e._value&&(ir=setTimeout(()=>{let t=`${!u&&e.innerText.trim()||`${n[u===1?`singular`:`plural`]}`.replace(`%d`,`${u}`)}`;!e.hidden&&r?.activeElement===i&&Jn(t),e._value=o},1e3));let d=0;if(jn)for(let t of l)G(t,`title`,`${++d} ${e._of} ${u}`)};kn&&Object.defineProperty(HTMLInputElement.prototype,`list`,{configurable:!0,enumerable:!0,get(){return Hn(this).getElementById(G(this,`list`)||``)}}),Kn.define(`u-datalist`,ur);let xr=`aria-label`;var Sr=class extends o{_items;_label=null;_render;_unresize;_unmutate;static get observedAttributes(){return[xr]}connectedCallback(){this._label=d(this,xr),this._items=this.getElementsByTagName(`a`),this._render=s(()=>Cr(this),100),this._unresize=f(window,`resize`,this._render),this._unmutate=g(this,this._render,{childList:!0,subtree:!0})}attributeChangedCallback(e,t,n){n&&(this._label=n),this._render?.()}disconnectedCallback(){this._unresize?.(),this._unmutate?.(),this._unresize=this._unmutate=this._render=this._items=void 0}};let Cr=e=>{let t=e._items?.[e._items.length-1],n=t?.parentElement===e?null:t,r=!n?.offsetHeight;l(e,`role`,r?null:`navigation`),l(e,xr,r?null:e._label);for(let t of e._items||[])l(t,`aria-current`,t===n?`page`:null)};b.define(`ds-breadcrumbs`,Sr);var wr=class extends o{connectedCallback(){f(this,`animationend`,this,r),requestAnimationFrame(()=>this.handleEvent({target:this}))}handleEvent({target:e}){if(e!==this)return;let t=this.querySelector(`h2,h3,h4,h5,h6`);t&&l(this,`aria-labelledby`,S(t)),l(this,`tabindex`,`-1`),this.focus()}disconnectedCallback(){p(this,`animationend`,this,r)}};b.define(`ds-error-summary`,wr);let Tr=`data-indeterminate`,Er=new Set,Dr=new WeakMap,Or=i()?document.getElementsByTagName(`fieldset`):[],kr=i()&&CSS.supports(`field-sizing`,`content`),Ar=a()?800:200,jr=new WeakSet,Mr=s(()=>{for(let e of Or)l(e,`aria-labelledby`,`${S(e.querySelector(`legend`))} ${S(e.querySelector(`:scope > :is([data-field="description"],legend + p)`))}`.trim()||null);for(let e of Er){let t=[],n=[],r,i,a=!1,o=!1;for(let s of e.getElementsByTagName(`*`))if(s instanceof HTMLLabelElement&&n.push(s),!s.hidden)if(Ir(s))r?c(`Fields should only have one input element. Use <fieldset> to group multiple fields:`,e):r=s;else{let e=s.getAttribute(`data-field`);e===`counter`&&(i=s),e===`validation`?(t.unshift(s),a=!0,o||=Fr(s)):e&&t.push(s)}if(!r)c(`Field is missing input element:`,e);else{i&&Dr.set(r,i);for(let e of n)l(e,`for`,S(r));let s=r.type===`radio`||r.type===`checkbox`,c=e.closest(`fieldset`)?.querySelector(`:scope > [data-field="validation"]`);c&&!c?.hidden&&(a=!0,o||=Fr(c),t.unshift(c));let u=l(r,Tr);u&&(r.indeterminate=u===`true`),l(e,`data-clickdelegatefor`,s?S(r):null),l(r,`aria-describedby`,t.map(S).join(` `)||null),(a||jr.has(r))&&(jr[a?`add`:`delete`](r),l(r,`aria-invalid`,`${o}`)),Nr(r)}}},0),Nr=e=>{let t=e.target||e,n=Dr.get(t);if(n?.isConnected){let r=(Number(l(n,`data-limit`))||0)-t.value.length,i=r<0?`over`:`under`,a=d(n,`data-${i}`)?.replace(`%d`,`${Math.abs(r)}`);l(n,`data-label`,a),l(n,`data-state`,i),l(n,`data-color`,r<0?`danger`:null),e.type===`input`&&a&&Pr(t,a)}!kr&&t instanceof HTMLTextAreaElement&&(t.style.setProperty(`--_ds-field-sizing`,`auto`),t.style.setProperty(`--_ds-field-sizing`,`${t.scrollHeight}px`))},Pr=s((e,t)=>{document.activeElement===e&&ee(t)},Ar),Fr=e=>e.getAttribute(`data-color`)!==`success`,Ir=e=>e instanceof HTMLElement&&`validity`in e&&!(e instanceof HTMLButtonElement)&&e.type!==`hidden`;var Lr=class extends o{connectedCallback(){Er.add(this),Mr()}disconnectedCallback(){Er.delete(this)}};b.define(`ds-field`,Lr),m(`field`,()=>[f(document,`input`,Nr,r),g(document,Mr,{attributeFilter:[`data-field`,`data-limit`,`hidden`,`value`,Tr],attributes:!0,childList:!0,subtree:!0})]);let Rr=`aria-label`,zr=`data-current`,Br=`data-total`,Vr=`data-href`,Hr=({current:e=1,total:t=10,show:n=7})=>({prev:e>1?e-1:0,next:e<t?e+1:0,pages:Gr(e,t,n).map((t,n)=>({current:t===e&&`page`,key:`key-${t}-${n}`,page:t}))});var Ur=class extends o{_unmutate;_render;static get observedAttributes(){return[Rr,zr,Br,Vr]}connectedCallback(){let e=l(this,Br),t=l(this,zr);t&&!e&&c(`Missing ${Br} attribute on:`,this),e&&!t&&c(`Missing ${zr} attribute on:`,this),l(this,Rr,d(this,Rr)),l(this,`role`,`navigation`),this._render=s(()=>Wr(this),0),this._unmutate=g(this,this._render,{childList:!0,subtree:!0})}attributeChangedCallback(){this._render?.()}disconnectedCallback(){this._unmutate?.(),this._unmutate=this._render=void 0}};let Wr=e=>{let t=Number(l(e,zr)),n=Number(l(e,Br));if(t&&n){let r=e.querySelectorAll(`button,a`),i=r.length-2,a=l(e,Vr),{next:o,prev:s,pages:c}=Hr({current:t,total:n,show:i});r.forEach((e,t)=>{let n=t?r[t+1]?c[t-1]?.page:o:s;l(e,`aria-current`,c[t-1]?.current?`true`:null),l(e,`aria-label`,`${n??`hidden`}`),l(e,`role`,n?null:`none`),l(e,`tabindex`,n?null:`-1`),e instanceof HTMLButtonElement&&l(e,`value`,`${n}`),a&&e instanceof HTMLAnchorElement&&l(e,`href`,a.replace(`%d`,`${n}`))})}},Gr=(e,t,n=1/0)=>{let r=(n-1)/2,i=Math.max(Math.min(e-Math.floor(r),t-n+1),1),a=Math.min(Math.max(e+Math.ceil(r),n),t),o=Array.from({length:a+1-i},(e,t)=>t+i);return n>4&&i>1&&o.splice(0,2,1,0),n>3&&a<t&&o.splice(-2,2,0,t),o};b.define(`ds-pagination`,Ur);var Kr=Object.defineProperty,qr=Object.getOwnPropertySymbols,Jr=Object.prototype.hasOwnProperty,Yr=Object.prototype.propertyIsEnumerable,Xr=(e,t,n)=>t in e?Kr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zr=(e,t)=>{for(var n in t||={})Jr.call(t,n)&&Xr(e,n,t[n]);if(qr)for(var n of qr(t))Yr.call(t,n)&&Xr(e,n,t[n]);return e},Qr=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,$r=Qr&&/android/i.test(navigator.userAgent),ei=Qr&&/iPad|iPhone|iPod/.test(navigator.userAgent);Qr&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var ti=`outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color`,ni=typeof HTMLElement>`u`?class{}:HTMLElement;function q(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var ri=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},ii=(e,...t)=>ri(`add`,e,t),ai=(e,...t)=>ri(`remove`,e,t),oi=new WeakMap,si=(e,t)=>{if(t===void 0)return oi.get(e);try{oi.get(e).disconnect(),oi.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),oi.set(e,n)}},ci=e=>{var t;let n=e.key===` `||e.key===`Enter`;return n&&((t=e.preventDefault)==null||t.call(e)),n&&e.target instanceof HTMLElement&&e.target.dispatchEvent(new MouseEvent(`click`,e)),n},li=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},ui=0,di=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++ui).toString(32)}`,e.id):``,J=(e,t,n)=>{let r=document.createElement(e);if(t&&(r[e===`style`?`textContent`:`innerHTML`]=t),n)for(let[e,t]of Object.entries(n))q(r,e,t);return r},fi={define:(e,t)=>!Qr||window.customElements.get(e)||window.customElements.define(e,t)},pi=e=>{let t=q(e,`aria-label`)||``;return[...(q(e,`aria-labelledby`)?.trim().split(/\s+/)||[]).map(e=>document.getElementById(e)),...Array.from(e.labels||[])].reduce((e,t)=>e||(t?.innerText)?.trim()||``,t)},Y,mi=0,hi=e=>{Y||(Y=J(`div`),Y.style.cssText=`position:fixed;overflow:hidden;width:1px;white-space:nowrap`,q(Y,`aria-live`,`assertive`)),Y.isConnected||document.body.append(Y),e&&(Y.textContent=`${e}${mi++%2?`\xA0`:``}`)},gi=(e,t,n=``)=>{var r;let i={bubbles:!0,composed:!0,data:t,inputType:n},a=HTMLInputElement.prototype;e.dispatchEvent(new InputEvent(`beforeinput`,i)),(r=Object.getOwnPropertyDescriptor(a,`value`)?.set)==null||r.call(e,t),e.dispatchEvent(new InputEvent(`input`,i)),e.dispatchEvent(new Event(`change`,{bubbles:!0}))},_i=!1,vi=e=>(e?.type===`mouseup`&&(_i=!1),e?.type===`mousedown`&&(_i=!0,ii(document,`mouseup`,vi,{once:!0})),_i),yi=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,bi=`:host(:not([hidden])) { display: block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) } /* Must be display block in Safari to allow focus inside */
|
|
6
|
+
::slotted([role="option"][hidden]) { display: none !important }`,lr=ir(cr),ur,dr=0,fr=Ln||In,pr=`click,focusout,input,keydown,mousedown,mouseup`,mr=`focus,focusin,blur,focusout`,hr={singular:`%d hit`,plural:`%d hits`},gr=class extends Vn{constructor(){super(),this._texts=Pn({},hr),this._value=``,this._of=`/`,Gn(this,cr)}static get observedAttributes(){return[`id`,...Object.keys(hr).map(e=>`data-sr-${e}`)]}connectedCallback(){this.hidden=!0,this._root=Jn(this),W(this,`role`,`listbox`),W(this,`tabindex`,`-1`),Un(this._root,`focusin`,this),Un(this._root,`focus`,this,!0),qn(this,{attributeFilter:[`disabled`,`hidden`,`label`,`value`],attributes:!0,characterData:!0,childList:!0,subtree:!0}),setTimeout(()=>this.attributeChangedCallback())}disconnectedCallback(){Wn(this._root||this,`focus`,this,!0),Wn(this._root||this,`focusin`,this),qn(this,!1),yr(this),this._root=void 0}attributeChangedCallback(e,t,n){let r=e?.split(`data-sr-`)[1],i=`input[list="${this.id}"]`;if(hr[r])this._texts[r]=n||hr[r];else if(this._root){this._input&&br(this,this._input);for(let e of this._root.querySelectorAll(i))br(this,e)}}handleEvent(e){let{target:t,type:n}=e;e.defaultPrevented||(n===`click`&&wr(this,e),(n===`focus`||n===`focusin`)&&xr(this,e),(n===`blur`||n===`focusout`)&&Sr(this,e),n===`keydown`&&Tr(this,e),n===`mousedown`&&this.contains(t)&&rr(e),(n===`mutation`||n===`input`)&&(clearTimeout(dr),dr=setTimeout(Er,0,this,e)))}get options(){if(!this._options){let e=this.querySelector(`[role="option"],option`)?.nodeName;e&&(this._options=this.getElementsByTagName(e))}return this._options||this.getElementsByTagName(`option`)}},_r=e=>e?.disabled||e?.readOnly||!1,vr=(e,t)=>{var n;if(e.hidden!==t)return;e.hidden=_r(e?._input)||!t,(n=qn(e))==null||n.takeRecords();let r=e.isConnected&&e.popover&&e._input?.isConnected&&e._input?.popoverTargetElement===e;e._input&&br(e,e._input,t),r&&W(e,`popover`,`manual`),r&&e.togglePopover(t),t&&Er(e)},yr=e=>{e._input&&=(Wn(e._input||e,mr,e),Wn(e._root||e,pr,e),vr(e,!1),void 0)},br=(e,t,n=!1)=>{e.popover&&W(t,`popovertarget`,Xn(e)),Un(t,mr,e,!0),W(t,`aria-autocomplete`,`list`),W(t,`aria-controls`,Xn(e)),W(t,`aria-expanded`,`${!fr||n}`),W(t,`autocomplete`,`off`),W(t,`role`,_r(t)?null:`combobox`)},xr=(e,t)=>{let n=t.target instanceof HTMLInputElement;n&&t.isTrusted&&t.stopImmediatePropagation(),e._input!==t.target&&n&&t.target.list===e&&(e._input&&yr(e),e._input=t.target,e._input.dispatchEvent(new FocusEvent(`focus`)),e._input.dispatchEvent(new FocusEvent(`focusin`,{bubbles:!0})),W(e,Rn,Xn(e._input.labels?.[0])),Un(e._root||e,pr,e),vr(e,W(e._input,`inputmode`)!==`none`),er())},Sr=(e,t)=>{!In&&!rr()&&e._input&&setTimeout(Cr,0,e),t.target===e._input&&t.isTrusted&&t.stopImmediatePropagation()},Cr=e=>{let t=e._root?.activeElement||null,n=e._input;n&&n!==t&&!e.contains(t)&&(n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:t})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:t})),yr(e))},wr=(e,{target:t})=>{var n;if(!e._input||e._input===t)return vr(e,!0);for(let r of e.options)if(r.contains(t))return W(e,`aria-multiselectable`)!==`true`&&((n=e._input)==null||n.focus(),vr(e,!1)),tr(e._input,r.value);In&&Cr(e)},Tr=(e,t)=>{var n;let{key:r,target:i,altKey:a,ctrlKey:o,shiftKey:s,metaKey:c}=t,l=r===`Escape`||r===`Esc`;if(a||o||c||s||r===`Tab`)return;l&&!e.hidden&&t?.preventDefault(),vr(e,!l);let u=[...e.options].filter(e=>W(e,`aria-hidden`)!==`true`&&e.offsetHeight),d=u.indexOf(i),f=-1;if(r===`ArrowDown`&&(f=(d+1)%u.length),r===`ArrowUp`&&(f=(~d?d:u.length)-1),~d&&((r===`Home`||r===`PageUp`)&&(f=0),(r===`End`||r===`PageDown`)&&(f=u.length-1),r===`Enter`))return u[d].click(),t.preventDefault();if(u[f])for(let e of u)e.tabIndex=-1;u[f]&&t.preventDefault(),(n=u[f]||e._input)==null||n.focus(),!u[f]&&r===`ArrowUp`&&setTimeout(()=>e._input?.setSelectionRange(999,999))},Er=(e,t)=>{let{_texts:n,_root:r,_input:i,options:a}=e,o=i?.value.toLowerCase().trim()||``,s=!e.hasAttribute(`data-nofilter`),c=[],l=[];for(let e of a)(e.disabled||e.hidden||s&&!e.label.toLowerCase().includes(o)?c:l).push(e);for(let e of c)W(e,`aria-hidden`,`true`);for(let e of l)W(e,`aria-hidden`,`false`);let u=l.length;clearTimeout(ur),t?.type===`input`&&o!==e._value&&(ur=setTimeout(()=>{let t=`${!u&&e.innerText.trim()||`${n[u===1?`singular`:`plural`]}`.replace(`%d`,`${u}`)}`;!e.hidden&&r?.activeElement===i&&er(t),e._value=o},1e3));let d=0;if(Ln)for(let t of l)W(t,`title`,`${++d} ${e._of} ${u}`)};Fn&&Object.defineProperty(HTMLInputElement.prototype,`list`,{configurable:!0,enumerable:!0,get(){return Jn(this).getElementById(W(this,`list`)||``)}}),Qn.define(`u-datalist`,gr);let Dr=`aria-label`;var Or=class extends o{_items;_label=null;_unresize;_unmutate;static get observedAttributes(){return[Dr]}connectedCallback(){let e=s(()=>kr(this),100);this._label=f(this,Dr),this._items=this.getElementsByTagName(`a`),this._unresize=p(window,`resize`,e),this._unmutate=g(this,kr,{childList:!0,subtree:!0})}attributeChangedCallback(e,t,n){!this._unmutate||!n||(this._label=n,kr(this))}disconnectedCallback(){this._unresize?.(),this._unmutate?.(),this._unresize=this._unmutate=this._items=void 0}};let kr=e=>{let t=e._items?.[e._items.length-1],n=t?.parentElement===e?null:t,r=!n?.offsetHeight;l(e,`role`,r?null:`navigation`),l(e,Dr,r?null:e._label);for(let t of e._items||[])l(t,`aria-current`,t===n?`page`:null)};v.define(`ds-breadcrumbs`,Or);var Ar=class extends o{_unmutate;connectedCallback(){p(this,`animationend`,this,r),l(this,`tabindex`,`-1`),this._unmutate=g(this,jr,{childList:!0,subtree:!0}),this.focus()}handleEvent({target:e}){e===this&&this.focus()}disconnectedCallback(){m(this,`animationend`,this,r),this._unmutate?.(),this._unmutate=void 0}};let jr=e=>{let t=e.querySelector(`h2,h3,h4,h5,h6`);t&&l(e,`aria-labelledby`,b(t))};v.define(`ds-error-summary`,Ar);let Mr=`aria-invalid`,Nr=`aria-describedby`,Pr=`data-indeterminate`,Fr=a()?800:200,Ir=new WeakMap,Lr=new Map,Rr=new WeakSet,zr=(e,t=[])=>{for(let{target:e}of t){let t=e instanceof HTMLFieldSetElement;for(let[n]of Lr)(t?e.contains(n):n.contains(e))&&Br(n)}},Br=e=>{let t=[],n=[],r=Lr.get(e)||[],i,a,o=!1,s=!1;for(let r of e.getElementsByTagName(`*`))if(r instanceof HTMLLabelElement&&t.push(r),!r.hidden)if(Gr(r))i?c(`Fields should only have one input element. Use <fieldset> to group multiple fields:`,e):i=r;else{let e=r.getAttribute(`data-field`);e===`counter`&&(a=r),e===`validation`?(n.unshift(b(r)),o=!0,s||=Wr(r)):e&&n.push(b(r))}if(!i)return;a&&Ir.set(i,a);for(let e of t)l(e,`for`,b(i));let u=e.closest(`fieldset`)?.querySelector(`:scope > [data-field="validation"]`);u&&!u?.hidden&&(o=!0,s||=Wr(u),n.unshift(b(u)));let d=l(i,Pr);d&&(i.indeterminate=d===`true`),(i.type===`radio`||i.type===`checkbox`)&&l(e,`data-clickdelegatefor`,b(i));let f=(l(i,Nr)?.trim().split(/\s+/))?.filter(e=>!r.includes(e))||[];l(i,Nr,[...n,...f].join(` `)||null),Lr.set(e,n);let p=Rr.has(i);o&&!p&&!i.hasAttribute(Mr)?(l(i,Mr,`true`),Rr.add(i)):!o&&p&&(l(i,Mr,null),Rr.delete(i)),Hr(i)},Vr={over:`%d tegn for mye`,under:`%d tegn igjen`},Hr=e=>{let t=e.target||e,n=Ir.get(t);if(n?.isConnected){let r=(Number(l(n,`data-limit`))||0)-t.value.length,i=r<0?`over`:`under`,a=(f(n,`data-${i}`)||Vr[i])?.replace(`%d`,`${Math.abs(r)}`);l(n,`data-label`,a),l(n,`data-state`,i),l(n,`data-color`,r<0?`danger`:null),e.type===`input`&&a&&Ur(t,a)}t instanceof HTMLTextAreaElement&&(t.style.setProperty(`--_ds-field-sizing`,`auto`),t.style.setProperty(`--_ds-field-sizing`,`${t.scrollHeight}px`))},Ur=s((e,t)=>{document.activeElement===e&&C(t)},Fr),Wr=e=>e.getAttribute(`data-color`)!==`success`,Gr=e=>e instanceof HTMLElement&&`validity`in e&&!(e instanceof HTMLButtonElement)&&e.type!==`hidden`;var Kr=class extends o{connectedCallback(){Lr.set(this,[]),Br(this)}disconnectedCallback(){Lr.delete(this)}};v.define(`ds-field`,Kr),h(`field`,()=>[p(document,`input`,Hr,r),g(document,zr,{attributeFilter:[`data-field`,`data-limit`,`hidden`,`id`,`value`,Pr],attributes:!0,childList:!0,subtree:!0})]);let qr=`aria-label`,Jr=`data-current`,Yr=`data-total`,Xr=`data-href`,Zr=({current:e=1,total:t=10,show:n=7})=>({prev:e>1?e-1:0,next:e<t?e+1:0,pages:ei(e,t,n).map((t,n)=>({current:t===e&&`page`,key:`key-${t}-${n}`,page:t}))});var Qr=class extends o{_unmutate;_render;static get observedAttributes(){return[qr,Jr,Yr,Xr]}connectedCallback(){let e=l(this,Yr),t=l(this,Jr);t&&!e&&c(`Missing ${Yr} attribute on:`,this),e&&!t&&c(`Missing ${Jr} attribute on:`,this),l(this,qr,f(this,qr)),l(this,`role`,`navigation`),this._unmutate=g(this,$r,{childList:!0,subtree:!0})}attributeChangedCallback(){this._unmutate&&$r(this)}disconnectedCallback(){this._unmutate?.(),this._unmutate=this._render=void 0}};let $r=e=>{let t=Number(l(e,Jr)),n=Number(l(e,Yr));if(t&&n){let r=e.querySelectorAll(`button,a`),i=r.length-2,a=l(e,Xr),{next:o,prev:s,pages:c}=Zr({current:t,total:n,show:i});r.forEach((e,t)=>{let n=t?r[t+1]?c[t-1]?.page:o:s;l(e,`aria-current`,c[t-1]?.current?`true`:null),l(e,`aria-label`,`${n??`hidden`}`),l(e,`role`,n?null:`none`),l(e,`tabindex`,n?null:`-1`),e instanceof HTMLButtonElement&&l(e,`value`,`${n}`),a&&e instanceof HTMLAnchorElement&&l(e,`href`,a.replace(`%d`,`${n}`))})}},ei=(e,t,n=1/0)=>{let r=(n-1)/2,i=Math.max(Math.min(e-Math.floor(r),t-n+1),1),a=Math.min(Math.max(e+Math.ceil(r),n),t),o=Array.from({length:a+1-i},(e,t)=>t+i);return n>4&&i>1&&o.splice(0,2,1,0),n>3&&a<t&&o.splice(-2,2,0,t),o};v.define(`ds-pagination`,Qr);var ti=Object.defineProperty,ni=Object.getOwnPropertySymbols,ri=Object.prototype.hasOwnProperty,ii=Object.prototype.propertyIsEnumerable,ai=(e,t,n)=>t in e?ti(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oi=(e,t)=>{for(var n in t||={})ri.call(t,n)&&ai(e,n,t[n]);if(ni)for(var n of ni(t))ii.call(t,n)&&ai(e,n,t[n]);return e},si=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,ci=si&&/android/i.test(navigator.userAgent),li=si&&/iPad|iPhone|iPod/.test(navigator.userAgent);si&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var ui=`outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color`,di=typeof HTMLElement>`u`?class{}:HTMLElement;function K(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var fi=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},pi=(e,...t)=>fi(`add`,e,t),mi=(e,...t)=>fi(`remove`,e,t),hi=new WeakMap,gi=(e,t)=>{if(t===void 0)return hi.get(e);try{hi.get(e).disconnect(),hi.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),hi.set(e,n)}},_i=e=>{var t;let n=e.key===` `||e.key===`Enter`;return n&&((t=e.preventDefault)==null||t.call(e)),n&&e.target instanceof HTMLElement&&e.target.dispatchEvent(new MouseEvent(`click`,e)),n},vi=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},yi=0,bi=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++yi).toString(32)}`,e.id):``,q=(e,t,n)=>{let r=document.createElement(e);if(t&&(r[e===`style`?`textContent`:`innerHTML`]=t),n)for(let[e,t]of Object.entries(n))K(r,e,t);return r},xi={define:(e,t)=>!si||window.customElements.get(e)||window.customElements.define(e,t)},Si=e=>{let t=K(e,`aria-label`)||``;return[...(K(e,`aria-labelledby`)?.trim().split(/\s+/)||[]).map(e=>document.getElementById(e)),...Array.from(e.labels||[])].reduce((e,t)=>e||(t?.innerText)?.trim()||``,t)},J,Ci=0,wi=e=>{J||(J=q(`div`),J.style.cssText=`position:fixed;overflow:hidden;width:1px;white-space:nowrap`,K(J,`aria-live`,`assertive`)),J.isConnected||document.body.append(J),e&&(J.textContent=`${e}${Ci++%2?`\xA0`:``}`)},Ti=(e,t,n=``)=>{var r;let i={bubbles:!0,composed:!0,data:t,inputType:n},a=HTMLInputElement.prototype;e.dispatchEvent(new InputEvent(`beforeinput`,i)),(r=Object.getOwnPropertyDescriptor(a,`value`)?.set)==null||r.call(e,t),e.dispatchEvent(new InputEvent(`input`,i)),e.dispatchEvent(new Event(`change`,{bubbles:!0}))},Ei=!1,Di=e=>(e?.type===`mouseup`&&(Ei=!1),e?.type===`mousedown`&&(Ei=!0,pi(document,`mouseup`,Di,{once:!0})),Ei),Oi=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,ki=`:host(:not([hidden])) { display: block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) } /* Must be display block in Safari to allow focus inside */
|
|
7
7
|
:host(:not([data-multiple])) ::slotted(data),
|
|
8
8
|
:host([data-multiple="false"]) ::slotted(data) { display: none } /* Hide data if not multiple */
|
|
9
9
|
[role="listbox"] { position: absolute } /* Avoid affecting CSS like flex on the <u-combobox> */
|
|
@@ -11,5 +11,7 @@
|
|
|
11
11
|
::slotted(del) { text-decoration: none }
|
|
12
12
|
::slotted(data:not([hidden])) { display: inline-block; pointer-events: none }
|
|
13
13
|
::slotted(data)::after { content: '\\00D7'; content: '\\00D7' / ''; padding-inline: .5ch; pointer-events: auto; cursor: pointer }
|
|
14
|
-
::slotted(data:focus) { ${ti} }`;yi(bi);var xi=`beforeinput,blur,focus,click,input,keydown,mousedown`,Si={once:!0,capture:!0,passive:!0},Ci=`false`,wi=$r||ei,Ti=``.repeat(5),Ei=`deleteContentBackward`,Di=`insertText`,Oi=`\xA0`,ki={added:`Added`,empty:`No selected`,found:`Navigate left to find %d selected`,invalid:`Invalid value`,items:`Selected`,of:`of`,remove:`Press to remove`,removed:`Removed`},Ai=class extends ni{constructor(){super(),this._item=``,this._speak=``,this._texts=Zr({},ki),this._value=``,this.shadowRoot||this.attachShadow({mode:`open`}).append(J(`slot`,null,{"aria-orientation":`horizontal`,tabindex:`-1`,role:`listbox`,name:`items`}),J(`slot`),J(`div`,`<div role="option" tabindex="-1"></div>`,{"aria-hidden":`true`,role:`listbox`}),J(`style`,bi))}static get observedAttributes(){return Object.keys(ki).map(e=>`data-sr-${e}`)}connectedCallback(){this._root=li(this),ii(this,xi,this,!0),si(this,{attributeFilter:[`value`,`id`,`role`],attributes:!0,characterData:!0,childList:!0,subtree:!0}),setTimeout(Ni,0,this),setTimeout(Ii,0,this)}attributeChangedCallback(e,t,n){let r=e.split(`data-sr-`)[1];ki[r]&&(this._texts[r]=n||ki[r])}disconnectedCallback(){si(this,!1),ai(this,xi,this,!0),this._items=this._clear=this._focus=this._control=void 0,this._list=this._options=this._root=this._form=void 0}handleEvent(e){let t=e.target;Mi(this)||(e.type===`beforeinput`&&(this._value=t?.value||``),e.type===`blur`&&zi(this),e.type===`click`&&Vi(this,e),e.type===`focus`&&Ri(this,e),e.type===`input`&&Hi(this,e),e.type===`keydown`&&Ui(this,e),e.type===`mousedown`&&vi(e),e.type===`mutation`&&Ni(this,e))}get multiple(){return(q(this,`data-multiple`)??Ci)!==Ci}set multiple(e){q(this,`data-multiple`,e?``:null)}get creatable(){return(q(this,`data-creatable`)??Ci)!==Ci}set creatable(e){q(this,`data-creatable`,e?``:null)}get control(){return this._control?.isConnected||(this._control=this.querySelector(`input`)),this._control}get list(){return this._list?.isConnected||(this._list=this.querySelector(`datalist,[role="listbox"]`)),this._list}get clear(){return this._clear?.isConnected||(this._clear=this.querySelector(`del`)),this._clear}get items(){return this._items||=this.getElementsByTagName(`data`),this._items}get options(){if(!this._options){let e=this.list?.querySelector(`[role="option"],option`)?.nodeName;e&&(this._options=this.getElementsByTagName(e))}return this._options}get values(){return[...this.items].map(({value:e})=>e)}},X=e=>(e?.textContent)?.trim()||``,ji=e=>e instanceof HTMLDataElement,Mi=({control:e})=>e?.disabled||e?.readOnly||!1,Ni=(e,t)=>{var n;let{_focus:r,_texts:i,items:a,control:o,list:s,multiple:c}=e;if(!o)return;let l=pi(o),u=l.endsWith(Ti)?q(o,`data-label`):l;q(o,`data-label`,u);let d=`${u}${c?`, ${a.length?i.found.replace(`%d`,`${a.length}`):i.empty}`:``}`,f=[];for(let{addedNodes:e,removedNodes:n}of t?.detail||[]){for(let t of e)ji(t)&&f.unshift(t);for(let e of n)ji(e)&&f.push(e)}let p=c?f.length===1:f[0]===r;if(r&&p){let t=q(o,`aria-expanded`),n=q(o,`inputmode`),a=ji(r)?o:r,s=!f[0].isConnected;e._speak=`${i[s?`removed`:`added`]} ${X(f[0])}, `,(wi||r===o)&&hi(e._speak),o!==a&&(wi&&q(o,`aria-expanded`,null),wi&&q(o,`inputmode`,`none`),d=Oi,o.focus()),setTimeout(()=>{var r;q(o,`aria-expanded`,t),q(o,`inputmode`,s?`none`:n),(r=a?.focus)==null||r.call(a),q(o,`inputmode`,n),e._speak=``,wi?setTimeout(Ni,100,e):ii(e,`blur`,()=>Ni(e),Si)},100)}let m=0,h=e.querySelector(`select`),g=Mi(e)?``:i.remove,_=e.shadowRoot?.firstElementChild;_&&q(_,`aria-label`,i.items);for(let t of a){let n=h?.options[m++],r=X(t),o=t.value||r;q(t,`aria-label`,`${e._speak}${r}, ${g}`),q(t,`aria-selected`,`true`),q(t,`role`,`option`),q(t,`slot`,`items`),q(t,`tabindex`,`-1`),q(t,`value`,o),n?Object.assign(n,{textContent:r,value:o}):h?.appendChild(new Option(r,o,!0,!0)),ei&&q(t,`title`,`${m} ${i.of} ${a.length}`)}h&&q(h,`multiple`,c?``:null);for(let e of[...h?.options||[]].slice(m))e.remove();!c&&m>1&&console.warn(e,` Multiple <data> found in single mode.`),s&&(q(s,`aria-multiselectable`,`${c}`),q(o,`list`,di(s)),q(o,`aria-label`,`${e._speak}${d}${Ti}`),s.hasAttribute(`popover`)&&(q(o,`popovertarget`,di(s)),q(s,`popover`,`manual`)),s._of=i.of);let v=X(a[0]);v!==e._item&&Ii(e),e._item=v,Pi(e),Fi(e),(n=si(e))==null||n.takeRecords()},Pi=e=>{e.clear&&q(e.clear,`role`,`button`),e.clear&&(e.clear.hidden=!e.control?.value||Mi(e))},Fi=e=>{let{_speak:t,options:n=[],values:r}=e;for(let e of n){let n=q(e,`value`)??X(e);q(e,`aria-label`,t?`${t}${X(e)}`:null),q(e,`selected`,r.includes(n)?``:null)}},Ii=e=>{let{multiple:t,control:n,items:r}=e,i=X(r[0]);!t&&n&&i!==n.value&&gi(n,i,i?Di:Ei)},Li=(e,t=!0)=>{let{_texts:n,options:r=[],creatable:i,control:a,items:o,multiple:s}=e,c=(a?.value)?.trim()||``,l=c.toLowerCase()||null,u=[...r].find(e=>(q(e,`label`)||X(e)).trim().toLowerCase()===l),d={bubbles:!0,cancelable:!0,detail:u};if(e.dispatchEvent(new CustomEvent(`comboboxbeforematch`,d))||(u=[...r].find(e=>e.selected)),t)return Fi(e),u?Z(e,u,!1):i&&c?Z(e,{value:c},!1):(!s&&!c&&o[0]?Z(e,o[0]):Ii(e),hi(n.invalid));for(let e of r)e.selected=e===u},Z=(e,t,n=!0)=>{var r;let{control:i,items:a,multiple:o}=e,s=J(`data`,t.label||t.value,{value:t.value}),c=[...a].find(e=>e.value===t.value),l={bubbles:!0,cancelable:!0,detail:c||s};if(c&&!n)return Ii(e);if(c===li(e)?.activeElement&&((r=e.shadowRoot?.querySelector(`[role="option"]`))==null||r.focus()),e.dispatchEvent(new CustomEvent(`comboboxbeforeselect`,l))){if(!o)for(let e of[...a])e.remove();c?c.remove():i?.insertAdjacentElement(`beforebegin`,s),e.dispatchEvent(new CustomEvent(`comboboxafterselect`,l))}},Ri=(e,{target:t})=>{let{_form:n,control:r,multiple:i}=e;t instanceof HTMLElement&&(e._focus=t),i&&n===void 0&&r&&t===r&&(e._form=q(r,`form`),q(r,`form`,`#`)),hi()},zi=e=>vi()||setTimeout(Bi,0,e),Bi=e=>{let{_focus:t,_root:n,_form:r,multiple:i,control:a}=e;!t||e.contains(n?.activeElement)||(i||Li(e),r&&a&&q(a,`form`,r),e._focus=e._form=void 0)},Vi=(e,t)=>{let{clientX:n,clientY:r,target:i}=t,{clear:a,control:o,items:s}=e;if(a?.contains(i))return o&&gi(o,``,Ei),o?.focus();for(let t of s){let{top:a,right:o,bottom:s,left:c}=t.getBoundingClientRect();if(t.contains(i))return Z(e,t);if(r>=a&&r<=s&&n>=c&&n<=o)return t.focus()}i===e&&o?.focus()},Hi=(e,t)=>{let{options:n=[],control:r,multiple:i}=e,a=(r?.value)?.trim()||``;if(t instanceof InputEvent?!t.inputType||t.inputType===`insertReplacementText`:a){t.stopImmediatePropagation(),r&&(r.value=e._value);for(let t of n)if(t.value&&t.value===a)return Z(e,t,i)}else i||Li(e,!1);Pi(e)},Ui=(e,t)=>{var n;let{clear:r,control:i,items:a}=e,{key:o,repeat:s,target:c}=t,l=i&&i===c,u=l&&i.selectionEnd,d=t.ctrlKey||t.metaKey||t.shiftKey||t.key===`Alt`,f=l?a.length:[...a].indexOf(c);if(l&&o===`Tab`&&!t.shiftKey&&r&&!r.hidden&&(t.preventDefault(),r.tabIndex=0,r.focus(),ii(r,`blur`,()=>q(r,`tabindex`,null),Si)),!(!l&&ci(t)||f===-1||d)){if(o===`ArrowRight`&&!l)f+=1;else if(o===`ArrowLeft`&&!u)--f;else if(o===`Enter`&&l)return Li(e);else if(o===`Backspace`&&!u){if(t.preventDefault(),!s&&a[f])return Z(e,a[f]);l&&--f}else return l||i?.focus();t.preventDefault(),(n=a[Math.max(0,f)]||i)==null||n.focus()}};fi.define(`u-combobox`,Ai);var Wi=class extends Ai{_unmutate;_render;connectedCallback(){super.connectedCallback(),this._render=()=>Gi(this),this._unmutate=g(this,this._render,{childList:!0}),f(this,`toggle`,Ki,r)}disconnectedCallback(){super.disconnectedCallback(),this._unmutate?.(),this._unmutate=this._render=void 0,p(this,`toggle`,Ki,r)}};let Gi=({control:e,list:t})=>{e&&!e.placeholder&&l(e,`placeholder`,` `),e&&l(e,`popovertarget`,S(t)||null),t&&l(t,`popover`,`manual`)},Ki=e=>{let t=e.currentTarget,n=e.newState===`open`&&t.control;n&&t.list?.dispatchEvent(new CustomEvent(`ds-toggle-source`,{detail:n}))};b.define(`ds-suggestion`,Wi);var qi=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,Ji=qi&&/android/i.test(navigator.userAgent);qi&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var Yi=`${Ji?`data`:`aria`}-labelledby`,Xi=`:host(:not([hidden])) { display: block }`,Zi=typeof HTMLElement>`u`?class{}:HTMLElement;function Q(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var Qi=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},$i=(e,...t)=>Qi(`add`,e,t),ea=(e,...t)=>Qi(`remove`,e,t),ta=(e,t)=>e.shadowRoot||e.attachShadow({mode:`open`}).append(ca(`slot`),ca(`style`,t)),na=new WeakMap,ra=(e,t)=>{if(t===void 0)return na.get(e);try{na.get(e).disconnect(),na.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),na.set(e,n)}},ia=e=>{var t;let n=e.key===` `||e.key===`Enter`;return n&&((t=e.preventDefault)==null||t.call(e)),n&&e.target instanceof HTMLElement&&e.target.dispatchEvent(new MouseEvent(`click`,e)),n},aa=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},oa=0,sa=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++oa).toString(32)}`,e.id):``,ca=(e,t,n)=>{let r=document.createElement(e);return t&&(r[e===`style`?`textContent`:`innerHTML`]=t),r},la={define:(e,t)=>!qi||window.customElements.get(e)||window.customElements.define(e,t)},ua=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,da=Xi,fa=Xi,pa=Xi,ma=`:host(:not([hidden])) { display: inline-block; cursor: pointer }:host([aria-disabled="true"]) { cursor: default }`;ua(da),ua(fa),ua(ma),ua(pa);var ha=`aria-controls`,$=`aria-selected`,ga=`data-utabs`,_a=class extends Zi{constructor(){super(),ta(this,da)}connectedCallback(){Q(this,ga,``)}get tabList(){return Ca(`tablist`,this)[0]||null}get selectedIndex(){return Ta(this.tabs)}set selectedIndex(e){Oa(this.tabs[e])}get tabs(){return Ca(`tab`,this)}get panels(){return Ca(`tabpanel`,this)}},va=class extends Zi{constructor(){super(),ta(this,fa)}connectedCallback(){Q(this,`role`,`tablist`),$i(this,`click,keydown`,this),ra(this,{childList:!0}),requestAnimationFrame(()=>this.handleEvent())}disconnectedCallback(){ea(this,`click,keydown`,this),ra(this,!1)}handleEvent(e){var t,n;if(!e||e.type===`mutation`)return this.tabs[Math.max(this.selectedIndex,0)]?.setAttribute($,`true`);let{key:r}=e,i=[...this.tabs],a=i.findIndex(t=>t.contains(e.target)),o=a;if(!(e.defaultPrevented||a===-1)&&(e.type===`click`&&Oa(i[a]),e.type===`keydown`&&!ia(e))){if(r===`ArrowDown`||r===`ArrowRight`)o=(a+1)%i.length;else if(r===`ArrowUp`||r===`ArrowLeft`)o=(a||i.length)-1;else if(r===`End`)o=i.length-1;else if(r===`Home`)o=0;else if(r===`Tab`)o=Ta(i);else return;setTimeout(()=>{Q(i[a],`tabindex`,`-1`),Q(i[o],`tabindex`,`0`)}),r!==`Tab`&&(e.preventDefault(),(n=(t=i[o]).focus)==null||n.call(t))}}get tabsElement(){return Ea(this)}get tabs(){return Da(this)}get selectedIndex(){return Ta(this.tabs)}set selectedIndex(e){Oa(this.tabs[e])}},ya=!1,ba=class extends Zi{static get observedAttributes(){return[`id`,$,ha]}constructor(){super(),ta(this,ma)}connectedCallback(){Q(this,`role`,`tab`),Q(this,`tabindex`,this.selected?`0`:`-1`)}attributeChangedCallback(){if(!ya&&this.selected&&this.tabList){ya=!0;let e=this.tabList?Da(this.tabList):[],t=Ca(`tabpanel`,this.tabsElement||this),n=wa(this,t[[...e].indexOf(this)]);n&&Q(n,Yi,sa(this));let r=0;for(let i of e){let e=wa(i,t[r++]);Q(i,`tabindex`,i===this?`0`:`-1`),Q(i,$,`${i===this}`),e?.id&&Q(i,ha,e.id),e&&(e.hidden=e!==n)}ya=!1}}get tabsElement(){return Ea(this)}get tabList(){let e=this.parentElement;return e?.getAttribute(`role`)===`tablist`?e:null}get selected(){return Q(this,$)===`true`}set selected(e){Q(this,$,`${!!e}`)}get index(){let e=this.tabList;return e?[...Da(e)].indexOf(this):0}get panel(){return wa(this)}},xa=!1,Sa=class extends Zi{static get observedAttributes(){return[`id`,`hidden`]}constructor(){super(),ta(this,pa)}connectedCallback(){var e;Q(this,`role`,`tabpanel`),(e=this.tabsElement?.tabList)==null||e.handleEvent(),this.attributeChangedCallback()}attributeChangedCallback(){if(xa)return;xa=!0;let e=ka(this.firstChild);this.hidden=Ta(this.tabs)===-1,Q(this,`aria-hidden`,`${this.hidden}`),Q(this,`tabindex`,this.hidden||e?null:`0`),xa=!1}get tabsElement(){return Ea(this)}get tabs(){return aa(this).querySelectorAll(`[role="tab"][${ha}="${this.id}"]`)}},Ca=(e,t)=>t.querySelectorAll(`[role="${e}"]:not(:scope [role="tabpanel"] [role="${e}"])`),wa=(e,t)=>aa(e).getElementById(Q(e,ha)||sa(t)),Ta=e=>[...e].findIndex(e=>Q(e,$)===`true`),Ea=e=>e.closest(`[${ga}]`),Da=e=>e.querySelectorAll(`:scope > [role="tab"]`),Oa=e=>e&&Q(e,`aria-disabled`)!==`true`&&Q(e,`aria-selected`,`true`),ka=e=>e instanceof Element&&!e.matches(`:disabled,[tabindex^="-"]`)&&e.matches(`[contenteditable],[controls],[href],[tabindex],input:not([type="hidden"]),select,textarea,button,summary,iframe`);la.define(`u-tabs`,_a),la.define(`u-tablist`,va),la.define(`u-tab`,ba),la.define(`u-tabpanel`,Sa);var Aa=class extends _a{},ja=class extends va{},Ma=class extends ba{},Na=class extends Sa{};b.define(`ds-tabs`,Aa),b.define(`ds-tablist`,ja),b.define(`ds-tab`,Ma),b.define(`ds-tabpanel`,Na),i()&&!t()&&n(),e.DSBreadcrumbsElement=Sr,e.DSErrorSummaryElement=wr,e.DSFieldElement=Lr,e.DSPaginationElement=Ur,e.DSSuggestionElement=Wi,e.DSTabElement=Ma,e.DSTabListElement=ja,e.DSTabPanelElement=Na,e.DSTabsElement=Aa,e.UHTMLDataListElement=ur,e.UHTMLDataListShadowRoot=rr,e.UHTMLDataListStyle=nr,e.pagination=Hr,e.setTooltipElement=vn});
|
|
14
|
+
::slotted(data:focus) { ${ui} }`;Oi(ki);var Ai=`beforeinput,blur,focus,click,input,keydown,mousedown`,ji={once:!0,capture:!0,passive:!0},Mi=`false`,Ni=ci||li,Pi=``.repeat(5),Fi=`deleteContentBackward`,Ii=`insertText`,Li=`\xA0`,Ri={added:`Added`,empty:`No selected`,found:`Navigate left to find %d selected`,invalid:`Invalid value`,items:`Selected`,of:`of`,remove:`Press to remove`,removed:`Removed`},zi=class extends di{constructor(){super(),this._item=``,this._speak=``,this._texts=oi({},Ri),this._value=``,this.shadowRoot||this.attachShadow({mode:`open`}).append(q(`slot`,null,{"aria-orientation":`horizontal`,tabindex:`-1`,role:`listbox`,name:`items`}),q(`slot`),q(`div`,`<div role="option" tabindex="-1"></div>`,{"aria-hidden":`true`,role:`listbox`}),q(`style`,ki))}static get observedAttributes(){return Object.keys(Ri).map(e=>`data-sr-${e}`)}connectedCallback(){this._root=vi(this),pi(this,Ai,this,!0),gi(this,{attributeFilter:[`value`,`id`,`role`],attributes:!0,characterData:!0,childList:!0,subtree:!0}),setTimeout(Hi,0,this),setTimeout(Gi,0,this)}attributeChangedCallback(e,t,n){let r=e.split(`data-sr-`)[1];Ri[r]&&(this._texts[r]=n||Ri[r])}disconnectedCallback(){gi(this,!1),mi(this,Ai,this,!0),this._items=this._clear=this._focus=this._control=void 0,this._list=this._options=this._root=this._form=void 0}handleEvent(e){let t=e.target;Vi(this)||(e.type===`beforeinput`&&(this._value=t?.value||``),e.type===`blur`&&Ji(this),e.type===`click`&&Xi(this,e),e.type===`focus`&&qi(this,e),e.type===`input`&&Zi(this,e),e.type===`keydown`&&Qi(this,e),e.type===`mousedown`&&Di(e),e.type===`mutation`&&Hi(this,e))}get multiple(){return(K(this,`data-multiple`)??Mi)!==Mi}set multiple(e){K(this,`data-multiple`,e?``:null)}get creatable(){return(K(this,`data-creatable`)??Mi)!==Mi}set creatable(e){K(this,`data-creatable`,e?``:null)}get control(){return this._control?.isConnected||(this._control=this.querySelector(`input`)),this._control}get list(){return this._list?.isConnected||(this._list=this.querySelector(`datalist,[role="listbox"]`)),this._list}get clear(){return this._clear?.isConnected||(this._clear=this.querySelector(`del`)),this._clear}get items(){return this._items||=this.getElementsByTagName(`data`),this._items}get options(){if(!this._options){let e=this.list?.querySelector(`[role="option"],option`)?.nodeName;e&&(this._options=this.getElementsByTagName(e))}return this._options}get values(){return[...this.items].map(({value:e})=>e)}},Y=e=>(e?.textContent)?.trim()||``,Bi=e=>e instanceof HTMLDataElement,Vi=({control:e})=>e?.disabled||e?.readOnly||!1,Hi=(e,t)=>{var n;let{_focus:r,_texts:i,items:a,control:o,list:s,multiple:c}=e;if(!o)return;let l=Si(o),u=l.endsWith(Pi)?K(o,`data-label`):l;K(o,`data-label`,u);let d=`${u}${c?`, ${a.length?i.found.replace(`%d`,`${a.length}`):i.empty}`:``}`,f=[];for(let{addedNodes:e,removedNodes:n}of t?.detail||[]){for(let t of e)Bi(t)&&f.unshift(t);for(let e of n)Bi(e)&&f.push(e)}let p=c?f.length===1:f[0]===r;if(r&&p){let t=K(o,`aria-expanded`),n=K(o,`inputmode`),a=Bi(r)?o:r,s=!f[0].isConnected;e._speak=`${i[s?`removed`:`added`]} ${Y(f[0])}, `,(Ni||r===o)&&wi(e._speak),o!==a&&(Ni&&K(o,`aria-expanded`,null),Ni&&K(o,`inputmode`,`none`),d=Li,o.focus()),setTimeout(()=>{var r;K(o,`aria-expanded`,t),K(o,`inputmode`,s?`none`:n),(r=a?.focus)==null||r.call(a),K(o,`inputmode`,n),e._speak=``,Ni?setTimeout(Hi,100,e):pi(e,`blur`,()=>Hi(e),ji)},100)}let m=0,h=e.querySelector(`select`),g=Vi(e)?``:i.remove,_=e.shadowRoot?.firstElementChild;_&&K(_,`aria-label`,i.items);for(let t of a){let n=h?.options[m++],r=Y(t),o=t.value||r;K(t,`aria-label`,`${e._speak}${r}, ${g}`),K(t,`aria-selected`,`true`),K(t,`role`,`option`),K(t,`slot`,`items`),K(t,`tabindex`,`-1`),K(t,`value`,o),n?Object.assign(n,{textContent:r,value:o}):h?.appendChild(new Option(r,o,!0,!0)),li&&K(t,`title`,`${m} ${i.of} ${a.length}`)}h&&K(h,`multiple`,c?``:null);for(let e of[...h?.options||[]].slice(m))e.remove();!c&&m>1&&console.warn(e,` Multiple <data> found in single mode.`),s&&(K(s,`aria-multiselectable`,`${c}`),K(o,`list`,bi(s)),K(o,`aria-label`,`${e._speak}${d}${Pi}`),s.hasAttribute(`popover`)&&(K(o,`popovertarget`,bi(s)),K(s,`popover`,`manual`)),s._of=i.of);let v=Y(a[0]);v!==e._item&&Gi(e),e._item=v,Ui(e),Wi(e),(n=gi(e))==null||n.takeRecords()},Ui=e=>{e.clear&&K(e.clear,`role`,`button`),e.clear&&(e.clear.hidden=!e.control?.value||Vi(e))},Wi=e=>{let{_speak:t,options:n=[],values:r}=e;for(let e of n){let n=K(e,`value`)??Y(e);K(e,`aria-label`,t?`${t}${Y(e)}`:null),K(e,`selected`,r.includes(n)?``:null)}},Gi=e=>{let{multiple:t,control:n,items:r}=e,i=Y(r[0]);!t&&n&&i!==n.value&&Ti(n,i,i?Ii:Fi)},Ki=(e,t=!0)=>{let{_texts:n,options:r=[],creatable:i,control:a,items:o,multiple:s}=e,c=(a?.value)?.trim()||``,l=c.toLowerCase()||null,u=[...r].find(e=>(K(e,`label`)||Y(e)).trim().toLowerCase()===l),d={bubbles:!0,cancelable:!0,detail:u};if(e.dispatchEvent(new CustomEvent(`comboboxbeforematch`,d))||(u=[...r].find(e=>e.selected)),t)return Wi(e),u?X(e,u,!1):i&&c?X(e,{value:c},!1):(!s&&!c&&o[0]?X(e,o[0]):Gi(e),wi(n.invalid));for(let e of r)e.selected=e===u},X=(e,t,n=!0)=>{var r;let{control:i,items:a,multiple:o}=e,s=q(`data`,t.label||t.value,{value:t.value}),c=[...a].find(e=>e.value===t.value),l={bubbles:!0,cancelable:!0,detail:c||s};if(c&&!n)return Gi(e);if(c===vi(e)?.activeElement&&((r=e.shadowRoot?.querySelector(`[role="option"]`))==null||r.focus()),e.dispatchEvent(new CustomEvent(`comboboxbeforeselect`,l))){if(!o)for(let e of[...a])e.remove();c?c.remove():i?.insertAdjacentElement(`beforebegin`,s),e.dispatchEvent(new CustomEvent(`comboboxafterselect`,l))}},qi=(e,{target:t})=>{let{_form:n,control:r,multiple:i}=e;t instanceof HTMLElement&&(e._focus=t),i&&n===void 0&&r&&t===r&&(e._form=K(r,`form`),K(r,`form`,`#`)),wi()},Ji=e=>Di()||setTimeout(Yi,0,e),Yi=e=>{let{_focus:t,_root:n,_form:r,multiple:i,control:a}=e;!t||e.contains(n?.activeElement)||(i||Ki(e),r&&a&&K(a,`form`,r),e._focus=e._form=void 0)},Xi=(e,t)=>{let{clientX:n,clientY:r,target:i}=t,{clear:a,control:o,items:s}=e;if(a?.contains(i))return o&&Ti(o,``,Fi),o?.focus();for(let t of s){let{top:a,right:o,bottom:s,left:c}=t.getBoundingClientRect();if(t.contains(i))return X(e,t);if(r>=a&&r<=s&&n>=c&&n<=o)return t.focus()}i===e&&o?.focus()},Zi=(e,t)=>{let{options:n=[],control:r,multiple:i}=e,a=(r?.value)?.trim()||``;if(t instanceof InputEvent?!t.inputType||t.inputType===`insertReplacementText`:a){t.stopImmediatePropagation(),r&&(r.value=e._value);for(let t of n)if(t.value&&t.value===a)return X(e,t,i)}else i||Ki(e,!1);Ui(e)},Qi=(e,t)=>{var n;let{clear:r,control:i,items:a}=e,{key:o,repeat:s,target:c}=t,l=i&&i===c,u=l&&i.selectionEnd,d=t.ctrlKey||t.metaKey||t.shiftKey||t.key===`Alt`,f=l?a.length:[...a].indexOf(c);if(l&&o===`Tab`&&!t.shiftKey&&r&&!r.hidden&&(t.preventDefault(),r.tabIndex=0,r.focus(),pi(r,`blur`,()=>K(r,`tabindex`,null),ji)),!(!l&&_i(t)||f===-1||d)){if(o===`ArrowRight`&&!l)f+=1;else if(o===`ArrowLeft`&&!u)--f;else if(o===`Enter`&&l)return Ki(e);else if(o===`Backspace`&&!u){if(t.preventDefault(),!s&&a[f])return X(e,a[f]);l&&--f}else return l||i?.focus();t.preventDefault(),(n=a[Math.max(0,f)]||i)==null||n.focus()}};xi.define(`u-combobox`,zi);var $i=class extends zi{_render;_unmutate;connectedCallback(){super.connectedCallback(),this._unmutate=g(this,ea,{childList:!0}),p(this,`toggle`,ta,r)}disconnectedCallback(){super.disconnectedCallback(),this._unmutate?.(),this._unmutate=this._render=void 0,m(this,`toggle`,ta,r)}};let ea=({control:e,list:t})=>{e&&!e.placeholder&&l(e,`placeholder`,` `),e&&l(e,`popovertarget`,b(t)||null),t&&l(t,`popover`,`manual`)},ta=e=>{let t=e.currentTarget,n=e.newState===`open`&&t.control;n&&t.list?.dispatchEvent(new CustomEvent(`ds-toggle-source`,{detail:n}))};v.define(`ds-suggestion`,$i);var na=()=>typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,ra=na(),ia=ra?navigator.userAgent:``,aa=/android/i.test(ia);ra&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var oa=ra&&window.CSSStyleSheet&&document.adoptedStyleSheets,sa=`:host(:not([hidden])) { display: block }`,ca=`${aa?`data`:`aria`}-labelledby`,la=typeof HTMLElement>`u`?class{}:HTMLElement,Z=(e,t,n)=>n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),ua=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.addEventListener(t,...r);return()=>da(e,...t)},da=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.removeEventListener(t,...r)},fa=(e,t)=>{let n=e.shadowRoot||e.attachShadow({mode:`open`});if(n.querySelector(`slot`)||n.append(ga(`slot`)),!n.querySelector(`style`))if(!oa)n.append(ga(`style`,null,t));else{let e=new CSSStyleSheet;e.replaceSync(t),n.adoptedStyleSheets=[e]}return n},pa=(e,t,n)=>{let r=new MutationObserver(n=>{if(!na()||!e.isConnected)return i();t(e,n)}),i=Object.assign(()=>r.disconnect(),{takeRecords:()=>r.takeRecords()});return t(e),r.observe(e,n),i},ma=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},ha=e=>{if(!e||!ra)return null;if(window.uElementsId||(window.uElementsId={}),!e.id){let t=e.nodeName.toLowerCase();window.uElementsId[t]||(window.uElementsId[t]=1),e.id=`:${t}${window.uElementsId[t]++}`}return e.id},ga=(e,t,n)=>{let r=document.createElement(e);if(n&&(r.textContent=n),t)for(let[e,n]of Object.entries(t))Z(r,e,n);return r},_a={define:(e,t)=>!na()||window.customElements.get(e)||window.customElements.define(e,t)},va=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,ya=`aria-controls`,ba=`aria-disabled`,xa=`aria-selected`,Sa=`tabindex`,Ca=sa,wa=sa,Ta=`${sa}
|
|
15
|
+
::slotted([role="tab"]:not([hidden])) { display: inline-block; cursor: pointer }
|
|
16
|
+
::slotted([role="tab"][${ba}="true"]) { cursor: default }`;va(Ca),va(Ta),va(wa);var Ea=class extends la{constructor(){super(),fa(this,Ca)}get tabList(){return this.querySelector(`[role="tablist"]:not(:scope [role="tabpanel"] [role="tablist"])`)}get selectedIndex(){let e=[...this.tabs];return e.indexOf(Pa(e))}set selectedIndex(e){$(this.tabs[e])}get tabs(){return this.querySelectorAll(`[role="tab"]:not(:scope [role="tabpanel"] [role="tab"])`)}get panels(){return this.querySelectorAll(`[role="tabpanel"]:not(:scope [role="tabpanel"] [role="tabpanel"])`)}},Da=class extends la{constructor(){super(),fa(this,Ta)}connectedCallback(){Z(this,`role`,`tablist`),ua(this,`click keydown`,this),this._umutate=pa(this,ja,{attributeFilter:[`id`,`role`,ya,xa],attributes:!0,childList:!0,subtree:!0})}disconnectedCallback(){var e;da(this,`click keydown`,this),(e=this._umutate)==null||e.call(this),this._umutate=void 0}handleEvent(e){var t,n,r,i;let{key:a,type:o,target:s}=e,c=Fa(this),l=c.findIndex(e=>e.contains(s)),u=a===` `||a===`Enter`,d=l;if(!(e.defaultPrevented||l===-1)&&(o===`click`&&$(c[l]),o===`keydown`)){if(u)return(t=e.preventDefault)==null||t.call(e),c[l].dispatchEvent(new MouseEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0}));if(a===`ArrowDown`||a===`ArrowRight`)d=(l+1)%c.length;else if(a===`ArrowUp`||a===`ArrowLeft`)d=(l||c.length)-1;else if(a===`End`)d=c.length-1;else if(a===`Home`)d=0;else if(a===`Tab`&&!Q(c[l])){let e=Pa(c);return e&&Z(e,Sa,`-1`),e&&setTimeout(()=>Z(e,Sa,`0`))}else return;(n=e.preventDefault)==null||n.call(e),(i=(r=c[d]).focus)==null||i.call(r)}}get tabsElement(){return La(this)}get tabs(){return this.querySelectorAll(`:scope > [role="tab"]`)}get selectedIndex(){let e=Fa(this);return e.indexOf(Pa(e))}set selectedIndex(e){$(this.tabs[e])}},Oa=!1,ka=class extends la{static get observedAttributes(){return[`id`,xa,ya]}connectedCallback(){Z(this,`role`,`tab`),Z(this,xa,`${this.selected}`),Z(this,Sa,this.selected?`0`:`-1`),Pa(this.parentElement?.children)||$(this)}attributeChangedCallback(){!Oa&&this.selected&&$(this)}get tabsElement(){return La(this)}get tabList(){let e=this.parentElement;return e instanceof Da?e:null}get selected(){return Q(this)}set selected(e){e&&$(this)}get index(){return Math.max(Fa(this.parentElement).indexOf(this),0)}get panel(){let e=La(this)?.panels,t=Fa(this.parentElement).indexOf(this);return Ia(this,e?.[t])}},Aa=class extends la{constructor(){super(),fa(this,wa)}connectedCallback(){var e;Oa=!0,Z(this,`role`,`tabpanel`);let t=La(this),n=t?.tabs[[...t.panels].indexOf(this)];(n&&Ia(n,this))!==this&&(n=Pa(this.tabs)||this.tabs[0]),Ma(this,n,!!n&&Q(n)),(e=n?.parentElement?._umutate)==null||e.takeRecords(),Oa=!1}get tabsElement(){return La(this)}get tabs(){return ma(this).querySelectorAll(`[${ya}="${this.id}"]`)}},ja=(e,t=[])=>{let n;for(let{target:e}of t)e instanceof Element&&Z(e,`role`)===`tab`&&Q(e)&&(n=e);!n&&!Pa(e.children)&&(n=Fa(e).find(Na)),$(n)},Ma=(e,t,n=!1)=>{Z(e,`aria-hidden`,`${!n}`),Z(e,`hidden`,n?null:``),Z(e,Sa,n?`0`:null),t&&Z(t,ya,ha(e)),t&&n&&Q(t)&&Z(e,ca,ha(t))},Na=e=>Z(e,ba)!==`true`,Q=e=>Z(e,xa)===`true`,Pa=(e=[])=>{for(let t of e)if(Q(t))return t},Fa=e=>{let t=[];for(let n of e?.children||[])n.getAttribute(`role`)===`tab`&&t.push(n);return t},Ia=(e,t=null)=>{let n=Z(e,ya);return n?ma(e).getElementById(n):t},La=e=>{for(let t=e;t;t=t.parentNode||t.host)if(t instanceof Ea)return t;return null},$=e=>{var t;if(!e||!Na(e))return;Oa=!0;let n=Fa(e.parentElement),r=La(e)?.panels||[],i=Ia(e,r?.[n.indexOf(e)]),a=0;for(let t of n){let n=Ia(t,r?.[a++]);Z(t,xa,`${t===e}`),Z(t,Sa,t===e?`0`:`-1`),n&&Ma(n,t,n===i)}(t=e.parentElement?._umutate)==null||t.takeRecords(),Oa=!1};_a.define(`u-tabs`,Ea),_a.define(`u-tablist`,Da),_a.define(`u-tab`,ka),_a.define(`u-tabpanel`,Aa);var Ra=class extends Ea{},za=class extends Da{},Ba=class extends ka{},Va=class extends Aa{};v.define(`ds-tabs`,Ra),v.define(`ds-tablist`,za),v.define(`ds-tab`,Ba),v.define(`ds-tabpanel`,Va),i()&&!t()&&n(),e.DSBreadcrumbsElement=Or,e.DSErrorSummaryElement=Ar,e.DSFieldElement=Kr,e.DSPaginationElement=Qr,e.DSSuggestionElement=$i,e.DSTabElement=Ba,e.DSTabListElement=za,e.DSTabPanelElement=Va,e.DSTabsElement=Ra,e.UHTMLDataListElement=gr,e.UHTMLDataListShadowRoot=lr,e.UHTMLDataListStyle=cr,e.pagination=Zr,e.setTooltipElement=wn});
|
|
15
17
|
//# sourceMappingURL=index.js.map
|