@digdir/designsystemet-web 1.21.0 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_vendors/@oddbird/popover-polyfill/dist/popover-fn.cjs +1 -1
- package/dist/cjs/_vendors/@oddbird/popover-polyfill/dist/popover-fn.cjs.map +1 -1
- package/dist/cjs/focusgroup/focusgroup.cjs +1 -1
- package/dist/cjs/focusgroup/focusgroup.cjs.map +1 -1
- package/dist/cjs/packages/web/package.cjs +1 -1
- package/dist/esm/_vendors/@oddbird/popover-polyfill/dist/popover-fn.js +1 -1
- package/dist/esm/_vendors/@oddbird/popover-polyfill/dist/popover-fn.js.map +1 -1
- package/dist/esm/focusgroup/focusgroup.js +1 -1
- package/dist/esm/focusgroup/focusgroup.js.map +1 -1
- package/dist/esm/packages/web/package.js +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +8 -5
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{QUICK_EVENT as e,attr as t,getComposedPath as n,getComposedTarget as r,isBrowser as i,on as a,onHotReload as o}from"../utils/utils.js";const s=`focusgroup`,c=`${s}start`,l=new WeakMap,u=new Map,d={listbox:{block:!0,wrap:!1,items:`option`},menu:{block:!0,wrap:!0,items:`menuitem`},menubar:{block:!1,wrap:!0,items:`menuitem`},radiogroup:{block:null,wrap:!0,items:`radio`},tablist:{block:!1,wrap:!0,items:`tab`},toolbar:{block:!1,wrap:!1,items:null}};let f=!1;const p=new Set([`AUDIO`,`VIDEO`,`TEXTAREA`,`SELECT`,`date`,`datetime-local`,`email`,`month`,`number`,`password`,`range`,`search`,`tel`,`text`,`time`,`url`,`week`]),m=i()&&(s in HTMLElement.prototype||`focusGroup`in HTMLElement.prototype),h=e=>f=e,g=e=>{if(e.defaultPrevented||e.altKey||e.metaKey||e.ctrlKey)return;let t=e.key===`Tab`,i=e.key===`ArrowUp`||e.key===`ArrowDown`,a=i||e.key===`ArrowLeft`||e.key===`ArrowRight`;if(!t&&!a&&e.key!==`Home`&&e.key!==`End`)return;t&&(h(!0),setTimeout(h,100,!1));let o=r(e);if(!o||E(o))return;let s=v(n(o));if(s?.role&&s?.el===o&&(s=v(n(s.el.parentNode))),!s?.role)return;let c=b(s.el,o),l=0;if(t)return setTimeout(D,0,
|
|
1
|
+
import{QUICK_EVENT as e,attr as t,getComposedPath as n,getComposedTarget as r,isBrowser as i,on as a,onHotReload as o}from"../utils/utils.js";const s=`focusgroup`,c=`${s}start`,l=new WeakMap,u=new Map,d={listbox:{block:!0,wrap:!1,items:`option`},menu:{block:!0,wrap:!0,items:`menuitem`},menubar:{block:!1,wrap:!0,items:`menuitem`},radiogroup:{block:null,wrap:!0,items:`radio`},tablist:{block:!1,wrap:!0,items:`tab`},toolbar:{block:!1,wrap:!1,items:null}};let f=!1;const p=new Set([`AUDIO`,`VIDEO`,`TEXTAREA`,`SELECT`,`date`,`datetime-local`,`email`,`month`,`number`,`password`,`range`,`search`,`tel`,`text`,`time`,`url`,`week`]),m=i()&&(s in HTMLElement.prototype||`focusGroup`in HTMLElement.prototype),h=e=>f=e,g=e=>{if(e.defaultPrevented||e.altKey||e.metaKey||e.ctrlKey)return;let t=e.key===`Tab`,i=e.key===`ArrowUp`||e.key===`ArrowDown`,a=i||e.key===`ArrowLeft`||e.key===`ArrowRight`;if(!t&&!a&&e.key!==`Home`&&e.key!==`End`)return;t&&(h(!0),setTimeout(h,100,!1));let o=r(e);if(!o||E(o))return;let s=v(n(o));if(s?.role&&s?.el===o&&(s=v(n(s.el.parentNode))),!s?.role)return;let c=b(s.el,o),l=0;if(t){let e=c.filter(e=>e!==o);return setTimeout(D,0,e,D(e))}if(e.key===`Home`)l=0;else if(e.key===`End`)l=c.length-1;else{let{direction:t,writingMode:n}=getComputedStyle(o),r=n.startsWith(`vertical`),a=r?n===`vertical-rl`:t===`rtl`,u=e.key===`ArrowDown`||e.key===`ArrowRight`,d=i!==r,f=u!==(!i&&a);if((s.block??d)!==d)return;l=c.indexOf(o)+(f?1:-1),l=s.wrap?(c.length+l)%c.length:Math.max(0,Math.min(l,c.length-1))}c[l]!==o&&e.preventDefault(),c[l]?.focus?.()},_=t=>{let i=r(t),o=n(i);for(let[e,t]of u)!o.has(e)&&u.delete(e)&&t();for(let t of o)t.nodeType===11&&!u.has(t)&&u.set(t,a(t,`focus`,_,e));if(t.target?.shadowRoot)return;let s=v(o);if(s?.role){if(f&&!E(s.focus)){let e=x(b(s.el,null),i),t=s.memory&&e.includes(s.focus)&&s.focus||e.find(e=>e?.hasAttribute(c))||e[0];if(t!==i)return t?.focus?.()}s.focus=i}},v=e=>{for(let n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;let e=n.getAttribute(s);if(e!==null){let r=l.get(n);if(r?.key===e)return r;r=y(n,e),l.set(n,r);for(let e of b(n))e&&!e.hasAttribute(`role`)&&t(e,`role`,r.items);return n.hasAttribute(`role`)||t(n,`role`,r.role),r}if(C(n))return}},y=(e,t)=>{let n=new Set(t.toLowerCase().split(` `)),r=[...n].find(e=>e in d),i=d[r],a=n.has(`inline`),o=n.has(`block`);return{key:t,el:e,role:r,block:a&&o?null:o||!a&&i?.block,focus:null,items:i?.items,memory:!n.has(`nomemory`),wrap:n.has(`wrap`)||!n.has(`nowrap`)&&i?.wrap}},b=(e,t,n=[],r=!1)=>{let i=e?.nodeName===`SLOT`?e.assignedElements({flatten:!0}):(e?.shadowRoot||e)?.children;for(let e=0,a=i?.length||e;i&&e<a;e++){let a=i[e];if(a.nodeName===`SLOT`)b(a,t,n,r);else if(S(a)&&!C(a)&&w(a)){let e=a.getAttribute(s);a===t||!r&&e!==`none`&&T(a)?n.push(a):e!==null&&t===null?n.push(null):b(a,t,n,r||e!==null)}}return n},x=(e,t)=>{let n=e.indexOf(t),r=e.indexOf(null,n);return e.slice(e.lastIndexOf(null,n)+1,r===-1?void 0:r)},S=e=>!e.inert&&!e.hidden&&!e.disabled,C=e=>e?.nodeName===`DIALOG`||e?.hasAttribute(`popover`),w=i()&&typeof Element.prototype.checkVisibility==`function`?e=>e.checkVisibility():e=>e.offsetParent!==null,T=e=>e.isContentEditable||e.tabIndex>=0&&!e.disabled,E=e=>e?.isContentEditable||p.has(e?.nodeName)||e?.nodeName===`INPUT`&&p.has(e.type),D=(e,n)=>Array.from(e,(e,r)=>{let i=e?.getAttribute(`tabindex`);return e&&t(e,`tabindex`,n?n[r]:`-1`),i});m||o(s,()=>[a(document,`keydown`,g),a(document,`focus`,_,e),()=>{for(let[,e]of u)e();u.clear()}]);export{v as getGroup,b as getItems,E as isConflict,T as isFocusable};
|
|
2
2
|
//# sourceMappingURL=focusgroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusgroup.js","names":[],"sources":["../../../src/focusgroup/focusgroup.ts"],"sourcesContent":["import {\n attr,\n getComposedPath,\n getComposedTarget,\n isBrowser,\n on,\n onHotReload,\n QUICK_EVENT,\n} from '../utils/utils';\n\n// Intentionally not implemented:\n// - Clearing memory based on attribute changes: https://open-ui.org/components/scoped-focusgroup.explainer/#disabling-focusgroup-memory\n// - Setting ARIA roles before focus or keydown occurs (this is too performance consuming, and does not affect a11y much)\n\nconst ATTR_GROUP = 'focusgroup';\nconst PROP_GROUP = 'focusGroup';\nconst ATTR_START = `${ATTR_GROUP}start`;\nconst GROUPS = new WeakMap<Element, ReturnType<typeof parseGroup>>();\nconst ROOTS = new Map<Node, () => void>(); // ShadowRoots we listen for focus events on, since focus only triggers once on ShadowDOM due to event retargeting\nconst ROLES = {\n listbox: { block: true, wrap: false, items: 'option' },\n menu: { block: true, wrap: true, items: 'menuitem' },\n menubar: { block: false, wrap: true, items: 'menuitem' },\n radiogroup: { block: null, wrap: true, items: 'radio' },\n tablist: { block: false, wrap: true, items: 'tab' },\n toolbar: { block: false, wrap: false, items: null },\n};\nlet IS_TAB = false; // Used to check if focus event is a result of tabbing\nconst IS_CONFLICT = new Set([\n 'AUDIO',\n 'VIDEO',\n 'TEXTAREA',\n 'SELECT',\n 'date',\n 'datetime-local',\n 'email',\n 'month',\n 'number',\n 'password',\n 'range',\n 'search',\n 'tel',\n 'text',\n 'time',\n 'url',\n 'week',\n]);\n\n// Chrome has implemented camel case \"focusGroup\", but several polyfills checks both camel case and kebab case, so we support both for now\nconst IS_SUPPORTED =\n isBrowser() &&\n (ATTR_GROUP in HTMLElement.prototype || PROP_GROUP in HTMLElement.prototype);\n\nconst setIsTab = (state: boolean) => (IS_TAB = state);\nconst handleKeydown = (e: Event & Partial<KeyboardEvent>) => {\n if (e.defaultPrevented || e.altKey || e.metaKey || e.ctrlKey) return;\n\n const isTab = e.key === 'Tab';\n const isBlock = e.key === 'ArrowUp' || e.key === 'ArrowDown';\n const isArrow = isBlock || e.key === 'ArrowLeft' || e.key === 'ArrowRight';\n if (!isTab && !isArrow && e.key !== 'Home' && e.key !== 'End') return;\n if (isTab) {\n setIsTab(true);\n setTimeout(setIsTab, 100, false); // Reset after event loop so we can check if next focus event is a result of tabbing\n }\n\n const target = getComposedTarget(e) as Element | null;\n if (!target || isConflict(target)) return; // See https://open-ui.org/components/scoped-focusgroup.explainer/#key-conflict-elements\n\n let group = getGroup(getComposedPath(target));\n\n if (group?.role && group?.el === target)\n group = getGroup(getComposedPath(group.el.parentNode)); // If focus is on the group itself, check if it is nested inside another group\n if (!group?.role) return; // Ignore invalid parent groups\n\n const items = getItems(group.el, target); // Include target so we can move from tabindex=\"-1\" as according to spec\n let next = 0;\n\n if (isTab) return setTimeout(setTab, 0, items, setTab(items)); // Make sure next tab stop is outside focusgroup\n if (e.key === 'Home') next = 0;\n else if (e.key === 'End') next = items.length - 1;\n else {\n const { direction: dir, writingMode: mode } = getComputedStyle(target);\n const isFlipped = mode.startsWith('vertical');\n const isReverse = isFlipped ? mode === 'vertical-rl' : dir === 'rtl';\n const isForward = e.key === 'ArrowDown' || e.key === 'ArrowRight';\n\n const moveBlock = isBlock !== isFlipped;\n const moveForward = isForward !== (!isBlock && isReverse);\n\n if ((group.block ?? moveBlock) !== moveBlock) return; // Ignore if group direction does not match move direction\n next = items.indexOf(target) + (moveForward ? 1 : -1);\n\n if (group.wrap) next = (items.length + next) % items.length;\n else next = Math.max(0, Math.min(next, items.length - 1));\n }\n\n // Note: preventDefault() prevents native <input type=\"radio\"> elements from changing checked state with arrow keys.\n // Although this differs from native behavior, it matches focusgroup=\"radiogroup\" for <button role=\"radio\">.\n // toggle-group.ts already normalizes this for both <input type=\"radio\"> and <button role=\"radio\">,\n // meaning the following preventDefault() introduces no inconsistencies:\n if (items[next] !== target) e.preventDefault(); // Prevent scrolling if changing item\n (items[next] as HTMLElement)?.focus?.();\n};\n\nconst handleFocus = (e: Event & Partial<FocusEvent>) => {\n const target = getComposedTarget(e);\n const path = getComposedPath(target);\n\n for (const [el, off] of ROOTS) if (!path.has(el) && ROOTS.delete(el)) off(); // Remove focus listener on previous roots\n for (const el of path)\n if (el.nodeType === 11 && !ROOTS.has(el))\n ROOTS.set(el, on(el, 'focus', handleFocus, QUICK_EVENT)); // Listener will instantly dispatch since we are binding during triggering\n\n if ((e.target as Element)?.shadowRoot) return; // Avoid double handling by only processing focus events that are not already handled in a shadowRoot\n\n const group = getGroup(path);\n if (!group?.role) return;\n if (IS_TAB && !isConflict(group.focus)) {\n const segment = getSegment(getItems(group.el, null), target); // See https://open-ui.org/components/scoped-focusgroup.explainer/#focusgroup-segments\n const start =\n (group.memory && segment.includes(group.focus) && group.focus) ||\n segment.find((el) => el?.hasAttribute(ATTR_START)) ||\n segment[0];\n if (start !== target) return (start as HTMLElement)?.focus?.(); // Fix focus position if tabbing into segment\n }\n group.focus = target; // Always store focus\n};\n\nexport const getGroup = (path: Set<Node>) => {\n for (const el of path as Set<Element>) {\n if (el.nodeType !== Node.ELEMENT_NODE) continue;\n\n const key = el.getAttribute(ATTR_GROUP);\n if (key !== null) {\n let group = GROUPS.get(el);\n if (group?.key === key) return group; // Return cache if attribute is unchanged\n\n group = parseGroup(el, key);\n GROUPS.set(el, group);\n for (const item of getItems(el))\n if (item && !item.hasAttribute('role')) attr(item, 'role', group.items);\n if (!el.hasAttribute('role')) attr(el, 'role', group.role);\n return group;\n }\n if (isTopLayer(el)) return;\n }\n};\n\nconst parseGroup = (el: Element, key: string) => {\n const opts = new Set(key.toLowerCase().split(' '));\n const role = [...opts].find((t) => t in ROLES) as keyof typeof ROLES;\n const base = ROLES[role];\n const x = opts.has('inline');\n const y = opts.has('block');\n\n return {\n key,\n el,\n role,\n block: x && y ? null : y || (x ? false : base?.block),\n focus: null as Element | null,\n items: base?.items,\n memory: !opts.has('nomemory'),\n wrap: opts.has('wrap') || (opts.has('nowrap') ? false : base?.wrap),\n };\n};\n\nexport const getItems = (\n root?: Element | null,\n keep?: Element | null, // Provide Element to include, or null to keep segments (https://open-ui.org/components/scoped-focusgroup.explainer/#focusgroup-segments)\n items: (Element | null)[] = [], // Used only for recursion\n isNested = false, // Used only for recursion, to check if already inside a nested group\n) => {\n const children =\n root?.nodeName === 'SLOT'\n ? (root as HTMLSlotElement).assignedElements({ flatten: true })\n : (root?.shadowRoot || root)?.children;\n\n for (let i = 0, l = children?.length || i; children && i < l; i++) {\n const el = children[i] as HTMLElement;\n if (el.nodeName === 'SLOT') getItems(el, keep, items, isNested);\n else if (isKeyboardReachable(el) && !isTopLayer(el) && isVisible(el)) {\n const group = el.getAttribute(ATTR_GROUP);\n if (el === keep || (!isNested && group !== 'none' && isFocusable(el)))\n items.push(el);\n else if (group !== null && keep === null) items.push(null);\n else getItems(el, keep, items, isNested || group !== null);\n }\n }\n return items;\n};\n\n// Treats the null returned from getItems as a separator and returns segment containing \"item\"\nconst getSegment = <T>(acc: (T | null)[], item: T) => {\n const at = acc.indexOf(item);\n const to = acc.indexOf(null, at);\n return acc.slice(acc.lastIndexOf(null, at) + 1, to === -1 ? undefined : to);\n};\n\nconst isKeyboardReachable = (el: HTMLElement) =>\n !el.inert && !el.hidden && !(el as HTMLInputElement).disabled;\n\nconst isTopLayer = (el: Element | null) =>\n el?.nodeName === 'DIALOG' || el?.hasAttribute('popover'); // See https://open-ui.org/components/scoped-focusgroup.explainer/#top-layer-elements)\n\nconst isVisible =\n isBrowser() && typeof Element.prototype.checkVisibility === 'function'\n ? (el: HTMLElement) => el.checkVisibility()\n : (el: HTMLElement) => el.offsetParent !== null;\n\nexport const isFocusable = (el: HTMLElement) =>\n el.isContentEditable ||\n (el.tabIndex >= 0 && !(el as HTMLInputElement).disabled);\n\nexport const isConflict = (el: Node | null) =>\n (el as HTMLElement)?.isContentEditable ||\n IS_CONFLICT.has(el?.nodeName as string) ||\n (el?.nodeName === 'INPUT' && IS_CONFLICT.has((el as HTMLInputElement).type));\n\nconst setTab = (items: ReturnType<typeof getItems>, prevs?: string[]) =>\n Array.from(items, (item, index) => {\n const prev = item?.getAttribute('tabindex');\n if (item) attr(item, 'tabindex', prevs ? prevs[index] : '-1'); // Restore previous tabindex if provided\n return prev;\n });\n\nif (!IS_SUPPORTED)\n onHotReload(ATTR_GROUP, () => [\n on(document, 'keydown', handleKeydown),\n on(document, 'focus', handleFocus, QUICK_EVENT),\n () => {\n for (const [, off] of ROOTS) off(); // Cleanup listeners on ShadowRoots on hot reload\n ROOTS.clear();\n },\n ]);\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"focusgroup.js","names":[],"sources":["../../../src/focusgroup/focusgroup.ts"],"sourcesContent":["import {\n attr,\n getComposedPath,\n getComposedTarget,\n isBrowser,\n on,\n onHotReload,\n QUICK_EVENT,\n} from '../utils/utils';\n\n// Intentionally not implemented:\n// - Clearing memory based on attribute changes: https://open-ui.org/components/scoped-focusgroup.explainer/#disabling-focusgroup-memory\n// - Setting ARIA roles before focus or keydown occurs (this is too performance consuming, and does not affect a11y much)\n\nconst ATTR_GROUP = 'focusgroup';\nconst PROP_GROUP = 'focusGroup';\nconst ATTR_START = `${ATTR_GROUP}start`;\nconst GROUPS = new WeakMap<Element, ReturnType<typeof parseGroup>>();\nconst ROOTS = new Map<Node, () => void>(); // ShadowRoots we listen for focus events on, since focus only triggers once on ShadowDOM due to event retargeting\nconst ROLES = {\n listbox: { block: true, wrap: false, items: 'option' },\n menu: { block: true, wrap: true, items: 'menuitem' },\n menubar: { block: false, wrap: true, items: 'menuitem' },\n radiogroup: { block: null, wrap: true, items: 'radio' },\n tablist: { block: false, wrap: true, items: 'tab' },\n toolbar: { block: false, wrap: false, items: null },\n};\nlet IS_TAB = false; // Used to check if focus event is a result of tabbing\nconst IS_CONFLICT = new Set([\n 'AUDIO',\n 'VIDEO',\n 'TEXTAREA',\n 'SELECT',\n 'date',\n 'datetime-local',\n 'email',\n 'month',\n 'number',\n 'password',\n 'range',\n 'search',\n 'tel',\n 'text',\n 'time',\n 'url',\n 'week',\n]);\n\n// Chrome has implemented camel case \"focusGroup\", but several polyfills checks both camel case and kebab case, so we support both for now\nconst IS_SUPPORTED =\n isBrowser() &&\n (ATTR_GROUP in HTMLElement.prototype || PROP_GROUP in HTMLElement.prototype);\n\nconst setIsTab = (state: boolean) => (IS_TAB = state);\nconst handleKeydown = (e: Event & Partial<KeyboardEvent>) => {\n if (e.defaultPrevented || e.altKey || e.metaKey || e.ctrlKey) return;\n\n const isTab = e.key === 'Tab';\n const isBlock = e.key === 'ArrowUp' || e.key === 'ArrowDown';\n const isArrow = isBlock || e.key === 'ArrowLeft' || e.key === 'ArrowRight';\n if (!isTab && !isArrow && e.key !== 'Home' && e.key !== 'End') return;\n if (isTab) {\n setIsTab(true);\n setTimeout(setIsTab, 100, false); // Reset after event loop so we can check if next focus event is a result of tabbing\n }\n\n const target = getComposedTarget(e) as Element | null;\n if (!target || isConflict(target)) return; // See https://open-ui.org/components/scoped-focusgroup.explainer/#key-conflict-elements\n\n let group = getGroup(getComposedPath(target));\n\n if (group?.role && group?.el === target)\n group = getGroup(getComposedPath(group.el.parentNode)); // If focus is on the group itself, check if it is nested inside another group\n if (!group?.role) return; // Ignore invalid parent groups\n\n const items = getItems(group.el, target); // Include target so we can move from tabindex=\"-1\" as according to spec\n let next = 0;\n\n if (isTab) {\n const others = items.filter((item) => item !== target); // Keep target tabbable, as Firefox restarts sequential navigation from document start if a mouse-focused element becomes tabindex=\"-1\"\n return setTimeout(setTab, 0, others, setTab(others)); // Make sure next tab stop is outside focusgroup\n }\n if (e.key === 'Home') next = 0;\n else if (e.key === 'End') next = items.length - 1;\n else {\n const { direction: dir, writingMode: mode } = getComputedStyle(target);\n const isFlipped = mode.startsWith('vertical');\n const isReverse = isFlipped ? mode === 'vertical-rl' : dir === 'rtl';\n const isForward = e.key === 'ArrowDown' || e.key === 'ArrowRight';\n\n const moveBlock = isBlock !== isFlipped;\n const moveForward = isForward !== (!isBlock && isReverse);\n\n if ((group.block ?? moveBlock) !== moveBlock) return; // Ignore if group direction does not match move direction\n next = items.indexOf(target) + (moveForward ? 1 : -1);\n\n if (group.wrap) next = (items.length + next) % items.length;\n else next = Math.max(0, Math.min(next, items.length - 1));\n }\n\n // Note: preventDefault() prevents native <input type=\"radio\"> elements from changing checked state with arrow keys.\n // Although this differs from native behavior, it matches focusgroup=\"radiogroup\" for <button role=\"radio\">.\n // toggle-group.ts already normalizes this for both <input type=\"radio\"> and <button role=\"radio\">,\n // meaning the following preventDefault() introduces no inconsistencies:\n if (items[next] !== target) e.preventDefault(); // Prevent scrolling if changing item\n (items[next] as HTMLElement)?.focus?.();\n};\n\nconst handleFocus = (e: Event & Partial<FocusEvent>) => {\n const target = getComposedTarget(e);\n const path = getComposedPath(target);\n\n for (const [el, off] of ROOTS) if (!path.has(el) && ROOTS.delete(el)) off(); // Remove focus listener on previous roots\n for (const el of path)\n if (el.nodeType === 11 && !ROOTS.has(el))\n ROOTS.set(el, on(el, 'focus', handleFocus, QUICK_EVENT)); // Listener will instantly dispatch since we are binding during triggering\n\n if ((e.target as Element)?.shadowRoot) return; // Avoid double handling by only processing focus events that are not already handled in a shadowRoot\n\n const group = getGroup(path);\n if (!group?.role) return;\n if (IS_TAB && !isConflict(group.focus)) {\n const segment = getSegment(getItems(group.el, null), target); // See https://open-ui.org/components/scoped-focusgroup.explainer/#focusgroup-segments\n const start =\n (group.memory && segment.includes(group.focus) && group.focus) ||\n segment.find((el) => el?.hasAttribute(ATTR_START)) ||\n segment[0];\n if (start !== target) return (start as HTMLElement)?.focus?.(); // Fix focus position if tabbing into segment\n }\n group.focus = target; // Always store focus\n};\n\nexport const getGroup = (path: Set<Node>) => {\n for (const el of path as Set<Element>) {\n if (el.nodeType !== Node.ELEMENT_NODE) continue;\n\n const key = el.getAttribute(ATTR_GROUP);\n if (key !== null) {\n let group = GROUPS.get(el);\n if (group?.key === key) return group; // Return cache if attribute is unchanged\n\n group = parseGroup(el, key);\n GROUPS.set(el, group);\n for (const item of getItems(el))\n if (item && !item.hasAttribute('role')) attr(item, 'role', group.items);\n if (!el.hasAttribute('role')) attr(el, 'role', group.role);\n return group;\n }\n if (isTopLayer(el)) return;\n }\n};\n\nconst parseGroup = (el: Element, key: string) => {\n const opts = new Set(key.toLowerCase().split(' '));\n const role = [...opts].find((t) => t in ROLES) as keyof typeof ROLES;\n const base = ROLES[role];\n const x = opts.has('inline');\n const y = opts.has('block');\n\n return {\n key,\n el,\n role,\n block: x && y ? null : y || (x ? false : base?.block),\n focus: null as Element | null,\n items: base?.items,\n memory: !opts.has('nomemory'),\n wrap: opts.has('wrap') || (opts.has('nowrap') ? false : base?.wrap),\n };\n};\n\nexport const getItems = (\n root?: Element | null,\n keep?: Element | null, // Provide Element to include, or null to keep segments (https://open-ui.org/components/scoped-focusgroup.explainer/#focusgroup-segments)\n items: (Element | null)[] = [], // Used only for recursion\n isNested = false, // Used only for recursion, to check if already inside a nested group\n) => {\n const children =\n root?.nodeName === 'SLOT'\n ? (root as HTMLSlotElement).assignedElements({ flatten: true })\n : (root?.shadowRoot || root)?.children;\n\n for (let i = 0, l = children?.length || i; children && i < l; i++) {\n const el = children[i] as HTMLElement;\n if (el.nodeName === 'SLOT') getItems(el, keep, items, isNested);\n else if (isKeyboardReachable(el) && !isTopLayer(el) && isVisible(el)) {\n const group = el.getAttribute(ATTR_GROUP);\n if (el === keep || (!isNested && group !== 'none' && isFocusable(el)))\n items.push(el);\n else if (group !== null && keep === null) items.push(null);\n else getItems(el, keep, items, isNested || group !== null);\n }\n }\n return items;\n};\n\n// Treats the null returned from getItems as a separator and returns segment containing \"item\"\nconst getSegment = <T>(acc: (T | null)[], item: T) => {\n const at = acc.indexOf(item);\n const to = acc.indexOf(null, at);\n return acc.slice(acc.lastIndexOf(null, at) + 1, to === -1 ? undefined : to);\n};\n\nconst isKeyboardReachable = (el: HTMLElement) =>\n !el.inert && !el.hidden && !(el as HTMLInputElement).disabled;\n\nconst isTopLayer = (el: Element | null) =>\n el?.nodeName === 'DIALOG' || el?.hasAttribute('popover'); // See https://open-ui.org/components/scoped-focusgroup.explainer/#top-layer-elements)\n\nconst isVisible =\n isBrowser() && typeof Element.prototype.checkVisibility === 'function'\n ? (el: HTMLElement) => el.checkVisibility()\n : (el: HTMLElement) => el.offsetParent !== null;\n\nexport const isFocusable = (el: HTMLElement) =>\n el.isContentEditable ||\n (el.tabIndex >= 0 && !(el as HTMLInputElement).disabled);\n\nexport const isConflict = (el: Node | null) =>\n (el as HTMLElement)?.isContentEditable ||\n IS_CONFLICT.has(el?.nodeName as string) ||\n (el?.nodeName === 'INPUT' && IS_CONFLICT.has((el as HTMLInputElement).type));\n\nconst setTab = (items: ReturnType<typeof getItems>, prevs?: string[]) =>\n Array.from(items, (item, index) => {\n const prev = item?.getAttribute('tabindex');\n if (item) attr(item, 'tabindex', prevs ? prevs[index] : '-1'); // Restore previous tabindex if provided\n return prev;\n });\n\nif (!IS_SUPPORTED)\n onHotReload(ATTR_GROUP, () => [\n on(document, 'keydown', handleKeydown),\n on(document, 'focus', handleFocus, QUICK_EVENT),\n () => {\n for (const [, off] of ROOTS) off(); // Cleanup listeners on ShadowRoots on hot reload\n ROOTS.clear();\n },\n ]);\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=`1.21.
|
|
1
|
+
var e=`1.21.1`;export{e as version};
|
|
2
2
|
//# sourceMappingURL=package.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type * as PreactTypes from 'preact'
|
|
2
|
+
import type * as ReactTypes from 'react'
|
|
3
|
+
import type * as SvelteTypes from 'svelte/elements'
|
|
4
|
+
import type * as VueJSX from '@vue/runtime-dom'
|
|
5
|
+
import type { JSX as QwikJSX } from '@builder.io/qwik/jsx-runtime'
|
|
6
|
+
import type { JSX as SolidJSX } from 'solid-js'
|
|
1
7
|
import "@u-elements/u-details/polyfill";
|
|
2
8
|
import { UHTMLComboboxElement } from "@u-elements/u-combobox";
|
|
3
9
|
import * as UTabs from "@u-elements/u-tabs";
|
|
@@ -157,7 +163,6 @@ declare class DSTabPanelElement extends UTabs.UHTMLTabPanelElement {}
|
|
|
157
163
|
//#endregion
|
|
158
164
|
export { DSBreadcrumbsElement, DSErrorSummaryElement, DSFieldElement, DSPaginationElement, DSSuggestionElement, DSTabElement, DSTabListElement, DSTabPanelElement, DSTabsElement, initTooltips, pagination, setTooltipElement };
|
|
159
165
|
|
|
160
|
-
|
|
161
166
|
export type PreactDstabs = PreactTypes.JSX.HTMLAttributes<DSTabsElement> & { }
|
|
162
167
|
export type ReactDstabs = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<DSTabsElement>, DSTabsElement> & { class?: string }
|
|
163
168
|
export type QwikDstabs = QwikJSX.IntrinsicElements['div'] & { class?: string }
|
|
@@ -235,7 +240,6 @@ declare module 'solid-js' {
|
|
|
235
240
|
}
|
|
236
241
|
}
|
|
237
242
|
|
|
238
|
-
|
|
239
243
|
export type PreactDssuggestion = PreactTypes.JSX.HTMLAttributes<DSSuggestionElement> & { }
|
|
240
244
|
export type ReactDssuggestion = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<DSSuggestionElement>, DSSuggestionElement> & { class?: string }
|
|
241
245
|
export type QwikDssuggestion = QwikJSX.IntrinsicElements['div'] & { class?: string }
|
|
@@ -256,7 +260,6 @@ declare module 'solid-js' {
|
|
|
256
260
|
}
|
|
257
261
|
}
|
|
258
262
|
|
|
259
|
-
|
|
260
263
|
export type PreactDspagination = PreactTypes.JSX.HTMLAttributes<DSPaginationElement> & { }
|
|
261
264
|
export type ReactDspagination = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<DSPaginationElement>, DSPaginationElement> & { class?: string }
|
|
262
265
|
export type QwikDspagination = QwikJSX.IntrinsicElements['div'] & { class?: string }
|
|
@@ -277,7 +280,6 @@ declare module 'solid-js' {
|
|
|
277
280
|
}
|
|
278
281
|
}
|
|
279
282
|
|
|
280
|
-
|
|
281
283
|
export type PreactDsfield = PreactTypes.JSX.HTMLAttributes<DSFieldElement> & { }
|
|
282
284
|
export type ReactDsfield = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<DSFieldElement>, DSFieldElement> & { class?: string }
|
|
283
285
|
export type QwikDsfield = QwikJSX.IntrinsicElements['div'] & { class?: string }
|
|
@@ -298,7 +300,6 @@ declare module 'solid-js' {
|
|
|
298
300
|
}
|
|
299
301
|
}
|
|
300
302
|
|
|
301
|
-
|
|
302
303
|
export type PreactDserrorsummary = PreactTypes.JSX.HTMLAttributes<DSErrorSummaryElement> & { }
|
|
303
304
|
export type ReactDserrorsummary = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<DSErrorSummaryElement>, DSErrorSummaryElement> & { class?: string }
|
|
304
305
|
export type QwikDserrorsummary = QwikJSX.IntrinsicElements['div'] & { class?: string }
|
|
@@ -319,7 +320,6 @@ declare module 'solid-js' {
|
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
|
|
322
|
-
|
|
323
323
|
export type PreactDsbreadcrumbs = PreactTypes.JSX.HTMLAttributes<DSBreadcrumbsElement> & { }
|
|
324
324
|
export type ReactDsbreadcrumbs = ReactTypes.DetailedHTMLProps<ReactTypes.HTMLAttributes<DSBreadcrumbsElement>, DSBreadcrumbsElement> & { class?: string }
|
|
325
325
|
export type QwikDsbreadcrumbs = QwikJSX.IntrinsicElements['div'] & { class?: string }
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { UHTMLComboboxElement } from "@u-elements/u-combobox";
|
|
|
4
4
|
import * as UTabs from "@u-elements/u-tabs";
|
|
5
5
|
export * from "@u-elements/u-datalist";
|
|
6
6
|
//#region package.json
|
|
7
|
-
var version = "1.21.
|
|
7
|
+
var version = "1.21.1";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/utils/utils.ts
|
|
10
10
|
const ARIA_DESC = "aria-description";
|
|
@@ -373,7 +373,10 @@ const handleKeydown$2 = (e) => {
|
|
|
373
373
|
if (!group?.role) return;
|
|
374
374
|
const items = getItems(group.el, target);
|
|
375
375
|
let next = 0;
|
|
376
|
-
if (isTab)
|
|
376
|
+
if (isTab) {
|
|
377
|
+
const others = items.filter((item) => item !== target);
|
|
378
|
+
return setTimeout(setTab, 0, others, setTab(others));
|
|
379
|
+
}
|
|
377
380
|
if (e.key === "Home") next = 0;
|
|
378
381
|
else if (e.key === "End") next = items.length - 1;
|
|
379
382
|
else {
|
|
@@ -699,7 +702,7 @@ function apply$1() {
|
|
|
699
702
|
//#region src/invokers/invokers.ts
|
|
700
703
|
if (isBrowser() && !isSupported$1()) apply$1();
|
|
701
704
|
//#endregion
|
|
702
|
-
//#region ../../node_modules/.pnpm/@oddbird+popover-polyfill@0.7.
|
|
705
|
+
//#region ../../node_modules/.pnpm/@oddbird+popover-polyfill@0.7.2/node_modules/@oddbird/popover-polyfill/dist/popover-fn.js
|
|
703
706
|
var ToggleEvent = class extends Event {
|
|
704
707
|
oldState;
|
|
705
708
|
newState;
|
|
@@ -1010,7 +1013,7 @@ function lightDismissOpenPopovers(event) {
|
|
|
1010
1013
|
if (!event.isTrusted) return;
|
|
1011
1014
|
const target = event.composedPath()[0];
|
|
1012
1015
|
if (!target) return;
|
|
1013
|
-
const document2 = target.ownerDocument;
|
|
1016
|
+
const document2 = target.ownerDocument || target;
|
|
1014
1017
|
if (!topmostAutoOrHintPopover(document2)) return;
|
|
1015
1018
|
const ancestor = topMostClickedPopover(target);
|
|
1016
1019
|
if (ancestor && event.type === "pointerdown") popoverPointerDownTargets.set(document2, ancestor);
|
|
@@ -1054,7 +1057,7 @@ function hasLayerSupport() {
|
|
|
1054
1057
|
function getStyles(layerName) {
|
|
1055
1058
|
var _a;
|
|
1056
1059
|
const useLayer = hasLayerSupport();
|
|
1057
|
-
const layerNameEscaped = (layerName ?? ((_a = window.POPOVER_POLYFILL_OPTIONS) == null ? void 0 : _a.layerName) ?? DEFAULT_LAYER_NAME).split(".").map((
|
|
1060
|
+
const layerNameEscaped = (layerName ?? ((_a = window.POPOVER_POLYFILL_OPTIONS) == null ? void 0 : _a.layerName) ?? DEFAULT_LAYER_NAME).split(".").map((css) => CSS.escape(css)).join(".");
|
|
1058
1061
|
return `
|
|
1059
1062
|
${useLayer ? `@layer ${layerNameEscaped} {` : ""}
|
|
1060
1063
|
:where([popover]) {
|
package/dist/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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`});var t=`1.21.0`;let n=`aria-label`,r=`aria-labelledby`,i={passive:!0,capture:!0},a=()=>typeof window<`u`&&typeof document<`u`,o=()=>a()&&/^Win/i.test(navigator.userAgentData?.platform||navigator.platform),s=typeof HTMLElement>`u`?class{}:HTMLElement;function c(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}let l=(e,...t)=>!a()||window.dsWarnings===!1||console.log(`\x1B[1mDesignsystemet:\x1B[m ${e}`,...t),u=(e,t,n)=>n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),d=(e,t)=>getComputedStyle(e).getPropertyValue(t).trim(),f=/^["']|["']$/g,p=(e,t)=>{let n=u(e,t);return n||=d(e,`--_ds-${t}`).replace(f,``).trim(),n||null},m=e=>{let t=e?.getRootNode?.()||e?.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:e?.ownerDocument||document},h=e=>{let t=e.target?.shadowRoot&&e.composedPath()[0]||e.target;return t?.nodeType===1?t:null},g=e=>{let t=new Set;for(;e;)t.add(e),e=e.nodeType===11?e.host:e.assignedSlot||e.parentNode;return t},_=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.addEventListener(t,...r);return()=>v(e,...t)},v=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.removeEventListener(t,...r)},y=`_dsHotReloadCleanup${t}`,b=(e,t)=>{if(a()){window[y]||(window[y]=new Map);for(let t of window[y]?.get(e)||[])t();window[y]?.set(e,t())}},x=(e,t,n)=>{let r=()=>i.disconnect(),i=new MutationObserver(n=>{if(!a()||!e.isConnected)return r();t(e,n)});return t(e),i.observe(e,n),r},ee=(e,t)=>{let n=document.createElement(e);if(t)for(let[e,r]of Object.entries(t))u(n,e,r);return n},S={define:(e,t)=>!a()||window.customElements.get(e)||window.customElements.define(e,t)},C=0;function w(e){return a()?(window.dsUseId||(window.dsUseId=0),e&&!e.id&&(e.id=`:ds:${++window.dsUseId}`),e?.id||``):`:ds:${++C}`}let T,te=0,ne=0,re=e=>{clearTimeout(ne),T&&(T.textContent=`${e}${te++%2?`\xA0`:``}`),e&&(ne=setTimeout(re,2e3,``))},ie=()=>{document.readyState===`complete`&&(T||(T=ee(`div`,{"aria-live":`assertive`}),T.style.overflow=`hidden`,T.style.position=`fixed`,T.style.whiteSpace=`nowrap`,T.style.width=`1px`),T.isConnected||document.body.appendChild(T))};b(`announce`,()=>[_(document,`focus mouseover`,ie,i)]);let ae=`:click-delegate-hover`,oe=new Set([`A`,`BUTTON`,`DETAILS`,`DIALOG`,`INPUT`,`LABEL`,`SELECT`,`TEXTAREA`]),se=e=>{let t=e.button===1||e.metaKey||e.ctrlKey,n=h(e),r=e.button<2&&de(e);if(!(!r||r.contains(n))){for(let e of g(n))if(e.control===r)return;if(t&&r instanceof HTMLAnchorElement)return window.open(r.href,void 0,r.rel);e.stopImmediatePropagation(),r.click()}},ce,le,ue=e=>{let t=h(e);if(!t||t===le)return;le=t;let n=de(e);ce!==n&&(ce&&ce.classList.remove(ae),n&&n.classList.add(ae),ce=n)},de=e=>{let t;for(let n of e.composedPath()){if(n.nodeType!==1)continue;n.nodeName===`LABEL`&&(n=n.control||n);let e=n.getAttribute(`data-clickdelegatefor`);if(e){let r=m(n).getElementById(e);return r&&!(t&&t!==r)&&!r.disabled&&!r.readOnly?r:void 0}!t&&fe(n)&&(t=n)}},fe=e=>e.isContentEditable||e.popover||oe.has(e.nodeName)||u(e,`role`)===`button`;b(`clickdelegatefor`,()=>[_(window,`click auxclick`,se,!0),_(document,`mousemove`,ue,i)]);var pe=()=>typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,me=pe(),he=me?navigator.userAgent:``,ge=/android/i.test(he),_e=/firefox/i.test(he);me&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var ve=(e,t,n)=>n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),ye=(e,t,n)=>{let r=new MutationObserver(n=>{if(!pe()||!e.isConnected)return i();t(e,n)}),i=Object.assign(()=>r.disconnect(),{takeRecords:()=>r.takeRecords()});return t(e),r.observe(e,n),i},be=`__uDetailsPolyfillSummarys`;if(pe()&&ge&&_e&&!window[be]){let e=document.getElementsByTagName(`summary`);window[be]=ye(document,()=>{for(let t of e){let e=t.parentElement;ve(t,`role`,`button`),ve(t,`aria-expanded`,`${!!e?.open}`)}},{attributeFilter:[`open`],attributes:!0,childList:!0,subtree:!0})}let xe=!1,Se=e=>{let{type:t,clientX:n=0,clientY:r=0}=e,i=h(e);if(i&&t===`pointerdown`)for(let e of g(i)){if(e.nodeName!==`DIALOG`)continue;let t=e.getBoundingClientRect();xe=t.top<=r&&r<=t.bottom&&t.left<=n&&n<=t.right;return}else{let e=i?.nodeName===`DIALOG`&&!xe&&u(i,`closedby`)===`any`;xe=!1,e&&setTimeout(Ce,0,i)}},Ce=e=>e.open&&e.close(),we=`--show-non-modal`,Te=e=>{for(let t of e.composedPath()){let e=t.nodeType===1&&u(t,`command`);if(e===`show-modal`||e===we)return u(t,`aria-haspopup`,`dialog`)}},Ee=({command:e,target:t})=>e===we&&t instanceof HTMLDialogElement&&t.show();b(`dialog`,()=>[_(document,`command`,Ee,i),_(document,`focus`,Te,i),_(document,`pointerdown pointerup`,Se,i)]);let De=a()?document.getElementsByTagName(`fieldset`):[],Oe=()=>{for(let e of De){if(e.hasAttribute(`aria-labelledby`))continue;let t=``;for(let n of e.children){let e=n.nodeName;(e===`LEGEND`||n.getAttribute(`data-field`)===`description`||e===`P`&&n.previousElementSibling?.nodeName===`LEGEND`)&&(t+=`${w(n)} `)}u(e,r,t.trim()||null)}};b(`fieldset`,()=>[x(document,Oe,{childList:!0,subtree:!0})]);let ke=`focusgroup`,Ae=`${ke}start`,je=new WeakMap,Me=new Map,Ne={listbox:{block:!0,wrap:!1,items:`option`},menu:{block:!0,wrap:!0,items:`menuitem`},menubar:{block:!1,wrap:!0,items:`menuitem`},radiogroup:{block:null,wrap:!0,items:`radio`},tablist:{block:!1,wrap:!0,items:`tab`},toolbar:{block:!1,wrap:!1,items:null}},Pe=!1,Fe=new Set([`AUDIO`,`VIDEO`,`TEXTAREA`,`SELECT`,`date`,`datetime-local`,`email`,`month`,`number`,`password`,`range`,`search`,`tel`,`text`,`time`,`url`,`week`]),Ie=a()&&(ke in HTMLElement.prototype||`focusGroup`in HTMLElement.prototype),Le=e=>Pe=e,Re=e=>{if(e.defaultPrevented||e.altKey||e.metaKey||e.ctrlKey)return;let t=e.key===`Tab`,n=e.key===`ArrowUp`||e.key===`ArrowDown`,r=n||e.key===`ArrowLeft`||e.key===`ArrowRight`;if(!t&&!r&&e.key!==`Home`&&e.key!==`End`)return;t&&(Le(!0),setTimeout(Le,100,!1));let i=h(e);if(!i||Je(i))return;let a=Be(g(i));if(a?.role&&a?.el===i&&(a=Be(g(a.el.parentNode))),!a?.role)return;let o=He(a.el,i),s=0;if(t)return setTimeout(Ye,0,o,Ye(o));if(e.key===`Home`)s=0;else if(e.key===`End`)s=o.length-1;else{let{direction:t,writingMode:r}=getComputedStyle(i),c=r.startsWith(`vertical`),l=c?r===`vertical-rl`:t===`rtl`,u=e.key===`ArrowDown`||e.key===`ArrowRight`,d=n!==c,f=u!==(!n&&l);if((a.block??d)!==d)return;s=o.indexOf(i)+(f?1:-1),s=a.wrap?(o.length+s)%o.length:Math.max(0,Math.min(s,o.length-1))}o[s]!==i&&e.preventDefault(),o[s]?.focus?.()},ze=e=>{let t=h(e),n=g(t);for(let[e,t]of Me)!n.has(e)&&Me.delete(e)&&t();for(let e of n)e.nodeType===11&&!Me.has(e)&&Me.set(e,_(e,`focus`,ze,i));if(e.target?.shadowRoot)return;let r=Be(n);if(r?.role){if(Pe&&!Je(r.focus)){let e=Ue(He(r.el,null),t),n=r.memory&&e.includes(r.focus)&&r.focus||e.find(e=>e?.hasAttribute(Ae))||e[0];if(n!==t)return n?.focus?.()}r.focus=t}},Be=e=>{for(let t of e){if(t.nodeType!==Node.ELEMENT_NODE)continue;let e=t.getAttribute(ke);if(e!==null){let n=je.get(t);if(n?.key===e)return n;n=Ve(t,e),je.set(t,n);for(let e of He(t))e&&!e.hasAttribute(`role`)&&u(e,`role`,n.items);return t.hasAttribute(`role`)||u(t,`role`,n.role),n}if(Ge(t))return}},Ve=(e,t)=>{let n=new Set(t.toLowerCase().split(` `)),r=[...n].find(e=>e in Ne),i=Ne[r],a=n.has(`inline`),o=n.has(`block`);return{key:t,el:e,role:r,block:a&&o?null:o||!a&&i?.block,focus:null,items:i?.items,memory:!n.has(`nomemory`),wrap:n.has(`wrap`)||!n.has(`nowrap`)&&i?.wrap}},He=(e,t,n=[],r=!1)=>{let i=e?.nodeName===`SLOT`?e.assignedElements({flatten:!0}):(e?.shadowRoot||e)?.children;for(let e=0,a=i?.length||e;i&&e<a;e++){let a=i[e];if(a.nodeName===`SLOT`)He(a,t,n,r);else if(We(a)&&!Ge(a)&&Ke(a)){let e=a.getAttribute(ke);a===t||!r&&e!==`none`&&qe(a)?n.push(a):e!==null&&t===null?n.push(null):He(a,t,n,r||e!==null)}}return n},Ue=(e,t)=>{let n=e.indexOf(t),r=e.indexOf(null,n);return e.slice(e.lastIndexOf(null,n)+1,r===-1?void 0:r)},We=e=>!e.inert&&!e.hidden&&!e.disabled,Ge=e=>e?.nodeName===`DIALOG`||e?.hasAttribute(`popover`),Ke=a()&&typeof Element.prototype.checkVisibility==`function`?e=>e.checkVisibility():e=>e.offsetParent!==null,qe=e=>e.isContentEditable||e.tabIndex>=0&&!e.disabled,Je=e=>e?.isContentEditable||Fe.has(e?.nodeName)||e?.nodeName===`INPUT`&&Fe.has(e.type),Ye=(e,t)=>Array.from(e,(e,n)=>{let r=e?.getAttribute(`tabindex`);return e&&u(e,`tabindex`,t?t[n]:`-1`),r});Ie||b(ke,()=>[_(document,`keydown`,Re),_(document,`focus`,ze,i),()=>{for(let[,e]of Me)e();Me.clear()}]);function Xe(){return typeof HTMLButtonElement<`u`&&`command`in HTMLButtonElement.prototype&&`source`in((globalThis.CommandEvent||{}).prototype||{})}function Ze(){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===`toggle-popover`||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})}a()&&!Xe()&&Ze();let Qe=Math.min,E=Math.max,$e=Math.round,et=Math.floor,D=e=>({x:e,y:e}),tt={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function nt(e,t,n){return E(e,Qe(t,n))}function O(e,t){return typeof e==`function`?e(t):e}function k(e){return e.split(`-`)[0]}function rt(e){return e.split(`-`)[1]}function it(e){return e===`x`?`y`:`x`}function at(e){return e===`y`?`height`:`width`}function A(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ot(e){return it(A(e))}function st(e,t,n){n===void 0&&(n=!1);let r=rt(e),i=ot(e),a=at(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=gt(o)),[o,gt(o)]}function ct(e){let t=gt(e);return[lt(e),t,lt(t)]}function lt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}let ut=[`left`,`right`],dt=[`right`,`left`],ft=[`top`,`bottom`],pt=[`bottom`,`top`];function mt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?dt:ut:t?ut:dt;case`left`:case`right`:return t?ft:pt;default:return[]}}function ht(e,t,n,r){let i=rt(e),a=mt(k(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(lt)))),a}function gt(e){let t=k(e);return tt[t]+e.slice(t.length)}function _t(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function vt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:_t(e)}function yt(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 bt(e,t,n){let{reference:r,floating:i}=e,a=A(t),o=ot(t),s=at(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}}let m=rt(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function xt(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=vt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=yt(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=yt(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 St=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:xt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=bt(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}=bt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ct=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?[gt(o)]:ct(o)),x=p!==`none`;!d&&x&&b.push(...ht(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=st(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)))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{}}}},wt=new Set([`left`,`top`]);async function Tt(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=rt(n),c=A(n)===`y`,l=wt.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 Et=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 Tt(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}}}}},Dt=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(i),p=it(f),m=u[p],h=u[f],g=(e,t)=>nt(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ot=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=it(d),p=u[f],m=u[d],h=O(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};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=wt.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}}}},kt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=O(e,t),c=await i.detectOverflow(t,s),l=k(n),u=rt(n),d=A(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Qe(p-c[m],g),y=Qe(f-c[h],_),b=t.middlewareData.shift,x=!b,ee=v,S=y;b!=null&&b.enabled.x&&(S=_),b!=null&&b.enabled.y&&(ee=g),x&&!u&&(d?S=f-2*E(c.left,c.right):ee=p-2*E(c.top,c.bottom)),await o({...t,availableWidth:S,availableHeight:ee});let C=await i.getDimensions(a.floating);return f!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}};function At(){return typeof window<`u`}function jt(e){return Mt(e)?(e.nodeName||``).toLowerCase():`#document`}function j(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function M(e){return((Mt(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Mt(e){return At()?e instanceof Node||e instanceof j(e).Node:!1}function N(e){return At()?e instanceof Element||e instanceof j(e).Element:!1}function P(e){return At()?e instanceof HTMLElement||e instanceof j(e).HTMLElement:!1}function Nt(e){return!At()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof j(e).ShadowRoot}function Pt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=I(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ft(e){return/^(table|td|th)$/.test(jt(e))}function It(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}let Lt=/transform|translate|scale|rotate|perspective|filter/,Rt=/paint|layout|strict|content/,F=e=>!!e&&e!==`none`,zt;function Bt(e){let t=N(e)?I(e):e;return F(t.transform)||F(t.translate)||F(t.scale)||F(t.rotate)||F(t.perspective)||!Ht()&&(F(t.backdropFilter)||F(t.filter))||Lt.test(t.willChange||``)||Rt.test(t.contain||``)}function Vt(e){let t=L(e);for(;P(t)&&!Ut(t);){if(Bt(t))return t;if(It(t))return null;t=L(t)}return null}function Ht(){return zt??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),zt}function Ut(e){return/^(html|body|#document)$/.test(jt(e))}function I(e){return j(e).getComputedStyle(e)}function Wt(e){return N(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function L(e){if(jt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Nt(e)&&e.host||M(e);return Nt(t)?t.host:t}function Gt(e){let t=L(e);return Ut(t)?(e.ownerDocument||e).body:P(t)&&Pt(t)?t:Gt(t)}function Kt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Gt(e),i=r===e.ownerDocument?.body,a=j(r);if(i){let e=qt(a);return t.concat(a,a.visualViewport||[],Pt(r)?r:[],e&&n?Kt(e):[])}else return t.concat(r,Kt(r,[],n))}function qt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jt(e){let t=I(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=P(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$e(n)!==a||$e(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Yt(e){return N(e)?e:e.contextElement}function Xt(e){let t=Yt(e);if(!P(t))return D(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Jt(t),o=(a?$e(n.width):n.width)/r,s=(a?$e(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let Zt=D(0);function Qt(e){let t=j(e);return!Ht()||!t.visualViewport?Zt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $t(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===j(e)}function R(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Yt(e),o=D(1);t&&(r?N(r)&&(o=Xt(r)):o=Xt(e));let s=$t(a,n,r)?Qt(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&&r){let e=j(a),t=N(r)?j(r):r,n=e,i=qt(n);for(;i&&t!==n;){let e=Xt(i),t=i.getBoundingClientRect(),r=I(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=j(i),i=qt(n)}}return yt({width:u,height:d,x:c,y:l})}function en(e,t){let n=Wt(e).scrollLeft;return t?t.left+n:R(M(e)).left+n}function tn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-en(e,n),y:n.top+t.scrollTop}}function nn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=M(r),s=t?It(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=D(1),u=D(0),d=P(r);if((d||!a)&&((jt(r)!==`body`||Pt(o))&&(c=Wt(r)),d)){let e=R(r);l=Xt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?tn(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 rn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function an(e){let t=Wt(e),n=e.ownerDocument.body,r=E(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=E(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+en(e),o=-t.scrollTop;return I(n).direction===`rtl`&&(a+=E(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}function on(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=j(e),a=M(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ht()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(en(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=25&&(s-=o)}return{width:s,height:c,x:l,y:u}}function sn(e,t){let n=R(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Xt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function cn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=on(e,n,t);else if(t===`document`)r=an(M(e));else if(N(t))r=sn(t,n);else{let n=Qt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return yt(r)}function ln(e,t){let n=t.get(e);if(n)return n;let r=Kt(e,[],!1).filter(e=>N(e)&&jt(e)!==`body`),i=null,a=I(e).position===`fixed`,o=a?L(e):e;for(;N(o)&&!Ut(o);){let e=I(o),t=Bt(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=L(o)}return t.set(e,r),r}function un(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?It(t)?[]:ln(t,this._c):[].concat(n),r],o=cn(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=cn(t,a[e],i);s=E(n.top,s),c=Qe(n.right,c),l=Qe(n.bottom,l),u=E(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dn(e){let{width:t,height:n}=Jt(e);return{width:t,height:n}}function fn(e,t,n){let r=P(t),i=M(t),a=n===`fixed`,o=R(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=D(0);if((r||!a)&&((jt(t)!==`body`||Pt(i))&&(s=Wt(t)),r)){let e=R(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=en(i));let l=i&&!r&&!a?tn(i,s):D(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function pn(e){return I(e).position===`static`}function mn(e,t){if(!P(e)||I(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return M(e)===n&&(n=n.ownerDocument.body),n}function hn(e,t){let n=j(e);if(It(e))return n;if(!P(e)){let t=L(e);for(;t&&!Ut(t);){if(N(t)&&!pn(t))return t;t=L(t)}return n}let r=mn(e,t);for(;r&&Ft(r)&&pn(r);)r=mn(r,t);return r&&Ut(r)&&pn(r)&&!Bt(r)?n:r||Vt(e)||n}let gn=async function(e){let t=this.getOffsetParent||hn,n=this.getDimensions,r=await n(e.floating);return{reference:fn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _n(e){return I(e).direction===`rtl`}let vn={convertOffsetParentRelativeRectToViewportRelativeRect:nn,getDocumentElement:M,getClippingRect:un,getOffsetParent:hn,getElementRects:gn,getClientRects:rn,getDimensions:dn,getScale:Xt,isElement:N,isRTL:_n};function yn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bn(e,t,n){let r=null,i,a=M(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=et(d),h=et(a.clientWidth-(u+f)),g=et(a.clientHeight-(d+p)),_=et(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:E(0,Qe(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!yn(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=j(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function xn(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=Yt(e),u=i||a?[...l?Kt(l):[],...t?Kt(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?bn(l,n,a):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?R(e):null;c&&g();function g(){let t=R(e);h&&!yn(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 Sn=Et,Cn=Dt,wn=Ct,Tn=kt,En=Ot,Dn=(e,t,n)=>{let r=new Map,i=n??{},a={...vn,...i.platform,_c:r};return St(e,t,{...i,platform:a})};var On=class extends Event{oldState;newState;constructor(e,t={}){let n=Object.assign({},t);delete n.oldState,delete n.newState,super(e,n),this.oldState=String(t.oldState||``),this.newState=String(t.newState||``)}},kn=new WeakMap;function An(e,t,n){kn.set(e,setTimeout(()=>{kn.has(e)&&e.dispatchEvent(new On(`toggle`,{cancelable:!1,oldState:t,newState:n}))},0))}var jn=globalThis.ShadowRoot||function(){},Mn=globalThis.HTMLDialogElement||function(){},Nn=new WeakMap,z=new WeakMap,B=new WeakMap,Pn=new WeakMap;function Fn(e){return Pn.get(e)||`hidden`}var In=new WeakMap;function Ln(e){return[...e].pop()}function Rn(e){let t=e.popoverTargetElement;if(!(t instanceof HTMLElement))return;let n=Fn(t);(e.popoverTargetAction!==`show`||n!==`showing`)&&(e.popoverTargetAction!==`hide`||n!==`hidden`)&&(n===`showing`?Qn(t,!0,!0):V(t,!1)&&(In.set(t,e),Zn(t)))}function V(e,t){return!(e.popover!==`auto`&&e.popover!==`manual`&&e.popover!==`hint`||!e.isConnected||t&&Fn(e)!==`showing`||!t&&Fn(e)!==`hidden`||e instanceof Mn&&e.hasAttribute(`open`)||document.fullscreenElement===e)}function zn(e){if(!e)return 0;let t=z.get(document)||new Set,n=B.get(document)||new Set;return n.has(e)?[...n].indexOf(e)+t.size+1:t.has(e)?[...t].indexOf(e)+1:0}function Bn(e){let t=Wn(e),n=Gn(e);return zn(t)>zn(n)?t:n}function Vn(e){let t,n=B.get(e)||new Set,r=z.get(e)||new Set,i=n.size>0?n:r.size>0?r:null;return i?(t=Ln(i),t.isConnected?t:(i.delete(t),Vn(e))):null}function Hn(e){for(let t of e||[])if(!t.isConnected)e.delete(t);else return t;return null}function Un(e){return typeof e.getRootNode==`function`?e.getRootNode():e.parentNode?Un(e.parentNode):e}function Wn(e){for(;e;){if(e instanceof HTMLElement&&e.popover===`auto`&&Pn.get(e)===`showing`)return e;if(e=e instanceof Element&&e.assignedSlot||e.parentElement||Un(e),e instanceof jn&&(e=e.host),e instanceof Document)return}}function Gn(e){for(;e;){let t=e.popoverTargetElement;if(t instanceof HTMLElement)return t;if(e=e.parentElement||Un(e),e instanceof jn&&(e=e.host),e instanceof Document)return}}function Kn(e,t){let n=new Map,r=0;for(let e of t||[])n.set(e,r),r+=1;n.set(e,r),r+=1;let i=null;function a(t){if(!t)return;let r=!1,a=null;for(;!r;){if(a=Wn(t)||null,a===null||!n.has(a))return;(e.popover===`hint`||a.popover===`auto`)&&(r=!0),r||(t=a.parentElement)}let o=n.get(a)??null;(i===null||n.get(i)<o)&&(i=a)}return a(e.parentElement||Un(e)),i}function qn(e){return e.hidden||e instanceof jn||(e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement||e instanceof HTMLFieldSetElement)&&e.disabled||e instanceof HTMLInputElement&&e.type===`hidden`||e instanceof HTMLAnchorElement&&e.href===``?!1:typeof e.tabIndex==`number`&&e.tabIndex!==-1}function Jn(e){if(e.shadowRoot&&e.shadowRoot.delegatesFocus!==!0)return null;let t=e;t.shadowRoot&&(t=t.shadowRoot);let n=t.querySelector(`[autofocus]`);if(n)return n;{let e=t.querySelectorAll(`slot`);for(let t of e){let e=t.assignedElements({flatten:!0});for(let t of e)if(t.hasAttribute(`autofocus`))return t;else if(n=t.querySelector(`[autofocus]`),n)return n}}let r=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){if(qn(i))return i;i=r.nextNode()}}function Yn(e){var t;(t=Jn(e))==null||t.focus()}var Xn=new WeakMap;function Zn(e){if(!V(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new On(`beforetoggle`,{cancelable:!0,oldState:`closed`,newState:`open`}))||!V(e,!1))return;let n=!1,r=e.popover,i=null,a=Kn(e,z.get(t)||new Set),o=Kn(e,B.get(t)||new Set);if(r===`auto`&&(er(B.get(t)||new Set,n,!0),H(a||t,n,!0),i=`auto`),r===`hint`&&(o?(H(o,n,!0),i=`hint`):(er(B.get(t)||new Set,n,!0),a?(H(a,n,!0),i=`auto`):i=`hint`)),r===`auto`||r===`hint`){if(r!==e.popover||!V(e,!1))return;Vn(t)||(n=!0),i===`auto`?(z.has(t)||z.set(t,new Set),z.get(t).add(e)):i===`hint`&&(B.has(t)||B.set(t,new Set),B.get(t).add(e))}Xn.delete(e);let s=t.activeElement;e.classList.add(`:popover-open`),Pn.set(e,`showing`),Nn.has(t)||Nn.set(t,new Set),Nn.get(t).add(e),ar(In.get(e),!0),Yn(e),n&&s&&e.popover===`auto`&&Xn.set(e,s),An(e,`closed`,`open`)}function Qn(e,t=!1,n=!1){var r,i;if(!V(e,!0))return;let a=e.ownerDocument;if([`auto`,`hint`].includes(e.popover)&&(H(e,t,n),!V(e,!0)))return;let o=z.get(a)||new Set,s=o.has(e)&&Ln(o)===e;if(ar(In.get(e),!1),In.delete(e),n&&(e.dispatchEvent(new On(`beforetoggle`,{oldState:`open`,newState:`closed`})),s&&Ln(o)!==e&&H(e,t,n),!V(e,!0)))return;(r=Nn.get(a))==null||r.delete(e),o.delete(e),(i=B.get(a))==null||i.delete(e),e.classList.remove(`:popover-open`),Pn.set(e,`hidden`),n&&An(e,`open`,`closed`);let c=Xn.get(e);c&&(Xn.delete(e),t&&c.focus())}function $n(e,t=!1,n=!1){let r=Vn(e);for(;r;)Qn(r,t,n),r=Vn(e)}function er(e,t=!1,n=!1){let r=Hn(e);for(;r;)Qn(r,t,n),r=Hn(e)}function tr(e,t,n,r){let i=!1,a=!1;for(;i||!a;){a=!0;let o=null,s=!1;for(let n of t)if(n===e)s=!0;else if(s){o=n;break}if(!o)return;for(;Fn(o)===`showing`&&t.size;)Qn(Ln(t),n,r);t.has(e)&&Ln(t)!==e&&(i=!0),i&&(r=!1)}}function H(e,t,n){let r=e.ownerDocument||e;if(e instanceof Document)return $n(r,t,n);if(B.get(r)?.has(e)){tr(e,B.get(r),t,n);return}er(B.get(r)||new Set,t,n),z.get(r)?.has(e)&&tr(e,z.get(r),t,n)}var nr=new WeakMap;function rr(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let n=t.ownerDocument;if(!Vn(n))return;let r=Bn(t);if(r&&e.type===`pointerdown`)nr.set(n,r);else if(e.type===`pointerup`){let e=nr.get(n)===r;nr.delete(n),e&&H(r||n,!1,!0)}}var ir=new WeakMap;function ar(e,t=!1){if(!e)return;ir.has(e)||ir.set(e,e.getAttribute(`aria-expanded`));let n=e.popoverTargetElement;if(n instanceof HTMLElement&&n.popover===`auto`)e.setAttribute(`aria-expanded`,String(t));else{let t=ir.get(e);t?e.setAttribute(`aria-expanded`,t):e.removeAttribute(`aria-expanded`)}}var or=globalThis.ShadowRoot||function(){},sr=`popover-polyfill`;function cr(){return typeof HTMLElement<`u`&&typeof HTMLElement.prototype==`object`&&`popover`in HTMLElement.prototype&&`showPopover`in HTMLElement.prototype}function lr(){return!!(document.body?.showPopover&&!/native code/i.test(document.body.showPopover.toString()))}function U(e,t,n){let r=e[t];Object.defineProperty(e,t,{value(e){return r.call(this,n(e))}})}var ur=/(^|[^\\]):popover-open\b/g;function dr(){return typeof globalThis.CSSLayerBlockRule==`function`}function fr(e){let t=dr(),n=(e??window.POPOVER_POLYFILL_OPTIONS?.layerName??sr).split(`.`).map(e=>CSS.escape(e)).join(`.`);return`
|
|
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`});var t=`1.21.1`;let n=`aria-label`,r=`aria-labelledby`,i={passive:!0,capture:!0},a=()=>typeof window<`u`&&typeof document<`u`,o=()=>a()&&/^Win/i.test(navigator.userAgentData?.platform||navigator.platform),s=typeof HTMLElement>`u`?class{}:HTMLElement;function c(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}let l=(e,...t)=>!a()||window.dsWarnings===!1||console.log(`\x1B[1mDesignsystemet:\x1B[m ${e}`,...t),u=(e,t,n)=>n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),d=(e,t)=>getComputedStyle(e).getPropertyValue(t).trim(),f=/^["']|["']$/g,p=(e,t)=>{let n=u(e,t);return n||=d(e,`--_ds-${t}`).replace(f,``).trim(),n||null},m=e=>{let t=e?.getRootNode?.()||e?.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:e?.ownerDocument||document},h=e=>{let t=e.target?.shadowRoot&&e.composedPath()[0]||e.target;return t?.nodeType===1?t:null},g=e=>{let t=new Set;for(;e;)t.add(e),e=e.nodeType===11?e.host:e.assignedSlot||e.parentNode;return t},_=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.addEventListener(t,...r);return()=>v(e,...t)},v=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.removeEventListener(t,...r)},y=`_dsHotReloadCleanup${t}`,b=(e,t)=>{if(a()){window[y]||(window[y]=new Map);for(let t of window[y]?.get(e)||[])t();window[y]?.set(e,t())}},x=(e,t,n)=>{let r=()=>i.disconnect(),i=new MutationObserver(n=>{if(!a()||!e.isConnected)return r();t(e,n)});return t(e),i.observe(e,n),r},ee=(e,t)=>{let n=document.createElement(e);if(t)for(let[e,r]of Object.entries(t))u(n,e,r);return n},S={define:(e,t)=>!a()||window.customElements.get(e)||window.customElements.define(e,t)},C=0;function w(e){return a()?(window.dsUseId||(window.dsUseId=0),e&&!e.id&&(e.id=`:ds:${++window.dsUseId}`),e?.id||``):`:ds:${++C}`}let T,te=0,ne=0,re=e=>{clearTimeout(ne),T&&(T.textContent=`${e}${te++%2?`\xA0`:``}`),e&&(ne=setTimeout(re,2e3,``))},ie=()=>{document.readyState===`complete`&&(T||(T=ee(`div`,{"aria-live":`assertive`}),T.style.overflow=`hidden`,T.style.position=`fixed`,T.style.whiteSpace=`nowrap`,T.style.width=`1px`),T.isConnected||document.body.appendChild(T))};b(`announce`,()=>[_(document,`focus mouseover`,ie,i)]);let ae=`:click-delegate-hover`,oe=new Set([`A`,`BUTTON`,`DETAILS`,`DIALOG`,`INPUT`,`LABEL`,`SELECT`,`TEXTAREA`]),se=e=>{let t=e.button===1||e.metaKey||e.ctrlKey,n=h(e),r=e.button<2&&de(e);if(!(!r||r.contains(n))){for(let e of g(n))if(e.control===r)return;if(t&&r instanceof HTMLAnchorElement)return window.open(r.href,void 0,r.rel);e.stopImmediatePropagation(),r.click()}},ce,le,ue=e=>{let t=h(e);if(!t||t===le)return;le=t;let n=de(e);ce!==n&&(ce&&ce.classList.remove(ae),n&&n.classList.add(ae),ce=n)},de=e=>{let t;for(let n of e.composedPath()){if(n.nodeType!==1)continue;n.nodeName===`LABEL`&&(n=n.control||n);let e=n.getAttribute(`data-clickdelegatefor`);if(e){let r=m(n).getElementById(e);return r&&!(t&&t!==r)&&!r.disabled&&!r.readOnly?r:void 0}!t&&fe(n)&&(t=n)}},fe=e=>e.isContentEditable||e.popover||oe.has(e.nodeName)||u(e,`role`)===`button`;b(`clickdelegatefor`,()=>[_(window,`click auxclick`,se,!0),_(document,`mousemove`,ue,i)]);var pe=()=>typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,me=pe(),he=me?navigator.userAgent:``,ge=/android/i.test(he),_e=/firefox/i.test(he);me&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var ve=(e,t,n)=>n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),ye=(e,t,n)=>{let r=new MutationObserver(n=>{if(!pe()||!e.isConnected)return i();t(e,n)}),i=Object.assign(()=>r.disconnect(),{takeRecords:()=>r.takeRecords()});return t(e),r.observe(e,n),i},be=`__uDetailsPolyfillSummarys`;if(pe()&&ge&&_e&&!window[be]){let e=document.getElementsByTagName(`summary`);window[be]=ye(document,()=>{for(let t of e){let e=t.parentElement;ve(t,`role`,`button`),ve(t,`aria-expanded`,`${!!e?.open}`)}},{attributeFilter:[`open`],attributes:!0,childList:!0,subtree:!0})}let xe=!1,Se=e=>{let{type:t,clientX:n=0,clientY:r=0}=e,i=h(e);if(i&&t===`pointerdown`)for(let e of g(i)){if(e.nodeName!==`DIALOG`)continue;let t=e.getBoundingClientRect();xe=t.top<=r&&r<=t.bottom&&t.left<=n&&n<=t.right;return}else{let e=i?.nodeName===`DIALOG`&&!xe&&u(i,`closedby`)===`any`;xe=!1,e&&setTimeout(Ce,0,i)}},Ce=e=>e.open&&e.close(),we=`--show-non-modal`,Te=e=>{for(let t of e.composedPath()){let e=t.nodeType===1&&u(t,`command`);if(e===`show-modal`||e===we)return u(t,`aria-haspopup`,`dialog`)}},Ee=({command:e,target:t})=>e===we&&t instanceof HTMLDialogElement&&t.show();b(`dialog`,()=>[_(document,`command`,Ee,i),_(document,`focus`,Te,i),_(document,`pointerdown pointerup`,Se,i)]);let De=a()?document.getElementsByTagName(`fieldset`):[],Oe=()=>{for(let e of De){if(e.hasAttribute(`aria-labelledby`))continue;let t=``;for(let n of e.children){let e=n.nodeName;(e===`LEGEND`||n.getAttribute(`data-field`)===`description`||e===`P`&&n.previousElementSibling?.nodeName===`LEGEND`)&&(t+=`${w(n)} `)}u(e,r,t.trim()||null)}};b(`fieldset`,()=>[x(document,Oe,{childList:!0,subtree:!0})]);let ke=`focusgroup`,Ae=`${ke}start`,je=new WeakMap,Me=new Map,Ne={listbox:{block:!0,wrap:!1,items:`option`},menu:{block:!0,wrap:!0,items:`menuitem`},menubar:{block:!1,wrap:!0,items:`menuitem`},radiogroup:{block:null,wrap:!0,items:`radio`},tablist:{block:!1,wrap:!0,items:`tab`},toolbar:{block:!1,wrap:!1,items:null}},Pe=!1,Fe=new Set([`AUDIO`,`VIDEO`,`TEXTAREA`,`SELECT`,`date`,`datetime-local`,`email`,`month`,`number`,`password`,`range`,`search`,`tel`,`text`,`time`,`url`,`week`]),Ie=a()&&(ke in HTMLElement.prototype||`focusGroup`in HTMLElement.prototype),Le=e=>Pe=e,Re=e=>{if(e.defaultPrevented||e.altKey||e.metaKey||e.ctrlKey)return;let t=e.key===`Tab`,n=e.key===`ArrowUp`||e.key===`ArrowDown`,r=n||e.key===`ArrowLeft`||e.key===`ArrowRight`;if(!t&&!r&&e.key!==`Home`&&e.key!==`End`)return;t&&(Le(!0),setTimeout(Le,100,!1));let i=h(e);if(!i||Je(i))return;let a=Be(g(i));if(a?.role&&a?.el===i&&(a=Be(g(a.el.parentNode))),!a?.role)return;let o=He(a.el,i),s=0;if(t){let e=o.filter(e=>e!==i);return setTimeout(Ye,0,e,Ye(e))}if(e.key===`Home`)s=0;else if(e.key===`End`)s=o.length-1;else{let{direction:t,writingMode:r}=getComputedStyle(i),c=r.startsWith(`vertical`),l=c?r===`vertical-rl`:t===`rtl`,u=e.key===`ArrowDown`||e.key===`ArrowRight`,d=n!==c,f=u!==(!n&&l);if((a.block??d)!==d)return;s=o.indexOf(i)+(f?1:-1),s=a.wrap?(o.length+s)%o.length:Math.max(0,Math.min(s,o.length-1))}o[s]!==i&&e.preventDefault(),o[s]?.focus?.()},ze=e=>{let t=h(e),n=g(t);for(let[e,t]of Me)!n.has(e)&&Me.delete(e)&&t();for(let e of n)e.nodeType===11&&!Me.has(e)&&Me.set(e,_(e,`focus`,ze,i));if(e.target?.shadowRoot)return;let r=Be(n);if(r?.role){if(Pe&&!Je(r.focus)){let e=Ue(He(r.el,null),t),n=r.memory&&e.includes(r.focus)&&r.focus||e.find(e=>e?.hasAttribute(Ae))||e[0];if(n!==t)return n?.focus?.()}r.focus=t}},Be=e=>{for(let t of e){if(t.nodeType!==Node.ELEMENT_NODE)continue;let e=t.getAttribute(ke);if(e!==null){let n=je.get(t);if(n?.key===e)return n;n=Ve(t,e),je.set(t,n);for(let e of He(t))e&&!e.hasAttribute(`role`)&&u(e,`role`,n.items);return t.hasAttribute(`role`)||u(t,`role`,n.role),n}if(Ge(t))return}},Ve=(e,t)=>{let n=new Set(t.toLowerCase().split(` `)),r=[...n].find(e=>e in Ne),i=Ne[r],a=n.has(`inline`),o=n.has(`block`);return{key:t,el:e,role:r,block:a&&o?null:o||!a&&i?.block,focus:null,items:i?.items,memory:!n.has(`nomemory`),wrap:n.has(`wrap`)||!n.has(`nowrap`)&&i?.wrap}},He=(e,t,n=[],r=!1)=>{let i=e?.nodeName===`SLOT`?e.assignedElements({flatten:!0}):(e?.shadowRoot||e)?.children;for(let e=0,a=i?.length||e;i&&e<a;e++){let a=i[e];if(a.nodeName===`SLOT`)He(a,t,n,r);else if(We(a)&&!Ge(a)&&Ke(a)){let e=a.getAttribute(ke);a===t||!r&&e!==`none`&&qe(a)?n.push(a):e!==null&&t===null?n.push(null):He(a,t,n,r||e!==null)}}return n},Ue=(e,t)=>{let n=e.indexOf(t),r=e.indexOf(null,n);return e.slice(e.lastIndexOf(null,n)+1,r===-1?void 0:r)},We=e=>!e.inert&&!e.hidden&&!e.disabled,Ge=e=>e?.nodeName===`DIALOG`||e?.hasAttribute(`popover`),Ke=a()&&typeof Element.prototype.checkVisibility==`function`?e=>e.checkVisibility():e=>e.offsetParent!==null,qe=e=>e.isContentEditable||e.tabIndex>=0&&!e.disabled,Je=e=>e?.isContentEditable||Fe.has(e?.nodeName)||e?.nodeName===`INPUT`&&Fe.has(e.type),Ye=(e,t)=>Array.from(e,(e,n)=>{let r=e?.getAttribute(`tabindex`);return e&&u(e,`tabindex`,t?t[n]:`-1`),r});Ie||b(ke,()=>[_(document,`keydown`,Re),_(document,`focus`,ze,i),()=>{for(let[,e]of Me)e();Me.clear()}]);function Xe(){return typeof HTMLButtonElement<`u`&&`command`in HTMLButtonElement.prototype&&`source`in((globalThis.CommandEvent||{}).prototype||{})}function Ze(){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===`toggle-popover`||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})}a()&&!Xe()&&Ze();let Qe=Math.min,E=Math.max,$e=Math.round,et=Math.floor,D=e=>({x:e,y:e}),tt={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function nt(e,t,n){return E(e,Qe(t,n))}function O(e,t){return typeof e==`function`?e(t):e}function k(e){return e.split(`-`)[0]}function rt(e){return e.split(`-`)[1]}function it(e){return e===`x`?`y`:`x`}function at(e){return e===`y`?`height`:`width`}function A(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ot(e){return it(A(e))}function st(e,t,n){n===void 0&&(n=!1);let r=rt(e),i=ot(e),a=at(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=gt(o)),[o,gt(o)]}function ct(e){let t=gt(e);return[lt(e),t,lt(t)]}function lt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}let ut=[`left`,`right`],dt=[`right`,`left`],ft=[`top`,`bottom`],pt=[`bottom`,`top`];function mt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?dt:ut:t?ut:dt;case`left`:case`right`:return t?ft:pt;default:return[]}}function ht(e,t,n,r){let i=rt(e),a=mt(k(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(lt)))),a}function gt(e){let t=k(e);return tt[t]+e.slice(t.length)}function _t(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function vt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:_t(e)}function yt(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 bt(e,t,n){let{reference:r,floating:i}=e,a=A(t),o=ot(t),s=at(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}}let m=rt(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function xt(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=vt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=yt(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=yt(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 St=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:xt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=bt(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}=bt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ct=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?[gt(o)]:ct(o)),x=p!==`none`;!d&&x&&b.push(...ht(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=st(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)))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{}}}},wt=new Set([`left`,`top`]);async function Tt(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=rt(n),c=A(n)===`y`,l=wt.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 Et=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 Tt(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}}}}},Dt=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(i),p=it(f),m=u[p],h=u[f],g=(e,t)=>nt(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ot=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=it(d),p=u[f],m=u[d],h=O(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};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=wt.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}}}},kt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=O(e,t),c=await i.detectOverflow(t,s),l=k(n),u=rt(n),d=A(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Qe(p-c[m],g),y=Qe(f-c[h],_),b=t.middlewareData.shift,x=!b,ee=v,S=y;b!=null&&b.enabled.x&&(S=_),b!=null&&b.enabled.y&&(ee=g),x&&!u&&(d?S=f-2*E(c.left,c.right):ee=p-2*E(c.top,c.bottom)),await o({...t,availableWidth:S,availableHeight:ee});let C=await i.getDimensions(a.floating);return f!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}};function At(){return typeof window<`u`}function jt(e){return Mt(e)?(e.nodeName||``).toLowerCase():`#document`}function j(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function M(e){return((Mt(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Mt(e){return At()?e instanceof Node||e instanceof j(e).Node:!1}function N(e){return At()?e instanceof Element||e instanceof j(e).Element:!1}function P(e){return At()?e instanceof HTMLElement||e instanceof j(e).HTMLElement:!1}function Nt(e){return!At()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof j(e).ShadowRoot}function Pt(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=I(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ft(e){return/^(table|td|th)$/.test(jt(e))}function It(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}let Lt=/transform|translate|scale|rotate|perspective|filter/,Rt=/paint|layout|strict|content/,F=e=>!!e&&e!==`none`,zt;function Bt(e){let t=N(e)?I(e):e;return F(t.transform)||F(t.translate)||F(t.scale)||F(t.rotate)||F(t.perspective)||!Ht()&&(F(t.backdropFilter)||F(t.filter))||Lt.test(t.willChange||``)||Rt.test(t.contain||``)}function Vt(e){let t=L(e);for(;P(t)&&!Ut(t);){if(Bt(t))return t;if(It(t))return null;t=L(t)}return null}function Ht(){return zt??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),zt}function Ut(e){return/^(html|body|#document)$/.test(jt(e))}function I(e){return j(e).getComputedStyle(e)}function Wt(e){return N(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function L(e){if(jt(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Nt(e)&&e.host||M(e);return Nt(t)?t.host:t}function Gt(e){let t=L(e);return Ut(t)?(e.ownerDocument||e).body:P(t)&&Pt(t)?t:Gt(t)}function Kt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Gt(e),i=r===e.ownerDocument?.body,a=j(r);if(i){let e=qt(a);return t.concat(a,a.visualViewport||[],Pt(r)?r:[],e&&n?Kt(e):[])}else return t.concat(r,Kt(r,[],n))}function qt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jt(e){let t=I(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=P(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$e(n)!==a||$e(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Yt(e){return N(e)?e:e.contextElement}function Xt(e){let t=Yt(e);if(!P(t))return D(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Jt(t),o=(a?$e(n.width):n.width)/r,s=(a?$e(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let Zt=D(0);function Qt(e){let t=j(e);return!Ht()||!t.visualViewport?Zt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $t(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===j(e)}function R(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Yt(e),o=D(1);t&&(r?N(r)&&(o=Xt(r)):o=Xt(e));let s=$t(a,n,r)?Qt(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&&r){let e=j(a),t=N(r)?j(r):r,n=e,i=qt(n);for(;i&&t!==n;){let e=Xt(i),t=i.getBoundingClientRect(),r=I(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=j(i),i=qt(n)}}return yt({width:u,height:d,x:c,y:l})}function en(e,t){let n=Wt(e).scrollLeft;return t?t.left+n:R(M(e)).left+n}function tn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-en(e,n),y:n.top+t.scrollTop}}function nn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=M(r),s=t?It(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=D(1),u=D(0),d=P(r);if((d||!a)&&((jt(r)!==`body`||Pt(o))&&(c=Wt(r)),d)){let e=R(r);l=Xt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?tn(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 rn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function an(e){let t=Wt(e),n=e.ownerDocument.body,r=E(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=E(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+en(e),o=-t.scrollTop;return I(n).direction===`rtl`&&(a+=E(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}function on(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=j(e),a=M(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ht()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(en(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=25&&(s-=o)}return{width:s,height:c,x:l,y:u}}function sn(e,t){let n=R(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Xt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function cn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=on(e,n,t);else if(t===`document`)r=an(M(e));else if(N(t))r=sn(t,n);else{let n=Qt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return yt(r)}function ln(e,t){let n=t.get(e);if(n)return n;let r=Kt(e,[],!1).filter(e=>N(e)&&jt(e)!==`body`),i=null,a=I(e).position===`fixed`,o=a?L(e):e;for(;N(o)&&!Ut(o);){let e=I(o),t=Bt(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=L(o)}return t.set(e,r),r}function un(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?It(t)?[]:ln(t,this._c):[].concat(n),r],o=cn(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=cn(t,a[e],i);s=E(n.top,s),c=Qe(n.right,c),l=Qe(n.bottom,l),u=E(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dn(e){let{width:t,height:n}=Jt(e);return{width:t,height:n}}function fn(e,t,n){let r=P(t),i=M(t),a=n===`fixed`,o=R(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=D(0);if((r||!a)&&((jt(t)!==`body`||Pt(i))&&(s=Wt(t)),r)){let e=R(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=en(i));let l=i&&!r&&!a?tn(i,s):D(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function pn(e){return I(e).position===`static`}function mn(e,t){if(!P(e)||I(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return M(e)===n&&(n=n.ownerDocument.body),n}function hn(e,t){let n=j(e);if(It(e))return n;if(!P(e)){let t=L(e);for(;t&&!Ut(t);){if(N(t)&&!pn(t))return t;t=L(t)}return n}let r=mn(e,t);for(;r&&Ft(r)&&pn(r);)r=mn(r,t);return r&&Ut(r)&&pn(r)&&!Bt(r)?n:r||Vt(e)||n}let gn=async function(e){let t=this.getOffsetParent||hn,n=this.getDimensions,r=await n(e.floating);return{reference:fn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _n(e){return I(e).direction===`rtl`}let vn={convertOffsetParentRelativeRectToViewportRelativeRect:nn,getDocumentElement:M,getClippingRect:un,getOffsetParent:hn,getElementRects:gn,getClientRects:rn,getDimensions:dn,getScale:Xt,isElement:N,isRTL:_n};function yn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bn(e,t,n){let r=null,i,a=M(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=et(d),h=et(a.clientWidth-(u+f)),g=et(a.clientHeight-(d+p)),_=et(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:E(0,Qe(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!yn(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=j(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function xn(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=Yt(e),u=i||a?[...l?Kt(l):[],...t?Kt(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?bn(l,n,a):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?R(e):null;c&&g();function g(){let t=R(e);h&&!yn(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 Sn=Et,Cn=Dt,wn=Ct,Tn=kt,En=Ot,Dn=(e,t,n)=>{let r=new Map,i=n??{},a={...vn,...i.platform,_c:r};return St(e,t,{...i,platform:a})};var On=class extends Event{oldState;newState;constructor(e,t={}){let n=Object.assign({},t);delete n.oldState,delete n.newState,super(e,n),this.oldState=String(t.oldState||``),this.newState=String(t.newState||``)}},kn=new WeakMap;function An(e,t,n){kn.set(e,setTimeout(()=>{kn.has(e)&&e.dispatchEvent(new On(`toggle`,{cancelable:!1,oldState:t,newState:n}))},0))}var jn=globalThis.ShadowRoot||function(){},Mn=globalThis.HTMLDialogElement||function(){},Nn=new WeakMap,z=new WeakMap,B=new WeakMap,Pn=new WeakMap;function Fn(e){return Pn.get(e)||`hidden`}var In=new WeakMap;function Ln(e){return[...e].pop()}function Rn(e){let t=e.popoverTargetElement;if(!(t instanceof HTMLElement))return;let n=Fn(t);(e.popoverTargetAction!==`show`||n!==`showing`)&&(e.popoverTargetAction!==`hide`||n!==`hidden`)&&(n===`showing`?Qn(t,!0,!0):V(t,!1)&&(In.set(t,e),Zn(t)))}function V(e,t){return!(e.popover!==`auto`&&e.popover!==`manual`&&e.popover!==`hint`||!e.isConnected||t&&Fn(e)!==`showing`||!t&&Fn(e)!==`hidden`||e instanceof Mn&&e.hasAttribute(`open`)||document.fullscreenElement===e)}function zn(e){if(!e)return 0;let t=z.get(document)||new Set,n=B.get(document)||new Set;return n.has(e)?[...n].indexOf(e)+t.size+1:t.has(e)?[...t].indexOf(e)+1:0}function Bn(e){let t=Wn(e),n=Gn(e);return zn(t)>zn(n)?t:n}function Vn(e){let t,n=B.get(e)||new Set,r=z.get(e)||new Set,i=n.size>0?n:r.size>0?r:null;return i?(t=Ln(i),t.isConnected?t:(i.delete(t),Vn(e))):null}function Hn(e){for(let t of e||[])if(!t.isConnected)e.delete(t);else return t;return null}function Un(e){return typeof e.getRootNode==`function`?e.getRootNode():e.parentNode?Un(e.parentNode):e}function Wn(e){for(;e;){if(e instanceof HTMLElement&&e.popover===`auto`&&Pn.get(e)===`showing`)return e;if(e=e instanceof Element&&e.assignedSlot||e.parentElement||Un(e),e instanceof jn&&(e=e.host),e instanceof Document)return}}function Gn(e){for(;e;){let t=e.popoverTargetElement;if(t instanceof HTMLElement)return t;if(e=e.parentElement||Un(e),e instanceof jn&&(e=e.host),e instanceof Document)return}}function Kn(e,t){let n=new Map,r=0;for(let e of t||[])n.set(e,r),r+=1;n.set(e,r),r+=1;let i=null;function a(t){if(!t)return;let r=!1,a=null;for(;!r;){if(a=Wn(t)||null,a===null||!n.has(a))return;(e.popover===`hint`||a.popover===`auto`)&&(r=!0),r||(t=a.parentElement)}let o=n.get(a)??null;(i===null||n.get(i)<o)&&(i=a)}return a(e.parentElement||Un(e)),i}function qn(e){return e.hidden||e instanceof jn||(e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement||e instanceof HTMLFieldSetElement)&&e.disabled||e instanceof HTMLInputElement&&e.type===`hidden`||e instanceof HTMLAnchorElement&&e.href===``?!1:typeof e.tabIndex==`number`&&e.tabIndex!==-1}function Jn(e){if(e.shadowRoot&&e.shadowRoot.delegatesFocus!==!0)return null;let t=e;t.shadowRoot&&(t=t.shadowRoot);let n=t.querySelector(`[autofocus]`);if(n)return n;{let e=t.querySelectorAll(`slot`);for(let t of e){let e=t.assignedElements({flatten:!0});for(let t of e)if(t.hasAttribute(`autofocus`))return t;else if(n=t.querySelector(`[autofocus]`),n)return n}}let r=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){if(qn(i))return i;i=r.nextNode()}}function Yn(e){var t;(t=Jn(e))==null||t.focus()}var Xn=new WeakMap;function Zn(e){if(!V(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new On(`beforetoggle`,{cancelable:!0,oldState:`closed`,newState:`open`}))||!V(e,!1))return;let n=!1,r=e.popover,i=null,a=Kn(e,z.get(t)||new Set),o=Kn(e,B.get(t)||new Set);if(r===`auto`&&(er(B.get(t)||new Set,n,!0),H(a||t,n,!0),i=`auto`),r===`hint`&&(o?(H(o,n,!0),i=`hint`):(er(B.get(t)||new Set,n,!0),a?(H(a,n,!0),i=`auto`):i=`hint`)),r===`auto`||r===`hint`){if(r!==e.popover||!V(e,!1))return;Vn(t)||(n=!0),i===`auto`?(z.has(t)||z.set(t,new Set),z.get(t).add(e)):i===`hint`&&(B.has(t)||B.set(t,new Set),B.get(t).add(e))}Xn.delete(e);let s=t.activeElement;e.classList.add(`:popover-open`),Pn.set(e,`showing`),Nn.has(t)||Nn.set(t,new Set),Nn.get(t).add(e),ar(In.get(e),!0),Yn(e),n&&s&&e.popover===`auto`&&Xn.set(e,s),An(e,`closed`,`open`)}function Qn(e,t=!1,n=!1){var r,i;if(!V(e,!0))return;let a=e.ownerDocument;if([`auto`,`hint`].includes(e.popover)&&(H(e,t,n),!V(e,!0)))return;let o=z.get(a)||new Set,s=o.has(e)&&Ln(o)===e;if(ar(In.get(e),!1),In.delete(e),n&&(e.dispatchEvent(new On(`beforetoggle`,{oldState:`open`,newState:`closed`})),s&&Ln(o)!==e&&H(e,t,n),!V(e,!0)))return;(r=Nn.get(a))==null||r.delete(e),o.delete(e),(i=B.get(a))==null||i.delete(e),e.classList.remove(`:popover-open`),Pn.set(e,`hidden`),n&&An(e,`open`,`closed`);let c=Xn.get(e);c&&(Xn.delete(e),t&&c.focus())}function $n(e,t=!1,n=!1){let r=Vn(e);for(;r;)Qn(r,t,n),r=Vn(e)}function er(e,t=!1,n=!1){let r=Hn(e);for(;r;)Qn(r,t,n),r=Hn(e)}function tr(e,t,n,r){let i=!1,a=!1;for(;i||!a;){a=!0;let o=null,s=!1;for(let n of t)if(n===e)s=!0;else if(s){o=n;break}if(!o)return;for(;Fn(o)===`showing`&&t.size;)Qn(Ln(t),n,r);t.has(e)&&Ln(t)!==e&&(i=!0),i&&(r=!1)}}function H(e,t,n){let r=e.ownerDocument||e;if(e instanceof Document)return $n(r,t,n);if(B.get(r)?.has(e)){tr(e,B.get(r),t,n);return}er(B.get(r)||new Set,t,n),z.get(r)?.has(e)&&tr(e,z.get(r),t,n)}var nr=new WeakMap;function rr(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let n=t.ownerDocument||t;if(!Vn(n))return;let r=Bn(t);if(r&&e.type===`pointerdown`)nr.set(n,r);else if(e.type===`pointerup`){let e=nr.get(n)===r;nr.delete(n),e&&H(r||n,!1,!0)}}var ir=new WeakMap;function ar(e,t=!1){if(!e)return;ir.has(e)||ir.set(e,e.getAttribute(`aria-expanded`));let n=e.popoverTargetElement;if(n instanceof HTMLElement&&n.popover===`auto`)e.setAttribute(`aria-expanded`,String(t));else{let t=ir.get(e);t?e.setAttribute(`aria-expanded`,t):e.removeAttribute(`aria-expanded`)}}var or=globalThis.ShadowRoot||function(){},sr=`popover-polyfill`;function cr(){return typeof HTMLElement<`u`&&typeof HTMLElement.prototype==`object`&&`popover`in HTMLElement.prototype&&`showPopover`in HTMLElement.prototype}function lr(){return!!(document.body?.showPopover&&!/native code/i.test(document.body.showPopover.toString()))}function U(e,t,n){let r=e[t];Object.defineProperty(e,t,{value(e){return r.call(this,n(e))}})}var ur=/(^|[^\\]):popover-open\b/g;function dr(){return typeof globalThis.CSSLayerBlockRule==`function`}function fr(e){let t=dr(),n=(e??window.POPOVER_POLYFILL_OPTIONS?.layerName??sr).split(`.`).map(e=>CSS.escape(e)).join(`.`);return`
|
|
2
2
|
${t?`@layer ${n} {`:``}
|
|
3
3
|
:where([popover]) {
|
|
4
4
|
position: fixed;
|