diff --git a/README.md b/README.md index 369a9bd..8956475 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Add `corex` to your `mix.exs` dependencies: ```elixir def deps do [ - {:corex, "~> 0.1.0-alpha.23"} + {:corex, "~> 0.1.0-alpha.24"} ] end ``` diff --git a/assets/components/combobox.ts b/assets/components/combobox.ts index 627b105..f641321 100644 --- a/assets/components/combobox.ts +++ b/assets/components/combobox.ts @@ -94,14 +94,11 @@ export class Combobox extends Component { .querySelectorAll('[data-scope="combobox"][data-part="item-group"]:not([data-template])') .forEach((el) => el.remove()); - const items = this.api.collection.items; - - const groups = this.api.collection.group?.() ?? []; - const hasGroupsInCollection = groups.some(([group]) => group != null); - - if (hasGroupsInCollection) { + if (this.hasGroups) { + const groups = this.api.collection.group?.() ?? []; this.renderGroupedItems(contentEl, templatesContainer, groups); } else { + const items = this.options?.length ? this.options : this.allOptions; this.renderFlatItems(contentEl, templatesContainer, items); } } @@ -159,9 +156,8 @@ export class Combobox extends Component { } cloneItem(templatesContainer: HTMLElement, item: ComboboxItem): HTMLElement | null { - const value = this.api.collection.getItemValue(item); + const value = (this.api.collection.getItemValue?.(item) as string | undefined) ?? item.id ?? ""; - // Find template by data-value (templates are rendered per item in Elixir when custom slots are used) const template = templatesContainer.querySelector( `[data-scope="combobox"][data-part="item"][data-value="${value}"][data-template]` ); diff --git a/assets/components/signature-pad.ts b/assets/components/signature-pad.ts index 069b794..24384eb 100644 --- a/assets/components/signature-pad.ts +++ b/assets/components/signature-pad.ts @@ -95,24 +95,18 @@ export class SignaturePad extends Component { ); if (clearBtn) { this.spreadProps(clearBtn, this.api.getClearTriggerProps()); - const hasPaths = this.api.paths.length > 0 || !!this.api.currentPath; - clearBtn.hidden = !hasPaths; } const hiddenInput = rootEl.querySelector( '[data-scope="signature-pad"][data-part="hidden-input"]' ); if (hiddenInput) { - const pathsForValue = this.paths.length > 0 ? this.paths : this.api.paths; - if (this.paths.length === 0 && this.api.paths.length > 0) { - this.paths = [...this.api.paths]; - } - const pathsValue = pathsForValue.length > 0 ? JSON.stringify(pathsForValue) : ""; - this.spreadProps(hiddenInput, this.api.getHiddenInputProps({ value: pathsValue })); - if (this.name) { - hiddenInput.name = this.name; - } - hiddenInput.value = pathsValue; + this.spreadProps( + hiddenInput, + this.api.getHiddenInputProps({ + value: this.api.paths.length > 0 ? JSON.stringify(this.api.paths) : "", + }) + ); } this.syncPaths(); diff --git a/assets/hooks/combobox.ts b/assets/hooks/combobox.ts index 8501cc1..aef5013 100644 --- a/assets/hooks/combobox.ts +++ b/assets/hooks/combobox.ts @@ -36,7 +36,7 @@ const ComboboxHook: Hook = { const pushEvent = this.pushEvent.bind(this); const allItems = JSON.parse(el.dataset.collection || "[]"); - const hasGroups = allItems.some((item: { group?: unknown }) => item.group !== undefined); + const hasGroups = allItems.some((item: { group?: unknown }) => Boolean(item.group)); const props: Props = { id: el.id, @@ -55,7 +55,7 @@ const ComboboxHook: Hook = { invalid: getBoolean(el, "invalid"), allowCustomValue: false, selectionBehavior: "replace", - name: getString(el, "name"), + name: "", form: getString(el, "form"), readOnly: getBoolean(el, "readOnly"), required: getBoolean(el, "required"), @@ -126,12 +126,18 @@ const ComboboxHook: Hook = { '[data-scope="combobox"][data-part="value-input"]' ); if (valueInput) { + const toId = (val: string) => { + const item = allItems.find( + (i: { id?: string; label?: string }) => String(i.id ?? "") === val || i.label === val + ); + return item ? String(item.id ?? "") : val; + }; const idValue = details.value.length === 0 ? "" : details.value.length === 1 - ? String(details.value[0]) - : details.value.map(String).join(","); + ? toId(String(details.value[0])) + : details.value.map((v) => toId(String(v))).join(","); valueInput.value = idValue; const formId = valueInput.getAttribute("form"); @@ -205,6 +211,14 @@ const ComboboxHook: Hook = { combobox.setAllOptions(allItems); combobox.init(); + const visibleInput = el.querySelector( + '[data-scope="combobox"][data-part="input"]' + ); + if (visibleInput) { + visibleInput.removeAttribute("name"); + visibleInput.removeAttribute("form"); + } + const initialValue = getBoolean(el, "controlled") ? getStringList(el, "value") : getStringList(el, "defaultValue"); @@ -236,7 +250,7 @@ const ComboboxHook: Hook = { updated(this: object & HookInterface & ComboboxHookState) { const newCollection = JSON.parse(this.el.dataset.collection || "[]"); - const hasGroups = newCollection.some((item: { group?: unknown }) => item.group !== undefined); + const hasGroups = newCollection.some((item: { group?: unknown }) => Boolean(item.group)); if (this.combobox) { this.combobox.hasGroups = hasGroups; diff --git a/assets/hooks/signature-pad.ts b/assets/hooks/signature-pad.ts index c200b8f..f754e34 100644 --- a/assets/hooks/signature-pad.ts +++ b/assets/hooks/signature-pad.ts @@ -49,11 +49,14 @@ const SignaturePadHook: Hook = { drawing: buildDrawingOptions(el), onDrawEnd: (details) => { signaturePad.setPaths(details.paths); + const hiddenInput = el.querySelector( '[data-scope="signature-pad"][data-part="hidden-input"]' ); if (hiddenInput) { - hiddenInput.value = JSON.stringify(details.paths); + hiddenInput.value = details.paths.length > 0 ? JSON.stringify(details.paths) : ""; + hiddenInput.dispatchEvent(new Event("input", { bubbles: true })); + hiddenInput.dispatchEvent(new Event("change", { bubbles: true })); } details.getDataUrl("image/png").then((url) => { @@ -87,29 +90,10 @@ const SignaturePadHook: Hook = { signaturePad.init(); this.signaturePad = signaturePad; - const initialPaths = controlled ? paths : defaultPaths; - if (initialPaths.length > 0) { - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.dispatchEvent(new Event("input", { bubbles: true })); - hiddenInput.dispatchEvent(new Event("change", { bubbles: true })); - } - } - this.onClear = (event: Event) => { const { id: targetId } = (event as CustomEvent<{ id: string }>).detail; if (targetId && targetId !== el.id) return; signaturePad.api.clear(); - signaturePad.imageURL = ""; - signaturePad.setPaths([]); - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.value = ""; - } }; el.addEventListener("phx:signature-pad:clear", this.onClear); @@ -120,14 +104,6 @@ const SignaturePadHook: Hook = { const targetId = payload.signature_pad_id; if (targetId && targetId !== el.id) return; signaturePad.api.clear(); - signaturePad.imageURL = ""; - signaturePad.setPaths([]); - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.value = ""; - } }) ); }, diff --git a/e2e/lib/e2e_web/live/admin_live/form.ex b/e2e/lib/e2e_web/live/admin_live/form.ex index 3e5bda1..fd176fa 100644 --- a/e2e/lib/e2e_web/live/admin_live/form.ex +++ b/e2e/lib/e2e_web/live/admin_live/form.ex @@ -60,7 +60,7 @@ defmodule E2eWeb.AdminLive.Form do {msg} - <.signature_pad field={@form[:signature]} class="signature-pad" controlled> + <.signature_pad field={@form[:signature]} class="signature-pad"> <:label>Sign here <:clear_trigger> <.icon name="hero-x-mark" /> diff --git a/guides/installation.md b/guides/installation.md index 98ae84a..32a2ee7 100644 --- a/guides/installation.md +++ b/guides/installation.md @@ -37,7 +37,7 @@ Add `corex` to your `mix.exs` dependencies: ```elixir def deps do [ - {:corex, "~> 0.1.0-alpha.23"} + {:corex, "~> 0.1.0-alpha.24"} ] end ``` diff --git a/lib/components/combobox.ex b/lib/components/combobox.ex index a47d2c5..c736324 100644 --- a/lib/components/combobox.ex +++ b/lib/components/combobox.ex @@ -319,7 +319,7 @@ defmodule Corex.Combobox do bubble: @bubble, disabled: @disabled })}>
- +
{render_slot(@label)} diff --git a/lib/components/combobox/connect.ex b/lib/components/combobox/connect.ex index abd5a93..0cc7956 100644 --- a/lib/components/combobox/connect.ex +++ b/lib/components/combobox/connect.ex @@ -106,7 +106,6 @@ defmodule Corex.Combobox.Connect do "data-invalid" => get_boolean(assigns.invalid), "aria-controls" => "combobox:#{assigns.id}:content", "placeholder" => assigns.placeholder, - "required" => get_boolean(assigns.required), "autoFocus" => get_boolean(assigns.auto_focus) } end diff --git a/lib/components/signature_pad.ex b/lib/components/signature_pad.ex index 2785f45..3d4dbcc 100644 --- a/lib/components/signature_pad.ex +++ b/lib/components/signature_pad.ex @@ -128,10 +128,6 @@ defmodule Corex.SignaturePad do ### With Ecto changeset - When using Ecto changeset for validation and inside a Live view you must enable the controlled mode. - - This allows the Live View to be the source of truth and the component to be in sync accordingly. - First create your schema and changeset: ```elixir @@ -174,7 +170,6 @@ defmodule Corex.SignaturePad do field={@form[:signature]} id="my-signature-pad" class="signature-pad" - controlled > <:label>Sign here <:clear_trigger> @@ -418,7 +413,13 @@ defmodule Corex.SignaturePad do {render_slot(@label)}
- + +
-
+
<%= if @label != [] do %>

<%= render_slot(@label) %> diff --git a/mix.exs b/mix.exs index bef873c..9a1f3e4 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Corex.MixProject do use Mix.Project - @version "0.1.0-alpha.23" + @version "0.1.0-alpha.24" @elixir_requirement "~> 1.15" def project do diff --git a/package.json b/package.json index 3e39a63..560b85b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "corex", - "version": "0.1.0-alpha.23", + "version": "0.1.0-alpha.24", "description": "The official JavaScript client for the Corex Phoenix Hooks.", "license": "MIT", "module": "./priv/static/corex.mjs", diff --git a/priv/static/combobox.mjs b/priv/static/combobox.mjs index a9b0bc5..75c2fd8 100644 --- a/priv/static/combobox.mjs +++ b/priv/static/combobox.mjs @@ -1665,12 +1665,11 @@ var Combobox = class extends Component { if (!templatesContainer) return; contentEl.querySelectorAll('[data-scope="combobox"][data-part="item"]:not([data-template])').forEach((el) => el.remove()); contentEl.querySelectorAll('[data-scope="combobox"][data-part="item-group"]:not([data-template])').forEach((el) => el.remove()); - const items = this.api.collection.items; - const groups = this.api.collection.group?.() ?? []; - const hasGroupsInCollection = groups.some(([group]) => group != null); - if (hasGroupsInCollection) { + if (this.hasGroups) { + const groups = this.api.collection.group?.() ?? []; this.renderGroupedItems(contentEl, templatesContainer, groups); } else { + const items = this.options?.length ? this.options : this.allOptions; this.renderFlatItems(contentEl, templatesContainer, items); } } @@ -1709,7 +1708,7 @@ var Combobox = class extends Component { } } cloneItem(templatesContainer, item) { - const value = this.api.collection.getItemValue(item); + const value = this.api.collection.getItemValue?.(item) ?? item.id ?? ""; const template = templatesContainer.querySelector( `[data-scope="combobox"][data-part="item"][data-value="${value}"][data-template]` ); @@ -1769,7 +1768,7 @@ var ComboboxHook = { const el = this.el; const pushEvent = this.pushEvent.bind(this); const allItems = JSON.parse(el.dataset.collection || "[]"); - const hasGroups = allItems.some((item) => item.group !== void 0); + const hasGroups = allItems.some((item) => Boolean(item.group)); const props2 = { id: el.id, ...getBoolean(el, "controlled") ? { value: getStringList(el, "value") } : { defaultValue: getStringList(el, "defaultValue") }, @@ -1785,7 +1784,7 @@ var ComboboxHook = { invalid: getBoolean(el, "invalid"), allowCustomValue: false, selectionBehavior: "replace", - name: getString(el, "name"), + name: "", form: getString(el, "form"), readOnly: getBoolean(el, "readOnly"), required: getBoolean(el, "required"), @@ -1854,7 +1853,13 @@ var ComboboxHook = { '[data-scope="combobox"][data-part="value-input"]' ); if (valueInput) { - const idValue = details.value.length === 0 ? "" : details.value.length === 1 ? String(details.value[0]) : details.value.map(String).join(","); + const toId = (val) => { + const item = allItems.find( + (i) => String(i.id ?? "") === val || i.label === val + ); + return item ? String(item.id ?? "") : val; + }; + const idValue = details.value.length === 0 ? "" : details.value.length === 1 ? toId(String(details.value[0])) : details.value.map((v) => toId(String(v))).join(","); valueInput.value = idValue; const formId = valueInput.getAttribute("form"); let form = null; @@ -1919,6 +1924,13 @@ var ComboboxHook = { combobox.hasGroups = hasGroups; combobox.setAllOptions(allItems); combobox.init(); + const visibleInput = el.querySelector( + '[data-scope="combobox"][data-part="input"]' + ); + if (visibleInput) { + visibleInput.removeAttribute("name"); + visibleInput.removeAttribute("form"); + } const initialValue = getBoolean(el, "controlled") ? getStringList(el, "value") : getStringList(el, "defaultValue"); if (initialValue && initialValue.length > 0) { const selectedItems = allItems.filter( @@ -1943,7 +1955,7 @@ var ComboboxHook = { }, updated() { const newCollection = JSON.parse(this.el.dataset.collection || "[]"); - const hasGroups = newCollection.some((item) => item.group !== void 0); + const hasGroups = newCollection.some((item) => Boolean(item.group)); if (this.combobox) { this.combobox.hasGroups = hasGroups; this.combobox.setAllOptions(newCollection); diff --git a/priv/static/corex.js b/priv/static/corex.js index 91052de..4d9509e 100644 --- a/priv/static/corex.js +++ b/priv/static/corex.js @@ -12499,7 +12499,7 @@ var Corex = (() => { return connect8(this.machine.service, normalizeProps); } renderItems() { - var _a, _b, _c; + var _a, _b, _c, _d; const contentEl = this.el.querySelector( '[data-scope="combobox"][data-part="content"]' ); @@ -12508,12 +12508,11 @@ var Corex = (() => { if (!templatesContainer) return; contentEl.querySelectorAll('[data-scope="combobox"][data-part="item"]:not([data-template])').forEach((el) => el.remove()); contentEl.querySelectorAll('[data-scope="combobox"][data-part="item-group"]:not([data-template])').forEach((el) => el.remove()); - const items = this.api.collection.items; - const groups = (_c = (_b = (_a = this.api.collection).group) == null ? void 0 : _b.call(_a)) != null ? _c : []; - const hasGroupsInCollection = groups.some(([group2]) => group2 != null); - if (hasGroupsInCollection) { + if (this.hasGroups) { + const groups = (_c = (_b = (_a = this.api.collection).group) == null ? void 0 : _b.call(_a)) != null ? _c : []; this.renderGroupedItems(contentEl, templatesContainer, groups); } else { + const items = ((_d = this.options) == null ? void 0 : _d.length) ? this.options : this.allOptions; this.renderFlatItems(contentEl, templatesContainer, items); } } @@ -12552,7 +12551,8 @@ var Corex = (() => { } } cloneItem(templatesContainer, item) { - const value = this.api.collection.getItemValue(item); + var _a, _b, _c, _d; + const value = (_d = (_c = (_b = (_a = this.api.collection).getItemValue) == null ? void 0 : _b.call(_a, item)) != null ? _c : item.id) != null ? _d : ""; const template = templatesContainer.querySelector( `[data-scope="combobox"][data-part="item"][data-value="${value}"][data-template]` ); @@ -12599,7 +12599,7 @@ var Corex = (() => { const el = this.el; const pushEvent = this.pushEvent.bind(this); const allItems = JSON.parse(el.dataset.collection || "[]"); - const hasGroups = allItems.some((item) => item.group !== void 0); + const hasGroups = allItems.some((item) => Boolean(item.group)); const props26 = __spreadProps(__spreadValues({ id: el.id }, getBoolean(el, "controlled") ? { value: getStringList(el, "value") } : { defaultValue: getStringList(el, "defaultValue") }), { @@ -12615,7 +12615,7 @@ var Corex = (() => { invalid: getBoolean(el, "invalid"), allowCustomValue: false, selectionBehavior: "replace", - name: getString(el, "name"), + name: "", form: getString(el, "form"), readOnly: getBoolean(el, "readOnly"), required: getBoolean(el, "required"), @@ -12684,7 +12684,17 @@ var Corex = (() => { '[data-scope="combobox"][data-part="value-input"]' ); if (valueInput) { - const idValue = details.value.length === 0 ? "" : details.value.length === 1 ? String(details.value[0]) : details.value.map(String).join(","); + const toId = (val) => { + var _a; + const item = allItems.find( + (i2) => { + var _a2; + return String((_a2 = i2.id) != null ? _a2 : "") === val || i2.label === val; + } + ); + return item ? String((_a = item.id) != null ? _a : "") : val; + }; + const idValue = details.value.length === 0 ? "" : details.value.length === 1 ? toId(String(details.value[0])) : details.value.map((v2) => toId(String(v2))).join(","); valueInput.value = idValue; const formId = valueInput.getAttribute("form"); let form = null; @@ -12749,6 +12759,13 @@ var Corex = (() => { combobox.hasGroups = hasGroups; combobox.setAllOptions(allItems); combobox.init(); + const visibleInput = el.querySelector( + '[data-scope="combobox"][data-part="input"]' + ); + if (visibleInput) { + visibleInput.removeAttribute("name"); + visibleInput.removeAttribute("form"); + } const initialValue = getBoolean(el, "controlled") ? getStringList(el, "value") : getStringList(el, "defaultValue"); if (initialValue && initialValue.length > 0) { const selectedItems = allItems.filter( @@ -12779,7 +12796,7 @@ var Corex = (() => { }, updated() { const newCollection = JSON.parse(this.el.dataset.collection || "[]"); - const hasGroups = newCollection.some((item) => item.group !== void 0); + const hasGroups = newCollection.some((item) => Boolean(item.group)); if (this.combobox) { this.combobox.hasGroups = hasGroups; this.combobox.setAllOptions(newCollection); @@ -28116,23 +28133,17 @@ var Corex = (() => { ); if (clearBtn) { this.spreadProps(clearBtn, this.api.getClearTriggerProps()); - const hasPaths = this.api.paths.length > 0 || !!this.api.currentPath; - clearBtn.hidden = !hasPaths; } const hiddenInput = rootEl.querySelector( '[data-scope="signature-pad"][data-part="hidden-input"]' ); if (hiddenInput) { - const pathsForValue = this.paths.length > 0 ? this.paths : this.api.paths; - if (this.paths.length === 0 && this.api.paths.length > 0) { - this.paths = [...this.api.paths]; - } - const pathsValue = pathsForValue.length > 0 ? JSON.stringify(pathsForValue) : ""; - this.spreadProps(hiddenInput, this.api.getHiddenInputProps({ value: pathsValue })); - if (this.name) { - hiddenInput.name = this.name; - } - hiddenInput.value = pathsValue; + this.spreadProps( + hiddenInput, + this.api.getHiddenInputProps({ + value: this.api.paths.length > 0 ? JSON.stringify(this.api.paths) : "" + }) + ); } this.syncPaths(); } @@ -28155,7 +28166,9 @@ var Corex = (() => { '[data-scope="signature-pad"][data-part="hidden-input"]' ); if (hiddenInput) { - hiddenInput.value = JSON.stringify(details.paths); + hiddenInput.value = details.paths.length > 0 ? JSON.stringify(details.paths) : ""; + hiddenInput.dispatchEvent(new Event("input", { bubbles: true })); + hiddenInput.dispatchEvent(new Event("change", { bubbles: true })); } details.getDataUrl("image/png").then((url) => { signaturePad.imageURL = url; @@ -28185,28 +28198,10 @@ var Corex = (() => { })); signaturePad.init(); this.signaturePad = signaturePad; - const initialPaths = controlled ? paths : defaultPaths; - if (initialPaths.length > 0) { - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.dispatchEvent(new Event("input", { bubbles: true })); - hiddenInput.dispatchEvent(new Event("change", { bubbles: true })); - } - } this.onClear = (event) => { const { id: targetId } = event.detail; if (targetId && targetId !== el.id) return; signaturePad.api.clear(); - signaturePad.imageURL = ""; - signaturePad.setPaths([]); - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.value = ""; - } }; el.addEventListener("phx:signature-pad:clear", this.onClear); this.handlers = []; @@ -28215,14 +28210,6 @@ var Corex = (() => { const targetId = payload.signature_pad_id; if (targetId && targetId !== el.id) return; signaturePad.api.clear(); - signaturePad.imageURL = ""; - signaturePad.setPaths([]); - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.value = ""; - } }) ); }, @@ -33235,12 +33222,6 @@ var Corex = (() => { ); }, updated() { - var _a; - if (!getBoolean(this.el, "controlled")) return; - (_a = this.treeView) == null ? void 0 : _a.updateProps({ - expandedValue: getStringList(this.el, "expandedValue"), - selectedValue: getStringList(this.el, "selectedValue") - }); }, destroyed() { var _a; diff --git a/priv/static/corex.min.js b/priv/static/corex.min.js index 0665523..6d25ace 100644 --- a/priv/static/corex.min.js +++ b/priv/static/corex.min.js @@ -1,11 +1,11 @@ "use strict";var Corex=(()=>{var Kr=Object.defineProperty,Ff=Object.defineProperties,$f=Object.getOwnPropertyDescriptor,Hf=Object.getOwnPropertyDescriptors,Bf=Object.getOwnPropertyNames,Wr=Object.getOwnPropertySymbols;var Ha=Object.prototype.hasOwnProperty,rc=Object.prototype.propertyIsEnumerable;var Fa=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_f=e=>{throw TypeError(e)};var $a=(e,t,n)=>t in e?Kr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))Ha.call(t,n)&&$a(e,n,t[n]);if(Wr)for(var n of Wr(t))rc.call(t,n)&&$a(e,n,t[n]);return e},y=(e,t)=>Ff(e,Hf(t));var ft=(e,t)=>{var n={};for(var i in e)Ha.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&Wr)for(var i of Wr(e))t.indexOf(i)<0&&rc.call(e,i)&&(n[i]=e[i]);return n};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var he=(e,t)=>{for(var n in t)Kr(e,n,{get:t[n],enumerable:!0})},Gf=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Bf(t))!Ha.call(e,r)&&r!==n&&Kr(e,r,{get:()=>t[r],enumerable:!(i=$f(t,r))||i.enumerable});return e};var Uf=e=>Gf(Kr({},"__esModule",{value:!0}),e);var z=(e,t,n)=>$a(e,typeof t!="symbol"?t+"":t,n);var Ve=(e,t,n)=>new Promise((i,r)=>{var s=l=>{try{o(n.next(l))}catch(c){r(c)}},a=l=>{try{o(n.throw(l))}catch(c){r(c)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(e,t)).next())}),qf=function(e,t){this[0]=e,this[1]=t};var sc=e=>{var t=e[Fa("asyncIterator")],n=!1,i,r={};return t==null?(t=e[Fa("iterator")](),i=s=>r[s]=a=>t[s](a)):(t=t.call(e),i=s=>r[s]=a=>{if(n){if(n=!1,s==="throw")throw a;return a}return n=!0,{done:!1,value:new qf(new Promise(o=>{var l=t[s](a);l instanceof Object||_f("Object expected"),o(l)}),1)}}),r[Fa("iterator")]=()=>r,i("next"),"throw"in t?i("throw"):r.throw=s=>{throw s},"return"in t&&i("return"),r};function Oe(e){let t=e.dataset.dir;if(t!==void 0&&Wf.includes(t))return t;let n=document.documentElement.getAttribute("dir");return n==="ltr"||n==="rtl"?n:"ltr"}function tr(e){if(e)try{if(e.ownerDocument.activeElement!==e)return;let t=e.value.length;e.setSelectionRange(t,t)}catch(t){}}function em(e){return["html","body","#document"].includes(bc(e))}function es(e){if(!e)return!1;let t=e.getRootNode();return ui(t)===e}function Ot(e){if(e==null||!le(e))return!1;try{return nm(e)&&e.selectionStart!=null||rm.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch(t){return!1}}function ce(e,t){var i;if(!e||!t||!le(e)||!le(t))return!1;let n=(i=t.getRootNode)==null?void 0:i.call(t);if(e===t||e.contains(t))return!0;if(n&&Ln(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Le(e){var t;return nr(e)?e:Qf(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function sm(e){return Le(e).documentElement}function ue(e){var t,n,i;return Ln(e)?ue(e.host):nr(e)?(t=e.defaultView)!=null?t:window:le(e)&&(i=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?i:window}function ui(e){let t=e.activeElement;for(;t!=null&&t.shadowRoot;){let n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function am(e){if(bc(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Ln(e)&&e.host||sm(e);return Ln(t)?t.host:t}function Ya(e){var n;let t;try{if(t=e.getRootNode({composed:!0}),nr(t)||Ln(t))return t}catch(i){}return(n=e.ownerDocument)!=null?n:document}function at(e){return Ga.has(e)||Ga.set(e,ue(e).getComputedStyle(e)),Ga.get(e)}function as(e,t){let n=new Set,i=Ya(e),r=s=>{let a=s.querySelectorAll("[aria-controls]");for(let o of a){if(o.getAttribute("aria-expanded")!=="true")continue;let l=Ec(o);for(let c of l){if(!c||n.has(c))continue;n.add(c);let u=i.getElementById(c);if(u){let h=u.getAttribute("role"),m=u.getAttribute("aria-modal")==="true";if(h&&om(h)&&!m&&(u===t||u.contains(t)||r(u)))return!0}}}return!1};return r(e)}function Xa(e,t){let n=Ya(e),i=new Set,r=s=>{let a=s.querySelectorAll("[aria-controls]");for(let o of a){if(o.getAttribute("aria-expanded")!=="true")continue;let l=Ec(o);for(let c of l){if(!c||i.has(c))continue;i.add(c);let u=n.getElementById(c);if(u){let h=u.getAttribute("role"),m=u.getAttribute("aria-modal")==="true";h&&ja.has(h)&&!m&&(t(u),r(u))}}}};r(e)}function Ic(e){let t=new Set;return Xa(e,n=>{e.contains(n)||t.add(n)}),Array.from(t)}function lm(e){let t=e.getAttribute("role");return!!(t&&ja.has(t))}function cm(e){return e.hasAttribute("aria-controls")&&e.getAttribute("aria-expanded")==="true"}function Pc(e){var t;return cm(e)?!0:!!((t=e.querySelector)!=null&&t.call(e,'[aria-controls][aria-expanded="true"]'))}function Cc(e){if(!e.id)return!1;let t=Ya(e),n=CSS.escape(e.id),i=`[aria-controls~="${n}"][aria-expanded="true"], [aria-controls="${n}"][aria-expanded="true"]`;return!!(t.querySelector(i)&&lm(e))}function Sc(e,t){let{type:n,quality:i=.92,background:r}=t;if(!e)throw new Error("[zag-js > getDataUrl]: Could not find the svg element");let s=ue(e),a=s.document,o=e.getBoundingClientRect(),l=e.cloneNode(!0);l.hasAttribute("viewBox")||l.setAttribute("viewBox",`0 0 ${o.width} ${o.height}`);let u=`\r -`+new s.XMLSerializer().serializeToString(l),h="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(u);if(n==="image/svg+xml")return Promise.resolve(h).then(I=>(l.remove(),I));let m=s.devicePixelRatio||1,d=a.createElement("canvas"),p=new s.Image;p.src=h,d.width=o.width*m,d.height=o.height*m;let v=d.getContext("2d");return(n==="image/jpeg"||r)&&(v.fillStyle=r||"white",v.fillRect(0,0,d.width,d.height)),new Promise(I=>{p.onload=()=>{v==null||v.drawImage(p,0,0,d.width,d.height),I(d.toDataURL(n,i)),l.remove()}})}function um(){var t;let e=navigator.userAgentData;return(t=e==null?void 0:e.platform)!=null?t:navigator.platform}function dm(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Oc(e){let{selectionStart:t,selectionEnd:n,value:i}=e.currentTarget,r=e.data;return i.slice(0,t)+(r!=null?r:"")+i.slice(n)}function vm(e){var t,n,i,r;return(r=(t=e.composedPath)==null?void 0:t.call(e))!=null?r:(i=(n=e.nativeEvent)==null?void 0:n.composedPath)==null?void 0:i.call(n)}function j(e){var n;let t=vm(e);return(n=t==null?void 0:t[0])!=null?n:e.target}function Fn(e){let t=e.currentTarget;if(!t||!t.matches("a[href], button[type='submit'], input[type='submit']"))return!1;let i=e.button===1,r=ls(e);return i||r}function rr(e){let t=e.currentTarget;if(!t)return!1;let n=t.localName;return e.altKey?n==="a"||n==="button"&&t.type==="submit"||n==="input"&&t.type==="submit":!1}function Re(e){return Yt(e).isComposing||e.keyCode===229}function ls(e){return di()?e.metaKey:e.ctrlKey}function wc(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function Vc(e){return e.pointerType===""&&e.isTrusted?!0:mm()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function ge(e,t={}){var a;let{dir:n="ltr",orientation:i="horizontal"}=t,r=e.key;return r=(a=bm[r])!=null?a:r,n==="rtl"&&i==="horizontal"&&r in oc&&(r=oc[r]),r}function Yt(e){var t;return(t=e.nativeEvent)!=null?t:e}function gi(e){return e.ctrlKey||e.metaKey?.1:Em.has(e.key)||e.shiftKey&&Im.has(e.key)?10:1}function je(e,t="client"){let n=ym(e)?e.touches[0]||e.changedTouches[0]:e;return{x:n[`${t}X`],y:n[`${t}Y`]}}function xc(e,t){var s;let{type:n="HTMLInputElement",property:i="value"}=t,r=ue(e)[n].prototype;return(s=Object.getOwnPropertyDescriptor(r,i))!=null?s:{}}function Pm(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function Me(e,t,n="value"){var r;if(!e)return;let i=Pm(e);i&&((r=xc(e,{type:i,property:n}).set)==null||r.call(e,t)),e.setAttribute(n,t)}function sr(e,t){var i;if(!e)return;(i=xc(e,{type:"HTMLInputElement",property:"checked"}).set)==null||i.call(e,t),t?e.setAttribute("checked",""):e.removeAttribute("checked")}function Ac(e,t){let{value:n,bubbles:i=!0}=t;if(!e)return;let r=ue(e);e instanceof r.HTMLInputElement&&(Me(e,`${n}`),e.dispatchEvent(new r.Event("input",{bubbles:i})))}function pi(e,t){let{checked:n,bubbles:i=!0}=t;if(!e)return;let r=ue(e);e instanceof r.HTMLInputElement&&(sr(e,n),e.dispatchEvent(new r.Event("click",{bubbles:i})))}function Cm(e){return Sm(e)?e.form:e.closest("form")}function Sm(e){return e.matches("textarea, input, select, button")}function Tm(e,t){if(!e)return;let n=Cm(e),i=r=>{r.defaultPrevented||t()};return n==null||n.addEventListener("reset",i,{passive:!0}),()=>n==null?void 0:n.removeEventListener("reset",i)}function Om(e,t){let n=e==null?void 0:e.closest("fieldset");if(!n)return;t(n.disabled);let i=ue(n),r=new i.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function wt(e,t){if(!e)return;let{onFieldsetDisabledChange:n,onFormReset:i}=t,r=[Tm(e,i),Om(e,n)];return()=>r.forEach(s=>s==null?void 0:s())}function Nc(e){let t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}function Am(e,t){if(!t)return null;if(t===!0)return e.shadowRoot||null;let n=t(e);return(n===!0?e.shadowRoot:n)||null}function Rc(e,t,n){let i=[...e],r=[...e],s=new Set,a=new Map;e.forEach((l,c)=>a.set(l,c));let o=0;for(;o{a.set(d,m+p)});for(let d=m+u.length;d{a.set(d,m+p)})}r.push(...u)}}return i}function Ye(e){return!le(e)||e.closest("[inert]")?!1:e.matches(cs)&&im(e)}function jt(e,t={}){if(!e)return[];let{includeContainer:n,getShadowRoot:i}=t,r=Array.from(e.querySelectorAll(cs));n&&dn(e)&&r.unshift(e);let s=[];for(let a of r)if(dn(a)){if(kc(a)&&a.contentDocument){let o=a.contentDocument.body;s.push(...jt(o,{getShadowRoot:i}));continue}s.push(a)}if(i){let a=Rc(s,i,dn);return!a.length&&n?r:a}return!s.length&&n?r:s}function dn(e){return le(e)&&e.tabIndex>0?!0:Ye(e)&&!xm(e)}function km(e,t={}){let n=jt(e,t),i=n[0]||null,r=n[n.length-1]||null;return[i,r]}function fi(e){return e.tabIndex<0&&(wm.test(e.localName)||Ot(e))&&!Vm(e)?0:e.tabIndex}function us(e){let{root:t,getInitialEl:n,filter:i,enabled:r=!0}=e;if(!r)return;let s=null;if(s||(s=typeof n=="function"?n():n),s||(s=t==null?void 0:t.querySelector("[data-autofocus],[autofocus]")),!s){let a=jt(t);s=i?a.filter(i)[0]:a[0]}return s||t||void 0}function ds(e){let t=e.currentTarget;if(!t)return!1;let[n,i]=km(t);return!(es(n)&&e.shiftKey||es(i)&&!e.shiftKey||!n&&!i)}function H(e){let t=eo.create();return t.request(e),t.cleanup}function $n(e){let t=new Set;function n(i){let r=globalThis.requestAnimationFrame(i);t.add(()=>globalThis.cancelAnimationFrame(r))}return n(()=>n(e)),function(){t.forEach(r=>r())}}function Nm(e,t,n){let i=H(()=>{e.removeEventListener(t,r,!0),n()}),r=()=>{i(),n()};return e.addEventListener(t,r,{once:!0,capture:!0}),i}function Rm(e,t){if(!e)return;let{attributes:n,callback:i}=t,r=e.ownerDocument.defaultView||window,s=new r.MutationObserver(a=>{for(let o of a)o.type==="attributes"&&o.attributeName&&n.includes(o.attributeName)&&i(o)});return s.observe(e,{attributes:!0,attributeFilter:n}),()=>s.disconnect()}function ot(e,t){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=typeof e=="function"?e():e;r.push(Rm(s,t))})),()=>{r.forEach(s=>s==null?void 0:s())}}function Dm(e,t){let{callback:n}=t;if(!e)return;let i=e.ownerDocument.defaultView||window,r=new i.MutationObserver(n);return r.observe(e,{childList:!0,subtree:!0}),()=>r.disconnect()}function hs(e,t){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=typeof e=="function"?e():e;r.push(Dm(s,t))})),()=>{r.forEach(s=>s==null?void 0:s())}}function mi(e){let t=()=>{let n=ue(e);e.dispatchEvent(new n.MouseEvent("click"))};fm()?Nm(e,"keyup",t):queueMicrotask(t)}function gs(e){let t=am(e);return em(t)?Le(t).body:le(t)&&Lc(t)?t:gs(t)}function Lc(e){let t=ue(e),{overflow:n,overflowX:i,overflowY:r,display:s}=t.getComputedStyle(e);return Lm.test(n+r+i)&&!Mm.has(s)}function Fm(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}function Xt(e,t){let r=t||{},{rootEl:n}=r,i=ft(r,["rootEl"]);!e||!n||!Lc(n)||!Fm(n)||e.scrollIntoView(i)}function to(e,t){let{left:n,top:i,width:r,height:s}=t.getBoundingClientRect(),a={x:e.x-n,y:e.y-i},o={x:ac(a.x/r),y:ac(a.y/s)};function l(c={}){let{dir:u="ltr",orientation:h="horizontal",inverted:m}=c,d=typeof m=="object"?m.x:m,p=typeof m=="object"?m.y:m;return h==="horizontal"?u==="rtl"||d?1-o.x:o.x:p?1-o.y:o.y}return{offset:a,percent:o,getPercentValue:l}}function Mc(e,t){let n=e.body,i="pointerLockElement"in e||"mozPointerLockElement"in e,r=()=>!!e.pointerLockElement;function s(){t==null||t(r())}function a(l){r()&&(t==null||t(!1)),console.error("PointerLock error occurred:",l),e.exitPointerLock()}if(!i)return;try{n.requestPointerLock()}catch(l){}let o=[ee(e,"pointerlockchange",s,!1),ee(e,"pointerlockerror",a,!1)];return()=>{o.forEach(l=>l()),e.exitPointerLock()}}function $m(e={}){let{target:t,doc:n}=e,i=n!=null?n:document,r=i.documentElement;return ir()?(ci==="default"&&(qa=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),ci="disabled"):t&&(Xr.set(t,t.style.userSelect),t.style.userSelect="none"),()=>no({target:t,doc:i})}function no(e={}){let{target:t,doc:n}=e,r=(n!=null?n:document).documentElement;if(ir()){if(ci!=="disabled")return;ci="restoring",setTimeout(()=>{$n(()=>{ci==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=qa||""),qa="",ci="default")})},300)}else if(t&&Xr.has(t)){let s=Xr.get(t);t.style.userSelect==="none"&&(t.style.userSelect=s!=null?s:""),t.getAttribute("style")===""&&t.removeAttribute("style"),Xr.delete(t)}}function io(e={}){let a=e,{defer:t,target:n}=a,i=ft(a,["defer","target"]),r=t?H:o=>o(),s=[];return s.push(r(()=>{let o=typeof n=="function"?n():n;s.push($m(y(g({},i),{target:o})))})),()=>{s.forEach(o=>o==null?void 0:o())}}function hn(e,t){let{onPointerMove:n,onPointerUp:i}=t,r=o=>{let l=je(o),c=Math.sqrt(l.x**2+l.y**2),u=o.pointerType==="touch"?10:5;if(!(c{let l=je(o);i({point:l,event:o})},a=[ee(e,"pointermove",r,!1),ee(e,"pointerup",s,!1),ee(e,"pointercancel",s,!1),ee(e,"contextmenu",s,!1),io({doc:e})];return()=>{a.forEach(o=>o())}}function ps(e){let{pointerNode:t,keyboardNode:n=t,onPress:i,onPressStart:r,onPressEnd:s,isValidKey:a=w=>w.key==="Enter"}=e;if(!t)return qt;let o=ue(t),l=qt,c=qt,u=qt,h=w=>({point:je(w),event:w});function m(w){r==null||r(h(w))}function d(w){s==null||s(h(w))}let v=ee(t,"pointerdown",w=>{c();let f=ee(o,"pointerup",P=>{let V=j(P);ce(t,V)?i==null||i(h(P)):s==null||s(h(P))},{passive:!i,once:!0}),S=ee(o,"pointercancel",d,{passive:!s,once:!0});c=_a(f,S),es(n)&&w.pointerType==="mouse"&&w.preventDefault(),m(w)},{passive:!r}),I=ee(n,"focus",T);l=_a(v,I);function T(){let w=P=>{if(!a(P))return;let V=x=>{if(!a(x))return;let k=new o.PointerEvent("pointerup"),N=h(k);i==null||i(N),s==null||s(N)};c(),c=ee(n,"keyup",V);let A=new o.PointerEvent("pointerdown");m(A)},b=()=>{let P=new o.PointerEvent("pointercancel");d(P)},f=ee(n,"keydown",w),S=ee(n,"blur",b);u=_a(f,S)}return()=>{l(),c(),u()}}function Fe(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function vi(e,t){var n;return(n=e==null?void 0:e.querySelector(t))!=null?n:null}function so(e,t,n=ro){return e.find(i=>n(i)===t)}function ao(e,t,n=ro){let i=so(e,t,n);return i?e.indexOf(i):-1}function yi(e,t,n=!0){let i=ao(e,t);return i=n?(i+1)%e.length:Math.min(i+1,e.length-1),e[i]}function bi(e,t,n=!0){let i=ao(e,t);return i===-1?n?e[e.length-1]:null:(i=n?(i-1+e.length)%e.length:Math.max(0,i-1),e[i])}function Hm(e){let t=new WeakMap,n,i=new WeakMap,r=o=>n||(n=new o.ResizeObserver(l=>{for(let c of l){i.set(c.target,c);let u=t.get(c.target);if(u)for(let h of u)h(c)}}),n);return{observe:(o,l)=>{let c=t.get(o)||new Set;c.add(l),t.set(o,c);let u=ue(o);return r(u).observe(o,e),()=>{let h=t.get(o);h&&(h.delete(l),h.size===0&&(t.delete(o),r(u).unobserve(o)))}},unobserve:o=>{t.delete(o),n==null||n.unobserve(o)}}}function Um(e,t,n,i=ro){let r=n?ao(e,n,i):-1,s=n?jf(e,r):e;return t.length===1&&(s=s.filter(o=>i(o)!==n)),s.find(o=>Gm(_m(o),t))}function Fc(e,t,n){let i=e.getAttribute(t),r=i!=null;return i===n?qt:(e.setAttribute(t,n),()=>{r?e.setAttribute(t,i):e.removeAttribute(t)})}function Hn(e,t){if(!e)return qt;let n=Object.keys(t).reduce((i,r)=>(i[r]=e.style.getPropertyValue(r),i),{});return qm(n,t)?qt:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function $c(e,t,n){if(!e)return qt;let i=e.style.getPropertyValue(t);return i===n?qt:(e.style.setProperty(t,n),()=>{e.style.setProperty(t,i),e.style.length===0&&e.removeAttribute("style")})}function qm(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function Wm(e,t){let{state:n,activeId:i,key:r,timeout:s=350,itemToId:a}=t,o=n.keysSoFar+r,c=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,u=e.slice(),h=Um(u,c,i,a);function m(){clearTimeout(n.timer),n.timer=-1}function d(p){n.keysSoFar=p,m(),p!==""&&(n.timer=+setTimeout(()=>{d(""),m()},s))}return d(o),h}function Km(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function zm(e,t,n){let{signal:i}=t;return[new Promise((a,o)=>{let l=setTimeout(()=>{o(new Error(`Timeout of ${n}ms exceeded`))},n);i.addEventListener("abort",()=>{clearTimeout(l),o(new Error("Promise aborted"))}),e.then(c=>{i.aborted||(clearTimeout(l),a(c))}).catch(c=>{i.aborted||(clearTimeout(l),o(c))})}),()=>t.abort()]}function Hc(e,t){let{timeout:n,rootNode:i}=t,r=ue(i),s=Le(i),a=new r.AbortController;return zm(new Promise(o=>{let l=e();if(l){o(l);return}let c=new r.MutationObserver(()=>{let u=e();u&&u.isConnected&&(c.disconnect(),o(u))});c.observe(s.body,{childList:!0,subtree:!0})}),a,n)}function or(e){return e==null?[]:Array.isArray(e)?e:[e]}function Ei(e,t,n={}){let{step:i=1,loop:r=!0}=n,s=t+i,a=e.length,o=a-1;return t===-1?i>0?0:o:s<0?r?o:0:s>=a?r?0:t>a?a:t:s}function _c(e,t,n={}){return e[Ei(e,t,n)]}function lr(e,t,n={}){let{step:i=1,loop:r=!0}=n;return Ei(e,t,{step:-i,loop:r})}function Gc(e,t,n={}){return e[lr(e,t,n)]}function cr(e,t){return e.reduce((n,i,r)=>{var s;return r%t===0?n.push([i]):(s=mt(n))==null||s.push(i),n},[])}function oo(e,t){return e.reduce(([n,i],r)=>(t(r)?n.push(r):i.push(r),[n,i]),[[],[]])}function Ce(e,t,...n){var r;if(e in t){let s=t[e];return Wt(s)?s(...n):s}let i=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw(r=Error.captureStackTrace)==null||r.call(Error,i,Ce),i}function Yc(e,t=0){let n=0,i=null;return(...r)=>{let s=Date.now(),a=s-n;a>=t?(i&&(clearTimeout(i),i=null),e(...r),n=s):i||(i=setTimeout(()=>{e(...r),n=Date.now(),i=null},t-a))}}function Si(e){if(!Qi(e)||e===void 0)return e;let t=Reflect.ownKeys(e).filter(i=>typeof i=="string"),n={};for(let i of t){let r=e[i];r!==void 0&&(n[i]=Si(r))}return n}function fn(e,t){let n={};for(let i of t){let r=e[i];r!==void 0&&(n[i]=r)}return n}function uv(e,t){let n={},i={},r=new Set(t),s=Reflect.ownKeys(e);for(let a of s)r.has(a)?i[a]=e[a]:n[a]=e[a];return[i,n]}function su(e,t){let n=new ru(({now:i,deltaMs:r})=>{if(r>=t){let s=t>0?i-r%t:i;n.setStartMs(s),e({startMs:s,deltaMs:r})}});return n.start(),()=>n.stop()}function mn(e,t){let n=new ru(({deltaMs:i})=>{if(i>=t)return e(),!1});return n.start(),()=>n.stop()}function zt(...e){let t=e.length===1?e[0]:e[1];(e.length===2?e[0]:!0)&&console.warn(t)}function vs(...e){let t=e.length===1?e[0]:e[1];if(e.length===2?e[0]:!0)throw new Error(t)}function vn(e,t){if(e==null)throw new Error(t())}function yn(e,t,n){let i=[];for(let r of t)e[r]==null&&i.push(r);if(i.length>0)throw new Error(`[zag-js${n?` > ${n}`:""}] missing required props: ${i.join(", ")}`)}function au(...e){let t={};for(let n of e){if(!n)continue;for(let r in t){if(r.startsWith("on")&&typeof t[r]=="function"&&typeof n[r]=="function"){t[r]=At(n[r],t[r]);continue}if(r==="className"||r==="class"){t[r]=dv(t[r],n[r]);continue}if(r==="style"){t[r]=gv(t[r],n[r]);continue}t[r]=n[r]!==void 0?n[r]:t[r]}for(let r in n)t[r]===void 0&&(t[r]=n[r]);let i=Object.getOwnPropertySymbols(n);for(let r of i)t[r]=n[r]}return t}function Bn(e,t,n){let i=[],r;return s=>{var l;let a=e(s);return(a.length!==i.length||a.some((c,u)=>!fe(i[u],c)))&&(i=a,r=t(a,s),(l=n==null?void 0:n.onChange)==null||l.call(n,r)),r}}function Ee(){return{and:(...e)=>function(n){return e.every(i=>n.guard(i))},or:(...e)=>function(n){return e.some(i=>n.guard(i))},not:e=>function(n){return!n.guard(e)}}}function ut(){return{guards:Ee(),createMachine:e=>e,choose:e=>function({choose:n}){var i;return(i=n(e))==null?void 0:i.actions}}}function pv(e){let t=()=>{var a,o;return(o=(a=e.getRootNode)==null?void 0:a.call(e))!=null?o:document},n=()=>Le(t()),i=()=>{var a;return(a=n().defaultView)!=null?a:window},r=()=>ui(t()),s=a=>t().getElementById(a);return y(g({},e),{getRootNode:t,getDoc:n,getWin:i,getActiveElement:r,isActiveElement:es,getById:s})}function fv(e){return new Proxy({},{get(t,n){return n==="style"?i=>e({style:i}).style:e}})}function bv(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global}function ou(e,t){let n=bv();return n?(n[e]||(n[e]=t()),n[e]):t()}function ys(e={}){return Tv(e)}function ns(e,t,n){let i=Dn.get(e);ts()&&!i&&console.warn("Please use proxy object");let r,s=[],a=i[3],o=!1,c=a(u=>{if(s.push(u),n){t(s.splice(0));return}r||(r=Promise.resolve().then(()=>{r=void 0,o&&t(s.splice(0))}))});return o=!0,()=>{o=!1,c()}}function Ov(e){let t=Dn.get(e);ts()&&!t&&console.warn("Please use proxy object");let[n,i,r]=t;return r(n,i())}function Rv(e,t,n){let i=n||"default",r=Yr.get(e);r||(r=new Map,Yr.set(e,r));let s=r.get(i)||{},a=Object.keys(t),o=(v,I)=>{e.addEventListener(v.toLowerCase(),I)},l=(v,I)=>{e.removeEventListener(v.toLowerCase(),I)},c=v=>v.startsWith("on"),u=v=>!v.startsWith("on"),h=v=>o(v.substring(2),t[v]),m=v=>l(v.substring(2),t[v]),d=v=>{let I=t[v],T=s[v];if(I!==T){if(v==="class"){e.className=I!=null?I:"";return}if(yc.has(v)){e[v]=I!=null?I:"";return}if(typeof I=="boolean"&&!v.includes("aria-")){e.toggleAttribute(jr(e,v),I);return}if(v==="children"){e.innerHTML=I;return}if(I!=null){e.setAttribute(jr(e,v),I);return}e.removeAttribute(jr(e,v))}};for(let v in s)t[v]==null&&(v==="class"?e.className="":yc.has(v)?e[v]="":e.removeAttribute(jr(e,v)));return Object.keys(s).filter(c).forEach(v=>{l(v.substring(2),s[v])}),a.filter(c).forEach(h),a.filter(u).forEach(d),r.set(i,t),function(){a.filter(c).forEach(m);let I=Yr.get(e);I&&(I.delete(i),I.size===0&&Yr.delete(e))}}function is(e){var s,a;let t=(s=e().value)!=null?s:e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);let n=(a=e().isEqual)!=null?a:Object.is,i=ys({value:t}),r=()=>e().value!==void 0;return{initial:t,ref:i,get(){return r()?e().value:i.value},set(o){var u,h;let l=i.value,c=Wt(o)?o(l):o;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:c,prev:l}),r()||(i.value=c),n(c,l)||(h=(u=e()).onChange)==null||h.call(u,c,l)},invoke(o,l){var c,u;(u=(c=e()).onChange)==null||u.call(c,o,l)},hash(o){var l,c,u;return(u=(c=(l=e()).hash)==null?void 0:c.call(l,o))!=null?u:String(o)}}}function Dv(e){let t={current:e};return{get(n){return t.current[n]},set(n,i){t.current[n]=i}}}function lu(e,t){if(!Qi(e)||!Qi(t))return t===void 0?e:t;let n=g({},e);for(let i of Object.keys(t)){let r=t[i],s=e[i];r!==void 0&&(Qi(s)&&Qi(r)?n[i]=lu(s,r):n[i]=r)}return n}var Wf,O,Z,Y,C,Mn,U,li,Kf,zf,Yf,Ba,ac,jf,_a,qt,rs,ss,E,X,Xf,Zf,Jf,le,nr,Qf,bc,tm,Ln,nm,st,im,rm,Ga,ja,om,Ec,os,Za,Tc,hm,Ja,gm,pm,ir,Qa,di,Xe,fm,mm,pe,hi,xe,ym,bm,oc,Em,Im,ee,kc,wm,Vm,xm,cs,ar,eo,Lm,Mm,ci,qa,Xr,ro,gn,Bm,_m,Gm,Ue,Vt,Ym,Bc,jm,un,Xm,lc,Zm,lt,mt,Jm,Ze,ct,vt,fs,yt,cc,Qm,fe,pn,Uc,qc,xt,Zr,Wt,Wc,$e,ev,Kc,tv,Qi,nv,iv,rv,Kt,lo,sv,zc,At,ur,jc,uc,Xc,av,ov,lv,cv,Wa,Ii,Zc,Jc,Qc,Pi,He,dc,Ci,eu,ms,hc,tu,nu,iu,ye,B,zr,Jr,ru,dv,hv,gc,gv,er,Ua,_,n0,mv,pc,Ka,vv,yv,fc,Qr,Ev,Iv,Pv,Cv,za,mc,ts,Dn,Sv,Tv,wv,Vv,oe,vc,xv,Av,q,Yr,yc,kv,Nv,jr,W,K,se=re(()=>{"use strict";Wf=["ltr","rtl"];O=(e,t,n)=>{let i=e.dataset[t];if(i!==void 0&&(!n||n.includes(i)))return i},Z=(e,t)=>{let n=e.dataset[t];if(typeof n=="string")return n.split(",").map(i=>i.trim()).filter(i=>i.length>0)},Y=(e,t,n)=>{let i=e.dataset[t];if(i===void 0)return;let r=Number(i);if(!Number.isNaN(r))return n&&!n.includes(r)?0:r},C=(e,t)=>{let n=t.replace(/([A-Z])/g,"-$1").toLowerCase();return e.hasAttribute(`data-${n}`)},Mn=(e,t="element")=>e!=null&&e.id?e.id:`${t}-${Math.random().toString(36).substring(2,9)}`,U=(e,t=[])=>({parts:(...n)=>{if(Kf(t))return U(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>U(e,[...t,...n]),omit:(...n)=>U(e,t.filter(i=>!n.includes(i))),rename:n=>U(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,i)=>Object.assign(n,{[i]:{selector:[`&[data-scope="${li(e)}"][data-part="${li(i)}"]`,`& [data-scope="${li(e)}"][data-part="${li(i)}"]`].join(", "),attrs:{"data-scope":li(e),"data-part":li(i)}}}),{})}),li=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Kf=e=>e.length===0,zf=Object.defineProperty,Yf=(e,t,n)=>t in e?zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ba=(e,t,n)=>Yf(e,typeof t!="symbol"?t+"":t,n);ac=e=>Math.max(0,Math.min(1,e)),jf=(e,t)=>e.map((n,i)=>e[(Math.max(t,0)+i)%e.length]),_a=(...e)=>t=>e.reduce((n,i)=>i(n),t),qt=()=>{},rs=e=>typeof e=="object"&&e!==null,ss=2147483647,E=e=>e?"":void 0,X=e=>e?"true":void 0,Xf=1,Zf=9,Jf=11,le=e=>rs(e)&&e.nodeType===Xf&&typeof e.nodeName=="string",nr=e=>rs(e)&&e.nodeType===Zf,Qf=e=>rs(e)&&e===e.window,bc=e=>le(e)?e.localName||"":"#document";tm=e=>rs(e)&&e.nodeType!==void 0,Ln=e=>tm(e)&&e.nodeType===Jf&&"host"in e,nm=e=>le(e)&&e.localName==="input",st=e=>!!(e!=null&&e.matches("a[href]")),im=e=>le(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;rm=/(textarea|select)/;Ga=new WeakMap;ja=new Set(["menu","listbox","dialog","grid","tree","region"]),om=e=>ja.has(e),Ec=e=>{var t;return((t=e.getAttribute("aria-controls"))==null?void 0:t.split(" "))||[]};os=()=>typeof document!="undefined";Za=e=>os()&&e.test(um()),Tc=e=>os()&&e.test(dm()),hm=e=>os()&&e.test(navigator.vendor),Ja=()=>os()&&!!navigator.maxTouchPoints,gm=()=>Za(/^iPhone/i),pm=()=>Za(/^iPad/i)||di()&&navigator.maxTouchPoints>1,ir=()=>gm()||pm(),Qa=()=>di()||ir(),di=()=>Za(/^Mac/i),Xe=()=>Qa()&&hm(/apple/i),fm=()=>Tc(/Firefox/i),mm=()=>Tc(/Android/i);pe=e=>e.button===0,hi=e=>e.button===2||di()&&e.ctrlKey&&e.button===0,xe=e=>e.ctrlKey||e.altKey||e.metaKey,ym=e=>"touches"in e&&e.touches.length>0,bm={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},oc={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};Em=new Set(["PageUp","PageDown"]),Im=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);ee=(e,t,n,i)=>{let r=typeof e=="function"?e():e;return r==null||r.addEventListener(t,n,i),()=>{r==null||r.removeEventListener(t,n,i)}};kc=e=>le(e)&&e.tagName==="IFRAME",wm=/^(audio|video|details)$/;Vm=e=>!Number.isNaN(Nc(e)),xm=e=>Nc(e)<0;cs="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",ar=(e,t={})=>{if(!e)return[];let{includeContainer:n=!1,getShadowRoot:i}=t,r=Array.from(e.querySelectorAll(cs));(n==!0||n=="if-empty"&&r.length===0)&&le(e)&&Ye(e)&&r.unshift(e);let a=[];for(let o of r)if(Ye(o)){if(kc(o)&&o.contentDocument){let l=o.contentDocument.body;a.push(...ar(l,{getShadowRoot:i}));continue}a.push(o)}return i?Rc(a,i,Ye):a};eo=class Dc{constructor(){Ba(this,"id",null),Ba(this,"fn_cleanup"),Ba(this,"cleanup",()=>{this.cancel()})}static create(){return new Dc}request(t){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=t==null?void 0:t()})}cancel(){var t;this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),(t=this.fn_cleanup)==null||t.call(this),this.fn_cleanup=void 0}isActive(){return this.id!==null}};Lm=/auto|scroll|overlay|hidden|clip/,Mm=new Set(["inline","contents"]);ci="default",qa="",Xr=new WeakMap;ro=e=>e.id;gn=Hm({box:"border-box"}),Bm=e=>e.split("").map(t=>{let n=t.charCodeAt(0);return n>0&&n<128?t:n>=128&&n<=255?`/x${n.toString(16)}`.replace("/","\\"):""}).join("").trim(),_m=e=>{var t,n,i;return Bm((i=(n=(t=e.dataset)==null?void 0:t.valuetext)!=null?n:e.textContent)!=null?i:"")},Gm=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase());Ue=Object.assign(Wm,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:Km});Vt={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};Ym=Object.defineProperty,Bc=e=>{throw TypeError(e)},jm=(e,t,n)=>t in e?Ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,un=(e,t,n)=>jm(e,typeof t!="symbol"?t+"":t,n),Xm=(e,t,n)=>t.has(e)||Bc("Cannot "+n),lc=(e,t,n)=>(Xm(e,t,"read from private field"),t.get(e)),Zm=(e,t,n)=>t.has(e)?Bc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);lt=e=>e[0],mt=e=>e[e.length-1],Jm=(e,t)=>e.indexOf(t)!==-1,Ze=(e,...t)=>e.concat(t),ct=(e,...t)=>e.filter(n=>!t.includes(n)),vt=e=>Array.from(new Set(e)),fs=(e,t)=>{let n=new Set(t);return e.filter(i=>!n.has(i))},yt=(e,t)=>Jm(e,t)?ct(e,t):Ze(e,t);cc=e=>(e==null?void 0:e.constructor.name)==="Array",Qm=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof(e==null?void 0:e.isEqual)=="function"&&typeof(t==null?void 0:t.isEqual)=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(cc(e)&&cc(t))return Qm(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;let n=Object.keys(t!=null?t:Object.create(null)),i=n.length;for(let r=0;rArray.isArray(e),Uc=e=>e===!0||e===!1,qc=e=>e!=null&&typeof e=="object",xt=e=>qc(e)&&!pn(e),Zr=e=>typeof e=="string",Wt=e=>typeof e=="function",Wc=e=>e==null,$e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ev=e=>Object.prototype.toString.call(e),Kc=Function.prototype.toString,tv=Kc.call(Object),Qi=e=>{if(!qc(e)||ev(e)!="[object Object]"||rv(e))return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=$e(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Kc.call(n)==tv},nv=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,iv=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,rv=e=>nv(e)||iv(e),Kt=(e,...t)=>{let n=typeof e=="function"?e(...t):e;return n!=null?n:void 0},lo=e=>e,sv=e=>e(),zc=()=>{},At=(...e)=>(...t)=>{e.forEach(function(n){n==null||n(...t)})},ur=(()=>{let e=0;return()=>(e++,e.toString(36))})();({floor:jc,abs:uc,round:Xc,min:av,max:ov,pow:lv,sign:cv}=Math),Wa=e=>Number.isNaN(e),Ii=e=>Wa(e)?0:e,Zc=(e,t)=>(e%t+t)%t,Jc=(e,t)=>Ii(e)>=t,Qc=(e,t)=>Ii(e)<=t,Pi=(e,t,n)=>{let i=Ii(e),r=t==null||i>=t,s=n==null||i<=n;return r&&s},He=(e,t,n)=>av(ov(Ii(e),t),n),dc=(e,t)=>{let n=e,i=t.toString(),r=i.indexOf("."),s=r>=0?i.length-r:0;if(s>0){let a=lv(10,s);n=Xc(n*a)/a}return n},Ci=(e,t)=>typeof t=="number"?jc(e*t+.5)/t:Xc(e),eu=(e,t,n,i)=>{let r=t!=null?Number(t):0,s=Number(n),a=(e-r)%i,o=uc(a)*2>=i?e+cv(a)*(i-uc(a)):e-a;if(o=dc(o,i),!Wa(r)&&os){let l=jc((s-r)/i),c=r+l*i;o=l<=0||ce[t]===n?e:[...e.slice(0,t),n,...e.slice(t+1)],hc=e=>{if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n},tu=(e,t,n)=>{let i=t==="+"?e+n:e-n;if(e%1!==0||n%1!==0){let r=10**Math.max(hc(e),hc(n));e=Math.round(e*r),n=Math.round(n*r),i=t==="+"?e+n:e-n,i/=r}return i},nu=(e,t)=>tu(Ii(e),"+",t),iu=(e,t)=>tu(Ii(e),"-",t),ye=e=>typeof e=="number"?`${e}px`:e;B=e=>function(n){return uv(n,e)},zr=()=>performance.now(),ru=class{constructor(e){this.onTick=e,un(this,"frameId",null),un(this,"pausedAtMs",null),un(this,"context"),un(this,"cancelFrame",()=>{this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}),un(this,"setStartMs",t=>{this.context.startMs=t}),un(this,"start",()=>{if(this.frameId!==null)return;let t=zr();this.pausedAtMs!==null?(this.context.startMs+=t-this.pausedAtMs,this.pausedAtMs=null):this.context.startMs=t,this.frameId=requestAnimationFrame(lc(this,Jr))}),un(this,"pause",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=zr())}),un(this,"stop",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=null)}),Zm(this,Jr,t=>{if(this.context.now=t,this.context.deltaMs=t-this.context.startMs,this.onTick(this.context)===!1){this.stop();return}this.frameId=requestAnimationFrame(lc(this,Jr))}),this.context={now:0,startMs:zr(),deltaMs:0}}get elapsedMs(){return this.pausedAtMs!==null?this.pausedAtMs-this.context.startMs:zr()-this.context.startMs}};Jr=new WeakMap;dv=(...e)=>e.map(t=>{var n;return(n=t==null?void 0:t.trim)==null?void 0:n.call(t)}).filter(Boolean).join(" "),hv=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,gc=e=>{let t={},n;for(;n=hv.exec(e);)t[n[1]]=n[2];return t},gv=(e,t)=>{if(Zr(e)){if(Zr(t))return`${e};${t}`;e=gc(e)}else Zr(t)&&(t=gc(t));return Object.assign({},e!=null?e:{},t!=null?t:{})};er=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(er||{}),Ua="__init__";_=()=>e=>Array.from(new Set(e)),n0=Symbol(),mv=Symbol(),pc=Object.getPrototypeOf,Ka=new WeakMap,vv=e=>e&&(Ka.has(e)?Ka.get(e):pc(e)===Object.prototype||pc(e)===Array.prototype),yv=e=>vv(e)&&e[mv]||null,fc=(e,t=!0)=>{Ka.set(e,t)};Qr=ou("__zag__refSet",()=>new WeakSet),Ev=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Iv=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Pv=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",Cv=e=>Ev(e)||Iv(e)||Pv(e),za=e=>e!==null&&typeof e=="object",mc=e=>za(e)&&!Qr.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!Cv(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise)&&!(e instanceof File)&&!(e instanceof Blob)&&!(e instanceof AbortController),ts=()=>!0,Dn=ou("__zag__proxyStateMap",()=>new WeakMap),Sv=(e=Object.is,t=(o,l)=>new Proxy(o,l),n=new WeakMap,i=(o,l)=>{let c=n.get(o);if((c==null?void 0:c[0])===l)return c[1];let u=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return fc(u,!0),n.set(o,[l,u]),Reflect.ownKeys(o).forEach(h=>{let m=Reflect.get(o,h);Qr.has(m)?(fc(m,!1),u[h]=m):Dn.has(m)?u[h]=Ov(m):u[h]=m}),Object.freeze(u)},r=new WeakMap,s=[1,1],a=o=>{if(!za(o))throw new Error("object required");let l=r.get(o);if(l)return l;let c=s[0],u=new Set,h=(V,A=++s[0])=>{c!==A&&(c=A,u.forEach(x=>x(V,A)))},m=s[1],d=(V=++s[1])=>(m!==V&&!u.size&&(m=V,v.forEach(([A])=>{let x=A[1](V);x>c&&(c=x)})),c),p=V=>(A,x)=>{let k=[...A];k[1]=[V,...k[1]],h(k,x)},v=new Map,I=(V,A)=>{if(ts()&&v.has(V))throw new Error("prop listener already exists");if(u.size){let x=A[3](p(V));v.set(V,[A,x])}else v.set(V,[A])},T=V=>{var x;let A=v.get(V);A&&(v.delete(V),(x=A[1])==null||x.call(A))},w=V=>(u.add(V),u.size===1&&v.forEach(([x,k],N)=>{if(ts()&&k)throw new Error("remove already exists");let D=x[3](p(N));v.set(N,[x,D])}),()=>{u.delete(V),u.size===0&&v.forEach(([x,k],N)=>{k&&(k(),v.set(N,[x]))})}),b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),S=t(b,{deleteProperty(V,A){let x=Reflect.get(V,A);T(A);let k=Reflect.deleteProperty(V,A);return k&&h(["delete",[A],x]),k},set(V,A,x,k){var te;let N=Reflect.has(V,A),D=Reflect.get(V,A,k);if(N&&(e(D,x)||r.has(x)&&e(D,r.get(x))))return!0;T(A),za(x)&&(x=yv(x)||x);let $=x;if(!((te=Object.getOwnPropertyDescriptor(V,A))!=null&&te.set)){!Dn.has(x)&&mc(x)&&($=ys(x));let J=!Qr.has($)&&Dn.get($);J&&I(A,J)}return Reflect.set(V,A,$,k),h(["set",[A],x,D]),!0}});r.set(o,S);let P=[b,d,i,w];return Dn.set(S,P),Reflect.ownKeys(o).forEach(V=>{let A=Object.getOwnPropertyDescriptor(o,V);A.get||A.set?Object.defineProperty(b,V,A):S[V]=o[V]}),S})=>[a,Dn,Qr,e,t,mc,n,i,r,s],[Tv]=Sv();wv=Object.defineProperty,Vv=(e,t,n)=>t in e?wv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oe=(e,t,n)=>Vv(e,typeof t!="symbol"?t+"":t,n),vc={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},xv=new Set(["viewBox","preserveAspectRatio"]),Av=e=>{let t="";for(let n in e){let i=e[n];i!=null&&(n.startsWith("--")||(n=n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`)),t+=`${n}:${i};`)}return t},q=fv(e=>Object.entries(e).reduce((t,[n,i])=>{if(i===void 0)return t;if(n in vc&&(n=vc[n]),n==="style"&&typeof i=="object")return t.style=Av(i),t;let r=xv.has(n)?n:n.toLowerCase();return t[r]=i,t},{})),Yr=new WeakMap,yc=new Set(["value","checked","selected"]),kv=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),Nv=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",jr=(e,t)=>Nv(e)&&kv.has(t)?t:t.toLowerCase();is.cleanup=e=>{};is.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};W=class{constructor(e,t={}){var h,m,d;this.machine=e,oe(this,"scope"),oe(this,"context"),oe(this,"prop"),oe(this,"state"),oe(this,"refs"),oe(this,"computed"),oe(this,"event",{type:""}),oe(this,"previousEvent",{type:""}),oe(this,"effects",new Map),oe(this,"transition",null),oe(this,"cleanups",[]),oe(this,"subscriptions",[]),oe(this,"userPropsRef"),oe(this,"getEvent",()=>y(g({},this.event),{current:()=>this.event,previous:()=>this.previousEvent})),oe(this,"getStateConfig",p=>this.machine.states[p]),oe(this,"getState",()=>y(g({},this.state),{matches:(...p)=>p.includes(this.state.get()),hasTag:p=>{var v,I;return!!((I=(v=this.getStateConfig(this.state.get()))==null?void 0:v.tags)!=null&&I.includes(p))}})),oe(this,"debug",(...p)=>{this.machine.debug&&console.log(...p)}),oe(this,"notify",()=>{this.publish()}),oe(this,"send",p=>{this.status===er.Started&&queueMicrotask(()=>{var S,P,V,A,x;if(!p)return;this.previousEvent=this.event,this.event=p,this.debug("send",p);let v=this.state.get(),I=p.type,T=(A=(P=(S=this.getStateConfig(v))==null?void 0:S.on)==null?void 0:P[I])!=null?A:(V=this.machine.on)==null?void 0:V[I],w=this.choose(T);if(!w)return;this.transition=w;let b=(x=w.target)!=null?x:v;this.debug("transition",w);let f=b!==v;f?this.state.set(b):w.reenter&&!f?this.state.invoke(v,v):this.action(w.actions)})}),oe(this,"action",p=>{let v=Wt(p)?p(this.getParams()):p;if(!v)return;let I=v.map(T=>{var b,f;let w=(f=(b=this.machine.implementations)==null?void 0:b.actions)==null?void 0:f[T];return w||zt(`[zag-js] No implementation found for action "${JSON.stringify(T)}"`),w});for(let T of I)T==null||T(this.getParams())}),oe(this,"guard",p=>{var v,I;return Wt(p)?p(this.getParams()):(I=(v=this.machine.implementations)==null?void 0:v.guards)==null?void 0:I[p](this.getParams())}),oe(this,"effect",p=>{let v=Wt(p)?p(this.getParams()):p;if(!v)return;let I=v.map(w=>{var f,S;let b=(S=(f=this.machine.implementations)==null?void 0:f.effects)==null?void 0:S[w];return b||zt(`[zag-js] No implementation found for effect "${JSON.stringify(w)}"`),b}),T=[];for(let w of I){let b=w==null?void 0:w(this.getParams());b&&T.push(b)}return()=>T.forEach(w=>w==null?void 0:w())}),oe(this,"choose",p=>or(p).find(v=>{let I=!v.guard;return Zr(v.guard)?I=!!this.guard(v.guard):Wt(v.guard)&&(I=v.guard(this.getParams())),I})),oe(this,"subscribe",p=>(this.subscriptions.push(p),()=>{let v=this.subscriptions.indexOf(p);v>-1&&this.subscriptions.splice(v,1)})),oe(this,"status",er.NotStarted),oe(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(p=>p(this.service))}),oe(this,"trackers",[]),oe(this,"setupTrackers",()=>{var p,v;(v=(p=this.machine).watch)==null||v.call(p,this.getParams())}),oe(this,"callTrackers",()=>{this.trackers.forEach(({deps:p,fn:v})=>{let I=p.map(T=>T());fe(v.prev,I)||(v(),v.prev=I)})}),oe(this,"getParams",()=>({state:this.getState(),context:this.context,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(p,v)=>{v.prev=p.map(I=>I()),this.trackers.push({deps:p,fn:v})},refs:this.refs,computed:this.computed,flush:sv,scope:this.scope,choose:this.choose})),this.userPropsRef={current:t};let{id:n,ids:i,getRootNode:r}=Kt(t);this.scope=pv({id:n,ids:i,getRootNode:r});let s=p=>{var T,w;let v=Kt(this.userPropsRef.current);return((w=(T=e.props)==null?void 0:T.call(e,{props:Si(v),scope:this.scope}))!=null?w:v)[p]};this.prop=s;let a=(h=e.context)==null?void 0:h.call(e,{prop:s,bindable:is,scope:this.scope,flush(p){queueMicrotask(p)},getContext(){return o},getComputed(){return l},getRefs(){return c},getEvent:this.getEvent.bind(this)});a&&Object.values(a).forEach(p=>{let v=ns(p.ref,()=>this.notify());this.cleanups.push(v)});let o={get(p){return a==null?void 0:a[p].get()},set(p,v){a==null||a[p].set(v)},initial(p){return a==null?void 0:a[p].initial},hash(p){let v=a==null?void 0:a[p].get();return a==null?void 0:a[p].hash(v)}};this.context=o;let l=p=>{var v,I;return(I=(v=e.computed)==null?void 0:v[p]({context:o,event:this.getEvent(),prop:s,refs:this.refs,scope:this.scope,computed:l}))!=null?I:{}};this.computed=l;let c=Dv((d=(m=e.refs)==null?void 0:m.call(e,{prop:s,context:o}))!=null?d:{});this.refs=c;let u=is(()=>({defaultValue:e.initialState({prop:s}),onChange:(p,v)=>{var T,w,b,f;if(v){let S=this.effects.get(v);S==null||S(),this.effects.delete(v)}v&&this.action((T=this.getStateConfig(v))==null?void 0:T.exit),this.action((w=this.transition)==null?void 0:w.actions);let I=this.effect((b=this.getStateConfig(p))==null?void 0:b.effects);if(I&&this.effects.set(p,I),v===Ua){this.action(e.entry);let S=this.effect(e.effects);S&&this.effects.set(Ua,S)}this.action((f=this.getStateConfig(p))==null?void 0:f.entry)}}));this.state=u,this.cleanups.push(ns(this.state.ref,()=>this.notify()))}updateProps(e){let t=this.userPropsRef.current;this.userPropsRef.current=()=>{let n=Kt(t),i=Kt(e);return lu(n,i)},this.notify()}start(){this.status=er.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,Ua),this.setupTrackers()}stop(){this.effects.forEach(e=>e==null?void 0:e()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.subscriptions=[],this.status=er.Stopped,this.debug("unmounting...")}get service(){return{state:this.getState(),send:this.send,context:this.context,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}},K=class{constructor(e,t){z(this,"el");z(this,"doc");z(this,"machine");z(this,"api");z(this,"init",()=>{this.render(),this.machine.subscribe(()=>{this.api=this.initApi(),this.render()}),this.machine.start()});z(this,"destroy",()=>{this.machine.stop()});z(this,"spreadProps",(e,t)=>{Rv(e,t,this.machine.scope.id)});z(this,"updateProps",e=>{this.machine.updateProps(e)});if(!e)throw new Error("Root element not found");this.el=e,this.doc=document,this.machine=this.initMachine(t),this.api=this.initApi()}}});var cu={};he(cu,{Accordion:()=>jv});function Gv(e,t){let{send:n,context:i,prop:r,scope:s,computed:a}=e,o=i.get("focusedValue"),l=i.get("value"),c=r("multiple");function u(m){let d=m;!c&&d.length>1&&(d=[d[0]]),n({type:"VALUE.SET",value:d})}function h(m){var d;return{expanded:l.includes(m.value),focused:o===m.value,disabled:!!((d=m.disabled)!=null?d:r("disabled"))}}return{focusedValue:o,value:l,setValue:u,getItemState:h,getRootProps(){return t.element(y(g({},dr.root.attrs),{dir:r("dir"),id:bs(s),"data-orientation":r("orientation")}))},getItemProps(m){let d=h(m);return t.element(y(g({},dr.item.attrs),{dir:r("dir"),id:Mv(s,m.value),"data-state":d.expanded?"open":"closed","data-focus":E(d.focused),"data-disabled":E(d.disabled),"data-orientation":r("orientation")}))},getItemContentProps(m){let d=h(m);return t.element(y(g({},dr.itemContent.attrs),{dir:r("dir"),role:"region",id:co(s,m.value),"aria-labelledby":Es(s,m.value),hidden:!d.expanded,"data-state":d.expanded?"open":"closed","data-disabled":E(d.disabled),"data-focus":E(d.focused),"data-orientation":r("orientation")}))},getItemIndicatorProps(m){let d=h(m);return t.element(y(g({},dr.itemIndicator.attrs),{dir:r("dir"),"aria-hidden":!0,"data-state":d.expanded?"open":"closed","data-disabled":E(d.disabled),"data-focus":E(d.focused),"data-orientation":r("orientation")}))},getItemTriggerProps(m){let{value:d}=m,p=h(m);return t.button(y(g({},dr.itemTrigger.attrs),{type:"button",dir:r("dir"),id:Es(s,d),"aria-controls":co(s,d),"data-controls":co(s,d),"aria-expanded":p.expanded,disabled:p.disabled,"data-orientation":r("orientation"),"aria-disabled":p.disabled,"data-state":p.expanded?"open":"closed","data-ownedby":bs(s),onFocus(){p.disabled||n({type:"TRIGGER.FOCUS",value:d})},onBlur(){p.disabled||n({type:"TRIGGER.BLUR"})},onClick(v){p.disabled||(Xe()&&v.currentTarget.focus(),n({type:"TRIGGER.CLICK",value:d}))},onKeyDown(v){if(v.defaultPrevented||p.disabled)return;let I={ArrowDown(){a("isHorizontal")||n({type:"GOTO.NEXT",value:d})},ArrowUp(){a("isHorizontal")||n({type:"GOTO.PREV",value:d})},ArrowRight(){a("isHorizontal")&&n({type:"GOTO.NEXT",value:d})},ArrowLeft(){a("isHorizontal")&&n({type:"GOTO.PREV",value:d})},Home(){n({type:"GOTO.FIRST",value:d})},End(){n({type:"GOTO.LAST",value:d})}},T=ge(v,{dir:r("dir"),orientation:r("orientation")}),w=I[T];w&&(w(v),v.preventDefault())}}))}}}var Lv,dr,bs,Mv,co,Es,Fv,Is,$v,Hv,Bv,_v,Uv,qv,Wv,Kv,c0,zv,u0,Yv,jv,uu=re(()=>{"use strict";se();Lv=U("accordion").parts("root","item","itemTrigger","itemContent","itemIndicator"),dr=Lv.build(),bs=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`accordion:${e.id}`},Mv=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`accordion:${e.id}:item:${t}`},co=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemContent)==null?void 0:i.call(n,t))!=null?r:`accordion:${e.id}:content:${t}`},Es=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemTrigger)==null?void 0:i.call(n,t))!=null?r:`accordion:${e.id}:trigger:${t}`},Fv=e=>e.getById(bs(e)),Is=e=>{let n=`[data-controls][data-ownedby='${CSS.escape(bs(e))}']:not([disabled])`;return Fe(Fv(e),n)},$v=e=>lt(Is(e)),Hv=e=>mt(Is(e)),Bv=(e,t)=>yi(Is(e),Es(e,t)),_v=(e,t)=>bi(Is(e),Es(e,t));({and:Uv,not:qv}=Ee()),Wv={props({props:e}){return g({collapsible:!1,multiple:!1,orientation:"vertical",defaultValue:[]},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{focusedValue:t(()=>({defaultValue:null,sync:!0,onChange(n){var i;(i=e("onFocusChange"))==null||i({value:n})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}}))}},computed:{isHorizontal:({prop:e})=>e("orientation")==="horizontal"},on:{"VALUE.SET":{actions:["setValue"]}},states:{idle:{on:{"TRIGGER.FOCUS":{target:"focused",actions:["setFocusedValue"]}}},focused:{on:{"GOTO.NEXT":{actions:["focusNextTrigger"]},"GOTO.PREV":{actions:["focusPrevTrigger"]},"TRIGGER.CLICK":[{guard:Uv("isExpanded","canToggle"),actions:["collapse"]},{guard:qv("isExpanded"),actions:["expand"]}],"GOTO.FIRST":{actions:["focusFirstTrigger"]},"GOTO.LAST":{actions:["focusLastTrigger"]},"TRIGGER.BLUR":{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{canToggle:({prop:e})=>!!e("collapsible")||!!e("multiple"),isExpanded:({context:e,event:t})=>e.get("value").includes(t.value)},actions:{collapse({context:e,prop:t,event:n}){let i=t("multiple")?ct(e.get("value"),n.value):[];e.set("value",i)},expand({context:e,prop:t,event:n}){let i=t("multiple")?Ze(e.get("value"),n.value):[n.value];e.set("value",i)},focusFirstTrigger({scope:e}){var t;(t=$v(e))==null||t.focus()},focusLastTrigger({scope:e}){var t;(t=Hv(e))==null||t.focus()},focusNextTrigger({context:e,scope:t}){let n=e.get("focusedValue");if(!n)return;let i=Bv(t,n);i==null||i.focus()},focusPrevTrigger({context:e,scope:t}){let n=e.get("focusedValue");if(!n)return;let i=_v(t,n);i==null||i.focus()},setFocusedValue({context:e,event:t}){e.set("focusedValue",t.value)},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t}){e.set("value",t.value)},coarseValue({context:e,prop:t}){!t("multiple")&&e.get("value").length>1&&(zt("The value of accordion should be a single value when multiple is false."),e.set("value",[e.get("value")[0]]))}}}},Kv=_()(["collapsible","dir","disabled","getRootNode","id","ids","multiple","onFocusChange","onValueChange","orientation","value","defaultValue"]),c0=B(Kv),zv=_()(["value","disabled"]),u0=B(zv),Yv=class extends K{initMachine(e){return new W(Wv,e)}initApi(){return Gv(this.machine.service,q)}render(){var i;let e=(i=this.el.querySelector('[data-scope="accordion"][data-part="root"]'))!=null?i:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.getItemsList(),n=e.querySelectorAll('[data-scope="accordion"][data-part="item"]');for(let r=0;r{var a,o;let r=O(e,"onValueChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,value:(a=i.value)!=null?a:null});let s=O(e,"onValueChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,value:(o=i.value)!=null?o:null}}))},onFocusChange:i=>{var a,o;let r=O(e,"onFocusChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,value:(a=i.value)!=null?a:null});let s=O(e,"onFocusChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,value:(o=i.value)!=null?o:null}}))}}));n.init(),this.accordion=n,this.onSetValue=i=>{let{value:r}=i.detail;n.api.setValue(r)},e.addEventListener("phx:accordion:set-value",this.onSetValue),this.handlers=[],this.handlers.push(this.handleEvent("accordion_set_value",i=>{let r=i.accordion_id;r&&!(e.id===r||e.id===`accordion:${r}`)||n.api.setValue(i.value)})),this.handlers.push(this.handleEvent("accordion_value",()=>{this.pushEvent("accordion_value_response",{value:n.api.value})})),this.handlers.push(this.handleEvent("accordion_focused_value",()=>{this.pushEvent("accordion_focused_value_response",{value:n.api.focusedValue})}))},updated(){var t,n,i,r;let e=C(this.el,"controlled");(r=this.accordion)==null||r.updateProps(y(g({id:this.el.id},e?{value:Z(this.el,"value")}:{defaultValue:(i=(n=(t=this.accordion)==null?void 0:t.api)==null?void 0:n.value)!=null?i:Z(this.el,"defaultValue")}),{collapsible:C(this.el,"collapsible"),multiple:C(this.el,"multiple"),orientation:O(this.el,"orientation",["horizontal","vertical"]),dir:Oe(this.el)}))},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:accordion:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.accordion)==null||e.destroy()}}});function yu(e,t,n=e.center){let i=t.x-n.x,r=t.y-n.y;return 360-(Math.atan2(i,r)*(180/Math.PI)+180)}function bn(e){let{x:t,y:n,width:i,height:r}=e,s=t+i/2,a=n+r/2;return{x:t,y:n,width:i,height:r,minX:t,minY:n,maxX:t+i,maxY:n+r,midX:s,midY:a,center:_n(s,a)}}function ey(e){let t=_n(e.minX,e.minY),n=_n(e.maxX,e.minY),i=_n(e.maxX,e.maxY),r=_n(e.minX,e.maxY);return{top:t,right:n,bottom:i,left:r}}function ty(e){if(!uo.has(e)){let t=e.ownerDocument.defaultView||window;uo.set(e,t.getComputedStyle(e))}return uo.get(e)}function po(e,t={}){return bn(ny(e,t))}function ny(e,t={}){let{excludeScrollbar:n=!1,excludeBorders:i=!1}=t,{x:r,y:s,width:a,height:o}=e.getBoundingClientRect(),l={x:r,y:s,width:a,height:o},c=ty(e),{borderLeftWidth:u,borderTopWidth:h,borderRightWidth:m,borderBottomWidth:d}=c,p=gu(u,m),v=gu(h,d);if(i&&(l.width-=p,l.height-=v,l.x+=ho(u),l.y+=ho(h)),n){let I=e.offsetWidth-e.clientWidth-p,T=e.offsetHeight-e.clientHeight-v;l.width-=I,l.height-=T}return l}function Cu(e,t={}){return bn(iy(e,t))}function iy(e,t){let{excludeScrollbar:n=!1}=t,{innerWidth:i,innerHeight:r,document:s,visualViewport:a}=e,o=(a==null?void 0:a.width)||i,l=(a==null?void 0:a.height)||r,c={x:0,y:0,width:o,height:l};if(n){let u=i-s.documentElement.clientWidth,h=r-s.documentElement.clientHeight;c.width-=u,c.height-=h}return c}function Su(e,t){let n=bn(e),{top:i,right:r,left:s,bottom:a}=ey(n),[o]=t.split("-");return{top:[s,i,r,a],right:[i,r,a,s],bottom:[i,s,a,r],left:[r,i,s,a]}[o]}function fo(e,t){let{x:n,y:i}=t,r=!1;for(let s=0,a=e.length-1;si!=u>i&&n<(c-o)*(i-l)/(u-l)+o&&(r=!r)}return r}function mu(e,t){let{minX:n,minY:i,maxX:r,maxY:s,midX:a,midY:o}=e,l=t.includes("w")?n:t.includes("e")?r:a,c=t.includes("n")?i:t.includes("s")?s:o;return{x:l,y:c}}function sy(e){return ry[e]}function Tu(e,t,n,i){let{scalingOriginMode:r,lockAspectRatio:s}=i,a=mu(e,n),o=sy(n),l=mu(e,o);r==="center"&&(t={x:t.x*2,y:t.y*2});let c={x:a.x+t.x,y:a.y+t.y},u={x:pu[n].x*2-1,y:pu[n].y*2-1},h={width:c.x-l.x,height:c.y-l.y},m=u.x*h.width/e.width,d=u.y*h.height/e.height,p=Ti(m)>Ti(d)?m:d,v=s?{x:p,y:p}:{x:a.x===l.x?1:m,y:a.y===l.y?1:d};switch(a.y===l.y?v.y=Ti(v.y):Ps(v.y)!==Ps(d)&&(v.y*=-1),a.x===l.x?v.x=Ti(v.x):Ps(v.x)!==Ps(m)&&(v.x*=-1),r){case"extent":return vu(e,du.scale(v.x,v.y,l),!1);case"center":return vu(e,du.scale(v.x,v.y,{x:e.midX,y:e.midY}),!1)}}function ay(e,t,n=!0){return n?{x:fu(t.x,e.x),y:fu(t.y,e.y),width:Ti(t.x-e.x),height:Ti(t.y-e.y)}:{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}function vu(e,t,n=!0){let i=t.applyTo({x:e.minX,y:e.minY}),r=t.applyTo({x:e.maxX,y:e.maxY});return ay(i,r,n)}var Xv,Zv,Zt,du,hu,hr,Jv,Qv,gr,_n,go,bu,Eu,Iu,Pu,uo,ho,gu,g0,p0,pu,ry,Ps,Ti,fu,Cs=re(()=>{"use strict";Xv=Object.defineProperty,Zv=(e,t,n)=>t in e?Xv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zt=(e,t,n)=>Zv(e,typeof t!="symbol"?t+"":t,n),du=class Ae{constructor([t,n,i,r,s,a]=[0,0,0,0,0,0]){Zt(this,"m00"),Zt(this,"m01"),Zt(this,"m02"),Zt(this,"m10"),Zt(this,"m11"),Zt(this,"m12"),Zt(this,"rotate",(...o)=>this.prepend(Ae.rotate(...o))),Zt(this,"scale",(...o)=>this.prepend(Ae.scale(...o))),Zt(this,"translate",(...o)=>this.prepend(Ae.translate(...o))),this.m00=t,this.m01=n,this.m02=i,this.m10=r,this.m11=s,this.m12=a}applyTo(t){let{x:n,y:i}=t,{m00:r,m01:s,m02:a,m10:o,m11:l,m12:c}=this;return{x:r*n+s*i+a,y:o*n+l*i+c}}prepend(t){return new Ae([this.m00*t.m00+this.m01*t.m10,this.m00*t.m01+this.m01*t.m11,this.m00*t.m02+this.m01*t.m12+this.m02,this.m10*t.m00+this.m11*t.m10,this.m10*t.m01+this.m11*t.m11,this.m10*t.m02+this.m11*t.m12+this.m12])}append(t){return new Ae([t.m00*this.m00+t.m01*this.m10,t.m00*this.m01+t.m01*this.m11,t.m00*this.m02+t.m01*this.m12+t.m02,t.m10*this.m00+t.m11*this.m10,t.m10*this.m01+t.m11*this.m11,t.m10*this.m02+t.m11*this.m12+t.m12])}get determinant(){return this.m00*this.m11-this.m01*this.m10}get isInvertible(){let t=this.determinant;return isFinite(t)&&isFinite(this.m02)&&isFinite(this.m12)&&t!==0}invert(){let t=this.determinant;return new Ae([this.m11/t,-this.m01/t,(this.m01*this.m12-this.m11*this.m02)/t,-this.m10/t,this.m00/t,(this.m10*this.m02-this.m00*this.m12)/t])}get array(){return[this.m00,this.m01,this.m02,this.m10,this.m11,this.m12,0,0,1]}get float32Array(){return new Float32Array(this.array)}static get identity(){return new Ae([1,0,0,0,1,0])}static rotate(t,n){let i=new Ae([Math.cos(t),-Math.sin(t),0,Math.sin(t),Math.cos(t),0]);return n&&(n.x!==0||n.y!==0)?Ae.multiply(Ae.translate(n.x,n.y),i,Ae.translate(-n.x,-n.y)):i}static scale(t,n=t,i={x:0,y:0}){let r=new Ae([t,0,0,0,n,0]);return i.x!==0||i.y!==0?Ae.multiply(Ae.translate(i.x,i.y),r,Ae.translate(-i.x,-i.y)):r}static translate(t,n){return new Ae([1,0,t,0,1,n])}static multiply(...[t,...n]){return t?n.reduce((i,r)=>i.prepend(r),t):Ae.identity}get a(){return this.m00}get b(){return this.m10}get c(){return this.m01}get d(){return this.m11}get tx(){return this.m02}get ty(){return this.m12}get scaleComponents(){return{x:this.a,y:this.d}}get translationComponents(){return{x:this.tx,y:this.ty}}get skewComponents(){return{x:this.c,y:this.b}}toString(){return`matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.tx}, ${this.ty})`}};hu=(e,t,n)=>Math.min(Math.max(e,t),n),hr=(e,t,n)=>{let i=hu(e.x,n.x,n.x+n.width-t.width),r=hu(e.y,n.y,n.y+n.height-t.height);return{x:i,y:r}},Jv={width:0,height:0},Qv={width:1/0,height:1/0},gr=(e,t=Jv,n=Qv)=>({width:Math.min(Math.max(e.width,t.width),n.width),height:Math.min(Math.max(e.height,t.height),n.height)}),_n=(e,t)=>({x:e,y:t}),go=(e,t)=>t?_n(e.x-t.x,e.y-t.y):e,bu=(e,t)=>_n(e.x+t.x,e.y+t.y);Eu=(e,t)=>{let n=Math.max(t.x,Math.min(e.x,t.x+t.width-e.width)),i=Math.max(t.y,Math.min(e.y,t.y+t.height-e.height));return{x:n,y:i,width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}},Iu=(e,t)=>e.width===(t==null?void 0:t.width)&&e.height===(t==null?void 0:t.height),Pu=(e,t)=>e.x===(t==null?void 0:t.x)&&e.y===(t==null?void 0:t.y),uo=new WeakMap;ho=e=>parseFloat(e.replace("px","")),gu=(...e)=>e.reduce((t,n)=>t+(n?ho(n):0),0),{min:g0,max:p0}=Math;pu={n:{x:.5,y:0},ne:{x:1,y:0},e:{x:1,y:.5},se:{x:1,y:1},s:{x:.5,y:1},sw:{x:0,y:1},w:{x:0,y:.5},nw:{x:0,y:0}},ry={n:"s",ne:"sw",e:"w",se:"nw",s:"n",sw:"ne",w:"e",nw:"se"},{sign:Ps,abs:Ti,min:fu}=Math});var Nu={};he(Nu,{AngleSlider:()=>vy});function Au(e,t,n){let i=bn(e.getBoundingClientRect()),r=yu(i,t);return n!=null?r-n:r}function ku(e){return Math.min(Math.max(e,Ss),Ts)}function hy(e,t){let n=ku(e),i=Math.ceil(n/t),r=Math.round(n/t);return i>=n/t?i*t===Ts?Ss:i*t:r*t}function wu(e,t){return eu(e,Ss,Ts,t)}function gy(e,t){let{state:n,send:i,context:r,prop:s,computed:a,scope:o}=e,l=n.matches("dragging"),c=r.get("value"),u=a("valueAsDegree"),h=s("disabled"),m=s("invalid"),d=s("readOnly"),p=a("interactive"),v=s("aria-label"),I=s("aria-labelledby");return{value:c,valueAsDegree:u,dragging:l,setValue(T){i({type:"VALUE.SET",value:T})},getRootProps(){return t.element(y(g({},Gn.root.attrs),{id:ly(o),"data-disabled":E(h),"data-invalid":E(m),"data-readonly":E(d),style:{"--value":c,"--angle":u}}))},getLabelProps(){return t.label(y(g({},Gn.label.attrs),{id:Ou(o),htmlFor:mo(o),"data-disabled":E(h),"data-invalid":E(m),"data-readonly":E(d),onClick(T){var w;p&&(T.preventDefault(),(w=vo(o))==null||w.focus())}}))},getHiddenInputProps(){return t.element({type:"hidden",value:c,name:s("name"),id:mo(o)})},getControlProps(){return t.element(y(g({},Gn.control.attrs),{role:"presentation",id:xu(o),"data-disabled":E(h),"data-invalid":E(m),"data-readonly":E(d),onPointerDown(T){if(!p||!pe(T))return;let w=je(T),b=T.currentTarget,f=vo(o),S=Yt(T).composedPath(),P=f&&S.includes(f),V=null;P&&(V=Au(b,w)-c),i({type:"CONTROL.POINTER_DOWN",point:w,angularOffset:V}),T.stopPropagation()},style:{touchAction:"none",userSelect:"none",WebkitUserSelect:"none"}}))},getThumbProps(){return t.element(y(g({},Gn.thumb.attrs),{id:Vu(o),role:"slider","aria-label":v,"aria-labelledby":I!=null?I:Ou(o),"aria-valuemax":360,"aria-valuemin":0,"aria-valuenow":c,tabIndex:d||p?0:void 0,"data-disabled":E(h),"data-invalid":E(m),"data-readonly":E(d),onFocus(){i({type:"THUMB.FOCUS"})},onBlur(){i({type:"THUMB.BLUR"})},onKeyDown(T){if(!p)return;let w=gi(T)*s("step");switch(T.key){case"ArrowLeft":case"ArrowUp":T.preventDefault(),i({type:"THUMB.ARROW_DEC",step:w});break;case"ArrowRight":case"ArrowDown":T.preventDefault(),i({type:"THUMB.ARROW_INC",step:w});break;case"Home":T.preventDefault(),i({type:"THUMB.HOME"});break;case"End":T.preventDefault(),i({type:"THUMB.END"});break}},style:{rotate:"var(--angle)"}}))},getValueTextProps(){return t.element(y(g({},Gn.valueText.attrs),{id:cy(o)}))},getMarkerGroupProps(){return t.element(g({},Gn.markerGroup.attrs))},getMarkerProps(T){let w;return T.valuec?w="over-value":w="at-value",t.element(y(g({},Gn.marker.attrs),{"data-value":T.value,"data-state":w,"data-disabled":E(h),style:{"--marker-value":T.value,rotate:"calc(var(--marker-value) * 1deg)"}}))}}}var oy,Gn,ly,Vu,mo,xu,cy,Ou,uy,dy,vo,Ss,Ts,py,fy,y0,my,vy,Ru=re(()=>{"use strict";Cs();se();oy=U("angle-slider").parts("root","label","thumb","valueText","control","track","markerGroup","marker"),Gn=oy.build(),ly=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`angle-slider:${e.id}`},Vu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.thumb)!=null?n:`angle-slider:${e.id}:thumb`},mo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`angle-slider:${e.id}:input`},xu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`angle-slider:${e.id}:control`},cy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.valueText)!=null?n:`angle-slider:${e.id}:value-text`},Ou=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`angle-slider:${e.id}:label`},uy=e=>e.getById(mo(e)),dy=e=>e.getById(xu(e)),vo=e=>e.getById(Vu(e)),Ss=0,Ts=359;py={props({props:e}){return g({step:1,defaultValue:0},e)},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n,valueAsDegree:`${n}deg`})}}))}},refs(){return{thumbDragOffset:null}},computed:{interactive:({prop:e})=>!(e("disabled")||e("readOnly")),valueAsDegree:({context:e})=>`${e.get("value")}deg`},watch({track:e,context:t,action:n}){e([()=>t.get("value")],()=>{n(["syncInputElement"])})},initialState(){return"idle"},on:{"VALUE.SET":{actions:["setValue"]}},states:{idle:{on:{"CONTROL.POINTER_DOWN":{target:"dragging",actions:["setThumbDragOffset","setPointerValue","focusThumb"]},"THUMB.FOCUS":{target:"focused"}}},focused:{on:{"CONTROL.POINTER_DOWN":{target:"dragging",actions:["setThumbDragOffset","setPointerValue","focusThumb"]},"THUMB.ARROW_DEC":{actions:["decrementValue","invokeOnChangeEnd"]},"THUMB.ARROW_INC":{actions:["incrementValue","invokeOnChangeEnd"]},"THUMB.HOME":{actions:["setValueToMin","invokeOnChangeEnd"]},"THUMB.END":{actions:["setValueToMax","invokeOnChangeEnd"]},"THUMB.BLUR":{target:"idle"}}},dragging:{entry:["focusThumb"],effects:["trackPointerMove"],on:{"DOC.POINTER_UP":{target:"focused",actions:["invokeOnChangeEnd","clearThumbDragOffset"]},"DOC.POINTER_MOVE":{actions:["setPointerValue"]}}}},implementations:{effects:{trackPointerMove({scope:e,send:t}){return hn(e.getDoc(),{onPointerMove(n){t({type:"DOC.POINTER_MOVE",point:n.point})},onPointerUp(){t({type:"DOC.POINTER_UP"})}})}},actions:{syncInputElement({scope:e,context:t}){let n=uy(e);Me(n,t.get("value").toString())},invokeOnChangeEnd({context:e,prop:t,computed:n}){var i;(i=t("onValueChangeEnd"))==null||i({value:e.get("value"),valueAsDegree:n("valueAsDegree")})},setPointerValue({scope:e,event:t,context:n,prop:i,refs:r}){let s=dy(e);if(!s)return;let a=r.get("thumbDragOffset"),o=Au(s,t.point,a);n.set("value",hy(o,i("step")))},setValueToMin({context:e}){e.set("value",Ss)},setValueToMax({context:e}){e.set("value",Ts)},setValue({context:e,event:t}){e.set("value",ku(t.value))},decrementValue({context:e,event:t,prop:n}){var r;let i=wu(e.get("value")-t.step,(r=t.step)!=null?r:n("step"));e.set("value",i)},incrementValue({context:e,event:t,prop:n}){var r;let i=wu(e.get("value")+t.step,(r=t.step)!=null?r:n("step"));e.set("value",i)},focusThumb({scope:e}){H(()=>{var t;(t=vo(e))==null||t.focus({preventScroll:!0})})},setThumbDragOffset({refs:e,event:t}){var n;e.set("thumbDragOffset",(n=t.angularOffset)!=null?n:null)},clearThumbDragOffset({refs:e}){e.set("thumbDragOffset",null)}}}},fy=_()(["aria-label","aria-labelledby","dir","disabled","getRootNode","id","ids","invalid","name","onValueChange","onValueChangeEnd","readOnly","step","value","defaultValue"]),y0=B(fy),my=class extends K{initMachine(e){return new W(py,e)}initApi(){return gy(this.machine.service,q)}render(){var o;let e=(o=this.el.querySelector('[data-scope="angle-slider"][data-part="root"]'))!=null?o:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="angle-slider"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');n&&this.spreadProps(n,this.api.getHiddenInputProps());let i=this.el.querySelector('[data-scope="angle-slider"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps());let r=this.el.querySelector('[data-scope="angle-slider"][data-part="thumb"]');r&&this.spreadProps(r,this.api.getThumbProps());let s=this.el.querySelector('[data-scope="angle-slider"][data-part="value-text"]');if(s){this.spreadProps(s,this.api.getValueTextProps());let l=s.querySelector('[data-scope="angle-slider"][data-part="value"]');l&&l.textContent!==String(this.api.value)&&(l.textContent=String(this.api.value))}let a=this.el.querySelector('[data-scope="angle-slider"][data-part="marker-group"]');a&&this.spreadProps(a,this.api.getMarkerGroupProps()),this.el.querySelectorAll('[data-scope="angle-slider"][data-part="marker"]').forEach(l=>{let c=l.dataset.value;if(c==null)return;let u=Number(c);Number.isNaN(u)||this.spreadProps(l,this.api.getMarkerProps({value:u}))})}},vy={mounted(){var a;let e=this.el,t=Y(e,"value"),n=Y(e,"defaultValue"),i=C(e,"controlled"),r=!1,s=new my(e,y(g({id:e.id},i&&t!==void 0?{value:t}:{defaultValue:n!=null?n:0}),{step:(a=Y(e,"step"))!=null?a:1,disabled:C(e,"disabled"),readOnly:C(e,"readOnly"),invalid:C(e,"invalid"),name:O(e,"name"),dir:O(e,"dir",["ltr","rtl"]),onValueChange:o=>{if(r){r=!1;return}if(i)r=!0,s.api.setValue(o.value);else{let u=e.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');u&&(u.value=String(o.value),u.dispatchEvent(new Event("input",{bubbles:!0})),u.dispatchEvent(new Event("change",{bubbles:!0})))}let l=O(e,"onValueChange");l&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(l,{value:o.value,valueAsDegree:o.valueAsDegree,id:e.id});let c=O(e,"onValueChangeClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:{value:o,id:e.id}}))},onValueChangeEnd:o=>{if(i){let u=e.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');u&&(u.value=String(o.value),u.dispatchEvent(new Event("input",{bubbles:!0})),u.dispatchEvent(new Event("change",{bubbles:!0})))}let l=O(e,"onValueChangeEnd");l&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(l,{value:o.value,valueAsDegree:o.valueAsDegree,id:e.id});let c=O(e,"onValueChangeEndClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:{value:o,id:e.id}}))}}));s.init(),this.angleSlider=s,this.handlers=[],this.onSetValue=o=>{let{value:l}=o.detail;s.api.setValue(l)},e.addEventListener("phx:angle-slider:set-value",this.onSetValue),this.handlers.push(this.handleEvent("angle_slider_set_value",o=>{let l=o.angle_slider_id;l&&!(e.id===l||e.id===`angle-slider:${l}`)||s.api.setValue(o.value)})),this.handlers.push(this.handleEvent("angle_slider_value",()=>{this.pushEvent("angle_slider_value_response",{value:s.api.value,valueAsDegree:s.api.valueAsDegree,dragging:s.api.dragging})}))},updated(){var n,i;let e=Y(this.el,"value"),t=C(this.el,"controlled");(i=this.angleSlider)==null||i.updateProps(y(g({id:this.el.id},t&&e!==void 0?{value:e}:{}),{step:(n=Y(this.el,"step"))!=null?n:1,disabled:C(this.el,"disabled"),readOnly:C(this.el,"readOnly"),invalid:C(this.el,"invalid"),name:O(this.el,"name")}))},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:angle-slider:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.angleSlider)==null||e.destroy()}}});var Mu={};he(Mu,{Avatar:()=>Oy});function Iy(e,t){let{state:n,send:i,prop:r,scope:s}=e,a=n.matches("loaded");return{loaded:a,setSrc(o){let l=bo(s);l==null||l.setAttribute("src",o)},setLoaded(){i({type:"img.loaded",src:"api"})},setError(){i({type:"img.error",src:"api"})},getRootProps(){return t.element(y(g({},yo.root.attrs),{dir:r("dir"),id:Du(s)}))},getImageProps(){return t.img(y(g({},yo.image.attrs),{hidden:!a,dir:r("dir"),id:Lu(s),"data-state":a?"visible":"hidden",onLoad(){i({type:"img.loaded",src:"element"})},onError(){i({type:"img.error",src:"element"})}}))},getFallbackProps(){return t.element(y(g({},yo.fallback.attrs),{dir:r("dir"),id:by(s),hidden:a,"data-state":a?"hidden":"visible"}))}}}function Cy(e){return e.complete&&e.naturalWidth!==0&&e.naturalHeight!==0}var yy,yo,Du,Lu,by,Ey,bo,Py,Sy,P0,Ty,Oy,Fu=re(()=>{"use strict";se();yy=U("avatar").parts("root","image","fallback"),yo=yy.build(),Du=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`avatar:${e.id}`},Lu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.image)!=null?n:`avatar:${e.id}:image`},by=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.fallback)!=null?n:`avatar:${e.id}:fallback`},Ey=e=>e.getById(Du(e)),bo=e=>e.getById(Lu(e));Py={initialState(){return"loading"},effects:["trackImageRemoval","trackSrcChange"],on:{"src.change":{target:"loading"},"img.unmount":{target:"error"}},states:{loading:{entry:["checkImageStatus"],on:{"img.loaded":{target:"loaded",actions:["invokeOnLoad"]},"img.error":{target:"error",actions:["invokeOnError"]}}},error:{on:{"img.loaded":{target:"loaded",actions:["invokeOnLoad"]}}},loaded:{on:{"img.error":{target:"error",actions:["invokeOnError"]}}}},implementations:{actions:{invokeOnLoad({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"loaded"})},invokeOnError({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"error"})},checkImageStatus({send:e,scope:t}){let n=bo(t);if(!(n!=null&&n.complete))return;let i=Cy(n)?"img.loaded":"img.error";e({type:i,src:"ssr"})}},effects:{trackImageRemoval({send:e,scope:t}){let n=Ey(t);return hs(n,{callback(i){Array.from(i[0].removedNodes).find(a=>a.nodeType===Node.ELEMENT_NODE&&a.matches("[data-scope=avatar][data-part=image]"))&&e({type:"img.unmount"})}})},trackSrcChange({send:e,scope:t}){let n=bo(t);return ot(n,{attributes:["src","srcset"],callback(){e({type:"src.change"})}})}}}};Sy=_()(["dir","id","ids","onStatusChange","getRootNode"]),P0=B(Sy),Ty=class extends K{initMachine(e){return new W(Py,e)}initApi(){return Iy(this.machine.service,q)}render(){var r;let e=(r=this.el.querySelector('[data-scope="avatar"][data-part="root"]'))!=null?r:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="avatar"][data-part="image"]');t&&this.spreadProps(t,this.api.getImageProps());let n=this.el.querySelector('[data-scope="avatar"][data-part="fallback"]');n&&this.spreadProps(n,this.api.getFallbackProps());let i=this.el.querySelector('[data-scope="avatar"][data-part="skeleton"]');if(i){let s=this.machine.service.state,a=s.matches("loaded"),o=s.matches("error");i.hidden=a||o,i.setAttribute("data-state",a||o?"hidden":"visible")}}},Oy={mounted(){let e=this.el,t=O(e,"src"),n=new Ty(e,g({id:e.id,onStatusChange:i=>{let r=O(e,"onStatusChange");r&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(r,{status:i.status,id:e.id});let s=O(e,"onStatusChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{value:i,id:e.id}}))}},t!==void 0?{}:{}));n.init(),this.avatar=n,t!==void 0&&n.api.setSrc(t),this.handlers=[]},updated(){let e=O(this.el,"src");e!==void 0&&this.avatar&&this.avatar.api.setSrc(e)},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.avatar)==null||e.destroy()}}});var qu={};he(qu,{Carousel:()=>qy});function Bu(e){let t=at(e),n=e.getBoundingClientRect(),i=t.getPropertyValue("scroll-padding-left").replace("auto","0px"),r=t.getPropertyValue("scroll-padding-top").replace("auto","0px"),s=t.getPropertyValue("scroll-padding-right").replace("auto","0px"),a=t.getPropertyValue("scroll-padding-bottom").replace("auto","0px");function o(m,d){let p=parseFloat(m);return/%/.test(m)&&(p/=100,p*=d),Number.isNaN(p)?0:p}let l=o(i,n.width),c=o(r,n.height),u=o(s,n.width),h=o(a,n.height);return{x:{before:l,after:u},y:{before:c,after:h}}}function wy(e,t,n="both"){return n==="x"&&e.right>=t.left&&e.left<=t.right||n==="y"&&e.bottom>=t.top&&e.top<=t.bottom||n==="both"&&e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}function _u(e){let t=[];for(let n of e.children)t=t.concat(n,_u(n));return t}function Gu(e,t=!1){let n=e.getBoundingClientRect(),r=Po(e)==="rtl",s={x:{start:[],center:[],end:[]},y:{start:[],center:[],end:[]}},a=t?_u(e):e.children;for(let o of["x","y"]){let l=o==="x"?"y":"x",c=o==="x"?"left":"top",u=o==="x"?"right":"bottom",h=o==="x"?"width":"height",m=o==="x"?"scrollLeft":"scrollTop",d=r&&o==="x";for(let p of a){let v=p.getBoundingClientRect();if(!wy(n,v,l))continue;let I=at(p),[T,w]=I.getPropertyValue("scroll-snap-align").split(" ");typeof w=="undefined"&&(w=T);let b=o==="x"?w:T,f,S,P;if(d){let V=Math.abs(e[m]),A=n[u]-v[u]+V;f=A,S=A+v[h],P=A+v[h]/2}else f=v[c]-n[c]+e[m],S=f+v[h],P=f+v[h]/2;switch(b){case"none":break;case"start":s[o].start.push({node:p,position:f});break;case"center":s[o].center.push({node:p,position:P});break;case"end":s[o].end.push({node:p,position:S});break}}}return s}function Vy(e){let t=Po(e),n=e.getBoundingClientRect(),i=Bu(e),r=Gu(e),s={x:e.scrollWidth-e.offsetWidth,y:e.scrollHeight-e.offsetHeight},a=t==="rtl",o=a&&e.scrollLeft<=0,l;return a?(l=Eo([...r.x.start.map(c=>c.position-i.x.after),...r.x.center.map(c=>c.position-n.width/2),...r.x.end.map(c=>c.position-n.width+i.x.before)].map(Io(0,s.x))),o&&(l=l.map(c=>-c))):l=Eo([...r.x.start.map(c=>c.position-i.x.before),...r.x.center.map(c=>c.position-n.width/2),...r.x.end.map(c=>c.position-n.width+i.x.after)].map(Io(0,s.x))),{x:l,y:Eo([...r.y.start.map(c=>c.position-i.y.before),...r.y.center.map(c=>c.position-n.height/2),...r.y.end.map(c=>c.position-n.height+i.y.after)].map(Io(0,s.y)))}}function xy(e,t,n){let i=Po(e),r=Bu(e),s=Gu(e),a=[...s[t].start,...s[t].center,...s[t].end],o=i==="rtl",l=o&&t==="x"&&e.scrollLeft<=0;for(let c of a)if(n(c.node)){let u;return t==="x"&&o?(u=c.position-r.x.after,l&&(u=-u)):u=c.position-(t==="x"?r.x.before:r.y.before),u}}function Fy(e,t){let{state:n,context:i,computed:r,send:s,scope:a,prop:o}=e,l=n.matches("autoplay"),c=n.matches("dragging"),u=r("canScrollNext"),h=r("canScrollPrev"),m=r("isHorizontal"),d=o("autoSize"),p=Array.from(i.get("pageSnapPoints")),v=i.get("page"),I=o("slidesPerPage"),T=o("padding"),w=o("translations");return{isPlaying:l,isDragging:c,page:v,pageSnapPoints:p,canScrollNext:u,canScrollPrev:h,getProgress(){return v/p.length},getProgressText(){var f,S;let b={page:v+1,totalPages:p.length};return(S=(f=w.progressText)==null?void 0:f.call(w,b))!=null?S:""},scrollToIndex(b,f){s({type:"INDEX.SET",index:b,instant:f})},scrollTo(b,f){s({type:"PAGE.SET",index:b,instant:f})},scrollNext(b){s({type:"PAGE.NEXT",instant:b})},scrollPrev(b){s({type:"PAGE.PREV",instant:b})},play(){s({type:"AUTOPLAY.START"})},pause(){s({type:"AUTOPLAY.PAUSE"})},isInView(b){return Array.from(i.get("slidesInView")).includes(b)},refresh(){s({type:"SNAP.REFRESH"})},getRootProps(){return t.element(y(g({},kt.root.attrs),{id:ky(a),role:"region","aria-roledescription":"carousel","data-orientation":o("orientation"),dir:o("dir"),style:{"--slides-per-page":I,"--slide-spacing":o("spacing"),"--slide-item-size":d?"auto":"calc(100% / var(--slides-per-page) - var(--slide-spacing) * (var(--slides-per-page) - 1) / var(--slides-per-page))"}}))},getItemGroupProps(){return t.element(y(g({},kt.itemGroup.attrs),{id:Os(a),"data-orientation":o("orientation"),"data-dragging":E(c),dir:o("dir"),"aria-live":l?"off":"polite",onFocus(b){ce(b.currentTarget,j(b))&&s({type:"VIEWPORT.FOCUS"})},onBlur(b){ce(b.currentTarget,b.relatedTarget)||s({type:"VIEWPORT.BLUR"})},onMouseDown(b){if(b.defaultPrevented||!o("allowMouseDrag")||!pe(b))return;let f=j(b);Ye(f)&&f!==b.currentTarget||(b.preventDefault(),s({type:"DRAGGING.START"}))},onWheel:Yc(b=>{let f=o("orientation")==="horizontal"?"deltaX":"deltaY";b[f]<0&&!r("canScrollPrev")||b[f]>0&&!r("canScrollNext")||s({type:"USER.SCROLL"})},150),onTouchStart(){s({type:"USER.SCROLL"})},style:{display:d?"flex":"grid",gap:"var(--slide-spacing)",scrollSnapType:[m?"x":"y",o("snapType")].join(" "),gridAutoFlow:m?"column":"row",scrollbarWidth:"none",overscrollBehaviorX:"contain",[m?"gridAutoColumns":"gridAutoRows"]:d?void 0:"var(--slide-item-size)",[m?"scrollPaddingInline":"scrollPaddingBlock"]:T,[m?"paddingInline":"paddingBlock"]:T,[m?"overflowX":"overflowY"]:"auto"}}))},getItemProps(b){let f=i.get("slidesInView").includes(b.index);return t.element(y(g({},kt.item.attrs),{id:Ny(a,b.index),dir:o("dir"),role:"group","data-index":b.index,"data-inview":E(f),"aria-roledescription":"slide","data-orientation":o("orientation"),"aria-label":w.item(b.index,o("slideCount")),"aria-hidden":X(!f),style:{flex:"0 0 auto",[m?"maxWidth":"maxHeight"]:"100%",scrollSnapAlign:(()=>{var x;let S=(x=b.snapAlign)!=null?x:"start",P=o("slidesPerMove"),V=P==="auto"?Math.floor(o("slidesPerPage")):P;return(b.index+V)%V===0?S:void 0})()}}))},getControlProps(){return t.element(y(g({},kt.control.attrs),{"data-orientation":o("orientation")}))},getPrevTriggerProps(){return t.button(y(g({},kt.prevTrigger.attrs),{id:Dy(a),type:"button",disabled:!h,dir:o("dir"),"aria-label":w.prevTrigger,"data-orientation":o("orientation"),"aria-controls":Os(a),onClick(b){b.defaultPrevented||s({type:"PAGE.PREV",src:"trigger"})}}))},getNextTriggerProps(){return t.button(y(g({},kt.nextTrigger.attrs),{dir:o("dir"),id:Ry(a),type:"button","aria-label":w.nextTrigger,"data-orientation":o("orientation"),"aria-controls":Os(a),disabled:!u,onClick(b){b.defaultPrevented||s({type:"PAGE.NEXT",src:"trigger"})}}))},getIndicatorGroupProps(){return t.element(y(g({},kt.indicatorGroup.attrs),{dir:o("dir"),id:Ly(a),"data-orientation":o("orientation"),onKeyDown(b){if(b.defaultPrevented)return;let f="indicator",S={ArrowDown(A){m||(s({type:"PAGE.NEXT",src:f}),A.preventDefault())},ArrowUp(A){m||(s({type:"PAGE.PREV",src:f}),A.preventDefault())},ArrowRight(A){m&&(s({type:"PAGE.NEXT",src:f}),A.preventDefault())},ArrowLeft(A){m&&(s({type:"PAGE.PREV",src:f}),A.preventDefault())},Home(A){s({type:"PAGE.SET",index:0,src:f}),A.preventDefault()},End(A){s({type:"PAGE.SET",index:p.length-1,src:f}),A.preventDefault()}},P=ge(b,{dir:o("dir"),orientation:o("orientation")}),V=S[P];V==null||V(b)}}))},getIndicatorProps(b){return t.button(y(g({},kt.indicator.attrs),{dir:o("dir"),id:Uu(a,b.index),type:"button","data-orientation":o("orientation"),"data-index":b.index,"data-readonly":E(b.readOnly),"data-current":E(b.index===v),"aria-label":w.indicator(b.index),onClick(f){f.defaultPrevented||b.readOnly||s({type:"PAGE.SET",index:b.index,src:"indicator"})}}))},getAutoplayTriggerProps(){return t.button(y(g({},kt.autoplayTrigger.attrs),{type:"button","data-orientation":o("orientation"),"data-pressed":E(l),"aria-label":l?w.autoplayStop:w.autoplayStart,onClick(b){b.defaultPrevented||s({type:l?"AUTOPLAY.PAUSE":"AUTOPLAY.START"})}}))},getProgressTextProps(){return t.element(g({},kt.progressText.attrs))}}}function Hy(e,t,n){if(e==null||n<=0)return[];let i=[],r=t==="auto"?Math.floor(n):t;if(r<=0)return[];for(let s=0;se);s+=r)i.push(s);return i}var Po,Eo,Io,Ay,kt,ky,Ny,Os,Ry,Dy,Ly,Uu,qe,$u,My,Hu,$y,By,O0,_y,w0,Gy,V0,Uy,qy,Wu=re(()=>{"use strict";se();Po=e=>at(e).direction;Eo=e=>[...new Set(e)],Io=(e,t)=>n=>Math.max(e,Math.min(t,n)),Ay=U("carousel").parts("root","itemGroup","item","control","nextTrigger","prevTrigger","indicatorGroup","indicator","autoplayTrigger","progressText"),kt=Ay.build(),ky=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`carousel:${e.id}`},Ny=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`carousel:${e.id}:item:${t}`},Os=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.itemGroup)!=null?n:`carousel:${e.id}:item-group`},Ry=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.nextTrigger)!=null?n:`carousel:${e.id}:next-trigger`},Dy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.prevTrigger)!=null?n:`carousel:${e.id}:prev-trigger`},Ly=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicatorGroup)!=null?n:`carousel:${e.id}:indicator-group`},Uu=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.indicator)==null?void 0:i.call(n,t))!=null?r:`carousel:${e.id}:indicator:${t}`},qe=e=>e.getById(Os(e)),$u=e=>Fe(qe(e),"[data-part=item]"),My=(e,t)=>e.getById(Uu(e,t)),Hu=e=>{let t=qe(e);if(!t)return;let n=jt(t);t.setAttribute("tabindex",n.length>0?"-1":"0")};$y={props({props:e}){return yn(e,["slideCount"],"carousel"),y(g({dir:"ltr",defaultPage:0,orientation:"horizontal",snapType:"mandatory",loop:!!e.autoplay,slidesPerPage:1,slidesPerMove:"auto",spacing:"0px",autoplay:!1,allowMouseDrag:!1,inViewThreshold:.6,autoSize:!1},e),{translations:g({nextTrigger:"Next slide",prevTrigger:"Previous slide",indicator:t=>`Go to slide ${t+1}`,item:(t,n)=>`${t+1} of ${n}`,autoplayStart:"Start slide rotation",autoplayStop:"Stop slide rotation",progressText:({page:t,totalPages:n})=>`${t} / ${n}`},e.translations)})},refs(){return{timeoutRef:void 0}},initialState({prop:e}){return e("autoplay")?"autoplay":"idle"},context({prop:e,bindable:t,getContext:n}){return{page:t(()=>({defaultValue:e("defaultPage"),value:e("page"),onChange(i){var a;let s=n().get("pageSnapPoints");(a=e("onPageChange"))==null||a({page:i,pageSnapPoint:s[i]})}})),pageSnapPoints:t(()=>({defaultValue:e("autoSize")?Array.from({length:e("slideCount")},(i,r)=>r):Hy(e("slideCount"),e("slidesPerMove"),e("slidesPerPage"))})),slidesInView:t(()=>({defaultValue:[]}))}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",isHorizontal:({prop:e})=>e("orientation")==="horizontal",canScrollNext:({prop:e,context:t})=>e("loop")||t.get("page")e("loop")||t.get("page")>0,autoplayInterval:({prop:e})=>{let t=e("autoplay");return xt(t)?t.delay:4e3}},watch({track:e,action:t,context:n,prop:i,send:r}){e([()=>i("slidesPerPage"),()=>i("slidesPerMove")],()=>{t(["setSnapPoints"])}),e([()=>n.get("page")],()=>{t(["scrollToPage","focusIndicatorEl"])}),e([()=>i("orientation"),()=>i("autoSize"),()=>i("dir")],()=>{t(["setSnapPoints","scrollToPage"])}),e([()=>i("slideCount")],()=>{r({type:"SNAP.REFRESH",src:"slide.count"})}),e([()=>!!i("autoplay")],()=>{r({type:i("autoplay")?"AUTOPLAY.START":"AUTOPLAY.PAUSE",src:"autoplay.prop.change"})})},on:{"PAGE.NEXT":{target:"idle",actions:["clearScrollEndTimer","setNextPage"]},"PAGE.PREV":{target:"idle",actions:["clearScrollEndTimer","setPrevPage"]},"PAGE.SET":{target:"idle",actions:["clearScrollEndTimer","setPage"]},"INDEX.SET":{target:"idle",actions:["clearScrollEndTimer","setMatchingPage"]},"SNAP.REFRESH":{actions:["setSnapPoints","clampPage"]},"PAGE.SCROLL":{actions:["scrollToPage"]}},effects:["trackSlideMutation","trackSlideIntersections","trackSlideResize"],entry:["setSnapPoints","setPage"],exit:["clearScrollEndTimer"],states:{idle:{on:{"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"AUTOPLAY.START":{target:"autoplay",actions:["invokeAutoplayStart"]},"USER.SCROLL":{target:"userScroll"},"VIEWPORT.FOCUS":{target:"focus"}}},focus:{effects:["trackKeyboardScroll"],on:{"VIEWPORT.BLUR":{target:"idle"},"PAGE.NEXT":{actions:["clearScrollEndTimer","setNextPage"]},"PAGE.PREV":{actions:["clearScrollEndTimer","setPrevPage"]},"PAGE.SET":{actions:["clearScrollEndTimer","setPage"]},"INDEX.SET":{actions:["clearScrollEndTimer","setMatchingPage"]},"USER.SCROLL":{target:"userScroll"}}},dragging:{effects:["trackPointerMove"],entry:["disableScrollSnap"],on:{DRAGGING:{actions:["scrollSlides","invokeDragging"]},"DRAGGING.END":{target:"idle",actions:["endDragging","invokeDraggingEnd"]}}},userScroll:{effects:["trackScroll"],on:{"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"SCROLL.END":[{guard:"isFocused",target:"focus",actions:["setClosestPage"]},{target:"idle",actions:["setClosestPage"]}]}},autoplay:{effects:["trackDocumentVisibility","trackScroll","autoUpdateSlide"],exit:["invokeAutoplayEnd"],on:{"AUTOPLAY.TICK":{actions:["setNextPage","invokeAutoplay"]},"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"AUTOPLAY.PAUSE":{target:"idle"}}}},implementations:{guards:{isFocused:({scope:e})=>e.isActiveElement(qe(e))},effects:{autoUpdateSlide({computed:e,send:t}){let n=setInterval(()=>{t({type:e("canScrollNext")?"AUTOPLAY.TICK":"AUTOPLAY.PAUSE",src:"autoplay.interval"})},e("autoplayInterval"));return()=>clearInterval(n)},trackSlideMutation({scope:e,send:t}){let n=qe(e);if(!n)return;let i=e.getWin(),r=new i.MutationObserver(()=>{t({type:"SNAP.REFRESH",src:"slide.mutation"}),Hu(e)});return Hu(e),r.observe(n,{childList:!0,subtree:!0}),()=>r.disconnect()},trackSlideResize({scope:e,send:t}){if(!qe(e))return;let i=()=>{t({type:"SNAP.REFRESH",src:"slide.resize"})};H(()=>{i(),H(()=>{t({type:"PAGE.SCROLL",instant:!0})})});let r=$u(e);r.forEach(i);let s=r.map(a=>gn.observe(a,i));return At(...s)},trackSlideIntersections({scope:e,prop:t,context:n}){let i=qe(e),r=e.getWin(),s=new r.IntersectionObserver(a=>{let o=a.reduce((l,c)=>{var m;let u=c.target,h=Number((m=u.dataset.index)!=null?m:"-1");return h==null||Number.isNaN(h)||h===-1?l:c.isIntersecting?Ze(l,h):ct(l,h)},n.get("slidesInView"));n.set("slidesInView",vt(o))},{root:i,threshold:t("inViewThreshold")});return $u(e).forEach(a=>s.observe(a)),()=>s.disconnect()},trackScroll({send:e,refs:t,scope:n}){let i=qe(n);return i?ee(i,"scroll",()=>{clearTimeout(t.get("timeoutRef")),t.set("timeoutRef",void 0),t.set("timeoutRef",setTimeout(()=>{e({type:"SCROLL.END"})},150))},{passive:!0}):void 0},trackDocumentVisibility({scope:e,send:t}){let n=e.getDoc();return ee(n,"visibilitychange",()=>{n.visibilityState!=="visible"&&t({type:"AUTOPLAY.PAUSE",src:"doc.hidden"})})},trackPointerMove({scope:e,send:t}){let n=e.getDoc();return hn(n,{onPointerMove({event:i}){t({type:"DRAGGING",left:-i.movementX,top:-i.movementY})},onPointerUp(){t({type:"DRAGGING.END"})}})},trackKeyboardScroll({scope:e,send:t,context:n}){let i=e.getWin();return ee(i,"keydown",s=>{switch(s.key){case"ArrowRight":s.preventDefault(),t({type:"PAGE.NEXT"});break;case"ArrowLeft":s.preventDefault(),t({type:"PAGE.PREV"});break;case"Home":s.preventDefault(),t({type:"PAGE.SET",index:0});break;case"End":s.preventDefault(),t({type:"PAGE.SET",index:n.get("pageSnapPoints").length-1})}},{capture:!0})}},actions:{clearScrollEndTimer({refs:e}){e.get("timeoutRef")!=null&&(clearTimeout(e.get("timeoutRef")),e.set("timeoutRef",void 0))},scrollToPage({context:e,event:t,scope:n,computed:i,flush:r}){var c;let s=t.instant?"instant":"smooth",a=He((c=t.index)!=null?c:e.get("page"),0,e.get("pageSnapPoints").length-1),o=qe(n);if(!o)return;let l=i("isHorizontal")?"left":"top";r(()=>{o.scrollTo({[l]:e.get("pageSnapPoints")[a],behavior:s})})},setClosestPage({context:e,scope:t,computed:n}){let i=qe(t);if(!i)return;let r=n("isHorizontal")?i.scrollLeft:i.scrollTop,s=e.get("pageSnapPoints").findIndex(a=>Math.abs(a-r)<1);s!==-1&&e.set("page",s)},setNextPage({context:e,prop:t,state:n}){let i=n.matches("autoplay")||t("loop"),r=Ei(e.get("pageSnapPoints"),e.get("page"),{loop:i});e.set("page",r)},setPrevPage({context:e,prop:t,state:n}){let i=n.matches("autoplay")||t("loop"),r=lr(e.get("pageSnapPoints"),e.get("page"),{loop:i});e.set("page",r)},setMatchingPage({context:e,event:t,computed:n,scope:i}){let r=qe(i);if(!r)return;let s=xy(r,n("isHorizontal")?"x":"y",o=>o.dataset.index===t.index.toString());if(s==null)return;let a=e.get("pageSnapPoints").findIndex(o=>Math.abs(o-s)<1);e.set("page",a)},setPage({context:e,event:t}){var i;let n=(i=t.index)!=null?i:e.get("page");e.set("page",n)},clampPage({context:e}){let t=He(e.get("page"),0,e.get("pageSnapPoints").length-1);e.set("page",t)},setSnapPoints({context:e,computed:t,scope:n}){let i=qe(n);if(!i)return;let r=Vy(i);e.set("pageSnapPoints",t("isHorizontal")?r.x:r.y)},disableScrollSnap({scope:e}){let t=qe(e);if(!t)return;let n=getComputedStyle(t);t.dataset.scrollSnapType=n.getPropertyValue("scroll-snap-type"),t.style.setProperty("scroll-snap-type","none")},scrollSlides({scope:e,event:t}){let n=qe(e);n==null||n.scrollBy({left:t.left,top:t.top,behavior:"instant"})},endDragging({scope:e,context:t,computed:n}){let i=qe(e);if(!i)return;let r=n("isHorizontal"),s=r?i.scrollLeft:i.scrollTop,a=t.get("pageSnapPoints"),o=a.reduce((l,c)=>Math.abs(c-s){i.scrollTo({left:r?o:i.scrollLeft,top:r?i.scrollTop:o,behavior:"smooth"}),t.set("page",a.indexOf(o));let l=i.dataset.scrollSnapType;l&&(i.style.setProperty("scroll-snap-type",l),delete i.dataset.scrollSnapType)})},focusIndicatorEl({context:e,event:t,scope:n}){if(t.src!=="indicator")return;let i=My(n,e.get("page"));i&&H(()=>i.focus({preventScroll:!0}))},invokeDragStart({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging.start",isDragging:!0,page:e.get("page")})},invokeDragging({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging",isDragging:!0,page:e.get("page")})},invokeDraggingEnd({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging.end",isDragging:!1,page:e.get("page")})},invokeAutoplay({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay",isPlaying:!0,page:e.get("page")})},invokeAutoplayStart({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay.start",isPlaying:!0,page:e.get("page")})},invokeAutoplayEnd({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay.stop",isPlaying:!1,page:e.get("page")})}}}};By=_()(["dir","getRootNode","id","ids","loop","page","defaultPage","onPageChange","orientation","slideCount","slidesPerPage","slidesPerMove","spacing","padding","autoplay","allowMouseDrag","inViewThreshold","translations","snapType","autoSize","onDragStatusChange","onAutoplayStatusChange"]),O0=B(By),_y=_()(["index","readOnly"]),w0=B(_y),Gy=_()(["index","snapAlign"]),V0=B(Gy),Uy=class extends K{initMachine(e){return new W($y,e)}initApi(){return Fy(this.machine.service,q)}render(){var u;let e=(u=this.el.querySelector('[data-scope="carousel"][data-part="root"]'))!=null?u:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="carousel"][data-part="control"]');t&&this.spreadProps(t,this.api.getControlProps());let n=this.el.querySelector('[data-scope="carousel"][data-part="item-group"]');n&&this.spreadProps(n,this.api.getItemGroupProps());let i=Number(this.el.dataset.slideCount)||0;for(let h=0;h{let h=O(e,"onPageChange");h&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(h,{page:u.page,pageSnapPoint:u.pageSnapPoint,id:e.id});let m=O(e,"onPageChangeClient");m&&e.dispatchEvent(new CustomEvent(m,{bubbles:!0,detail:{value:u,id:e.id}}))}}));s.init(),this.carousel=s,this.handlers=[]},updated(){var i,r;let e=Y(this.el,"slideCount");if(e==null||e<1)return;let t=Y(this.el,"page"),n=C(this.el,"controlled");(r=this.carousel)==null||r.updateProps(y(g({id:this.el.id,slideCount:e},n&&t!==void 0?{page:t}:{}),{dir:Oe(this.el),orientation:O(this.el,"orientation",["horizontal","vertical"]),slidesPerPage:(i=Y(this.el,"slidesPerPage"))!=null?i:1,loop:C(this.el,"loop"),allowMouseDrag:C(this.el,"allowMouseDrag")}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.carousel)==null||e.destroy()}}});function Wy(e){return!(e.metaKey||!di()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function zy(e,t,n){let i=n?j(n):null,r=ue(i);return e=e||i instanceof r.HTMLInputElement&&!Ky.has(i==null?void 0:i.type)||i instanceof r.HTMLTextAreaElement||i instanceof r.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof r.KeyboardEvent&&!Reflect.has(Yy,n.key))}function xs(e,t){for(let n of Co)n(e,t)}function Vs(e){Un=!0,Wy(e)&&(In="keyboard",xs("keyboard",e))}function dt(e){In="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Un=!0,xs("pointer",e))}function Ku(e){Vc(e)&&(Un=!0,In="virtual")}function zu(e){let t=j(e);t===ue(t)||t===Le(t)||(!Un&&!So&&(In="virtual",xs("virtual",e)),Un=!1,So=!1)}function Yu(){Un=!1,So=!0}function jy(e){if(typeof window=="undefined"||ws.get(ue(e)))return;let t=ue(e),n=Le(e),i=t.HTMLElement.prototype.focus;function r(){In="virtual",xs("virtual",null),Un=!0,i.apply(this,arguments)}try{Object.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,value:r})}catch(s){}n.addEventListener("keydown",Vs,!0),n.addEventListener("keyup",Vs,!0),n.addEventListener("click",Ku,!0),t.addEventListener("focus",zu,!0),t.addEventListener("blur",Yu,!1),typeof t.PointerEvent!="undefined"?(n.addEventListener("pointerdown",dt,!0),n.addEventListener("pointermove",dt,!0),n.addEventListener("pointerup",dt,!0)):(n.addEventListener("mousedown",dt,!0),n.addEventListener("mousemove",dt,!0),n.addEventListener("mouseup",dt,!0)),t.addEventListener("beforeunload",()=>{Xy(e)},{once:!0}),ws.set(t,{focus:i})}function ju(){return In}function En(){return In==="keyboard"}function Pn(e={}){let{isTextInput:t,autoFocus:n,onChange:i,root:r}=e;jy(r),i==null||i({isFocusVisible:n||En(),modality:In});let s=(a,o)=>{zy(!!t,a,o)&&(i==null||i({isFocusVisible:En(),modality:a}))};return Co.add(s),()=>{Co.delete(s)}}var Ky,In,Co,ws,Un,So,Yy,Xy,pr=re(()=>{"use strict";se();Ky=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);In=null,Co=new Set,ws=new Map,Un=!1,So=!1,Yy={Tab:!0,Escape:!0};Xy=(e,t)=>{let n=ue(e),i=Le(e),r=ws.get(n);if(r){try{Object.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,value:r.focus})}catch(s){}i.removeEventListener("keydown",Vs,!0),i.removeEventListener("keyup",Vs,!0),i.removeEventListener("click",Ku,!0),n.removeEventListener("focus",zu,!0),n.removeEventListener("blur",Yu,!1),typeof n.PointerEvent!="undefined"?(i.removeEventListener("pointerdown",dt,!0),i.removeEventListener("pointermove",dt,!0),i.removeEventListener("pointerup",dt,!0)):(i.removeEventListener("mousedown",dt,!0),i.removeEventListener("mousemove",dt,!0),i.removeEventListener("mouseup",dt,!0)),ws.delete(n)}}});var Qu={};he(Qu,{Checkbox:()=>sb});function eb(e,t){let{send:n,context:i,prop:r,computed:s,scope:a}=e,o=!!r("disabled"),l=!!r("readOnly"),c=!!r("required"),u=!!r("invalid"),h=!o&&i.get("focused"),m=!o&&i.get("focusVisible"),d=s("checked"),p=s("indeterminate"),v=i.get("checked"),I={"data-active":E(i.get("active")),"data-focus":E(h),"data-focus-visible":E(m),"data-readonly":E(l),"data-hover":E(i.get("hovered")),"data-disabled":E(o),"data-state":p?"indeterminate":d?"checked":"unchecked","data-invalid":E(u),"data-required":E(c)};return{checked:d,disabled:o,indeterminate:p,focused:h,checkedState:v,setChecked(T){n({type:"CHECKED.SET",checked:T,isTrusted:!1})},toggleChecked(){n({type:"CHECKED.TOGGLE",checked:d,isTrusted:!1})},getRootProps(){return t.label(y(g(g({},As.root.attrs),I),{dir:r("dir"),id:Ju(a),htmlFor:To(a),onPointerMove(){o||n({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){o||n({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(T){j(T)===fr(a)&&T.stopPropagation()}}))},getLabelProps(){return t.element(y(g(g({},As.label.attrs),I),{dir:r("dir"),id:Xu(a)}))},getControlProps(){return t.element(y(g(g({},As.control.attrs),I),{dir:r("dir"),id:Jy(a),"aria-hidden":!0}))},getIndicatorProps(){return t.element(y(g(g({},As.indicator.attrs),I),{dir:r("dir"),hidden:!p&&!d}))},getHiddenInputProps(){return t.input({id:To(a),type:"checkbox",required:r("required"),defaultChecked:d,disabled:o,"aria-labelledby":Xu(a),"aria-invalid":u,name:r("name"),form:r("form"),value:r("value"),style:Vt,onFocus(){let T=En();n({type:"CONTEXT.SET",context:{focused:!0,focusVisible:T}})},onBlur(){n({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(T){if(l){T.preventDefault();return}let w=T.currentTarget.checked;n({type:"CHECKED.SET",checked:w,isTrusted:!0})}})}}}function ks(e){return e==="indeterminate"}function nb(e){return ks(e)?!1:!!e}var Zy,As,Ju,Xu,Jy,To,Qy,fr,Zu,tb,ib,L0,rb,sb,ed=re(()=>{"use strict";pr();se();Zy=U("checkbox").parts("root","label","control","indicator"),As=Zy.build(),Ju=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`checkbox:${e.id}`},Xu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`checkbox:${e.id}:label`},Jy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`checkbox:${e.id}:control`},To=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`checkbox:${e.id}:input`},Qy=e=>e.getById(Ju(e)),fr=e=>e.getById(To(e));({not:Zu}=Ee()),tb={props({props:e}){var t;return y(g({value:"on"},e),{defaultChecked:(t=e.defaultChecked)!=null?t:!1})},initialState(){return"ready"},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e("defaultChecked"),value:e("checked"),onChange(n){var i;(i=e("onCheckedChange"))==null||i({checked:n})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},watch({track:e,context:t,prop:n,action:i}){e([()=>n("disabled")],()=>{i(["removeFocusIfNeeded"])}),e([()=>t.get("checked")],()=>{i(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Zu("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Zu("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{indeterminate:({context:e})=>ks(e.get("checked")),checked:({context:e})=>nb(e.get("checked")),disabled:({context:e,prop:t})=>!!t("disabled")||e.get("fieldsetDisabled")},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({context:e,computed:t,scope:n}){if(!t("disabled"))return ps({pointerNode:Qy(n),keyboardNode:fr(n),isValidKey:i=>i.key===" ",onPress:()=>e.set("active",!1),onPressStart:()=>e.set("active",!0),onPressEnd:()=>e.set("active",!1)})},trackFocusVisible({computed:e,scope:t}){var n;if(!e("disabled"))return Pn({root:(n=t.getRootNode)==null?void 0:n.call(t)})},trackFormControlState({context:e,scope:t}){return wt(fr(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){e.set("checked",e.initial("checked"))}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,computed:t,scope:n}){let i=fr(n);i&&(sr(i,t("checked")),i.indeterminate=ks(e.get("checked")))},removeFocusIfNeeded({context:e,prop:t}){t("disabled")&&e.get("focused")&&(e.set("focused",!1),e.set("focusVisible",!1))},setChecked({context:e,event:t}){e.set("checked",t.checked)},toggleChecked({context:e,computed:t}){let n=ks(t("checked"))?!0:!t("checked");e.set("checked",n)},dispatchChangeEvent({computed:e,scope:t}){queueMicrotask(()=>{let n=fr(t);pi(n,{checked:e("checked")})})}}}};ib=_()(["defaultChecked","checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]),L0=B(ib),rb=class extends K{initMachine(e){return new W(tb,e)}initApi(){return eb(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="checkbox"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector(':scope > [data-scope="checkbox"][data-part="hidden-input"]');t&&this.spreadProps(t,this.api.getHiddenInputProps());let n=e.querySelector(':scope > [data-scope="checkbox"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=e.querySelector(':scope > [data-scope="checkbox"][data-part="control"]');if(i){this.spreadProps(i,this.api.getControlProps());let r=i.querySelector(':scope > [data-scope="checkbox"][data-part="indicator"]');r&&this.spreadProps(r,this.api.getIndicatorProps())}}},sb={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=new rb(e,y(g({id:e.id},C(e,"controlled")?{checked:C(e,"checked")}:{defaultChecked:C(e,"defaultChecked")}),{disabled:C(e,"disabled"),name:O(e,"name"),form:O(e,"form"),value:O(e,"value"),dir:Oe(e),invalid:C(e,"invalid"),required:C(e,"required"),readOnly:C(e,"readOnly"),onCheckedChange:i=>{let r=O(e,"onCheckedChange");r&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(r,{checked:i.checked,id:e.id});let s=O(e,"onCheckedChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{value:i,id:e.id}}))}}));n.init(),this.checkbox=n,this.onSetChecked=i=>{let{checked:r}=i.detail;n.api.setChecked(r)},e.addEventListener("phx:checkbox:set-checked",this.onSetChecked),this.onToggleChecked=()=>{n.api.toggleChecked()},e.addEventListener("phx:checkbox:toggle-checked",this.onToggleChecked),this.handlers=[],this.handlers.push(this.handleEvent("checkbox_set_checked",i=>{let r=i.id;r&&r!==e.id||n.api.setChecked(i.checked)})),this.handlers.push(this.handleEvent("checkbox_toggle_checked",i=>{let r=i.id;r&&r!==e.id||n.api.toggleChecked()})),this.handlers.push(this.handleEvent("checkbox_checked",()=>{this.pushEvent("checkbox_checked_response",{value:n.api.checked})})),this.handlers.push(this.handleEvent("checkbox_focused",()=>{this.pushEvent("checkbox_focused_response",{value:n.api.focused})})),this.handlers.push(this.handleEvent("checkbox_disabled",()=>{this.pushEvent("checkbox_disabled_response",{value:n.api.disabled})}))},updated(){var e;(e=this.checkbox)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{checked:C(this.el,"checked")}:{defaultChecked:C(this.el,"defaultChecked")}),{disabled:C(this.el,"disabled"),name:O(this.el,"name"),form:O(this.el,"form"),value:O(this.el,"value"),dir:Oe(this.el),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly"),label:O(this.el,"label")}))},destroyed(){var e;if(this.onSetChecked&&this.el.removeEventListener("phx:checkbox:set-checked",this.onSetChecked),this.onToggleChecked&&this.el.removeEventListener("phx:checkbox:toggle-checked",this.onToggleChecked),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.checkbox)==null||e.destroy()}}});var td={};he(td,{Clipboard:()=>bb});function db(e,t){let n=e.createElement("pre");return Object.assign(n.style,{width:"1px",height:"1px",position:"fixed",top:"5px"}),n.textContent=t,n}function hb(e){let n=ue(e).getSelection();if(n==null)return Promise.reject(new Error);n.removeAllRanges();let i=e.ownerDocument,r=i.createRange();return r.selectNodeContents(e),n.addRange(r),i.execCommand("copy"),n.removeAllRanges(),Promise.resolve()}function gb(e,t){var r;let n=e.defaultView||window;if(((r=n.navigator.clipboard)==null?void 0:r.writeText)!==void 0)return n.navigator.clipboard.writeText(t);if(!e.body)return Promise.reject(new Error);let i=db(e,t);return e.body.appendChild(i),hb(i),e.body.removeChild(i),Promise.resolve()}function pb(e,t){let{state:n,send:i,context:r,scope:s}=e,a=n.matches("copied");return{copied:a,value:r.get("value"),setValue(o){i({type:"VALUE.SET",value:o})},copy(){i({type:"COPY"})},getRootProps(){return t.element(y(g({},Oi.root.attrs),{"data-copied":E(a),id:ob(s)}))},getLabelProps(){return t.label(y(g({},Oi.label.attrs),{htmlFor:Oo(s),"data-copied":E(a),id:lb(s)}))},getControlProps(){return t.element(y(g({},Oi.control.attrs),{"data-copied":E(a)}))},getInputProps(){return t.input(y(g({},Oi.input.attrs),{defaultValue:r.get("value"),"data-copied":E(a),readOnly:!0,"data-readonly":"true",id:Oo(s),onFocus(o){o.currentTarget.select()},onCopy(){i({type:"INPUT.COPY"})}}))},getTriggerProps(){return t.button(y(g({},Oi.trigger.attrs),{type:"button","aria-label":a?"Copied to clipboard":"Copy to clipboard","data-copied":E(a),onClick(){i({type:"COPY"})}}))},getIndicatorProps(o){return t.element(y(g({},Oi.indicator.attrs),{hidden:o.copied!==a}))}}}var ab,Oi,ob,Oo,lb,cb,ub,fb,mb,H0,vb,B0,yb,bb,nd=re(()=>{"use strict";se();ab=U("clipboard").parts("root","control","trigger","indicator","input","label"),Oi=ab.build(),ob=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`clip:${e.id}`},Oo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`clip:${e.id}:input`},lb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`clip:${e.id}:label`},cb=e=>e.getById(Oo(e)),ub=(e,t)=>gb(e.getDoc(),t);fb={props({props:e}){return g({timeout:3e3,defaultValue:""},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}}))}},watch({track:e,context:t,action:n}){e([()=>t.get("value")],()=>{n(["syncInputElement"])})},on:{"VALUE.SET":{actions:["setValue"]},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]}},states:{idle:{on:{"INPUT.COPY":{target:"copied",actions:["invokeOnCopy"]}}},copied:{effects:["waitForTimeout"],on:{"COPY.DONE":{target:"idle"},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]},"INPUT.COPY":{actions:["invokeOnCopy"]}}}},implementations:{effects:{waitForTimeout({prop:e,send:t}){return mn(()=>{t({type:"COPY.DONE"})},e("timeout"))}},actions:{setValue({context:e,event:t}){e.set("value",t.value)},copyToClipboard({context:e,scope:t}){ub(t,e.get("value"))},invokeOnCopy({prop:e}){var t;(t=e("onStatusChange"))==null||t({copied:!0})},syncInputElement({context:e,scope:t}){let n=cb(t);n&&Me(n,e.get("value"))}}}},mb=_()(["getRootNode","id","ids","value","defaultValue","timeout","onStatusChange","onValueChange"]),H0=B(mb),vb=_()(["copied"]),B0=B(vb),yb=class extends K{initMachine(e){return new W(fb,e)}initApi(){return pb(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="clipboard"][data-part="root"]');if(e){this.spreadProps(e,this.api.getRootProps());let t=e.querySelector('[data-scope="clipboard"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=e.querySelector('[data-scope="clipboard"][data-part="control"]');if(n){this.spreadProps(n,this.api.getControlProps());let i=n.querySelector('[data-scope="clipboard"][data-part="input"]');if(i){let s=g({},this.api.getInputProps()),a=this.el.dataset.inputAriaLabel;a&&(s["aria-label"]=a),this.spreadProps(i,s)}let r=n.querySelector('[data-scope="clipboard"][data-part="trigger"]');if(r){let s=g({},this.api.getTriggerProps()),a=this.el.dataset.triggerAriaLabel;a&&(s["aria-label"]=a),this.spreadProps(r,s)}}}}},bb={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=this.liveSocket,i=new yb(e,y(g({id:e.id,timeout:Y(e,"timeout")},C(e,"controlled")?{value:O(e,"value")}:{defaultValue:O(e,"defaultValue")}),{onValueChange:r=>{var a;let s=O(e,"onValueChange");s&&n.main.isConnected()&&t(s,{id:e.id,value:(a=r.value)!=null?a:null})},onStatusChange:r=>{let s=O(e,"onStatusChange");s&&n.main.isConnected()&&t(s,{id:e.id,copied:r.copied});let a=O(e,"onStatusChangeClient");a&&e.dispatchEvent(new CustomEvent(a,{bubbles:!0}))}}));i.init(),this.clipboard=i,this.onCopy=()=>{i.api.copy()},e.addEventListener("phx:clipboard:copy",this.onCopy),this.onSetValue=r=>{let{value:s}=r.detail;i.api.setValue(s)},e.addEventListener("phx:clipboard:set-value",this.onSetValue),this.handlers=[],this.handlers.push(this.handleEvent("clipboard_copy",r=>{let s=r.clipboard_id;s&&s!==e.id||i.api.copy()})),this.handlers.push(this.handleEvent("clipboard_set_value",r=>{let s=r.clipboard_id;s&&s!==e.id||i.api.setValue(r.value)})),this.handlers.push(this.handleEvent("clipboard_copied",()=>{this.pushEvent("clipboard_copied_response",{value:i.api.copied})}))},updated(){var e;(e=this.clipboard)==null||e.updateProps(y(g({id:this.el.id,timeout:Y(this.el,"timeout")},C(this.el,"controlled")?{value:O(this.el,"value")}:{defaultValue:O(this.el,"value")}),{dir:O(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onCopy&&this.el.removeEventListener("phx:clipboard:copy",this.onCopy),this.onSetValue&&this.el.removeEventListener("phx:clipboard:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.clipboard)==null||e.destroy()}}});var id={};he(id,{Collapsible:()=>wb});function Cb(e,t){let{state:n,send:i,context:r,scope:s,prop:a}=e,o=n.matches("open")||n.matches("closing"),l=n.matches("open"),c=n.matches("closed"),{width:u,height:h}=r.get("size"),m=!!a("disabled"),d=a("collapsedHeight"),p=a("collapsedWidth"),v=d!=null,I=p!=null,T=v||I,w=!r.get("initial")&&l;return{disabled:m,visible:o,open:l,measureSize(){i({type:"size.measure"})},setOpen(b){n.matches("open")!==b&&i({type:b?"open":"close"})},getRootProps(){return t.element(y(g({},Ns.root.attrs),{"data-state":l?"open":"closed",dir:a("dir"),id:Ib(s)}))},getContentProps(){return t.element(y(g({},Ns.content.attrs),{id:wo(s),"data-collapsible":"","data-state":w?void 0:l?"open":"closed","data-disabled":E(m),"data-has-collapsed-size":E(T),hidden:!o&&!T,dir:a("dir"),style:g(g({"--height":ye(h),"--width":ye(u),"--collapsed-height":ye(d),"--collapsed-width":ye(p)},c&&v&&{overflow:"hidden",minHeight:ye(d),maxHeight:ye(d)}),c&&I&&{overflow:"hidden",minWidth:ye(p),maxWidth:ye(p)})}))},getTriggerProps(){return t.element(y(g({},Ns.trigger.attrs),{id:Pb(s),dir:a("dir"),type:"button","data-state":l?"open":"closed","data-disabled":E(m),"aria-controls":wo(s),"aria-expanded":o||!1,onClick(b){b.defaultPrevented||m||i({type:l?"close":"open"})}}))},getIndicatorProps(){return t.element(y(g({},Ns.indicator.attrs),{dir:a("dir"),"data-state":l?"open":"closed","data-disabled":E(m)}))}}}var Eb,Ns,Ib,wo,Pb,mr,Sb,Tb,q0,Ob,wb,rd=re(()=>{"use strict";se();Eb=U("collapsible").parts("root","trigger","content","indicator"),Ns=Eb.build(),Ib=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`collapsible:${e.id}`},wo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`collapsible:${e.id}:content`},Pb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`collapsible:${e.id}:trigger`},mr=e=>e.getById(wo(e));Sb={initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({bindable:e}){return{size:e(()=>({defaultValue:{height:0,width:0},sync:!0})),initial:e(()=>({defaultValue:!1}))}},refs(){return{cleanup:void 0,stylesRef:void 0}},watch({track:e,prop:t,action:n}){e([()=>t("open")],()=>{n(["setInitial","computeSize","toggleVisibility"])})},exit:["cleanupNode"],states:{closed:{effects:["trackTabbableElements"],on:{"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitial","computeSize","invokeOnOpen"]}]}},closing:{effects:["trackExitAnimation"],on:{"controlled.close":{target:"closed"},"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitial","invokeOnOpen"]}],close:[{guard:"isOpenControlled",actions:["invokeOnExitComplete"]},{target:"closed",actions:["setInitial","computeSize","invokeOnExitComplete"]}],"animation.end":{target:"closed",actions:["invokeOnExitComplete","clearInitial"]}}},open:{effects:["trackEnterAnimation"],on:{"controlled.close":{target:"closing"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closing",actions:["setInitial","computeSize","invokeOnClose"]}],"size.measure":{actions:["measureSize"]},"animation.end":{actions:["clearInitial"]}}}},implementations:{guards:{isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackEnterAnimation:({send:e,scope:t})=>{let n,i=H(()=>{let r=mr(t);if(!r)return;let s=at(r).animationName;if(!s||s==="none"){e({type:"animation.end"});return}let o=l=>{j(l)===r&&e({type:"animation.end"})};r.addEventListener("animationend",o),n=()=>{r.removeEventListener("animationend",o)}});return()=>{i(),n==null||n()}},trackExitAnimation:({send:e,scope:t})=>{let n,i=H(()=>{let r=mr(t);if(!r)return;let s=at(r).animationName;if(!s||s==="none"){e({type:"animation.end"});return}let o=c=>{j(c)===r&&e({type:"animation.end"})};r.addEventListener("animationend",o);let l=Hn(r,{animationFillMode:"forwards"});n=()=>{r.removeEventListener("animationend",o),$n(()=>l())}});return()=>{i(),n==null||n()}},trackTabbableElements:({scope:e,prop:t})=>{if(!t("collapsedHeight")&&!t("collapsedWidth"))return;let n=mr(e);if(!n)return;let i=()=>{let o=jt(n).map(l=>Fc(l,"inert",""));return()=>{o.forEach(l=>l())}},r=i(),s=hs(n,{callback(){r(),r=i()}});return()=>{r(),s()}}},actions:{setInitial:({context:e,flush:t})=>{t(()=>{e.set("initial",!0)})},clearInitial:({context:e})=>{e.set("initial",!1)},cleanupNode:({refs:e})=>{e.set("stylesRef",null)},measureSize:({context:e,scope:t})=>{let n=mr(t);if(!n)return;let{height:i,width:r}=n.getBoundingClientRect();e.set("size",{height:i,width:r})},computeSize:({refs:e,scope:t,context:n})=>{var r;(r=e.get("cleanup"))==null||r();let i=H(()=>{let s=mr(t);if(!s)return;let a=s.hidden;s.style.animationName="none",s.style.animationDuration="0s",s.hidden=!1;let o=s.getBoundingClientRect();n.set("size",{height:o.height,width:o.width}),n.get("initial")&&(s.style.animationName="",s.style.animationDuration=""),s.hidden=a});e.set("cleanup",i)},invokeOnOpen:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnExitComplete:({prop:e})=>{var t;(t=e("onExitComplete"))==null||t()},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"controlled.open":"controlled.close"})}}}},Tb=_()(["dir","disabled","getRootNode","id","ids","collapsedHeight","collapsedWidth","onExitComplete","onOpenChange","defaultOpen","open"]),q0=B(Tb),Ob=class extends K{initMachine(e){return new W(Sb,e)}initApi(){return Cb(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="collapsible"][data-part="root"]');if(e){this.spreadProps(e,this.api.getRootProps());let t=e.querySelector('[data-scope="collapsible"][data-part="trigger"]');t&&this.spreadProps(t,this.api.getTriggerProps());let n=e.querySelector('[data-scope="collapsible"][data-part="content"]');n&&this.spreadProps(n,this.api.getContentProps())}}},wb={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=new Ob(e,y(g({id:e.id},C(e,"controlled")?{open:C(e,"open")}:{defaultOpen:C(e,"defaultOpen")}),{disabled:C(e,"disabled"),dir:O(e,"dir",["ltr","rtl"]),onOpenChange:i=>{let r=O(e,"onOpenChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,open:i.open});let s=O(e,"onOpenChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,open:i.open}}))}}));n.init(),this.collapsible=n,this.onSetOpen=i=>{let{open:r}=i.detail;n.api.setOpen(r)},e.addEventListener("phx:collapsible:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("collapsible_set_open",i=>{let r=i.collapsible_id;r&&r!==e.id||n.api.setOpen(i.open)})),this.handlers.push(this.handleEvent("collapsible_open",()=>{this.pushEvent("collapsible_open_response",{value:n.api.open})}))},updated(){var e;(e=this.collapsible)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{open:C(this.el,"open")}:{defaultOpen:C(this.el,"defaultOpen")}),{disabled:C(this.el,"disabled"),dir:O(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onSetOpen&&this.el.removeEventListener("phx:collapsible:set-open",this.onSetOpen),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.collapsible)==null||e.destroy()}}});function vr(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function Rs(e,t,n){t=[...t].sort((r,s)=>r-s);let i=t.map(r=>e[r]);for(let r=t.length-1;r>=0;r--)e=[...e.slice(0,t[r]),...e.slice(t[r]+1)];return n=Math.max(0,n-t.filter(r=>rt[n])return 1}return e.length-t.length}function Nb(e){return e.sort(ud)}function Rb(e,t){let n;return Je(e,y(g({},t),{onEnter:(i,r)=>{if(t.predicate(i,r))return n=i,"stop"}})),n}function Db(e,t){let n=[];return Je(e,{onEnter:(i,r)=>{t.predicate(i,r)&&n.push(i)},getChildren:t.getChildren}),n}function sd(e,t){let n;return Je(e,{onEnter:(i,r)=>{if(t.predicate(i,r))return n=[...r],"stop"},getChildren:t.getChildren}),n}function Lb(e,t){let n=t.initialResult;return Je(e,y(g({},t),{onEnter:(i,r)=>{n=t.nextResult(n,i,r)}})),n}function Mb(e,t){return Lb(e,y(g({},t),{initialResult:[],nextResult:(n,i,r)=>(n.push(...t.transform(i,r)),n)}))}function Fb(e,t){let{predicate:n,create:i,getChildren:r}=t,s=(a,o)=>{let l=r(a,o),c=[];l.forEach((d,p)=>{let v=[...o,p],I=s(d,v);I&&c.push(I)});let u=o.length===0,h=n(a,o),m=c.length>0;return u||h||m?i(a,c,o):null};return s(e,[])||i(e,[],[])}function $b(e,t){let n=[],i=0,r=new Map,s=new Map;return Je(e,{getChildren:t.getChildren,onEnter:(a,o)=>{r.has(a)||r.set(a,i++);let l=t.getChildren(a,o);l.forEach(d=>{s.has(d)||s.set(d,a),r.has(d)||r.set(d,i++)});let c=l.length>0?l.map(d=>r.get(d)):void 0,u=s.get(a),h=u?r.get(u):void 0,m=r.get(a);n.push(y(g({},a),{_children:c,_parent:h,_index:m}))}}),n}function Hb(e,t){return{type:"insert",index:e,nodes:t}}function Bb(e){return{type:"remove",indexes:e}}function xo(){return{type:"replace"}}function dd(e){return[e.slice(0,-1),e[e.length-1]]}function hd(e,t,n=new Map){var a;let[i,r]=dd(e);for(let o=i.length-1;o>=0;o--){let l=i.slice(0,o).join();switch((a=n.get(l))==null?void 0:a.type){case"remove":continue}n.set(l,xo())}let s=n.get(i.join());switch(s==null?void 0:s.type){case"remove":n.set(i.join(),{type:"removeThenInsert",removeIndexes:s.indexes,insertIndex:r,insertNodes:t});break;default:n.set(i.join(),Hb(r,t))}return n}function gd(e){var i;let t=new Map,n=new Map;for(let r of e){let s=r.slice(0,-1).join(),a=(i=n.get(s))!=null?i:[];a.push(r[r.length-1]),n.set(s,a.sort((o,l)=>o-l))}for(let r of e)for(let s=r.length-2;s>=0;s--){let a=r.slice(0,s).join();t.has(a)||t.set(a,xo())}for(let[r,s]of n)t.set(r,Bb(s));return t}function _b(e,t){let n=new Map,[i,r]=dd(e);for(let s=i.length-1;s>=0;s--){let a=i.slice(0,s).join();n.set(a,xo())}return n.set(i.join(),{type:"removeThenInsert",removeIndexes:[r],insertIndex:r,insertNodes:[t]}),n}function Ms(e,t,n){return Gb(e,y(g({},n),{getChildren:(i,r)=>{let s=r.join(),a=t.get(s);switch(a==null?void 0:a.type){case"replace":case"remove":case"removeThenInsert":case"insert":return n.getChildren(i,r);default:return[]}},transform:(i,r,s)=>{let a=s.join(),o=t.get(a);switch(o==null?void 0:o.type){case"remove":return n.create(i,r.filter((u,h)=>!o.indexes.includes(h)),s);case"removeThenInsert":let l=r.filter((u,h)=>!o.removeIndexes.includes(h)),c=o.removeIndexes.reduce((u,h)=>h{var u,h;let s=[0,...r],a=s.join(),o=t.transform(i,(u=n[a])!=null?u:[],r),l=s.slice(0,-1).join(),c=(h=n[l])!=null?h:[];c.push(o),n[l]=c}})),n[""][0]}function Ub(e,t){let{nodes:n,at:i}=t;if(i.length===0)throw new Error("Can't insert nodes at the root");let r=hd(i,n);return Ms(e,r,t)}function qb(e,t){if(t.at.length===0)return t.node;let n=_b(t.at,t.node);return Ms(e,n,t)}function Wb(e,t){if(t.indexPaths.length===0)return e;for(let i of t.indexPaths)if(i.length===0)throw new Error("Can't remove the root node");let n=gd(t.indexPaths);return Ms(e,n,t)}function Kb(e,t){if(t.indexPaths.length===0)return e;for(let s of t.indexPaths)if(s.length===0)throw new Error("Can't move the root node");if(t.to.length===0)throw new Error("Can't move nodes to the root");let n=kb(t.indexPaths),i=n.map(s=>cd(e,s,t)),r=hd(t.to,i,gd(n));return Ms(e,r,t)}function Je(e,t){let{onEnter:n,onLeave:i,getChildren:r}=t,s=[],a=[{node:e}],o=t.reuseIndexPath?()=>s:()=>s.slice();for(;a.length>0;){let l=a[a.length-1];if(l.state===void 0){let u=n==null?void 0:n(l.node,o());if(u==="stop")return;l.state=u==="skip"?-1:0}let c=l.children||r(l.node,o());if(l.children||(l.children=c),l.state!==-1){if(l.state{"use strict";se();Vb=Object.defineProperty,xb=(e,t,n)=>t in e?Vb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t,n)=>xb(e,typeof t!="symbol"?t+"":t,n),Ds={itemToValue(e){return typeof e=="string"?e:xt(e)&&$e(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:xt(e)&&$e(e,"label")?e.label:Ds.itemToValue(e)},isItemDisabled(e){return xt(e)&&$e(e,"disabled")?!!e.disabled:!1}},Nt=class od{constructor(t){this.options=t,L(this,"items"),L(this,"indexMap",null),L(this,"copy",n=>new od(y(g({},this.options),{items:n!=null?n:[...this.items]}))),L(this,"isEqual",n=>fe(this.items,n.items)),L(this,"setItems",n=>this.copy(n)),L(this,"getValues",(n=this.items)=>{let i=[];for(let r of n){let s=this.getItemValue(r);s!=null&&i.push(s)}return i}),L(this,"find",n=>{if(n==null)return null;let i=this.indexOf(n);return i!==-1?this.at(i):null}),L(this,"findMany",n=>{let i=[];for(let r of n){let s=this.find(r);s!=null&&i.push(s)}return i}),L(this,"at",n=>{var s;if(!this.options.groupBy&&!this.options.groupSort)return(s=this.items[n])!=null?s:null;let i=0,r=this.group();for(let[,a]of r)for(let o of a){if(i===n)return o;i++}return null}),L(this,"sortFn",(n,i)=>{let r=this.indexOf(n),s=this.indexOf(i);return(r!=null?r:0)-(s!=null?s:0)}),L(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),L(this,"getItemValue",n=>{var i,r,s;return n==null?null:(s=(r=(i=this.options).itemToValue)==null?void 0:r.call(i,n))!=null?s:Ds.itemToValue(n)}),L(this,"getItemDisabled",n=>{var i,r,s;return n==null?!1:(s=(r=(i=this.options).isItemDisabled)==null?void 0:r.call(i,n))!=null?s:Ds.isItemDisabled(n)}),L(this,"stringifyItem",n=>{var i,r,s;return n==null?null:(s=(r=(i=this.options).itemToString)==null?void 0:r.call(i,n))!=null?s:Ds.itemToString(n)}),L(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),L(this,"stringifyItems",(n,i=", ")=>{let r=[];for(let s of n){let a=this.stringifyItem(s);a!=null&&r.push(a)}return r.join(i)}),L(this,"stringifyMany",(n,i)=>this.stringifyItems(this.findMany(n),i)),L(this,"has",n=>this.indexOf(n)!==-1),L(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),L(this,"group",()=>{let{groupBy:n,groupSort:i}=this.options;if(!n)return[["",[...this.items]]];let r=new Map;this.items.forEach((a,o)=>{let l=n(a,o);r.has(l)||r.set(l,[]),r.get(l).push(a)});let s=Array.from(r.entries());return i&&s.sort(([a],[o])=>{if(typeof i=="function")return i(a,o);if(Array.isArray(i)){let l=i.indexOf(a),c=i.indexOf(o);return l===-1?1:c===-1?-1:l-c}return i==="asc"?a.localeCompare(o):i==="desc"?o.localeCompare(a):0}),s}),L(this,"getNextValue",(n,i=1,r=!1)=>{let s=this.indexOf(n);if(s===-1)return null;for(s=r?Math.min(s+i,this.size-1):s+i;s<=this.size&&this.getItemDisabled(this.at(s));)s++;return this.getItemValue(this.at(s))}),L(this,"getPreviousValue",(n,i=1,r=!1)=>{let s=this.indexOf(n);if(s===-1)return null;for(s=r?Math.max(s-i,0):s-i;s>=0&&this.getItemDisabled(this.at(s));)s--;return this.getItemValue(this.at(s))}),L(this,"indexOf",n=>{var i;if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(r=>this.getItemValue(r)===n);if(!this.indexMap){this.indexMap=new Map;let r=0,s=this.group();for(let[,a]of s)for(let o of a){let l=this.getItemValue(o);l!=null&&this.indexMap.set(l,r),r++}}return(i=this.indexMap.get(n))!=null?i:-1}),L(this,"getByText",(n,i)=>{let r=i!=null?this.indexOf(i):-1,s=n.length===1;for(let a=0;a{let{state:r,currentValue:s,timeout:a=350}=i,o=r.keysSoFar+n,c=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,u=this.getByText(c,s),h=this.getItemValue(u);function m(){clearTimeout(r.timer),r.timer=-1}function d(p){r.keysSoFar=p,m(),p!==""&&(r.timer=+setTimeout(()=>{d(""),m()},a))}return d(o),h}),L(this,"update",(n,i)=>{let r=this.indexOf(n);return r===-1?this:this.copy([...this.items.slice(0,r),i,...this.items.slice(r+1)])}),L(this,"upsert",(n,i,r="append")=>{let s=this.indexOf(n);return s===-1?(r==="append"?this.append:this.prepend)(i):this.copy([...this.items.slice(0,s),i,...this.items.slice(s+1)])}),L(this,"insert",(n,...i)=>this.copy(vr(this.items,n,...i))),L(this,"insertBefore",(n,...i)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(vr(this.items,r,...i))}),L(this,"insertAfter",(n,...i)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(vr(this.items,r+1,...i))}),L(this,"prepend",(...n)=>this.copy(vr(this.items,0,...n))),L(this,"append",(...n)=>this.copy(vr(this.items,this.items.length,...n))),L(this,"filter",n=>{let i=this.items.filter((r,s)=>n(this.stringifyItem(r),s,r));return this.copy(i)}),L(this,"remove",(...n)=>{let i=n.map(r=>typeof r=="string"?r:this.getItemValue(r));return this.copy(this.items.filter(r=>{let s=this.getItemValue(r);return s==null?!1:!i.includes(s)}))}),L(this,"move",(n,i)=>{let r=this.indexOf(n);return r===-1?this:this.copy(Rs(this.items,[r],i))}),L(this,"moveBefore",(n,...i)=>{let r=this.items.findIndex(a=>this.getItemValue(a)===n);if(r===-1)return this;let s=i.map(a=>this.items.findIndex(o=>this.getItemValue(o)===a)).sort((a,o)=>a-o);return this.copy(Rs(this.items,s,r))}),L(this,"moveAfter",(n,...i)=>{let r=this.items.findIndex(a=>this.getItemValue(a)===n);if(r===-1)return this;let s=i.map(a=>this.items.findIndex(o=>this.getItemValue(o)===a)).sort((a,o)=>a-o);return this.copy(Rs(this.items,s,r+1))}),L(this,"reorder",(n,i)=>this.copy(Rs(this.items,[n],i))),L(this,"compareValue",(n,i)=>{let r=this.indexOf(n),s=this.indexOf(i);return rs?1:0}),L(this,"range",(n,i)=>{let r=[],s=n;for(;s!=null;){if(this.find(s)&&r.push(s),s===i)return r;s=this.getNextValue(s)}return[]}),L(this,"getValueRange",(n,i)=>n&&i?this.compareValue(n,i)<=0?this.range(n,i):this.range(i,n):[]),L(this,"toString",()=>{let n="";for(let i of this.items){let r=this.getItemValue(i),s=this.stringifyItem(i),a=this.getItemDisabled(i),o=[r,s,a].filter(Boolean).join(":");n+=o+","}return n}),L(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let t=0;for(;this.getItemDisabled(this.at(t));)t++;return this.getItemValue(this.at(t))}get lastValue(){let t=this.size-1;for(;this.getItemDisabled(this.at(t));)t--;return this.getItemValue(this.at(t))}*[Symbol.iterator](){yield*sc(this.items)}},Ab=(e,t)=>!!(e!=null&&e.toLowerCase().startsWith(t.toLowerCase()));Vo=class extends Nt{constructor(e){let{columnCount:t}=e;super(e),L(this,"columnCount"),L(this,"rows",null),L(this,"getRows",()=>(this.rows||(this.rows=cr([...this.items],this.columnCount)),this.rows)),L(this,"getRowCount",()=>Math.ceil(this.items.length/this.columnCount)),L(this,"getCellIndex",(n,i)=>n*this.columnCount+i),L(this,"getCell",(n,i)=>this.at(this.getCellIndex(n,i))),L(this,"getValueCell",n=>{let i=this.indexOf(n);if(i===-1)return null;let r=Math.floor(i/this.columnCount),s=i%this.columnCount;return{row:r,column:s}}),L(this,"getLastEnabledColumnIndex",n=>{for(let i=this.columnCount-1;i>=0;i--){let r=this.getCell(n,i);if(r&&!this.getItemDisabled(r))return i}return null}),L(this,"getFirstEnabledColumnIndex",n=>{for(let i=0;i{let r=this.getValueCell(n);if(r===null)return null;let s=this.getRows(),a=s.length,o=r.row,l=r.column;for(let c=1;c<=a;c++){o=lr(s,o,{loop:i});let u=s[o];if(!u)continue;if(!u[l]){let d=this.getLastEnabledColumnIndex(o);d!=null&&(l=d)}let m=this.getCell(o,l);if(!this.getItemDisabled(m))return this.getItemValue(m)}return this.firstValue}),L(this,"getNextRowValue",(n,i=!1)=>{let r=this.getValueCell(n);if(r===null)return null;let s=this.getRows(),a=s.length,o=r.row,l=r.column;for(let c=1;c<=a;c++){o=Ei(s,o,{loop:i});let u=s[o];if(!u)continue;if(!u[l]){let d=this.getLastEnabledColumnIndex(o);d!=null&&(l=d)}let m=this.getCell(o,l);if(!this.getItemDisabled(m))return this.getItemValue(m)}return this.lastValue}),this.columnCount=t}};ld=class Ls extends Set{constructor(t=[]){super(t),L(this,"selectionMode","single"),L(this,"deselectable",!0),L(this,"copy",()=>{let n=new Ls([...this]);return this.sync(n)}),L(this,"sync",n=>(n.selectionMode=this.selectionMode,n.deselectable=this.deselectable,n)),L(this,"isEmpty",()=>this.size===0),L(this,"isSelected",n=>this.selectionMode==="none"||n==null?!1:this.has(n)),L(this,"canSelect",(n,i)=>this.selectionMode!=="none"||!n.getItemDisabled(n.find(i))),L(this,"firstSelectedValue",n=>{let i=null;for(let r of this)(!i||n.compareValue(r,i)<0)&&(i=r);return i}),L(this,"lastSelectedValue",n=>{let i=null;for(let r of this)(!i||n.compareValue(r,i)>0)&&(i=r);return i}),L(this,"extendSelection",(n,i,r)=>{if(this.selectionMode==="none")return this;if(this.selectionMode==="single")return this.replaceSelection(n,r);let s=this.copy(),a=Array.from(this).pop();for(let o of n.getValueRange(i,a!=null?a:r))s.delete(o);for(let o of n.getValueRange(r,i))this.canSelect(n,o)&&s.add(o);return s}),L(this,"toggleSelection",(n,i)=>{if(this.selectionMode==="none")return this;if(this.selectionMode==="single"&&!this.isSelected(i))return this.replaceSelection(n,i);let r=this.copy();return r.has(i)?r.delete(i):r.canSelect(n,i)&&r.add(i),r}),L(this,"replaceSelection",(n,i)=>{if(this.selectionMode==="none")return this;if(i==null)return this;if(!this.canSelect(n,i))return this;let r=new Ls([i]);return this.sync(r)}),L(this,"setSelection",n=>{if(this.selectionMode==="none")return this;let i=new Ls;for(let r of n)if(r!=null&&(i.add(r),this.selectionMode==="single"))break;return this.sync(i)}),L(this,"clearSelection",()=>{let n=this.copy();return n.deselectable&&n.size>0&&n.clear(),n}),L(this,"select",(n,i,r)=>this.selectionMode==="none"?this:this.selectionMode==="single"?this.isSelected(i)&&this.deselectable?this.toggleSelection(n,i):this.replaceSelection(n,i):this.selectionMode==="multiple"||r?this.toggleSelection(n,i):this.replaceSelection(n,i)),L(this,"deselect",n=>{let i=this.copy();return i.delete(n),i}),L(this,"isEqual",n=>fe(Array.from(this),Array.from(n)))}};Ao=class pd{constructor(t){this.options=t,L(this,"rootNode"),L(this,"isEqual",n=>fe(this.rootNode,n.rootNode)),L(this,"getNodeChildren",n=>{var i,r,s,a;return(a=(s=(r=(i=this.options).nodeToChildren)==null?void 0:r.call(i,n))!=null?s:wi.nodeToChildren(n))!=null?a:[]}),L(this,"resolveIndexPath",n=>typeof n=="string"?this.getIndexPath(n):n),L(this,"resolveNode",n=>{let i=this.resolveIndexPath(n);return i?this.at(i):void 0}),L(this,"getNodeChildrenCount",n=>{var i,r,s;return(s=(r=(i=this.options).nodeToChildrenCount)==null?void 0:r.call(i,n))!=null?s:wi.nodeToChildrenCount(n)}),L(this,"getNodeValue",n=>{var i,r,s;return(s=(r=(i=this.options).nodeToValue)==null?void 0:r.call(i,n))!=null?s:wi.nodeToValue(n)}),L(this,"getNodeDisabled",n=>{var i,r,s;return(s=(r=(i=this.options).isNodeDisabled)==null?void 0:r.call(i,n))!=null?s:wi.isNodeDisabled(n)}),L(this,"stringify",n=>{let i=this.findNode(n);return i?this.stringifyNode(i):null}),L(this,"stringifyNode",n=>{var i,r,s;return(s=(r=(i=this.options).nodeToString)==null?void 0:r.call(i,n))!=null?s:wi.nodeToString(n)}),L(this,"getFirstNode",(n=this.rootNode,i={})=>{let r;return Je(n,{getChildren:this.getNodeChildren,onEnter:(s,a)=>{var o;if(!this.isSameNode(s,n)){if((o=i.skip)!=null&&o.call(i,{value:this.getNodeValue(s),node:s,indexPath:a}))return"skip";if(!r&&a.length>0&&!this.getNodeDisabled(s))return r=s,"stop"}}}),r}),L(this,"getLastNode",(n=this.rootNode,i={})=>{let r;return Je(n,{getChildren:this.getNodeChildren,onEnter:(s,a)=>{var o;if(!this.isSameNode(s,n)){if((o=i.skip)!=null&&o.call(i,{value:this.getNodeValue(s),node:s,indexPath:a}))return"skip";a.length>0&&!this.getNodeDisabled(s)&&(r=s)}}}),r}),L(this,"at",n=>cd(this.rootNode,n,{getChildren:this.getNodeChildren})),L(this,"findNode",(n,i=this.rootNode)=>Rb(i,{getChildren:this.getNodeChildren,predicate:r=>this.getNodeValue(r)===n})),L(this,"findNodes",(n,i=this.rootNode)=>{let r=new Set(n.filter(s=>s!=null));return Db(i,{getChildren:this.getNodeChildren,predicate:s=>r.has(this.getNodeValue(s))})}),L(this,"sort",n=>n.reduce((i,r)=>{let s=this.getIndexPath(r);return s&&i.push({value:r,indexPath:s}),i},[]).sort((i,r)=>ud(i.indexPath,r.indexPath)).map(({value:i})=>i)),L(this,"getIndexPath",n=>sd(this.rootNode,{getChildren:this.getNodeChildren,predicate:i=>this.getNodeValue(i)===n})),L(this,"getValue",n=>{let i=this.at(n);return i?this.getNodeValue(i):void 0}),L(this,"getValuePath",n=>{if(!n)return[];let i=[],r=[...n];for(;r.length>0;){let s=this.at(r);s&&i.unshift(this.getNodeValue(s)),r.pop()}return i}),L(this,"getDepth",n=>{var r;let i=sd(this.rootNode,{getChildren:this.getNodeChildren,predicate:s=>this.getNodeValue(s)===n});return(r=i==null?void 0:i.length)!=null?r:0}),L(this,"isSameNode",(n,i)=>this.getNodeValue(n)===this.getNodeValue(i)),L(this,"isRootNode",n=>this.isSameNode(n,this.rootNode)),L(this,"contains",(n,i)=>!n||!i?!1:i.slice(0,n.length).every((r,s)=>n[s]===i[s])),L(this,"getNextNode",(n,i={})=>{let r=!1,s;return Je(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var c;if(this.isRootNode(a))return;let l=this.getNodeValue(a);if((c=i.skip)!=null&&c.call(i,{value:l,node:a,indexPath:o}))return l===n&&(r=!0),"skip";if(r&&!this.getNodeDisabled(a))return s=a,"stop";l===n&&(r=!0)}}),s}),L(this,"getPreviousNode",(n,i={})=>{let r,s=!1;return Je(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var c;if(this.isRootNode(a))return;let l=this.getNodeValue(a);if((c=i.skip)!=null&&c.call(i,{value:l,node:a,indexPath:o}))return"skip";if(l===n)return s=!0,"stop";this.getNodeDisabled(a)||(r=a)}}),s?r:void 0}),L(this,"getParentNodes",n=>{var s;let i=(s=this.resolveIndexPath(n))==null?void 0:s.slice();if(!i)return[];let r=[];for(;i.length>0;){i.pop();let a=this.at(i);a&&!this.isRootNode(a)&&r.unshift(a)}return r}),L(this,"getDescendantNodes",(n,i)=>{let r=this.resolveNode(n);if(!r)return[];let s=[];return Je(r,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{o.length!==0&&(!(i!=null&&i.withBranch)&&this.isBranchNode(a)||s.push(a))}}),s}),L(this,"getDescendantValues",(n,i)=>this.getDescendantNodes(n,i).map(s=>this.getNodeValue(s))),L(this,"getParentIndexPath",n=>n.slice(0,-1)),L(this,"getParentNode",n=>{let i=this.resolveIndexPath(n);return i?this.at(this.getParentIndexPath(i)):void 0}),L(this,"visit",n=>{let s=n,{skip:i}=s,r=ft(s,["skip"]);Je(this.rootNode,y(g({},r),{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var l;if(!this.isRootNode(a))return i!=null&&i({value:this.getNodeValue(a),node:a,indexPath:o})?"skip":(l=r.onEnter)==null?void 0:l.call(r,a,o)}}))}),L(this,"getPreviousSibling",n=>{let i=this.getParentNode(n);if(!i)return;let r=this.getNodeChildren(i),s=n[n.length-1];for(;--s>=0;){let a=r[s];if(!this.getNodeDisabled(a))return a}}),L(this,"getNextSibling",n=>{let i=this.getParentNode(n);if(!i)return;let r=this.getNodeChildren(i),s=n[n.length-1];for(;++s{let i=this.getParentNode(n);return i?this.getNodeChildren(i):[]}),L(this,"getValues",(n=this.rootNode)=>Mb(n,{getChildren:this.getNodeChildren,transform:r=>[this.getNodeValue(r)]}).slice(1)),L(this,"isValidDepth",(n,i)=>i==null?!0:typeof i=="function"?i(n.length):n.length===i),L(this,"isBranchNode",n=>this.getNodeChildren(n).length>0||this.getNodeChildrenCount(n)!=null),L(this,"getBranchValues",(n=this.rootNode,i={})=>{let r=[];return Je(n,{getChildren:this.getNodeChildren,onEnter:(s,a)=>{var l;if(a.length===0)return;let o=this.getNodeValue(s);if((l=i.skip)!=null&&l.call(i,{value:o,node:s,indexPath:a}))return"skip";this.isBranchNode(s)&&this.isValidDepth(a,i.depth)&&r.push(this.getNodeValue(s))}}),r}),L(this,"flatten",(n=this.rootNode)=>$b(n,{getChildren:this.getNodeChildren})),L(this,"_create",(n,i)=>this.getNodeChildren(n).length>0||i.length>0?y(g({},n),{children:i}):g({},n)),L(this,"_insert",(n,i,r)=>this.copy(Ub(n,{at:i,nodes:r,getChildren:this.getNodeChildren,create:this._create}))),L(this,"copy",n=>new pd(y(g({},this.options),{rootNode:n}))),L(this,"_replace",(n,i,r)=>this.copy(qb(n,{at:i,node:r,getChildren:this.getNodeChildren,create:this._create}))),L(this,"_move",(n,i,r)=>this.copy(Kb(n,{indexPaths:i,to:r,getChildren:this.getNodeChildren,create:this._create}))),L(this,"_remove",(n,i)=>this.copy(Wb(n,{indexPaths:i,getChildren:this.getNodeChildren,create:this._create}))),L(this,"replace",(n,i)=>this._replace(this.rootNode,n,i)),L(this,"remove",n=>this._remove(this.rootNode,n)),L(this,"insertBefore",(n,i)=>this.getParentNode(n)?this._insert(this.rootNode,n,i):void 0),L(this,"insertAfter",(n,i)=>{if(!this.getParentNode(n))return;let s=[...n.slice(0,-1),n[n.length-1]+1];return this._insert(this.rootNode,s,i)}),L(this,"move",(n,i)=>this._move(this.rootNode,n,i)),L(this,"filter",n=>{let i=Fb(this.rootNode,{predicate:n,getChildren:this.getNodeChildren,create:this._create});return this.copy(i)}),L(this,"toJSON",()=>this.getValues(this.rootNode)),this.rootNode=t.rootNode}},wi={nodeToValue(e){return typeof e=="string"?e:xt(e)&&$e(e,"value")?e.value:""},nodeToString(e){return typeof e=="string"?e:xt(e)&&$e(e,"label")?e.label:wi.nodeToValue(e)},isNodeDisabled(e){return xt(e)&&$e(e,"disabled")?!!e.disabled:!1},nodeToChildren(e){return e.children},nodeToChildrenCount(e){if(xt(e)&&$e(e,"childrenCount"))return e.childrenCount}}});function No(e,t,n){return Qe(e,Sn(t,n))}function Qt(e,t){return typeof e=="function"?e(t):e}function en(e){return e.split("-")[0]}function Ai(e){return e.split("-")[1]}function Lo(e){return e==="x"?"y":"x"}function Mo(e){return e==="y"?"height":"width"}function Rt(e){return Xb.has(en(e))?"y":"x"}function Fo(e){return Lo(Rt(e))}function Zb(e,t,n){n===void 0&&(n=!1);let i=Ai(e),r=Fo(e),s=Mo(r),a=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Hs(a)),[a,Hs(a)]}function Jb(e){let t=Hs(e);return[Ro(e),t,Ro(t)]}function Ro(e){return e.replace(/start|end/g,t=>jb[t])}function tE(e,t,n){switch(e){case"top":case"bottom":return n?t?md:fd:t?fd:md;case"left":case"right":return t?Qb:eE;default:return[]}}function nE(e,t,n,i){let r=Ai(e),s=tE(en(e),n==="start",i);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Ro)))),s}function Hs(e){return e.replace(/left|right|bottom|top/g,t=>Yb[t])}function iE(e){return g({top:0,right:0,bottom:0,left:0},e)}function Od(e){return typeof e!="number"?iE(e):{top:e,right:e,bottom:e,left:e}}function Bs(e){let{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function vd(e,t,n){let{reference:i,floating:r}=e,s=Rt(t),a=Fo(t),o=Mo(a),l=en(t),c=s==="y",u=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,m=i[o]/2-r[o]/2,d;switch(l){case"top":d={x:u,y:i.y-r.height};break;case"bottom":d={x:u,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:h};break;case"left":d={x:i.x-r.width,y:h};break;default:d={x:i.x,y:i.y}}switch(Ai(t)){case"start":d[a]-=m*(n&&c?-1:1);break;case"end":d[a]+=m*(n&&c?-1:1);break}return d}function rE(e,t){return Ve(this,null,function*(){var n;t===void 0&&(t={});let{x:i,y:r,platform:s,rects:a,elements:o,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:d=0}=Qt(t,e),p=Od(d),I=o[m?h==="floating"?"reference":"floating":h],T=Bs(yield s.getClippingRect({element:(n=yield s.isElement==null?void 0:s.isElement(I))==null||n?I:I.contextElement||(yield s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:u,strategy:l})),w=h==="floating"?{x:i,y:r,width:a.floating.width,height:a.floating.height}:a.reference,b=yield s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating),f=(yield s.isElement==null?void 0:s.isElement(b))?(yield s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},S=Bs(s.convertOffsetParentRelativeRectToViewportRelativeRect?yield s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:w,offsetParent:b,strategy:l}):w);return{top:(T.top-S.top+p.top)/f.y,bottom:(S.bottom-T.bottom+p.bottom)/f.y,left:(T.left-S.left+p.left)/f.x,right:(S.right-T.right+p.right)/f.x}})}function yd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bd(e){return zb.some(t=>e[t]>=0)}function cE(e,t){return Ve(this,null,function*(){let{placement:n,platform:i,elements:r}=e,s=yield i.isRTL==null?void 0:i.isRTL(r.floating),a=en(n),o=Ai(n),l=Rt(n)==="y",c=wd.has(a)?-1:1,u=s&&l?-1:1,h=Qt(t,e),{mainAxis:m,crossAxis:d,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof p=="number"&&(d=o==="end"?p*-1:p),l?{x:d*u,y:m*c}:{x:m*c,y:d*u}})}function _s(){return typeof window!="undefined"}function ki(e){return Vd(e)?(e.nodeName||"").toLowerCase():"#document"}function et(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mt(e){var t;return(t=(Vd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Vd(e){return _s()?e instanceof Node||e instanceof et(e).Node:!1}function bt(e){return _s()?e instanceof Element||e instanceof et(e).Element:!1}function Lt(e){return _s()?e instanceof HTMLElement||e instanceof et(e).HTMLElement:!1}function Ed(e){return!_s()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof et(e).ShadowRoot}function Ir(e){let{overflow:t,overflowX:n,overflowY:i,display:r}=Et(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!pE.has(r)}function mE(e){return fE.has(ki(e))}function Gs(e){return vE.some(t=>{try{return e.matches(t)}catch(n){return!1}})}function $o(e){let t=Ho(),n=bt(e)?Et(e):e;return yE.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||bE.some(i=>(n.willChange||"").includes(i))||EE.some(i=>(n.contain||"").includes(i))}function IE(e){let t=Tn(e);for(;Lt(t)&&!xi(t);){if($o(t))return t;if(Gs(t))return null;t=Tn(t)}return null}function Ho(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xi(e){return PE.has(ki(e))}function Et(e){return et(e).getComputedStyle(e)}function Us(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Tn(e){if(ki(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Ed(e)&&e.host||Mt(e);return Ed(t)?t.host:t}function xd(e){let t=Tn(e);return xi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Lt(t)&&Ir(t)?t:xd(t)}function Er(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);let r=xd(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),a=et(r);if(s){let o=Do(a);return t.concat(a,a.visualViewport||[],Ir(r)?r:[],o&&n?Er(o):[])}return t.concat(r,Er(r,[],n))}function Do(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ad(e){let t=Et(e),n=parseFloat(t.width)||0,i=parseFloat(t.height)||0,r=Lt(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:i,o=$s(n)!==s||$s(i)!==a;return o&&(n=s,i=a),{width:n,height:i,$:o}}function Bo(e){return bt(e)?e:e.contextElement}function Vi(e){let t=Bo(e);if(!Lt(t))return Dt(1);let n=t.getBoundingClientRect(),{width:i,height:r,$:s}=Ad(t),a=(s?$s(n.width):n.width)/i,o=(s?$s(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}function kd(e){let t=et(e);return!Ho()||!t.visualViewport?CE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function SE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==et(e)?!1:t}function qn(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=e.getBoundingClientRect(),s=Bo(e),a=Dt(1);t&&(i?bt(i)&&(a=Vi(i)):a=Vi(e));let o=SE(s,n,i)?kd(s):Dt(0),l=(r.left+o.x)/a.x,c=(r.top+o.y)/a.y,u=r.width/a.x,h=r.height/a.y;if(s){let m=et(s),d=i&&bt(i)?et(i):i,p=m,v=Do(p);for(;v&&i&&d!==p;){let I=Vi(v),T=v.getBoundingClientRect(),w=Et(v),b=T.left+(v.clientLeft+parseFloat(w.paddingLeft))*I.x,f=T.top+(v.clientTop+parseFloat(w.paddingTop))*I.y;l*=I.x,c*=I.y,u*=I.x,h*=I.y,l+=b,c+=f,p=et(v),v=Do(p)}}return Bs({width:u,height:h,x:l,y:c})}function qs(e,t){let n=Us(e).scrollLeft;return t?t.left+n:qn(Mt(e)).left+n}function Nd(e,t){let n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-qs(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function TE(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e,s=r==="fixed",a=Mt(i),o=t?Gs(t.floating):!1;if(i===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Dt(1),u=Dt(0),h=Lt(i);if((h||!h&&!s)&&((ki(i)!=="body"||Ir(a))&&(l=Us(i)),Lt(i))){let d=qn(i);c=Vi(i),u.x=d.x+i.clientLeft,u.y=d.y+i.clientTop}let m=a&&!h&&!s?Nd(a,l):Dt(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-l.scrollTop*c.y+u.y+m.y}}function OE(e){return Array.from(e.getClientRects())}function wE(e){let t=Mt(e),n=Us(e),i=e.ownerDocument.body,r=Qe(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=Qe(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),a=-n.scrollLeft+qs(e),o=-n.scrollTop;return Et(i).direction==="rtl"&&(a+=Qe(t.clientWidth,i.clientWidth)-r),{width:r,height:s,x:a,y:o}}function VE(e,t){let n=et(e),i=Mt(e),r=n.visualViewport,s=i.clientWidth,a=i.clientHeight,o=0,l=0;if(r){s=r.width,a=r.height;let u=Ho();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}let c=qs(i);if(c<=0){let u=i.ownerDocument,h=u.body,m=getComputedStyle(h),d=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(i.clientWidth-h.clientWidth-d);p<=Id&&(s-=p)}else c<=Id&&(s+=c);return{width:s,height:a,x:o,y:l}}function AE(e,t){let n=qn(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,s=Lt(e)?Vi(e):Dt(1),a=e.clientWidth*s.x,o=e.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:a,height:o,x:l,y:c}}function Pd(e,t,n){let i;if(t==="viewport")i=VE(e,n);else if(t==="document")i=wE(Mt(e));else if(bt(t))i=AE(t,n);else{let r=kd(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Bs(i)}function Rd(e,t){let n=Tn(e);return n===t||!bt(n)||xi(n)?!1:Et(n).position==="fixed"||Rd(n,t)}function kE(e,t){let n=t.get(e);if(n)return n;let i=Er(e,[],!1).filter(o=>bt(o)&&ki(o)!=="body"),r=null,s=Et(e).position==="fixed",a=s?Tn(e):e;for(;bt(a)&&!xi(a);){let o=Et(a),l=$o(a);!l&&o.position==="fixed"&&(r=null),(s?!l&&!r:!l&&o.position==="static"&&!!r&&xE.has(r.position)||Ir(a)&&!l&&Rd(e,a))?i=i.filter(u=>u!==a):r=o,a=Tn(a)}return t.set(e,i),i}function NE(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e,a=[...n==="clippingAncestors"?Gs(t)?[]:kE(t,this._c):[].concat(n),i],o=a[0],l=a.reduce((c,u)=>{let h=Pd(t,u,r);return c.top=Qe(h.top,c.top),c.right=Sn(h.right,c.right),c.bottom=Sn(h.bottom,c.bottom),c.left=Qe(h.left,c.left),c},Pd(t,o,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function RE(e){let{width:t,height:n}=Ad(e);return{width:t,height:n}}function DE(e,t,n){let i=Lt(t),r=Mt(t),s=n==="fixed",a=qn(e,!0,s,t),o={scrollLeft:0,scrollTop:0},l=Dt(0);function c(){l.x=qs(r)}if(i||!i&&!s)if((ki(t)!=="body"||Ir(r))&&(o=Us(t)),i){let d=qn(t,!0,s,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else r&&c();s&&!i&&r&&c();let u=r&&!i&&!s?Nd(r,o):Dt(0),h=a.left+o.scrollLeft-l.x-u.x,m=a.top+o.scrollTop-l.y-u.y;return{x:h,y:m,width:a.width,height:a.height}}function ko(e){return Et(e).position==="static"}function Cd(e,t){if(!Lt(e)||Et(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Mt(e)===n&&(n=n.ownerDocument.body),n}function Dd(e,t){let n=et(e);if(Gs(e))return n;if(!Lt(e)){let r=Tn(e);for(;r&&!xi(r);){if(bt(r)&&!ko(r))return r;r=Tn(r)}return n}let i=Cd(e,t);for(;i&&mE(i)&&ko(i);)i=Cd(i,t);return i&&xi(i)&&ko(i)&&!$o(i)?n:i||IE(e)||n}function ME(e){return Et(e).direction==="rtl"}function Ld(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $E(e,t){let n=null,i,r=Mt(e);function s(){var o;clearTimeout(i),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();let c=e.getBoundingClientRect(),{left:u,top:h,width:m,height:d}=c;if(o||t(),!m||!d)return;let p=Fs(h),v=Fs(r.clientWidth-(u+m)),I=Fs(r.clientHeight-(h+d)),T=Fs(u),b={rootMargin:-p+"px "+-v+"px "+-I+"px "+-T+"px",threshold:Qe(0,Sn(1,l))||1},f=!0;function S(P){let V=P[0].intersectionRatio;if(V!==l){if(!f)return a();V?a(!1,V):i=setTimeout(()=>{a(!1,1e-7)},1e3)}V===1&&!Ld(c,e.getBoundingClientRect())&&a(),f=!1}try{n=new IntersectionObserver(S,y(g({},b),{root:r.ownerDocument}))}catch(P){n=new IntersectionObserver(S,b)}n.observe(e)}return a(!0),s}function HE(e,t,n,i){i===void 0&&(i={});let{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=Bo(e),u=r||s?[...c?Er(c):[],...Er(t)]:[];u.forEach(T=>{r&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});let h=c&&o?$E(c,n):null,m=-1,d=null;a&&(d=new ResizeObserver(T=>{let[w]=T;w&&w.target===c&&d&&(d.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=d)==null||b.observe(t)})),n()}),c&&!l&&d.observe(c),d.observe(t));let p,v=l?qn(e):null;l&&I();function I(){let T=qn(e);v&&!Ld(v,T)&&n(),v=T,p=requestAnimationFrame(I)}return n(),()=>{var T;u.forEach(w=>{r&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h==null||h(),(T=d)==null||T.disconnect(),d=null,l&&cancelAnimationFrame(p)}}function Sd(e=0,t=0,n=0,i=0){if(typeof DOMRect=="function")return new DOMRect(e,t,n,i);let r={x:e,y:t,width:n,height:i,top:t,right:e+n,bottom:t+i,left:e};return y(g({},r),{toJSON:()=>r})}function YE(e){if(!e)return Sd();let{x:t,y:n,width:i,height:r}=e;return Sd(t,n,i,r)}function jE(e,t){return{contextElement:le(e)?e:e==null?void 0:e.contextElement,getBoundingClientRect:()=>{let n=e,i=t==null?void 0:t(n);return i||!n?YE(i):n.getBoundingClientRect()}}}function ZE(e,t){return{name:"transformOrigin",fn(n){var x,k,N,D,$;let{elements:i,middlewareData:r,placement:s,rects:a,y:o}=n,l=s.split("-")[0],c=XE(l),u=((x=r.arrow)==null?void 0:x.x)||0,h=((k=r.arrow)==null?void 0:k.y)||0,m=(t==null?void 0:t.clientWidth)||0,d=(t==null?void 0:t.clientHeight)||0,p=u+m/2,v=h+d/2,I=Math.abs(((N=r.shift)==null?void 0:N.y)||0),T=a.reference.height/2,w=d/2,b=($=(D=e.offset)==null?void 0:D.mainAxis)!=null?$:e.gutter,f=typeof b=="number"?b+w:b!=null?b:w,S=I>f,P={top:`${p}px calc(100% + ${f}px)`,bottom:`${p}px ${-f}px`,left:`calc(100% + ${f}px) ${v}px`,right:`${-f}px ${v}px`}[l],V=`${p}px ${a.reference.y+T-o}px`,A=!!e.overlap&&c==="y"&&S;return i.floating.style.setProperty(Jt.transformOrigin.variable,A?V:P),{data:{transformOrigin:A?V:P}}}}}function eI(e){let[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function Md(e){return e.split("-")[0]}function Td(e,t){let n=e.devicePixelRatio||1;return Math.round(t*n)/n}function _o(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function nI(e,t,n){let i=e||t.createElement("div");return WE({element:i,padding:n.arrowPadding})}function iI(e,t){var n;if(!Wc((n=t.offset)!=null?n:t.gutter))return BE(({placement:i})=>{var u,h,m,d;let r=((e==null?void 0:e.clientHeight)||0)/2,s=(h=(u=t.offset)==null?void 0:u.mainAxis)!=null?h:t.gutter,a=typeof s=="number"?s+r:s!=null?s:r,{hasAlign:o}=eI(i),l=o?void 0:t.shift,c=(d=(m=t.offset)==null?void 0:m.crossAxis)!=null?d:l;return Si({crossAxis:c,mainAxis:a,alignmentAxis:t.shift})})}function rI(e){if(!e.flip)return;let t=_o(e.boundary);return GE(y(g({},t?{boundary:t}:void 0),{padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}))}function sI(e){if(!e.slide&&!e.overlap)return;let t=_o(e.boundary);return _E(y(g({},t?{boundary:t}:void 0),{mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:KE()}))}function aI(e){return UE({padding:e.overflowPadding,apply({elements:t,rects:n,availableHeight:i,availableWidth:r}){let s=t.floating,a=Math.round(n.reference.width),o=Math.round(n.reference.height);r=Math.floor(r),i=Math.floor(i),s.style.setProperty("--reference-width",`${a}px`),s.style.setProperty("--reference-height",`${o}px`),s.style.setProperty("--available-width",`${r}px`),s.style.setProperty("--available-height",`${i}px`)}})}function oI(e){var t;if(e.hideWhenDetached)return qE({strategy:"referenceHidden",boundary:(t=_o(e.boundary))!=null?t:"clippingAncestors"})}function lI(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}function cI(e,t,n={}){var I,T;let i=(T=(I=n.getAnchorElement)==null?void 0:I.call(n))!=null?T:e,r=jE(i,n.getAnchorRect);if(!t||!r)return;let s=Object.assign({},tI,n),a=t.querySelector("[data-part=arrow]"),o=[iI(a,s),rI(s),sI(s),nI(a,t.ownerDocument,s),QE(a),ZE({gutter:s.gutter,offset:s.offset,overlap:s.overlap},a),aI(s),oI(s),JE],{placement:l,strategy:c,onComplete:u,onPositioned:h}=s,m=()=>Ve(null,null,function*(){var V;if(!r||!t)return;let w=yield zE(r,t,{placement:l,middleware:o,strategy:c});u==null||u(w),h==null||h({placed:!0});let b=ue(t),f=Td(b,w.x),S=Td(b,w.y);t.style.setProperty("--x",`${f}px`),t.style.setProperty("--y",`${S}px`),s.hideWhenDetached&&(((V=w.middlewareData.hide)==null?void 0:V.referenceHidden)?(t.style.setProperty("visibility","hidden"),t.style.setProperty("pointer-events","none")):(t.style.removeProperty("visibility"),t.style.removeProperty("pointer-events")));let P=t.firstElementChild;if(P){let A=at(P);t.style.setProperty("--z-index",A.zIndex)}}),d=()=>Ve(null,null,function*(){n.updatePosition?(yield n.updatePosition({updatePosition:m,floatingElement:t}),h==null||h({placed:!0})):yield m()}),p=lI(s.listeners),v=s.listeners?HE(r,t,d,p):zc;return d(),()=>{v==null||v(),h==null||h({placed:!1})}}function It(e,t,n={}){let o=n,{defer:i}=o,r=ft(o,["defer"]),s=i?H:l=>l(),a=[];return a.push(s(()=>{let l=typeof e=="function"?e():e,c=typeof t=="function"?t():t;a.push(cI(l,c,r))})),()=>{a.forEach(l=>l==null?void 0:l())}}function On(e={}){let{placement:t,sameWidth:n,fitViewport:i,strategy:r="absolute"}=e;return{arrow:{position:"absolute",width:Jt.arrowSize.reference,height:Jt.arrowSize.reference,[Jt.arrowSizeHalf.variable]:`calc(${Jt.arrowSize.reference} / 2)`,[Jt.arrowOffset.variable]:`calc(${Jt.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?uI[t.split("-")[0]]:void 0,background:Jt.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:r,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:i?"var(--available-width)":void 0,maxHeight:i?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}var zb,Sn,Qe,$s,Fs,Dt,Yb,jb,Xb,fd,md,Qb,eE,sE,aE,oE,lE,wd,uE,dE,hE,gE,pE,fE,vE,yE,bE,EE,PE,CE,Id,xE,LE,FE,BE,_E,GE,UE,qE,WE,KE,zE,br,Jt,XE,JE,QE,tI,uI,Pr=re(()=>{"use strict";se();zb=["top","right","bottom","left"],Sn=Math.min,Qe=Math.max,$s=Math.round,Fs=Math.floor,Dt=e=>({x:e,y:e}),Yb={left:"right",right:"left",bottom:"top",top:"bottom"},jb={start:"end",end:"start"};Xb=new Set(["top","bottom"]);fd=["left","right"],md=["right","left"],Qb=["top","bottom"],eE=["bottom","top"];sE=(e,t,n)=>Ve(null,null,function*(){let{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,o=s.filter(Boolean),l=yield a.isRTL==null?void 0:a.isRTL(t),c=yield a.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:h}=vd(c,i,l),m=i,d={},p=0;for(let I=0;I({name:"arrow",options:e,fn(n){return Ve(this,null,function*(){let{x:i,y:r,placement:s,rects:a,platform:o,elements:l,middlewareData:c}=n,{element:u,padding:h=0}=Qt(e,n)||{};if(u==null)return{};let m=Od(h),d={x:i,y:r},p=Fo(s),v=Mo(p),I=yield o.getDimensions(u),T=p==="y",w=T?"top":"left",b=T?"bottom":"right",f=T?"clientHeight":"clientWidth",S=a.reference[v]+a.reference[p]-d[p]-a.floating[v],P=d[p]-a.reference[p],V=yield o.getOffsetParent==null?void 0:o.getOffsetParent(u),A=V?V[f]:0;(!A||!(yield o.isElement==null?void 0:o.isElement(V)))&&(A=l.floating[f]||a.floating[v]);let x=S/2-P/2,k=A/2-I[v]/2-1,N=Sn(m[w],k),D=Sn(m[b],k),$=N,te=A-I[v]-D,J=A/2-I[v]/2+x,ie=No($,J,te),Q=!c.arrow&&Ai(s)!=null&&J!==ie&&a.reference[v]/2-(J<$?N:D)-I[v]/2<0,Se=Q?J<$?J-$:J-te:0;return{[p]:d[p]+Se,data:g({[p]:ie,centerOffset:J-ie-Se},Q&&{alignmentOffset:Se}),reset:Q}})}}),oE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,fn(n){return Ve(this,null,function*(){var i,r;let{placement:s,middlewareData:a,rects:o,initialPlacement:l,platform:c,elements:u}=n,J=Qt(e,n),{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:I=!0}=J,T=ft(J,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((i=a.arrow)!=null&&i.alignmentOffset)return{};let w=en(s),b=Rt(l),f=en(l)===l,S=yield c.isRTL==null?void 0:c.isRTL(u.floating),P=d||(f||!I?[Hs(l)]:Jb(l)),V=v!=="none";!d&&V&&P.push(...nE(l,I,v,S));let A=[l,...P],x=yield c.detectOverflow(n,T),k=[],N=((r=a.flip)==null?void 0:r.overflows)||[];if(h&&k.push(x[w]),m){let ie=Zb(s,o,S);k.push(x[ie[0]],x[ie[1]])}if(N=[...N,{placement:s,overflows:k}],!k.every(ie=>ie<=0)){var D,$;let ie=(((D=a.flip)==null?void 0:D.index)||0)+1,Q=A[ie];if(Q&&(!(m==="alignment"?b!==Rt(Q):!1)||N.every(ne=>Rt(ne.placement)===b?ne.overflows[0]>0:!0)))return{data:{index:ie,overflows:N},reset:{placement:Q}};let Se=($=N.filter(Pe=>Pe.overflows[0]<=0).sort((Pe,ne)=>Pe.overflows[1]-ne.overflows[1])[0])==null?void 0:$.placement;if(!Se)switch(p){case"bestFit":{var te;let Pe=(te=N.filter(ne=>{if(V){let Ie=Rt(ne.placement);return Ie===b||Ie==="y"}return!0}).map(ne=>[ne.placement,ne.overflows.filter(Ie=>Ie>0).reduce((Ie,rt)=>Ie+rt,0)]).sort((ne,Ie)=>ne[1]-Ie[1])[0])==null?void 0:te[0];Pe&&(Se=Pe);break}case"initialPlacement":Se=l;break}if(s!==Se)return{reset:{placement:Se}}}return{}})}}};lE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,fn(n){return Ve(this,null,function*(){let{rects:i,platform:r}=n,o=Qt(e,n),{strategy:s="referenceHidden"}=o,a=ft(o,["strategy"]);switch(s){case"referenceHidden":{let l=yield r.detectOverflow(n,y(g({},a),{elementContext:"reference"})),c=yd(l,i.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:bd(c)}}}case"escaped":{let l=yield r.detectOverflow(n,y(g({},a),{altBoundary:!0})),c=yd(l,i.floating);return{data:{escapedOffsets:c,escaped:bd(c)}}}default:return{}}})}}},wd=new Set(["left","top"]);uE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return Ve(this,null,function*(){var i,r;let{x:s,y:a,placement:o,middlewareData:l}=n,c=yield cE(n,e);return o===((i=l.offset)==null?void 0:i.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:y(g({},c),{placement:o})}})}}},dE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,fn(n){return Ve(this,null,function*(){let{x:i,y:r,placement:s,platform:a}=n,w=Qt(e,n),{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:f,y:S}=b;return{x:f,y:S}}}}=w,u=ft(w,["mainAxis","crossAxis","limiter"]),h={x:i,y:r},m=yield a.detectOverflow(n,u),d=Rt(en(s)),p=Lo(d),v=h[p],I=h[d];if(o){let b=p==="y"?"top":"left",f=p==="y"?"bottom":"right",S=v+m[b],P=v-m[f];v=No(S,v,P)}if(l){let b=d==="y"?"top":"left",f=d==="y"?"bottom":"right",S=I+m[b],P=I-m[f];I=No(S,I,P)}let T=c.fn(y(g({},n),{[p]:v,[d]:I}));return y(g({},T),{data:{x:T.x-i,y:T.y-r,enabled:{[p]:o,[d]:l}}})})}}},hE=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:i,placement:r,rects:s,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=Qt(e,t),u={x:n,y:i},h=Rt(r),m=Lo(h),d=u[m],p=u[h],v=Qt(o,t),I=typeof v=="number"?{mainAxis:v,crossAxis:0}:g({mainAxis:0,crossAxis:0},v);if(l){let b=m==="y"?"height":"width",f=s.reference[m]-s.floating[b]+I.mainAxis,S=s.reference[m]+s.reference[b]-I.mainAxis;dS&&(d=S)}if(c){var T,w;let b=m==="y"?"width":"height",f=wd.has(en(r)),S=s.reference[h]-s.floating[b]+(f&&((T=a.offset)==null?void 0:T[h])||0)+(f?0:I.crossAxis),P=s.reference[h]+s.reference[b]+(f?0:((w=a.offset)==null?void 0:w[h])||0)-(f?I.crossAxis:0);pP&&(p=P)}return{[m]:d,[h]:p}}}},gE=function(e){return e===void 0&&(e={}),{name:"size",options:e,fn(n){return Ve(this,null,function*(){var i,r;let{placement:s,rects:a,platform:o,elements:l}=n,N=Qt(e,n),{apply:c=()=>{}}=N,u=ft(N,["apply"]),h=yield o.detectOverflow(n,u),m=en(s),d=Ai(s),p=Rt(s)==="y",{width:v,height:I}=a.floating,T,w;m==="top"||m==="bottom"?(T=m,w=d===((yield o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(w=m,T=d==="end"?"top":"bottom");let b=I-h.top-h.bottom,f=v-h.left-h.right,S=Sn(I-h[T],b),P=Sn(v-h[w],f),V=!n.middlewareData.shift,A=S,x=P;if((i=n.middlewareData.shift)!=null&&i.enabled.x&&(x=f),(r=n.middlewareData.shift)!=null&&r.enabled.y&&(A=b),V&&!d){let D=Qe(h.left,0),$=Qe(h.right,0),te=Qe(h.top,0),J=Qe(h.bottom,0);p?x=v-2*(D!==0||$!==0?D+$:Qe(h.left,h.right)):A=I-2*(te!==0||J!==0?te+J:Qe(h.top,h.bottom))}yield c(y(g({},n),{availableWidth:x,availableHeight:A}));let k=yield o.getDimensions(l.floating);return v!==k.width||I!==k.height?{reset:{rects:!0}}:{}})}}};pE=new Set(["inline","contents"]);fE=new Set(["table","td","th"]);vE=[":popover-open",":modal"];yE=["transform","translate","scale","rotate","perspective"],bE=["transform","translate","scale","rotate","perspective","filter"],EE=["paint","layout","strict","content"];PE=new Set(["html","body","#document"]);CE=Dt(0);Id=25;xE=new Set(["absolute","fixed"]);LE=function(e){return Ve(this,null,function*(){let t=this.getOffsetParent||Dd,n=this.getDimensions,i=yield n(e.floating);return{reference:DE(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};FE={convertOffsetParentRelativeRectToViewportRelativeRect:TE,getDocumentElement:Mt,getClippingRect:NE,getOffsetParent:Dd,getElementRects:LE,getClientRects:OE,getDimensions:RE,getScale:Vi,isElement:bt,isRTL:ME};BE=uE,_E=dE,GE=oE,UE=gE,qE=lE,WE=aE,KE=hE,zE=(e,t,n)=>{let i=new Map,r=g({platform:FE},n),s=y(g({},r.platform),{_c:i});return sE(e,t,y(g({},r),{platform:s}))};br=e=>({variable:e,reference:`var(${e})`}),Jt={arrowSize:br("--arrow-size"),arrowSizeHalf:br("--arrow-size-half"),arrowBg:br("--arrow-background"),transformOrigin:br("--transform-origin"),arrowOffset:br("--arrow-offset")},XE=e=>e==="top"||e==="bottom"?"y":"x";JE={name:"rects",fn({rects:e}){return{data:e}}},QE=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};let{x:i,y:r}=n.arrow,s=t.split("-")[0];return Object.assign(e.style,{left:i!=null?`${i}px`:"",top:r!=null?`${r}px`:"",[s]:`calc(100% + ${Jt.arrowOffset.reference})`}),{}}}};tI={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};uI={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"}});function dI(e){let t={each(n){var i;for(let r=0;r<((i=e.frames)==null?void 0:i.length);r+=1){let s=e.frames[r];s&&n(s)}},addEventListener(n,i,r){return t.each(s=>{try{s.document.addEventListener(n,i,r)}catch(a){}}),()=>{try{t.removeEventListener(n,i,r)}catch(s){}}},removeEventListener(n,i,r){t.each(s=>{try{s.document.removeEventListener(n,i,r)}catch(a){}})}};return t}function hI(e){let t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,i,r)=>{try{t==null||t.addEventListener(n,i,r)}catch(s){}return()=>{try{t==null||t.removeEventListener(n,i,r)}catch(s){}}},removeEventListener:(n,i,r)=>{try{t==null||t.removeEventListener(n,i,r)}catch(s){}}}}function gI(e){for(let t of e)if(le(t)&&Ye(t))return!0;return!1}function pI(e,t){if(!_d(t)||!e)return!1;let n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function fI(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Hd(e,t){if(!t||!_d(e))return!1;let n=t.scrollHeight>t.clientHeight,i=n&&e.clientX>t.offsetLeft+t.clientWidth,r=t.scrollWidth>t.clientWidth,s=r&&e.clientY>t.offsetTop+t.clientHeight,a={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(r?16:0)},o={x:e.clientX,y:e.clientY};return fI(a,o)?i||s:!1}function mI(e,t){let{exclude:n,onFocusOutside:i,onPointerDownOutside:r,onInteractOutside:s,defer:a,followControlledElements:o=!0}=t;if(!e)return;let l=Le(e),c=ue(e),u=dI(c),h=hI(c);function m(b,f){if(!le(f)||!f.isConnected||ce(e,f)||pI(e,b)||o&&as(e,f))return!1;let S=l.querySelector(`[aria-controls="${e.id}"]`);if(S){let V=gs(S);if(Hd(b,V))return!1}let P=gs(e);return Hd(b,P)?!1:!(n!=null&&n(f))}let d=new Set,p=Ln(e==null?void 0:e.getRootNode());function v(b){function f(S){var x,k;let P=a&&!Ja()?H:N=>N(),V=S!=null?S:b,A=(k=(x=V==null?void 0:V.composedPath)==null?void 0:x.call(V))!=null?k:[V==null?void 0:V.target];P(()=>{let N=p?A[0]:j(b);if(!(!e||!m(b,N))){if(r||s){let D=At(r,s);e.addEventListener(Fd,D,{once:!0})}Bd(e,Fd,{bubbles:!1,cancelable:!0,detail:{originalEvent:V,contextmenu:hi(V),focusable:gI(A),target:N}})}})}b.pointerType==="touch"?(d.forEach(S=>S()),d.add(ee(l,"click",f,{once:!0})),d.add(h.addEventListener("click",f,{once:!0})),d.add(u.addEventListener("click",f,{once:!0}))):f()}let I=new Set,T=setTimeout(()=>{I.add(ee(l,"pointerdown",v,!0)),I.add(h.addEventListener("pointerdown",v,!0)),I.add(u.addEventListener("pointerdown",v,!0))},0);function w(b){(a?H:S=>S())(()=>{var V,A;let S=(A=(V=b==null?void 0:b.composedPath)==null?void 0:V.call(b))!=null?A:[b==null?void 0:b.target],P=p?S[0]:j(b);if(!(!e||!m(b,P))){if(i||s){let x=At(i,s);e.addEventListener($d,x,{once:!0})}Bd(e,$d,{bubbles:!1,cancelable:!0,detail:{originalEvent:b,contextmenu:!1,focusable:Ye(P),target:P}})}})}return Ja()||(I.add(ee(l,"focusin",w,!0)),I.add(h.addEventListener("focusin",w,!0)),I.add(u.addEventListener("focusin",w,!0))),()=>{clearTimeout(T),d.forEach(b=>b()),I.forEach(b=>b())}}function Ws(e,t){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=typeof e=="function"?e():e;r.push(mI(s,t))})),()=>{r.forEach(s=>s==null?void 0:s())}}function Bd(e,t,n){let i=e.ownerDocument.defaultView||window,r=new i.CustomEvent(t,n);return e.dispatchEvent(r)}var Fd,$d,_d,tn=re(()=>{"use strict";se();Fd="pointerdown.outside",$d="focus.outside";_d=e=>"clientY"in e});function vI(e,t){let n=i=>{i.key==="Escape"&&(i.isComposing||t==null||t(i))};return ee(Le(e),"keydown",n,{capture:!0})}function yI(e,t,n){let i=e.ownerDocument.defaultView||window,r=new i.CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(r)}function bI(e,t,n){e.addEventListener(t,n,{once:!0})}function qd(){We.layers.forEach(({node:e})=>{e.style.pointerEvents=We.isBelowPointerBlockingLayer(e)?"none":"auto"})}function EI(e){e.style.pointerEvents=""}function II(e,t){let n=Le(e),i=[];return We.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Ud=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),t==null||t.forEach(r=>{let[s,a]=Hc(()=>{let o=r();return le(o)?o:null},{timeout:1e3});s.then(o=>i.push(Hn(o,{pointerEvents:"auto"}))),i.push(a)}),()=>{We.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Ud,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),i.forEach(r=>r()))}}function PI(e,t){let{warnOnMissingNode:n=!0}=t;if(n&&!e){zt("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!e)return;let{onDismiss:i,onRequestDismiss:r,pointerBlocking:s,exclude:a,debug:o,type:l="dialog"}=t,c={dismiss:i,node:e,type:l,pointerBlocking:s,requestDismiss:r};We.add(c),qd();function u(v){var T,w;let I=j(v.detail.originalEvent);We.isBelowPointerBlockingLayer(e)||We.isInBranch(I)||((T=t.onPointerDownOutside)==null||T.call(t,v),(w=t.onInteractOutside)==null||w.call(t,v),!v.defaultPrevented&&(o&&console.log("onPointerDownOutside:",v.detail.originalEvent),i==null||i()))}function h(v){var T,w;let I=j(v.detail.originalEvent);We.isInBranch(I)||((T=t.onFocusOutside)==null||T.call(t,v),(w=t.onInteractOutside)==null||w.call(t,v),!v.defaultPrevented&&(o&&console.log("onFocusOutside:",v.detail.originalEvent),i==null||i()))}function m(v){var I;We.isTopMost(e)&&((I=t.onEscapeKeyDown)==null||I.call(t,v),!v.defaultPrevented&&i&&(v.preventDefault(),i()))}function d(v){var b;if(!e)return!1;let I=typeof a=="function"?a():a,T=Array.isArray(I)?I:[I],w=(b=t.persistentElements)==null?void 0:b.map(f=>f()).filter(le);return w&&T.push(...w),T.some(f=>ce(f,v))||We.isInNestedLayer(e,v)}let p=[s?II(e,t.persistentElements):void 0,vI(e,m),Ws(e,{exclude:d,onFocusOutside:h,onPointerDownOutside:u,defer:t.defer})];return()=>{We.remove(e),qd(),EI(e),p.forEach(v=>v==null?void 0:v())}}function Ft(e,t){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=Wt(e)?e():e;r.push(PI(s,t))})),()=>{r.forEach(s=>s==null?void 0:s())}}function Wd(e,t={}){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=Wt(e)?e():e;if(!s){zt("[@zag-js/dismissable] branch node is `null` or `undefined`");return}We.addBranch(s),r.push(()=>{We.removeBranch(s)})})),()=>{r.forEach(s=>s==null?void 0:s())}}var Gd,We,Ud,Wn=re(()=>{"use strict";tn();se();Gd="layer:request-dismiss",We={layers:[],branches:[],recentlyRemoved:new Set,count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){var i;let t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf((i=this.topMostPointerBlockingLayer())==null?void 0:i.node):-1;return tt.type===e)},getNestedLayersByType(e,t){let n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(i=>i.type===t)},getParentLayerOfType(e,t){let n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(i=>i.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(i=>ce(i.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>ce(t,e))},add(e){this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){let t=this.indexOf(e);t<0||(this.recentlyRemoved.add(e),$n(()=>this.recentlyRemoved.delete(e)),tWe.dismiss(i.node,e)),this.layers.splice(t,1),this.syncLayers())},removeBranch(e){let t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{e.node.style.setProperty("--layer-index",`${t}`),e.node.removeAttribute("data-nested"),e.node.removeAttribute("data-has-nested"),this.getParentLayerOfType(e.node,e.type)&&e.node.setAttribute("data-nested",e.type);let i=this.countNestedLayersOfType(e.node,e.type);i>0&&e.node.setAttribute("data-has-nested",e.type),e.node.style.setProperty("--nested-layer-count",`${i}`)})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){let n=this.indexOf(e);if(n===-1)return;let i=this.layers[n];bI(e,Gd,r=>{var s;(s=i.requestDismiss)==null||s.call(i,r),r.defaultPrevented||i==null||i.dismiss()}),yI(e,Gd,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}}});var nh={};he(nh,{Combobox:()=>BI});function VI(e,t){let{context:n,prop:i,state:r,send:s,scope:a,computed:o,event:l}=e,c=i("translations"),u=i("collection"),h=!!i("disabled"),m=o("isInteractive"),d=!!i("invalid"),p=!!i("required"),v=!!i("readOnly"),I=r.hasTag("open"),T=r.hasTag("focused"),w=i("composite"),b=n.get("highlightedValue"),f=On(y(g({},i("positioning")),{placement:n.get("currentPlacement")}));function S(P){let V=u.getItemDisabled(P.item),A=u.getItemValue(P.item);return vn(A,()=>`[zag-js] No value found for item ${JSON.stringify(P.item)}`),{value:A,disabled:!!(V||V),highlighted:b===A,selected:n.get("value").includes(A)}}return{focused:T,open:I,inputValue:n.get("inputValue"),highlightedValue:b,highlightedItem:n.get("highlightedItem"),value:n.get("value"),valueAsString:o("valueAsString"),hasSelectedItems:o("hasSelectedItems"),selectedItems:n.get("selectedItems"),collection:i("collection"),multiple:!!i("multiple"),disabled:!!h,syncSelectedItems(){s({type:"SELECTED_ITEMS.SYNC"})},reposition(P={}){s({type:"POSITIONING.SET",options:P})},setHighlightValue(P){s({type:"HIGHLIGHTED_VALUE.SET",value:P})},clearHighlightValue(){s({type:"HIGHLIGHTED_VALUE.CLEAR"})},selectValue(P){s({type:"ITEM.SELECT",value:P})},setValue(P){s({type:"VALUE.SET",value:P})},setInputValue(P,V="script"){s({type:"INPUT_VALUE.SET",value:P,src:V})},clearValue(P){P!=null?s({type:"ITEM.CLEAR",value:P}):s({type:"VALUE.CLEAR"})},focus(){var P;(P=zn(a))==null||P.focus()},setOpen(P,V="script"){r.hasTag("open")!==P&&s({type:P?"OPEN":"CLOSE",src:V})},getRootProps(){return t.element(y(g({},Ke.root.attrs),{dir:i("dir"),id:SI(a),"data-invalid":E(d),"data-readonly":E(v)}))},getLabelProps(){return t.label(y(g({},Ke.label.attrs),{dir:i("dir"),htmlFor:Ks(a),id:Go(a),"data-readonly":E(v),"data-disabled":E(h),"data-invalid":E(d),"data-required":E(p),"data-focus":E(T),onClick(P){var V;w||(P.preventDefault(),(V=Cr(a))==null||V.focus({preventScroll:!0}))}}))},getControlProps(){return t.element(y(g({},Ke.control.attrs),{dir:i("dir"),id:Jd(a),"data-state":I?"open":"closed","data-focus":E(T),"data-disabled":E(h),"data-invalid":E(d)}))},getPositionerProps(){return t.element(y(g({},Ke.positioner.attrs),{dir:i("dir"),id:Qd(a),style:f.floating}))},getInputProps(){return t.input(y(g({},Ke.input.attrs),{dir:i("dir"),"aria-invalid":X(d),"data-invalid":E(d),"data-autofocus":E(i("autoFocus")),name:i("name"),form:i("form"),disabled:h,required:i("required"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:"false",readOnly:v,placeholder:i("placeholder"),id:Ks(a),type:"text",role:"combobox",defaultValue:n.get("inputValue"),"aria-autocomplete":o("autoComplete")?"both":"list","aria-controls":zs(a),"aria-expanded":I,"data-state":I?"open":"closed","aria-activedescendant":b?zd(a,b):void 0,onClick(P){P.defaultPrevented||i("openOnClick")&&m&&s({type:"INPUT.CLICK",src:"input-click"})},onFocus(){h||s({type:"INPUT.FOCUS"})},onBlur(){h||s({type:"INPUT.BLUR"})},onChange(P){s({type:"INPUT.CHANGE",value:P.currentTarget.value,src:"input-change"})},onKeyDown(P){if(P.defaultPrevented||!m||P.ctrlKey||P.shiftKey||Re(P))return;let V=i("openOnKeyPress"),A=P.ctrlKey||P.metaKey||P.shiftKey,x=!0,k={ArrowDown($){!V&&!I||(s({type:$.altKey?"OPEN":"INPUT.ARROW_DOWN",keypress:x,src:"arrow-key"}),$.preventDefault())},ArrowUp(){!V&&!I||(s({type:P.altKey?"CLOSE":"INPUT.ARROW_UP",keypress:x,src:"arrow-key"}),P.preventDefault())},Home($){A||(s({type:"INPUT.HOME",keypress:x}),I&&$.preventDefault())},End($){A||(s({type:"INPUT.END",keypress:x}),I&&$.preventDefault())},Enter($){var Se;s({type:"INPUT.ENTER",keypress:x,src:"item-select"});let te=o("isCustomValue")&&i("allowCustomValue"),J=b!=null,ie=i("alwaysSubmitOnEnter");if(I&&!te&&!ie&&J&&$.preventDefault(),b==null)return;let Q=Ni(a,b);st(Q)&&((Se=i("navigate"))==null||Se({value:b,node:Q,href:Q.href}))},Escape(){s({type:"INPUT.ESCAPE",keypress:x,src:"escape-key"}),P.preventDefault()}},N=ge(P,{dir:i("dir")}),D=k[N];D==null||D(P)}}))},getTriggerProps(P={}){return t.button(y(g({},Ke.trigger.attrs),{dir:i("dir"),id:eh(a),"aria-haspopup":w?"listbox":"dialog",type:"button",tabIndex:P.focusable?void 0:-1,"aria-label":c.triggerLabel,"aria-expanded":I,"data-state":I?"open":"closed","aria-controls":I?zs(a):void 0,disabled:h,"data-invalid":E(d),"data-focusable":E(P.focusable),"data-readonly":E(v),"data-disabled":E(h),onFocus(){P.focusable&&s({type:"INPUT.FOCUS",src:"trigger"})},onClick(V){V.defaultPrevented||m&&pe(V)&&s({type:"TRIGGER.CLICK",src:"trigger-click"})},onPointerDown(V){m&&V.pointerType!=="touch"&&pe(V)&&(V.preventDefault(),queueMicrotask(()=>{var A;(A=zn(a))==null||A.focus({preventScroll:!0})}))},onKeyDown(V){if(V.defaultPrevented||w)return;let A={ArrowDown(){s({type:"INPUT.ARROW_DOWN",src:"arrow-key"})},ArrowUp(){s({type:"INPUT.ARROW_UP",src:"arrow-key"})}},x=ge(V,{dir:i("dir")}),k=A[x];k&&(k(V),V.preventDefault())}}))},getContentProps(){return t.element(y(g({},Ke.content.attrs),{dir:i("dir"),id:zs(a),role:w?"listbox":"dialog",tabIndex:-1,hidden:!I,"data-state":I?"open":"closed","data-placement":n.get("currentPlacement"),"aria-labelledby":Go(a),"aria-multiselectable":i("multiple")&&w?!0:void 0,"data-empty":E(u.size===0),onPointerDown(P){pe(P)&&P.preventDefault()}}))},getListProps(){return t.element(y(g({},Ke.list.attrs),{role:w?void 0:"listbox","data-empty":E(u.size===0),"aria-labelledby":Go(a),"aria-multiselectable":i("multiple")&&!w?!0:void 0}))},getClearTriggerProps(){return t.button(y(g({},Ke.clearTrigger.attrs),{dir:i("dir"),id:th(a),type:"button",tabIndex:-1,disabled:h,"data-invalid":E(d),"aria-label":c.clearTriggerLabel,"aria-controls":Ks(a),hidden:!n.get("value").length,onPointerDown(P){pe(P)&&P.preventDefault()},onClick(P){P.defaultPrevented||m&&s({type:"VALUE.CLEAR",src:"clear-trigger"})}}))},getItemState:S,getItemProps(P){let V=S(P),A=V.value;return t.element(y(g({},Ke.item.attrs),{dir:i("dir"),id:zd(a,A),role:"option",tabIndex:-1,"data-highlighted":E(V.highlighted),"data-state":V.selected?"checked":"unchecked","aria-selected":X(V.highlighted),"aria-disabled":X(V.disabled),"data-disabled":E(V.disabled),"data-value":V.value,onPointerMove(){V.disabled||V.highlighted||s({type:"ITEM.POINTER_MOVE",value:A})},onPointerLeave(){if(P.persistFocus||V.disabled)return;let x=l.previous();x!=null&&x.type.includes("POINTER")&&s({type:"ITEM.POINTER_LEAVE",value:A})},onClick(x){rr(x)||Fn(x)||hi(x)||V.disabled||s({type:"ITEM.CLICK",src:"item-select",value:A})}}))},getItemTextProps(P){let V=S(P);return t.element(y(g({},Ke.itemText.attrs),{dir:i("dir"),"data-state":V.selected?"checked":"unchecked","data-disabled":E(V.disabled),"data-highlighted":E(V.highlighted)}))},getItemIndicatorProps(P){let V=S(P);return t.element(y(g({"aria-hidden":!0},Ke.itemIndicator.attrs),{dir:i("dir"),"data-state":V.selected?"checked":"unchecked",hidden:!V.selected}))},getItemGroupProps(P){let{id:V}=P;return t.element(y(g({},Ke.itemGroup.attrs),{dir:i("dir"),id:TI(a,V),"aria-labelledby":Kd(a,V),"data-empty":E(u.size===0),role:"group"}))},getItemGroupLabelProps(P){let{htmlFor:V}=P;return t.element(y(g({},Ke.itemGroupLabel.attrs),{dir:i("dir"),id:Kd(a,V),role:"presentation"}))}}}function Zd(e){return(e.previousEvent||e).src}function $I(e){return e.replace(/_([a-z])/g,(t,n)=>n.toUpperCase())}function HI(e){let t={};for(let[n,i]of Object.entries(e)){let r=$I(n);t[r]=i}return t}var CI,Ke,Ys,SI,Go,Jd,Ks,zs,Qd,eh,th,TI,Kd,zd,Kn,zn,Yd,jd,Cr,OI,Ni,Xd,wI,xI,AI,kI,we,tt,NI,RI,ux,DI,dx,LI,hx,MI,gx,FI,BI,ih=re(()=>{"use strict";yr();Pr();Wn();tn();se();CI=U("combobox").parts("root","clearTrigger","content","control","input","item","itemGroup","itemGroupLabel","itemIndicator","itemText","label","list","positioner","trigger"),Ke=CI.build(),Ys=e=>new Nt(e);Ys.empty=()=>new Nt({items:[]});SI=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`combobox:${e.id}`},Go=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`combobox:${e.id}:label`},Jd=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`combobox:${e.id}:control`},Ks=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`combobox:${e.id}:input`},zs=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`combobox:${e.id}:content`},Qd=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`combobox:${e.id}:popper`},eh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`combobox:${e.id}:toggle-btn`},th=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`combobox:${e.id}:clear-btn`},TI=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:i.call(n,t))!=null?r:`combobox:${e.id}:optgroup:${t}`},Kd=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:i.call(n,t))!=null?r:`combobox:${e.id}:optgroup-label:${t}`},zd=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`combobox:${e.id}:option:${t}`},Kn=e=>e.getById(zs(e)),zn=e=>e.getById(Ks(e)),Yd=e=>e.getById(Qd(e)),jd=e=>e.getById(Jd(e)),Cr=e=>e.getById(eh(e)),OI=e=>e.getById(th(e)),Ni=(e,t)=>{if(t==null)return null;let n=`[role=option][data-value="${CSS.escape(t)}"]`;return vi(Kn(e),n)},Xd=e=>{let t=zn(e);e.isActiveElement(t)||t==null||t.focus({preventScroll:!0})},wI=e=>{let t=Cr(e);e.isActiveElement(t)||t==null||t.focus({preventScroll:!0})};({guards:xI,createMachine:AI,choose:kI}=ut()),{and:we,not:tt}=xI,NI=AI({props({props:e}){return y(g({loopFocus:!0,openOnClick:!1,defaultValue:[],defaultInputValue:"",closeOnSelect:!e.multiple,allowCustomValue:!1,alwaysSubmitOnEnter:!1,inputBehavior:"none",selectionBehavior:e.multiple?"clear":"replace",openOnKeyPress:!0,openOnChange:!0,composite:!0,navigate({node:t}){mi(t)},collection:Ys.empty()},e),{positioning:g({placement:"bottom",sameWidth:!0},e.positioning),translations:g({triggerLabel:"Toggle suggestions",clearTriggerLabel:"Clear value"},e.translations)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"suggesting":"idle"},context({prop:e,bindable:t,getContext:n,getEvent:i}){return{currentPlacement:t(()=>({defaultValue:void 0})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:fe,hash(r){return r.join(",")},onChange(r){var c;let s=n(),a=s.get("selectedItems"),o=e("collection"),l=r.map(u=>a.find(m=>o.getItemValue(m)===u)||o.find(u));s.set("selectedItems",l),(c=e("onValueChange"))==null||c({value:r,items:l})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(r){var a;let s=e("collection").find(r);(a=e("onHighlightChange"))==null||a({highlightedValue:r,highlightedItem:s})}})),inputValue:t(()=>{let r=e("inputValue")||e("defaultInputValue"),s=e("value")||e("defaultValue");if(!r.trim()&&!e("multiple")){let a=e("collection").stringifyMany(s);r=Ce(e("selectionBehavior"),{preserve:r||a,replace:a,clear:""})}return{defaultValue:r,value:e("inputValue"),onChange(a){var c;let o=i(),l=(o.previousEvent||o).src;(c=e("onInputValueChange"))==null||c({inputValue:a,reason:l})}}}),highlightedItem:t(()=>{let r=e("highlightedValue");return{defaultValue:e("collection").find(r)}}),selectedItems:t(()=>{let r=e("value")||e("defaultValue")||[];return{defaultValue:e("collection").findMany(r)}})}},computed:{isInputValueEmpty:({context:e})=>e.get("inputValue").length===0,isInteractive:({prop:e})=>!(e("readOnly")||e("disabled")),autoComplete:({prop:e})=>e("inputBehavior")==="autocomplete",autoHighlight:({prop:e})=>e("inputBehavior")==="autohighlight",hasSelectedItems:({context:e})=>e.get("value").length>0,valueAsString:({context:e,prop:t})=>t("collection").stringifyItems(e.get("selectedItems")),isCustomValue:({context:e,computed:t})=>e.get("inputValue")!==t("valueAsString")},watch({context:e,prop:t,track:n,action:i,send:r}){n([()=>e.hash("value")],()=>{i(["syncSelectedItems"])}),n([()=>e.get("inputValue")],()=>{i(["syncInputValue"])}),n([()=>e.get("highlightedValue")],()=>{i(["syncHighlightedItem","autofillInputValue"])}),n([()=>t("open")],()=>{i(["toggleVisibility"])}),n([()=>t("collection").toString()],()=>{r({type:"CHILDREN_CHANGE"})})},on:{"SELECTED_ITEMS.SYNC":{actions:["syncSelectedItems"]},"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedValue"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedValue"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setValue"]},"INPUT_VALUE.SET":{actions:["setInputValue"]},"POSITIONING.SET":{actions:["reposition"]}},entry:kI([{guard:"autoFocus",actions:["setInitialFocus"]}]),states:{idle:{tags:["idle","closed"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":{target:"interacting"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{target:"focused",actions:["clearInputValue","clearSelectedItems","setInitialFocus"]}}},focused:{tags:["focused","closed"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":[{guard:"isChangeEvent",target:"suggesting"},{target:"interacting"}],"INPUT.CHANGE":[{guard:we("isOpenControlled","openOnChange"),actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{guard:"openOnChange",target:"suggesting",actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{actions:["setInputValue"]}],"LAYER.INTERACT_OUTSIDE":{target:"idle"},"INPUT.ESCAPE":{guard:we("isCustomValue",tt("allowCustomValue")),actions:["revertInputValue"]},"INPUT.BLUR":{target:"idle"},"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_DOWN":[{guard:we("isOpenControlled","autoComplete"),actions:["invokeOnOpen"]},{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{guard:"isOpenControlled",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_UP":[{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{target:"interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{actions:["clearInputValue","clearSelectedItems"]}}},interacting:{tags:["open","focused"],entry:["setInitialFocus"],effects:["scrollToHighlightedItem","trackDismissableLayer","trackPlacement"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["setFinalFocus"]},{target:"idle"}],CHILDREN_CHANGE:[{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{actions:["scrollToHighlightedItem"]}],"INPUT.HOME":{actions:["highlightFirstItem"]},"INPUT.END":{actions:["highlightLastItem"]},"INPUT.ARROW_DOWN":[{guard:we("autoComplete","isLastItemHighlighted"),actions:["clearHighlightedValue","scrollContentToTop"]},{actions:["highlightNextItem"]}],"INPUT.ARROW_UP":[{guard:we("autoComplete","isFirstItemHighlighted"),actions:["clearHighlightedValue"]},{actions:["highlightPrevItem"]}],"INPUT.ENTER":[{guard:we("isOpenControlled","isCustomValue",tt("hasHighlightedItem"),tt("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:we("isCustomValue",tt("hasHighlightedItem"),tt("allowCustomValue")),target:"focused",actions:["revertInputValue","invokeOnClose"]},{guard:we("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"INPUT.CHANGE":[{guard:"autoComplete",target:"suggesting",actions:["setInputValue"]},{target:"suggesting",actions:["clearHighlightedValue","setInputValue"]}],"ITEM.POINTER_MOVE":{actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"ITEM.CLICK":[{guard:we("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],"LAYER.ESCAPE":[{guard:we("isOpenControlled","autoComplete"),actions:["syncInputValue","invokeOnClose"]},{guard:"autoComplete",target:"focused",actions:["syncInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"LAYER.INTERACT_OUTSIDE":[{guard:we("isOpenControlled","isCustomValue",tt("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:we("isCustomValue",tt("allowCustomValue")),target:"idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]}},suggesting:{tags:["open","focused"],effects:["trackDismissableLayer","scrollToHighlightedItem","trackPlacement"],entry:["setInitialFocus"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["setFinalFocus"]},{target:"idle"}],CHILDREN_CHANGE:[{guard:we("isHighlightedItemRemoved","hasCollectionItems","autoHighlight"),actions:["clearHighlightedValue","highlightFirstItem"]},{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{guard:"autoHighlight",actions:["highlightFirstItem"]}],"INPUT.ARROW_DOWN":{target:"interacting",actions:["highlightNextItem"]},"INPUT.ARROW_UP":{target:"interacting",actions:["highlightPrevItem"]},"INPUT.HOME":{target:"interacting",actions:["highlightFirstItem"]},"INPUT.END":{target:"interacting",actions:["highlightLastItem"]},"INPUT.ENTER":[{guard:we("isOpenControlled","isCustomValue",tt("hasHighlightedItem"),tt("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:we("isCustomValue",tt("hasHighlightedItem"),tt("allowCustomValue")),target:"focused",actions:["revertInputValue","invokeOnClose"]},{guard:we("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"INPUT.CHANGE":{actions:["setInputValue"]},"LAYER.ESCAPE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"ITEM.POINTER_MOVE":{target:"interacting",actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"LAYER.INTERACT_OUTSIDE":[{guard:we("isOpenControlled","isCustomValue",tt("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:we("isCustomValue",tt("allowCustomValue")),target:"idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"ITEM.CLICK":[{guard:we("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]}}},implementations:{guards:{isInputValueEmpty:({computed:e})=>e("isInputValueEmpty"),autoComplete:({computed:e,prop:t})=>e("autoComplete")&&!t("multiple"),autoHighlight:({computed:e})=>e("autoHighlight"),isFirstItemHighlighted:({prop:e,context:t})=>e("collection").firstValue===t.get("highlightedValue"),isLastItemHighlighted:({prop:e,context:t})=>e("collection").lastValue===t.get("highlightedValue"),isCustomValue:({computed:e})=>e("isCustomValue"),allowCustomValue:({prop:e})=>!!e("allowCustomValue"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null,openOnChange:({prop:e,context:t})=>{let n=e("openOnChange");return Uc(n)?n:!!(n!=null&&n({inputValue:t.get("inputValue")}))},restoreFocus:({event:e})=>{var n,i;let t=(i=e.restoreFocus)!=null?i:(n=e.previousEvent)==null?void 0:n.restoreFocus;return t==null?!0:!!t},isChangeEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="INPUT.CHANGE"},autoFocus:({prop:e})=>!!e("autoFocus"),isHighlightedItemRemoved:({prop:e,context:t})=>!e("collection").has(t.get("highlightedValue")),hasCollectionItems:({prop:e})=>e("collection").size>0},effects:{trackDismissableLayer({send:e,prop:t,scope:n}){return t("disableLayer")?void 0:Ft(()=>Kn(n),{type:"listbox",defer:!0,exclude:()=>[zn(n),Cr(n),OI(n)],onFocusOutside:t("onFocusOutside"),onPointerDownOutside:t("onPointerDownOutside"),onInteractOutside:t("onInteractOutside"),onEscapeKeyDown(r){r.preventDefault(),r.stopPropagation(),e({type:"LAYER.ESCAPE",src:"escape-key"})},onDismiss(){e({type:"LAYER.INTERACT_OUTSIDE",src:"interact-outside",restoreFocus:!1})}})},trackPlacement({context:e,prop:t,scope:n}){let i=()=>jd(n)||Cr(n),r=()=>Yd(n);return e.set("currentPlacement",t("positioning").placement),It(i,r,y(g({},t("positioning")),{defer:!0,onComplete(s){e.set("currentPlacement",s.placement)}}))},scrollToHighlightedItem({context:e,prop:t,scope:n,event:i}){let r=zn(n),s=[],a=c=>{let u=i.current().type.includes("POINTER"),h=e.get("highlightedValue");if(u||!h)return;let m=Kn(n),d=t("scrollToIndexFn");if(d){let I=t("collection").indexOf(h);d({index:I,immediate:c,getElement:()=>Ni(n,h)});return}let p=Ni(n,h),v=H(()=>{Xt(p,{rootEl:m,block:"nearest"})});s.push(v)},o=H(()=>a(!0));s.push(o);let l=ot(r,{attributes:["aria-activedescendant"],callback:()=>a(!1)});return s.push(l),()=>{s.forEach(c=>c())}}},actions:{reposition({context:e,prop:t,scope:n,event:i}){It(()=>jd(n),()=>Yd(n),y(g(g({},t("positioning")),i.options),{defer:!0,listeners:!1,onComplete(a){e.set("currentPlacement",a.placement)}}))},setHighlightedValue({context:e,event:t}){t.value!=null&&e.set("highlightedValue",t.value)},clearHighlightedValue({context:e}){e.set("highlightedValue",null)},selectHighlightedItem(e){var o;let{context:t,prop:n}=e,i=n("collection"),r=t.get("highlightedValue");if(!r||!i.has(r))return;let s=n("multiple")?yt(t.get("value"),r):[r];(o=n("onSelect"))==null||o({value:s,itemValue:r}),t.set("value",s);let a=Ce(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:i.stringifyMany(s),clear:""});t.set("inputValue",a)},scrollToHighlightedItem({context:e,prop:t,scope:n}){$n(()=>{let i=e.get("highlightedValue");if(i==null)return;let r=Ni(n,i),s=Kn(n),a=t("scrollToIndexFn");if(a){let o=t("collection").indexOf(i);a({index:o,immediate:!0,getElement:()=>Ni(n,i)});return}Xt(r,{rootEl:s,block:"nearest"})})},selectItem(e){let{context:t,event:n,flush:i,prop:r}=e;n.value!=null&&i(()=>{var o;let s=r("multiple")?yt(t.get("value"),n.value):[n.value];(o=r("onSelect"))==null||o({value:s,itemValue:n.value}),t.set("value",s);let a=Ce(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany(s),clear:""});t.set("inputValue",a)})},clearItem(e){let{context:t,event:n,flush:i,prop:r}=e;n.value!=null&&i(()=>{let s=ct(t.get("value"),n.value);t.set("value",s);let a=Ce(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany(s),clear:""});t.set("inputValue",a)})},setInitialFocus({scope:e}){H(()=>{Xd(e)})},setFinalFocus({scope:e}){H(()=>{let t=Cr(e);(t==null?void 0:t.dataset.focusable)==null?Xd(e):wI(e)})},syncInputValue({context:e,scope:t,event:n}){let i=zn(t);i&&(i.value=e.get("inputValue"),queueMicrotask(()=>{n.current().type!=="INPUT.CHANGE"&&tr(i)}))},setInputValue({context:e,event:t}){e.set("inputValue",t.value)},clearInputValue({context:e}){e.set("inputValue","")},revertInputValue({context:e,prop:t,computed:n}){let i=t("selectionBehavior"),r=Ce(i,{replace:n("hasSelectedItems")?n("valueAsString"):"",preserve:e.get("inputValue"),clear:""});e.set("inputValue",r)},setValue(e){let{context:t,flush:n,event:i,prop:r}=e;n(()=>{t.set("value",i.value);let s=Ce(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany(i.value),clear:""});t.set("inputValue",s)})},clearSelectedItems(e){let{context:t,flush:n,prop:i}=e;n(()=>{t.set("value",[]);let r=Ce(i("selectionBehavior"),{preserve:t.get("inputValue"),replace:i("collection").stringifyMany([]),clear:""});t.set("inputValue",r)})},scrollContentToTop({prop:e,scope:t}){let n=e("scrollToIndexFn");if(n){let i=e("collection").firstValue;n({index:0,immediate:!0,getElement:()=>Ni(t,i)})}else{let i=Kn(t);if(!i)return;i.scrollTop=0}},invokeOnOpen({prop:e,event:t,context:n}){var r;let i=Zd(t);(r=e("onOpenChange"))==null||r({open:!0,reason:i,value:n.get("value")})},invokeOnClose({prop:e,event:t,context:n}){var r;let i=Zd(t);(r=e("onOpenChange"))==null||r({open:!1,reason:i,value:n.get("value")})},highlightFirstItem({context:e,prop:t,scope:n}){(Kn(n)?queueMicrotask:H)(()=>{let r=t("collection").firstValue;r&&e.set("highlightedValue",r)})},highlightFirstItemIfNeeded({computed:e,action:t}){e("autoHighlight")&&t(["highlightFirstItem"])},highlightLastItem({context:e,prop:t,scope:n}){(Kn(n)?queueMicrotask:H)(()=>{let r=t("collection").lastValue;r&&e.set("highlightedValue",r)})},highlightNextItem({context:e,prop:t}){let n=null,i=e.get("highlightedValue"),r=t("collection");i?(n=r.getNextValue(i),!n&&t("loopFocus")&&(n=r.firstValue)):n=r.firstValue,n&&e.set("highlightedValue",n)},highlightPrevItem({context:e,prop:t}){let n=null,i=e.get("highlightedValue"),r=t("collection");i?(n=r.getPreviousValue(i),!n&&t("loopFocus")&&(n=r.lastValue)):n=r.lastValue,n&&e.set("highlightedValue",n)},highlightFirstSelectedItem({context:e,prop:t}){H(()=>{let[n]=t("collection").sort(e.get("value"));n&&e.set("highlightedValue",n)})},highlightFirstOrSelectedItem({context:e,prop:t,computed:n}){H(()=>{let i=null;n("hasSelectedItems")?i=t("collection").sort(e.get("value"))[0]:i=t("collection").firstValue,i&&e.set("highlightedValue",i)})},highlightLastOrSelectedItem({context:e,prop:t,computed:n}){H(()=>{let i=t("collection"),r=null;n("hasSelectedItems")?r=i.sort(e.get("value"))[0]:r=i.lastValue,r&&e.set("highlightedValue",r)})},autofillInputValue({context:e,computed:t,prop:n,event:i,scope:r}){let s=zn(r),a=n("collection");if(!t("autoComplete")||!s||!i.keypress)return;let o=a.stringify(e.get("highlightedValue"));H(()=>{s.value=o||e.get("inputValue")})},syncSelectedItems(e){queueMicrotask(()=>{let{context:t,prop:n}=e,i=n("collection"),r=t.get("value"),s=r.map(o=>t.get("selectedItems").find(c=>i.getItemValue(c)===o)||i.find(o));t.set("selectedItems",s);let a=Ce(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:i.stringifyMany(r),clear:""});t.set("inputValue",a)})},syncHighlightedItem({context:e,prop:t}){let n=t("collection").find(e.get("highlightedValue"));e.set("highlightedItem",n)},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}});RI=_()(["allowCustomValue","autoFocus","closeOnSelect","collection","composite","defaultHighlightedValue","defaultInputValue","defaultOpen","defaultValue","dir","disabled","disableLayer","form","getRootNode","highlightedValue","id","ids","inputBehavior","inputValue","invalid","loopFocus","multiple","name","navigate","onFocusOutside","onHighlightChange","onInputValueChange","onInteractOutside","onOpenChange","onOpenChange","onPointerDownOutside","onSelect","onValueChange","open","openOnChange","openOnClick","openOnKeyPress","placeholder","positioning","readOnly","required","scrollToIndexFn","selectionBehavior","translations","value","alwaysSubmitOnEnter"]),ux=B(RI),DI=_()(["htmlFor"]),dx=B(DI),LI=_()(["id"]),hx=B(LI),MI=_()(["item","persistFocus"]),gx=B(MI),FI=class extends K{constructor(){super(...arguments);z(this,"options",[]);z(this,"allOptions",[]);z(this,"hasGroups",!1)}setAllOptions(t){this.allOptions=t,this.options=t}getCollection(){let t=this.options||this.allOptions||[];return this.hasGroups?Ys({items:t,itemToValue:n=>{var i;return(i=n.id)!=null?i:""},itemToString:n=>n.label,isItemDisabled:n=>{var i;return(i=n.disabled)!=null?i:!1},groupBy:n=>{var i;return(i=n.group)!=null?i:""}}):Ys({items:t,itemToValue:n=>{var i;return(i=n.id)!=null?i:""},itemToString:n=>n.label,isItemDisabled:n=>{var i;return(i=n.disabled)!=null?i:!1}})}initMachine(t){let n=this.getCollection.bind(this);return new W(NI,y(g({},t),{get collection(){return n()},onOpenChange:i=>{i.open&&(this.options=this.allOptions),t.onOpenChange&&t.onOpenChange(i)},onInputValueChange:i=>{let r=this.allOptions.filter(s=>s.label.toLowerCase().includes(i.inputValue.toLowerCase()));this.options=r.length>0?r:this.allOptions,t.onInputValueChange&&t.onInputValueChange(i)}}))}initApi(){return VI(this.machine.service,q)}renderItems(){var a,o,l;let t=this.el.querySelector('[data-scope="combobox"][data-part="content"]');if(!t)return;let n=this.el.querySelector('[data-templates="combobox"]');if(!n)return;t.querySelectorAll('[data-scope="combobox"][data-part="item"]:not([data-template])').forEach(c=>c.remove()),t.querySelectorAll('[data-scope="combobox"][data-part="item-group"]:not([data-template])').forEach(c=>c.remove());let i=this.api.collection.items,r=(l=(o=(a=this.api.collection).group)==null?void 0:o.call(a))!=null?l:[];r.some(([c])=>c!=null)?this.renderGroupedItems(t,n,r):this.renderFlatItems(t,n,i)}renderGroupedItems(t,n,i){for(let[r,s]of i){if(r==null)continue;let a=n.querySelector(`[data-scope="combobox"][data-part="item-group"][data-id="${r}"][data-template]`);if(!a)continue;let o=a.cloneNode(!0);o.removeAttribute("data-template"),this.spreadProps(o,this.api.getItemGroupProps({id:r}));let l=o.querySelector('[data-scope="combobox"][data-part="item-group-label"]');l&&this.spreadProps(l,this.api.getItemGroupLabelProps({htmlFor:r}));let c=o.querySelector('[data-scope="combobox"][data-part="item-group-content"]');if(c){c.innerHTML="";for(let u of s){let h=this.cloneItem(n,u);h&&c.appendChild(h)}t.appendChild(o)}}}renderFlatItems(t,n,i){for(let r of i){let s=this.cloneItem(n,r);s&&t.appendChild(s)}}cloneItem(t,n){let i=this.api.collection.getItemValue(n),r=t.querySelector(`[data-scope="combobox"][data-part="item"][data-value="${i}"][data-template]`);if(!r)return null;let s=r.cloneNode(!0);s.removeAttribute("data-template"),this.spreadProps(s,this.api.getItemProps({item:n}));let a=s.querySelector('[data-scope="combobox"][data-part="item-text"]');a&&(this.spreadProps(a,this.api.getItemTextProps({item:n})),a.children.length===0&&(a.textContent=n.label||""));let o=s.querySelector('[data-scope="combobox"][data-part="item-indicator"]');return o&&this.spreadProps(o,this.api.getItemIndicatorProps({item:n})),s}render(){let t=this.el.querySelector('[data-scope="combobox"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps()),["label","control","input","trigger","clear-trigger","positioner"].forEach(i=>{let r=this.el.querySelector(`[data-scope="combobox"][data-part="${i}"]`);if(!r)return;let s="get"+i.split("-").map(a=>a[0].toUpperCase()+a.slice(1)).join("")+"Props";this.spreadProps(r,this.api[s]())});let n=this.el.querySelector('[data-scope="combobox"][data-part="content"]');n&&(this.spreadProps(n,this.api.getContentProps()),this.renderItems())}};BI={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=JSON.parse(e.dataset.collection||"[]"),i=n.some(o=>o.group!==void 0),r=y(g({id:e.id},C(e,"controlled")?{value:Z(e,"value")}:{defaultValue:Z(e,"defaultValue")}),{disabled:C(e,"disabled"),placeholder:O(e,"placeholder"),alwaysSubmitOnEnter:C(e,"alwaysSubmitOnEnter"),autoFocus:C(e,"autoFocus"),closeOnSelect:C(e,"closeOnSelect"),dir:O(e,"dir",["ltr","rtl"]),inputBehavior:O(e,"inputBehavior",["autohighlight","autocomplete","none"]),loopFocus:C(e,"loopFocus"),multiple:C(e,"multiple"),invalid:C(e,"invalid"),allowCustomValue:!1,selectionBehavior:"replace",name:O(e,"name"),form:O(e,"form"),readOnly:C(e,"readOnly"),required:C(e,"required"),positioning:(()=>{let o=e.dataset.positioning;if(o)try{let l=JSON.parse(o);return HI(l)}catch(l){return}})(),onOpenChange:o=>{let l=O(e,"onOpenChange");l&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(l,{open:o.open,reason:o.reason,value:o.value,id:e.id});let c=O(e,"onOpenChangeClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:C(e,"bubble"),detail:{open:o.open,reason:o.reason,value:o.value,id:e.id}}))},onInputValueChange:o=>{let l=O(e,"onInputValueChange");l&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(l,{value:o.inputValue,reason:o.reason,id:e.id});let c=O(e,"onInputValueChangeClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:C(e,"bubble"),detail:{value:o.inputValue,reason:o.reason,id:e.id}}))},onValueChange:o=>{let l=e.querySelector('[data-scope="combobox"][data-part="value-input"]');if(l){let h=o.value.length===0?"":o.value.length===1?String(o.value[0]):o.value.map(String).join(",");l.value=h;let m=l.getAttribute("form"),d=null;m?d=document.getElementById(m):d=l.closest("form");let p=new Event("change",{bubbles:!0,cancelable:!0});l.dispatchEvent(p);let v=new Event("input",{bubbles:!0,cancelable:!0});l.dispatchEvent(v),d&&d.hasAttribute("phx-change")&&requestAnimationFrame(()=>{let I=d.querySelector("input, select, textarea");if(I){let T=new Event("change",{bubbles:!0,cancelable:!0});I.dispatchEvent(T)}else{let T=new Event("change",{bubbles:!0,cancelable:!0});d.dispatchEvent(T)}})}let c=O(e,"onValueChange");c&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(c,{value:o.value,items:o.items,id:e.id});let u=O(e,"onValueChangeClient");u&&e.dispatchEvent(new CustomEvent(u,{bubbles:C(e,"bubble"),detail:{value:o.value,items:o.items,id:e.id}}))}}),s=new FI(e,r);s.hasGroups=i,s.setAllOptions(n),s.init();let a=C(e,"controlled")?Z(e,"value"):Z(e,"defaultValue");if(a&&a.length>0){let o=n.filter(l=>{var c;return a.includes((c=l.id)!=null?c:"")});if(o.length>0){let l=o.map(c=>{var u;return(u=c.label)!=null?u:""}).join(", ");if(s.api&&typeof s.api.setInputValue=="function")s.api.setInputValue(l);else{let c=e.querySelector('[data-scope="combobox"][data-part="input"]');c&&(c.value=l)}}}this.combobox=s,this.handlers=[]},updated(){let e=JSON.parse(this.el.dataset.collection||"[]"),t=e.some(n=>n.group!==void 0);if(this.combobox){this.combobox.hasGroups=t,this.combobox.setAllOptions(e),this.combobox.updateProps(y(g({},C(this.el,"controlled")?{value:Z(this.el,"value")}:{defaultValue:Z(this.el,"defaultValue")}),{name:O(this.el,"name"),form:O(this.el,"form"),disabled:C(this.el,"disabled"),multiple:C(this.el,"multiple"),dir:O(this.el,"dir",["ltr","rtl"]),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly")}));let n=this.el.querySelector('[data-scope="combobox"][data-part="input"]');n&&(n.removeAttribute("name"),n.removeAttribute("form"),n.name="")}},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.combobox)==null||e.destroy()}}});var eg={};he(eg,{DatePicker:()=>kC});function Uo(e,t){return e-t*Math.floor(e/t)}function js(e,t,n,i){t=al(e,t);let r=t-1,s=-2;return n<=2?s=0:na(t)&&(s=-1),bh-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+s+i)}function na(e){return e%4===0&&(e%100!==0||e%400===0)}function al(e,t){return e==="BC"?1-t:t}function _I(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}function Zn(e,t){return t=it(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function qI(e,t){return t=it(t,e.calendar),e=rn(e),t=rn(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function WI(e,t){return t=it(t,e.calendar),e=Or(e),t=Or(t),e.era===t.era&&e.year===t.year}function KI(e,t){return aa(e.calendar,t.calendar)&&Zn(e,t)}function zI(e,t){return aa(e.calendar,t.calendar)&&qI(e,t)}function YI(e,t){return aa(e.calendar,t.calendar)&&WI(e,t)}function aa(e,t){var n,i,r,s;return(s=(r=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,t))!==null&&r!==void 0?r:(i=t.isEqual)===null||i===void 0?void 0:i.call(t,e))!==null&&s!==void 0?s:e.identifier===t.identifier}function jI(e,t){return Zn(e,oa(t))}function Eh(e,t,n){let i=e.calendar.toJulianDay(e),r=n?XI[n]:QI(t),s=Math.ceil(i+1-r)%7;return s<0&&(s+=7),s}function Ih(e){return sn(Date.now(),e)}function oa(e){return Yn(Ih(e))}function Ph(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function ZI(e,t){return rh(e)-rh(t)}function rh(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}function ol(){return qo==null&&(qo=new Intl.DateTimeFormat().resolvedOptions().timeZone),qo}function rn(e){return e.subtract({days:e.day-1})}function Zo(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function Or(e){return rn(e.subtract({months:e.month-1}))}function JI(e){return Zo(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function wr(e,t,n){let i=Eh(e,t,n);return e.subtract({days:i})}function sh(e,t,n){return wr(e,t,n).add({days:6})}function Ch(e){if(Intl.Locale){let n=ah.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&ah.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function QI(e){let t=Wo.get(e);if(!t){if(Intl.Locale){let i=new Intl.Locale(e);if("getWeekInfo"in i&&(t=i.getWeekInfo(),t))return Wo.set(e,t),t.firstDay}let n=Ch(e);if(e.includes("-fw-")){let i=e.split("-fw-")[1].split("-")[0];i==="mon"?t={firstDay:1}:i==="tue"?t={firstDay:2}:i==="wed"?t={firstDay:3}:i==="thu"?t={firstDay:4}:i==="fri"?t={firstDay:5}:i==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:n&&UI[n]||0};Wo.set(e,t)}return t.firstDay}function eP(e,t,n){let i=e.calendar.getDaysInMonth(e);return Math.ceil((Eh(rn(e),t,n)+i)/7)}function Sh(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function Th(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}function nP(e,t){let n=e.calendar.toJulianDay(e),i=Math.ceil(n+1)%7;i<0&&(i+=7);let r=Ch(t),[s,a]=tP[r]||[6,0];return i===s||i===a}function Fi(e){e=it(e,new Mi);let t=al(e.era,e.year);return Oh(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Oh(e,t,n,i,r,s,a){let o=new Date;return o.setUTCHours(i,r,s,a),o.setUTCFullYear(e,t-1,n),o.getTime()}function Jo(e,t){if(t==="UTC")return 0;if(e>0&&t===ol())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:i,day:r,hour:s,minute:a,second:o}=wh(e,t);return Oh(n,i,r,s,a,o,0)-Math.floor(e/1e3)*1e3}function wh(e,t){let n=oh.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),oh.set(t,n));let i=n.formatToParts(new Date(e)),r={};for(let s of i)s.type!=="literal"&&(r[s.type]=s.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}function iP(e,t,n,i){return(n===i?[n]:[n,i]).filter(s=>rP(e,t,s))}function rP(e,t,n){let i=wh(n,t);return e.year===i.year&&e.month===i.month&&e.day===i.day&&e.hour===i.hour&&e.minute===i.minute&&e.second===i.second}function nn(e,t,n="compatible"){let i=jn(e);if(t==="UTC")return Fi(i);if(t===ol()&&n==="compatible"){i=it(i,new Mi);let l=new Date,c=al(i.era,i.year);return l.setFullYear(c,i.month-1,i.day),l.setHours(i.hour,i.minute,i.second,i.millisecond),l.getTime()}let r=Fi(i),s=Jo(r-lh,t),a=Jo(r+lh,t),o=iP(i,t,r-s,r-a);if(o.length===1)return o[0];if(o.length>1)switch(n){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-s,r-a);case"compatible":case"later":return Math.max(r-s,r-a);case"reject":throw new RangeError("No such absolute time found")}}function Vh(e,t,n="compatible"){return new Date(nn(e,t,n))}function sn(e,t){let n=Jo(e,t),i=new Date(e+n),r=i.getUTCFullYear(),s=i.getUTCMonth()+1,a=i.getUTCDate(),o=i.getUTCHours(),l=i.getUTCMinutes(),c=i.getUTCSeconds(),u=i.getUTCMilliseconds();return new Mh(r<1?"BC":"AD",r<1?-r+1:r,s,a,t,n,o,l,c,u)}function Yn(e){return new $i(e.calendar,e.era,e.year,e.month,e.day)}function jn(e,t){let n=0,i=0,r=0,s=0;if("timeZone"in e)({hour:n,minute:i,second:r,millisecond:s}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:i,second:r,millisecond:s}=t),new TP(e.calendar,e.era,e.year,e.month,e.day,n,i,r,s)}function it(e,t){if(aa(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),i=e.copy();return i.calendar=t,i.era=n.era,i.year=n.year,i.month=n.month,i.day=n.day,Xn(i),i}function sP(e,t,n){if(e instanceof Mh)return e.timeZone===t?e:oP(e,t);let i=nn(e,t,n);return sn(i,t)}function aP(e){let t=Fi(e)-e.offset;return new Date(t)}function oP(e,t){let n=Fi(e)-e.offset;return it(sn(n,t),e.calendar)}function la(e,t){let n=e.copy(),i="hour"in n?dP(n,t):0;Qo(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,el(n),xh(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=i,lP(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){var s,a;let l=(s=(a=n.calendar).isInverseEra)===null||s===void 0?void 0:s.call(a,n);n.year=r,n.month=l?1:n.calendar.getMonthsInYear(n),n.day=l?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let o=n.calendar.getMonthsInYear(n);return n.month>o&&(n.month=o,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function Qo(e,t){var n,i;!((n=(i=e.calendar).isInverseEra)===null||n===void 0)&&n.call(i,e)&&(t=-t),e.year+=t}function el(e){for(;e.month<1;)Qo(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Qo(e,1)}function lP(e){for(;e.day<1;)e.month--,el(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,el(e)}function xh(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Xn(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),xh(e)}function Ah(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function kh(e,t){return la(e,Ah(t))}function ll(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),Xn(n),n}function sa(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),uP(n),n}function cP(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Xs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Xs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Xs(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Xs(e.hour,24),t}function uP(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Xs(e,t){let n=e%t;return n<0&&(n+=t),n}function dP(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,cP(e)}function cl(e,t,n,i){let r=e.copy();switch(t){case"era":{let o=e.calendar.getEras(),l=o.indexOf(e.era);if(l<0)throw new Error("Invalid era: "+e.era);l=an(l,n,0,o.length-1,i==null?void 0:i.round),r.era=o[l],Xn(r);break}case"year":var s,a;!((s=(a=r.calendar).isInverseEra)===null||s===void 0)&&s.call(a,r)&&(n=-n),r.year=an(e.year,n,-1/0,9999,i==null?void 0:i.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=an(e.month,n,1,e.calendar.getMonthsInYear(e),i==null?void 0:i.round);break;case"day":r.day=an(e.day,n,1,e.calendar.getDaysInMonth(e),i==null?void 0:i.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Xn(r),r}function Nh(e,t,n,i){let r=e.copy();switch(t){case"hour":{let s=e.hour,a=0,o=23;if((i==null?void 0:i.hourCycle)===12){let l=s>=12;a=l?12:0,o=l?23:11}r.hour=an(s,n,a,o,i==null?void 0:i.round);break}case"minute":r.minute=an(e.minute,n,0,59,i==null?void 0:i.round);break;case"second":r.second=an(e.second,n,0,59,i==null?void 0:i.round);break;case"millisecond":r.millisecond=an(e.millisecond,n,0,999,i==null?void 0:i.round);break;default:throw new Error("Unsupported field "+t)}return r}function an(e,t,n,i,r=!1){if(r){e+=Math.sign(t),e0?e=Math.ceil(e/s)*s:e=Math.floor(e/s)*s,e>i&&(e=n)}else e+=t,ei&&(e=n+(e-i-1));return e}function Rh(e,t){let n;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let r=la(jn(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=nn(r,e.timeZone)}else n=Fi(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let i=sn(n,e.timeZone);return it(i,e.calendar)}function hP(e,t){return Rh(e,Ah(t))}function gP(e,t,n,i){switch(t){case"hour":{let r=0,s=23;if((i==null?void 0:i.hourCycle)===12){let p=e.hour>=12;r=p?12:0,s=p?23:11}let a=jn(e),o=it(sa(a,{hour:r}),new Mi),l=[nn(o,e.timeZone,"earlier"),nn(o,e.timeZone,"later")].filter(p=>sn(p,e.timeZone).day===o.day)[0],c=it(sa(a,{hour:s}),new Mi),u=[nn(c,e.timeZone,"earlier"),nn(c,e.timeZone,"later")].filter(p=>sn(p,e.timeZone).day===c.day).pop(),h=Fi(e)-e.offset,m=Math.floor(h/Sr),d=h%Sr;return h=an(m,n,Math.floor(l/Sr),Math.floor(u/Sr),i==null?void 0:i.round)*Sr+d,it(sn(h,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return Nh(e,t,n,i);case"era":case"year":case"month":case"day":{let r=cl(jn(e),t,n,i),s=nn(r,e.timeZone);return it(sn(s,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function pP(e,t,n){let i=jn(e),r=sa(ll(i,t),t);if(r.compare(i)===0)return e;let s=nn(r,e.timeZone,n);return it(sn(s,e.timeZone),e.calendar)}function yP(e){let t=e.match(fP);if(!t)throw mP.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new $i(Ko(t[1],0,9999),Ko(t[2],1,12),1);return n.day=Ko(t[3],1,n.calendar.getDaysInMonth(n)),n}function Ko(e,t,n){let i=Number(e);if(in)throw new RangeError(`Value out of range: ${t} <= ${i} <= ${n}`);return i}function bP(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function Dh(e){let t=it(e,new Mi),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Lh(e){return`${Dh(e)}T${bP(e)}`}function EP(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let n=Math.floor(e/36e5),i=Math.floor(e%36e5/6e4),r=Math.floor(e%36e5%6e4/1e3),s=`${t}${String(n).padStart(2,"0")}:${String(i).padStart(2,"0")}`;return r!==0&&(s+=`:${String(r).padStart(2,"0")}`),s}function IP(e){return`${Lh(e)}${EP(e.offset)}[${e.timeZone}]`}function PP(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ul(e,t,n){PP(e,t),t.set(e,n)}function dl(e){let t=typeof e[0]=="object"?e.shift():new Mi,n;if(typeof e[0]=="string")n=e.shift();else{let a=t.getEras();n=a[a.length-1]}let i=e.shift(),r=e.shift(),s=e.shift();return[t,n,i,r,s]}function Fh(e,t={}){if(typeof t.hour12=="boolean"&&VP()){t=g({},t);let r=wP[String(t.hour12)][e.split("-")[0]],s=t.hour12?"h12":"h23";t.hourCycle=r!=null?r:s,delete t.hour12}let n=e+(t?Object.entries(t).sort((r,s)=>r[0]s.type==="hour").value,10),r=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(s=>s.type==="hour").value,10);if(i===0&&r===23)return"h23";if(i===24&&r===23)return"h24";if(i===0&&r===11)return"h11";if(i===12&&r===11)return"h12";throw new Error("Unexpected hour cycle result")}function kP(e,t,n,i,r){let s={};for(let o in t){let l=o,c=t[l];c!=null&&(s[l]=Math.floor(c/2),s[l]>0&&c%2===0&&s[l]--)}let a=Jn(e,t,n).subtract(s);return Vr(e,a,t,n,i,r)}function Jn(e,t,n,i,r){let s=e;return t.years?s=Or(e):t.months?s=rn(e):t.weeks&&(s=wr(e,n)),Vr(e,s,t,n,i,r)}function hl(e,t,n,i,r){let s=g({},t);s.days?s.days--:s.weeks?s.weeks--:s.months?s.months--:s.years&&s.years--;let a=Jn(e,t,n).subtract(s);return Vr(e,a,t,n,i,r)}function Vr(e,t,n,i,r,s){return r&&e.compare(r)>=0&&(t=Th(t,Jn(Yn(r),n,i))),s&&e.compare(s)<=0&&(t=Sh(t,hl(Yn(s),n,i))),t}function Pt(e,t,n){let i=Yn(e);return t&&(i=Th(i,Yn(t))),n&&(i=Sh(i,Yn(n))),i}function ch(e,t,n,i,r,s){switch(t){case"start":return Jn(e,n,i,r,s);case"end":return hl(e,n,i,r,s);case"center":default:return kP(e,n,i,r,s)}}function nt(e,t){return e==null||t==null?e===t:Zn(e,t)}function uh(e,t,n,i,r){return e?t!=null&&t(e,n)?!0:$t(e,i,r):!1}function $t(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function NP(e,t,n){let i=e.subtract({days:1});return Zn(i,e)||$t(i,t,n)}function RP(e,t,n){let i=e.add({days:1});return Zn(i,e)||$t(i,t,n)}function gl(e){let t=g({},e);for(let n in t)t[n]=1;return t}function $h(e,t){let n=g({},t);return n.days?n.days--:n.days=-1,e.add(n)}function Hh(e){return(e==null?void 0:e.calendar.identifier)==="gregory"&&e.era==="BC"?"short":void 0}function Bh(e,t){let n=jn(oa(t));return new Ct(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:Hh(n),timeZone:t})}function dh(e,t){let n=oa(t);return new Ct(e,{month:"long",year:"numeric",era:Hh(n),calendar:n==null?void 0:n.calendar.identifier,timeZone:t})}function DP(e,t,n,i,r){let s=n.formatRangeToParts(e.toDate(r),t.toDate(r)),a=-1;for(let c=0;ca&&(l+=s[c].value);return i(o,l)}function Zs(e,t,n,i){if(!e)return"";let r=e,s=t!=null?t:e,a=Bh(n,i);return Zn(r,s)?a.format(r.toDate(i)):DP(r,s,a,(o,l)=>`${o} \u2013 ${l}`,i)}function _h(e){return e!=null?LP[e]:void 0}function Gh(e,t,n){let i=_h(n);return wr(e,t,i)}function Uh(e,t,n,i){let r=t.add({weeks:e}),s=[],a=Gh(r,n,i);for(;s.length<7;){s.push(a);let o=a.add({days:1});if(Zn(a,o))break;a=o}return s}function MP(e,t,n,i){let r=_h(i),s=n!=null?n:eP(e,t,r);return[...new Array(s).keys()].map(o=>Uh(o,e,t,i))}function FP(e,t){let n=new Ct(e,{weekday:"long",timeZone:t}),i=new Ct(e,{weekday:"short",timeZone:t}),r=new Ct(e,{weekday:"narrow",timeZone:t});return s=>{let a=s instanceof Date?s:s.toDate(t);return{value:s,short:i.format(a),long:n.format(a),narrow:r.format(a)}}}function $P(e,t,n,i){let r=Gh(e,i,t),s=[...new Array(7).keys()],a=FP(i,n);return s.map(o=>a(r.add({days:o})))}function HP(e,t="long"){let n=new Date(2021,0,1),i=[];for(let r=0;r<12;r++)i.push(n.toLocaleString(e,{month:t})),n.setMonth(n.getMonth()+1);return i}function BP(e){let t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}function GP(e){if(e){if(e.length===3)return e.padEnd(4,"0");if(e.length===2){let t=new Date().getFullYear(),n=Math.floor(t/100)*100,i=parseInt(e.slice(-2),10),r=n+i;return r>t+_P?(r-100).toString():r.toString()}return e}}function Li(e,t){let n=t!=null&&t.strict?10:12,i=e-e%10,r=[];for(let s=0;s0?{startDate:Jn(o,e,t,n,i),endDate:l,focusedDate:Pt(o,n,i)}:{startDate:a,endDate:l,focusedDate:Pt(o,n,i)}}}function qh(e,t,n,i,r,s){let a=xr(n,i,r,s),o=t.add(n);return a({focusedDate:e.add(n),startDate:Jn(Vr(e,o,n,i,r,s),n,i)})}function Wh(e,t,n,i,r,s){let a=xr(n,i,r,s),o=t.subtract(n);return a({focusedDate:e.subtract(n),startDate:Jn(Vr(e,o,n,i,r,s),n,i)})}function UP(e,t,n,i,r,s,a){let o=xr(i,r,s,a);if(!n&&!i.days)return o({focusedDate:e.add(gl(i)),startDate:t});if(i.days)return qh(e,t,i,r,s,a);if(i.weeks)return o({focusedDate:e.add({months:1}),startDate:t});if(i.months||i.years)return o({focusedDate:e.add({years:1}),startDate:t})}function qP(e,t,n,i,r,s,a){let o=xr(i,r,s,a);if(!n&&!i.days)return o({focusedDate:e.subtract(gl(i)),startDate:t});if(i.days)return Wh(e,t,i,r,s,a);if(i.weeks)return o({focusedDate:e.subtract({months:1}),startDate:t});if(i.months||i.years)return o({focusedDate:e.subtract({years:1}),startDate:t})}function zP(e,t,n){var c;let i=YP(t,n),{year:r,month:s,day:a}=(c=jP(i,e))!=null?c:{};if(r!=null||s!=null||a!=null){let u=new Date;r||(r=u.getFullYear().toString()),s||(s=(u.getMonth()+1).toString()),a||(a=u.getDate().toString())}if(hh(r)||(r=GP(r)),hh(r)&&WP(s)&&KP(a))return new $i(+r,+s,+a);let l=Date.parse(e);if(!isNaN(l)){let u=new Date(l);return new $i(u.getFullYear(),u.getMonth()+1,u.getDate())}}function YP(e,t){return new Ct(e,{day:"numeric",month:"numeric",year:"numeric",timeZone:t}).formatToParts(new Date(2e3,11,25)).map(({type:r,value:s})=>r==="literal"?`${s}?`:`((?!=<${r}>)\\d+)?`).join("")}function jP(e,t){var i;let n=t.match(e);return(i=e.toString().match(/<(.+?)>/g))==null?void 0:i.map(r=>{var a;let s=r.match(/<(.+)>/);return!s||s.length<=0?null:(a=r.match(/<(.+)>/))==null?void 0:a[1]}).reduce((r,s,a)=>(s&&(n&&n.length>a?r[s]=n[a+1]:r[s]=null),r),{})}function gh(e,t,n){let i=Yn(Ih(n));switch(e){case"thisWeek":return[wr(i,t),sh(i,t)];case"thisMonth":return[rn(i),i];case"thisQuarter":return[rn(i).add({months:-((i.month-1)%3)}),i];case"thisYear":return[Or(i),i];case"last3Days":return[i.add({days:-2}),i];case"last7Days":return[i.add({days:-6}),i];case"last14Days":return[i.add({days:-13}),i];case"last30Days":return[i.add({days:-29}),i];case"last90Days":return[i.add({days:-89}),i];case"lastMonth":return[rn(i.add({months:-1})),Zo(i.add({months:-1}))];case"lastQuarter":return[rn(i.add({months:-((i.month-1)%3)-3})),Zo(i.add({months:-((i.month-1)%3)-1}))];case"lastWeek":return[wr(i,t).add({weeks:-1}),sh(i,t).add({weeks:-1})];case"lastYear":return[Or(i.add({years:-1})),JI(i.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}function XP(e={}){var c;let{level:t="polite",document:n=document,root:i,delay:r=0}=e,s=(c=n.defaultView)!=null?c:window,a=i!=null?i:n.body;function o(u,h){let m=n.getElementById(Js);m==null||m.remove(),h=h!=null?h:r;let d=n.createElement("span");d.id=Js,d.dataset.liveAnnouncer="true";let p=t!=="assertive"?"status":"alert";d.setAttribute("aria-live",t),d.setAttribute("role",p),Object.assign(d.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}),a.appendChild(d),s.setTimeout(()=>{d.textContent=u},h)}function l(){let u=n.getElementById(Js);u==null||u.remove()}return{announce:o,destroy:l,toJSON(){return Js}}}function sl(e){let[t,n]=e,i;return!t||!n?i=e:i=t.compare(n)<=0?e:[n,t],i}function Ri(e,t){let[n,i]=t;return!n||!i?!1:n.compare(e)<=0&&i.compare(e)>=0}function Qs(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function lC(e){return Ce(e,{year:"calendar decade",month:"calendar year",day:"calendar month"})}function uC(e){return new Ct(e).formatToParts(new Date).map(t=>{var n;return(n=cC[t.type])!=null?n:t.value}).join("")}function hC(e){let i=new Intl.DateTimeFormat(e).formatToParts(new Date).find(r=>r.type==="literal");return i?i.value:"/"}function on(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function pl(e){return e===0?"day":e===1?"month":"year"}function fl(e,t,n){return pl(He(on(e,0),on(t,0),on(n,2)))}function pC(e,t){return on(e,0)>on(t,0)}function fC(e,t){return on(e,0)e(t))}function IC(e,t){let{state:n,context:i,prop:r,send:s,computed:a,scope:o}=e,l=i.get("startValue"),c=a("endValue"),u=i.get("value"),h=i.get("focusedValue"),m=i.get("hoveredValue"),d=m?sl([u[0],m]):[],p=!!r("disabled"),v=!!r("readOnly"),I=!!r("invalid"),T=a("isInteractive"),w=u.length===0,b=r("min"),f=r("max"),S=r("locale"),P=r("timeZone"),V=r("startOfWeek"),A=n.matches("focused"),x=n.matches("open"),k=r("selectionMode")==="range",N=r("isDateUnavailable"),D=i.get("currentPlacement"),$=On(y(g({},r("positioning")),{placement:D})),te=hC(S),J=g(g({},gC),r("translations"));function ie(M=l){let R=r("fixedWeeks")?6:void 0;return MP(M,S,R,V)}function Q(M={}){let{format:R}=M;return HP(S,R).map((F,G)=>{let ae=G+1,ze=h.set({month:ae}),Ne=$t(ze,b,f);return{label:F,value:ae,disabled:Ne}})}function Se(){var R,F;return BP({from:(R=b==null?void 0:b.year)!=null?R:1900,to:(F=f==null?void 0:f.year)!=null?F:2100}).map(G=>({label:G.toString(),value:G,disabled:!Pi(G,b==null?void 0:b.year,f==null?void 0:f.year)}))}function Pe(M){return uh(M,N,S,b,f)}function ne(M){let R=l!=null?l:Di(P);s({type:"FOCUS.SET",value:R.set({month:M})})}function Ie(M){let R=l!=null?l:Di(P);s({type:"FOCUS.SET",value:R.set({year:M})})}function rt(M){let{value:R,disabled:F}=M,G=h.set({year:R}),ze=!Li(l.year,{strict:!0}).includes(R),Ne=Pi(R,b==null?void 0:b.year,f==null?void 0:f.year),Tt={focused:h.year===M.value,selectable:ze||Ne,outsideRange:ze,selected:!!u.find(Zi=>Zi&&Zi.year===R),valueText:R.toString(),inRange:k&&(Ri(G,u)||Ri(G,d)),value:G,get disabled(){return F||!Tt.selectable}};return Tt}function Ut(M){let{value:R,disabled:F}=M,G=h.set({month:R}),ae=dh(S,P),ze={focused:h.month===M.value,selectable:!$t(G,b,f),selected:!!u.find(Ne=>Ne&&Ne.month===R&&Ne.year===h.year),valueText:ae.format(G.toDate(P)),inRange:k&&(Ri(G,u)||Ri(G,d)),value:G,get disabled(){return F||!ze.selectable}};return ze}function Xi(M){let{value:R,disabled:F,visibleRange:G=a("visibleRange")}=M,ae=Bh(S,P),ze=gl(a("visibleDuration")),Ne=r("outsideDaySelectable"),Tt=G.start.add(ze).subtract({days:1}),Zi=$t(R,G.start,Tt),kf=k&&Ri(R,u),Nf=k&&nt(R,u[0]),Rf=k&&nt(R,u[1]),Ma=k&&d.length>0,ic=Ma&&Ri(R,d),Df=Ma&&nt(R,d[0]),Lf=Ma&&nt(R,d[1]),Ji={invalid:$t(R,b,f),disabled:F||!Ne&&Zi||$t(R,b,f),selected:u.some(Mf=>nt(R,Mf)),unavailable:uh(R,N,S,b,f)&&!F,outsideRange:Zi,today:jI(R,P),weekend:nP(R,S),formattedDate:ae.format(R.toDate(P)),get focused(){return nt(R,h)&&(!Ji.outsideRange||Ne)},get ariaLabel(){return J.dayCell(Ji)},get selectable(){return!Ji.disabled&&!Ji.unavailable},inRange:kf||ic,firstInRange:Nf,lastInRange:Rf,inHoveredRange:ic,firstInHoveredRange:Df,lastInHoveredRange:Lf};return Ji}function La(M){let{view:R="day",id:F}=M;return[R,F].filter(Boolean).join(" ")}return{focused:A,open:x,disabled:p,invalid:I,readOnly:v,inline:!!r("inline"),numOfMonths:r("numOfMonths"),selectionMode:r("selectionMode"),view:i.get("view"),getRangePresetValue(M){return gh(M,S,P)},getDaysInWeek(M,R=l){return Uh(M,R,S,V)},getOffset(M){let R=l.add(M),F=c.add(M),G=dh(S,P);return{visibleRange:{start:R,end:F},weeks:ie(R),visibleRangeText:{start:G.format(R.toDate(P)),end:G.format(F.toDate(P))}}},getMonthWeeks:ie,isUnavailable:Pe,weeks:ie(),weekDays:$P(Di(P),V,P,S),visibleRangeText:a("visibleRangeText"),value:u,valueAsDate:u.filter(M=>M!=null).map(M=>M.toDate(P)),valueAsString:a("valueAsString"),focusedValue:h,focusedValueAsDate:h==null?void 0:h.toDate(P),focusedValueAsString:r("format")(h,{locale:S,timeZone:P}),visibleRange:a("visibleRange"),selectToday(){let M=Pt(Di(P),b,f);s({type:"VALUE.SET",value:M})},setValue(M){let R=M.map(F=>Pt(F,b,f));s({type:"VALUE.SET",value:R})},clearValue(){s({type:"VALUE.CLEAR"})},setFocusedValue(M){s({type:"FOCUS.SET",value:M})},setOpen(M){r("inline")||n.matches("open")===M||s({type:M?"OPEN":"CLOSE"})},focusMonth:ne,focusYear:Ie,getYears:Se,getMonths:Q,getYearsGrid(M={}){let{columns:R=1}=M,F=Li(l.year,{strict:!0}).map(G=>({label:G.toString(),value:G,disabled:!Pi(G,b==null?void 0:b.year,f==null?void 0:f.year)}));return cr(F,R)},getDecade(){let M=Li(l.year,{strict:!0});return{start:M.at(0),end:M.at(-1)}},getMonthsGrid(M={}){let{columns:R=1,format:F}=M;return cr(Q({format:F}),R)},format(M,R={month:"long",year:"numeric"}){return new Ct(S,R).format(M.toDate(P))},setView(M){s({type:"VIEW.SET",view:M})},goToNext(){s({type:"GOTO.NEXT",view:i.get("view")})},goToPrev(){s({type:"GOTO.PREV",view:i.get("view")})},getRootProps(){return t.element(y(g({},de.root.attrs),{dir:r("dir"),id:QP(o),"data-state":x?"open":"closed","data-disabled":E(p),"data-readonly":E(v),"data-empty":E(w)}))},getLabelProps(M={}){let{index:R=0}=M;return t.label(y(g({},de.label.attrs),{id:JP(o,R),dir:r("dir"),htmlFor:ph(o,R),"data-state":x?"open":"closed","data-index":R,"data-disabled":E(p),"data-readonly":E(v)}))},getControlProps(){return t.element(y(g({},de.control.attrs),{dir:r("dir"),id:zh(o),"data-disabled":E(p),"data-placeholder-shown":E(w)}))},getRangeTextProps(){return t.element(y(g({},de.rangeText.attrs),{dir:r("dir")}))},getContentProps(){return t.element(y(g({},de.content.attrs),{hidden:!x,dir:r("dir"),"data-state":x?"open":"closed","data-placement":D,"data-inline":E(r("inline")),id:rl(o),tabIndex:-1,role:"application","aria-roledescription":"datepicker","aria-label":J.content}))},getTableProps(M={}){let{view:R="day",columns:F=R==="day"?7:4}=M,G=La(M);return t.element(y(g({},de.table.attrs),{role:"grid","data-columns":F,"aria-roledescription":lC(R),id:eC(o,G),"aria-readonly":X(v),"aria-disabled":X(p),"aria-multiselectable":X(r("selectionMode")!=="single"),"data-view":R,dir:r("dir"),tabIndex:-1,onKeyDown(ae){if(ae.defaultPrevented)return;let Ne={Enter(){R==="day"&&Pe(h)||R==="month"&&!Ut({value:h.month}).selectable||R==="year"&&!rt({value:h.year}).selectable||s({type:"TABLE.ENTER",view:R,columns:F,focus:!0})},ArrowLeft(){s({type:"TABLE.ARROW_LEFT",view:R,columns:F,focus:!0})},ArrowRight(){s({type:"TABLE.ARROW_RIGHT",view:R,columns:F,focus:!0})},ArrowUp(){s({type:"TABLE.ARROW_UP",view:R,columns:F,focus:!0})},ArrowDown(){s({type:"TABLE.ARROW_DOWN",view:R,columns:F,focus:!0})},PageUp(Tt){s({type:"TABLE.PAGE_UP",larger:Tt.shiftKey,view:R,columns:F,focus:!0})},PageDown(Tt){s({type:"TABLE.PAGE_DOWN",larger:Tt.shiftKey,view:R,columns:F,focus:!0})},Home(){s({type:"TABLE.HOME",view:R,columns:F,focus:!0})},End(){s({type:"TABLE.END",view:R,columns:F,focus:!0})}}[ge(ae,{dir:r("dir")})];Ne&&(Ne(ae),ae.preventDefault(),ae.stopPropagation())},onPointerLeave(){s({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){s({type:"TABLE.POINTER_DOWN",view:R})},onPointerUp(){s({type:"TABLE.POINTER_UP",view:R})}}))},getTableHeadProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.tableHead.attrs),{"aria-hidden":!0,dir:r("dir"),"data-view":R,"data-disabled":E(p)}))},getTableHeaderProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.tableHeader.attrs),{dir:r("dir"),"data-view":R,"data-disabled":E(p)}))},getTableBodyProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.tableBody.attrs),{"data-view":R,"data-disabled":E(p)}))},getTableRowProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.tableRow.attrs),{"aria-disabled":X(p),"data-disabled":E(p),"data-view":R}))},getDayTableCellState:Xi,getDayTableCellProps(M){let{value:R}=M,F=Xi(M);return t.element(y(g({},de.tableCell.attrs),{role:"gridcell","aria-disabled":X(!F.selectable),"aria-selected":F.selected||F.inRange,"aria-invalid":X(F.invalid),"aria-current":F.today?"date":void 0,"data-value":R.toString()}))},getDayTableCellTriggerProps(M){let{value:R}=M,F=Xi(M);return t.element(y(g({},de.tableCellTrigger.attrs),{id:Xo(o,R.toString()),role:"button",dir:r("dir"),tabIndex:F.focused?0:-1,"aria-label":F.ariaLabel,"aria-disabled":X(!F.selectable),"aria-invalid":X(F.invalid),"data-disabled":E(!F.selectable),"data-selected":E(F.selected),"data-value":R.toString(),"data-view":"day","data-today":E(F.today),"data-focus":E(F.focused),"data-unavailable":E(F.unavailable),"data-range-start":E(F.firstInRange),"data-range-end":E(F.lastInRange),"data-in-range":E(F.inRange),"data-outside-range":E(F.outsideRange),"data-weekend":E(F.weekend),"data-in-hover-range":E(F.inHoveredRange),"data-hover-range-start":E(F.firstInHoveredRange),"data-hover-range-end":E(F.lastInHoveredRange),onClick(G){G.defaultPrevented||F.selectable&&s({type:"CELL.CLICK",cell:"day",value:R})},onPointerMove:k?G=>{if(G.pointerType==="touch"||!F.selectable)return;let ae=!o.isActiveElement(G.currentTarget);m&&KI(R,m)||s({type:"CELL.POINTER_MOVE",cell:"day",value:R,focus:ae})}:void 0}))},getMonthTableCellState:Ut,getMonthTableCellProps(M){let{value:R,columns:F}=M,G=Ut(M);return t.element(y(g({},de.tableCell.attrs),{dir:r("dir"),colSpan:F,role:"gridcell","aria-selected":X(G.selected||G.inRange),"data-selected":E(G.selected),"aria-disabled":X(!G.selectable),"data-value":R}))},getMonthTableCellTriggerProps(M){let{value:R}=M,F=Ut(M);return t.element(y(g({},de.tableCellTrigger.attrs),{dir:r("dir"),role:"button",id:Xo(o,R.toString()),"data-selected":E(F.selected),"aria-disabled":X(!F.selectable),"data-disabled":E(!F.selectable),"data-focus":E(F.focused),"data-in-range":E(F.inRange),"data-outside-range":E(F.outsideRange),"aria-label":F.valueText,"data-view":"month","data-value":R,tabIndex:F.focused?0:-1,onClick(G){G.defaultPrevented||F.selectable&&s({type:"CELL.CLICK",cell:"month",value:R})},onPointerMove:k?G=>{if(G.pointerType==="touch"||!F.selectable)return;let ae=!o.isActiveElement(G.currentTarget);m&&F.value&&zI(F.value,m)||s({type:"CELL.POINTER_MOVE",cell:"month",value:F.value,focus:ae})}:void 0}))},getYearTableCellState:rt,getYearTableCellProps(M){let{value:R,columns:F}=M,G=rt(M);return t.element(y(g({},de.tableCell.attrs),{dir:r("dir"),colSpan:F,role:"gridcell","aria-selected":X(G.selected),"data-selected":E(G.selected),"aria-disabled":X(!G.selectable),"data-value":R}))},getYearTableCellTriggerProps(M){let{value:R}=M,F=rt(M);return t.element(y(g({},de.tableCellTrigger.attrs),{dir:r("dir"),role:"button",id:Xo(o,R.toString()),"data-selected":E(F.selected),"data-focus":E(F.focused),"data-in-range":E(F.inRange),"aria-disabled":X(!F.selectable),"data-disabled":E(!F.selectable),"aria-label":F.valueText,"data-outside-range":E(F.outsideRange),"data-value":R,"data-view":"year",tabIndex:F.focused?0:-1,onClick(G){G.defaultPrevented||F.selectable&&s({type:"CELL.CLICK",cell:"year",value:R})},onPointerMove:k?G=>{if(G.pointerType==="touch"||!F.selectable)return;let ae=!o.isActiveElement(G.currentTarget);m&&F.value&&YI(F.value,m)||s({type:"CELL.POINTER_MOVE",cell:"year",value:F.value,focus:ae})}:void 0}))},getNextTriggerProps(M={}){let{view:R="day"}=M,F=p||!a("isNextVisibleRangeValid");return t.button(y(g({},de.nextTrigger.attrs),{dir:r("dir"),id:nC(o,R),type:"button","aria-label":J.nextTrigger(R),disabled:F,"data-disabled":E(F),onClick(G){G.defaultPrevented||s({type:"GOTO.NEXT",view:R})}}))},getPrevTriggerProps(M={}){let{view:R="day"}=M,F=p||!a("isPrevVisibleRangeValid");return t.button(y(g({},de.prevTrigger.attrs),{dir:r("dir"),id:tC(o,R),type:"button","aria-label":J.prevTrigger(R),disabled:F,"data-disabled":E(F),onClick(G){G.defaultPrevented||s({type:"GOTO.PREV",view:R})}}))},getClearTriggerProps(){return t.button(y(g({},de.clearTrigger.attrs),{id:Kh(o),dir:r("dir"),type:"button","aria-label":J.clearTrigger,hidden:!u.length,onClick(M){M.defaultPrevented||s({type:"VALUE.CLEAR"})}}))},getTriggerProps(){return t.button(y(g({},de.trigger.attrs),{id:Yh(o),dir:r("dir"),type:"button","data-placement":D,"aria-label":J.trigger(x),"aria-controls":rl(o),"data-state":x?"open":"closed","data-placeholder-shown":E(w),"aria-haspopup":"grid",disabled:p,onClick(M){M.defaultPrevented||T&&s({type:"TRIGGER.CLICK"})}}))},getViewProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.view.attrs),{"data-view":R,hidden:i.get("view")!==R}))},getViewTriggerProps(M={}){let{view:R="day"}=M;return t.button(y(g({},de.viewTrigger.attrs),{"data-view":R,dir:r("dir"),id:iC(o,R),type:"button",disabled:p,"aria-label":J.viewTrigger(R),onClick(F){F.defaultPrevented||T&&s({type:"VIEW.TOGGLE",src:"viewTrigger"})}}))},getViewControlProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.viewControl.attrs),{"data-view":R,dir:r("dir")}))},getInputProps(M={}){let{index:R=0,fixOnBlur:F=!0}=M;return t.input(y(g({},de.input.attrs),{id:ph(o,R),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":R,"data-state":x?"open":"closed","data-placeholder-shown":E(w),readOnly:v,disabled:p,required:r("required"),"aria-invalid":X(I),"data-invalid":E(I),placeholder:r("placeholder")||uC(S),defaultValue:a("valueAsString")[R],onBeforeInput(G){let{data:ae}=Yt(G);Qh(ae,te)||G.preventDefault()},onFocus(){s({type:"INPUT.FOCUS",index:R})},onBlur(G){let ae=G.currentTarget.value.trim();s({type:"INPUT.BLUR",value:ae,index:R,fixOnBlur:F})},onKeyDown(G){if(G.defaultPrevented||!T)return;let ze={Enter(Ne){Re(Ne)||Pe(h)||Ne.currentTarget.value.trim()!==""&&s({type:"INPUT.ENTER",value:Ne.currentTarget.value,index:R})}}[G.key];ze&&(ze(G),G.preventDefault())},onInput(G){let ae=G.currentTarget.value;s({type:"INPUT.CHANGE",value:dC(ae,te),index:R})}}))},getMonthSelectProps(){return t.select(y(g({},de.monthSelect.attrs),{id:Xh(o),"aria-label":J.monthSelect,disabled:p,dir:r("dir"),defaultValue:l.month,onChange(M){ne(Number(M.currentTarget.value))}}))},getYearSelectProps(){return t.select(y(g({},de.yearSelect.attrs),{id:Zh(o),disabled:p,"aria-label":J.yearSelect,dir:r("dir"),defaultValue:l.year,onChange(M){Ie(Number(M.currentTarget.value))}}))},getPositionerProps(){return t.element(y(g({id:jh(o)},de.positioner.attrs),{dir:r("dir"),style:$.floating}))},getPresetTriggerProps(M){let R=Array.isArray(M.value)?M.value:gh(M.value,S,P),F=R.filter(G=>G!=null).map(G=>G.toDate(P).toDateString());return t.button(y(g({},de.presetTrigger.attrs),{"aria-label":J.presetTrigger(F),type:"button",onClick(G){G.defaultPrevented||s({type:"PRESET.CLICK",value:R})}}))}}}function PC(e,t){if((e==null?void 0:e.length)!==(t==null?void 0:t.length))return!1;let n=Math.max(e.length,t.length);for(let i=0;in==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}function ve(e,t){let{context:n,prop:i,computed:r}=e;if(!t)return;let s=ra(e,t);if(nt(n.get("focusedValue"),s))return;let o=xr(r("visibleDuration"),i("locale"),i("min"),i("max"))({focusedDate:s,startDate:n.get("startValue")});n.set("startValue",o.startDate),n.set("focusedValue",o.focusedDate)}function ta(e,t){let{context:n}=e;n.set("startValue",t.startDate);let i=n.get("focusedValue");nt(i,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function gt(e){return Array.isArray(e)?e.map(t=>gt(t)):e instanceof Date?new $i(e.getFullYear(),e.getMonth()+1,e.getDate()):yP(e)}function yh(e){let t=n=>String(n).padStart(2,"0");return`${e.year}-${t(e.month)}-${t(e.day)}`}var bh,GI,Mi,UI,XI,qo,ah,Wo,tP,oh,lh,Sr,fP,mP,vP,Ex,CP,$i,SP,TP,OP,Mh,zo,Ct,wP,Yo,jo,LP,_P,hh,WP,KP,Js,ZP,de,JP,QP,eC,rl,Xo,tC,nC,iC,Kh,zh,ph,Yh,jh,Xh,Zh,fh,mh,ia,Tr,rC,sC,aC,oC,Jh,cC,Qh,vh,dC,gC,yC,EC,ht,CC,ra,SC,Ix,TC,Px,OC,Cx,wC,Sx,VC,Tx,xC,Ox,AC,kC,tg=re(()=>{"use strict";Pr();Wn();tn();se();bh=1721426;GI={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},Mi=class{fromJulianDay(e){let t=e,n=t-bh,i=Math.floor(n/146097),r=Uo(n,146097),s=Math.floor(r/36524),a=Uo(r,36524),o=Math.floor(a/1461),l=Uo(a,1461),c=Math.floor(l/365),u=i*400+s*100+o*4+c+(s!==4&&c!==4?1:0),[h,m]=_I(u),d=t-js(h,m,1,1),p=2;t= start date");return`${this.formatter.format(e)} \u2013 ${this.formatter.format(t)}`}formatRangeToParts(e,t){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(e,t);if(t= start date");let n=this.formatter.formatToParts(e),i=this.formatter.formatToParts(t);return[...n.map(r=>y(g({},r),{source:"startRange"})),{type:"literal",value:" \u2013 ",source:"shared"},...i.map(r=>y(g({},r),{source:"endRange"}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return xP()&&(this.resolvedHourCycle||(this.resolvedHourCycle=AP(e.locale,this.options)),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),e.calendar==="ethiopic-amete-alem"&&(e.calendar="ethioaa"),e}constructor(e,t={}){this.formatter=Fh(e,t),this.options=t}},wP={true:{ja:"h11"},false:{}};Yo=null;jo=null;LP=["sun","mon","tue","wed","thu","fri","sat"];_P=10;hh=e=>e!=null&&e.length===4,WP=e=>e!=null&&parseFloat(e)<=12,KP=e=>e!=null&&parseFloat(e)<=31;Js="__live-region__";ZP=U("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),de=ZP.build(),JP=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.label)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:label:${t}`},QP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`datepicker:${e.id}`},eC=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.table)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:table:${t}`},rl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`datepicker:${e.id}:content`},Xo=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.cellTrigger)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:cell-trigger:${t}`},tC=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.prevTrigger)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:prev:${t}`},nC=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.nextTrigger)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:next:${t}`},iC=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.viewTrigger)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:view:${t}`},Kh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`datepicker:${e.id}:clear`},zh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`datepicker:${e.id}:control`},ph=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.input)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:input:${t}`},Yh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`datepicker:${e.id}:trigger`},jh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`datepicker:${e.id}:positioner`},Xh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.monthSelect)!=null?n:`datepicker:${e.id}:month-select`},Zh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.yearSelect)!=null?n:`datepicker:${e.id}:year-select`},fh=(e,t)=>vi(ia(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),mh=e=>e.getById(Yh(e)),ia=e=>e.getById(rl(e)),Tr=e=>Fe(Jh(e),"[data-part=input]"),rC=e=>e.getById(Zh(e)),sC=e=>e.getById(Xh(e)),aC=e=>e.getById(Kh(e)),oC=e=>e.getById(jh(e)),Jh=e=>e.getById(zh(e));cC={day:"dd",month:"mm",year:"yyyy"};Qh=(e,t)=>e?/\d/.test(e)||e===t||e.length!==1:!0,vh=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),dC=(e,t)=>e.split("").filter(n=>Qh(n,t)).join("");gC={dayCell(e){return e.unavailable?`Not available. ${e.formattedDate}`:e.selected?`Selected date. ${e.formattedDate}`:`Choose ${e.formattedDate}`},trigger(e){return e?"Close calendar":"Open calendar"},viewTrigger(e){return Ce(e,{year:"Switch to month view",month:"Switch to day view",day:"Switch to year view"})},presetTrigger(e){let[t="",n=""]=e;return`select ${t} to ${n}`},prevTrigger(e){return Ce(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return Ce(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates"};yC=["day","month","year"];EC=Bn(e=>[e.view,e.startValue.toString(),e.endValue.toString(),e.locale],([e],t)=>{let{startValue:n,endValue:i,locale:r,timeZone:s,selectionMode:a}=t;if(e==="year"){let h=Li(n.year,{strict:!0}),m=h.at(0).toString(),d=h.at(-1).toString();return{start:m,end:d,formatted:`${m} - ${d}`}}if(e==="month"){let h=new Ct(r,{year:"numeric",timeZone:s}),m=h.format(n.toDate(s)),d=h.format(i.toDate(s)),p=a==="range"?`${m} - ${d}`:m;return{start:m,end:d,formatted:p}}let o=new Ct(r,{month:"long",year:"numeric",timeZone:s}),l=o.format(n.toDate(s)),c=o.format(i.toDate(s)),u=a==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:u}});({and:ht}=Ee());CC={props({props:e}){let t=e.locale||"en-US",n=e.timeZone||"UTC",i=e.selectionMode||"single",r=e.numOfMonths||1,s=e.defaultValue?Qs(e.defaultValue).map(h=>Pt(h,e.min,e.max)):void 0,a=e.value?Qs(e.value).map(h=>Pt(h,e.min,e.max)):void 0,o=e.focusedValue||e.defaultFocusedValue||(a==null?void 0:a[0])||(s==null?void 0:s[0])||Di(n);o=Pt(o,e.min,e.max);let l="day",c="year",u=fl(e.view||l,l,c);return y(g({locale:t,numOfMonths:r,timeZone:n,selectionMode:i,defaultView:u,minView:l,maxView:c,outsideDaySelectable:!1,closeOnSelect:!0,format(h,{locale:m,timeZone:d}){return new Ct(m,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric"}).format(h.toDate(d))},parse(h,{locale:m,timeZone:d}){return zP(h,m,d)}},e),{focusedValue:typeof e.focusedValue=="undefined"?void 0:o,defaultFocusedValue:o,value:a,defaultValue:s!=null?s:[],positioning:g({placement:"bottom"},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")||e("inline")?"open":"idle"},refs(){return{announcer:void 0}},context({prop:e,bindable:t,getContext:n}){return{focusedValue:t(()=>({defaultValue:e("defaultFocusedValue"),value:e("focusedValue"),isEqual:nt,hash:i=>i.toString(),sync:!0,onChange(i){var l;let r=n(),s=r.get("view"),a=r.get("value"),o=ea(a,e);(l=e("onFocusChange"))==null||l({value:a,valueAsString:o,view:s,focusedValue:i})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:PC,hash:i=>i.map(r=>{var s;return(s=r==null?void 0:r.toString())!=null?s:""}).join(","),onChange(i){var a;let r=n(),s=ea(i,e);(a=e("onValueChange"))==null||a({value:i,valueAsString:s,view:r.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual:nt})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(i){var r;(r=e("onViewChange"))==null||r({view:i})}})),startValue:t(()=>{let i=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:ch(i,"start",{months:e("numOfMonths")},e("locale")),isEqual:nt,hash:r=>r.toString()}}),currentPlacement:t(()=>({defaultValue:void 0})),restoreFocus:t(()=>({defaultValue:!1}))}},computed:{isInteractive:({prop:e})=>!e("disabled")&&!e("readOnly"),visibleDuration:({prop:e})=>({months:e("numOfMonths")}),endValue:({context:e,computed:t})=>$h(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>EC({view:e.get("view"),startValue:e.get("startValue"),endValue:n("endValue"),locale:t("locale"),timeZone:t("timeZone"),selectionMode:t("selectionMode")}),isPrevVisibleRangeValid:({context:e,prop:t})=>!NP(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!RP(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>ea(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:i,computed:r}){e([()=>t("locale")],()=>{i(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{i(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{i(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{i(["syncInputValue"])}),e([()=>n.hash("value")],()=>{i(["syncInputElement"])}),e([()=>r("valueAsString").toString()],()=>{i(["announceValueText"])}),e([()=>n.get("view")],()=>{i(["focusActiveCell"])}),e([()=>t("open")],()=>{i(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate","resetView"],on:{"CONTROLLED.CLOSE":[{guard:ht("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["focusTriggerElement"]},{guard:"shouldRestoreFocus",target:"focused",actions:["focusInputElement"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ht("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ht("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ht("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","focusInputElement"]},{guard:ht("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:"isMultiPicker",actions:["setFocusedDate","toggleSelectedDate"]},{guard:ht("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","focusInputElement"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":{guard:ht("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]},"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","focusTriggerElement"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:ht("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","clearDateValue","setSelectedDate","setActiveIndexToEnd"]},{guard:ht("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ht("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","focusInputElement"]},{guard:ht("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:"isMultiPicker",actions:["toggleSelectedDate"]},{guard:ht("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","focusInputElement"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","focusTriggerElement"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>pC(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",shouldRestoreFocus:({context:e})=>!!e.get("restoreFocus"),isSelectingEndDate:({context:e})=>e.get("activeIndex")===1,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),isInteractOutsideEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="INTERACT_OUTSIDE"},isInputValueEmpty:({event:e})=>e.value.trim()==="",shouldFixOnBlur:({event:e})=>!!e.fixOnBlur},effects:{trackPositioning({context:e,prop:t,scope:n}){if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement);let i=Jh(n);return It(i,()=>oC(n),y(g({},t("positioning")),{defer:!0,onComplete(s){e.set("currentPlacement",s.placement)}}))},setupLiveRegion({scope:e,refs:t}){let n=e.getDoc();return t.set("announcer",XP({level:"assertive",document:n})),()=>{var i,r;return(r=(i=t.get("announcer"))==null?void 0:i.destroy)==null?void 0:r.call(i)}},trackDismissableElement({scope:e,send:t,context:n,prop:i}){return i("inline")?void 0:Ft(()=>ia(e),{type:"popover",defer:!0,exclude:[...Tr(e),mh(e),aC(e)],onInteractOutside(s){n.set("restoreFocus",!s.detail.focusable)},onDismiss(){t({type:"INTERACT_OUTSIDE"})},onEscapeKeyDown(s){s.preventDefault(),t({type:"TABLE.ESCAPE",src:"dismissable"})}})}},actions:{setNextView({context:e,prop:t}){let n=mC(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){let n=vC(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){var o;let i=e.get("value"),r=t("locale"),s=t("timeZone"),a;if(t("selectionMode")==="range"){let[l,c]=i;l&&c?a=Zs(l,c,r,s):l?a=Zs(l,null,r,s):c?a=Zs(c,null,r,s):a=""}else a=i.map(l=>Zs(l,null,r,s)).filter(Boolean).join(",");(o=n.get("announcer"))==null||o.announce(a,3e3)},announceVisibleRange({computed:e,refs:t}){var i;let{formatted:n}=e("visibleRangeText");(i=t.get("announcer"))==null||i.announce(n)},disableTextSelection({scope:e}){io({target:ia(e),doc:e.getDoc()})},enableTextSelection({scope:e}){no({doc:e.getDoc(),target:ia(e)})},focusFirstSelectedDate(e){let{context:t}=e;t.get("value").length&&ve(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){H(()=>{Tr(e).forEach((i,r)=>{Me(i,t("valueAsString")[r]||"")})})},setFocusedDate(e){let{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;ve(e,n)},setFocusedValueForView(e){let{context:t,event:n}=e;ve(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){let{context:t}=e;ve(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){let{context:t}=e;ve(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;let i=t.value.map(r=>Pt(r,n("min"),n("max")));e.set("value",i)},clearDateValue({context:e}){e.set("value",[])},setSelectedDate(e){var r;let{context:t,event:n}=e,i=Array.from(t.get("value"));i[t.get("activeIndex")]=ra(e,(r=n.value)!=null?r:t.get("focusedValue")),t.set("value",sl(i))},resetSelection(e){var r;let{context:t,event:n}=e,i=ra(e,(r=n.value)!=null?r:t.get("focusedValue"));t.set("value",[i])},toggleSelectedDate(e){var s;let{context:t,event:n}=e,i=ra(e,(s=n.value)!=null?s:t.get("focusedValue")),r=t.get("value").findIndex(a=>nt(a,i));if(r===-1){let a=[...t.get("value"),i];t.set("value",Qs(a))}else{let a=Array.from(t.get("value"));a.splice(r,1),t.set("value",Qs(a))}},setHoveredDate({context:e,event:t}){e.set("hoveredValue",t.value)},clearHoveredDate({context:e}){e.set("hoveredValue",null)},selectFocusedDate({context:e,computed:t}){let n=Array.from(e.get("value")),i=e.get("activeIndex");n[i]=e.get("focusedValue").copy(),e.set("value",sl(n));let r=t("valueAsString");e.set("inputValue",r[i])},focusPreviousDay(e){let{context:t}=e,n=t.get("focusedValue").subtract({days:1});ve(e,n)},focusNextDay(e){let{context:t}=e,n=t.get("focusedValue").add({days:1});ve(e,n)},focusPreviousWeek(e){let{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});ve(e,n)},focusNextWeek(e){let{context:t}=e,n=t.get("focusedValue").add({weeks:1});ve(e,n)},focusNextPage(e){let{context:t,computed:n,prop:i}=e,r=qh(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),i("locale"),i("min"),i("max"));ta(e,r)},focusPreviousPage(e){let{context:t,computed:n,prop:i}=e,r=Wh(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),i("locale"),i("min"),i("max"));ta(e,r)},focusSectionStart(e){let{context:t}=e;ve(e,t.get("startValue").copy())},focusSectionEnd(e){let{computed:t}=e;ve(e,t("endValue").copy())},focusNextSection(e){let{context:t,event:n,computed:i,prop:r}=e,s=UP(t.get("focusedValue"),t.get("startValue"),n.larger,i("visibleDuration"),r("locale"),r("min"),r("max"));s&&ta(e,s)},focusPreviousSection(e){let{context:t,event:n,computed:i,prop:r}=e,s=qP(t.get("focusedValue"),t.get("startValue"),n.larger,i("visibleDuration"),r("locale"),r("min"),r("max"));s&&ta(e,s)},focusNextYear(e){let{context:t}=e,n=t.get("focusedValue").add({years:1});ve(e,n)},focusPreviousYear(e){let{context:t}=e,n=t.get("focusedValue").subtract({years:1});ve(e,n)},focusNextDecade(e){let{context:t}=e,n=t.get("focusedValue").add({years:10});ve(e,n)},focusPreviousDecade(e){let{context:t}=e,n=t.get("focusedValue").subtract({years:10});ve(e,n)},clearFocusedDate(e){let{prop:t}=e;ve(e,Di(t("timeZone")))},focusPreviousMonthColumn(e){let{context:t,event:n}=e,i=t.get("focusedValue").subtract({months:n.columns});ve(e,i)},focusNextMonthColumn(e){let{context:t,event:n}=e,i=t.get("focusedValue").add({months:n.columns});ve(e,i)},focusPreviousYearColumn(e){let{context:t,event:n}=e,i=t.get("focusedValue").subtract({years:n.columns});ve(e,i)},focusNextYearColumn(e){let{context:t,event:n}=e,i=t.get("focusedValue").add({years:n.columns});ve(e,i)},focusFirstMonth(e){let{context:t}=e,n=t.get("focusedValue").set({month:1});ve(e,n)},focusLastMonth(e){let{context:t}=e,n=t.get("focusedValue").set({month:12});ve(e,n)},focusFirstYear(e){let{context:t}=e,n=Li(t.get("focusedValue").year),i=t.get("focusedValue").set({year:n[0]});ve(e,i)},focusLastYear(e){let{context:t}=e,n=Li(t.get("focusedValue").year),i=t.get("focusedValue").set({year:n[n.length-1]});ve(e,i)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},focusActiveCell({scope:e,context:t}){H(()=>{var i;let n=t.get("view");(i=fh(e,n))==null||i.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&H(()=>{var r;let i=t.get("view");(r=fh(e,i))==null||r.focus({preventScroll:!0})})},setHoveredValueIfKeyboard({context:e,event:t,prop:n}){!t.type.startsWith("TABLE.ARROW")||n("selectionMode")!=="range"||e.get("activeIndex")===0||e.set("hoveredValue",e.get("focusedValue").copy())},focusTriggerElement({scope:e}){H(()=>{var t;(t=mh(e))==null||t.focus({preventScroll:!0})})},focusFirstInputElement({scope:e}){H(()=>{let[t]=Tr(e);t==null||t.focus({preventScroll:!0})})},focusInputElement({scope:e}){H(()=>{let t=Tr(e),n=t.findLastIndex(s=>s.value!==""),i=Math.max(n,0),r=t[i];r==null||r.focus({preventScroll:!0}),r==null||r.setSelectionRange(r.value.length,r.value.length)})},syncMonthSelectElement({scope:e,context:t}){let n=sC(e);Me(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){let n=rC(e);Me(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{var s;let i=Tr(e),r=(s=n.index)!=null?s:t.get("activeIndex");Me(i[r],t.get("inputValue"))})},focusParsedDate(e){let{event:t,prop:n}=e;if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!r||!vh(r)||ve(e,r)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!r||!vh(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=Pt(r,n("min"),n("max"));let s=Array.from(e.get("value"));s[t.index]=r,e.set("value",s);let a=ea(s,n);e.set("inputValue",a[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){let i=e.get("focusedValue");if(!$t(i,e.get("startValue"),t("endValue")))return;let s=ch(i,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",s)},invokeOnOpen({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){var i;(i=e("onVisibleRangeChange"))==null||i({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}},ra=(e,t)=>{let{context:n,prop:i}=e,r=n.get("view"),s=typeof t=="number"?n.get("focusedValue").set({[r]:t}):t;return bC(a=>{fC(a,i("minView"))&&(s=s.set({[a]:a==="day"?1:0}))}),s};SC=_()(["closeOnSelect","dir","disabled","fixedWeeks","focusedValue","format","parse","placeholder","getRootNode","id","ids","inline","invalid","isDateUnavailable","locale","max","min","name","numOfMonths","onFocusChange","onOpenChange","onValueChange","onViewChange","onVisibleRangeChange","open","defaultOpen","positioning","readOnly","required","selectionMode","startOfWeek","timeZone","translations","value","defaultView","defaultValue","view","defaultFocusedValue","outsideDaySelectable","minView","maxView"]),Ix=B(SC),TC=_()(["index","fixOnBlur"]),Px=B(TC),OC=_()(["value"]),Cx=B(OC),wC=_()(["columns","id","view"]),Sx=B(wC),VC=_()(["disabled","value","columns"]),Tx=B(VC),xC=_()(["view"]),Ox=B(xC),AC=class extends K{constructor(){super(...arguments);z(this,"getDayView",()=>this.el.querySelector('[data-part="day-view"]'));z(this,"getMonthView",()=>this.el.querySelector('[data-part="month-view"]'));z(this,"getYearView",()=>this.el.querySelector('[data-part="year-view"]'));z(this,"renderDayTableHeader",()=>{let t=this.getDayView(),n=t==null?void 0:t.querySelector("thead");if(!n||!this.api.weekDays)return;let i=this.doc.createElement("tr");this.spreadProps(i,this.api.getTableRowProps({view:"day"})),this.api.weekDays.forEach(r=>{let s=this.doc.createElement("th");s.scope="col",s.setAttribute("aria-label",r.long),s.textContent=r.narrow,i.appendChild(s)}),n.innerHTML="",n.appendChild(i)});z(this,"renderDayTableBody",()=>{let t=this.getDayView(),n=t==null?void 0:t.querySelector("tbody");n&&(this.spreadProps(n,this.api.getTableBodyProps({view:"day"})),this.api.weeks&&(n.innerHTML="",this.api.weeks.forEach(i=>{let r=this.doc.createElement("tr");this.spreadProps(r,this.api.getTableRowProps({view:"day"})),i.forEach(s=>{let a=this.doc.createElement("td");this.spreadProps(a,this.api.getDayTableCellProps({value:s}));let o=this.doc.createElement("div");this.spreadProps(o,this.api.getDayTableCellTriggerProps({value:s})),o.textContent=String(s.day),a.appendChild(o),r.appendChild(a)}),n.appendChild(r)})))});z(this,"renderMonthTableBody",()=>{let t=this.getMonthView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;this.spreadProps(n,this.api.getTableBodyProps({view:"month"}));let i=this.api.getMonthsGrid({columns:4,format:"short"});n.innerHTML="",i.forEach(r=>{let s=this.doc.createElement("tr");this.spreadProps(s,this.api.getTableRowProps()),r.forEach(a=>{let o=this.doc.createElement("td");this.spreadProps(o,this.api.getMonthTableCellProps(y(g({},a),{columns:4})));let l=this.doc.createElement("div");this.spreadProps(l,this.api.getMonthTableCellTriggerProps(y(g({},a),{columns:4}))),l.textContent=a.label,o.appendChild(l),s.appendChild(o)}),n.appendChild(s)})});z(this,"renderYearTableBody",()=>{let t=this.getYearView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;this.spreadProps(n,this.api.getTableBodyProps());let i=this.api.getYearsGrid({columns:4});n.innerHTML="",i.forEach(r=>{let s=this.doc.createElement("tr");this.spreadProps(s,this.api.getTableRowProps({view:"year"})),r.forEach(a=>{let o=this.doc.createElement("td");this.spreadProps(o,this.api.getYearTableCellProps(y(g({},a),{columns:4})));let l=this.doc.createElement("div");this.spreadProps(l,this.api.getYearTableCellTriggerProps(y(g({},a),{columns:4}))),l.textContent=a.label,o.appendChild(l),s.appendChild(o)}),n.appendChild(s)})})}initMachine(t){return new W(CC,t)}initApi(){return IC(this.machine.service,q)}render(){let t=this.el.querySelector('[data-scope="date-picker"][data-part="root"]');t&&this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="date-picker"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=this.el.querySelector('[data-scope="date-picker"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps());let r=this.el.querySelector('[data-scope="date-picker"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let s=this.el.querySelector('[data-scope="date-picker"][data-part="trigger"]');s&&this.spreadProps(s,this.api.getTriggerProps());let a=this.el.querySelector('[data-scope="date-picker"][data-part="positioner"]');a&&this.spreadProps(a,this.api.getPositionerProps());let o=this.el.querySelector('[data-scope="date-picker"][data-part="content"]');if(o&&this.spreadProps(o,this.api.getContentProps()),this.api.open){let l=this.getDayView(),c=this.getMonthView(),u=this.getYearView();if(l&&(l.hidden=this.api.view!=="day"),c&&(c.hidden=this.api.view!=="month"),u&&(u.hidden=this.api.view!=="year"),this.api.view==="day"&&l){let h=l.querySelector('[data-part="view-control"]');h&&this.spreadProps(h,this.api.getViewControlProps({view:"year"}));let m=l.querySelector('[data-part="prev-trigger"]');m&&this.spreadProps(m,this.api.getPrevTriggerProps());let d=l.querySelector('[data-part="view-trigger"]');d&&(this.spreadProps(d,this.api.getViewTriggerProps()),d.textContent=this.api.visibleRangeText.start);let p=l.querySelector('[data-part="next-trigger"]');p&&this.spreadProps(p,this.api.getNextTriggerProps());let v=l.querySelector("table");v&&this.spreadProps(v,this.api.getTableProps({view:"day"}));let I=l.querySelector("thead");I&&this.spreadProps(I,this.api.getTableHeaderProps({view:"day"})),this.renderDayTableHeader(),this.renderDayTableBody()}else if(this.api.view==="month"&&c){let h=c.querySelector('[data-part="view-control"]');h&&this.spreadProps(h,this.api.getViewControlProps({view:"month"}));let m=c.querySelector('[data-part="prev-trigger"]');m&&this.spreadProps(m,this.api.getPrevTriggerProps({view:"month"}));let d=c.querySelector('[data-part="view-trigger"]');d&&(this.spreadProps(d,this.api.getViewTriggerProps({view:"month"})),d.textContent=String(this.api.visibleRange.start.year));let p=c.querySelector('[data-part="next-trigger"]');p&&this.spreadProps(p,this.api.getNextTriggerProps({view:"month"}));let v=c.querySelector("table");v&&this.spreadProps(v,this.api.getTableProps({view:"month",columns:4})),this.renderMonthTableBody()}else if(this.api.view==="year"&&u){let h=u.querySelector('[data-part="view-control"]');h&&this.spreadProps(h,this.api.getViewControlProps({view:"year"}));let m=u.querySelector('[data-part="prev-trigger"]');m&&this.spreadProps(m,this.api.getPrevTriggerProps({view:"year"}));let d=u.querySelector('[data-part="decade"]');if(d){let I=this.api.getDecade();d.textContent=`${I.start} - ${I.end}`}let p=u.querySelector('[data-part="next-trigger"]');p&&this.spreadProps(p,this.api.getNextTriggerProps({view:"year"}));let v=u.querySelector("table");v&&this.spreadProps(v,this.api.getTableProps({view:"year",columns:4})),this.renderYearTableBody()}}}};kC={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=this.liveSocket,i=O(e,"min"),r=O(e,"max"),s=O(e,"positioning"),a=u=>u?u.map(h=>gt(h)):void 0,o=u=>u?gt(u):void 0,l=new AC(e,y(g({id:e.id},C(e,"controlled")?{value:a(Z(e,"value"))}:{defaultValue:a(Z(e,"defaultValue"))}),{defaultFocusedValue:o(O(e,"focusedValue")),defaultView:O(e,"defaultView",["day","month","year"]),dir:O(e,"dir",["ltr","rtl"]),locale:O(e,"locale"),timeZone:O(e,"timeZone"),disabled:C(e,"disabled"),readOnly:C(e,"readOnly"),required:C(e,"required"),invalid:C(e,"invalid"),outsideDaySelectable:C(e,"outsideDaySelectable"),closeOnSelect:C(e,"closeOnSelect"),min:i?gt(i):void 0,max:r?gt(r):void 0,numOfMonths:Y(e,"numOfMonths"),startOfWeek:Y(e,"startOfWeek"),fixedWeeks:C(e,"fixedWeeks"),selectionMode:O(e,"selectionMode",["single","multiple","range"]),placeholder:O(e,"placeholder"),minView:O(e,"minView",["day","month","year"]),maxView:O(e,"maxView",["day","month","year"]),inline:C(e,"inline"),positioning:s?JSON.parse(s):void 0,onValueChange:u=>{var p;let h=(p=u.value)!=null&&p.length?u.value.map(v=>yh(v)).join(","):"",m=e.querySelector(`#${e.id}-value`);m&&m.value!==h&&(m.value=h,m.dispatchEvent(new Event("input",{bubbles:!0})),m.dispatchEvent(new Event("change",{bubbles:!0})));let d=O(e,"onValueChange");d&&n.main.isConnected()&&t(d,{id:e.id,value:h||null})},onFocusChange:u=>{var m;let h=O(e,"onFocusChange");h&&n.main.isConnected()&&t(h,{id:e.id,focused:(m=u.focused)!=null?m:!1})},onViewChange:u=>{let h=O(e,"onViewChange");h&&n.main.isConnected()&&t(h,{id:e.id,view:u.view})},onVisibleRangeChange:u=>{let h=O(e,"onVisibleRangeChange");h&&n.main.isConnected()&&t(h,{id:e.id,start:u.start,end:u.end})},onOpenChange:u=>{let h=O(e,"onOpenChange");h&&n.main.isConnected()&&t(h,{id:e.id,open:u.open})}}));l.init(),this.datePicker=l;let c=e.querySelector('[data-scope="date-picker"][data-part="input-wrapper"]');c&&c.removeAttribute("data-loading"),this.handlers=[],this.handlers.push(this.handleEvent("date_picker_set_value",u=>{let h=u.date_picker_id;h&&h!==e.id||l.api.setValue([gt(u.value)])})),this.onSetValue=u=>{var m;let h=(m=u.detail)==null?void 0:m.value;typeof h=="string"&&l.api.setValue([gt(h)])},e.addEventListener("phx:date-picker:set-value",this.onSetValue)},updated(){var l,c;let e=this.el,t=e.querySelector('[data-scope="date-picker"][data-part="input-wrapper"]');t&&t.removeAttribute("data-loading");let n=u=>u?u.map(h=>gt(h)):void 0,i=O(e,"min"),r=O(e,"max"),s=O(e,"positioning"),a=C(e,"controlled"),o=O(e,"focusedValue");if((l=this.datePicker)==null||l.updateProps(y(g({},C(e,"controlled")?{value:n(Z(e,"value"))}:{defaultValue:n(Z(e,"defaultValue"))}),{defaultFocusedValue:o?gt(o):void 0,defaultView:O(e,"defaultView",["day","month","year"]),dir:O(this.el,"dir",["ltr","rtl"]),locale:O(this.el,"locale"),timeZone:O(this.el,"timeZone"),disabled:C(this.el,"disabled"),readOnly:C(this.el,"readOnly"),required:C(this.el,"required"),invalid:C(this.el,"invalid"),outsideDaySelectable:C(this.el,"outsideDaySelectable"),closeOnSelect:C(this.el,"closeOnSelect"),min:i?gt(i):void 0,max:r?gt(r):void 0,numOfMonths:Y(this.el,"numOfMonths"),startOfWeek:Y(this.el,"startOfWeek"),fixedWeeks:C(this.el,"fixedWeeks"),selectionMode:O(this.el,"selectionMode",["single","multiple","range"]),placeholder:O(this.el,"placeholder"),minView:O(this.el,"minView",["day","month","year"]),maxView:O(this.el,"maxView",["day","month","year"]),inline:C(this.el,"inline"),positioning:s?JSON.parse(s):void 0})),a&&this.datePicker){let u=Z(e,"value"),h=(c=u==null?void 0:u.join(","))!=null?c:"",m=this.datePicker.api.value,d=m!=null&&m.length?m.map(p=>yh(p)).join(","):"";if(h!==d){let p=u!=null&&u.length?u.map(v=>gt(v)):[];this.datePicker.api.setValue(p)}}},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:date-picker:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.datePicker)==null||e.destroy()}}});var ug={};he(ug,{Dialog:()=>lS});function HC(e,t={}){let{defer:n=!0}=t,i=n?$C:s=>s(),r=[];return r.push(i(()=>{let a=(typeof e=="function"?e():e).filter(Boolean);a.length!==0&&r.push(FC(a))})),()=>{r.forEach(s=>s==null?void 0:s())}}function YC(e,t={}){let n,i=H(()=>{let s=(Array.isArray(e)?e:[e]).map(o=>typeof o=="function"?o():o).filter(o=>o!=null);if(s.length===0)return;let a=s[0];n=new UC(s,y(g({escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:a},t),{document:Le(a)}));try{n.activate()}catch(o){}});return function(){n==null||n.deactivate(),i()}}function jC(e){let t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?"paddingLeft":"paddingRight"}function rg(e){let t=at(e),n=t==null?void 0:t.scrollbarGutter;return n==="stable"||(n==null?void 0:n.startsWith("stable "))===!0}function XC(e){var d;let t=e!=null?e:document,n=(d=t.defaultView)!=null?d:window,{documentElement:i,body:r}=t;if(r.hasAttribute(yl))return;let a=rg(i)||rg(r),o=n.innerWidth-i.clientWidth;r.setAttribute(yl,"");let l=()=>$c(i,"--scrollbar-width",`${o}px`),c=jC(i),u=()=>{let p={overflow:"hidden"};return!a&&o>0&&(p[c]=`${o}px`),Hn(r,p)},h=()=>{var S,P;let{scrollX:p,scrollY:v,visualViewport:I}=n,T=(S=I==null?void 0:I.offsetLeft)!=null?S:0,w=(P=I==null?void 0:I.offsetTop)!=null?P:0,b={position:"fixed",overflow:"hidden",top:`${-(v-Math.floor(w))}px`,left:`${-(p-Math.floor(T))}px`,right:"0"};!a&&o>0&&(b[c]=`${o}px`);let f=Hn(r,b);return()=>{f==null||f(),n.scrollTo({left:p,top:v,behavior:"instant"})}},m=[l(),ir()?h():u()];return()=>{m.forEach(p=>p==null?void 0:p()),r.removeAttribute(yl)}}function rS(e,t){let{state:n,send:i,context:r,prop:s,scope:a}=e,o=s("aria-label"),l=n.matches("open");return{open:l,setOpen(c){n.matches("open")!==c&&i({type:c?"OPEN":"CLOSE"})},getTriggerProps(){return t.button(y(g({},Qn.trigger.attrs),{dir:s("dir"),id:lg(a),"aria-haspopup":"dialog",type:"button","aria-expanded":l,"data-state":l?"open":"closed","aria-controls":bl(a),onClick(c){c.defaultPrevented||i({type:"TOGGLE"})}}))},getBackdropProps(){return t.element(y(g({},Qn.backdrop.attrs),{dir:s("dir"),hidden:!l,id:og(a),"data-state":l?"open":"closed"}))},getPositionerProps(){return t.element(y(g({},Qn.positioner.attrs),{dir:s("dir"),id:ag(a),style:{pointerEvents:l?void 0:"none"}}))},getContentProps(){let c=r.get("rendered");return t.element(y(g({},Qn.content.attrs),{dir:s("dir"),role:s("role"),hidden:!l,id:bl(a),tabIndex:-1,"data-state":l?"open":"closed","aria-modal":!0,"aria-label":o||void 0,"aria-labelledby":o||!c.title?void 0:El(a),"aria-describedby":c.description?Il(a):void 0}))},getTitleProps(){return t.element(y(g({},Qn.title.attrs),{dir:s("dir"),id:El(a)}))},getDescriptionProps(){return t.element(y(g({},Qn.description.attrs),{dir:s("dir"),id:Il(a)}))},getCloseTriggerProps(){return t.button(y(g({},Qn.closeTrigger.attrs),{dir:s("dir"),id:cg(a),type:"button",onClick(c){c.defaultPrevented||(c.stopPropagation(),i({type:"CLOSE"}))}}))}}}var Hi,ca,ua,ml,sg,NC,RC,DC,LC,MC,FC,$C,BC,_C,be,ng,GC,UC,Pl,vl,qC,WC,Ar,KC,ig,zC,yl,ZC,Qn,ag,og,bl,lg,El,Il,cg,da,JC,QC,eS,tS,nS,iS,sS,aS,Dx,oS,lS,dg=re(()=>{"use strict";Wn();tn();se();Hi=new WeakMap,ca=new WeakMap,ua={},ml=0,sg=e=>e&&(e.host||sg(e.parentNode)),NC=(e,t)=>t.map(n=>{if(e.contains(n))return n;let i=sg(n);return i&&e.contains(i)?i:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",e,". Doing nothing"),null)}).filter(n=>!!n),RC=new Set(["script","output","status","next-route-announcer"]),DC=e=>RC.has(e.localName)||e.role==="status"||e.hasAttribute("aria-live")?!0:e.matches("[data-live-announcer]"),LC=(e,t)=>{let{parentNode:n,markerName:i,controlAttribute:r,followControlledElements:s=!0}=t,a=NC(n,Array.isArray(e)?e:[e]);ua[i]||(ua[i]=new WeakMap);let o=ua[i],l=[],c=new Set,u=new Set(a),h=d=>{!d||c.has(d)||(c.add(d),h(d.parentNode))};a.forEach(d=>{h(d),s&&le(d)&&Xa(d,p=>{h(p)})});let m=d=>{!d||u.has(d)||Array.prototype.forEach.call(d.children,p=>{if(c.has(p))m(p);else try{if(DC(p))return;let I=p.getAttribute(r)==="true",T=(Hi.get(p)||0)+1,w=(o.get(p)||0)+1;Hi.set(p,T),o.set(p,w),l.push(p),T===1&&I&&ca.set(p,!0),w===1&&p.setAttribute(i,""),I||p.setAttribute(r,"true")}catch(v){console.error("[zag-js > ariaHidden] cannot operate on ",p,v)}})};return m(n),c.clear(),ml++,()=>{l.forEach(d=>{let p=Hi.get(d)-1,v=o.get(d)-1;Hi.set(d,p),o.set(d,v),p||(ca.has(d)||d.removeAttribute(r),ca.delete(d)),v||d.removeAttribute(i)}),ml--,ml||(Hi=new WeakMap,Hi=new WeakMap,ca=new WeakMap,ua={})}},MC=e=>(Array.isArray(e)?e[0]:e).ownerDocument.body,FC=(e,t=MC(e),n="data-aria-hidden",i=!0)=>{if(t)return LC(e,{parentNode:t,markerName:n,controlAttribute:"aria-hidden",followControlledElements:i})},$C=e=>{let t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)};BC=Object.defineProperty,_C=(e,t,n)=>t in e?BC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,be=(e,t,n)=>_C(e,typeof t!="symbol"?t+"":t,n),ng={activateTrap(e,t){if(e.length>0){let i=e[e.length-1];i!==t&&i.pause()}let n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},GC=[],UC=class{constructor(e,t){be(this,"trapStack"),be(this,"config"),be(this,"doc"),be(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),be(this,"portalContainers",new Set),be(this,"listenerCleanups",[]),be(this,"handleFocus",i=>{let r=j(i),s=this.findContainerIndex(r,i)>=0;if(s||nr(r))s&&(this.state.mostRecentlyFocusedNode=r);else{i.stopImmediatePropagation();let a,o=!0;if(this.state.mostRecentlyFocusedNode)if(fi(this.state.mostRecentlyFocusedNode)>0){let l=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:c}=this.state.containerGroups[l];if(c.length>0){let u=c.findIndex(h=>h===this.state.mostRecentlyFocusedNode);u>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?u+1=0&&(a=c[u-1],o=!1))}}else this.state.containerGroups.some(l=>l.tabbableNodes.some(c=>fi(c)>0))||(o=!1);else o=!1;o&&(a=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),a?this.tryFocus(a):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),be(this,"handlePointerDown",i=>{let r=j(i);if(!(this.findContainerIndex(r,i)>=0)){if(Ar(this.config.clickOutsideDeactivates,i)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}Ar(this.config.allowOutsideClick,i)||i.preventDefault()}}),be(this,"handleClick",i=>{let r=j(i);this.findContainerIndex(r,i)>=0||Ar(this.config.clickOutsideDeactivates,i)||Ar(this.config.allowOutsideClick,i)||(i.preventDefault(),i.stopImmediatePropagation())}),be(this,"handleTabKey",i=>{if(this.config.isKeyForward(i)||this.config.isKeyBackward(i)){this.state.recentNavEvent=i;let r=this.config.isKeyBackward(i),s=this.findNextNavNode({event:i,isBackward:r});if(!s)return;vl(i)&&i.preventDefault(),this.tryFocus(s)}}),be(this,"handleEscapeKey",i=>{KC(i)&&Ar(this.config.escapeDeactivates,i)!==!1&&(i.preventDefault(),this.deactivate())}),be(this,"_mutationObserver"),be(this,"setupMutationObserver",()=>{let i=this.doc.defaultView||window;this._mutationObserver=new i.MutationObserver(r=>{r.some(o=>Array.from(o.removedNodes).some(c=>c===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode()),r.some(o=>o.type==="attributes"&&(o.attributeName==="aria-controls"||o.attributeName==="aria-expanded")?!0:o.type==="childList"&&o.addedNodes.length>0?Array.from(o.addedNodes).some(l=>{if(l.nodeType!==Node.ELEMENT_NODE)return!1;let c=l;return Pc(c)?!0:c.id&&!this.state.containers.some(u=>u.contains(c))?Cc(c):!1}):!1)&&this.state.active&&!this.state.paused&&(this.updateTabbableNodes(),this.updatePortalContainers())})}),be(this,"updateObservedNodes",()=>{var i;(i=this._mutationObserver)==null||i.disconnect(),this.state.active&&!this.state.paused&&(this.state.containers.map(r=>{var s;(s=this._mutationObserver)==null||s.observe(r,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-controls","aria-expanded"]})}),this.portalContainers.forEach(r=>{this.observePortalContainer(r)}))}),be(this,"getInitialFocusNode",()=>{let i=this.getNodeForOption("initialFocus",{hasFallback:!0});if(i===!1)return!1;if(i===void 0||i&&!Ye(i)){let r=ui(this.doc);if(r&&this.findContainerIndex(r)>=0)i=r;else{let s=this.state.tabbableGroups[0];i=s&&s.firstTabbableNode||this.getNodeForOption("fallbackFocus")}}else i===null&&(i=this.getNodeForOption("fallbackFocus"));if(!i)throw new Error("Your focus-trap needs to have at least one focusable element");return i.isConnected||(i=this.getNodeForOption("fallbackFocus")),i}),be(this,"tryFocus",i=>{if(i!==!1&&i!==ui(this.doc)){if(!i||!i.focus){this.tryFocus(this.getInitialFocusNode());return}i.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=i,zC(i)&&i.select()}}),be(this,"deactivate",i=>{if(!this.state.active)return this;let r=g({onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus},i);clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),ng.deactivateTrap(this.trapStack,this),this.portalContainers.clear();let s=this.getOption(r,"onDeactivate"),a=this.getOption(r,"onPostDeactivate"),o=this.getOption(r,"checkCanReturnFocus"),l=this.getOption(r,"returnFocus","returnFocusOnDeactivate");s==null||s();let c=()=>{ig(()=>{if(l){let u=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(u)}a==null||a()})};if(l&&o){let u=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return o(u).then(c,c),this}return c(),this}),be(this,"pause",i=>{if(this.state.paused||!this.state.active)return this;let r=this.getOption(i,"onPause"),s=this.getOption(i,"onPostPause");return this.state.paused=!0,r==null||r(),this.removeListeners(),this.updateObservedNodes(),s==null||s(),this}),be(this,"unpause",i=>{if(!this.state.paused||!this.state.active)return this;let r=this.getOption(i,"onUnpause"),s=this.getOption(i,"onPostUnpause");return this.state.paused=!1,r==null||r(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),s==null||s(),this}),be(this,"updateContainerElements",i=>(this.state.containers=Array.isArray(i)?i.filter(Boolean):[i].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),be(this,"getReturnFocusNode",i=>{let r=this.getNodeForOption("setReturnFocus",{params:[i]});return r||(r===!1?!1:i)}),be(this,"getOption",(i,r,s)=>i&&i[r]!==void 0?i[r]:this.config[s||r]),be(this,"getNodeForOption",(i,{hasFallback:r=!1,params:s=[]}={})=>{let a=this.config[i];if(typeof a=="function"&&(a=a(...s)),a===!0&&(a=void 0),!a){if(a===void 0||a===!1)return a;throw new Error(`\`${i}\` was specified but was not a node, or did not return a node`)}let o=a;if(typeof a=="string"){try{o=this.doc.querySelector(a)}catch(l){throw new Error(`\`${i}\` appears to be an invalid selector; error="${l.message}"`)}if(!o&&!r)throw new Error(`\`${i}\` as selector refers to no known node`)}return o}),be(this,"findNextNavNode",i=>{let{event:r,isBackward:s=!1}=i,a=i.target||j(r);this.updateTabbableNodes();let o=null;if(this.state.tabbableGroups.length>0){let l=this.findContainerIndex(a,r),c=l>=0?this.state.containerGroups[l]:void 0;if(l<0)s?o=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:o=this.state.tabbableGroups[0].firstTabbableNode;else if(s){let u=this.state.tabbableGroups.findIndex(({firstTabbableNode:h})=>a===h);if(u<0&&((c==null?void 0:c.container)===a||Ye(a)&&!dn(a)&&!(c!=null&&c.nextTabbableNode(a,!1)))&&(u=l),u>=0){let h=u===0?this.state.tabbableGroups.length-1:u-1,m=this.state.tabbableGroups[h];o=fi(a)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else vl(r)||(o=c==null?void 0:c.nextTabbableNode(a,!1))}else{let u=this.state.tabbableGroups.findIndex(({lastTabbableNode:h})=>a===h);if(u<0&&((c==null?void 0:c.container)===a||Ye(a)&&!dn(a)&&!(c!=null&&c.nextTabbableNode(a)))&&(u=l),u>=0){let h=u===this.state.tabbableGroups.length-1?0:u+1,m=this.state.tabbableGroups[h];o=fi(a)>=0?m.firstTabbableNode:m.firstDomTabbableNode}else vl(r)||(o=c==null?void 0:c.nextTabbableNode(a))}}else o=this.getNodeForOption("fallbackFocus");return o}),this.trapStack=t.trapStack||GC;let n=g({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,followControlledElements:!0,isKeyForward:qC,isKeyBackward:WC},t);this.doc=n.document||Le(Array.isArray(e)?e[0]:e),this.config=n,this.updateContainerElements(e),this.setupMutationObserver()}addPortalContainer(e){let t=e.parentElement;t&&!this.portalContainers.has(t)&&(this.portalContainers.add(t),this.state.active&&!this.state.paused&&this.observePortalContainer(t))}observePortalContainer(e){var t;(t=this._mutationObserver)==null||t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-controls","aria-expanded"]})}updatePortalContainers(){this.config.followControlledElements&&this.state.containers.forEach(e=>{Ic(e).forEach(n=>{this.addPortalContainer(n)})})}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(e,t){let n=typeof(t==null?void 0:t.composedPath)=="function"?t.composedPath():void 0;return this.state.containerGroups.findIndex(({container:i,tabbableNodes:r})=>i.contains(e)||(n==null?void 0:n.includes(i))||r.find(s=>s===e)||this.isControlledElement(i,e))}isControlledElement(e,t){return this.config.followControlledElements?as(e,t):!1}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(e=>{let t=jt(e,{getShadowRoot:this.config.getShadowRoot}),n=ar(e,{getShadowRoot:this.config.getShadowRoot}),i=t[0],r=t[t.length-1],s=i,a=r,o=!1;for(let c=0;c0){o=!0;break}function l(c,u=!0){let h=t.indexOf(c);if(h>=0)return t[h+(u?1:-1)];let m=n.indexOf(c);if(!(m<0)){if(u){for(let d=m+1;d=0;d--)if(dn(n[d]))return n[d]}}return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:o,firstTabbableNode:i,lastTabbableNode:r,firstDomTabbableNode:s,lastDomTabbableNode:a,nextTabbableNode:l}}),this.state.tabbableGroups=this.state.containerGroups.filter(e=>e.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(e=>e.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return ng.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?ig(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(ee(this.doc,"focusin",this.handleFocus,!0),ee(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),ee(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),ee(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),ee(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),ee(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(e=>e()),this.listenerCleanups=[],this}activate(e){if(this.state.active)return this;let t=this.getOption(e,"onActivate"),n=this.getOption(e,"onPostActivate"),i=this.getOption(e,"checkCanFocusTrap");i||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=ui(this.doc),t==null||t();let r=()=>{i&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n==null||n()};return i?(i(this.state.containers.concat()).then(r,r),this):(r(),this)}},Pl=e=>e.type==="keydown",vl=e=>Pl(e)&&(e==null?void 0:e.key)==="Tab",qC=e=>Pl(e)&&e.key==="Tab"&&!(e!=null&&e.shiftKey),WC=e=>Pl(e)&&e.key==="Tab"&&(e==null?void 0:e.shiftKey),Ar=(e,...t)=>typeof e=="function"?e(...t):e,KC=e=>!e.isComposing&&e.key==="Escape",ig=e=>setTimeout(e,0),zC=e=>e.localName==="input"&&"select"in e&&typeof e.select=="function";yl="data-scroll-lock";ZC=U("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),Qn=ZC.build(),ag=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`dialog:${e.id}:positioner`},og=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.backdrop)!=null?n:`dialog:${e.id}:backdrop`},bl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`dialog:${e.id}:content`},lg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`dialog:${e.id}:trigger`},El=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`dialog:${e.id}:title`},Il=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.description)!=null?n:`dialog:${e.id}:description`},cg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.closeTrigger)!=null?n:`dialog:${e.id}:close`},da=e=>e.getById(bl(e)),JC=e=>e.getById(ag(e)),QC=e=>e.getById(og(e)),eS=e=>e.getById(lg(e)),tS=e=>e.getById(El(e)),nS=e=>e.getById(Il(e)),iS=e=>e.getById(cg(e));sS={props({props:e,scope:t}){let n=e.role==="alertdialog",i=n?()=>iS(t):void 0,r=typeof e.modal=="boolean"?e.modal:!0;return g({role:"dialog",modal:r,trapFocus:r,preventScroll:r,closeOnInteractOutside:!n,closeOnEscape:!0,restoreFocus:!0,initialFocusEl:i},e)},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({bindable:e}){return{rendered:e(()=>({defaultValue:{title:!0,description:!0}}))}},watch({track:e,action:t,prop:n}){e([()=>n("open")],()=>{t(["toggleVisibility"])})},states:{open:{entry:["checkRenderedElements","syncZIndex"],effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}},implementations:{guards:{isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackDismissableElement({scope:e,send:t,prop:n}){return Ft(()=>da(e),{type:"dialog",defer:!0,pointerBlocking:n("modal"),exclude:[eS(e)],onInteractOutside(r){var s;(s=n("onInteractOutside"))==null||s(r),n("closeOnInteractOutside")||r.preventDefault()},persistentElements:n("persistentElements"),onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onRequestDismiss:n("onRequestDismiss"),onEscapeKeyDown(r){var s;(s=n("onEscapeKeyDown"))==null||s(r),n("closeOnEscape")||r.preventDefault()},onDismiss(){t({type:"CLOSE",src:"interact-outside"})}})},preventScroll({scope:e,prop:t}){if(t("preventScroll"))return XC(e.getDoc())},trapFocus({scope:e,prop:t}){return t("trapFocus")?YC(()=>da(e),{preventScroll:!0,returnFocusOnDeactivate:!!t("restoreFocus"),initialFocus:t("initialFocusEl"),setReturnFocus:i=>{var r,s;return(s=(r=t("finalFocusEl"))==null?void 0:r())!=null?s:i},getShadowRoot:!0}):void 0},hideContentBelow({scope:e,prop:t}){return t("modal")?HC(()=>[da(e)],{defer:!0}):void 0}},actions:{checkRenderedElements({context:e,scope:t}){H(()=>{e.set("rendered",{title:!!tS(t),description:!!nS(t)})})},syncZIndex({scope:e}){H(()=>{let t=da(e);if(!t)return;let n=at(t);[JC(e),QC(e)].forEach(r=>{r==null||r.style.setProperty("--z-index",n.zIndex),r==null||r.style.setProperty("--layer-index",n.getPropertyValue("--layer-index"))})})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},toggleVisibility({prop:e,send:t,event:n}){t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}},aS=_()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","defaultOpen","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]),Dx=B(aS),oS=class extends K{initMachine(e){return new W(sS,e)}initApi(){return rS(this.machine.service,q)}render(){let e=this.el,t=e.querySelector('[data-scope="dialog"][data-part="trigger"]');t&&this.spreadProps(t,this.api.getTriggerProps());let n=e.querySelector('[data-scope="dialog"][data-part="backdrop"]');n&&this.spreadProps(n,this.api.getBackdropProps());let i=e.querySelector('[data-scope="dialog"][data-part="positioner"]');i&&this.spreadProps(i,this.api.getPositionerProps());let r=e.querySelector('[data-scope="dialog"][data-part="content"]');r&&this.spreadProps(r,this.api.getContentProps());let s=e.querySelector('[data-scope="dialog"][data-part="title"]');s&&this.spreadProps(s,this.api.getTitleProps());let a=e.querySelector('[data-scope="dialog"][data-part="description"]');a&&this.spreadProps(a,this.api.getDescriptionProps());let o=e.querySelector('[data-scope="dialog"][data-part="close-trigger"]');o&&this.spreadProps(o,this.api.getCloseTriggerProps())}},lS={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=new oS(e,y(g({id:e.id},C(e,"controlled")?{open:C(e,"open")}:{defaultOpen:C(e,"defaultOpen")}),{modal:C(e,"modal"),closeOnInteractOutside:C(e,"closeOnInteractOutside"),closeOnEscape:C(e,"closeOnEscapeKeyDown"),preventScroll:C(e,"preventScroll"),restoreFocus:C(e,"restoreFocus"),dir:O(e,"dir",["ltr","rtl"]),onOpenChange:i=>{let r=O(e,"onOpenChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,open:i.open});let s=O(e,"onOpenChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,open:i.open}}))}}));n.init(),this.dialog=n,this.onSetOpen=i=>{let{open:r}=i.detail;n.api.setOpen(r)},e.addEventListener("phx:dialog:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("dialog_set_open",i=>{let r=i.dialog_id;r&&r!==e.id||n.api.setOpen(i.open)})),this.handlers.push(this.handleEvent("dialog_open",()=>{this.pushEvent("dialog_open_response",{value:n.api.open})}))},updated(){var e;(e=this.dialog)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{open:C(this.el,"open")}:{defaultOpen:C(this.el,"defaultOpen")}),{modal:C(this.el,"modal"),closeOnInteractOutside:C(this.el,"closeOnInteractOutside"),closeOnEscape:C(this.el,"closeOnEscapeKeyDown"),preventScroll:C(this.el,"preventScroll"),restoreFocus:C(this.el,"restoreFocus"),dir:O(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onSetOpen&&this.el.removeEventListener("phx:dialog:set-open",this.onSetOpen),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.dialog)==null||e.destroy()}}});var mg={};he(mg,{Editable:()=>PS});function yS(e,t){var S;let{state:n,context:i,send:r,prop:s,scope:a,computed:o}=e,l=!!s("disabled"),c=o("isInteractive"),u=!!s("readOnly"),h=!!s("required"),m=!!s("invalid"),d=!!s("autoResize"),p=s("translations"),v=n.matches("edit"),I=s("placeholder"),T=typeof I=="string"?{edit:I,preview:I}:I,w=i.get("value"),b=w.trim()==="",f=b?(S=T==null?void 0:T.preview)!=null?S:"":w;return{editing:v,empty:b,value:w,valueText:f,setValue(P){r({type:"VALUE.SET",value:P,src:"setValue"})},clearValue(){r({type:"VALUE.SET",value:"",src:"clearValue"})},edit(){c&&r({type:"EDIT"})},cancel(){c&&r({type:"CANCEL"})},submit(){c&&r({type:"SUBMIT"})},getRootProps(){return t.element(y(g({},ln.root.attrs),{id:uS(a),dir:s("dir")}))},getAreaProps(){return t.element(y(g({},ln.area.attrs),{id:dS(a),dir:s("dir"),style:d?{display:"inline-grid"}:void 0,"data-focus":E(v),"data-disabled":E(l),"data-placeholder-shown":E(b)}))},getLabelProps(){return t.label(y(g({},ln.label.attrs),{id:hS(a),dir:s("dir"),htmlFor:Cl(a),"data-focus":E(v),"data-invalid":E(m),"data-required":E(h),onClick(){if(v)return;let P=pS(a);P==null||P.focus({preventScroll:!0})}}))},getInputProps(){return t.input(y(g({},ln.input.attrs),{dir:s("dir"),"aria-label":p==null?void 0:p.input,name:s("name"),form:s("form"),id:Cl(a),hidden:d?void 0:!v,placeholder:T==null?void 0:T.edit,maxLength:s("maxLength"),required:s("required"),disabled:l,"data-disabled":E(l),readOnly:u,"data-readonly":E(u),"aria-invalid":X(m),"data-invalid":E(m),"data-autoresize":E(d),defaultValue:w,size:d?1:void 0,onChange(P){r({type:"VALUE.SET",src:"input.change",value:P.currentTarget.value})},onKeyDown(P){if(P.defaultPrevented||Re(P))return;let A={Escape(){r({type:"CANCEL"}),P.preventDefault()},Enter(x){if(!o("submitOnEnter"))return;let{localName:k}=x.currentTarget;if(k==="textarea"){if(!(Qa()?x.metaKey:x.ctrlKey))return;r({type:"SUBMIT",src:"keydown.enter"});return}k==="input"&&!x.shiftKey&&!x.metaKey&&(r({type:"SUBMIT",src:"keydown.enter"}),x.preventDefault())}}[P.key];A&&A(P)},style:d?{gridArea:"1 / 1 / auto / auto",visibility:v?void 0:"hidden"}:void 0}))},getPreviewProps(){return t.element(y(g({id:hg(a)},ln.preview.attrs),{dir:s("dir"),"data-placeholder-shown":E(b),"aria-readonly":X(u),"data-readonly":E(l),"data-disabled":E(l),"aria-disabled":X(l),"aria-invalid":X(m),"data-invalid":E(m),"aria-label":p==null?void 0:p.edit,"data-autoresize":E(d),children:f,hidden:d?void 0:v,tabIndex:c?0:void 0,onClick(){c&&s("activationMode")==="click"&&r({type:"EDIT",src:"click"})},onFocus(){c&&s("activationMode")==="focus"&&r({type:"EDIT",src:"focus"})},onDoubleClick(P){P.defaultPrevented||c&&s("activationMode")==="dblclick"&&r({type:"EDIT",src:"dblclick"})},style:d?{whiteSpace:"pre",gridArea:"1 / 1 / auto / auto",visibility:v?"hidden":void 0,overflow:"hidden",textOverflow:"ellipsis"}:void 0}))},getEditTriggerProps(){return t.button(y(g({},ln.editTrigger.attrs),{id:fg(a),dir:s("dir"),"aria-label":p==null?void 0:p.edit,hidden:v,type:"button",disabled:l,onClick(P){P.defaultPrevented||c&&r({type:"EDIT",src:"edit.click"})}}))},getControlProps(){return t.element(y(g({id:gS(a)},ln.control.attrs),{dir:s("dir")}))},getSubmitTriggerProps(){return t.button(y(g({},ln.submitTrigger.attrs),{dir:s("dir"),id:gg(a),"aria-label":p==null?void 0:p.submit,hidden:!v,disabled:l,type:"button",onClick(P){P.defaultPrevented||c&&r({type:"SUBMIT",src:"submit.click"})}}))},getCancelTriggerProps(){return t.button(y(g({},ln.cancelTrigger.attrs),{dir:s("dir"),"aria-label":p==null?void 0:p.cancel,id:pg(a),hidden:!v,type:"button",disabled:l,onClick(P){P.defaultPrevented||c&&r({type:"CANCEL",src:"cancel.click"})}}))}}}var cS,ln,uS,dS,hS,hg,Cl,gS,gg,pg,fg,ha,pS,fS,mS,vS,bS,ES,Bx,IS,PS,vg=re(()=>{"use strict";tn();se();cS=U("editable").parts("root","area","label","preview","input","editTrigger","submitTrigger","cancelTrigger","control"),ln=cS.build(),uS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`editable:${e.id}`},dS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`editable:${e.id}:area`},hS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`editable:${e.id}:label`},hg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.preview)!=null?n:`editable:${e.id}:preview`},Cl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`editable:${e.id}:input`},gS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`editable:${e.id}:control`},gg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.submitTrigger)!=null?n:`editable:${e.id}:submit`},pg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.cancelTrigger)!=null?n:`editable:${e.id}:cancel`},fg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.editTrigger)!=null?n:`editable:${e.id}:edit`},ha=e=>e.getById(Cl(e)),pS=e=>e.getById(hg(e)),fS=e=>e.getById(gg(e)),mS=e=>e.getById(pg(e)),vS=e=>e.getById(fg(e));bS={props({props:e}){return y(g({activationMode:"focus",submitMode:"both",defaultValue:"",selectOnFocus:!0},e),{translations:g({input:"editable input",edit:"edit",submit:"submit",cancel:"cancel"},e.translations)})},initialState({prop:e}){return e("edit")||e("defaultEdit")?"edit":"preview"},entry:["focusInputIfNeeded"],context:({bindable:e,prop:t})=>({value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var i;return(i=t("onValueChange"))==null?void 0:i({value:n})}})),previousValue:e(()=>({defaultValue:""}))}),watch({track:e,action:t,context:n,prop:i}){e([()=>n.get("value")],()=>{t(["syncInputValue"])}),e([()=>i("edit")],()=>{t(["toggleEditing"])})},computed:{submitOnEnter({prop:e}){let t=e("submitMode");return t==="both"||t==="enter"},submitOnBlur({prop:e}){let t=e("submitMode");return t==="both"||t==="blur"},isInteractive({prop:e}){return!(e("disabled")||e("readOnly"))}},on:{"VALUE.SET":{actions:["setValue"]}},states:{preview:{entry:["blurInput"],on:{"CONTROLLED.EDIT":{target:"edit",actions:["setPreviousValue","focusInput"]},EDIT:[{guard:"isEditControlled",actions:["invokeOnEdit"]},{target:"edit",actions:["setPreviousValue","focusInput","invokeOnEdit"]}]}},edit:{effects:["trackInteractOutside"],entry:["syncInputValue"],on:{"CONTROLLED.PREVIEW":[{guard:"isSubmitEvent",target:"preview",actions:["setPreviousValue","restoreFocus","invokeOnSubmit"]},{target:"preview",actions:["revertValue","restoreFocus","invokeOnCancel"]}],CANCEL:[{guard:"isEditControlled",actions:["invokeOnPreview"]},{target:"preview",actions:["revertValue","restoreFocus","invokeOnCancel","invokeOnPreview"]}],SUBMIT:[{guard:"isEditControlled",actions:["invokeOnPreview"]},{target:"preview",actions:["setPreviousValue","restoreFocus","invokeOnSubmit","invokeOnPreview"]}]}}},implementations:{guards:{isEditControlled:({prop:e})=>e("edit")!=null,isSubmitEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="SUBMIT"}},effects:{trackInteractOutside({send:e,scope:t,prop:n,computed:i}){return Ws(ha(t),{exclude(r){return[mS(t),fS(t)].some(a=>ce(a,r))},onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(r){var a;if((a=n("onInteractOutside"))==null||a(r),r.defaultPrevented)return;let{focusable:s}=r.detail;e({type:i("submitOnBlur")?"SUBMIT":"CANCEL",src:"interact-outside",focusable:s})}})}},actions:{restoreFocus({event:e,scope:t,prop:n}){e.focusable||H(()=>{var r,s;let i=(s=(r=n("finalFocusEl"))==null?void 0:r())!=null?s:vS(t);i==null||i.focus({preventScroll:!0})})},clearValue({context:e}){e.set("value","")},focusInputIfNeeded({action:e,prop:t}){(t("edit")||t("defaultEdit"))&&e(["focusInput"])},focusInput({scope:e,prop:t}){H(()=>{let n=ha(e);n&&(t("selectOnFocus")?n.select():n.focus({preventScroll:!0}))})},invokeOnCancel({prop:e,context:t}){var i;let n=t.get("previousValue");(i=e("onValueRevert"))==null||i({value:n})},invokeOnSubmit({prop:e,context:t}){var i;let n=t.get("value");(i=e("onValueCommit"))==null||i({value:n})},invokeOnEdit({prop:e}){var t;(t=e("onEditChange"))==null||t({edit:!0})},invokeOnPreview({prop:e}){var t;(t=e("onEditChange"))==null||t({edit:!1})},toggleEditing({prop:e,send:t,event:n}){t({type:e("edit")?"CONTROLLED.EDIT":"CONTROLLED.PREVIEW",previousEvent:n})},syncInputValue({context:e,scope:t}){let n=ha(t);n&&Me(n,e.get("value"))},setValue({context:e,prop:t,event:n}){let i=t("maxLength"),r=i!=null?n.value.slice(0,i):n.value;e.set("value",r)},setPreviousValue({context:e}){e.set("previousValue",e.get("value"))},revertValue({context:e}){let t=e.get("previousValue");t&&e.set("value",t)},blurInput({scope:e}){var t;(t=ha(e))==null||t.blur()}}}},ES=_()(["activationMode","autoResize","dir","disabled","finalFocusEl","form","getRootNode","id","ids","invalid","maxLength","name","onEditChange","onFocusOutside","onInteractOutside","onPointerDownOutside","onValueChange","onValueCommit","onValueRevert","placeholder","readOnly","required","selectOnFocus","edit","defaultEdit","submitMode","translations","defaultValue","value"]),Bx=B(ES),IS=class extends K{initMachine(e){return new W(bS,e)}initApi(){return yS(this.machine.service,q)}render(){var l;let e=(l=this.el.querySelector('[data-scope="editable"][data-part="root"]'))!=null?l:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="editable"][data-part="area"]');t&&this.spreadProps(t,this.api.getAreaProps());let n=this.el.querySelector('[data-scope="editable"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=this.el.querySelector('[data-scope="editable"][data-part="input"]');i&&this.spreadProps(i,this.api.getInputProps());let r=this.el.querySelector('[data-scope="editable"][data-part="preview"]');r&&this.spreadProps(r,this.api.getPreviewProps());let s=this.el.querySelector('[data-scope="editable"][data-part="edit-trigger"]');s&&this.spreadProps(s,this.api.getEditTriggerProps());let a=this.el.querySelector('[data-scope="editable"][data-part="submit-trigger"]');a&&this.spreadProps(a,this.api.getSubmitTriggerProps());let o=this.el.querySelector('[data-scope="editable"][data-part="cancel-trigger"]');o&&this.spreadProps(o,this.api.getCancelTriggerProps())}},PS={mounted(){let e=this.el,t=O(e,"value"),n=O(e,"defaultValue"),i=C(e,"controlled"),r=O(e,"placeholder"),s=O(e,"activationMode"),a=C(e,"selectOnFocus"),o=new IS(e,y(g(g(g(g(y(g({id:e.id},i&&t!==void 0?{value:t}:{defaultValue:n!=null?n:""}),{disabled:C(e,"disabled"),readOnly:C(e,"readOnly"),required:C(e,"required"),invalid:C(e,"invalid"),name:O(e,"name"),form:O(e,"form"),dir:Oe(e)}),r!==void 0?{placeholder:r}:{}),s!==void 0?{activationMode:s}:{}),a!==void 0?{selectOnFocus:a}:{}),C(e,"controlledEdit")?{edit:C(e,"edit")}:{defaultEdit:C(e,"defaultEdit")}),{onValueChange:l=>{let c=e.querySelector('[data-scope="editable"][data-part="input"]');c&&(c.value=l.value,c.dispatchEvent(new Event("input",{bubbles:!0})),c.dispatchEvent(new Event("change",{bubbles:!0})));let u=O(e,"onValueChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{value:l.value,id:e.id});let h=O(e,"onValueChangeClient");h&&e.dispatchEvent(new CustomEvent(h,{bubbles:!0,detail:{value:l,id:e.id}}))}}));o.init(),this.editable=o,this.handlers=[]},updated(){var n;let e=O(this.el,"value"),t=C(this.el,"controlled");(n=this.editable)==null||n.updateProps(y(g({id:this.el.id},t&&e!==void 0?{value:e}:{}),{disabled:C(this.el,"disabled"),readOnly:C(this.el,"readOnly"),required:C(this.el,"required"),invalid:C(this.el,"invalid"),name:O(this.el,"name"),form:O(this.el,"form")}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.editable)==null||e.destroy()}}});var Vg={};he(Vg,{FloatingPanel:()=>RS});function TS(e){switch(e){case"n":return{cursor:"n-resize",width:"100%",top:0,left:"50%",translate:"-50%"};case"e":return{cursor:"e-resize",height:"100%",right:0,top:"50%",translate:"0 -50%"};case"s":return{cursor:"s-resize",width:"100%",bottom:0,left:"50%",translate:"-50%"};case"w":return{cursor:"w-resize",height:"100%",left:0,top:"50%",translate:"0 -50%"};case"se":return{cursor:"se-resize",bottom:0,right:0};case"sw":return{cursor:"sw-resize",bottom:0,left:0};case"ne":return{cursor:"ne-resize",top:0,right:0};case"nw":return{cursor:"nw-resize",top:0,left:0};default:throw new Error(`Invalid axis: ${e}`)}}function OS(e,t){let{state:n,send:i,scope:r,prop:s,computed:a,context:o}=e,l=n.hasTag("open"),c=n.matches("open.dragging"),u=n.matches("open.resizing"),h=o.get("isTopmost"),m=o.get("size"),d=o.get("position"),p=a("isMaximized"),v=a("isMinimized"),I=a("isStaged"),T=a("canResize"),w=a("canDrag");return{open:l,resizable:s("resizable"),draggable:s("draggable"),setOpen(b){n.hasTag("open")!==b&&i({type:b?"OPEN":"CLOSE"})},dragging:c,resizing:u,position:d,size:m,setPosition(b){i({type:"SET_POSITION",position:b})},setSize(b){i({type:"SET_SIZE",size:b})},minimize(){i({type:"MINIMIZE"})},maximize(){i({type:"MAXIMIZE"})},restore(){i({type:"RESTORE"})},getTriggerProps(){return t.button(y(g({},St.trigger.attrs),{dir:s("dir"),type:"button",disabled:s("disabled"),id:Tg(r),"data-state":l?"open":"closed","data-dragging":E(c),"aria-controls":Sl(r),onClick(b){if(b.defaultPrevented||s("disabled"))return;let f=n.hasTag("open");i({type:f?"CLOSE":"OPEN",src:"trigger"})}}))},getPositionerProps(){return t.element(y(g({},St.positioner.attrs),{dir:s("dir"),id:Og(r),style:{"--width":ye(m==null?void 0:m.width),"--height":ye(m==null?void 0:m.height),"--x":ye(d==null?void 0:d.x),"--y":ye(d==null?void 0:d.y),position:s("strategy"),top:"var(--y)",left:"var(--x)"}}))},getContentProps(){return t.element(y(g({},St.content.attrs),{dir:s("dir"),role:"dialog",tabIndex:0,hidden:!l,id:Sl(r),"aria-labelledby":yg(r),"data-state":l?"open":"closed","data-dragging":E(c),"data-topmost":E(h),"data-behind":E(!h),"data-minimized":E(v),"data-maximized":E(p),"data-staged":E(I),style:{width:"var(--width)",height:"var(--height)",overflow:v?"hidden":void 0},onFocus(){i({type:"CONTENT_FOCUS"})},onKeyDown(b){if(b.defaultPrevented||b.currentTarget!==j(b))return;let f=gi(b)*s("gridSize"),P={Escape(){h&&i({type:"ESCAPE"})},ArrowLeft(){i({type:"MOVE",direction:"left",step:f})},ArrowRight(){i({type:"MOVE",direction:"right",step:f})},ArrowUp(){i({type:"MOVE",direction:"up",step:f})},ArrowDown(){i({type:"MOVE",direction:"down",step:f})}}[ge(b,{dir:s("dir")})];P&&(b.preventDefault(),P(b))}}))},getCloseTriggerProps(){return t.button(y(g({},St.closeTrigger.attrs),{dir:s("dir"),disabled:s("disabled"),"aria-label":"Close Window",type:"button",onClick(b){b.defaultPrevented||i({type:"CLOSE"})}}))},getStageTriggerProps(b){if(!Pg.has(b.stage))throw new Error(`[zag-js] Invalid stage: ${b.stage}. Must be one of: ${Array.from(Pg).join(", ")}`);let f=s("translations"),S=Ce(b.stage,{minimized:()=>({"aria-label":f.minimize,hidden:I}),maximized:()=>({"aria-label":f.maximize,hidden:I}),default:()=>({"aria-label":f.restore,hidden:!I})});return t.button(y(g(y(g({},St.stageTrigger.attrs),{dir:s("dir"),disabled:s("disabled"),"data-stage":b.stage}),S),{type:"button",onClick(P){if(P.defaultPrevented||!s("resizable"))return;let V=Ce(b.stage,{minimized:()=>"MINIMIZE",maximized:()=>"MAXIMIZE",default:()=>"RESTORE"});i({type:V.toUpperCase()})}}))},getResizeTriggerProps(b){return t.element(y(g({},St.resizeTrigger.attrs),{dir:s("dir"),"data-disabled":E(!T),"data-axis":b.axis,onPointerDown(f){T&&pe(f)&&(f.currentTarget.setPointerCapture(f.pointerId),f.stopPropagation(),i({type:"RESIZE_START",axis:b.axis,position:{x:f.clientX,y:f.clientY}}))},onPointerUp(f){if(!T)return;let S=f.currentTarget;S.hasPointerCapture(f.pointerId)&&S.releasePointerCapture(f.pointerId)},style:g({position:"absolute",touchAction:"none"},TS(b.axis))}))},getDragTriggerProps(){return t.element(y(g({},St.dragTrigger.attrs),{dir:s("dir"),"data-disabled":E(!w),onPointerDown(b){if(!w||!pe(b))return;let f=j(b);f!=null&&f.closest("button")||f!=null&&f.closest("[data-no-drag]")||(b.currentTarget.setPointerCapture(b.pointerId),b.stopPropagation(),i({type:"DRAG_START",pointerId:b.pointerId,position:{x:b.clientX,y:b.clientY}}))},onPointerUp(b){if(!w)return;let f=b.currentTarget;f.hasPointerCapture(b.pointerId)&&f.releasePointerCapture(b.pointerId)},onDoubleClick(b){b.defaultPrevented||s("resizable")&&i({type:I?"RESTORE":"MAXIMIZE"})},style:{WebkitUserSelect:"none",userSelect:"none",touchAction:"none",cursor:"move"}}))},getControlProps(){return t.element(y(g({},St.control.attrs),{dir:s("dir"),"data-disabled":E(s("disabled")),"data-stage":o.get("stage"),"data-minimized":E(v),"data-maximized":E(p),"data-staged":E(I)}))},getTitleProps(){return t.element(y(g({},St.title.attrs),{dir:s("dir"),id:yg(r)}))},getHeaderProps(){return t.element(y(g({},St.header.attrs),{dir:s("dir"),id:wg(r),"data-dragging":E(c),"data-topmost":E(h),"data-behind":E(!h),"data-minimized":E(v),"data-maximized":E(p),"data-staged":E(I)}))},getBodyProps(){return t.element(y(g({},St.body.attrs),{dir:s("dir"),"data-dragging":E(c),"data-minimized":E(v),"data-maximized":E(p),"data-staged":E(I),hidden:v}))}}}function ga(e){if(e)try{let t=JSON.parse(e);if(typeof t.width=="number"&&typeof t.height=="number")return{width:t.width,height:t.height}}catch(t){}}function Sg(e){if(e)try{let t=JSON.parse(e);if(typeof t.x=="number"&&typeof t.y=="number")return{x:t.x,y:t.y}}catch(t){}}var CS,St,Tg,Og,Sl,yg,wg,bg,Eg,Ig,SS,wn,Pg,kr,Cg,wS,VS,xS,AS,Wx,kS,Kx,NS,RS,xg=re(()=>{"use strict";Cs();se();CS=U("floating-panel").parts("trigger","positioner","content","header","body","title","resizeTrigger","dragTrigger","stageTrigger","closeTrigger","control"),St=CS.build(),Tg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`float:${e.id}:trigger`},Og=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`float:${e.id}:positioner`},Sl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`float:${e.id}:content`},yg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`float:${e.id}:title`},wg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.header)!=null?n:`float:${e.id}:header`},bg=e=>e.getById(Tg(e)),Eg=e=>e.getById(Og(e)),Ig=e=>e.getById(Sl(e)),SS=e=>e.getById(wg(e)),wn=(e,t,n)=>{let i;return le(t)?i=po(t):i=Cu(e.getWin()),n&&(i=bn({x:-i.width,y:i.minY,width:i.width*3,height:i.height*2})),fn(i,["x","y","width","height"])};Pg=new Set(["minimized","maximized","default"]);kr=ys({stack:[],count(){return this.stack.length},add(e){this.stack.includes(e)||this.stack.push(e)},remove(e){let t=this.stack.indexOf(e);t<0||this.stack.splice(t,1)},bringToFront(e){this.remove(e),this.add(e)},isTopmost(e){return this.stack[this.stack.length-1]===e},indexOf(e){return this.stack.indexOf(e)}}),{not:Cg,and:wS}=Ee(),VS={minimize:"Minimize window",maximize:"Maximize window",restore:"Restore window"},xS={props({props:e}){return yn(e,["id"],"floating-panel"),y(g({strategy:"fixed",gridSize:1,defaultSize:{width:320,height:240},defaultPosition:{x:300,y:100},allowOverflow:!0,resizable:!0,draggable:!0},e),{hasSpecifiedPosition:!!e.defaultPosition||!!e.position,translations:g(g({},VS),e.translations)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({prop:e,bindable:t}){return{size:t(()=>({defaultValue:e("defaultSize"),value:e("size"),isEqual:Iu,sync:!0,hash(n){return`W:${n.width} H:${n.height}`},onChange(n){var i;(i=e("onSizeChange"))==null||i({size:n})}})),position:t(()=>({defaultValue:e("defaultPosition"),value:e("position"),isEqual:Pu,sync:!0,hash(n){return`X:${n.x} Y:${n.y}`},onChange(n){var i;(i=e("onPositionChange"))==null||i({position:n})}})),stage:t(()=>({defaultValue:"default",onChange(n){var i;(i=e("onStageChange"))==null||i({stage:n})}})),lastEventPosition:t(()=>({defaultValue:null})),prevPosition:t(()=>({defaultValue:null})),prevSize:t(()=>({defaultValue:null})),isTopmost:t(()=>({defaultValue:void 0}))}},computed:{isMaximized:({context:e})=>e.get("stage")==="maximized",isMinimized:({context:e})=>e.get("stage")==="minimized",isStaged:({context:e})=>e.get("stage")!=="default",canResize:({context:e,prop:t})=>t("resizable")&&!t("disabled")&&e.get("stage")==="default",canDrag:({prop:e,computed:t})=>e("draggable")&&!e("disabled")&&!t("isMaximized")},watch({track:e,context:t,action:n,prop:i}){e([()=>t.hash("position")],()=>{n(["setPositionStyle"])}),e([()=>t.hash("size")],()=>{n(["setSizeStyle"])}),e([()=>i("open")],()=>{n(["toggleVisibility"])})},effects:["trackPanelStack"],on:{CONTENT_FOCUS:{actions:["bringToFrontOfPanelStack"]},SET_POSITION:{actions:["setPosition"]},SET_SIZE:{actions:["setSize"]}},states:{closed:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["setAnchorPosition","setPositionStyle","setSizeStyle","focusContentEl"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setAnchorPosition","setPositionStyle","setSizeStyle","focusContentEl"]}]}},open:{tags:["open"],entry:["bringToFrontOfPanelStack"],effects:["trackBoundaryRect"],on:{DRAG_START:{guard:Cg("isMaximized"),target:"open.dragging",actions:["setPrevPosition"]},RESIZE_START:{guard:Cg("isMinimized"),target:"open.resizing",actions:["setPrevSize"]},"CONTROLLED.CLOSE":{target:"closed",actions:["resetRect","focusTriggerEl"]},CLOSE:[{guard:"isOpenControlled",target:"closed",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","resetRect","focusTriggerEl"]}],ESCAPE:[{guard:wS("isOpenControlled","closeOnEsc"),actions:["invokeOnClose"]},{guard:"closeOnEsc",target:"closed",actions:["invokeOnClose","resetRect","focusTriggerEl"]}],MINIMIZE:{actions:["setMinimized"]},MAXIMIZE:{actions:["setMaximized"]},RESTORE:{actions:["setRestored"]},MOVE:{actions:["setPositionFromKeyboard"]}}},"open.dragging":{tags:["open"],effects:["trackPointerMove"],exit:["clearPrevPosition"],on:{DRAG:{actions:["setPosition"]},DRAG_END:{target:"open",actions:["invokeOnDragEnd"]},"CONTROLLED.CLOSE":{target:"closed",actions:["resetRect"]},CLOSE:[{guard:"isOpenControlled",target:"closed",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","resetRect"]}],ESCAPE:{target:"open"}}},"open.resizing":{tags:["open"],effects:["trackPointerMove"],exit:["clearPrevSize"],on:{DRAG:{actions:["setSize"]},DRAG_END:{target:"open",actions:["invokeOnResizeEnd"]},"CONTROLLED.CLOSE":{target:"closed",actions:["resetRect"]},CLOSE:[{guard:"isOpenControlled",target:"closed",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","resetRect"]}],ESCAPE:{target:"open"}}}},implementations:{guards:{closeOnEsc:({prop:e})=>!!e("closeOnEscape"),isMaximized:({context:e})=>e.get("stage")==="maximized",isMinimized:({context:e})=>e.get("stage")==="minimized",isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackPointerMove({scope:e,send:t,event:n,prop:i}){var o;let r=e.getDoc(),s=(o=i("getBoundaryEl"))==null?void 0:o(),a=wn(e,s,!1);return hn(r,{onPointerMove({point:l,event:c}){let{altKey:u,shiftKey:h}=c,m=He(l.x,a.x,a.x+a.width),d=He(l.y,a.y,a.y+a.height);t({type:"DRAG",position:{x:m,y:d},axis:n.axis,altKey:u,shiftKey:h})},onPointerUp(){t({type:"DRAG_END"})}})},trackBoundaryRect({context:e,scope:t,prop:n,computed:i}){var l;let r=t.getWin(),s=!0,a=()=>{var h;if(s){s=!1;return}let c=(h=n("getBoundaryEl"))==null?void 0:h(),u=wn(t,c,!1);if(!i("isMaximized")){let m=g(g({},e.get("position")),e.get("size"));u=Eu(m,u)}e.set("size",fn(u,["width","height"])),e.set("position",fn(u,["x","y"]))},o=(l=n("getBoundaryEl"))==null?void 0:l();return le(o)?gn.observe(o,a):ee(r,"resize",a)},trackPanelStack({context:e,scope:t}){let n=ns(kr,()=>{e.set("isTopmost",kr.isTopmost(t.id));let i=Ig(t);if(!i)return;let r=kr.indexOf(t.id);r!==-1&&i.style.setProperty("--z-index",`${r+1}`)});return()=>{kr.remove(t.id),n()}}},actions:{setAnchorPosition({context:e,prop:t,scope:n}){if(t("hasSpecifiedPosition"))return;let i=e.get("prevPosition")||e.get("prevSize");t("persistRect")&&i||H(()=>{var o,l;let r=bg(n),s=wn(n,(o=t("getBoundaryEl"))==null?void 0:o(),!1),a=(l=t("getAnchorPosition"))==null?void 0:l({triggerRect:r?DOMRect.fromRect(po(r)):null,boundaryRect:DOMRect.fromRect(s)});if(!a){let c=e.get("size");a={x:s.x+(s.width-c.width)/2,y:s.y+(s.height-c.height)/2}}a&&e.set("position",a)})},setPrevPosition({context:e,event:t}){e.set("prevPosition",g({},e.get("position"))),e.set("lastEventPosition",t.position)},clearPrevPosition({context:e,prop:t}){t("persistRect")||e.set("prevPosition",null),e.set("lastEventPosition",null)},setPosition({context:e,event:t,prop:n,scope:i}){var c;let r=go(t.position,e.get("lastEventPosition"));r.x=Math.round(r.x/n("gridSize"))*n("gridSize"),r.y=Math.round(r.y/n("gridSize"))*n("gridSize");let s=e.get("prevPosition");if(!s)return;let a=bu(s,r),o=(c=n("getBoundaryEl"))==null?void 0:c(),l=wn(i,o,n("allowOverflow"));a=hr(a,e.get("size"),l),e.set("position",a)},setPositionStyle({scope:e,context:t}){let n=Eg(e),i=t.get("position");n==null||n.style.setProperty("--x",`${i.x}px`),n==null||n.style.setProperty("--y",`${i.y}px`)},resetRect({context:e,prop:t}){e.set("stage","default"),t("persistRect")||(e.set("position",e.initial("position")),e.set("size",e.initial("size")))},setPrevSize({context:e,event:t}){e.set("prevSize",g({},e.get("size"))),e.set("prevPosition",g({},e.get("position"))),e.set("lastEventPosition",t.position)},clearPrevSize({context:e}){e.set("prevSize",null),e.set("prevPosition",null),e.set("lastEventPosition",null)},setSize({context:e,event:t,scope:n,prop:i}){var p;let r=e.get("prevSize"),s=e.get("prevPosition"),a=e.get("lastEventPosition");if(!r||!s||!a)return;let o=bn(g(g({},s),r)),l=go(t.position,a),c=Tu(o,l,t.axis,{scalingOriginMode:t.altKey?"center":"extent",lockAspectRatio:!!i("lockAspectRatio")||t.shiftKey}),u=fn(c,["width","height"]),h=fn(c,["x","y"]),m=(p=i("getBoundaryEl"))==null?void 0:p(),d=wn(n,m,!1);if(u=gr(u,i("minSize"),i("maxSize")),u=gr(u,i("minSize"),d),e.set("size",u),h){let v=hr(h,u,d);e.set("position",v)}},setSizeStyle({scope:e,context:t}){queueMicrotask(()=>{let n=Eg(e),i=t.get("size");n==null||n.style.setProperty("--width",`${i.width}px`),n==null||n.style.setProperty("--height",`${i.height}px`)})},setMaximized({context:e,prop:t,scope:n}){var s;e.set("stage","maximized"),e.set("prevSize",e.get("size")),e.set("prevPosition",e.get("position"));let i=(s=t("getBoundaryEl"))==null?void 0:s(),r=wn(n,i,!1);e.set("position",fn(r,["x","y"])),e.set("size",fn(r,["height","width"]))},setMinimized({context:e,scope:t}){e.set("stage","minimized"),e.set("prevSize",e.get("size")),e.set("prevPosition",e.get("position"));let n=SS(t);if(!n)return;let i=y(g({},e.get("size")),{height:n==null?void 0:n.offsetHeight});e.set("size",i)},setRestored({context:e,prop:t,scope:n}){var s;let i=wn(n,(s=t("getBoundaryEl"))==null?void 0:s(),!1);e.set("stage","default");let r=e.get("prevSize");if(r){let a=r;a=gr(a,t("minSize"),t("maxSize")),a=gr(a,t("minSize"),i),e.set("size",a),e.set("prevSize",null)}if(e.get("prevPosition")){let a=e.get("prevPosition");a=hr(a,e.get("size"),i),e.set("position",a),e.set("prevPosition",null)}},setPositionFromKeyboard({context:e,event:t,prop:n,scope:i}){var c;vs(t.step==null,"step is required");let r=e.get("position"),s=t.step,a=Ce(t.direction,{left:{x:r.x-s,y:r.y},right:{x:r.x+s,y:r.y},up:{x:r.x,y:r.y-s},down:{x:r.x,y:r.y+s}}),o=(c=n("getBoundaryEl"))==null?void 0:c(),l=wn(i,o,!1);a=hr(a,e.get("size"),l),e.set("position",a)},bringToFrontOfPanelStack({prop:e}){kr.bringToFront(e("id"))},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnDragEnd({context:e,prop:t}){var n;(n=t("onPositionChangeEnd"))==null||n({position:e.get("position")})},invokeOnResizeEnd({context:e,prop:t}){var n;(n=t("onSizeChangeEnd"))==null||n({size:e.get("size")})},focusTriggerEl({scope:e}){H(()=>{var t;(t=bg(e))==null||t.focus()})},focusContentEl({scope:e}){H(()=>{var t;(t=Ig(e))==null||t.focus()})},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}},AS=_()(["allowOverflow","closeOnEscape","defaultOpen","defaultPosition","defaultSize","dir","disabled","draggable","getAnchorPosition","getBoundaryEl","getRootNode","gridSize","id","ids","lockAspectRatio","maxSize","minSize","onOpenChange","onPositionChange","onPositionChangeEnd","onSizeChange","onSizeChangeEnd","onStageChange","open","persistRect","position","resizable","size","strategy","translations"]),Wx=B(AS),kS=_()(["axis"]),Kx=B(kS),NS=class extends K{initMachine(e){return new W(xS,e)}initApi(){return OS(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="floating-panel"][data-part="trigger"]');e&&this.spreadProps(e,this.api.getTriggerProps());let t=this.el.querySelector('[data-scope="floating-panel"][data-part="positioner"]');t&&this.spreadProps(t,this.api.getPositionerProps());let n=this.el.querySelector('[data-scope="floating-panel"][data-part="content"]');n&&this.spreadProps(n,this.api.getContentProps());let i=this.el.querySelector('[data-scope="floating-panel"][data-part="title"]');i&&this.spreadProps(i,this.api.getTitleProps());let r=this.el.querySelector('[data-scope="floating-panel"][data-part="header"]');r&&this.spreadProps(r,this.api.getHeaderProps());let s=this.el.querySelector('[data-scope="floating-panel"][data-part="body"]');s&&this.spreadProps(s,this.api.getBodyProps());let a=this.el.querySelector('[data-scope="floating-panel"][data-part="drag-trigger"]');a&&this.spreadProps(a,this.api.getDragTriggerProps()),["s","w","e","n","sw","nw","se","ne"].forEach(h=>{let m=this.el.querySelector(`[data-scope="floating-panel"][data-part="resize-trigger"][data-axis="${h}"]`);m&&this.spreadProps(m,this.api.getResizeTriggerProps({axis:h}))});let l=this.el.querySelector('[data-scope="floating-panel"][data-part="close-trigger"]');l&&this.spreadProps(l,this.api.getCloseTriggerProps());let c=this.el.querySelector('[data-scope="floating-panel"][data-part="control"]');c&&this.spreadProps(c,this.api.getControlProps()),["minimized","maximized","default"].forEach(h=>{let m=this.el.querySelector(`[data-scope="floating-panel"][data-part="stage-trigger"][data-stage="${h}"]`);m&&this.spreadProps(m,this.api.getStageTriggerProps({stage:h}))})}};RS={mounted(){let e=this.el,t=C(e,"open"),n=C(e,"defaultOpen"),i=C(e,"controlled"),r=ga(e.dataset.size),s=ga(e.dataset.defaultSize),a=Sg(e.dataset.position),o=Sg(e.dataset.defaultPosition),l=new NS(e,y(g({id:e.id},i?{open:t}:{defaultOpen:n}),{draggable:C(e,"draggable")!==!1,resizable:C(e,"resizable")!==!1,allowOverflow:C(e,"allowOverflow")!==!1,closeOnEscape:C(e,"closeOnEscape")!==!1,disabled:C(e,"disabled"),dir:Oe(e),size:r,defaultSize:s,position:a,defaultPosition:o,minSize:ga(e.dataset.minSize),maxSize:ga(e.dataset.maxSize),persistRect:C(e,"persistRect"),gridSize:Number(e.dataset.gridSize)||1,onOpenChange:c=>{let u=O(e,"onOpenChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{open:c.open,id:e.id});let h=O(e,"onOpenChangeClient");h&&e.dispatchEvent(new CustomEvent(h,{bubbles:!0,detail:{value:c,id:e.id}}))},onPositionChange:c=>{let u=O(e,"onPositionChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{position:c.position,id:e.id})},onSizeChange:c=>{let u=O(e,"onSizeChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{size:c.size,id:e.id})},onStageChange:c=>{let u=O(e,"onStageChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{stage:c.stage,id:e.id})}}));l.init(),this.floatingPanel=l,this.handlers=[]},updated(){var n;let e=C(this.el,"open"),t=C(this.el,"controlled");(n=this.floatingPanel)==null||n.updateProps(y(g({id:this.el.id},t?{open:e}:{}),{disabled:C(this.el,"disabled"),dir:Oe(this.el)}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.floatingPanel)==null||e.destroy()}}});var Dg={};he(Dg,{Listbox:()=>jS});function $S(e,t){let{context:n,prop:i,scope:r,computed:s,send:a,refs:o}=e,l=i("disabled"),c=i("collection"),u=Cn(c)?"grid":"list",h=n.get("focused"),m=o.get("focusVisible")&&h,d=o.get("inputState"),p=n.get("value"),v=n.get("selectedItems"),I=n.get("highlightedValue"),T=n.get("highlightedItem"),w=s("isTypingAhead"),b=s("isInteractive"),f=I?Ol(r,I):void 0;function S(P){let V=c.getItemDisabled(P.item),A=c.getItemValue(P.item);vn(A,()=>`[zag-js] No value found for item ${JSON.stringify(P.item)}`);let x=I===A;return{value:A,disabled:!!(l||V),focused:x&&h,focusVisible:x&&m,highlighted:x&&(d.focused?h:m),selected:n.get("value").includes(A)}}return{empty:p.length===0,highlightedItem:T,highlightedValue:I,clearHighlightedValue(){a({type:"HIGHLIGHTED_VALUE.SET",value:null})},selectedItems:v,hasSelectedItems:s("hasSelectedItems"),value:p,valueAsString:s("valueAsString"),collection:c,disabled:!!l,selectValue(P){a({type:"ITEM.SELECT",value:P})},setValue(P){a({type:"VALUE.SET",value:P})},selectAll(){if(!s("multiple"))throw new Error("[zag-js] Cannot select all items in a single-select listbox");a({type:"VALUE.SET",value:c.getValues()})},highlightValue(P){a({type:"HIGHLIGHTED_VALUE.SET",value:P})},clearValue(P){a(P?{type:"ITEM.CLEAR",value:P}:{type:"VALUE.CLEAR"})},getItemState:S,getRootProps(){return t.element(y(g({},Ht.root.attrs),{dir:i("dir"),id:MS(r),"data-orientation":i("orientation"),"data-disabled":E(l)}))},getInputProps(P={}){return t.input(y(g({},Ht.input.attrs),{dir:i("dir"),disabled:l,"data-disabled":E(l),autoComplete:"off",autoCorrect:"off","aria-haspopup":"listbox","aria-controls":Tl(r),"aria-autocomplete":"list","aria-activedescendant":f,spellCheck:!1,enterKeyHint:"go",onFocus(){queueMicrotask(()=>{a({type:"INPUT.FOCUS",autoHighlight:!!(P!=null&&P.autoHighlight)})})},onBlur(){a({type:"CONTENT.BLUR",src:"input"})},onInput(V){P!=null&&P.autoHighlight&&(V.currentTarget.value.trim()||queueMicrotask(()=>{a({type:"HIGHLIGHTED_VALUE.SET",value:null})}))},onKeyDown(V){if(V.defaultPrevented||Re(V))return;let A=Yt(V),x=()=>{var D;V.preventDefault();let k=r.getWin(),N=new k.KeyboardEvent(A.type,A);(D=pa(r))==null||D.dispatchEvent(N)};switch(A.key){case"ArrowLeft":case"ArrowRight":{if(!Cn(c)||V.ctrlKey)return;x()}case"Home":case"End":{if(I==null&&V.shiftKey)return;x()}case"ArrowDown":case"ArrowUp":{x();break}case"Enter":I!=null&&(V.preventDefault(),a({type:"ITEM.CLICK",value:I}));break}}}))},getLabelProps(){return t.element(y(g({dir:i("dir"),id:Ag(r)},Ht.label.attrs),{"data-disabled":E(l)}))},getValueTextProps(){return t.element(y(g({},Ht.valueText.attrs),{dir:i("dir"),"data-disabled":E(l)}))},getItemProps(P){let V=S(P);return t.element(y(g({id:Ol(r,V.value),role:"option"},Ht.item.attrs),{dir:i("dir"),"data-value":V.value,"aria-selected":V.selected,"data-selected":E(V.selected),"data-layout":u,"data-state":V.selected?"checked":"unchecked","data-orientation":i("orientation"),"data-highlighted":E(V.highlighted),"data-disabled":E(V.disabled),"aria-disabled":X(V.disabled),onPointerMove(A){P.highlightOnHover&&(V.disabled||A.pointerType!=="mouse"||V.highlighted||a({type:"ITEM.POINTER_MOVE",value:V.value}))},onMouseDown(A){var x;A.preventDefault(),(x=pa(r))==null||x.focus()},onClick(A){A.defaultPrevented||V.disabled||a({type:"ITEM.CLICK",value:V.value,shiftKey:A.shiftKey,anchorValue:I,metaKey:ls(A)})}}))},getItemTextProps(P){let V=S(P);return t.element(y(g({},Ht.itemText.attrs),{"data-state":V.selected?"checked":"unchecked","data-disabled":E(V.disabled),"data-highlighted":E(V.highlighted)}))},getItemIndicatorProps(P){let V=S(P);return t.element(y(g({},Ht.itemIndicator.attrs),{"aria-hidden":!0,"data-state":V.selected?"checked":"unchecked",hidden:!V.selected}))},getItemGroupLabelProps(P){let{htmlFor:V}=P;return t.element(y(g({},Ht.itemGroupLabel.attrs),{id:kg(r,V),dir:i("dir"),role:"presentation"}))},getItemGroupProps(P){let{id:V}=P;return t.element(y(g({},Ht.itemGroup.attrs),{"data-disabled":E(l),"data-orientation":i("orientation"),"data-empty":E(c.size===0),id:FS(r,V),"aria-labelledby":kg(r,V),role:"group",dir:i("dir")}))},getContentProps(){return t.element(y(g({dir:i("dir"),id:Tl(r),role:"listbox"},Ht.content.attrs),{"data-activedescendant":f,"aria-activedescendant":f,"data-orientation":i("orientation"),"aria-multiselectable":s("multiple")?!0:void 0,"aria-labelledby":Ag(r),tabIndex:0,"data-layout":u,"data-empty":E(c.size===0),style:{"--column-count":Cn(c)?c.columnCount:1},onFocus(){a({type:"CONTENT.FOCUS"})},onBlur(){a({type:"CONTENT.BLUR"})},onKeyDown(P){if(!b||!ce(P.currentTarget,j(P)))return;let V=P.shiftKey,A={ArrowUp(N){let D=null;Cn(c)&&I?D=c.getPreviousRowValue(I):I&&(D=c.getPreviousValue(I)),!D&&(i("loopFocus")||!I)&&(D=c.lastValue),D&&(N.preventDefault(),a({type:"NAVIGATE",value:D,shiftKey:V,anchorValue:I}))},ArrowDown(N){let D=null;Cn(c)&&I?D=c.getNextRowValue(I):I&&(D=c.getNextValue(I)),!D&&(i("loopFocus")||!I)&&(D=c.firstValue),D&&(N.preventDefault(),a({type:"NAVIGATE",value:D,shiftKey:V,anchorValue:I}))},ArrowLeft(){if(!Cn(c)&&i("orientation")==="vertical")return;let N=I?c.getPreviousValue(I):null;!N&&i("loopFocus")&&(N=c.lastValue),N&&(P.preventDefault(),a({type:"NAVIGATE",value:N,shiftKey:V,anchorValue:I}))},ArrowRight(){if(!Cn(c)&&i("orientation")==="vertical")return;let N=I?c.getNextValue(I):null;!N&&i("loopFocus")&&(N=c.firstValue),N&&(P.preventDefault(),a({type:"NAVIGATE",value:N,shiftKey:V,anchorValue:I}))},Home(N){N.preventDefault();let D=c.firstValue;a({type:"NAVIGATE",value:D,shiftKey:V,anchorValue:I})},End(N){N.preventDefault();let D=c.lastValue;a({type:"NAVIGATE",value:D,shiftKey:V,anchorValue:I})},Enter(){a({type:"ITEM.CLICK",value:I})},a(N){ls(N)&&s("multiple")&&!i("disallowSelectAll")&&(N.preventDefault(),a({type:"VALUE.SET",value:c.getValues()}))},Space(N){var D;w&&i("typeahead")?a({type:"CONTENT.TYPEAHEAD",key:N.key}):(D=A.Enter)==null||D.call(A,N)},Escape(N){i("deselectable")&&p.length>0&&(N.preventDefault(),N.stopPropagation(),a({type:"VALUE.CLEAR"}))}},x=A[ge(P)];if(x){x(P);return}let k=j(P);Ot(k)||Ue.isValidEvent(P)&&i("typeahead")&&(a({type:"CONTENT.TYPEAHEAD",key:P.key}),P.preventDefault())}}))}}}function Nr(e,t,n){let i=US(t,e);for(let r of i)n==null||n({value:r})}function Rg(e,t){return Bi(t?{items:e,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var i;return(i=n.group)!=null?i:""}}:{items:e,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled})}var DS,Ht,Bi,LS,MS,Tl,Ag,Ol,FS,kg,pa,Ng,HS,BS,_S,GS,US,qS,Jx,WS,Qx,KS,eA,zS,tA,YS,jS,Lg=re(()=>{"use strict";pr();yr();se();DS=U("listbox").parts("label","input","item","itemText","itemIndicator","itemGroup","itemGroupLabel","content","root","valueText"),Ht=DS.build(),Bi=e=>new Nt(e);Bi.empty=()=>new Nt({items:[]});LS=e=>new Vo(e);LS.empty=()=>new Vo({items:[],columnCount:0});MS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`select:${e.id}`},Tl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`select:${e.id}:content`},Ag=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`select:${e.id}:label`},Ol=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:option:${t}`},FS=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:optgroup:${t}`},kg=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:optgroup-label:${t}`},pa=e=>e.getById(Tl(e)),Ng=(e,t)=>e.getById(Ol(e,t));({guards:HS,createMachine:BS}=ut()),{or:_S}=HS,GS=BS({props({props:e}){return g({loopFocus:!1,composite:!0,defaultValue:[],multiple:!1,typeahead:!0,collection:Bi.empty(),orientation:"vertical",selectionMode:"single"},e)},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:fe,onChange(n){var r;let i=e("collection").findMany(n);return(r=e("onValueChange"))==null?void 0:r({value:n,items:i})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),sync:!0,onChange(n){var i;(i=e("onHighlightChange"))==null||i({highlightedValue:n,highlightedItem:e("collection").find(n),highlightedIndex:e("collection").indexOf(n)})}})),highlightedItem:t(()=>({defaultValue:null})),selectedItems:t(()=>{var r,s;let n=(s=(r=e("value"))!=null?r:e("defaultValue"))!=null?s:[];return{defaultValue:e("collection").findMany(n)}}),focused:t(()=>({sync:!0,defaultValue:!1}))}},refs(){return{typeahead:g({},Ue.defaultOptions),focusVisible:!1,inputState:{autoHighlight:!1,focused:!1}}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isInteractive:({prop:e})=>!e("disabled"),selection:({context:e,prop:t})=>{let n=new ld(e.get("value"));return n.selectionMode=t("selectionMode"),n.deselectable=!!t("deselectable"),n},multiple:({prop:e})=>e("selectionMode")==="multiple"||e("selectionMode")==="extended",valueAsString:({context:e,prop:t})=>t("collection").stringifyItems(e.get("selectedItems"))},initialState(){return"idle"},watch({context:e,prop:t,track:n,action:i}){n([()=>e.get("value").toString()],()=>{i(["syncSelectedItems"])}),n([()=>e.get("highlightedValue")],()=>{i(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{i(["syncHighlightedValue"])})},effects:["trackFocusVisible"],on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]}},states:{idle:{effects:["scrollToHighlightedItem"],on:{"INPUT.FOCUS":{actions:["setFocused","setInputState"]},"CONTENT.FOCUS":[{guard:_S("hasSelectedValue","hasHighlightedValue"),actions:["setFocused"]},{actions:["setFocused","setDefaultHighlightedValue"]}],"CONTENT.BLUR":{actions:["clearFocused","clearInputState"]},"ITEM.CLICK":{actions:["setHighlightedItem","selectHighlightedItem"]},"CONTENT.TYPEAHEAD":{actions:["setFocused","highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},NAVIGATE:{actions:["setFocused","setHighlightedItem","selectWithKeyboard"]}}}},implementations:{guards:{hasSelectedValue:({context:e})=>e.get("value").length>0,hasHighlightedValue:({context:e})=>e.get("highlightedValue")!=null},effects:{trackFocusVisible:({scope:e,refs:t})=>{var n;return Pn({root:(n=e.getRootNode)==null?void 0:n.call(e),onChange(i){t.set("focusVisible",i.isFocusVisible)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){let i=s=>{let a=e.get("highlightedValue");if(a==null||ju()!=="keyboard")return;let l=pa(n),c=t("scrollToIndexFn");if(c){let h=t("collection").indexOf(a);c==null||c({index:h,immediate:s,getElement(){return Ng(n,a)}});return}let u=Ng(n,a);Xt(u,{rootEl:l,block:"nearest"})};return H(()=>i(!0)),ot(()=>pa(n),{defer:!0,attributes:["data-activedescendant"],callback(){i(!1)}})}},actions:{selectHighlightedItem({context:e,prop:t,event:n,computed:i}){var o;let r=(o=n.value)!=null?o:e.get("highlightedValue"),s=t("collection");if(r==null||!s.has(r))return;let a=i("selection");if(n.shiftKey&&i("multiple")&&n.anchorValue){let l=a.extendSelection(s,n.anchorValue,r);Nr(a,l,t("onSelect")),e.set("value",Array.from(l))}else{let l=a.select(s,r,n.metaKey);Nr(a,l,t("onSelect")),e.set("value",Array.from(l))}},selectWithKeyboard({context:e,prop:t,event:n,computed:i}){let r=i("selection"),s=t("collection");if(n.shiftKey&&i("multiple")&&n.anchorValue){let a=r.extendSelection(s,n.anchorValue,n.value);Nr(r,a,t("onSelect")),e.set("value",Array.from(a));return}if(t("selectOnHighlight")){let a=r.replaceSelection(s,n.value);Nr(r,a,t("onSelect")),e.set("value",Array.from(a))}},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:i}){let r=t("collection").search(n.key,{state:i.get("typeahead"),currentValue:e.get("highlightedValue")});r!=null&&e.set("highlightedValue",r)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n,computed:i}){let r=t("collection"),s=i("selection"),a=s.select(r,n.value);Nr(s,a,t("onSelect")),e.set("value",Array.from(a))},clearItem({context:e,event:t,computed:n}){let r=n("selection").deselect(t.value);e.set("value",Array.from(r))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},syncSelectedItems({context:e,prop:t}){let n=t("collection"),i=e.get("selectedItems"),s=e.get("value").map(a=>i.find(l=>n.getItemValue(l)===a)||n.find(a));e.set("selectedItems",s)},syncHighlightedItem({context:e,prop:t}){let n=t("collection"),i=e.get("highlightedValue"),r=i?n.find(i):null;e.set("highlightedItem",r)},syncHighlightedValue({context:e,prop:t,refs:n}){let i=t("collection"),r=e.get("highlightedValue"),{autoHighlight:s}=n.get("inputState");if(s){queueMicrotask(()=>{var a;e.set("highlightedValue",(a=t("collection").firstValue)!=null?a:null)});return}r!=null&&!i.has(r)&&queueMicrotask(()=>{e.set("highlightedValue",null)})},setFocused({context:e}){e.set("focused",!0)},setDefaultHighlightedValue({context:e,prop:t}){let i=t("collection").firstValue;i!=null&&e.set("highlightedValue",i)},clearFocused({context:e}){e.set("focused",!1)},setInputState({refs:e,event:t}){e.set("inputState",{autoHighlight:!!t.autoHighlight,focused:!0})},clearInputState({refs:e}){e.set("inputState",{autoHighlight:!1,focused:!1})}}}}),US=(e,t)=>{let n=new Set(e);for(let i of t)n.delete(i);return n};qS=_()(["collection","defaultHighlightedValue","defaultValue","dir","disabled","deselectable","disallowSelectAll","getRootNode","highlightedValue","id","ids","loopFocus","onHighlightChange","onSelect","onValueChange","orientation","scrollToIndexFn","selectionMode","selectOnHighlight","typeahead","value"]),Jx=B(qS),WS=_()(["item","highlightOnHover"]),Qx=B(WS),KS=_()(["id"]),eA=B(KS),zS=_()(["htmlFor"]),tA=B(zS),YS=class extends K{constructor(t,n){var r;super(t,n);z(this,"_options",[]);z(this,"hasGroups",!1);z(this,"init",()=>{this.machine.start(),this.render(),this.machine.subscribe(()=>{this.api=this.initApi(),this.render()})});let i=n.collection;this._options=(r=i==null?void 0:i.items)!=null?r:[]}get options(){return Array.isArray(this._options)?this._options:[]}setOptions(t){this._options=Array.isArray(t)?t:[]}getCollection(){let t=this.options;return this.hasGroups?Bi({items:t,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var i;return(i=n.group)!=null?i:""}}):Bi({items:t,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled})}initMachine(t){let n=this.getCollection.bind(this),i=t.collection;return new W(GS,y(g({},t),{get collection(){return i!=null?i:n()}}))}initApi(){return $S(this.machine.service,q)}applyItemProps(){let t=this.el.querySelector('[data-scope="listbox"][data-part="content"]');t&&(t.querySelectorAll('[data-scope="listbox"][data-part="item-group"]').forEach(n=>{var s;let i=(s=n.dataset.id)!=null?s:"";this.spreadProps(n,this.api.getItemGroupProps({id:i}));let r=n.querySelector('[data-scope="listbox"][data-part="item-group-label"]');r&&this.spreadProps(r,this.api.getItemGroupLabelProps({htmlFor:i}))}),t.querySelectorAll('[data-scope="listbox"][data-part="item"]').forEach(n=>{var o;let i=(o=n.dataset.value)!=null?o:"",r=this.options.find(l=>{var c,u;return String((u=(c=l.id)!=null?c:l.value)!=null?u:"")===String(i)});if(!r)return;this.spreadProps(n,this.api.getItemProps({item:r}));let s=n.querySelector('[data-scope="listbox"][data-part="item-text"]');s&&this.spreadProps(s,this.api.getItemTextProps({item:r}));let a=n.querySelector('[data-scope="listbox"][data-part="item-indicator"]');a&&this.spreadProps(a,this.api.getItemIndicatorProps({item:r}))}))}render(){var a;let t=(a=this.el.querySelector('[data-scope="listbox"][data-part="root"]'))!=null?a:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="listbox"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=this.el.querySelector('[data-scope="listbox"][data-part="value-text"]');i&&this.spreadProps(i,this.api.getValueTextProps());let r=this.el.querySelector('[data-scope="listbox"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let s=this.el.querySelector('[data-scope="listbox"][data-part="content"]');s&&(this.spreadProps(s,this.api.getContentProps()),this.applyItemProps())}};jS={mounted(){var o;let e=this.el,t=JSON.parse((o=e.dataset.collection)!=null?o:"[]"),n=t.some(l=>l.group!==void 0),i=Z(e,"value"),r=Z(e,"defaultValue"),s=C(e,"controlled"),a=new YS(e,y(g({id:e.id,collection:Rg(t,n)},s&&i?{value:i}:{defaultValue:r!=null?r:[]}),{disabled:C(e,"disabled"),dir:O(e,"dir",["ltr","rtl"]),orientation:O(e,"orientation",["horizontal","vertical"]),loopFocus:C(e,"loopFocus"),selectionMode:O(e,"selectionMode",["single","multiple","extended"]),selectOnHighlight:C(e,"selectOnHighlight"),deselectable:C(e,"deselectable"),typeahead:C(e,"typeahead"),onValueChange:l=>{let c=O(e,"onValueChange");c&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(c,{value:l.value,items:l.items,id:e.id});let u=O(e,"onValueChangeClient");u&&e.dispatchEvent(new CustomEvent(u,{bubbles:!0,detail:{value:l,id:e.id}}))}}));a.hasGroups=n,a.setOptions(t),a.init(),this.listbox=a,this.handlers=[]},updated(){var r;let e=JSON.parse((r=this.el.dataset.collection)!=null?r:"[]"),t=e.some(s=>s.group!==void 0),n=Z(this.el,"value"),i=C(this.el,"controlled");this.listbox&&(this.listbox.hasGroups=t,this.listbox.setOptions(e),this.listbox.updateProps(y(g({collection:Rg(e,t),id:this.el.id},i&&n?{value:n}:{}),{disabled:C(this.el,"disabled"),dir:O(this.el,"dir",["ltr","rtl"]),orientation:O(this.el,"orientation",["horizontal","vertical"])})))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.listbox)==null||e.destroy()}}});var Ug={};he(Ug,{Menu:()=>mT});function sT(e,t){if(!e)return;let n=ue(e),i=new n.CustomEvent(Vl,{detail:{value:t}});e.dispatchEvent(i)}function aT(e,t){let{context:n,send:i,state:r,computed:s,prop:a,scope:o}=e,l=r.hasTag("open"),c=n.get("isSubmenu"),u=s("isTypingAhead"),h=a("composite"),m=n.get("currentPlacement"),d=n.get("anchorPoint"),p=n.get("highlightedValue"),v=On(y(g({},a("positioning")),{placement:d?"bottom":m}));function I(f){return{id:Rr(o,f.value),disabled:!!f.disabled,highlighted:p===f.value}}function T(f){var P;let S=(P=f.valueText)!=null?P:f.value;return y(g({},f),{id:f.value,valueText:S})}function w(f){let S=I(T(f));return y(g({},S),{checked:!!f.checked})}function b(f){let{closeOnSelect:S,valueText:P,value:V}=f,A=I(f),x=Rr(o,V);return t.element(y(g({},Be.item.attrs),{id:x,role:"menuitem","aria-disabled":X(A.disabled),"data-disabled":E(A.disabled),"data-ownedby":Gi(o),"data-highlighted":E(A.highlighted),"data-value":V,"data-valuetext":P,onDragStart(k){k.currentTarget.matches("a[href]")&&k.preventDefault()},onPointerMove(k){if(A.disabled||k.pointerType!=="mouse")return;let N=k.currentTarget;if(A.highlighted)return;let D=je(k);i({type:"ITEM_POINTERMOVE",id:x,target:N,closeOnSelect:S,point:D})},onPointerLeave(k){var $;if(A.disabled||k.pointerType!=="mouse"||!(($=e.event.previous())==null?void 0:$.type.includes("POINTER")))return;let D=k.currentTarget;i({type:"ITEM_POINTERLEAVE",id:x,target:D,closeOnSelect:S})},onPointerDown(k){if(A.disabled)return;let N=k.currentTarget;i({type:"ITEM_POINTERDOWN",target:N,id:x,closeOnSelect:S})},onClick(k){if(rr(k)||Fn(k)||A.disabled)return;let N=k.currentTarget;i({type:"ITEM_CLICK",target:N,id:x,closeOnSelect:S})}}))}return{highlightedValue:p,open:l,setOpen(f){r.hasTag("open")!==f&&i({type:f?"OPEN":"CLOSE"})},setHighlightedValue(f){i({type:"HIGHLIGHTED.SET",value:f})},setParent(f){i({type:"PARENT.SET",value:f,id:f.prop("id")})},setChild(f){i({type:"CHILD.SET",value:f,id:f.prop("id")})},reposition(f={}){i({type:"POSITIONING.SET",options:f})},addItemListener(f){let S=o.getById(f.id);if(!S)return;let P=()=>{var V;return(V=f.onSelect)==null?void 0:V.call(f)};return S.addEventListener(Vl,P),()=>S.removeEventListener(Vl,P)},getContextTriggerProps(){return t.element(y(g({},Be.contextTrigger.attrs),{dir:a("dir"),id:_g(o),"data-state":l?"open":"closed",onPointerDown(f){if(f.pointerType==="mouse")return;let S=je(f);i({type:"CONTEXT_MENU_START",point:S})},onPointerCancel(f){f.pointerType!=="mouse"&&i({type:"CONTEXT_MENU_CANCEL"})},onPointerMove(f){f.pointerType!=="mouse"&&i({type:"CONTEXT_MENU_CANCEL"})},onPointerUp(f){f.pointerType!=="mouse"&&i({type:"CONTEXT_MENU_CANCEL"})},onContextMenu(f){let S=je(f);i({type:"CONTEXT_MENU",point:S}),f.preventDefault()},style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none"}}))},getTriggerItemProps(f){let S=f.getTriggerProps();return au(b({value:S.id}),S)},getTriggerProps(){return t.button(y(g({},c?Be.triggerItem.attrs:Be.trigger.attrs),{"data-placement":n.get("currentPlacement"),type:"button",dir:a("dir"),id:va(o),"data-uid":a("id"),"aria-haspopup":h?"menu":"dialog","aria-controls":Gi(o),"data-controls":Gi(o),"aria-expanded":l||void 0,"data-state":l?"open":"closed",onPointerMove(f){if(f.pointerType!=="mouse"||ma(f.currentTarget)||!c)return;let P=je(f);i({type:"TRIGGER_POINTERMOVE",target:f.currentTarget,point:P})},onPointerLeave(f){if(ma(f.currentTarget)||f.pointerType!=="mouse"||!c)return;let S=je(f);i({type:"TRIGGER_POINTERLEAVE",target:f.currentTarget,point:S})},onPointerDown(f){ma(f.currentTarget)||hi(f)||f.preventDefault()},onClick(f){f.defaultPrevented||ma(f.currentTarget)||i({type:"TRIGGER_CLICK",target:f.currentTarget})},onBlur(){i({type:"TRIGGER_BLUR"})},onFocus(){i({type:"TRIGGER_FOCUS"})},onKeyDown(f){if(f.defaultPrevented)return;let S={ArrowDown(){i({type:"ARROW_DOWN"})},ArrowUp(){i({type:"ARROW_UP"})},Enter(){i({type:"ARROW_DOWN",src:"enter"})},Space(){i({type:"ARROW_DOWN",src:"space"})}},P=ge(f,{orientation:"vertical",dir:a("dir")}),V=S[P];V&&(f.preventDefault(),V(f))}}))},getIndicatorProps(){return t.element(y(g({},Be.indicator.attrs),{dir:a("dir"),"data-state":l?"open":"closed"}))},getPositionerProps(){return t.element(y(g({},Be.positioner.attrs),{dir:a("dir"),id:Gg(o),style:v.floating}))},getArrowProps(){return t.element(y(g({id:ZS(o)},Be.arrow.attrs),{dir:a("dir"),style:v.arrow}))},getArrowTipProps(){return t.element(y(g({},Be.arrowTip.attrs),{dir:a("dir"),style:v.arrowTip}))},getContentProps(){return t.element(y(g({},Be.content.attrs),{id:Gi(o),"aria-label":a("aria-label"),hidden:!l,"data-state":l?"open":"closed",role:h?"menu":"dialog",tabIndex:0,dir:a("dir"),"aria-activedescendant":s("highlightedId")||void 0,"aria-labelledby":va(o),"data-placement":m,onPointerEnter(f){f.pointerType==="mouse"&&i({type:"MENU_POINTERENTER"})},onKeyDown(f){if(f.defaultPrevented||!ce(f.currentTarget,j(f)))return;let S=j(f);if(!((S==null?void 0:S.closest("[role=menu]"))===f.currentTarget||S===f.currentTarget))return;if(f.key==="Tab"&&!ds(f)){f.preventDefault();return}let V={ArrowDown(){i({type:"ARROW_DOWN"})},ArrowUp(){i({type:"ARROW_UP"})},ArrowLeft(){i({type:"ARROW_LEFT"})},ArrowRight(){i({type:"ARROW_RIGHT"})},Enter(){i({type:"ENTER"})},Space(k){var N;u?i({type:"TYPEAHEAD",key:k.key}):(N=V.Enter)==null||N.call(V,k)},Home(){i({type:"HOME"})},End(){i({type:"END"})}},A=ge(f,{dir:a("dir")}),x=V[A];if(x){x(f),f.stopPropagation(),f.preventDefault();return}a("typeahead")&&wc(f)&&(xe(f)||Ot(S)||(i({type:"TYPEAHEAD",key:f.key}),f.preventDefault()))}}))},getSeparatorProps(){return t.element(y(g({},Be.separator.attrs),{role:"separator",dir:a("dir"),"aria-orientation":"horizontal"}))},getItemState:I,getItemProps:b,getOptionItemState:w,getOptionItemProps(f){let{type:S,disabled:P,closeOnSelect:V}=f,A=T(f),x=w(f);return g(g({},b(A)),t.element(y(g({"data-type":S},Be.item.attrs),{dir:a("dir"),"data-value":A.value,role:`menuitem${S}`,"aria-checked":!!x.checked,"data-state":x.checked?"checked":"unchecked",onClick(k){if(P||rr(k)||Fn(k))return;let N=k.currentTarget;i({type:"ITEM_CLICK",target:N,option:A,closeOnSelect:V})}})))},getItemIndicatorProps(f){let S=w(lo(f)),P=S.checked?"checked":"unchecked";return t.element(y(g({},Be.itemIndicator.attrs),{dir:a("dir"),"data-disabled":E(S.disabled),"data-highlighted":E(S.highlighted),"data-state":$e(f,"checked")?P:void 0,hidden:$e(f,"checked")?!S.checked:void 0}))},getItemTextProps(f){let S=w(lo(f)),P=S.checked?"checked":"unchecked";return t.element(y(g({},Be.itemText.attrs),{dir:a("dir"),"data-disabled":E(S.disabled),"data-highlighted":E(S.highlighted),"data-state":$e(f,"checked")?P:void 0}))},getItemGroupLabelProps(f){return t.element(y(g({},Be.itemGroupLabel.attrs),{id:Mg(o,f.htmlFor),dir:a("dir")}))},getItemGroupProps(f){return t.element(y(g({id:JS(o,f.id)},Be.itemGroup.attrs),{dir:a("dir"),"aria-labelledby":Mg(o,f.id),role:"group"}))}}}function Hg(e){let t=e.parent;for(;t&&t.context.get("isSubmenu");)t=t.refs.get("parent");t==null||t.send({type:"CLOSE"})}function cT(e,t){return e?fo(e,t):!1}function uT(e,t,n){let i=Object.keys(e).length>0;if(!t)return null;if(!i)return Rr(n,t);for(let r in e){let s=e[r],a=va(s.scope);if(a===t)return a}return Rr(n,t)}var XS,Be,va,_g,Gi,ZS,Gg,JS,Rr,ei,Mg,cn,Fg,fa,QS,wl,Dr,eT,tT,xl,nT,iT,rT,ma,$g,Vl,pt,_i,oT,lT,dT,cA,hT,uA,gT,dA,pT,hA,fT,gA,Bg,mT,qg=re(()=>{"use strict";Cs();Pr();Wn();tn();se();XS=U("menu").parts("arrow","arrowTip","content","contextTrigger","indicator","item","itemGroup","itemGroupLabel","itemIndicator","itemText","positioner","separator","trigger","triggerItem"),Be=XS.build(),va=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`menu:${e.id}:trigger`},_g=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.contextTrigger)!=null?n:`menu:${e.id}:ctx-trigger`},Gi=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`menu:${e.id}:content`},ZS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.arrow)!=null?n:`menu:${e.id}:arrow`},Gg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`menu:${e.id}:popper`},JS=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.group)==null?void 0:i.call(n,t))!=null?r:`menu:${e.id}:group:${t}`},Rr=(e,t)=>`${e.id}/${t}`,ei=e=>{var t;return(t=e==null?void 0:e.dataset.value)!=null?t:null},Mg=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.groupLabel)==null?void 0:i.call(n,t))!=null?r:`menu:${e.id}:group-label:${t}`},cn=e=>e.getById(Gi(e)),Fg=e=>e.getById(Gg(e)),fa=e=>e.getById(va(e)),QS=(e,t)=>t?e.getById(Rr(e,t)):null,wl=e=>e.getById(_g(e)),Dr=e=>{let n=`[role^="menuitem"][data-ownedby=${CSS.escape(Gi(e))}]:not([data-disabled])`;return Fe(cn(e),n)},eT=e=>lt(Dr(e)),tT=e=>mt(Dr(e)),xl=(e,t)=>t?e.id===t||e.dataset.value===t:!1,nT=(e,t)=>{var r;let n=Dr(e),i=n.findIndex(s=>xl(s,t.value));return _c(n,i,{loop:(r=t.loop)!=null?r:t.loopFocus})},iT=(e,t)=>{var r;let n=Dr(e),i=n.findIndex(s=>xl(s,t.value));return Gc(n,i,{loop:(r=t.loop)!=null?r:t.loopFocus})},rT=(e,t)=>{var r;let n=Dr(e),i=n.find(s=>xl(s,t.value));return Ue(n,{state:t.typeaheadState,key:t.key,activeId:(r=i==null?void 0:i.id)!=null?r:null})},ma=e=>le(e)&&(e.dataset.disabled===""||e.hasAttribute("disabled")),$g=e=>{var t;return!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))&&!!(e!=null&&e.hasAttribute("data-controls"))},Vl="menu:select";({not:pt,and:_i,or:oT}=Ee()),lT={props({props:e}){return y(g({closeOnSelect:!0,typeahead:!0,composite:!0,loopFocus:!1,navigate(t){mi(t.node)}},e),{positioning:g({placement:"bottom-start",gutter:8},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},context({bindable:e,prop:t}){return{suspendPointer:e(()=>({defaultValue:!1})),highlightedValue:e(()=>({defaultValue:t("defaultHighlightedValue")||null,value:t("highlightedValue"),onChange(n){var i;(i=t("onHighlightChange"))==null||i({highlightedValue:n})}})),lastHighlightedValue:e(()=>({defaultValue:null})),currentPlacement:e(()=>({defaultValue:void 0})),intentPolygon:e(()=>({defaultValue:null})),anchorPoint:e(()=>({defaultValue:null,hash(n){return`x: ${n==null?void 0:n.x}, y: ${n==null?void 0:n.y}`}})),isSubmenu:e(()=>({defaultValue:!1}))}},refs(){return{parent:null,children:{},typeaheadState:g({},Ue.defaultOptions),positioningOverride:{}}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",isTypingAhead:({refs:e})=>e.get("typeaheadState").keysSoFar!=="",highlightedId:({context:e,scope:t,refs:n})=>uT(n.get("children"),e.get("highlightedValue"),t)},watch({track:e,action:t,context:n,prop:i}){e([()=>n.get("isSubmenu")],()=>{t(["setSubmenuPlacement"])}),e([()=>n.hash("anchorPoint")],()=>{n.get("anchorPoint")&&t(["reposition"])}),e([()=>i("open")],()=>{t(["toggleVisibility"])})},on:{"PARENT.SET":{actions:["setParentMenu"]},"CHILD.SET":{actions:["setChildMenu"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],OPEN_AUTOFOCUS:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightFirstItem","invokeOnOpen"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"HIGHLIGHTED.RESTORE":{actions:["restoreHighlightedItem"]},"HIGHLIGHTED.SET":{actions:["setHighlightedItem"]}},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TRIGGER_FOCUS:{guard:pt("isSubmenu"),target:"closed"},TRIGGER_POINTERMOVE:{guard:"isSubmenu",target:"opening"}}},"opening:contextmenu":{tags:["closed"],effects:["waitForLongPress"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},CONTEXT_MENU_CANCEL:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"LONG_PRESS.OPEN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}},opening:{tags:["closed"],effects:["waitForOpenDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},BLUR:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TRIGGER_POINTERLEAVE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"DELAY.OPEN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}},closing:{tags:["open"],effects:["trackPointerMove","trackInteractOutside","waitForCloseDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]},MENU_POINTERENTER:{target:"open",actions:["clearIntentPolygon"]},POINTER_MOVED_AWAY_FROM_SUBMENU:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]}],"DELAY.CLOSE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem","invokeOnClose"]}]}},closed:{tags:["closed"],entry:["clearHighlightedItem","focusTrigger","resumePointer","clearAnchorPoint"],on:{"CONTROLLED.OPEN":[{guard:oT("isOpenAutoFocusEvent","isArrowDownEvent"),target:"open",actions:["highlightFirstItem"]},{guard:"isArrowUpEvent",target:"open",actions:["highlightLastItem"]},{target:"open"}],CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",target:"opening"},TRIGGER_BLUR:{target:"idle"},ARROW_DOWN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightFirstItem","invokeOnOpen"]}],ARROW_UP:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightLastItem","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackInteractOutside","trackPositioning","scrollToHighlightedItem"],entry:["focusMenu","resumePointer"],on:{"CONTROLLED.CLOSE":[{target:"closed",guard:"isArrowLeftEvent",actions:["focusParentMenu"]},{target:"closed"}],TRIGGER_CLICK:[{guard:_i(pt("isTriggerItem"),"isOpenControlled"),actions:["invokeOnClose"]},{guard:pt("isTriggerItem"),target:"closed",actions:["invokeOnClose"]}],CONTEXT_MENU:{actions:["setAnchorPoint","focusMenu"]},ARROW_UP:{actions:["highlightPrevItem","focusMenu"]},ARROW_DOWN:{actions:["highlightNextItem","focusMenu"]},ARROW_LEFT:[{guard:_i("isSubmenu","isOpenControlled"),actions:["invokeOnClose"]},{guard:"isSubmenu",target:"closed",actions:["focusParentMenu","invokeOnClose"]}],HOME:{actions:["highlightFirstItem","focusMenu"]},END:{actions:["highlightLastItem","focusMenu"]},ARROW_RIGHT:{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},ENTER:[{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},{actions:["clickHighlightedItem"]}],ITEM_POINTERMOVE:[{guard:pt("isPointerSuspended"),actions:["setHighlightedItem","focusMenu","closeSiblingMenus"]},{actions:["setLastHighlightedItem","closeSiblingMenus"]}],ITEM_POINTERLEAVE:{guard:_i(pt("isPointerSuspended"),pt("isTriggerItem")),actions:["clearHighlightedItem"]},ITEM_CLICK:[{guard:_i(pt("isTriggerItemHighlighted"),pt("isHighlightedItemEditable"),"closeOnSelect","isOpenControlled"),actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose"]},{guard:_i(pt("isTriggerItemHighlighted"),pt("isHighlightedItemEditable"),"closeOnSelect"),target:"closed",actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose"]},{guard:_i(pt("isTriggerItemHighlighted"),pt("isHighlightedItemEditable")),actions:["invokeOnSelect","setOptionState"]},{actions:["setHighlightedItem"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",actions:["setIntentPolygon"]},TRIGGER_POINTERLEAVE:{target:"closing",actions:["setIntentPolygon"]},ITEM_POINTERDOWN:{actions:["setHighlightedItem"]},TYPEAHEAD:{actions:["highlightMatchedItem"]},FOCUS_MENU:{actions:["focusMenu"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{closeOnSelect:({prop:e,event:t})=>{var n;return!!((n=t==null?void 0:t.closeOnSelect)!=null?n:e("closeOnSelect"))},isTriggerItem:({event:e})=>$g(e.target),isTriggerItemHighlighted:({event:e,scope:t,computed:n})=>{var r;let i=(r=e.target)!=null?r:t.getById(n("highlightedId"));return!!(i!=null&&i.hasAttribute("data-controls"))},isSubmenu:({context:e})=>e.get("isSubmenu"),isPointerSuspended:({context:e})=>e.get("suspendPointer"),isHighlightedItemEditable:({scope:e,computed:t})=>Ot(e.getById(t("highlightedId"))),isOpenControlled:({prop:e})=>e("open")!==void 0,isArrowLeftEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_LEFT"},isArrowUpEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_UP"},isArrowDownEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_DOWN"},isOpenAutoFocusEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="OPEN_AUTOFOCUS"}},effects:{waitForOpenDelay({send:e}){let t=setTimeout(()=>{e({type:"DELAY.OPEN"})},200);return()=>clearTimeout(t)},waitForCloseDelay({send:e}){let t=setTimeout(()=>{e({type:"DELAY.CLOSE"})},100);return()=>clearTimeout(t)},waitForLongPress({send:e}){let t=setTimeout(()=>{e({type:"LONG_PRESS.OPEN"})},700);return()=>clearTimeout(t)},trackPositioning({context:e,prop:t,scope:n,refs:i}){if(wl(n))return;let r=g(g({},t("positioning")),i.get("positioningOverride"));e.set("currentPlacement",r.placement);let s=()=>Fg(n);return It(fa(n),s,y(g({},r),{defer:!0,onComplete(a){e.set("currentPlacement",a.placement)}}))},trackInteractOutside({refs:e,scope:t,prop:n,context:i,send:r}){let s=()=>cn(t),a=!0;return Ft(s,{type:"menu",defer:!0,exclude:[fa(t)],onInteractOutside:n("onInteractOutside"),onRequestDismiss:n("onRequestDismiss"),onFocusOutside(o){var u;(u=n("onFocusOutside"))==null||u(o);let l=j(o.detail.originalEvent);if(ce(wl(t),l)){o.preventDefault();return}},onEscapeKeyDown(o){var l;(l=n("onEscapeKeyDown"))==null||l(o),i.get("isSubmenu")&&o.preventDefault(),Hg({parent:e.get("parent")})},onPointerDownOutside(o){var u;(u=n("onPointerDownOutside"))==null||u(o);let l=j(o.detail.originalEvent);if(ce(wl(t),l)&&o.detail.contextmenu){o.preventDefault();return}a=!o.detail.focusable},onDismiss(){r({type:"CLOSE",src:"interact-outside",restoreFocus:a})}})},trackPointerMove({context:e,scope:t,send:n,refs:i,flush:r}){let s=i.get("parent");r(()=>{s.context.set("suspendPointer",!0)});let a=t.getDoc();return ee(a,"pointermove",o=>{cT(e.get("intentPolygon"),{x:o.clientX,y:o.clientY})||(n({type:"POINTER_MOVED_AWAY_FROM_SUBMENU"}),s.context.set("suspendPointer",!1))})},scrollToHighlightedItem({event:e,scope:t,computed:n}){let i=()=>{if(e.current().type.startsWith("ITEM_POINTER"))return;let s=t.getById(n("highlightedId")),a=cn(t);Xt(s,{rootEl:a,block:"nearest"})};return H(()=>i()),ot(()=>cn(t),{defer:!0,attributes:["aria-activedescendant"],callback:i})}},actions:{setAnchorPoint({context:e,event:t}){e.set("anchorPoint",n=>fe(n,t.point)?n:t.point)},setSubmenuPlacement({context:e,computed:t,refs:n}){if(!e.get("isSubmenu"))return;let i=t("isRtl")?"left-start":"right-start";n.set("positioningOverride",{placement:i,gutter:0})},reposition({context:e,scope:t,prop:n,event:i,refs:r}){var c;let s=()=>Fg(t),a=e.get("anchorPoint"),o=a?()=>g({width:0,height:0},a):void 0,l=g(g({},n("positioning")),r.get("positioningOverride"));It(fa(t),s,y(g(y(g({},l),{defer:!0,getAnchorRect:o}),(c=i.options)!=null?c:{}),{listeners:!1,onComplete(u){e.set("currentPlacement",u.placement)}}))},setOptionState({event:e}){if(!e.option)return;let{checked:t,onCheckedChange:n,type:i}=e.option;i==="radio"?n==null||n(!0):i==="checkbox"&&(n==null||n(!t))},clickHighlightedItem({scope:e,computed:t,prop:n,context:i}){var a;let r=e.getById(t("highlightedId"));if(!r||r.dataset.disabled)return;let s=i.get("highlightedValue");st(r)?(a=n("navigate"))==null||a({value:s,node:r,href:r.href}):queueMicrotask(()=>r.click())},setIntentPolygon({context:e,scope:t,event:n}){let i=cn(t),r=e.get("currentPlacement");if(!i||!r)return;let s=i.getBoundingClientRect(),a=Su(s,r);if(!a)return;let l=Md(r)==="right"?-5:5;e.set("intentPolygon",[y(g({},n.point),{x:n.point.x+l}),...a])},clearIntentPolygon({context:e}){e.set("intentPolygon",null)},clearAnchorPoint({context:e}){e.set("anchorPoint",null)},resumePointer({refs:e,flush:t}){let n=e.get("parent");n&&t(()=>{n.context.set("suspendPointer",!1)})},setHighlightedItem({context:e,event:t}){let n=t.value||ei(t.target);e.set("highlightedValue",n)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},focusMenu({scope:e}){H(()=>{let t=cn(e),n=us({root:t,enabled:!ce(t,e.getActiveElement()),filter(i){var r;return!((r=i.role)!=null&&r.startsWith("menuitem"))}});n==null||n.focus({preventScroll:!0})})},highlightFirstItem({context:e,scope:t}){(cn(t)?queueMicrotask:H)(()=>{let i=eT(t);i&&e.set("highlightedValue",ei(i))})},highlightLastItem({context:e,scope:t}){(cn(t)?queueMicrotask:H)(()=>{let i=tT(t);i&&e.set("highlightedValue",ei(i))})},highlightNextItem({context:e,scope:t,event:n,prop:i}){let r=nT(t,{loop:n.loop,value:e.get("highlightedValue"),loopFocus:i("loopFocus")});e.set("highlightedValue",ei(r))},highlightPrevItem({context:e,scope:t,event:n,prop:i}){let r=iT(t,{loop:n.loop,value:e.get("highlightedValue"),loopFocus:i("loopFocus")});e.set("highlightedValue",ei(r))},invokeOnSelect({context:e,prop:t,scope:n}){var s;let i=e.get("highlightedValue");if(i==null)return;let r=QS(n,i);sT(r,i),(s=t("onSelect"))==null||s({value:i})},focusTrigger({scope:e,context:t,event:n}){t.get("isSubmenu")||t.get("anchorPoint")||n.restoreFocus===!1||queueMicrotask(()=>{var i;return(i=fa(e))==null?void 0:i.focus({preventScroll:!0})})},highlightMatchedItem({scope:e,context:t,event:n,refs:i}){let r=rT(e,{key:n.key,value:t.get("highlightedValue"),typeaheadState:i.get("typeaheadState")});r&&t.set("highlightedValue",ei(r))},setParentMenu({refs:e,event:t,context:n}){e.set("parent",t.value),n.set("isSubmenu",!0)},setChildMenu({refs:e,event:t}){let n=e.get("children");n[t.id]=t.value,e.set("children",n)},closeSiblingMenus({refs:e,event:t,scope:n}){var a;let i=t.target;if(!$g(i))return;let r=i==null?void 0:i.getAttribute("data-uid"),s=e.get("children");for(let o in s){if(o===r)continue;let l=s[o],c=l.context.get("intentPolygon");c&&t.point&&fo(c,t.point)||((a=cn(n))==null||a.focus({preventScroll:!0}),l.send({type:"CLOSE"}))}},closeRootMenu({refs:e}){Hg({parent:e.get("parent")})},openSubmenu({refs:e,scope:t,computed:n}){let i=t.getById(n("highlightedId")),r=i==null?void 0:i.getAttribute("data-uid"),s=e.get("children"),a=r?s[r]:null;a==null||a.send({type:"OPEN_AUTOFOCUS"})},focusParentMenu({refs:e}){var t;(t=e.get("parent"))==null||t.send({type:"FOCUS_MENU"})},setLastHighlightedItem({context:e,event:t}){e.set("lastHighlightedValue",ei(t.target))},restoreHighlightedItem({context:e}){e.get("lastHighlightedValue")&&(e.set("highlightedValue",e.get("lastHighlightedValue")),e.set("lastHighlightedValue",null))},restoreParentHighlightedItem({refs:e}){var t;(t=e.get("parent"))==null||t.send({type:"HIGHLIGHTED.RESTORE"})},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},toggleVisibility({prop:e,event:t,send:n}){n({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:t})}}}};dT=_()(["anchorPoint","aria-label","closeOnSelect","composite","defaultHighlightedValue","defaultOpen","dir","getRootNode","highlightedValue","id","ids","loopFocus","navigate","onEscapeKeyDown","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","onSelect","open","positioning","typeahead"]),cA=B(dT),hT=_()(["closeOnSelect","disabled","value","valueText"]),uA=B(hT),gT=_()(["htmlFor"]),dA=B(gT),pT=_()(["id"]),hA=B(pT),fT=_()(["checked","closeOnSelect","disabled","onCheckedChange","type","value","valueText"]),gA=B(fT),Bg=class extends K{constructor(){super(...arguments);z(this,"children",[])}initMachine(t){return new W(lT,t)}initApi(){return aT(this.machine.service,q)}setChild(t){this.api.setChild(t.machine.service),this.children.includes(t)||this.children.push(t)}setParent(t){this.api.setParent(t.machine.service)}isOwnElement(t){return t.closest('[phx-hook="Menu"]')===this.el}renderSubmenuTriggers(){let t=this.el.querySelector('[data-scope="menu"][data-part="content"]');if(!t)return;let n=t.querySelectorAll('[data-scope="menu"][data-nested-menu]');for(let i of n){if(!this.isOwnElement(i))continue;let r=i.dataset.nestedMenu;if(!r)continue;let s=this.children.find(o=>o.el.id===`menu:${r}`);if(!s)continue;let a=()=>{let o=this.api.getTriggerItemProps(s.api);this.spreadProps(i,o)};a(),this.machine.subscribe(a),s.machine.subscribe(a)}}render(){let t=this.el.querySelector('[data-scope="menu"][data-part="trigger"]');t&&this.spreadProps(t,this.api.getTriggerProps());let n=this.el.querySelector('[data-scope="menu"][data-part="positioner"]'),i=this.el.querySelector('[data-scope="menu"][data-part="content"]');if(n&&i){this.spreadProps(n,this.api.getPositionerProps()),this.spreadProps(i,this.api.getContentProps()),i.style.pointerEvents="auto",n.hidden=!this.api.open;let s=!this.el.querySelector('[data-scope="menu"][data-part="trigger"]');(this.api.open||s)&&(i.querySelectorAll('[data-scope="menu"][data-part="item"]').forEach(u=>{if(!this.isOwnElement(u))return;let h=u.dataset.value;if(h){let m=u.hasAttribute("data-disabled");this.spreadProps(u,this.api.getItemProps({value:h,disabled:m||void 0}))}}),i.querySelectorAll('[data-scope="menu"][data-part="item-group"]').forEach(u=>{if(!this.isOwnElement(u))return;let h=u.id;h&&this.spreadProps(u,this.api.getItemGroupProps({id:h}))}),i.querySelectorAll('[data-scope="menu"][data-part="separator"]').forEach(u=>{this.isOwnElement(u)&&this.spreadProps(u,this.api.getSeparatorProps())}))}let r=this.el.querySelector('[data-scope="menu"][data-part="indicator"]');r&&this.spreadProps(r,this.api.getIndicatorProps())}},mT={mounted(){let e=this.el;if(e.hasAttribute("data-nested"))return;let t=this.pushEvent.bind(this),n=()=>{var a;return(a=this.liveSocket)==null?void 0:a.main},i=new Bg(e,y(g({id:e.id.replace("menu:","")},C(e,"controlled")?{open:C(e,"open")}:{defaultOpen:C(e,"defaultOpen")}),{closeOnSelect:C(e,"closeOnSelect"),loopFocus:C(e,"loopFocus"),typeahead:C(e,"typeahead"),composite:C(e,"composite"),dir:O(e,"dir",["ltr","rtl"]),onSelect:a=>{var v,I,T;let o=C(e,"redirect"),l=[...e.querySelectorAll('[data-scope="menu"][data-part="item"]')].find(w=>w.getAttribute("data-value")===a.value),c=l==null?void 0:l.getAttribute("data-redirect"),u=l==null?void 0:l.hasAttribute("data-new-tab"),h=n();o&&a.value&&((v=h==null?void 0:h.isDead)!=null?v:!0)&&c!=="false"&&(u?window.open(a.value,"_blank","noopener,noreferrer"):window.location.href=a.value);let d=O(e,"onSelect");d&&h&&!h.isDead&&h.isConnected()&&t(d,{id:e.id,value:(I=a.value)!=null?I:null});let p=O(e,"onSelectClient");p&&e.dispatchEvent(new CustomEvent(p,{bubbles:!0,detail:{id:e.id,value:(T=a.value)!=null?T:null}}))},onOpenChange:a=>{var u,h;let o=n(),l=O(e,"onOpenChange");l&&o&&!o.isDead&&o.isConnected()&&t(l,{id:e.id,open:(u=a.open)!=null?u:!1});let c=O(e,"onOpenChangeClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:{id:e.id,open:(h=a.open)!=null?h:!1}}))}}));i.init(),this.menu=i,this.nestedMenus=new Map;let r=e.querySelectorAll('[data-scope="menu"][data-nested="menu"]'),s=[];r.forEach((a,o)=>{var c;let l=a.id;if(l){let u=`${l}-${o}`,h=new Bg(a,{id:u,dir:O(a,"dir",["ltr","rtl"]),closeOnSelect:C(a,"closeOnSelect"),loopFocus:C(a,"loopFocus"),typeahead:C(a,"typeahead"),composite:C(a,"composite"),onSelect:m=>{var S,P,V;let d=C(e,"redirect"),p=[...e.querySelectorAll('[data-scope="menu"][data-part="item"]')].find(A=>A.getAttribute("data-value")===m.value),v=p==null?void 0:p.getAttribute("data-redirect"),I=p==null?void 0:p.hasAttribute("data-new-tab"),T=n();d&&m.value&&((S=T==null?void 0:T.isDead)!=null?S:!0)&&v!=="false"&&(I?window.open(m.value,"_blank","noopener,noreferrer"):window.location.href=m.value);let b=O(e,"onSelect");b&&T&&!T.isDead&&T.isConnected()&&t(b,{id:e.id,value:(P=m.value)!=null?P:null});let f=O(e,"onSelectClient");f&&e.dispatchEvent(new CustomEvent(f,{bubbles:!0,detail:{id:e.id,value:(V=m.value)!=null?V:null}}))}});h.init(),(c=this.nestedMenus)==null||c.set(l,h),s.push(h)}}),setTimeout(()=>{s.forEach(a=>{this.menu&&(this.menu.setChild(a),a.setParent(this.menu))}),this.menu&&this.menu.children.length>0&&this.menu.renderSubmenuTriggers()},0),this.onSetOpen=a=>{let{open:o}=a.detail;i.api.open!==o&&i.api.setOpen(o)},e.addEventListener("phx:menu:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("menu_set_open",a=>{let o=a.menu_id;(!o||e.id===o||e.id===`menu:${o}`)&&i.api.setOpen(a.open)})),this.handlers.push(this.handleEvent("menu_open",()=>{this.pushEvent("menu_open_response",{open:i.api.open})}))},updated(){var e;this.el.hasAttribute("data-nested")||(e=this.menu)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{open:C(this.el,"open")}:{defaultOpen:C(this.el,"defaultOpen")}),{closeOnSelect:C(this.el,"closeOnSelect"),loopFocus:C(this.el,"loopFocus"),typeahead:C(this.el,"typeahead"),composite:C(this.el,"composite"),dir:O(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(!this.el.hasAttribute("data-nested")){if(this.onSetOpen&&this.el.removeEventListener("phx:menu:set-open",this.onSetOpen),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);if(this.nestedMenus)for(let[,t]of this.nestedMenus)t.destroy();(e=this.menu)==null||e.destroy()}}}});var rp={};he(rp,{NumberInput:()=>zT});function yT(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes("-nu-")&&(e.includes("-u-")||(e+="-u-"),e+=`-nu-${n}`),t.style==="unit"&&!ya){var i;let{unit:a,unitDisplay:o="short"}=t;if(!a)throw new Error('unit option must be provided with style: "unit"');if(!(!((i=Jg[a])===null||i===void 0)&&i[o]))throw new Error(`Unsupported unit ${a} with unitDisplay = ${o}`);t=y(g({},t),{style:"decimal"})}let r=e+(t?Object.entries(t).sort((a,o)=>a[0]0||Object.is(n,0):t==="exceptZero"&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):i=n>0),i){let r=e.format(-n),s=e.format(n),a=r.replace(s,"").replace(/\u200e|\u061C/,"");return[...a].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),r.replace(s,"!!!").replace(a,"+").replace("!!!",s)}else return e.format(n)}}function kl(e,t,n){let i=Kg(e,t);if(!e.includes("-nu-")&&!i.isValidPartialNumber(n)){for(let r of IT)if(r!==i.options.numberingSystem){let s=Kg(e+(e.includes("-u-")?"-nu-":"-u-nu-")+r,t);if(s.isValidPartialNumber(n))return s}}return i}function Kg(e,t){let n=e+(t?Object.entries(t).sort((r,s)=>r[0]l.formatToParts(k));var m;let d=(m=(r=c.find(k=>k.type==="minusSign"))===null||r===void 0?void 0:r.value)!==null&&m!==void 0?m:"-",p=(s=u.find(k=>k.type==="plusSign"))===null||s===void 0?void 0:s.value;!p&&((i==null?void 0:i.signDisplay)==="exceptZero"||(i==null?void 0:i.signDisplay)==="always")&&(p="+");let I=(a=new Intl.NumberFormat(e,y(g({},n),{minimumFractionDigits:2,maximumFractionDigits:2})).formatToParts(.001).find(k=>k.type==="decimal"))===null||a===void 0?void 0:a.value,T=(o=c.find(k=>k.type==="group"))===null||o===void 0?void 0:o.value,w=c.filter(k=>!zg.has(k.type)).map(k=>Yg(k.value)),b=h.flatMap(k=>k.filter(N=>!zg.has(N.type)).map(N=>Yg(N.value))),f=[...new Set([...w,...b])].sort((k,N)=>N.length-k.length),S=f.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${f.join("|")}|[\\p{White_Space}]`,"gu"),P=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),V=new Map(P.map((k,N)=>[k,N])),A=new RegExp(`[${P.join("")}]`,"g");return{minusSign:d,plusSign:p,decimal:I,group:T,literals:S,numeral:A,index:k=>String(V.get(k))}}function Ui(e,t,n){return e.replaceAll?e.replaceAll(t,n):e.split(t).join(n)}function Yg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Dl(e,t){if(!(!e||!t.isActiveElement(e)))try{let{selectionStart:n,selectionEnd:i,value:r}=e;return n==null||i==null?void 0:{start:n,end:i,value:r}}catch(n){return}}function OT(e,t,n){if(!(!e||!n.isActiveElement(e))){if(!t){let i=e.value.length;e.setSelectionRange(i,i);return}try{let i=e.value,{start:r,end:s,value:a}=t;if(i===a){e.setSelectionRange(r,s);return}let o=jg(a,i,r),l=r===s?o:jg(a,i,s),c=Math.max(0,Math.min(o,i.length)),u=Math.max(c,Math.min(l,i.length));e.setSelectionRange(c,u)}catch(i){let r=e.value.length;e.setSelectionRange(r,r)}}}function jg(e,t,n){let i=e.slice(0,n),r=e.slice(n),s=0,a=Math.min(i.length,t.length);for(let c=0;c0&&s>=i.length)return s;if(o>=r.length)return t.length-o;if(s>0)return s;if(o>0)return t.length-o;if(n===0&&s===0&&o===0)return t.length;if(e.length>0){let c=n/e.length;return Math.round(c*t.length)}return t.length}function FT(e,t){let{state:n,send:i,prop:r,scope:s,computed:a}=e,o=n.hasTag("focus"),l=a("isDisabled"),c=!!r("readOnly"),u=!!r("required"),h=n.matches("scrubbing"),m=a("isValueEmpty"),d=a("isOutOfRange")||!!r("invalid"),p=l||!a("canIncrement")||c,v=l||!a("canDecrement")||c,I=r("translations");return{focused:o,invalid:d,empty:m,value:a("formattedValue"),valueAsNumber:a("valueAsNumber"),setValue(T){i({type:"VALUE.SET",value:T})},clearValue(){i({type:"VALUE.CLEAR"})},increment(){i({type:"VALUE.INCREMENT"})},decrement(){i({type:"VALUE.DECREMENT"})},setToMax(){i({type:"VALUE.SET",value:r("max")})},setToMin(){i({type:"VALUE.SET",value:r("min")})},focus(){var T;(T=ni(s))==null||T.focus()},getRootProps(){return t.element(y(g({id:wT(s)},Vn.root.attrs),{dir:r("dir"),"data-disabled":E(l),"data-focus":E(o),"data-invalid":E(d),"data-scrubbing":E(h)}))},getLabelProps(){return t.label(y(g({},Vn.label.attrs),{dir:r("dir"),"data-disabled":E(l),"data-focus":E(o),"data-invalid":E(d),"data-required":E(u),"data-scrubbing":E(h),id:xT(s),htmlFor:Lr(s),onClick(){H(()=>{tr(ni(s))})}}))},getControlProps(){return t.element(y(g({},Vn.control.attrs),{dir:r("dir"),role:"group","aria-disabled":l,"data-focus":E(o),"data-disabled":E(l),"data-invalid":E(d),"data-scrubbing":E(h),"aria-invalid":X(d)}))},getValueTextProps(){return t.element(y(g({},Vn.valueText.attrs),{dir:r("dir"),"data-disabled":E(l),"data-invalid":E(d),"data-focus":E(o),"data-scrubbing":E(h)}))},getInputProps(){return t.input(y(g({},Vn.input.attrs),{dir:r("dir"),name:r("name"),form:r("form"),id:Lr(s),role:"spinbutton",defaultValue:a("formattedValue"),pattern:r("formatOptions")?void 0:r("pattern"),inputMode:r("inputMode"),"aria-invalid":X(d),"data-invalid":E(d),disabled:l,"data-disabled":E(l),readOnly:c,required:r("required"),autoComplete:"off",autoCorrect:"off",spellCheck:"false",type:"text","aria-roledescription":"numberfield","aria-valuemin":r("min"),"aria-valuemax":r("max"),"aria-valuenow":Number.isNaN(a("valueAsNumber"))?void 0:a("valueAsNumber"),"aria-valuetext":a("valueText"),"data-scrubbing":E(h),onFocus(){i({type:"INPUT.FOCUS"})},onBlur(){i({type:"INPUT.BLUR"})},onInput(T){let w=Dl(T.currentTarget,s);i({type:"INPUT.CHANGE",target:T.currentTarget,hint:"set",selection:w})},onBeforeInput(T){var w;try{let{selectionStart:b,selectionEnd:f,value:S}=T.currentTarget,P=S.slice(0,b)+((w=T.data)!=null?w:"")+S.slice(f);a("parser").isValidPartialNumber(P)||T.preventDefault()}catch(b){}},onKeyDown(T){if(T.defaultPrevented||c||Re(T))return;let w=gi(T)*r("step"),f={ArrowUp(){i({type:"INPUT.ARROW_UP",step:w}),T.preventDefault()},ArrowDown(){i({type:"INPUT.ARROW_DOWN",step:w}),T.preventDefault()},Home(){xe(T)||(i({type:"INPUT.HOME"}),T.preventDefault())},End(){xe(T)||(i({type:"INPUT.END"}),T.preventDefault())},Enter(S){let P=Dl(S.currentTarget,s);i({type:"INPUT.ENTER",selection:P})}}[T.key];f==null||f(T)}}))},getDecrementTriggerProps(){return t.button(y(g({},Vn.decrementTrigger.attrs),{dir:r("dir"),id:tp(s),disabled:v,"data-disabled":E(v),"aria-label":I.decrementLabel,type:"button",tabIndex:-1,"aria-controls":Lr(s),"data-scrubbing":E(h),onPointerDown(T){var w;v||pe(T)&&(i({type:"TRIGGER.PRESS_DOWN",hint:"decrement",pointerType:T.pointerType}),T.pointerType==="mouse"&&T.preventDefault(),T.pointerType==="touch"&&((w=T.currentTarget)==null||w.focus({preventScroll:!0})))},onPointerUp(T){i({type:"TRIGGER.PRESS_UP",hint:"decrement",pointerType:T.pointerType})},onPointerLeave(){v||i({type:"TRIGGER.PRESS_UP",hint:"decrement"})}}))},getIncrementTriggerProps(){return t.button(y(g({},Vn.incrementTrigger.attrs),{dir:r("dir"),id:ep(s),disabled:p,"data-disabled":E(p),"aria-label":I.incrementLabel,type:"button",tabIndex:-1,"aria-controls":Lr(s),"data-scrubbing":E(h),onPointerDown(T){var w;p||!pe(T)||(i({type:"TRIGGER.PRESS_DOWN",hint:"increment",pointerType:T.pointerType}),T.pointerType==="mouse"&&T.preventDefault(),T.pointerType==="touch"&&((w=T.currentTarget)==null||w.focus({preventScroll:!0})))},onPointerUp(T){i({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:T.pointerType})},onPointerLeave(T){i({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:T.pointerType})}}))},getScrubberProps(){return t.element(y(g({},Vn.scrubber.attrs),{dir:r("dir"),"data-disabled":E(l),id:VT(s),role:"presentation","data-scrubbing":E(h),onMouseDown(T){if(l||!pe(T))return;let w=je(T),f=ue(T.currentTarget).devicePixelRatio;w.x=w.x-Ci(7.5,f),w.y=w.y-Ci(7.5,f),i({type:"SCRUBBER.PRESS_DOWN",point:w}),T.preventDefault(),H(()=>{tr(ni(s))})},style:{cursor:l?void 0:"ew-resize"}}))}}}var Al,Rl,ya,Jg,vT,ET,IT,Qg,Wg,PT,zg,CT,TT,Vn,wT,Lr,ep,tp,VT,np,xT,ni,AT,kT,ip,NT,RT,DT,LT,MT,$T,HT,Nl,ti,BT,_T,GT,UT,Xg,Zg,qT,WT,vA,KT,zT,sp=re(()=>{"use strict";se();Al=new Map,Rl=!1;try{Rl=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch(e){}ya=!1;try{ya=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch(e){}Jg={degree:{narrow:{default:"\xB0","ja-JP":" \u5EA6","zh-TW":"\u5EA6","sl-SI":" \xB0"}}},vT=class{format(e){let t="";if(!Rl&&this.options.signDisplay!=null?t=bT(this.numberFormatter,this.options.signDisplay,e):t=this.numberFormatter.format(e),this.options.style==="unit"&&!ya){var n;let{unit:i,unitDisplay:r="short",locale:s}=this.resolvedOptions();if(!i)return t;let a=(n=Jg[i])===null||n===void 0?void 0:n[r];t+=a[s]||a.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,t);if(t= start date");return`${this.format(e)} \u2013 ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,t);if(t= start date");let n=this.numberFormatter.formatToParts(e),i=this.numberFormatter.formatToParts(t);return[...n.map(r=>y(g({},r),{source:"startRange"})),{type:"literal",value:" \u2013 ",source:"shared"},...i.map(r=>y(g({},r),{source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!Rl&&this.options.signDisplay!=null&&(e=y(g({},e),{signDisplay:this.options.signDisplay})),!ya&&this.options.style==="unit"&&(e=y(g({},e),{style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay})),e}constructor(e,t={}){this.numberFormatter=yT(e,t),this.options=t}};ET=new RegExp("^.*\\(.*\\).*$"),IT=["latn","arab","hanidec","deva","beng","fullwide"],Qg=class{parse(e){return kl(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,n){return kl(this.locale,this.options,e).isValidPartialNumber(e,t,n)}getNumberingSystem(e){return kl(this.locale,this.options,e).options.numberingSystem}constructor(e,t={}){this.locale=e,this.options=t}},Wg=new Map;PT=class{parse(e){let t=this.sanitize(e);if(this.symbols.group&&(t=Ui(t,this.symbols.group,"")),this.symbols.decimal&&(t=t.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(t=t.replace(this.symbols.minusSign,"-")),t=t.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let s=t.indexOf("-");t=t.replace("-",""),t=t.replace("+","");let a=t.indexOf(".");a===-1&&(a=t.length),t=t.replace(".",""),a-2===0?t=`0.${t}`:a-2===-1?t=`0.0${t}`:a-2===-2?t="0.00":t=`${t.slice(0,a-2)}.${t.slice(a-2)}`,s>-1&&(t=`-${t}`)}let n=t?+t:NaN;if(isNaN(n))return NaN;if(this.options.style==="percent"){var i,r;let s=y(g({},this.options),{style:"decimal",minimumFractionDigits:Math.min(((i=this.options.minimumFractionDigits)!==null&&i!==void 0?i:0)+2,20),maximumFractionDigits:Math.min(((r=this.options.maximumFractionDigits)!==null&&r!==void 0?r:0)+2,20)});return new Qg(this.locale,s).parse(new vT(this.locale,s).format(n))}return this.options.currencySign==="accounting"&&ET.test(e)&&(n=-1*n),n}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("\u060C",this.symbols.decimal)),this.symbols.group&&(e=Ui(e,".",this.symbols.group))),this.symbols.group==="\u2019"&&e.includes("'")&&(e=Ui(e,"'",this.symbols.group)),this.options.locale==="fr-FR"&&this.symbols.group&&(e=Ui(e," ",this.symbols.group),e=Ui(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,t=-1/0,n=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&n>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=Ui(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits==null&&(t.minimumFractionDigits=t.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=ST(e,this.formatter,this.options,t);var n,i;this.options.style==="percent"&&(((n=this.options.minimumFractionDigits)!==null&&n!==void 0?n:0)>18||((i=this.options.maximumFractionDigits)!==null&&i!==void 0?i:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}},zg=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),CT=[0,4,2,1,11,20,3,7,100,21,.1,1.1];TT=U("numberInput").parts("root","label","input","control","valueText","incrementTrigger","decrementTrigger","scrubber"),Vn=TT.build();wT=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`number-input:${e.id}`},Lr=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`number-input:${e.id}:input`},ep=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.incrementTrigger)!=null?n:`number-input:${e.id}:inc`},tp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.decrementTrigger)!=null?n:`number-input:${e.id}:dec`},VT=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.scrubber)!=null?n:`number-input:${e.id}:scrubber`},np=e=>`number-input:${e.id}:cursor`,xT=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`number-input:${e.id}:label`},ni=e=>e.getById(Lr(e)),AT=e=>e.getById(ep(e)),kT=e=>e.getById(tp(e)),ip=e=>e.getDoc().getElementById(np(e)),NT=(e,t)=>{let n=null;return t==="increment"&&(n=AT(e)),t==="decrement"&&(n=kT(e)),n},RT=(e,t)=>{if(!Xe())return MT(e,t),()=>{var n;(n=ip(e))==null||n.remove()}},DT=e=>{let t=e.getDoc(),n=t.documentElement,i=t.body;return i.style.pointerEvents="none",n.style.userSelect="none",n.style.cursor="ew-resize",()=>{i.style.pointerEvents="",n.style.userSelect="",n.style.cursor="",n.style.length||n.removeAttribute("style"),i.style.length||i.removeAttribute("style")}},LT=(e,t)=>{let{point:n,isRtl:i,event:r}=t,s=e.getWin(),a=Ci(r.movementX,s.devicePixelRatio),o=Ci(r.movementY,s.devicePixelRatio),l=a>0?"increment":a<0?"decrement":null;i&&l==="increment"&&(l="decrement"),i&&l==="decrement"&&(l="increment");let c={x:n.x+a,y:n.y+o},u=s.innerWidth,h=Ci(7.5,s.devicePixelRatio);return c.x=Zc(c.x+h,u)-h,{hint:l,point:c}},MT=(e,t)=>{let n=e.getDoc(),i=n.createElement("div");i.className="scrubber--cursor",i.id=np(e),Object.assign(i.style,{width:"15px",height:"15px",position:"fixed",pointerEvents:"none",left:"0px",top:"0px",zIndex:ss,transform:t?`translate3d(${t.x}px, ${t.y}px, 0px)`:void 0,willChange:"transform"}),i.innerHTML=` +`+new s.XMLSerializer().serializeToString(l),h="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(u);if(n==="image/svg+xml")return Promise.resolve(h).then(I=>(l.remove(),I));let m=s.devicePixelRatio||1,d=a.createElement("canvas"),p=new s.Image;p.src=h,d.width=o.width*m,d.height=o.height*m;let v=d.getContext("2d");return(n==="image/jpeg"||r)&&(v.fillStyle=r||"white",v.fillRect(0,0,d.width,d.height)),new Promise(I=>{p.onload=()=>{v==null||v.drawImage(p,0,0,d.width,d.height),I(d.toDataURL(n,i)),l.remove()}})}function um(){var t;let e=navigator.userAgentData;return(t=e==null?void 0:e.platform)!=null?t:navigator.platform}function dm(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Oc(e){let{selectionStart:t,selectionEnd:n,value:i}=e.currentTarget,r=e.data;return i.slice(0,t)+(r!=null?r:"")+i.slice(n)}function vm(e){var t,n,i,r;return(r=(t=e.composedPath)==null?void 0:t.call(e))!=null?r:(i=(n=e.nativeEvent)==null?void 0:n.composedPath)==null?void 0:i.call(n)}function j(e){var n;let t=vm(e);return(n=t==null?void 0:t[0])!=null?n:e.target}function Fn(e){let t=e.currentTarget;if(!t||!t.matches("a[href], button[type='submit'], input[type='submit']"))return!1;let i=e.button===1,r=ls(e);return i||r}function rr(e){let t=e.currentTarget;if(!t)return!1;let n=t.localName;return e.altKey?n==="a"||n==="button"&&t.type==="submit"||n==="input"&&t.type==="submit":!1}function Re(e){return Yt(e).isComposing||e.keyCode===229}function ls(e){return di()?e.metaKey:e.ctrlKey}function wc(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function Vc(e){return e.pointerType===""&&e.isTrusted?!0:mm()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function ge(e,t={}){var a;let{dir:n="ltr",orientation:i="horizontal"}=t,r=e.key;return r=(a=bm[r])!=null?a:r,n==="rtl"&&i==="horizontal"&&r in oc&&(r=oc[r]),r}function Yt(e){var t;return(t=e.nativeEvent)!=null?t:e}function gi(e){return e.ctrlKey||e.metaKey?.1:Em.has(e.key)||e.shiftKey&&Im.has(e.key)?10:1}function je(e,t="client"){let n=ym(e)?e.touches[0]||e.changedTouches[0]:e;return{x:n[`${t}X`],y:n[`${t}Y`]}}function xc(e,t){var s;let{type:n="HTMLInputElement",property:i="value"}=t,r=ue(e)[n].prototype;return(s=Object.getOwnPropertyDescriptor(r,i))!=null?s:{}}function Pm(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function Me(e,t,n="value"){var r;if(!e)return;let i=Pm(e);i&&((r=xc(e,{type:i,property:n}).set)==null||r.call(e,t)),e.setAttribute(n,t)}function sr(e,t){var i;if(!e)return;(i=xc(e,{type:"HTMLInputElement",property:"checked"}).set)==null||i.call(e,t),t?e.setAttribute("checked",""):e.removeAttribute("checked")}function Ac(e,t){let{value:n,bubbles:i=!0}=t;if(!e)return;let r=ue(e);e instanceof r.HTMLInputElement&&(Me(e,`${n}`),e.dispatchEvent(new r.Event("input",{bubbles:i})))}function pi(e,t){let{checked:n,bubbles:i=!0}=t;if(!e)return;let r=ue(e);e instanceof r.HTMLInputElement&&(sr(e,n),e.dispatchEvent(new r.Event("click",{bubbles:i})))}function Cm(e){return Sm(e)?e.form:e.closest("form")}function Sm(e){return e.matches("textarea, input, select, button")}function Tm(e,t){if(!e)return;let n=Cm(e),i=r=>{r.defaultPrevented||t()};return n==null||n.addEventListener("reset",i,{passive:!0}),()=>n==null?void 0:n.removeEventListener("reset",i)}function Om(e,t){let n=e==null?void 0:e.closest("fieldset");if(!n)return;t(n.disabled);let i=ue(n),r=new i.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function wt(e,t){if(!e)return;let{onFieldsetDisabledChange:n,onFormReset:i}=t,r=[Tm(e,i),Om(e,n)];return()=>r.forEach(s=>s==null?void 0:s())}function Nc(e){let t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}function Am(e,t){if(!t)return null;if(t===!0)return e.shadowRoot||null;let n=t(e);return(n===!0?e.shadowRoot:n)||null}function Rc(e,t,n){let i=[...e],r=[...e],s=new Set,a=new Map;e.forEach((l,c)=>a.set(l,c));let o=0;for(;o{a.set(d,m+p)});for(let d=m+u.length;d{a.set(d,m+p)})}r.push(...u)}}return i}function Ye(e){return!le(e)||e.closest("[inert]")?!1:e.matches(cs)&&im(e)}function jt(e,t={}){if(!e)return[];let{includeContainer:n,getShadowRoot:i}=t,r=Array.from(e.querySelectorAll(cs));n&&dn(e)&&r.unshift(e);let s=[];for(let a of r)if(dn(a)){if(kc(a)&&a.contentDocument){let o=a.contentDocument.body;s.push(...jt(o,{getShadowRoot:i}));continue}s.push(a)}if(i){let a=Rc(s,i,dn);return!a.length&&n?r:a}return!s.length&&n?r:s}function dn(e){return le(e)&&e.tabIndex>0?!0:Ye(e)&&!xm(e)}function km(e,t={}){let n=jt(e,t),i=n[0]||null,r=n[n.length-1]||null;return[i,r]}function fi(e){return e.tabIndex<0&&(wm.test(e.localName)||Ot(e))&&!Vm(e)?0:e.tabIndex}function us(e){let{root:t,getInitialEl:n,filter:i,enabled:r=!0}=e;if(!r)return;let s=null;if(s||(s=typeof n=="function"?n():n),s||(s=t==null?void 0:t.querySelector("[data-autofocus],[autofocus]")),!s){let a=jt(t);s=i?a.filter(i)[0]:a[0]}return s||t||void 0}function ds(e){let t=e.currentTarget;if(!t)return!1;let[n,i]=km(t);return!(es(n)&&e.shiftKey||es(i)&&!e.shiftKey||!n&&!i)}function H(e){let t=eo.create();return t.request(e),t.cleanup}function $n(e){let t=new Set;function n(i){let r=globalThis.requestAnimationFrame(i);t.add(()=>globalThis.cancelAnimationFrame(r))}return n(()=>n(e)),function(){t.forEach(r=>r())}}function Nm(e,t,n){let i=H(()=>{e.removeEventListener(t,r,!0),n()}),r=()=>{i(),n()};return e.addEventListener(t,r,{once:!0,capture:!0}),i}function Rm(e,t){if(!e)return;let{attributes:n,callback:i}=t,r=e.ownerDocument.defaultView||window,s=new r.MutationObserver(a=>{for(let o of a)o.type==="attributes"&&o.attributeName&&n.includes(o.attributeName)&&i(o)});return s.observe(e,{attributes:!0,attributeFilter:n}),()=>s.disconnect()}function ot(e,t){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=typeof e=="function"?e():e;r.push(Rm(s,t))})),()=>{r.forEach(s=>s==null?void 0:s())}}function Dm(e,t){let{callback:n}=t;if(!e)return;let i=e.ownerDocument.defaultView||window,r=new i.MutationObserver(n);return r.observe(e,{childList:!0,subtree:!0}),()=>r.disconnect()}function hs(e,t){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=typeof e=="function"?e():e;r.push(Dm(s,t))})),()=>{r.forEach(s=>s==null?void 0:s())}}function mi(e){let t=()=>{let n=ue(e);e.dispatchEvent(new n.MouseEvent("click"))};fm()?Nm(e,"keyup",t):queueMicrotask(t)}function gs(e){let t=am(e);return em(t)?Le(t).body:le(t)&&Lc(t)?t:gs(t)}function Lc(e){let t=ue(e),{overflow:n,overflowX:i,overflowY:r,display:s}=t.getComputedStyle(e);return Lm.test(n+r+i)&&!Mm.has(s)}function Fm(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}function Xt(e,t){let r=t||{},{rootEl:n}=r,i=ft(r,["rootEl"]);!e||!n||!Lc(n)||!Fm(n)||e.scrollIntoView(i)}function to(e,t){let{left:n,top:i,width:r,height:s}=t.getBoundingClientRect(),a={x:e.x-n,y:e.y-i},o={x:ac(a.x/r),y:ac(a.y/s)};function l(c={}){let{dir:u="ltr",orientation:h="horizontal",inverted:m}=c,d=typeof m=="object"?m.x:m,p=typeof m=="object"?m.y:m;return h==="horizontal"?u==="rtl"||d?1-o.x:o.x:p?1-o.y:o.y}return{offset:a,percent:o,getPercentValue:l}}function Mc(e,t){let n=e.body,i="pointerLockElement"in e||"mozPointerLockElement"in e,r=()=>!!e.pointerLockElement;function s(){t==null||t(r())}function a(l){r()&&(t==null||t(!1)),console.error("PointerLock error occurred:",l),e.exitPointerLock()}if(!i)return;try{n.requestPointerLock()}catch(l){}let o=[ee(e,"pointerlockchange",s,!1),ee(e,"pointerlockerror",a,!1)];return()=>{o.forEach(l=>l()),e.exitPointerLock()}}function $m(e={}){let{target:t,doc:n}=e,i=n!=null?n:document,r=i.documentElement;return ir()?(ci==="default"&&(qa=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),ci="disabled"):t&&(Xr.set(t,t.style.userSelect),t.style.userSelect="none"),()=>no({target:t,doc:i})}function no(e={}){let{target:t,doc:n}=e,r=(n!=null?n:document).documentElement;if(ir()){if(ci!=="disabled")return;ci="restoring",setTimeout(()=>{$n(()=>{ci==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=qa||""),qa="",ci="default")})},300)}else if(t&&Xr.has(t)){let s=Xr.get(t);t.style.userSelect==="none"&&(t.style.userSelect=s!=null?s:""),t.getAttribute("style")===""&&t.removeAttribute("style"),Xr.delete(t)}}function io(e={}){let a=e,{defer:t,target:n}=a,i=ft(a,["defer","target"]),r=t?H:o=>o(),s=[];return s.push(r(()=>{let o=typeof n=="function"?n():n;s.push($m(y(g({},i),{target:o})))})),()=>{s.forEach(o=>o==null?void 0:o())}}function hn(e,t){let{onPointerMove:n,onPointerUp:i}=t,r=o=>{let l=je(o),c=Math.sqrt(l.x**2+l.y**2),u=o.pointerType==="touch"?10:5;if(!(c{let l=je(o);i({point:l,event:o})},a=[ee(e,"pointermove",r,!1),ee(e,"pointerup",s,!1),ee(e,"pointercancel",s,!1),ee(e,"contextmenu",s,!1),io({doc:e})];return()=>{a.forEach(o=>o())}}function ps(e){let{pointerNode:t,keyboardNode:n=t,onPress:i,onPressStart:r,onPressEnd:s,isValidKey:a=O=>O.key==="Enter"}=e;if(!t)return qt;let o=ue(t),l=qt,c=qt,u=qt,h=O=>({point:je(O),event:O});function m(O){r==null||r(h(O))}function d(O){s==null||s(h(O))}let v=ee(t,"pointerdown",O=>{c();let f=ee(o,"pointerup",P=>{let V=j(P);ce(t,V)?i==null||i(h(P)):s==null||s(h(P))},{passive:!i,once:!0}),S=ee(o,"pointercancel",d,{passive:!s,once:!0});c=_a(f,S),es(n)&&O.pointerType==="mouse"&&O.preventDefault(),m(O)},{passive:!r}),I=ee(n,"focus",T);l=_a(v,I);function T(){let O=P=>{if(!a(P))return;let V=x=>{if(!a(x))return;let k=new o.PointerEvent("pointerup"),N=h(k);i==null||i(N),s==null||s(N)};c(),c=ee(n,"keyup",V);let A=new o.PointerEvent("pointerdown");m(A)},b=()=>{let P=new o.PointerEvent("pointercancel");d(P)},f=ee(n,"keydown",O),S=ee(n,"blur",b);u=_a(f,S)}return()=>{l(),c(),u()}}function Fe(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function vi(e,t){var n;return(n=e==null?void 0:e.querySelector(t))!=null?n:null}function so(e,t,n=ro){return e.find(i=>n(i)===t)}function ao(e,t,n=ro){let i=so(e,t,n);return i?e.indexOf(i):-1}function yi(e,t,n=!0){let i=ao(e,t);return i=n?(i+1)%e.length:Math.min(i+1,e.length-1),e[i]}function bi(e,t,n=!0){let i=ao(e,t);return i===-1?n?e[e.length-1]:null:(i=n?(i-1+e.length)%e.length:Math.max(0,i-1),e[i])}function Hm(e){let t=new WeakMap,n,i=new WeakMap,r=o=>n||(n=new o.ResizeObserver(l=>{for(let c of l){i.set(c.target,c);let u=t.get(c.target);if(u)for(let h of u)h(c)}}),n);return{observe:(o,l)=>{let c=t.get(o)||new Set;c.add(l),t.set(o,c);let u=ue(o);return r(u).observe(o,e),()=>{let h=t.get(o);h&&(h.delete(l),h.size===0&&(t.delete(o),r(u).unobserve(o)))}},unobserve:o=>{t.delete(o),n==null||n.unobserve(o)}}}function Um(e,t,n,i=ro){let r=n?ao(e,n,i):-1,s=n?jf(e,r):e;return t.length===1&&(s=s.filter(o=>i(o)!==n)),s.find(o=>Gm(_m(o),t))}function Fc(e,t,n){let i=e.getAttribute(t),r=i!=null;return i===n?qt:(e.setAttribute(t,n),()=>{r?e.setAttribute(t,i):e.removeAttribute(t)})}function Hn(e,t){if(!e)return qt;let n=Object.keys(t).reduce((i,r)=>(i[r]=e.style.getPropertyValue(r),i),{});return qm(n,t)?qt:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function $c(e,t,n){if(!e)return qt;let i=e.style.getPropertyValue(t);return i===n?qt:(e.style.setProperty(t,n),()=>{e.style.setProperty(t,i),e.style.length===0&&e.removeAttribute("style")})}function qm(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function Wm(e,t){let{state:n,activeId:i,key:r,timeout:s=350,itemToId:a}=t,o=n.keysSoFar+r,c=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,u=e.slice(),h=Um(u,c,i,a);function m(){clearTimeout(n.timer),n.timer=-1}function d(p){n.keysSoFar=p,m(),p!==""&&(n.timer=+setTimeout(()=>{d(""),m()},s))}return d(o),h}function Km(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function zm(e,t,n){let{signal:i}=t;return[new Promise((a,o)=>{let l=setTimeout(()=>{o(new Error(`Timeout of ${n}ms exceeded`))},n);i.addEventListener("abort",()=>{clearTimeout(l),o(new Error("Promise aborted"))}),e.then(c=>{i.aborted||(clearTimeout(l),a(c))}).catch(c=>{i.aborted||(clearTimeout(l),o(c))})}),()=>t.abort()]}function Hc(e,t){let{timeout:n,rootNode:i}=t,r=ue(i),s=Le(i),a=new r.AbortController;return zm(new Promise(o=>{let l=e();if(l){o(l);return}let c=new r.MutationObserver(()=>{let u=e();u&&u.isConnected&&(c.disconnect(),o(u))});c.observe(s.body,{childList:!0,subtree:!0})}),a,n)}function or(e){return e==null?[]:Array.isArray(e)?e:[e]}function Ei(e,t,n={}){let{step:i=1,loop:r=!0}=n,s=t+i,a=e.length,o=a-1;return t===-1?i>0?0:o:s<0?r?o:0:s>=a?r?0:t>a?a:t:s}function _c(e,t,n={}){return e[Ei(e,t,n)]}function lr(e,t,n={}){let{step:i=1,loop:r=!0}=n;return Ei(e,t,{step:-i,loop:r})}function Gc(e,t,n={}){return e[lr(e,t,n)]}function cr(e,t){return e.reduce((n,i,r)=>{var s;return r%t===0?n.push([i]):(s=mt(n))==null||s.push(i),n},[])}function oo(e,t){return e.reduce(([n,i],r)=>(t(r)?n.push(r):i.push(r),[n,i]),[[],[]])}function Ce(e,t,...n){var r;if(e in t){let s=t[e];return Wt(s)?s(...n):s}let i=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw(r=Error.captureStackTrace)==null||r.call(Error,i,Ce),i}function Yc(e,t=0){let n=0,i=null;return(...r)=>{let s=Date.now(),a=s-n;a>=t?(i&&(clearTimeout(i),i=null),e(...r),n=s):i||(i=setTimeout(()=>{e(...r),n=Date.now(),i=null},t-a))}}function Si(e){if(!Qi(e)||e===void 0)return e;let t=Reflect.ownKeys(e).filter(i=>typeof i=="string"),n={};for(let i of t){let r=e[i];r!==void 0&&(n[i]=Si(r))}return n}function fn(e,t){let n={};for(let i of t){let r=e[i];r!==void 0&&(n[i]=r)}return n}function uv(e,t){let n={},i={},r=new Set(t),s=Reflect.ownKeys(e);for(let a of s)r.has(a)?i[a]=e[a]:n[a]=e[a];return[i,n]}function su(e,t){let n=new ru(({now:i,deltaMs:r})=>{if(r>=t){let s=t>0?i-r%t:i;n.setStartMs(s),e({startMs:s,deltaMs:r})}});return n.start(),()=>n.stop()}function mn(e,t){let n=new ru(({deltaMs:i})=>{if(i>=t)return e(),!1});return n.start(),()=>n.stop()}function zt(...e){let t=e.length===1?e[0]:e[1];(e.length===2?e[0]:!0)&&console.warn(t)}function vs(...e){let t=e.length===1?e[0]:e[1];if(e.length===2?e[0]:!0)throw new Error(t)}function vn(e,t){if(e==null)throw new Error(t())}function yn(e,t,n){let i=[];for(let r of t)e[r]==null&&i.push(r);if(i.length>0)throw new Error(`[zag-js${n?` > ${n}`:""}] missing required props: ${i.join(", ")}`)}function au(...e){let t={};for(let n of e){if(!n)continue;for(let r in t){if(r.startsWith("on")&&typeof t[r]=="function"&&typeof n[r]=="function"){t[r]=At(n[r],t[r]);continue}if(r==="className"||r==="class"){t[r]=dv(t[r],n[r]);continue}if(r==="style"){t[r]=gv(t[r],n[r]);continue}t[r]=n[r]!==void 0?n[r]:t[r]}for(let r in n)t[r]===void 0&&(t[r]=n[r]);let i=Object.getOwnPropertySymbols(n);for(let r of i)t[r]=n[r]}return t}function Bn(e,t,n){let i=[],r;return s=>{var l;let a=e(s);return(a.length!==i.length||a.some((c,u)=>!fe(i[u],c)))&&(i=a,r=t(a,s),(l=n==null?void 0:n.onChange)==null||l.call(n,r)),r}}function Ee(){return{and:(...e)=>function(n){return e.every(i=>n.guard(i))},or:(...e)=>function(n){return e.some(i=>n.guard(i))},not:e=>function(n){return!n.guard(e)}}}function ut(){return{guards:Ee(),createMachine:e=>e,choose:e=>function({choose:n}){var i;return(i=n(e))==null?void 0:i.actions}}}function pv(e){let t=()=>{var a,o;return(o=(a=e.getRootNode)==null?void 0:a.call(e))!=null?o:document},n=()=>Le(t()),i=()=>{var a;return(a=n().defaultView)!=null?a:window},r=()=>ui(t()),s=a=>t().getElementById(a);return y(g({},e),{getRootNode:t,getDoc:n,getWin:i,getActiveElement:r,isActiveElement:es,getById:s})}function fv(e){return new Proxy({},{get(t,n){return n==="style"?i=>e({style:i}).style:e}})}function bv(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global}function ou(e,t){let n=bv();return n?(n[e]||(n[e]=t()),n[e]):t()}function ys(e={}){return Tv(e)}function ns(e,t,n){let i=Dn.get(e);ts()&&!i&&console.warn("Please use proxy object");let r,s=[],a=i[3],o=!1,c=a(u=>{if(s.push(u),n){t(s.splice(0));return}r||(r=Promise.resolve().then(()=>{r=void 0,o&&t(s.splice(0))}))});return o=!0,()=>{o=!1,c()}}function Ov(e){let t=Dn.get(e);ts()&&!t&&console.warn("Please use proxy object");let[n,i,r]=t;return r(n,i())}function Rv(e,t,n){let i=n||"default",r=Yr.get(e);r||(r=new Map,Yr.set(e,r));let s=r.get(i)||{},a=Object.keys(t),o=(v,I)=>{e.addEventListener(v.toLowerCase(),I)},l=(v,I)=>{e.removeEventListener(v.toLowerCase(),I)},c=v=>v.startsWith("on"),u=v=>!v.startsWith("on"),h=v=>o(v.substring(2),t[v]),m=v=>l(v.substring(2),t[v]),d=v=>{let I=t[v],T=s[v];if(I!==T){if(v==="class"){e.className=I!=null?I:"";return}if(yc.has(v)){e[v]=I!=null?I:"";return}if(typeof I=="boolean"&&!v.includes("aria-")){e.toggleAttribute(jr(e,v),I);return}if(v==="children"){e.innerHTML=I;return}if(I!=null){e.setAttribute(jr(e,v),I);return}e.removeAttribute(jr(e,v))}};for(let v in s)t[v]==null&&(v==="class"?e.className="":yc.has(v)?e[v]="":e.removeAttribute(jr(e,v)));return Object.keys(s).filter(c).forEach(v=>{l(v.substring(2),s[v])}),a.filter(c).forEach(h),a.filter(u).forEach(d),r.set(i,t),function(){a.filter(c).forEach(m);let I=Yr.get(e);I&&(I.delete(i),I.size===0&&Yr.delete(e))}}function is(e){var s,a;let t=(s=e().value)!=null?s:e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);let n=(a=e().isEqual)!=null?a:Object.is,i=ys({value:t}),r=()=>e().value!==void 0;return{initial:t,ref:i,get(){return r()?e().value:i.value},set(o){var u,h;let l=i.value,c=Wt(o)?o(l):o;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:c,prev:l}),r()||(i.value=c),n(c,l)||(h=(u=e()).onChange)==null||h.call(u,c,l)},invoke(o,l){var c,u;(u=(c=e()).onChange)==null||u.call(c,o,l)},hash(o){var l,c,u;return(u=(c=(l=e()).hash)==null?void 0:c.call(l,o))!=null?u:String(o)}}}function Dv(e){let t={current:e};return{get(n){return t.current[n]},set(n,i){t.current[n]=i}}}function lu(e,t){if(!Qi(e)||!Qi(t))return t===void 0?e:t;let n=g({},e);for(let i of Object.keys(t)){let r=t[i],s=e[i];r!==void 0&&(Qi(s)&&Qi(r)?n[i]=lu(s,r):n[i]=r)}return n}var Wf,w,Q,Y,C,Mn,U,li,Kf,zf,Yf,Ba,ac,jf,_a,qt,rs,ss,E,X,Xf,Zf,Jf,le,nr,Qf,bc,tm,Ln,nm,st,im,rm,Ga,ja,om,Ec,os,Za,Tc,hm,Ja,gm,pm,ir,Qa,di,Xe,fm,mm,pe,hi,xe,ym,bm,oc,Em,Im,ee,kc,wm,Vm,xm,cs,ar,eo,Lm,Mm,ci,qa,Xr,ro,gn,Bm,_m,Gm,Ue,Vt,Ym,Bc,jm,un,Xm,lc,Zm,lt,mt,Jm,Ze,ct,vt,fs,yt,cc,Qm,fe,pn,Uc,qc,xt,Zr,Wt,Wc,$e,ev,Kc,tv,Qi,nv,iv,rv,Kt,lo,sv,zc,At,ur,jc,uc,Xc,av,ov,lv,cv,Wa,Ii,Zc,Jc,Qc,Pi,He,dc,Ci,eu,ms,hc,tu,nu,iu,ye,B,zr,Jr,ru,dv,hv,gc,gv,er,Ua,_,n0,mv,pc,Ka,vv,yv,fc,Qr,Ev,Iv,Pv,Cv,za,mc,ts,Dn,Sv,Tv,wv,Vv,oe,vc,xv,Av,q,Yr,yc,kv,Nv,jr,W,K,se=re(()=>{"use strict";Wf=["ltr","rtl"];w=(e,t,n)=>{let i=e.dataset[t];if(i!==void 0&&(!n||n.includes(i)))return i},Q=(e,t)=>{let n=e.dataset[t];if(typeof n=="string")return n.split(",").map(i=>i.trim()).filter(i=>i.length>0)},Y=(e,t,n)=>{let i=e.dataset[t];if(i===void 0)return;let r=Number(i);if(!Number.isNaN(r))return n&&!n.includes(r)?0:r},C=(e,t)=>{let n=t.replace(/([A-Z])/g,"-$1").toLowerCase();return e.hasAttribute(`data-${n}`)},Mn=(e,t="element")=>e!=null&&e.id?e.id:`${t}-${Math.random().toString(36).substring(2,9)}`,U=(e,t=[])=>({parts:(...n)=>{if(Kf(t))return U(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>U(e,[...t,...n]),omit:(...n)=>U(e,t.filter(i=>!n.includes(i))),rename:n=>U(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,i)=>Object.assign(n,{[i]:{selector:[`&[data-scope="${li(e)}"][data-part="${li(i)}"]`,`& [data-scope="${li(e)}"][data-part="${li(i)}"]`].join(", "),attrs:{"data-scope":li(e),"data-part":li(i)}}}),{})}),li=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Kf=e=>e.length===0,zf=Object.defineProperty,Yf=(e,t,n)=>t in e?zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ba=(e,t,n)=>Yf(e,typeof t!="symbol"?t+"":t,n);ac=e=>Math.max(0,Math.min(1,e)),jf=(e,t)=>e.map((n,i)=>e[(Math.max(t,0)+i)%e.length]),_a=(...e)=>t=>e.reduce((n,i)=>i(n),t),qt=()=>{},rs=e=>typeof e=="object"&&e!==null,ss=2147483647,E=e=>e?"":void 0,X=e=>e?"true":void 0,Xf=1,Zf=9,Jf=11,le=e=>rs(e)&&e.nodeType===Xf&&typeof e.nodeName=="string",nr=e=>rs(e)&&e.nodeType===Zf,Qf=e=>rs(e)&&e===e.window,bc=e=>le(e)?e.localName||"":"#document";tm=e=>rs(e)&&e.nodeType!==void 0,Ln=e=>tm(e)&&e.nodeType===Jf&&"host"in e,nm=e=>le(e)&&e.localName==="input",st=e=>!!(e!=null&&e.matches("a[href]")),im=e=>le(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;rm=/(textarea|select)/;Ga=new WeakMap;ja=new Set(["menu","listbox","dialog","grid","tree","region"]),om=e=>ja.has(e),Ec=e=>{var t;return((t=e.getAttribute("aria-controls"))==null?void 0:t.split(" "))||[]};os=()=>typeof document!="undefined";Za=e=>os()&&e.test(um()),Tc=e=>os()&&e.test(dm()),hm=e=>os()&&e.test(navigator.vendor),Ja=()=>os()&&!!navigator.maxTouchPoints,gm=()=>Za(/^iPhone/i),pm=()=>Za(/^iPad/i)||di()&&navigator.maxTouchPoints>1,ir=()=>gm()||pm(),Qa=()=>di()||ir(),di=()=>Za(/^Mac/i),Xe=()=>Qa()&&hm(/apple/i),fm=()=>Tc(/Firefox/i),mm=()=>Tc(/Android/i);pe=e=>e.button===0,hi=e=>e.button===2||di()&&e.ctrlKey&&e.button===0,xe=e=>e.ctrlKey||e.altKey||e.metaKey,ym=e=>"touches"in e&&e.touches.length>0,bm={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},oc={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};Em=new Set(["PageUp","PageDown"]),Im=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);ee=(e,t,n,i)=>{let r=typeof e=="function"?e():e;return r==null||r.addEventListener(t,n,i),()=>{r==null||r.removeEventListener(t,n,i)}};kc=e=>le(e)&&e.tagName==="IFRAME",wm=/^(audio|video|details)$/;Vm=e=>!Number.isNaN(Nc(e)),xm=e=>Nc(e)<0;cs="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",ar=(e,t={})=>{if(!e)return[];let{includeContainer:n=!1,getShadowRoot:i}=t,r=Array.from(e.querySelectorAll(cs));(n==!0||n=="if-empty"&&r.length===0)&&le(e)&&Ye(e)&&r.unshift(e);let a=[];for(let o of r)if(Ye(o)){if(kc(o)&&o.contentDocument){let l=o.contentDocument.body;a.push(...ar(l,{getShadowRoot:i}));continue}a.push(o)}return i?Rc(a,i,Ye):a};eo=class Dc{constructor(){Ba(this,"id",null),Ba(this,"fn_cleanup"),Ba(this,"cleanup",()=>{this.cancel()})}static create(){return new Dc}request(t){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=t==null?void 0:t()})}cancel(){var t;this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),(t=this.fn_cleanup)==null||t.call(this),this.fn_cleanup=void 0}isActive(){return this.id!==null}};Lm=/auto|scroll|overlay|hidden|clip/,Mm=new Set(["inline","contents"]);ci="default",qa="",Xr=new WeakMap;ro=e=>e.id;gn=Hm({box:"border-box"}),Bm=e=>e.split("").map(t=>{let n=t.charCodeAt(0);return n>0&&n<128?t:n>=128&&n<=255?`/x${n.toString(16)}`.replace("/","\\"):""}).join("").trim(),_m=e=>{var t,n,i;return Bm((i=(n=(t=e.dataset)==null?void 0:t.valuetext)!=null?n:e.textContent)!=null?i:"")},Gm=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase());Ue=Object.assign(Wm,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:Km});Vt={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};Ym=Object.defineProperty,Bc=e=>{throw TypeError(e)},jm=(e,t,n)=>t in e?Ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,un=(e,t,n)=>jm(e,typeof t!="symbol"?t+"":t,n),Xm=(e,t,n)=>t.has(e)||Bc("Cannot "+n),lc=(e,t,n)=>(Xm(e,t,"read from private field"),t.get(e)),Zm=(e,t,n)=>t.has(e)?Bc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);lt=e=>e[0],mt=e=>e[e.length-1],Jm=(e,t)=>e.indexOf(t)!==-1,Ze=(e,...t)=>e.concat(t),ct=(e,...t)=>e.filter(n=>!t.includes(n)),vt=e=>Array.from(new Set(e)),fs=(e,t)=>{let n=new Set(t);return e.filter(i=>!n.has(i))},yt=(e,t)=>Jm(e,t)?ct(e,t):Ze(e,t);cc=e=>(e==null?void 0:e.constructor.name)==="Array",Qm=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof(e==null?void 0:e.isEqual)=="function"&&typeof(t==null?void 0:t.isEqual)=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(cc(e)&&cc(t))return Qm(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;let n=Object.keys(t!=null?t:Object.create(null)),i=n.length;for(let r=0;rArray.isArray(e),Uc=e=>e===!0||e===!1,qc=e=>e!=null&&typeof e=="object",xt=e=>qc(e)&&!pn(e),Zr=e=>typeof e=="string",Wt=e=>typeof e=="function",Wc=e=>e==null,$e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ev=e=>Object.prototype.toString.call(e),Kc=Function.prototype.toString,tv=Kc.call(Object),Qi=e=>{if(!qc(e)||ev(e)!="[object Object]"||rv(e))return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=$e(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Kc.call(n)==tv},nv=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,iv=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,rv=e=>nv(e)||iv(e),Kt=(e,...t)=>{let n=typeof e=="function"?e(...t):e;return n!=null?n:void 0},lo=e=>e,sv=e=>e(),zc=()=>{},At=(...e)=>(...t)=>{e.forEach(function(n){n==null||n(...t)})},ur=(()=>{let e=0;return()=>(e++,e.toString(36))})();({floor:jc,abs:uc,round:Xc,min:av,max:ov,pow:lv,sign:cv}=Math),Wa=e=>Number.isNaN(e),Ii=e=>Wa(e)?0:e,Zc=(e,t)=>(e%t+t)%t,Jc=(e,t)=>Ii(e)>=t,Qc=(e,t)=>Ii(e)<=t,Pi=(e,t,n)=>{let i=Ii(e),r=t==null||i>=t,s=n==null||i<=n;return r&&s},He=(e,t,n)=>av(ov(Ii(e),t),n),dc=(e,t)=>{let n=e,i=t.toString(),r=i.indexOf("."),s=r>=0?i.length-r:0;if(s>0){let a=lv(10,s);n=Xc(n*a)/a}return n},Ci=(e,t)=>typeof t=="number"?jc(e*t+.5)/t:Xc(e),eu=(e,t,n,i)=>{let r=t!=null?Number(t):0,s=Number(n),a=(e-r)%i,o=uc(a)*2>=i?e+cv(a)*(i-uc(a)):e-a;if(o=dc(o,i),!Wa(r)&&os){let l=jc((s-r)/i),c=r+l*i;o=l<=0||ce[t]===n?e:[...e.slice(0,t),n,...e.slice(t+1)],hc=e=>{if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n},tu=(e,t,n)=>{let i=t==="+"?e+n:e-n;if(e%1!==0||n%1!==0){let r=10**Math.max(hc(e),hc(n));e=Math.round(e*r),n=Math.round(n*r),i=t==="+"?e+n:e-n,i/=r}return i},nu=(e,t)=>tu(Ii(e),"+",t),iu=(e,t)=>tu(Ii(e),"-",t),ye=e=>typeof e=="number"?`${e}px`:e;B=e=>function(n){return uv(n,e)},zr=()=>performance.now(),ru=class{constructor(e){this.onTick=e,un(this,"frameId",null),un(this,"pausedAtMs",null),un(this,"context"),un(this,"cancelFrame",()=>{this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}),un(this,"setStartMs",t=>{this.context.startMs=t}),un(this,"start",()=>{if(this.frameId!==null)return;let t=zr();this.pausedAtMs!==null?(this.context.startMs+=t-this.pausedAtMs,this.pausedAtMs=null):this.context.startMs=t,this.frameId=requestAnimationFrame(lc(this,Jr))}),un(this,"pause",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=zr())}),un(this,"stop",()=>{this.frameId!==null&&(this.cancelFrame(),this.pausedAtMs=null)}),Zm(this,Jr,t=>{if(this.context.now=t,this.context.deltaMs=t-this.context.startMs,this.onTick(this.context)===!1){this.stop();return}this.frameId=requestAnimationFrame(lc(this,Jr))}),this.context={now:0,startMs:zr(),deltaMs:0}}get elapsedMs(){return this.pausedAtMs!==null?this.pausedAtMs-this.context.startMs:zr()-this.context.startMs}};Jr=new WeakMap;dv=(...e)=>e.map(t=>{var n;return(n=t==null?void 0:t.trim)==null?void 0:n.call(t)}).filter(Boolean).join(" "),hv=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,gc=e=>{let t={},n;for(;n=hv.exec(e);)t[n[1]]=n[2];return t},gv=(e,t)=>{if(Zr(e)){if(Zr(t))return`${e};${t}`;e=gc(e)}else Zr(t)&&(t=gc(t));return Object.assign({},e!=null?e:{},t!=null?t:{})};er=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(er||{}),Ua="__init__";_=()=>e=>Array.from(new Set(e)),n0=Symbol(),mv=Symbol(),pc=Object.getPrototypeOf,Ka=new WeakMap,vv=e=>e&&(Ka.has(e)?Ka.get(e):pc(e)===Object.prototype||pc(e)===Array.prototype),yv=e=>vv(e)&&e[mv]||null,fc=(e,t=!0)=>{Ka.set(e,t)};Qr=ou("__zag__refSet",()=>new WeakSet),Ev=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Iv=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Pv=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",Cv=e=>Ev(e)||Iv(e)||Pv(e),za=e=>e!==null&&typeof e=="object",mc=e=>za(e)&&!Qr.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!Cv(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise)&&!(e instanceof File)&&!(e instanceof Blob)&&!(e instanceof AbortController),ts=()=>!0,Dn=ou("__zag__proxyStateMap",()=>new WeakMap),Sv=(e=Object.is,t=(o,l)=>new Proxy(o,l),n=new WeakMap,i=(o,l)=>{let c=n.get(o);if((c==null?void 0:c[0])===l)return c[1];let u=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return fc(u,!0),n.set(o,[l,u]),Reflect.ownKeys(o).forEach(h=>{let m=Reflect.get(o,h);Qr.has(m)?(fc(m,!1),u[h]=m):Dn.has(m)?u[h]=Ov(m):u[h]=m}),Object.freeze(u)},r=new WeakMap,s=[1,1],a=o=>{if(!za(o))throw new Error("object required");let l=r.get(o);if(l)return l;let c=s[0],u=new Set,h=(V,A=++s[0])=>{c!==A&&(c=A,u.forEach(x=>x(V,A)))},m=s[1],d=(V=++s[1])=>(m!==V&&!u.size&&(m=V,v.forEach(([A])=>{let x=A[1](V);x>c&&(c=x)})),c),p=V=>(A,x)=>{let k=[...A];k[1]=[V,...k[1]],h(k,x)},v=new Map,I=(V,A)=>{if(ts()&&v.has(V))throw new Error("prop listener already exists");if(u.size){let x=A[3](p(V));v.set(V,[A,x])}else v.set(V,[A])},T=V=>{var x;let A=v.get(V);A&&(v.delete(V),(x=A[1])==null||x.call(A))},O=V=>(u.add(V),u.size===1&&v.forEach(([x,k],N)=>{if(ts()&&k)throw new Error("remove already exists");let D=x[3](p(N));v.set(N,[x,D])}),()=>{u.delete(V),u.size===0&&v.forEach(([x,k],N)=>{k&&(k(),v.set(N,[x]))})}),b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),S=t(b,{deleteProperty(V,A){let x=Reflect.get(V,A);T(A);let k=Reflect.deleteProperty(V,A);return k&&h(["delete",[A],x]),k},set(V,A,x,k){var te;let N=Reflect.has(V,A),D=Reflect.get(V,A,k);if(N&&(e(D,x)||r.has(x)&&e(D,r.get(x))))return!0;T(A),za(x)&&(x=yv(x)||x);let $=x;if(!((te=Object.getOwnPropertyDescriptor(V,A))!=null&&te.set)){!Dn.has(x)&&mc(x)&&($=ys(x));let Z=!Qr.has($)&&Dn.get($);Z&&I(A,Z)}return Reflect.set(V,A,$,k),h(["set",[A],x,D]),!0}});r.set(o,S);let P=[b,d,i,O];return Dn.set(S,P),Reflect.ownKeys(o).forEach(V=>{let A=Object.getOwnPropertyDescriptor(o,V);A.get||A.set?Object.defineProperty(b,V,A):S[V]=o[V]}),S})=>[a,Dn,Qr,e,t,mc,n,i,r,s],[Tv]=Sv();wv=Object.defineProperty,Vv=(e,t,n)=>t in e?wv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oe=(e,t,n)=>Vv(e,typeof t!="symbol"?t+"":t,n),vc={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},xv=new Set(["viewBox","preserveAspectRatio"]),Av=e=>{let t="";for(let n in e){let i=e[n];i!=null&&(n.startsWith("--")||(n=n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`)),t+=`${n}:${i};`)}return t},q=fv(e=>Object.entries(e).reduce((t,[n,i])=>{if(i===void 0)return t;if(n in vc&&(n=vc[n]),n==="style"&&typeof i=="object")return t.style=Av(i),t;let r=xv.has(n)?n:n.toLowerCase();return t[r]=i,t},{})),Yr=new WeakMap,yc=new Set(["value","checked","selected"]),kv=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),Nv=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",jr=(e,t)=>Nv(e)&&kv.has(t)?t:t.toLowerCase();is.cleanup=e=>{};is.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};W=class{constructor(e,t={}){var h,m,d;this.machine=e,oe(this,"scope"),oe(this,"context"),oe(this,"prop"),oe(this,"state"),oe(this,"refs"),oe(this,"computed"),oe(this,"event",{type:""}),oe(this,"previousEvent",{type:""}),oe(this,"effects",new Map),oe(this,"transition",null),oe(this,"cleanups",[]),oe(this,"subscriptions",[]),oe(this,"userPropsRef"),oe(this,"getEvent",()=>y(g({},this.event),{current:()=>this.event,previous:()=>this.previousEvent})),oe(this,"getStateConfig",p=>this.machine.states[p]),oe(this,"getState",()=>y(g({},this.state),{matches:(...p)=>p.includes(this.state.get()),hasTag:p=>{var v,I;return!!((I=(v=this.getStateConfig(this.state.get()))==null?void 0:v.tags)!=null&&I.includes(p))}})),oe(this,"debug",(...p)=>{this.machine.debug&&console.log(...p)}),oe(this,"notify",()=>{this.publish()}),oe(this,"send",p=>{this.status===er.Started&&queueMicrotask(()=>{var S,P,V,A,x;if(!p)return;this.previousEvent=this.event,this.event=p,this.debug("send",p);let v=this.state.get(),I=p.type,T=(A=(P=(S=this.getStateConfig(v))==null?void 0:S.on)==null?void 0:P[I])!=null?A:(V=this.machine.on)==null?void 0:V[I],O=this.choose(T);if(!O)return;this.transition=O;let b=(x=O.target)!=null?x:v;this.debug("transition",O);let f=b!==v;f?this.state.set(b):O.reenter&&!f?this.state.invoke(v,v):this.action(O.actions)})}),oe(this,"action",p=>{let v=Wt(p)?p(this.getParams()):p;if(!v)return;let I=v.map(T=>{var b,f;let O=(f=(b=this.machine.implementations)==null?void 0:b.actions)==null?void 0:f[T];return O||zt(`[zag-js] No implementation found for action "${JSON.stringify(T)}"`),O});for(let T of I)T==null||T(this.getParams())}),oe(this,"guard",p=>{var v,I;return Wt(p)?p(this.getParams()):(I=(v=this.machine.implementations)==null?void 0:v.guards)==null?void 0:I[p](this.getParams())}),oe(this,"effect",p=>{let v=Wt(p)?p(this.getParams()):p;if(!v)return;let I=v.map(O=>{var f,S;let b=(S=(f=this.machine.implementations)==null?void 0:f.effects)==null?void 0:S[O];return b||zt(`[zag-js] No implementation found for effect "${JSON.stringify(O)}"`),b}),T=[];for(let O of I){let b=O==null?void 0:O(this.getParams());b&&T.push(b)}return()=>T.forEach(O=>O==null?void 0:O())}),oe(this,"choose",p=>or(p).find(v=>{let I=!v.guard;return Zr(v.guard)?I=!!this.guard(v.guard):Wt(v.guard)&&(I=v.guard(this.getParams())),I})),oe(this,"subscribe",p=>(this.subscriptions.push(p),()=>{let v=this.subscriptions.indexOf(p);v>-1&&this.subscriptions.splice(v,1)})),oe(this,"status",er.NotStarted),oe(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(p=>p(this.service))}),oe(this,"trackers",[]),oe(this,"setupTrackers",()=>{var p,v;(v=(p=this.machine).watch)==null||v.call(p,this.getParams())}),oe(this,"callTrackers",()=>{this.trackers.forEach(({deps:p,fn:v})=>{let I=p.map(T=>T());fe(v.prev,I)||(v(),v.prev=I)})}),oe(this,"getParams",()=>({state:this.getState(),context:this.context,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(p,v)=>{v.prev=p.map(I=>I()),this.trackers.push({deps:p,fn:v})},refs:this.refs,computed:this.computed,flush:sv,scope:this.scope,choose:this.choose})),this.userPropsRef={current:t};let{id:n,ids:i,getRootNode:r}=Kt(t);this.scope=pv({id:n,ids:i,getRootNode:r});let s=p=>{var T,O;let v=Kt(this.userPropsRef.current);return((O=(T=e.props)==null?void 0:T.call(e,{props:Si(v),scope:this.scope}))!=null?O:v)[p]};this.prop=s;let a=(h=e.context)==null?void 0:h.call(e,{prop:s,bindable:is,scope:this.scope,flush(p){queueMicrotask(p)},getContext(){return o},getComputed(){return l},getRefs(){return c},getEvent:this.getEvent.bind(this)});a&&Object.values(a).forEach(p=>{let v=ns(p.ref,()=>this.notify());this.cleanups.push(v)});let o={get(p){return a==null?void 0:a[p].get()},set(p,v){a==null||a[p].set(v)},initial(p){return a==null?void 0:a[p].initial},hash(p){let v=a==null?void 0:a[p].get();return a==null?void 0:a[p].hash(v)}};this.context=o;let l=p=>{var v,I;return(I=(v=e.computed)==null?void 0:v[p]({context:o,event:this.getEvent(),prop:s,refs:this.refs,scope:this.scope,computed:l}))!=null?I:{}};this.computed=l;let c=Dv((d=(m=e.refs)==null?void 0:m.call(e,{prop:s,context:o}))!=null?d:{});this.refs=c;let u=is(()=>({defaultValue:e.initialState({prop:s}),onChange:(p,v)=>{var T,O,b,f;if(v){let S=this.effects.get(v);S==null||S(),this.effects.delete(v)}v&&this.action((T=this.getStateConfig(v))==null?void 0:T.exit),this.action((O=this.transition)==null?void 0:O.actions);let I=this.effect((b=this.getStateConfig(p))==null?void 0:b.effects);if(I&&this.effects.set(p,I),v===Ua){this.action(e.entry);let S=this.effect(e.effects);S&&this.effects.set(Ua,S)}this.action((f=this.getStateConfig(p))==null?void 0:f.entry)}}));this.state=u,this.cleanups.push(ns(this.state.ref,()=>this.notify()))}updateProps(e){let t=this.userPropsRef.current;this.userPropsRef.current=()=>{let n=Kt(t),i=Kt(e);return lu(n,i)},this.notify()}start(){this.status=er.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,Ua),this.setupTrackers()}stop(){this.effects.forEach(e=>e==null?void 0:e()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.subscriptions=[],this.status=er.Stopped,this.debug("unmounting...")}get service(){return{state:this.getState(),send:this.send,context:this.context,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}},K=class{constructor(e,t){z(this,"el");z(this,"doc");z(this,"machine");z(this,"api");z(this,"init",()=>{this.render(),this.machine.subscribe(()=>{this.api=this.initApi(),this.render()}),this.machine.start()});z(this,"destroy",()=>{this.machine.stop()});z(this,"spreadProps",(e,t)=>{Rv(e,t,this.machine.scope.id)});z(this,"updateProps",e=>{this.machine.updateProps(e)});if(!e)throw new Error("Root element not found");this.el=e,this.doc=document,this.machine=this.initMachine(t),this.api=this.initApi()}}});var cu={};he(cu,{Accordion:()=>jv});function Gv(e,t){let{send:n,context:i,prop:r,scope:s,computed:a}=e,o=i.get("focusedValue"),l=i.get("value"),c=r("multiple");function u(m){let d=m;!c&&d.length>1&&(d=[d[0]]),n({type:"VALUE.SET",value:d})}function h(m){var d;return{expanded:l.includes(m.value),focused:o===m.value,disabled:!!((d=m.disabled)!=null?d:r("disabled"))}}return{focusedValue:o,value:l,setValue:u,getItemState:h,getRootProps(){return t.element(y(g({},dr.root.attrs),{dir:r("dir"),id:bs(s),"data-orientation":r("orientation")}))},getItemProps(m){let d=h(m);return t.element(y(g({},dr.item.attrs),{dir:r("dir"),id:Mv(s,m.value),"data-state":d.expanded?"open":"closed","data-focus":E(d.focused),"data-disabled":E(d.disabled),"data-orientation":r("orientation")}))},getItemContentProps(m){let d=h(m);return t.element(y(g({},dr.itemContent.attrs),{dir:r("dir"),role:"region",id:co(s,m.value),"aria-labelledby":Es(s,m.value),hidden:!d.expanded,"data-state":d.expanded?"open":"closed","data-disabled":E(d.disabled),"data-focus":E(d.focused),"data-orientation":r("orientation")}))},getItemIndicatorProps(m){let d=h(m);return t.element(y(g({},dr.itemIndicator.attrs),{dir:r("dir"),"aria-hidden":!0,"data-state":d.expanded?"open":"closed","data-disabled":E(d.disabled),"data-focus":E(d.focused),"data-orientation":r("orientation")}))},getItemTriggerProps(m){let{value:d}=m,p=h(m);return t.button(y(g({},dr.itemTrigger.attrs),{type:"button",dir:r("dir"),id:Es(s,d),"aria-controls":co(s,d),"data-controls":co(s,d),"aria-expanded":p.expanded,disabled:p.disabled,"data-orientation":r("orientation"),"aria-disabled":p.disabled,"data-state":p.expanded?"open":"closed","data-ownedby":bs(s),onFocus(){p.disabled||n({type:"TRIGGER.FOCUS",value:d})},onBlur(){p.disabled||n({type:"TRIGGER.BLUR"})},onClick(v){p.disabled||(Xe()&&v.currentTarget.focus(),n({type:"TRIGGER.CLICK",value:d}))},onKeyDown(v){if(v.defaultPrevented||p.disabled)return;let I={ArrowDown(){a("isHorizontal")||n({type:"GOTO.NEXT",value:d})},ArrowUp(){a("isHorizontal")||n({type:"GOTO.PREV",value:d})},ArrowRight(){a("isHorizontal")&&n({type:"GOTO.NEXT",value:d})},ArrowLeft(){a("isHorizontal")&&n({type:"GOTO.PREV",value:d})},Home(){n({type:"GOTO.FIRST",value:d})},End(){n({type:"GOTO.LAST",value:d})}},T=ge(v,{dir:r("dir"),orientation:r("orientation")}),O=I[T];O&&(O(v),v.preventDefault())}}))}}}var Lv,dr,bs,Mv,co,Es,Fv,Is,$v,Hv,Bv,_v,Uv,qv,Wv,Kv,c0,zv,u0,Yv,jv,uu=re(()=>{"use strict";se();Lv=U("accordion").parts("root","item","itemTrigger","itemContent","itemIndicator"),dr=Lv.build(),bs=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`accordion:${e.id}`},Mv=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`accordion:${e.id}:item:${t}`},co=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemContent)==null?void 0:i.call(n,t))!=null?r:`accordion:${e.id}:content:${t}`},Es=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemTrigger)==null?void 0:i.call(n,t))!=null?r:`accordion:${e.id}:trigger:${t}`},Fv=e=>e.getById(bs(e)),Is=e=>{let n=`[data-controls][data-ownedby='${CSS.escape(bs(e))}']:not([disabled])`;return Fe(Fv(e),n)},$v=e=>lt(Is(e)),Hv=e=>mt(Is(e)),Bv=(e,t)=>yi(Is(e),Es(e,t)),_v=(e,t)=>bi(Is(e),Es(e,t));({and:Uv,not:qv}=Ee()),Wv={props({props:e}){return g({collapsible:!1,multiple:!1,orientation:"vertical",defaultValue:[]},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{focusedValue:t(()=>({defaultValue:null,sync:!0,onChange(n){var i;(i=e("onFocusChange"))==null||i({value:n})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}}))}},computed:{isHorizontal:({prop:e})=>e("orientation")==="horizontal"},on:{"VALUE.SET":{actions:["setValue"]}},states:{idle:{on:{"TRIGGER.FOCUS":{target:"focused",actions:["setFocusedValue"]}}},focused:{on:{"GOTO.NEXT":{actions:["focusNextTrigger"]},"GOTO.PREV":{actions:["focusPrevTrigger"]},"TRIGGER.CLICK":[{guard:Uv("isExpanded","canToggle"),actions:["collapse"]},{guard:qv("isExpanded"),actions:["expand"]}],"GOTO.FIRST":{actions:["focusFirstTrigger"]},"GOTO.LAST":{actions:["focusLastTrigger"]},"TRIGGER.BLUR":{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{canToggle:({prop:e})=>!!e("collapsible")||!!e("multiple"),isExpanded:({context:e,event:t})=>e.get("value").includes(t.value)},actions:{collapse({context:e,prop:t,event:n}){let i=t("multiple")?ct(e.get("value"),n.value):[];e.set("value",i)},expand({context:e,prop:t,event:n}){let i=t("multiple")?Ze(e.get("value"),n.value):[n.value];e.set("value",i)},focusFirstTrigger({scope:e}){var t;(t=$v(e))==null||t.focus()},focusLastTrigger({scope:e}){var t;(t=Hv(e))==null||t.focus()},focusNextTrigger({context:e,scope:t}){let n=e.get("focusedValue");if(!n)return;let i=Bv(t,n);i==null||i.focus()},focusPrevTrigger({context:e,scope:t}){let n=e.get("focusedValue");if(!n)return;let i=_v(t,n);i==null||i.focus()},setFocusedValue({context:e,event:t}){e.set("focusedValue",t.value)},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t}){e.set("value",t.value)},coarseValue({context:e,prop:t}){!t("multiple")&&e.get("value").length>1&&(zt("The value of accordion should be a single value when multiple is false."),e.set("value",[e.get("value")[0]]))}}}},Kv=_()(["collapsible","dir","disabled","getRootNode","id","ids","multiple","onFocusChange","onValueChange","orientation","value","defaultValue"]),c0=B(Kv),zv=_()(["value","disabled"]),u0=B(zv),Yv=class extends K{initMachine(e){return new W(Wv,e)}initApi(){return Gv(this.machine.service,q)}render(){var i;let e=(i=this.el.querySelector('[data-scope="accordion"][data-part="root"]'))!=null?i:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.getItemsList(),n=e.querySelectorAll('[data-scope="accordion"][data-part="item"]');for(let r=0;r{var a,o;let r=w(e,"onValueChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,value:(a=i.value)!=null?a:null});let s=w(e,"onValueChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,value:(o=i.value)!=null?o:null}}))},onFocusChange:i=>{var a,o;let r=w(e,"onFocusChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,value:(a=i.value)!=null?a:null});let s=w(e,"onFocusChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,value:(o=i.value)!=null?o:null}}))}}));n.init(),this.accordion=n,this.onSetValue=i=>{let{value:r}=i.detail;n.api.setValue(r)},e.addEventListener("phx:accordion:set-value",this.onSetValue),this.handlers=[],this.handlers.push(this.handleEvent("accordion_set_value",i=>{let r=i.accordion_id;r&&!(e.id===r||e.id===`accordion:${r}`)||n.api.setValue(i.value)})),this.handlers.push(this.handleEvent("accordion_value",()=>{this.pushEvent("accordion_value_response",{value:n.api.value})})),this.handlers.push(this.handleEvent("accordion_focused_value",()=>{this.pushEvent("accordion_focused_value_response",{value:n.api.focusedValue})}))},updated(){var t,n,i,r;let e=C(this.el,"controlled");(r=this.accordion)==null||r.updateProps(y(g({id:this.el.id},e?{value:Q(this.el,"value")}:{defaultValue:(i=(n=(t=this.accordion)==null?void 0:t.api)==null?void 0:n.value)!=null?i:Q(this.el,"defaultValue")}),{collapsible:C(this.el,"collapsible"),multiple:C(this.el,"multiple"),orientation:w(this.el,"orientation",["horizontal","vertical"]),dir:Oe(this.el)}))},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:accordion:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.accordion)==null||e.destroy()}}});function yu(e,t,n=e.center){let i=t.x-n.x,r=t.y-n.y;return 360-(Math.atan2(i,r)*(180/Math.PI)+180)}function bn(e){let{x:t,y:n,width:i,height:r}=e,s=t+i/2,a=n+r/2;return{x:t,y:n,width:i,height:r,minX:t,minY:n,maxX:t+i,maxY:n+r,midX:s,midY:a,center:_n(s,a)}}function ey(e){let t=_n(e.minX,e.minY),n=_n(e.maxX,e.minY),i=_n(e.maxX,e.maxY),r=_n(e.minX,e.maxY);return{top:t,right:n,bottom:i,left:r}}function ty(e){if(!uo.has(e)){let t=e.ownerDocument.defaultView||window;uo.set(e,t.getComputedStyle(e))}return uo.get(e)}function po(e,t={}){return bn(ny(e,t))}function ny(e,t={}){let{excludeScrollbar:n=!1,excludeBorders:i=!1}=t,{x:r,y:s,width:a,height:o}=e.getBoundingClientRect(),l={x:r,y:s,width:a,height:o},c=ty(e),{borderLeftWidth:u,borderTopWidth:h,borderRightWidth:m,borderBottomWidth:d}=c,p=gu(u,m),v=gu(h,d);if(i&&(l.width-=p,l.height-=v,l.x+=ho(u),l.y+=ho(h)),n){let I=e.offsetWidth-e.clientWidth-p,T=e.offsetHeight-e.clientHeight-v;l.width-=I,l.height-=T}return l}function Cu(e,t={}){return bn(iy(e,t))}function iy(e,t){let{excludeScrollbar:n=!1}=t,{innerWidth:i,innerHeight:r,document:s,visualViewport:a}=e,o=(a==null?void 0:a.width)||i,l=(a==null?void 0:a.height)||r,c={x:0,y:0,width:o,height:l};if(n){let u=i-s.documentElement.clientWidth,h=r-s.documentElement.clientHeight;c.width-=u,c.height-=h}return c}function Su(e,t){let n=bn(e),{top:i,right:r,left:s,bottom:a}=ey(n),[o]=t.split("-");return{top:[s,i,r,a],right:[i,r,a,s],bottom:[i,s,a,r],left:[r,i,s,a]}[o]}function fo(e,t){let{x:n,y:i}=t,r=!1;for(let s=0,a=e.length-1;si!=u>i&&n<(c-o)*(i-l)/(u-l)+o&&(r=!r)}return r}function mu(e,t){let{minX:n,minY:i,maxX:r,maxY:s,midX:a,midY:o}=e,l=t.includes("w")?n:t.includes("e")?r:a,c=t.includes("n")?i:t.includes("s")?s:o;return{x:l,y:c}}function sy(e){return ry[e]}function Tu(e,t,n,i){let{scalingOriginMode:r,lockAspectRatio:s}=i,a=mu(e,n),o=sy(n),l=mu(e,o);r==="center"&&(t={x:t.x*2,y:t.y*2});let c={x:a.x+t.x,y:a.y+t.y},u={x:pu[n].x*2-1,y:pu[n].y*2-1},h={width:c.x-l.x,height:c.y-l.y},m=u.x*h.width/e.width,d=u.y*h.height/e.height,p=Ti(m)>Ti(d)?m:d,v=s?{x:p,y:p}:{x:a.x===l.x?1:m,y:a.y===l.y?1:d};switch(a.y===l.y?v.y=Ti(v.y):Ps(v.y)!==Ps(d)&&(v.y*=-1),a.x===l.x?v.x=Ti(v.x):Ps(v.x)!==Ps(m)&&(v.x*=-1),r){case"extent":return vu(e,du.scale(v.x,v.y,l),!1);case"center":return vu(e,du.scale(v.x,v.y,{x:e.midX,y:e.midY}),!1)}}function ay(e,t,n=!0){return n?{x:fu(t.x,e.x),y:fu(t.y,e.y),width:Ti(t.x-e.x),height:Ti(t.y-e.y)}:{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}function vu(e,t,n=!0){let i=t.applyTo({x:e.minX,y:e.minY}),r=t.applyTo({x:e.maxX,y:e.maxY});return ay(i,r,n)}var Xv,Zv,Zt,du,hu,hr,Jv,Qv,gr,_n,go,bu,Eu,Iu,Pu,uo,ho,gu,g0,p0,pu,ry,Ps,Ti,fu,Cs=re(()=>{"use strict";Xv=Object.defineProperty,Zv=(e,t,n)=>t in e?Xv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zt=(e,t,n)=>Zv(e,typeof t!="symbol"?t+"":t,n),du=class Ae{constructor([t,n,i,r,s,a]=[0,0,0,0,0,0]){Zt(this,"m00"),Zt(this,"m01"),Zt(this,"m02"),Zt(this,"m10"),Zt(this,"m11"),Zt(this,"m12"),Zt(this,"rotate",(...o)=>this.prepend(Ae.rotate(...o))),Zt(this,"scale",(...o)=>this.prepend(Ae.scale(...o))),Zt(this,"translate",(...o)=>this.prepend(Ae.translate(...o))),this.m00=t,this.m01=n,this.m02=i,this.m10=r,this.m11=s,this.m12=a}applyTo(t){let{x:n,y:i}=t,{m00:r,m01:s,m02:a,m10:o,m11:l,m12:c}=this;return{x:r*n+s*i+a,y:o*n+l*i+c}}prepend(t){return new Ae([this.m00*t.m00+this.m01*t.m10,this.m00*t.m01+this.m01*t.m11,this.m00*t.m02+this.m01*t.m12+this.m02,this.m10*t.m00+this.m11*t.m10,this.m10*t.m01+this.m11*t.m11,this.m10*t.m02+this.m11*t.m12+this.m12])}append(t){return new Ae([t.m00*this.m00+t.m01*this.m10,t.m00*this.m01+t.m01*this.m11,t.m00*this.m02+t.m01*this.m12+t.m02,t.m10*this.m00+t.m11*this.m10,t.m10*this.m01+t.m11*this.m11,t.m10*this.m02+t.m11*this.m12+t.m12])}get determinant(){return this.m00*this.m11-this.m01*this.m10}get isInvertible(){let t=this.determinant;return isFinite(t)&&isFinite(this.m02)&&isFinite(this.m12)&&t!==0}invert(){let t=this.determinant;return new Ae([this.m11/t,-this.m01/t,(this.m01*this.m12-this.m11*this.m02)/t,-this.m10/t,this.m00/t,(this.m10*this.m02-this.m00*this.m12)/t])}get array(){return[this.m00,this.m01,this.m02,this.m10,this.m11,this.m12,0,0,1]}get float32Array(){return new Float32Array(this.array)}static get identity(){return new Ae([1,0,0,0,1,0])}static rotate(t,n){let i=new Ae([Math.cos(t),-Math.sin(t),0,Math.sin(t),Math.cos(t),0]);return n&&(n.x!==0||n.y!==0)?Ae.multiply(Ae.translate(n.x,n.y),i,Ae.translate(-n.x,-n.y)):i}static scale(t,n=t,i={x:0,y:0}){let r=new Ae([t,0,0,0,n,0]);return i.x!==0||i.y!==0?Ae.multiply(Ae.translate(i.x,i.y),r,Ae.translate(-i.x,-i.y)):r}static translate(t,n){return new Ae([1,0,t,0,1,n])}static multiply(...[t,...n]){return t?n.reduce((i,r)=>i.prepend(r),t):Ae.identity}get a(){return this.m00}get b(){return this.m10}get c(){return this.m01}get d(){return this.m11}get tx(){return this.m02}get ty(){return this.m12}get scaleComponents(){return{x:this.a,y:this.d}}get translationComponents(){return{x:this.tx,y:this.ty}}get skewComponents(){return{x:this.c,y:this.b}}toString(){return`matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.tx}, ${this.ty})`}};hu=(e,t,n)=>Math.min(Math.max(e,t),n),hr=(e,t,n)=>{let i=hu(e.x,n.x,n.x+n.width-t.width),r=hu(e.y,n.y,n.y+n.height-t.height);return{x:i,y:r}},Jv={width:0,height:0},Qv={width:1/0,height:1/0},gr=(e,t=Jv,n=Qv)=>({width:Math.min(Math.max(e.width,t.width),n.width),height:Math.min(Math.max(e.height,t.height),n.height)}),_n=(e,t)=>({x:e,y:t}),go=(e,t)=>t?_n(e.x-t.x,e.y-t.y):e,bu=(e,t)=>_n(e.x+t.x,e.y+t.y);Eu=(e,t)=>{let n=Math.max(t.x,Math.min(e.x,t.x+t.width-e.width)),i=Math.max(t.y,Math.min(e.y,t.y+t.height-e.height));return{x:n,y:i,width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}},Iu=(e,t)=>e.width===(t==null?void 0:t.width)&&e.height===(t==null?void 0:t.height),Pu=(e,t)=>e.x===(t==null?void 0:t.x)&&e.y===(t==null?void 0:t.y),uo=new WeakMap;ho=e=>parseFloat(e.replace("px","")),gu=(...e)=>e.reduce((t,n)=>t+(n?ho(n):0),0),{min:g0,max:p0}=Math;pu={n:{x:.5,y:0},ne:{x:1,y:0},e:{x:1,y:.5},se:{x:1,y:1},s:{x:.5,y:1},sw:{x:0,y:1},w:{x:0,y:.5},nw:{x:0,y:0}},ry={n:"s",ne:"sw",e:"w",se:"nw",s:"n",sw:"ne",w:"e",nw:"se"},{sign:Ps,abs:Ti,min:fu}=Math});var Nu={};he(Nu,{AngleSlider:()=>vy});function Au(e,t,n){let i=bn(e.getBoundingClientRect()),r=yu(i,t);return n!=null?r-n:r}function ku(e){return Math.min(Math.max(e,Ss),Ts)}function hy(e,t){let n=ku(e),i=Math.ceil(n/t),r=Math.round(n/t);return i>=n/t?i*t===Ts?Ss:i*t:r*t}function wu(e,t){return eu(e,Ss,Ts,t)}function gy(e,t){let{state:n,send:i,context:r,prop:s,computed:a,scope:o}=e,l=n.matches("dragging"),c=r.get("value"),u=a("valueAsDegree"),h=s("disabled"),m=s("invalid"),d=s("readOnly"),p=a("interactive"),v=s("aria-label"),I=s("aria-labelledby");return{value:c,valueAsDegree:u,dragging:l,setValue(T){i({type:"VALUE.SET",value:T})},getRootProps(){return t.element(y(g({},Gn.root.attrs),{id:ly(o),"data-disabled":E(h),"data-invalid":E(m),"data-readonly":E(d),style:{"--value":c,"--angle":u}}))},getLabelProps(){return t.label(y(g({},Gn.label.attrs),{id:Ou(o),htmlFor:mo(o),"data-disabled":E(h),"data-invalid":E(m),"data-readonly":E(d),onClick(T){var O;p&&(T.preventDefault(),(O=vo(o))==null||O.focus())}}))},getHiddenInputProps(){return t.element({type:"hidden",value:c,name:s("name"),id:mo(o)})},getControlProps(){return t.element(y(g({},Gn.control.attrs),{role:"presentation",id:xu(o),"data-disabled":E(h),"data-invalid":E(m),"data-readonly":E(d),onPointerDown(T){if(!p||!pe(T))return;let O=je(T),b=T.currentTarget,f=vo(o),S=Yt(T).composedPath(),P=f&&S.includes(f),V=null;P&&(V=Au(b,O)-c),i({type:"CONTROL.POINTER_DOWN",point:O,angularOffset:V}),T.stopPropagation()},style:{touchAction:"none",userSelect:"none",WebkitUserSelect:"none"}}))},getThumbProps(){return t.element(y(g({},Gn.thumb.attrs),{id:Vu(o),role:"slider","aria-label":v,"aria-labelledby":I!=null?I:Ou(o),"aria-valuemax":360,"aria-valuemin":0,"aria-valuenow":c,tabIndex:d||p?0:void 0,"data-disabled":E(h),"data-invalid":E(m),"data-readonly":E(d),onFocus(){i({type:"THUMB.FOCUS"})},onBlur(){i({type:"THUMB.BLUR"})},onKeyDown(T){if(!p)return;let O=gi(T)*s("step");switch(T.key){case"ArrowLeft":case"ArrowUp":T.preventDefault(),i({type:"THUMB.ARROW_DEC",step:O});break;case"ArrowRight":case"ArrowDown":T.preventDefault(),i({type:"THUMB.ARROW_INC",step:O});break;case"Home":T.preventDefault(),i({type:"THUMB.HOME"});break;case"End":T.preventDefault(),i({type:"THUMB.END"});break}},style:{rotate:"var(--angle)"}}))},getValueTextProps(){return t.element(y(g({},Gn.valueText.attrs),{id:cy(o)}))},getMarkerGroupProps(){return t.element(g({},Gn.markerGroup.attrs))},getMarkerProps(T){let O;return T.valuec?O="over-value":O="at-value",t.element(y(g({},Gn.marker.attrs),{"data-value":T.value,"data-state":O,"data-disabled":E(h),style:{"--marker-value":T.value,rotate:"calc(var(--marker-value) * 1deg)"}}))}}}var oy,Gn,ly,Vu,mo,xu,cy,Ou,uy,dy,vo,Ss,Ts,py,fy,y0,my,vy,Ru=re(()=>{"use strict";Cs();se();oy=U("angle-slider").parts("root","label","thumb","valueText","control","track","markerGroup","marker"),Gn=oy.build(),ly=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`angle-slider:${e.id}`},Vu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.thumb)!=null?n:`angle-slider:${e.id}:thumb`},mo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`angle-slider:${e.id}:input`},xu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`angle-slider:${e.id}:control`},cy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.valueText)!=null?n:`angle-slider:${e.id}:value-text`},Ou=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`angle-slider:${e.id}:label`},uy=e=>e.getById(mo(e)),dy=e=>e.getById(xu(e)),vo=e=>e.getById(Vu(e)),Ss=0,Ts=359;py={props({props:e}){return g({step:1,defaultValue:0},e)},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n,valueAsDegree:`${n}deg`})}}))}},refs(){return{thumbDragOffset:null}},computed:{interactive:({prop:e})=>!(e("disabled")||e("readOnly")),valueAsDegree:({context:e})=>`${e.get("value")}deg`},watch({track:e,context:t,action:n}){e([()=>t.get("value")],()=>{n(["syncInputElement"])})},initialState(){return"idle"},on:{"VALUE.SET":{actions:["setValue"]}},states:{idle:{on:{"CONTROL.POINTER_DOWN":{target:"dragging",actions:["setThumbDragOffset","setPointerValue","focusThumb"]},"THUMB.FOCUS":{target:"focused"}}},focused:{on:{"CONTROL.POINTER_DOWN":{target:"dragging",actions:["setThumbDragOffset","setPointerValue","focusThumb"]},"THUMB.ARROW_DEC":{actions:["decrementValue","invokeOnChangeEnd"]},"THUMB.ARROW_INC":{actions:["incrementValue","invokeOnChangeEnd"]},"THUMB.HOME":{actions:["setValueToMin","invokeOnChangeEnd"]},"THUMB.END":{actions:["setValueToMax","invokeOnChangeEnd"]},"THUMB.BLUR":{target:"idle"}}},dragging:{entry:["focusThumb"],effects:["trackPointerMove"],on:{"DOC.POINTER_UP":{target:"focused",actions:["invokeOnChangeEnd","clearThumbDragOffset"]},"DOC.POINTER_MOVE":{actions:["setPointerValue"]}}}},implementations:{effects:{trackPointerMove({scope:e,send:t}){return hn(e.getDoc(),{onPointerMove(n){t({type:"DOC.POINTER_MOVE",point:n.point})},onPointerUp(){t({type:"DOC.POINTER_UP"})}})}},actions:{syncInputElement({scope:e,context:t}){let n=uy(e);Me(n,t.get("value").toString())},invokeOnChangeEnd({context:e,prop:t,computed:n}){var i;(i=t("onValueChangeEnd"))==null||i({value:e.get("value"),valueAsDegree:n("valueAsDegree")})},setPointerValue({scope:e,event:t,context:n,prop:i,refs:r}){let s=dy(e);if(!s)return;let a=r.get("thumbDragOffset"),o=Au(s,t.point,a);n.set("value",hy(o,i("step")))},setValueToMin({context:e}){e.set("value",Ss)},setValueToMax({context:e}){e.set("value",Ts)},setValue({context:e,event:t}){e.set("value",ku(t.value))},decrementValue({context:e,event:t,prop:n}){var r;let i=wu(e.get("value")-t.step,(r=t.step)!=null?r:n("step"));e.set("value",i)},incrementValue({context:e,event:t,prop:n}){var r;let i=wu(e.get("value")+t.step,(r=t.step)!=null?r:n("step"));e.set("value",i)},focusThumb({scope:e}){H(()=>{var t;(t=vo(e))==null||t.focus({preventScroll:!0})})},setThumbDragOffset({refs:e,event:t}){var n;e.set("thumbDragOffset",(n=t.angularOffset)!=null?n:null)},clearThumbDragOffset({refs:e}){e.set("thumbDragOffset",null)}}}},fy=_()(["aria-label","aria-labelledby","dir","disabled","getRootNode","id","ids","invalid","name","onValueChange","onValueChangeEnd","readOnly","step","value","defaultValue"]),y0=B(fy),my=class extends K{initMachine(e){return new W(py,e)}initApi(){return gy(this.machine.service,q)}render(){var o;let e=(o=this.el.querySelector('[data-scope="angle-slider"][data-part="root"]'))!=null?o:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="angle-slider"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');n&&this.spreadProps(n,this.api.getHiddenInputProps());let i=this.el.querySelector('[data-scope="angle-slider"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps());let r=this.el.querySelector('[data-scope="angle-slider"][data-part="thumb"]');r&&this.spreadProps(r,this.api.getThumbProps());let s=this.el.querySelector('[data-scope="angle-slider"][data-part="value-text"]');if(s){this.spreadProps(s,this.api.getValueTextProps());let l=s.querySelector('[data-scope="angle-slider"][data-part="value"]');l&&l.textContent!==String(this.api.value)&&(l.textContent=String(this.api.value))}let a=this.el.querySelector('[data-scope="angle-slider"][data-part="marker-group"]');a&&this.spreadProps(a,this.api.getMarkerGroupProps()),this.el.querySelectorAll('[data-scope="angle-slider"][data-part="marker"]').forEach(l=>{let c=l.dataset.value;if(c==null)return;let u=Number(c);Number.isNaN(u)||this.spreadProps(l,this.api.getMarkerProps({value:u}))})}},vy={mounted(){var a;let e=this.el,t=Y(e,"value"),n=Y(e,"defaultValue"),i=C(e,"controlled"),r=!1,s=new my(e,y(g({id:e.id},i&&t!==void 0?{value:t}:{defaultValue:n!=null?n:0}),{step:(a=Y(e,"step"))!=null?a:1,disabled:C(e,"disabled"),readOnly:C(e,"readOnly"),invalid:C(e,"invalid"),name:w(e,"name"),dir:w(e,"dir",["ltr","rtl"]),onValueChange:o=>{if(r){r=!1;return}if(i)r=!0,s.api.setValue(o.value);else{let u=e.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');u&&(u.value=String(o.value),u.dispatchEvent(new Event("input",{bubbles:!0})),u.dispatchEvent(new Event("change",{bubbles:!0})))}let l=w(e,"onValueChange");l&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(l,{value:o.value,valueAsDegree:o.valueAsDegree,id:e.id});let c=w(e,"onValueChangeClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:{value:o,id:e.id}}))},onValueChangeEnd:o=>{if(i){let u=e.querySelector('[data-scope="angle-slider"][data-part="hidden-input"]');u&&(u.value=String(o.value),u.dispatchEvent(new Event("input",{bubbles:!0})),u.dispatchEvent(new Event("change",{bubbles:!0})))}let l=w(e,"onValueChangeEnd");l&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(l,{value:o.value,valueAsDegree:o.valueAsDegree,id:e.id});let c=w(e,"onValueChangeEndClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:{value:o,id:e.id}}))}}));s.init(),this.angleSlider=s,this.handlers=[],this.onSetValue=o=>{let{value:l}=o.detail;s.api.setValue(l)},e.addEventListener("phx:angle-slider:set-value",this.onSetValue),this.handlers.push(this.handleEvent("angle_slider_set_value",o=>{let l=o.angle_slider_id;l&&!(e.id===l||e.id===`angle-slider:${l}`)||s.api.setValue(o.value)})),this.handlers.push(this.handleEvent("angle_slider_value",()=>{this.pushEvent("angle_slider_value_response",{value:s.api.value,valueAsDegree:s.api.valueAsDegree,dragging:s.api.dragging})}))},updated(){var n,i;let e=Y(this.el,"value"),t=C(this.el,"controlled");(i=this.angleSlider)==null||i.updateProps(y(g({id:this.el.id},t&&e!==void 0?{value:e}:{}),{step:(n=Y(this.el,"step"))!=null?n:1,disabled:C(this.el,"disabled"),readOnly:C(this.el,"readOnly"),invalid:C(this.el,"invalid"),name:w(this.el,"name")}))},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:angle-slider:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.angleSlider)==null||e.destroy()}}});var Mu={};he(Mu,{Avatar:()=>Oy});function Iy(e,t){let{state:n,send:i,prop:r,scope:s}=e,a=n.matches("loaded");return{loaded:a,setSrc(o){let l=bo(s);l==null||l.setAttribute("src",o)},setLoaded(){i({type:"img.loaded",src:"api"})},setError(){i({type:"img.error",src:"api"})},getRootProps(){return t.element(y(g({},yo.root.attrs),{dir:r("dir"),id:Du(s)}))},getImageProps(){return t.img(y(g({},yo.image.attrs),{hidden:!a,dir:r("dir"),id:Lu(s),"data-state":a?"visible":"hidden",onLoad(){i({type:"img.loaded",src:"element"})},onError(){i({type:"img.error",src:"element"})}}))},getFallbackProps(){return t.element(y(g({},yo.fallback.attrs),{dir:r("dir"),id:by(s),hidden:a,"data-state":a?"hidden":"visible"}))}}}function Cy(e){return e.complete&&e.naturalWidth!==0&&e.naturalHeight!==0}var yy,yo,Du,Lu,by,Ey,bo,Py,Sy,P0,Ty,Oy,Fu=re(()=>{"use strict";se();yy=U("avatar").parts("root","image","fallback"),yo=yy.build(),Du=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`avatar:${e.id}`},Lu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.image)!=null?n:`avatar:${e.id}:image`},by=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.fallback)!=null?n:`avatar:${e.id}:fallback`},Ey=e=>e.getById(Du(e)),bo=e=>e.getById(Lu(e));Py={initialState(){return"loading"},effects:["trackImageRemoval","trackSrcChange"],on:{"src.change":{target:"loading"},"img.unmount":{target:"error"}},states:{loading:{entry:["checkImageStatus"],on:{"img.loaded":{target:"loaded",actions:["invokeOnLoad"]},"img.error":{target:"error",actions:["invokeOnError"]}}},error:{on:{"img.loaded":{target:"loaded",actions:["invokeOnLoad"]}}},loaded:{on:{"img.error":{target:"error",actions:["invokeOnError"]}}}},implementations:{actions:{invokeOnLoad({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"loaded"})},invokeOnError({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"error"})},checkImageStatus({send:e,scope:t}){let n=bo(t);if(!(n!=null&&n.complete))return;let i=Cy(n)?"img.loaded":"img.error";e({type:i,src:"ssr"})}},effects:{trackImageRemoval({send:e,scope:t}){let n=Ey(t);return hs(n,{callback(i){Array.from(i[0].removedNodes).find(a=>a.nodeType===Node.ELEMENT_NODE&&a.matches("[data-scope=avatar][data-part=image]"))&&e({type:"img.unmount"})}})},trackSrcChange({send:e,scope:t}){let n=bo(t);return ot(n,{attributes:["src","srcset"],callback(){e({type:"src.change"})}})}}}};Sy=_()(["dir","id","ids","onStatusChange","getRootNode"]),P0=B(Sy),Ty=class extends K{initMachine(e){return new W(Py,e)}initApi(){return Iy(this.machine.service,q)}render(){var r;let e=(r=this.el.querySelector('[data-scope="avatar"][data-part="root"]'))!=null?r:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="avatar"][data-part="image"]');t&&this.spreadProps(t,this.api.getImageProps());let n=this.el.querySelector('[data-scope="avatar"][data-part="fallback"]');n&&this.spreadProps(n,this.api.getFallbackProps());let i=this.el.querySelector('[data-scope="avatar"][data-part="skeleton"]');if(i){let s=this.machine.service.state,a=s.matches("loaded"),o=s.matches("error");i.hidden=a||o,i.setAttribute("data-state",a||o?"hidden":"visible")}}},Oy={mounted(){let e=this.el,t=w(e,"src"),n=new Ty(e,g({id:e.id,onStatusChange:i=>{let r=w(e,"onStatusChange");r&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(r,{status:i.status,id:e.id});let s=w(e,"onStatusChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{value:i,id:e.id}}))}},t!==void 0?{}:{}));n.init(),this.avatar=n,t!==void 0&&n.api.setSrc(t),this.handlers=[]},updated(){let e=w(this.el,"src");e!==void 0&&this.avatar&&this.avatar.api.setSrc(e)},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.avatar)==null||e.destroy()}}});var qu={};he(qu,{Carousel:()=>qy});function Bu(e){let t=at(e),n=e.getBoundingClientRect(),i=t.getPropertyValue("scroll-padding-left").replace("auto","0px"),r=t.getPropertyValue("scroll-padding-top").replace("auto","0px"),s=t.getPropertyValue("scroll-padding-right").replace("auto","0px"),a=t.getPropertyValue("scroll-padding-bottom").replace("auto","0px");function o(m,d){let p=parseFloat(m);return/%/.test(m)&&(p/=100,p*=d),Number.isNaN(p)?0:p}let l=o(i,n.width),c=o(r,n.height),u=o(s,n.width),h=o(a,n.height);return{x:{before:l,after:u},y:{before:c,after:h}}}function wy(e,t,n="both"){return n==="x"&&e.right>=t.left&&e.left<=t.right||n==="y"&&e.bottom>=t.top&&e.top<=t.bottom||n==="both"&&e.right>=t.left&&e.left<=t.right&&e.bottom>=t.top&&e.top<=t.bottom}function _u(e){let t=[];for(let n of e.children)t=t.concat(n,_u(n));return t}function Gu(e,t=!1){let n=e.getBoundingClientRect(),r=Po(e)==="rtl",s={x:{start:[],center:[],end:[]},y:{start:[],center:[],end:[]}},a=t?_u(e):e.children;for(let o of["x","y"]){let l=o==="x"?"y":"x",c=o==="x"?"left":"top",u=o==="x"?"right":"bottom",h=o==="x"?"width":"height",m=o==="x"?"scrollLeft":"scrollTop",d=r&&o==="x";for(let p of a){let v=p.getBoundingClientRect();if(!wy(n,v,l))continue;let I=at(p),[T,O]=I.getPropertyValue("scroll-snap-align").split(" ");typeof O=="undefined"&&(O=T);let b=o==="x"?O:T,f,S,P;if(d){let V=Math.abs(e[m]),A=n[u]-v[u]+V;f=A,S=A+v[h],P=A+v[h]/2}else f=v[c]-n[c]+e[m],S=f+v[h],P=f+v[h]/2;switch(b){case"none":break;case"start":s[o].start.push({node:p,position:f});break;case"center":s[o].center.push({node:p,position:P});break;case"end":s[o].end.push({node:p,position:S});break}}}return s}function Vy(e){let t=Po(e),n=e.getBoundingClientRect(),i=Bu(e),r=Gu(e),s={x:e.scrollWidth-e.offsetWidth,y:e.scrollHeight-e.offsetHeight},a=t==="rtl",o=a&&e.scrollLeft<=0,l;return a?(l=Eo([...r.x.start.map(c=>c.position-i.x.after),...r.x.center.map(c=>c.position-n.width/2),...r.x.end.map(c=>c.position-n.width+i.x.before)].map(Io(0,s.x))),o&&(l=l.map(c=>-c))):l=Eo([...r.x.start.map(c=>c.position-i.x.before),...r.x.center.map(c=>c.position-n.width/2),...r.x.end.map(c=>c.position-n.width+i.x.after)].map(Io(0,s.x))),{x:l,y:Eo([...r.y.start.map(c=>c.position-i.y.before),...r.y.center.map(c=>c.position-n.height/2),...r.y.end.map(c=>c.position-n.height+i.y.after)].map(Io(0,s.y)))}}function xy(e,t,n){let i=Po(e),r=Bu(e),s=Gu(e),a=[...s[t].start,...s[t].center,...s[t].end],o=i==="rtl",l=o&&t==="x"&&e.scrollLeft<=0;for(let c of a)if(n(c.node)){let u;return t==="x"&&o?(u=c.position-r.x.after,l&&(u=-u)):u=c.position-(t==="x"?r.x.before:r.y.before),u}}function Fy(e,t){let{state:n,context:i,computed:r,send:s,scope:a,prop:o}=e,l=n.matches("autoplay"),c=n.matches("dragging"),u=r("canScrollNext"),h=r("canScrollPrev"),m=r("isHorizontal"),d=o("autoSize"),p=Array.from(i.get("pageSnapPoints")),v=i.get("page"),I=o("slidesPerPage"),T=o("padding"),O=o("translations");return{isPlaying:l,isDragging:c,page:v,pageSnapPoints:p,canScrollNext:u,canScrollPrev:h,getProgress(){return v/p.length},getProgressText(){var f,S;let b={page:v+1,totalPages:p.length};return(S=(f=O.progressText)==null?void 0:f.call(O,b))!=null?S:""},scrollToIndex(b,f){s({type:"INDEX.SET",index:b,instant:f})},scrollTo(b,f){s({type:"PAGE.SET",index:b,instant:f})},scrollNext(b){s({type:"PAGE.NEXT",instant:b})},scrollPrev(b){s({type:"PAGE.PREV",instant:b})},play(){s({type:"AUTOPLAY.START"})},pause(){s({type:"AUTOPLAY.PAUSE"})},isInView(b){return Array.from(i.get("slidesInView")).includes(b)},refresh(){s({type:"SNAP.REFRESH"})},getRootProps(){return t.element(y(g({},kt.root.attrs),{id:ky(a),role:"region","aria-roledescription":"carousel","data-orientation":o("orientation"),dir:o("dir"),style:{"--slides-per-page":I,"--slide-spacing":o("spacing"),"--slide-item-size":d?"auto":"calc(100% / var(--slides-per-page) - var(--slide-spacing) * (var(--slides-per-page) - 1) / var(--slides-per-page))"}}))},getItemGroupProps(){return t.element(y(g({},kt.itemGroup.attrs),{id:Os(a),"data-orientation":o("orientation"),"data-dragging":E(c),dir:o("dir"),"aria-live":l?"off":"polite",onFocus(b){ce(b.currentTarget,j(b))&&s({type:"VIEWPORT.FOCUS"})},onBlur(b){ce(b.currentTarget,b.relatedTarget)||s({type:"VIEWPORT.BLUR"})},onMouseDown(b){if(b.defaultPrevented||!o("allowMouseDrag")||!pe(b))return;let f=j(b);Ye(f)&&f!==b.currentTarget||(b.preventDefault(),s({type:"DRAGGING.START"}))},onWheel:Yc(b=>{let f=o("orientation")==="horizontal"?"deltaX":"deltaY";b[f]<0&&!r("canScrollPrev")||b[f]>0&&!r("canScrollNext")||s({type:"USER.SCROLL"})},150),onTouchStart(){s({type:"USER.SCROLL"})},style:{display:d?"flex":"grid",gap:"var(--slide-spacing)",scrollSnapType:[m?"x":"y",o("snapType")].join(" "),gridAutoFlow:m?"column":"row",scrollbarWidth:"none",overscrollBehaviorX:"contain",[m?"gridAutoColumns":"gridAutoRows"]:d?void 0:"var(--slide-item-size)",[m?"scrollPaddingInline":"scrollPaddingBlock"]:T,[m?"paddingInline":"paddingBlock"]:T,[m?"overflowX":"overflowY"]:"auto"}}))},getItemProps(b){let f=i.get("slidesInView").includes(b.index);return t.element(y(g({},kt.item.attrs),{id:Ny(a,b.index),dir:o("dir"),role:"group","data-index":b.index,"data-inview":E(f),"aria-roledescription":"slide","data-orientation":o("orientation"),"aria-label":O.item(b.index,o("slideCount")),"aria-hidden":X(!f),style:{flex:"0 0 auto",[m?"maxWidth":"maxHeight"]:"100%",scrollSnapAlign:(()=>{var x;let S=(x=b.snapAlign)!=null?x:"start",P=o("slidesPerMove"),V=P==="auto"?Math.floor(o("slidesPerPage")):P;return(b.index+V)%V===0?S:void 0})()}}))},getControlProps(){return t.element(y(g({},kt.control.attrs),{"data-orientation":o("orientation")}))},getPrevTriggerProps(){return t.button(y(g({},kt.prevTrigger.attrs),{id:Dy(a),type:"button",disabled:!h,dir:o("dir"),"aria-label":O.prevTrigger,"data-orientation":o("orientation"),"aria-controls":Os(a),onClick(b){b.defaultPrevented||s({type:"PAGE.PREV",src:"trigger"})}}))},getNextTriggerProps(){return t.button(y(g({},kt.nextTrigger.attrs),{dir:o("dir"),id:Ry(a),type:"button","aria-label":O.nextTrigger,"data-orientation":o("orientation"),"aria-controls":Os(a),disabled:!u,onClick(b){b.defaultPrevented||s({type:"PAGE.NEXT",src:"trigger"})}}))},getIndicatorGroupProps(){return t.element(y(g({},kt.indicatorGroup.attrs),{dir:o("dir"),id:Ly(a),"data-orientation":o("orientation"),onKeyDown(b){if(b.defaultPrevented)return;let f="indicator",S={ArrowDown(A){m||(s({type:"PAGE.NEXT",src:f}),A.preventDefault())},ArrowUp(A){m||(s({type:"PAGE.PREV",src:f}),A.preventDefault())},ArrowRight(A){m&&(s({type:"PAGE.NEXT",src:f}),A.preventDefault())},ArrowLeft(A){m&&(s({type:"PAGE.PREV",src:f}),A.preventDefault())},Home(A){s({type:"PAGE.SET",index:0,src:f}),A.preventDefault()},End(A){s({type:"PAGE.SET",index:p.length-1,src:f}),A.preventDefault()}},P=ge(b,{dir:o("dir"),orientation:o("orientation")}),V=S[P];V==null||V(b)}}))},getIndicatorProps(b){return t.button(y(g({},kt.indicator.attrs),{dir:o("dir"),id:Uu(a,b.index),type:"button","data-orientation":o("orientation"),"data-index":b.index,"data-readonly":E(b.readOnly),"data-current":E(b.index===v),"aria-label":O.indicator(b.index),onClick(f){f.defaultPrevented||b.readOnly||s({type:"PAGE.SET",index:b.index,src:"indicator"})}}))},getAutoplayTriggerProps(){return t.button(y(g({},kt.autoplayTrigger.attrs),{type:"button","data-orientation":o("orientation"),"data-pressed":E(l),"aria-label":l?O.autoplayStop:O.autoplayStart,onClick(b){b.defaultPrevented||s({type:l?"AUTOPLAY.PAUSE":"AUTOPLAY.START"})}}))},getProgressTextProps(){return t.element(g({},kt.progressText.attrs))}}}function Hy(e,t,n){if(e==null||n<=0)return[];let i=[],r=t==="auto"?Math.floor(n):t;if(r<=0)return[];for(let s=0;se);s+=r)i.push(s);return i}var Po,Eo,Io,Ay,kt,ky,Ny,Os,Ry,Dy,Ly,Uu,qe,$u,My,Hu,$y,By,O0,_y,w0,Gy,V0,Uy,qy,Wu=re(()=>{"use strict";se();Po=e=>at(e).direction;Eo=e=>[...new Set(e)],Io=(e,t)=>n=>Math.max(e,Math.min(t,n)),Ay=U("carousel").parts("root","itemGroup","item","control","nextTrigger","prevTrigger","indicatorGroup","indicator","autoplayTrigger","progressText"),kt=Ay.build(),ky=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`carousel:${e.id}`},Ny=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`carousel:${e.id}:item:${t}`},Os=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.itemGroup)!=null?n:`carousel:${e.id}:item-group`},Ry=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.nextTrigger)!=null?n:`carousel:${e.id}:next-trigger`},Dy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.prevTrigger)!=null?n:`carousel:${e.id}:prev-trigger`},Ly=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicatorGroup)!=null?n:`carousel:${e.id}:indicator-group`},Uu=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.indicator)==null?void 0:i.call(n,t))!=null?r:`carousel:${e.id}:indicator:${t}`},qe=e=>e.getById(Os(e)),$u=e=>Fe(qe(e),"[data-part=item]"),My=(e,t)=>e.getById(Uu(e,t)),Hu=e=>{let t=qe(e);if(!t)return;let n=jt(t);t.setAttribute("tabindex",n.length>0?"-1":"0")};$y={props({props:e}){return yn(e,["slideCount"],"carousel"),y(g({dir:"ltr",defaultPage:0,orientation:"horizontal",snapType:"mandatory",loop:!!e.autoplay,slidesPerPage:1,slidesPerMove:"auto",spacing:"0px",autoplay:!1,allowMouseDrag:!1,inViewThreshold:.6,autoSize:!1},e),{translations:g({nextTrigger:"Next slide",prevTrigger:"Previous slide",indicator:t=>`Go to slide ${t+1}`,item:(t,n)=>`${t+1} of ${n}`,autoplayStart:"Start slide rotation",autoplayStop:"Stop slide rotation",progressText:({page:t,totalPages:n})=>`${t} / ${n}`},e.translations)})},refs(){return{timeoutRef:void 0}},initialState({prop:e}){return e("autoplay")?"autoplay":"idle"},context({prop:e,bindable:t,getContext:n}){return{page:t(()=>({defaultValue:e("defaultPage"),value:e("page"),onChange(i){var a;let s=n().get("pageSnapPoints");(a=e("onPageChange"))==null||a({page:i,pageSnapPoint:s[i]})}})),pageSnapPoints:t(()=>({defaultValue:e("autoSize")?Array.from({length:e("slideCount")},(i,r)=>r):Hy(e("slideCount"),e("slidesPerMove"),e("slidesPerPage"))})),slidesInView:t(()=>({defaultValue:[]}))}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",isHorizontal:({prop:e})=>e("orientation")==="horizontal",canScrollNext:({prop:e,context:t})=>e("loop")||t.get("page")e("loop")||t.get("page")>0,autoplayInterval:({prop:e})=>{let t=e("autoplay");return xt(t)?t.delay:4e3}},watch({track:e,action:t,context:n,prop:i,send:r}){e([()=>i("slidesPerPage"),()=>i("slidesPerMove")],()=>{t(["setSnapPoints"])}),e([()=>n.get("page")],()=>{t(["scrollToPage","focusIndicatorEl"])}),e([()=>i("orientation"),()=>i("autoSize"),()=>i("dir")],()=>{t(["setSnapPoints","scrollToPage"])}),e([()=>i("slideCount")],()=>{r({type:"SNAP.REFRESH",src:"slide.count"})}),e([()=>!!i("autoplay")],()=>{r({type:i("autoplay")?"AUTOPLAY.START":"AUTOPLAY.PAUSE",src:"autoplay.prop.change"})})},on:{"PAGE.NEXT":{target:"idle",actions:["clearScrollEndTimer","setNextPage"]},"PAGE.PREV":{target:"idle",actions:["clearScrollEndTimer","setPrevPage"]},"PAGE.SET":{target:"idle",actions:["clearScrollEndTimer","setPage"]},"INDEX.SET":{target:"idle",actions:["clearScrollEndTimer","setMatchingPage"]},"SNAP.REFRESH":{actions:["setSnapPoints","clampPage"]},"PAGE.SCROLL":{actions:["scrollToPage"]}},effects:["trackSlideMutation","trackSlideIntersections","trackSlideResize"],entry:["setSnapPoints","setPage"],exit:["clearScrollEndTimer"],states:{idle:{on:{"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"AUTOPLAY.START":{target:"autoplay",actions:["invokeAutoplayStart"]},"USER.SCROLL":{target:"userScroll"},"VIEWPORT.FOCUS":{target:"focus"}}},focus:{effects:["trackKeyboardScroll"],on:{"VIEWPORT.BLUR":{target:"idle"},"PAGE.NEXT":{actions:["clearScrollEndTimer","setNextPage"]},"PAGE.PREV":{actions:["clearScrollEndTimer","setPrevPage"]},"PAGE.SET":{actions:["clearScrollEndTimer","setPage"]},"INDEX.SET":{actions:["clearScrollEndTimer","setMatchingPage"]},"USER.SCROLL":{target:"userScroll"}}},dragging:{effects:["trackPointerMove"],entry:["disableScrollSnap"],on:{DRAGGING:{actions:["scrollSlides","invokeDragging"]},"DRAGGING.END":{target:"idle",actions:["endDragging","invokeDraggingEnd"]}}},userScroll:{effects:["trackScroll"],on:{"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"SCROLL.END":[{guard:"isFocused",target:"focus",actions:["setClosestPage"]},{target:"idle",actions:["setClosestPage"]}]}},autoplay:{effects:["trackDocumentVisibility","trackScroll","autoUpdateSlide"],exit:["invokeAutoplayEnd"],on:{"AUTOPLAY.TICK":{actions:["setNextPage","invokeAutoplay"]},"DRAGGING.START":{target:"dragging",actions:["invokeDragStart"]},"AUTOPLAY.PAUSE":{target:"idle"}}}},implementations:{guards:{isFocused:({scope:e})=>e.isActiveElement(qe(e))},effects:{autoUpdateSlide({computed:e,send:t}){let n=setInterval(()=>{t({type:e("canScrollNext")?"AUTOPLAY.TICK":"AUTOPLAY.PAUSE",src:"autoplay.interval"})},e("autoplayInterval"));return()=>clearInterval(n)},trackSlideMutation({scope:e,send:t}){let n=qe(e);if(!n)return;let i=e.getWin(),r=new i.MutationObserver(()=>{t({type:"SNAP.REFRESH",src:"slide.mutation"}),Hu(e)});return Hu(e),r.observe(n,{childList:!0,subtree:!0}),()=>r.disconnect()},trackSlideResize({scope:e,send:t}){if(!qe(e))return;let i=()=>{t({type:"SNAP.REFRESH",src:"slide.resize"})};H(()=>{i(),H(()=>{t({type:"PAGE.SCROLL",instant:!0})})});let r=$u(e);r.forEach(i);let s=r.map(a=>gn.observe(a,i));return At(...s)},trackSlideIntersections({scope:e,prop:t,context:n}){let i=qe(e),r=e.getWin(),s=new r.IntersectionObserver(a=>{let o=a.reduce((l,c)=>{var m;let u=c.target,h=Number((m=u.dataset.index)!=null?m:"-1");return h==null||Number.isNaN(h)||h===-1?l:c.isIntersecting?Ze(l,h):ct(l,h)},n.get("slidesInView"));n.set("slidesInView",vt(o))},{root:i,threshold:t("inViewThreshold")});return $u(e).forEach(a=>s.observe(a)),()=>s.disconnect()},trackScroll({send:e,refs:t,scope:n}){let i=qe(n);return i?ee(i,"scroll",()=>{clearTimeout(t.get("timeoutRef")),t.set("timeoutRef",void 0),t.set("timeoutRef",setTimeout(()=>{e({type:"SCROLL.END"})},150))},{passive:!0}):void 0},trackDocumentVisibility({scope:e,send:t}){let n=e.getDoc();return ee(n,"visibilitychange",()=>{n.visibilityState!=="visible"&&t({type:"AUTOPLAY.PAUSE",src:"doc.hidden"})})},trackPointerMove({scope:e,send:t}){let n=e.getDoc();return hn(n,{onPointerMove({event:i}){t({type:"DRAGGING",left:-i.movementX,top:-i.movementY})},onPointerUp(){t({type:"DRAGGING.END"})}})},trackKeyboardScroll({scope:e,send:t,context:n}){let i=e.getWin();return ee(i,"keydown",s=>{switch(s.key){case"ArrowRight":s.preventDefault(),t({type:"PAGE.NEXT"});break;case"ArrowLeft":s.preventDefault(),t({type:"PAGE.PREV"});break;case"Home":s.preventDefault(),t({type:"PAGE.SET",index:0});break;case"End":s.preventDefault(),t({type:"PAGE.SET",index:n.get("pageSnapPoints").length-1})}},{capture:!0})}},actions:{clearScrollEndTimer({refs:e}){e.get("timeoutRef")!=null&&(clearTimeout(e.get("timeoutRef")),e.set("timeoutRef",void 0))},scrollToPage({context:e,event:t,scope:n,computed:i,flush:r}){var c;let s=t.instant?"instant":"smooth",a=He((c=t.index)!=null?c:e.get("page"),0,e.get("pageSnapPoints").length-1),o=qe(n);if(!o)return;let l=i("isHorizontal")?"left":"top";r(()=>{o.scrollTo({[l]:e.get("pageSnapPoints")[a],behavior:s})})},setClosestPage({context:e,scope:t,computed:n}){let i=qe(t);if(!i)return;let r=n("isHorizontal")?i.scrollLeft:i.scrollTop,s=e.get("pageSnapPoints").findIndex(a=>Math.abs(a-r)<1);s!==-1&&e.set("page",s)},setNextPage({context:e,prop:t,state:n}){let i=n.matches("autoplay")||t("loop"),r=Ei(e.get("pageSnapPoints"),e.get("page"),{loop:i});e.set("page",r)},setPrevPage({context:e,prop:t,state:n}){let i=n.matches("autoplay")||t("loop"),r=lr(e.get("pageSnapPoints"),e.get("page"),{loop:i});e.set("page",r)},setMatchingPage({context:e,event:t,computed:n,scope:i}){let r=qe(i);if(!r)return;let s=xy(r,n("isHorizontal")?"x":"y",o=>o.dataset.index===t.index.toString());if(s==null)return;let a=e.get("pageSnapPoints").findIndex(o=>Math.abs(o-s)<1);e.set("page",a)},setPage({context:e,event:t}){var i;let n=(i=t.index)!=null?i:e.get("page");e.set("page",n)},clampPage({context:e}){let t=He(e.get("page"),0,e.get("pageSnapPoints").length-1);e.set("page",t)},setSnapPoints({context:e,computed:t,scope:n}){let i=qe(n);if(!i)return;let r=Vy(i);e.set("pageSnapPoints",t("isHorizontal")?r.x:r.y)},disableScrollSnap({scope:e}){let t=qe(e);if(!t)return;let n=getComputedStyle(t);t.dataset.scrollSnapType=n.getPropertyValue("scroll-snap-type"),t.style.setProperty("scroll-snap-type","none")},scrollSlides({scope:e,event:t}){let n=qe(e);n==null||n.scrollBy({left:t.left,top:t.top,behavior:"instant"})},endDragging({scope:e,context:t,computed:n}){let i=qe(e);if(!i)return;let r=n("isHorizontal"),s=r?i.scrollLeft:i.scrollTop,a=t.get("pageSnapPoints"),o=a.reduce((l,c)=>Math.abs(c-s){i.scrollTo({left:r?o:i.scrollLeft,top:r?i.scrollTop:o,behavior:"smooth"}),t.set("page",a.indexOf(o));let l=i.dataset.scrollSnapType;l&&(i.style.setProperty("scroll-snap-type",l),delete i.dataset.scrollSnapType)})},focusIndicatorEl({context:e,event:t,scope:n}){if(t.src!=="indicator")return;let i=My(n,e.get("page"));i&&H(()=>i.focus({preventScroll:!0}))},invokeDragStart({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging.start",isDragging:!0,page:e.get("page")})},invokeDragging({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging",isDragging:!0,page:e.get("page")})},invokeDraggingEnd({context:e,prop:t}){var n;(n=t("onDragStatusChange"))==null||n({type:"dragging.end",isDragging:!1,page:e.get("page")})},invokeAutoplay({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay",isPlaying:!0,page:e.get("page")})},invokeAutoplayStart({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay.start",isPlaying:!0,page:e.get("page")})},invokeAutoplayEnd({context:e,prop:t}){var n;(n=t("onAutoplayStatusChange"))==null||n({type:"autoplay.stop",isPlaying:!1,page:e.get("page")})}}}};By=_()(["dir","getRootNode","id","ids","loop","page","defaultPage","onPageChange","orientation","slideCount","slidesPerPage","slidesPerMove","spacing","padding","autoplay","allowMouseDrag","inViewThreshold","translations","snapType","autoSize","onDragStatusChange","onAutoplayStatusChange"]),O0=B(By),_y=_()(["index","readOnly"]),w0=B(_y),Gy=_()(["index","snapAlign"]),V0=B(Gy),Uy=class extends K{initMachine(e){return new W($y,e)}initApi(){return Fy(this.machine.service,q)}render(){var u;let e=(u=this.el.querySelector('[data-scope="carousel"][data-part="root"]'))!=null?u:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="carousel"][data-part="control"]');t&&this.spreadProps(t,this.api.getControlProps());let n=this.el.querySelector('[data-scope="carousel"][data-part="item-group"]');n&&this.spreadProps(n,this.api.getItemGroupProps());let i=Number(this.el.dataset.slideCount)||0;for(let h=0;h{let h=w(e,"onPageChange");h&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(h,{page:u.page,pageSnapPoint:u.pageSnapPoint,id:e.id});let m=w(e,"onPageChangeClient");m&&e.dispatchEvent(new CustomEvent(m,{bubbles:!0,detail:{value:u,id:e.id}}))}}));s.init(),this.carousel=s,this.handlers=[]},updated(){var i,r;let e=Y(this.el,"slideCount");if(e==null||e<1)return;let t=Y(this.el,"page"),n=C(this.el,"controlled");(r=this.carousel)==null||r.updateProps(y(g({id:this.el.id,slideCount:e},n&&t!==void 0?{page:t}:{}),{dir:Oe(this.el),orientation:w(this.el,"orientation",["horizontal","vertical"]),slidesPerPage:(i=Y(this.el,"slidesPerPage"))!=null?i:1,loop:C(this.el,"loop"),allowMouseDrag:C(this.el,"allowMouseDrag")}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.carousel)==null||e.destroy()}}});function Wy(e){return!(e.metaKey||!di()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function zy(e,t,n){let i=n?j(n):null,r=ue(i);return e=e||i instanceof r.HTMLInputElement&&!Ky.has(i==null?void 0:i.type)||i instanceof r.HTMLTextAreaElement||i instanceof r.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof r.KeyboardEvent&&!Reflect.has(Yy,n.key))}function xs(e,t){for(let n of Co)n(e,t)}function Vs(e){Un=!0,Wy(e)&&(In="keyboard",xs("keyboard",e))}function dt(e){In="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Un=!0,xs("pointer",e))}function Ku(e){Vc(e)&&(Un=!0,In="virtual")}function zu(e){let t=j(e);t===ue(t)||t===Le(t)||(!Un&&!So&&(In="virtual",xs("virtual",e)),Un=!1,So=!1)}function Yu(){Un=!1,So=!0}function jy(e){if(typeof window=="undefined"||ws.get(ue(e)))return;let t=ue(e),n=Le(e),i=t.HTMLElement.prototype.focus;function r(){In="virtual",xs("virtual",null),Un=!0,i.apply(this,arguments)}try{Object.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,value:r})}catch(s){}n.addEventListener("keydown",Vs,!0),n.addEventListener("keyup",Vs,!0),n.addEventListener("click",Ku,!0),t.addEventListener("focus",zu,!0),t.addEventListener("blur",Yu,!1),typeof t.PointerEvent!="undefined"?(n.addEventListener("pointerdown",dt,!0),n.addEventListener("pointermove",dt,!0),n.addEventListener("pointerup",dt,!0)):(n.addEventListener("mousedown",dt,!0),n.addEventListener("mousemove",dt,!0),n.addEventListener("mouseup",dt,!0)),t.addEventListener("beforeunload",()=>{Xy(e)},{once:!0}),ws.set(t,{focus:i})}function ju(){return In}function En(){return In==="keyboard"}function Pn(e={}){let{isTextInput:t,autoFocus:n,onChange:i,root:r}=e;jy(r),i==null||i({isFocusVisible:n||En(),modality:In});let s=(a,o)=>{zy(!!t,a,o)&&(i==null||i({isFocusVisible:En(),modality:a}))};return Co.add(s),()=>{Co.delete(s)}}var Ky,In,Co,ws,Un,So,Yy,Xy,pr=re(()=>{"use strict";se();Ky=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);In=null,Co=new Set,ws=new Map,Un=!1,So=!1,Yy={Tab:!0,Escape:!0};Xy=(e,t)=>{let n=ue(e),i=Le(e),r=ws.get(n);if(r){try{Object.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,value:r.focus})}catch(s){}i.removeEventListener("keydown",Vs,!0),i.removeEventListener("keyup",Vs,!0),i.removeEventListener("click",Ku,!0),n.removeEventListener("focus",zu,!0),n.removeEventListener("blur",Yu,!1),typeof n.PointerEvent!="undefined"?(i.removeEventListener("pointerdown",dt,!0),i.removeEventListener("pointermove",dt,!0),i.removeEventListener("pointerup",dt,!0)):(i.removeEventListener("mousedown",dt,!0),i.removeEventListener("mousemove",dt,!0),i.removeEventListener("mouseup",dt,!0)),ws.delete(n)}}});var Qu={};he(Qu,{Checkbox:()=>sb});function eb(e,t){let{send:n,context:i,prop:r,computed:s,scope:a}=e,o=!!r("disabled"),l=!!r("readOnly"),c=!!r("required"),u=!!r("invalid"),h=!o&&i.get("focused"),m=!o&&i.get("focusVisible"),d=s("checked"),p=s("indeterminate"),v=i.get("checked"),I={"data-active":E(i.get("active")),"data-focus":E(h),"data-focus-visible":E(m),"data-readonly":E(l),"data-hover":E(i.get("hovered")),"data-disabled":E(o),"data-state":p?"indeterminate":d?"checked":"unchecked","data-invalid":E(u),"data-required":E(c)};return{checked:d,disabled:o,indeterminate:p,focused:h,checkedState:v,setChecked(T){n({type:"CHECKED.SET",checked:T,isTrusted:!1})},toggleChecked(){n({type:"CHECKED.TOGGLE",checked:d,isTrusted:!1})},getRootProps(){return t.label(y(g(g({},As.root.attrs),I),{dir:r("dir"),id:Ju(a),htmlFor:To(a),onPointerMove(){o||n({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){o||n({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(T){j(T)===fr(a)&&T.stopPropagation()}}))},getLabelProps(){return t.element(y(g(g({},As.label.attrs),I),{dir:r("dir"),id:Xu(a)}))},getControlProps(){return t.element(y(g(g({},As.control.attrs),I),{dir:r("dir"),id:Jy(a),"aria-hidden":!0}))},getIndicatorProps(){return t.element(y(g(g({},As.indicator.attrs),I),{dir:r("dir"),hidden:!p&&!d}))},getHiddenInputProps(){return t.input({id:To(a),type:"checkbox",required:r("required"),defaultChecked:d,disabled:o,"aria-labelledby":Xu(a),"aria-invalid":u,name:r("name"),form:r("form"),value:r("value"),style:Vt,onFocus(){let T=En();n({type:"CONTEXT.SET",context:{focused:!0,focusVisible:T}})},onBlur(){n({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(T){if(l){T.preventDefault();return}let O=T.currentTarget.checked;n({type:"CHECKED.SET",checked:O,isTrusted:!0})}})}}}function ks(e){return e==="indeterminate"}function nb(e){return ks(e)?!1:!!e}var Zy,As,Ju,Xu,Jy,To,Qy,fr,Zu,tb,ib,L0,rb,sb,ed=re(()=>{"use strict";pr();se();Zy=U("checkbox").parts("root","label","control","indicator"),As=Zy.build(),Ju=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`checkbox:${e.id}`},Xu=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`checkbox:${e.id}:label`},Jy=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`checkbox:${e.id}:control`},To=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`checkbox:${e.id}:input`},Qy=e=>e.getById(Ju(e)),fr=e=>e.getById(To(e));({not:Zu}=Ee()),tb={props({props:e}){var t;return y(g({value:"on"},e),{defaultChecked:(t=e.defaultChecked)!=null?t:!1})},initialState(){return"ready"},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e("defaultChecked"),value:e("checked"),onChange(n){var i;(i=e("onCheckedChange"))==null||i({checked:n})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},watch({track:e,context:t,prop:n,action:i}){e([()=>n("disabled")],()=>{i(["removeFocusIfNeeded"])}),e([()=>t.get("checked")],()=>{i(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Zu("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Zu("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{indeterminate:({context:e})=>ks(e.get("checked")),checked:({context:e})=>nb(e.get("checked")),disabled:({context:e,prop:t})=>!!t("disabled")||e.get("fieldsetDisabled")},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({context:e,computed:t,scope:n}){if(!t("disabled"))return ps({pointerNode:Qy(n),keyboardNode:fr(n),isValidKey:i=>i.key===" ",onPress:()=>e.set("active",!1),onPressStart:()=>e.set("active",!0),onPressEnd:()=>e.set("active",!1)})},trackFocusVisible({computed:e,scope:t}){var n;if(!e("disabled"))return Pn({root:(n=t.getRootNode)==null?void 0:n.call(t)})},trackFormControlState({context:e,scope:t}){return wt(fr(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){e.set("checked",e.initial("checked"))}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,computed:t,scope:n}){let i=fr(n);i&&(sr(i,t("checked")),i.indeterminate=ks(e.get("checked")))},removeFocusIfNeeded({context:e,prop:t}){t("disabled")&&e.get("focused")&&(e.set("focused",!1),e.set("focusVisible",!1))},setChecked({context:e,event:t}){e.set("checked",t.checked)},toggleChecked({context:e,computed:t}){let n=ks(t("checked"))?!0:!t("checked");e.set("checked",n)},dispatchChangeEvent({computed:e,scope:t}){queueMicrotask(()=>{let n=fr(t);pi(n,{checked:e("checked")})})}}}};ib=_()(["defaultChecked","checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]),L0=B(ib),rb=class extends K{initMachine(e){return new W(tb,e)}initApi(){return eb(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="checkbox"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector(':scope > [data-scope="checkbox"][data-part="hidden-input"]');t&&this.spreadProps(t,this.api.getHiddenInputProps());let n=e.querySelector(':scope > [data-scope="checkbox"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=e.querySelector(':scope > [data-scope="checkbox"][data-part="control"]');if(i){this.spreadProps(i,this.api.getControlProps());let r=i.querySelector(':scope > [data-scope="checkbox"][data-part="indicator"]');r&&this.spreadProps(r,this.api.getIndicatorProps())}}},sb={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=new rb(e,y(g({id:e.id},C(e,"controlled")?{checked:C(e,"checked")}:{defaultChecked:C(e,"defaultChecked")}),{disabled:C(e,"disabled"),name:w(e,"name"),form:w(e,"form"),value:w(e,"value"),dir:Oe(e),invalid:C(e,"invalid"),required:C(e,"required"),readOnly:C(e,"readOnly"),onCheckedChange:i=>{let r=w(e,"onCheckedChange");r&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(r,{checked:i.checked,id:e.id});let s=w(e,"onCheckedChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{value:i,id:e.id}}))}}));n.init(),this.checkbox=n,this.onSetChecked=i=>{let{checked:r}=i.detail;n.api.setChecked(r)},e.addEventListener("phx:checkbox:set-checked",this.onSetChecked),this.onToggleChecked=()=>{n.api.toggleChecked()},e.addEventListener("phx:checkbox:toggle-checked",this.onToggleChecked),this.handlers=[],this.handlers.push(this.handleEvent("checkbox_set_checked",i=>{let r=i.id;r&&r!==e.id||n.api.setChecked(i.checked)})),this.handlers.push(this.handleEvent("checkbox_toggle_checked",i=>{let r=i.id;r&&r!==e.id||n.api.toggleChecked()})),this.handlers.push(this.handleEvent("checkbox_checked",()=>{this.pushEvent("checkbox_checked_response",{value:n.api.checked})})),this.handlers.push(this.handleEvent("checkbox_focused",()=>{this.pushEvent("checkbox_focused_response",{value:n.api.focused})})),this.handlers.push(this.handleEvent("checkbox_disabled",()=>{this.pushEvent("checkbox_disabled_response",{value:n.api.disabled})}))},updated(){var e;(e=this.checkbox)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{checked:C(this.el,"checked")}:{defaultChecked:C(this.el,"defaultChecked")}),{disabled:C(this.el,"disabled"),name:w(this.el,"name"),form:w(this.el,"form"),value:w(this.el,"value"),dir:Oe(this.el),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly"),label:w(this.el,"label")}))},destroyed(){var e;if(this.onSetChecked&&this.el.removeEventListener("phx:checkbox:set-checked",this.onSetChecked),this.onToggleChecked&&this.el.removeEventListener("phx:checkbox:toggle-checked",this.onToggleChecked),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.checkbox)==null||e.destroy()}}});var td={};he(td,{Clipboard:()=>bb});function db(e,t){let n=e.createElement("pre");return Object.assign(n.style,{width:"1px",height:"1px",position:"fixed",top:"5px"}),n.textContent=t,n}function hb(e){let n=ue(e).getSelection();if(n==null)return Promise.reject(new Error);n.removeAllRanges();let i=e.ownerDocument,r=i.createRange();return r.selectNodeContents(e),n.addRange(r),i.execCommand("copy"),n.removeAllRanges(),Promise.resolve()}function gb(e,t){var r;let n=e.defaultView||window;if(((r=n.navigator.clipboard)==null?void 0:r.writeText)!==void 0)return n.navigator.clipboard.writeText(t);if(!e.body)return Promise.reject(new Error);let i=db(e,t);return e.body.appendChild(i),hb(i),e.body.removeChild(i),Promise.resolve()}function pb(e,t){let{state:n,send:i,context:r,scope:s}=e,a=n.matches("copied");return{copied:a,value:r.get("value"),setValue(o){i({type:"VALUE.SET",value:o})},copy(){i({type:"COPY"})},getRootProps(){return t.element(y(g({},Oi.root.attrs),{"data-copied":E(a),id:ob(s)}))},getLabelProps(){return t.label(y(g({},Oi.label.attrs),{htmlFor:Oo(s),"data-copied":E(a),id:lb(s)}))},getControlProps(){return t.element(y(g({},Oi.control.attrs),{"data-copied":E(a)}))},getInputProps(){return t.input(y(g({},Oi.input.attrs),{defaultValue:r.get("value"),"data-copied":E(a),readOnly:!0,"data-readonly":"true",id:Oo(s),onFocus(o){o.currentTarget.select()},onCopy(){i({type:"INPUT.COPY"})}}))},getTriggerProps(){return t.button(y(g({},Oi.trigger.attrs),{type:"button","aria-label":a?"Copied to clipboard":"Copy to clipboard","data-copied":E(a),onClick(){i({type:"COPY"})}}))},getIndicatorProps(o){return t.element(y(g({},Oi.indicator.attrs),{hidden:o.copied!==a}))}}}var ab,Oi,ob,Oo,lb,cb,ub,fb,mb,H0,vb,B0,yb,bb,nd=re(()=>{"use strict";se();ab=U("clipboard").parts("root","control","trigger","indicator","input","label"),Oi=ab.build(),ob=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`clip:${e.id}`},Oo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`clip:${e.id}:input`},lb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`clip:${e.id}:label`},cb=e=>e.getById(Oo(e)),ub=(e,t)=>gb(e.getDoc(),t);fb={props({props:e}){return g({timeout:3e3,defaultValue:""},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}}))}},watch({track:e,context:t,action:n}){e([()=>t.get("value")],()=>{n(["syncInputElement"])})},on:{"VALUE.SET":{actions:["setValue"]},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]}},states:{idle:{on:{"INPUT.COPY":{target:"copied",actions:["invokeOnCopy"]}}},copied:{effects:["waitForTimeout"],on:{"COPY.DONE":{target:"idle"},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]},"INPUT.COPY":{actions:["invokeOnCopy"]}}}},implementations:{effects:{waitForTimeout({prop:e,send:t}){return mn(()=>{t({type:"COPY.DONE"})},e("timeout"))}},actions:{setValue({context:e,event:t}){e.set("value",t.value)},copyToClipboard({context:e,scope:t}){ub(t,e.get("value"))},invokeOnCopy({prop:e}){var t;(t=e("onStatusChange"))==null||t({copied:!0})},syncInputElement({context:e,scope:t}){let n=cb(t);n&&Me(n,e.get("value"))}}}},mb=_()(["getRootNode","id","ids","value","defaultValue","timeout","onStatusChange","onValueChange"]),H0=B(mb),vb=_()(["copied"]),B0=B(vb),yb=class extends K{initMachine(e){return new W(fb,e)}initApi(){return pb(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="clipboard"][data-part="root"]');if(e){this.spreadProps(e,this.api.getRootProps());let t=e.querySelector('[data-scope="clipboard"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=e.querySelector('[data-scope="clipboard"][data-part="control"]');if(n){this.spreadProps(n,this.api.getControlProps());let i=n.querySelector('[data-scope="clipboard"][data-part="input"]');if(i){let s=g({},this.api.getInputProps()),a=this.el.dataset.inputAriaLabel;a&&(s["aria-label"]=a),this.spreadProps(i,s)}let r=n.querySelector('[data-scope="clipboard"][data-part="trigger"]');if(r){let s=g({},this.api.getTriggerProps()),a=this.el.dataset.triggerAriaLabel;a&&(s["aria-label"]=a),this.spreadProps(r,s)}}}}},bb={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=this.liveSocket,i=new yb(e,y(g({id:e.id,timeout:Y(e,"timeout")},C(e,"controlled")?{value:w(e,"value")}:{defaultValue:w(e,"defaultValue")}),{onValueChange:r=>{var a;let s=w(e,"onValueChange");s&&n.main.isConnected()&&t(s,{id:e.id,value:(a=r.value)!=null?a:null})},onStatusChange:r=>{let s=w(e,"onStatusChange");s&&n.main.isConnected()&&t(s,{id:e.id,copied:r.copied});let a=w(e,"onStatusChangeClient");a&&e.dispatchEvent(new CustomEvent(a,{bubbles:!0}))}}));i.init(),this.clipboard=i,this.onCopy=()=>{i.api.copy()},e.addEventListener("phx:clipboard:copy",this.onCopy),this.onSetValue=r=>{let{value:s}=r.detail;i.api.setValue(s)},e.addEventListener("phx:clipboard:set-value",this.onSetValue),this.handlers=[],this.handlers.push(this.handleEvent("clipboard_copy",r=>{let s=r.clipboard_id;s&&s!==e.id||i.api.copy()})),this.handlers.push(this.handleEvent("clipboard_set_value",r=>{let s=r.clipboard_id;s&&s!==e.id||i.api.setValue(r.value)})),this.handlers.push(this.handleEvent("clipboard_copied",()=>{this.pushEvent("clipboard_copied_response",{value:i.api.copied})}))},updated(){var e;(e=this.clipboard)==null||e.updateProps(y(g({id:this.el.id,timeout:Y(this.el,"timeout")},C(this.el,"controlled")?{value:w(this.el,"value")}:{defaultValue:w(this.el,"value")}),{dir:w(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onCopy&&this.el.removeEventListener("phx:clipboard:copy",this.onCopy),this.onSetValue&&this.el.removeEventListener("phx:clipboard:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.clipboard)==null||e.destroy()}}});var id={};he(id,{Collapsible:()=>wb});function Cb(e,t){let{state:n,send:i,context:r,scope:s,prop:a}=e,o=n.matches("open")||n.matches("closing"),l=n.matches("open"),c=n.matches("closed"),{width:u,height:h}=r.get("size"),m=!!a("disabled"),d=a("collapsedHeight"),p=a("collapsedWidth"),v=d!=null,I=p!=null,T=v||I,O=!r.get("initial")&&l;return{disabled:m,visible:o,open:l,measureSize(){i({type:"size.measure"})},setOpen(b){n.matches("open")!==b&&i({type:b?"open":"close"})},getRootProps(){return t.element(y(g({},Ns.root.attrs),{"data-state":l?"open":"closed",dir:a("dir"),id:Ib(s)}))},getContentProps(){return t.element(y(g({},Ns.content.attrs),{id:wo(s),"data-collapsible":"","data-state":O?void 0:l?"open":"closed","data-disabled":E(m),"data-has-collapsed-size":E(T),hidden:!o&&!T,dir:a("dir"),style:g(g({"--height":ye(h),"--width":ye(u),"--collapsed-height":ye(d),"--collapsed-width":ye(p)},c&&v&&{overflow:"hidden",minHeight:ye(d),maxHeight:ye(d)}),c&&I&&{overflow:"hidden",minWidth:ye(p),maxWidth:ye(p)})}))},getTriggerProps(){return t.element(y(g({},Ns.trigger.attrs),{id:Pb(s),dir:a("dir"),type:"button","data-state":l?"open":"closed","data-disabled":E(m),"aria-controls":wo(s),"aria-expanded":o||!1,onClick(b){b.defaultPrevented||m||i({type:l?"close":"open"})}}))},getIndicatorProps(){return t.element(y(g({},Ns.indicator.attrs),{dir:a("dir"),"data-state":l?"open":"closed","data-disabled":E(m)}))}}}var Eb,Ns,Ib,wo,Pb,mr,Sb,Tb,q0,Ob,wb,rd=re(()=>{"use strict";se();Eb=U("collapsible").parts("root","trigger","content","indicator"),Ns=Eb.build(),Ib=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`collapsible:${e.id}`},wo=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`collapsible:${e.id}:content`},Pb=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`collapsible:${e.id}:trigger`},mr=e=>e.getById(wo(e));Sb={initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({bindable:e}){return{size:e(()=>({defaultValue:{height:0,width:0},sync:!0})),initial:e(()=>({defaultValue:!1}))}},refs(){return{cleanup:void 0,stylesRef:void 0}},watch({track:e,prop:t,action:n}){e([()=>t("open")],()=>{n(["setInitial","computeSize","toggleVisibility"])})},exit:["cleanupNode"],states:{closed:{effects:["trackTabbableElements"],on:{"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitial","computeSize","invokeOnOpen"]}]}},closing:{effects:["trackExitAnimation"],on:{"controlled.close":{target:"closed"},"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitial","invokeOnOpen"]}],close:[{guard:"isOpenControlled",actions:["invokeOnExitComplete"]},{target:"closed",actions:["setInitial","computeSize","invokeOnExitComplete"]}],"animation.end":{target:"closed",actions:["invokeOnExitComplete","clearInitial"]}}},open:{effects:["trackEnterAnimation"],on:{"controlled.close":{target:"closing"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closing",actions:["setInitial","computeSize","invokeOnClose"]}],"size.measure":{actions:["measureSize"]},"animation.end":{actions:["clearInitial"]}}}},implementations:{guards:{isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackEnterAnimation:({send:e,scope:t})=>{let n,i=H(()=>{let r=mr(t);if(!r)return;let s=at(r).animationName;if(!s||s==="none"){e({type:"animation.end"});return}let o=l=>{j(l)===r&&e({type:"animation.end"})};r.addEventListener("animationend",o),n=()=>{r.removeEventListener("animationend",o)}});return()=>{i(),n==null||n()}},trackExitAnimation:({send:e,scope:t})=>{let n,i=H(()=>{let r=mr(t);if(!r)return;let s=at(r).animationName;if(!s||s==="none"){e({type:"animation.end"});return}let o=c=>{j(c)===r&&e({type:"animation.end"})};r.addEventListener("animationend",o);let l=Hn(r,{animationFillMode:"forwards"});n=()=>{r.removeEventListener("animationend",o),$n(()=>l())}});return()=>{i(),n==null||n()}},trackTabbableElements:({scope:e,prop:t})=>{if(!t("collapsedHeight")&&!t("collapsedWidth"))return;let n=mr(e);if(!n)return;let i=()=>{let o=jt(n).map(l=>Fc(l,"inert",""));return()=>{o.forEach(l=>l())}},r=i(),s=hs(n,{callback(){r(),r=i()}});return()=>{r(),s()}}},actions:{setInitial:({context:e,flush:t})=>{t(()=>{e.set("initial",!0)})},clearInitial:({context:e})=>{e.set("initial",!1)},cleanupNode:({refs:e})=>{e.set("stylesRef",null)},measureSize:({context:e,scope:t})=>{let n=mr(t);if(!n)return;let{height:i,width:r}=n.getBoundingClientRect();e.set("size",{height:i,width:r})},computeSize:({refs:e,scope:t,context:n})=>{var r;(r=e.get("cleanup"))==null||r();let i=H(()=>{let s=mr(t);if(!s)return;let a=s.hidden;s.style.animationName="none",s.style.animationDuration="0s",s.hidden=!1;let o=s.getBoundingClientRect();n.set("size",{height:o.height,width:o.width}),n.get("initial")&&(s.style.animationName="",s.style.animationDuration=""),s.hidden=a});e.set("cleanup",i)},invokeOnOpen:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose:({prop:e})=>{var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnExitComplete:({prop:e})=>{var t;(t=e("onExitComplete"))==null||t()},toggleVisibility:({prop:e,send:t})=>{t({type:e("open")?"controlled.open":"controlled.close"})}}}},Tb=_()(["dir","disabled","getRootNode","id","ids","collapsedHeight","collapsedWidth","onExitComplete","onOpenChange","defaultOpen","open"]),q0=B(Tb),Ob=class extends K{initMachine(e){return new W(Sb,e)}initApi(){return Cb(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="collapsible"][data-part="root"]');if(e){this.spreadProps(e,this.api.getRootProps());let t=e.querySelector('[data-scope="collapsible"][data-part="trigger"]');t&&this.spreadProps(t,this.api.getTriggerProps());let n=e.querySelector('[data-scope="collapsible"][data-part="content"]');n&&this.spreadProps(n,this.api.getContentProps())}}},wb={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=new Ob(e,y(g({id:e.id},C(e,"controlled")?{open:C(e,"open")}:{defaultOpen:C(e,"defaultOpen")}),{disabled:C(e,"disabled"),dir:w(e,"dir",["ltr","rtl"]),onOpenChange:i=>{let r=w(e,"onOpenChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,open:i.open});let s=w(e,"onOpenChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,open:i.open}}))}}));n.init(),this.collapsible=n,this.onSetOpen=i=>{let{open:r}=i.detail;n.api.setOpen(r)},e.addEventListener("phx:collapsible:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("collapsible_set_open",i=>{let r=i.collapsible_id;r&&r!==e.id||n.api.setOpen(i.open)})),this.handlers.push(this.handleEvent("collapsible_open",()=>{this.pushEvent("collapsible_open_response",{value:n.api.open})}))},updated(){var e;(e=this.collapsible)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{open:C(this.el,"open")}:{defaultOpen:C(this.el,"defaultOpen")}),{disabled:C(this.el,"disabled"),dir:w(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onSetOpen&&this.el.removeEventListener("phx:collapsible:set-open",this.onSetOpen),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.collapsible)==null||e.destroy()}}});function vr(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function Rs(e,t,n){t=[...t].sort((r,s)=>r-s);let i=t.map(r=>e[r]);for(let r=t.length-1;r>=0;r--)e=[...e.slice(0,t[r]),...e.slice(t[r]+1)];return n=Math.max(0,n-t.filter(r=>rt[n])return 1}return e.length-t.length}function Nb(e){return e.sort(ud)}function Rb(e,t){let n;return Je(e,y(g({},t),{onEnter:(i,r)=>{if(t.predicate(i,r))return n=i,"stop"}})),n}function Db(e,t){let n=[];return Je(e,{onEnter:(i,r)=>{t.predicate(i,r)&&n.push(i)},getChildren:t.getChildren}),n}function sd(e,t){let n;return Je(e,{onEnter:(i,r)=>{if(t.predicate(i,r))return n=[...r],"stop"},getChildren:t.getChildren}),n}function Lb(e,t){let n=t.initialResult;return Je(e,y(g({},t),{onEnter:(i,r)=>{n=t.nextResult(n,i,r)}})),n}function Mb(e,t){return Lb(e,y(g({},t),{initialResult:[],nextResult:(n,i,r)=>(n.push(...t.transform(i,r)),n)}))}function Fb(e,t){let{predicate:n,create:i,getChildren:r}=t,s=(a,o)=>{let l=r(a,o),c=[];l.forEach((d,p)=>{let v=[...o,p],I=s(d,v);I&&c.push(I)});let u=o.length===0,h=n(a,o),m=c.length>0;return u||h||m?i(a,c,o):null};return s(e,[])||i(e,[],[])}function $b(e,t){let n=[],i=0,r=new Map,s=new Map;return Je(e,{getChildren:t.getChildren,onEnter:(a,o)=>{r.has(a)||r.set(a,i++);let l=t.getChildren(a,o);l.forEach(d=>{s.has(d)||s.set(d,a),r.has(d)||r.set(d,i++)});let c=l.length>0?l.map(d=>r.get(d)):void 0,u=s.get(a),h=u?r.get(u):void 0,m=r.get(a);n.push(y(g({},a),{_children:c,_parent:h,_index:m}))}}),n}function Hb(e,t){return{type:"insert",index:e,nodes:t}}function Bb(e){return{type:"remove",indexes:e}}function xo(){return{type:"replace"}}function dd(e){return[e.slice(0,-1),e[e.length-1]]}function hd(e,t,n=new Map){var a;let[i,r]=dd(e);for(let o=i.length-1;o>=0;o--){let l=i.slice(0,o).join();switch((a=n.get(l))==null?void 0:a.type){case"remove":continue}n.set(l,xo())}let s=n.get(i.join());switch(s==null?void 0:s.type){case"remove":n.set(i.join(),{type:"removeThenInsert",removeIndexes:s.indexes,insertIndex:r,insertNodes:t});break;default:n.set(i.join(),Hb(r,t))}return n}function gd(e){var i;let t=new Map,n=new Map;for(let r of e){let s=r.slice(0,-1).join(),a=(i=n.get(s))!=null?i:[];a.push(r[r.length-1]),n.set(s,a.sort((o,l)=>o-l))}for(let r of e)for(let s=r.length-2;s>=0;s--){let a=r.slice(0,s).join();t.has(a)||t.set(a,xo())}for(let[r,s]of n)t.set(r,Bb(s));return t}function _b(e,t){let n=new Map,[i,r]=dd(e);for(let s=i.length-1;s>=0;s--){let a=i.slice(0,s).join();n.set(a,xo())}return n.set(i.join(),{type:"removeThenInsert",removeIndexes:[r],insertIndex:r,insertNodes:[t]}),n}function Ms(e,t,n){return Gb(e,y(g({},n),{getChildren:(i,r)=>{let s=r.join(),a=t.get(s);switch(a==null?void 0:a.type){case"replace":case"remove":case"removeThenInsert":case"insert":return n.getChildren(i,r);default:return[]}},transform:(i,r,s)=>{let a=s.join(),o=t.get(a);switch(o==null?void 0:o.type){case"remove":return n.create(i,r.filter((u,h)=>!o.indexes.includes(h)),s);case"removeThenInsert":let l=r.filter((u,h)=>!o.removeIndexes.includes(h)),c=o.removeIndexes.reduce((u,h)=>h{var u,h;let s=[0,...r],a=s.join(),o=t.transform(i,(u=n[a])!=null?u:[],r),l=s.slice(0,-1).join(),c=(h=n[l])!=null?h:[];c.push(o),n[l]=c}})),n[""][0]}function Ub(e,t){let{nodes:n,at:i}=t;if(i.length===0)throw new Error("Can't insert nodes at the root");let r=hd(i,n);return Ms(e,r,t)}function qb(e,t){if(t.at.length===0)return t.node;let n=_b(t.at,t.node);return Ms(e,n,t)}function Wb(e,t){if(t.indexPaths.length===0)return e;for(let i of t.indexPaths)if(i.length===0)throw new Error("Can't remove the root node");let n=gd(t.indexPaths);return Ms(e,n,t)}function Kb(e,t){if(t.indexPaths.length===0)return e;for(let s of t.indexPaths)if(s.length===0)throw new Error("Can't move the root node");if(t.to.length===0)throw new Error("Can't move nodes to the root");let n=kb(t.indexPaths),i=n.map(s=>cd(e,s,t)),r=hd(t.to,i,gd(n));return Ms(e,r,t)}function Je(e,t){let{onEnter:n,onLeave:i,getChildren:r}=t,s=[],a=[{node:e}],o=t.reuseIndexPath?()=>s:()=>s.slice();for(;a.length>0;){let l=a[a.length-1];if(l.state===void 0){let u=n==null?void 0:n(l.node,o());if(u==="stop")return;l.state=u==="skip"?-1:0}let c=l.children||r(l.node,o());if(l.children||(l.children=c),l.state!==-1){if(l.state{"use strict";se();Vb=Object.defineProperty,xb=(e,t,n)=>t in e?Vb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t,n)=>xb(e,typeof t!="symbol"?t+"":t,n),Ds={itemToValue(e){return typeof e=="string"?e:xt(e)&&$e(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:xt(e)&&$e(e,"label")?e.label:Ds.itemToValue(e)},isItemDisabled(e){return xt(e)&&$e(e,"disabled")?!!e.disabled:!1}},Nt=class od{constructor(t){this.options=t,L(this,"items"),L(this,"indexMap",null),L(this,"copy",n=>new od(y(g({},this.options),{items:n!=null?n:[...this.items]}))),L(this,"isEqual",n=>fe(this.items,n.items)),L(this,"setItems",n=>this.copy(n)),L(this,"getValues",(n=this.items)=>{let i=[];for(let r of n){let s=this.getItemValue(r);s!=null&&i.push(s)}return i}),L(this,"find",n=>{if(n==null)return null;let i=this.indexOf(n);return i!==-1?this.at(i):null}),L(this,"findMany",n=>{let i=[];for(let r of n){let s=this.find(r);s!=null&&i.push(s)}return i}),L(this,"at",n=>{var s;if(!this.options.groupBy&&!this.options.groupSort)return(s=this.items[n])!=null?s:null;let i=0,r=this.group();for(let[,a]of r)for(let o of a){if(i===n)return o;i++}return null}),L(this,"sortFn",(n,i)=>{let r=this.indexOf(n),s=this.indexOf(i);return(r!=null?r:0)-(s!=null?s:0)}),L(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),L(this,"getItemValue",n=>{var i,r,s;return n==null?null:(s=(r=(i=this.options).itemToValue)==null?void 0:r.call(i,n))!=null?s:Ds.itemToValue(n)}),L(this,"getItemDisabled",n=>{var i,r,s;return n==null?!1:(s=(r=(i=this.options).isItemDisabled)==null?void 0:r.call(i,n))!=null?s:Ds.isItemDisabled(n)}),L(this,"stringifyItem",n=>{var i,r,s;return n==null?null:(s=(r=(i=this.options).itemToString)==null?void 0:r.call(i,n))!=null?s:Ds.itemToString(n)}),L(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),L(this,"stringifyItems",(n,i=", ")=>{let r=[];for(let s of n){let a=this.stringifyItem(s);a!=null&&r.push(a)}return r.join(i)}),L(this,"stringifyMany",(n,i)=>this.stringifyItems(this.findMany(n),i)),L(this,"has",n=>this.indexOf(n)!==-1),L(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),L(this,"group",()=>{let{groupBy:n,groupSort:i}=this.options;if(!n)return[["",[...this.items]]];let r=new Map;this.items.forEach((a,o)=>{let l=n(a,o);r.has(l)||r.set(l,[]),r.get(l).push(a)});let s=Array.from(r.entries());return i&&s.sort(([a],[o])=>{if(typeof i=="function")return i(a,o);if(Array.isArray(i)){let l=i.indexOf(a),c=i.indexOf(o);return l===-1?1:c===-1?-1:l-c}return i==="asc"?a.localeCompare(o):i==="desc"?o.localeCompare(a):0}),s}),L(this,"getNextValue",(n,i=1,r=!1)=>{let s=this.indexOf(n);if(s===-1)return null;for(s=r?Math.min(s+i,this.size-1):s+i;s<=this.size&&this.getItemDisabled(this.at(s));)s++;return this.getItemValue(this.at(s))}),L(this,"getPreviousValue",(n,i=1,r=!1)=>{let s=this.indexOf(n);if(s===-1)return null;for(s=r?Math.max(s-i,0):s-i;s>=0&&this.getItemDisabled(this.at(s));)s--;return this.getItemValue(this.at(s))}),L(this,"indexOf",n=>{var i;if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(r=>this.getItemValue(r)===n);if(!this.indexMap){this.indexMap=new Map;let r=0,s=this.group();for(let[,a]of s)for(let o of a){let l=this.getItemValue(o);l!=null&&this.indexMap.set(l,r),r++}}return(i=this.indexMap.get(n))!=null?i:-1}),L(this,"getByText",(n,i)=>{let r=i!=null?this.indexOf(i):-1,s=n.length===1;for(let a=0;a{let{state:r,currentValue:s,timeout:a=350}=i,o=r.keysSoFar+n,c=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,u=this.getByText(c,s),h=this.getItemValue(u);function m(){clearTimeout(r.timer),r.timer=-1}function d(p){r.keysSoFar=p,m(),p!==""&&(r.timer=+setTimeout(()=>{d(""),m()},a))}return d(o),h}),L(this,"update",(n,i)=>{let r=this.indexOf(n);return r===-1?this:this.copy([...this.items.slice(0,r),i,...this.items.slice(r+1)])}),L(this,"upsert",(n,i,r="append")=>{let s=this.indexOf(n);return s===-1?(r==="append"?this.append:this.prepend)(i):this.copy([...this.items.slice(0,s),i,...this.items.slice(s+1)])}),L(this,"insert",(n,...i)=>this.copy(vr(this.items,n,...i))),L(this,"insertBefore",(n,...i)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(vr(this.items,r,...i))}),L(this,"insertAfter",(n,...i)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(vr(this.items,r+1,...i))}),L(this,"prepend",(...n)=>this.copy(vr(this.items,0,...n))),L(this,"append",(...n)=>this.copy(vr(this.items,this.items.length,...n))),L(this,"filter",n=>{let i=this.items.filter((r,s)=>n(this.stringifyItem(r),s,r));return this.copy(i)}),L(this,"remove",(...n)=>{let i=n.map(r=>typeof r=="string"?r:this.getItemValue(r));return this.copy(this.items.filter(r=>{let s=this.getItemValue(r);return s==null?!1:!i.includes(s)}))}),L(this,"move",(n,i)=>{let r=this.indexOf(n);return r===-1?this:this.copy(Rs(this.items,[r],i))}),L(this,"moveBefore",(n,...i)=>{let r=this.items.findIndex(a=>this.getItemValue(a)===n);if(r===-1)return this;let s=i.map(a=>this.items.findIndex(o=>this.getItemValue(o)===a)).sort((a,o)=>a-o);return this.copy(Rs(this.items,s,r))}),L(this,"moveAfter",(n,...i)=>{let r=this.items.findIndex(a=>this.getItemValue(a)===n);if(r===-1)return this;let s=i.map(a=>this.items.findIndex(o=>this.getItemValue(o)===a)).sort((a,o)=>a-o);return this.copy(Rs(this.items,s,r+1))}),L(this,"reorder",(n,i)=>this.copy(Rs(this.items,[n],i))),L(this,"compareValue",(n,i)=>{let r=this.indexOf(n),s=this.indexOf(i);return rs?1:0}),L(this,"range",(n,i)=>{let r=[],s=n;for(;s!=null;){if(this.find(s)&&r.push(s),s===i)return r;s=this.getNextValue(s)}return[]}),L(this,"getValueRange",(n,i)=>n&&i?this.compareValue(n,i)<=0?this.range(n,i):this.range(i,n):[]),L(this,"toString",()=>{let n="";for(let i of this.items){let r=this.getItemValue(i),s=this.stringifyItem(i),a=this.getItemDisabled(i),o=[r,s,a].filter(Boolean).join(":");n+=o+","}return n}),L(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let t=0;for(;this.getItemDisabled(this.at(t));)t++;return this.getItemValue(this.at(t))}get lastValue(){let t=this.size-1;for(;this.getItemDisabled(this.at(t));)t--;return this.getItemValue(this.at(t))}*[Symbol.iterator](){yield*sc(this.items)}},Ab=(e,t)=>!!(e!=null&&e.toLowerCase().startsWith(t.toLowerCase()));Vo=class extends Nt{constructor(e){let{columnCount:t}=e;super(e),L(this,"columnCount"),L(this,"rows",null),L(this,"getRows",()=>(this.rows||(this.rows=cr([...this.items],this.columnCount)),this.rows)),L(this,"getRowCount",()=>Math.ceil(this.items.length/this.columnCount)),L(this,"getCellIndex",(n,i)=>n*this.columnCount+i),L(this,"getCell",(n,i)=>this.at(this.getCellIndex(n,i))),L(this,"getValueCell",n=>{let i=this.indexOf(n);if(i===-1)return null;let r=Math.floor(i/this.columnCount),s=i%this.columnCount;return{row:r,column:s}}),L(this,"getLastEnabledColumnIndex",n=>{for(let i=this.columnCount-1;i>=0;i--){let r=this.getCell(n,i);if(r&&!this.getItemDisabled(r))return i}return null}),L(this,"getFirstEnabledColumnIndex",n=>{for(let i=0;i{let r=this.getValueCell(n);if(r===null)return null;let s=this.getRows(),a=s.length,o=r.row,l=r.column;for(let c=1;c<=a;c++){o=lr(s,o,{loop:i});let u=s[o];if(!u)continue;if(!u[l]){let d=this.getLastEnabledColumnIndex(o);d!=null&&(l=d)}let m=this.getCell(o,l);if(!this.getItemDisabled(m))return this.getItemValue(m)}return this.firstValue}),L(this,"getNextRowValue",(n,i=!1)=>{let r=this.getValueCell(n);if(r===null)return null;let s=this.getRows(),a=s.length,o=r.row,l=r.column;for(let c=1;c<=a;c++){o=Ei(s,o,{loop:i});let u=s[o];if(!u)continue;if(!u[l]){let d=this.getLastEnabledColumnIndex(o);d!=null&&(l=d)}let m=this.getCell(o,l);if(!this.getItemDisabled(m))return this.getItemValue(m)}return this.lastValue}),this.columnCount=t}};ld=class Ls extends Set{constructor(t=[]){super(t),L(this,"selectionMode","single"),L(this,"deselectable",!0),L(this,"copy",()=>{let n=new Ls([...this]);return this.sync(n)}),L(this,"sync",n=>(n.selectionMode=this.selectionMode,n.deselectable=this.deselectable,n)),L(this,"isEmpty",()=>this.size===0),L(this,"isSelected",n=>this.selectionMode==="none"||n==null?!1:this.has(n)),L(this,"canSelect",(n,i)=>this.selectionMode!=="none"||!n.getItemDisabled(n.find(i))),L(this,"firstSelectedValue",n=>{let i=null;for(let r of this)(!i||n.compareValue(r,i)<0)&&(i=r);return i}),L(this,"lastSelectedValue",n=>{let i=null;for(let r of this)(!i||n.compareValue(r,i)>0)&&(i=r);return i}),L(this,"extendSelection",(n,i,r)=>{if(this.selectionMode==="none")return this;if(this.selectionMode==="single")return this.replaceSelection(n,r);let s=this.copy(),a=Array.from(this).pop();for(let o of n.getValueRange(i,a!=null?a:r))s.delete(o);for(let o of n.getValueRange(r,i))this.canSelect(n,o)&&s.add(o);return s}),L(this,"toggleSelection",(n,i)=>{if(this.selectionMode==="none")return this;if(this.selectionMode==="single"&&!this.isSelected(i))return this.replaceSelection(n,i);let r=this.copy();return r.has(i)?r.delete(i):r.canSelect(n,i)&&r.add(i),r}),L(this,"replaceSelection",(n,i)=>{if(this.selectionMode==="none")return this;if(i==null)return this;if(!this.canSelect(n,i))return this;let r=new Ls([i]);return this.sync(r)}),L(this,"setSelection",n=>{if(this.selectionMode==="none")return this;let i=new Ls;for(let r of n)if(r!=null&&(i.add(r),this.selectionMode==="single"))break;return this.sync(i)}),L(this,"clearSelection",()=>{let n=this.copy();return n.deselectable&&n.size>0&&n.clear(),n}),L(this,"select",(n,i,r)=>this.selectionMode==="none"?this:this.selectionMode==="single"?this.isSelected(i)&&this.deselectable?this.toggleSelection(n,i):this.replaceSelection(n,i):this.selectionMode==="multiple"||r?this.toggleSelection(n,i):this.replaceSelection(n,i)),L(this,"deselect",n=>{let i=this.copy();return i.delete(n),i}),L(this,"isEqual",n=>fe(Array.from(this),Array.from(n)))}};Ao=class pd{constructor(t){this.options=t,L(this,"rootNode"),L(this,"isEqual",n=>fe(this.rootNode,n.rootNode)),L(this,"getNodeChildren",n=>{var i,r,s,a;return(a=(s=(r=(i=this.options).nodeToChildren)==null?void 0:r.call(i,n))!=null?s:wi.nodeToChildren(n))!=null?a:[]}),L(this,"resolveIndexPath",n=>typeof n=="string"?this.getIndexPath(n):n),L(this,"resolveNode",n=>{let i=this.resolveIndexPath(n);return i?this.at(i):void 0}),L(this,"getNodeChildrenCount",n=>{var i,r,s;return(s=(r=(i=this.options).nodeToChildrenCount)==null?void 0:r.call(i,n))!=null?s:wi.nodeToChildrenCount(n)}),L(this,"getNodeValue",n=>{var i,r,s;return(s=(r=(i=this.options).nodeToValue)==null?void 0:r.call(i,n))!=null?s:wi.nodeToValue(n)}),L(this,"getNodeDisabled",n=>{var i,r,s;return(s=(r=(i=this.options).isNodeDisabled)==null?void 0:r.call(i,n))!=null?s:wi.isNodeDisabled(n)}),L(this,"stringify",n=>{let i=this.findNode(n);return i?this.stringifyNode(i):null}),L(this,"stringifyNode",n=>{var i,r,s;return(s=(r=(i=this.options).nodeToString)==null?void 0:r.call(i,n))!=null?s:wi.nodeToString(n)}),L(this,"getFirstNode",(n=this.rootNode,i={})=>{let r;return Je(n,{getChildren:this.getNodeChildren,onEnter:(s,a)=>{var o;if(!this.isSameNode(s,n)){if((o=i.skip)!=null&&o.call(i,{value:this.getNodeValue(s),node:s,indexPath:a}))return"skip";if(!r&&a.length>0&&!this.getNodeDisabled(s))return r=s,"stop"}}}),r}),L(this,"getLastNode",(n=this.rootNode,i={})=>{let r;return Je(n,{getChildren:this.getNodeChildren,onEnter:(s,a)=>{var o;if(!this.isSameNode(s,n)){if((o=i.skip)!=null&&o.call(i,{value:this.getNodeValue(s),node:s,indexPath:a}))return"skip";a.length>0&&!this.getNodeDisabled(s)&&(r=s)}}}),r}),L(this,"at",n=>cd(this.rootNode,n,{getChildren:this.getNodeChildren})),L(this,"findNode",(n,i=this.rootNode)=>Rb(i,{getChildren:this.getNodeChildren,predicate:r=>this.getNodeValue(r)===n})),L(this,"findNodes",(n,i=this.rootNode)=>{let r=new Set(n.filter(s=>s!=null));return Db(i,{getChildren:this.getNodeChildren,predicate:s=>r.has(this.getNodeValue(s))})}),L(this,"sort",n=>n.reduce((i,r)=>{let s=this.getIndexPath(r);return s&&i.push({value:r,indexPath:s}),i},[]).sort((i,r)=>ud(i.indexPath,r.indexPath)).map(({value:i})=>i)),L(this,"getIndexPath",n=>sd(this.rootNode,{getChildren:this.getNodeChildren,predicate:i=>this.getNodeValue(i)===n})),L(this,"getValue",n=>{let i=this.at(n);return i?this.getNodeValue(i):void 0}),L(this,"getValuePath",n=>{if(!n)return[];let i=[],r=[...n];for(;r.length>0;){let s=this.at(r);s&&i.unshift(this.getNodeValue(s)),r.pop()}return i}),L(this,"getDepth",n=>{var r;let i=sd(this.rootNode,{getChildren:this.getNodeChildren,predicate:s=>this.getNodeValue(s)===n});return(r=i==null?void 0:i.length)!=null?r:0}),L(this,"isSameNode",(n,i)=>this.getNodeValue(n)===this.getNodeValue(i)),L(this,"isRootNode",n=>this.isSameNode(n,this.rootNode)),L(this,"contains",(n,i)=>!n||!i?!1:i.slice(0,n.length).every((r,s)=>n[s]===i[s])),L(this,"getNextNode",(n,i={})=>{let r=!1,s;return Je(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var c;if(this.isRootNode(a))return;let l=this.getNodeValue(a);if((c=i.skip)!=null&&c.call(i,{value:l,node:a,indexPath:o}))return l===n&&(r=!0),"skip";if(r&&!this.getNodeDisabled(a))return s=a,"stop";l===n&&(r=!0)}}),s}),L(this,"getPreviousNode",(n,i={})=>{let r,s=!1;return Je(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var c;if(this.isRootNode(a))return;let l=this.getNodeValue(a);if((c=i.skip)!=null&&c.call(i,{value:l,node:a,indexPath:o}))return"skip";if(l===n)return s=!0,"stop";this.getNodeDisabled(a)||(r=a)}}),s?r:void 0}),L(this,"getParentNodes",n=>{var s;let i=(s=this.resolveIndexPath(n))==null?void 0:s.slice();if(!i)return[];let r=[];for(;i.length>0;){i.pop();let a=this.at(i);a&&!this.isRootNode(a)&&r.unshift(a)}return r}),L(this,"getDescendantNodes",(n,i)=>{let r=this.resolveNode(n);if(!r)return[];let s=[];return Je(r,{getChildren:this.getNodeChildren,onEnter:(a,o)=>{o.length!==0&&(!(i!=null&&i.withBranch)&&this.isBranchNode(a)||s.push(a))}}),s}),L(this,"getDescendantValues",(n,i)=>this.getDescendantNodes(n,i).map(s=>this.getNodeValue(s))),L(this,"getParentIndexPath",n=>n.slice(0,-1)),L(this,"getParentNode",n=>{let i=this.resolveIndexPath(n);return i?this.at(this.getParentIndexPath(i)):void 0}),L(this,"visit",n=>{let s=n,{skip:i}=s,r=ft(s,["skip"]);Je(this.rootNode,y(g({},r),{getChildren:this.getNodeChildren,onEnter:(a,o)=>{var l;if(!this.isRootNode(a))return i!=null&&i({value:this.getNodeValue(a),node:a,indexPath:o})?"skip":(l=r.onEnter)==null?void 0:l.call(r,a,o)}}))}),L(this,"getPreviousSibling",n=>{let i=this.getParentNode(n);if(!i)return;let r=this.getNodeChildren(i),s=n[n.length-1];for(;--s>=0;){let a=r[s];if(!this.getNodeDisabled(a))return a}}),L(this,"getNextSibling",n=>{let i=this.getParentNode(n);if(!i)return;let r=this.getNodeChildren(i),s=n[n.length-1];for(;++s{let i=this.getParentNode(n);return i?this.getNodeChildren(i):[]}),L(this,"getValues",(n=this.rootNode)=>Mb(n,{getChildren:this.getNodeChildren,transform:r=>[this.getNodeValue(r)]}).slice(1)),L(this,"isValidDepth",(n,i)=>i==null?!0:typeof i=="function"?i(n.length):n.length===i),L(this,"isBranchNode",n=>this.getNodeChildren(n).length>0||this.getNodeChildrenCount(n)!=null),L(this,"getBranchValues",(n=this.rootNode,i={})=>{let r=[];return Je(n,{getChildren:this.getNodeChildren,onEnter:(s,a)=>{var l;if(a.length===0)return;let o=this.getNodeValue(s);if((l=i.skip)!=null&&l.call(i,{value:o,node:s,indexPath:a}))return"skip";this.isBranchNode(s)&&this.isValidDepth(a,i.depth)&&r.push(this.getNodeValue(s))}}),r}),L(this,"flatten",(n=this.rootNode)=>$b(n,{getChildren:this.getNodeChildren})),L(this,"_create",(n,i)=>this.getNodeChildren(n).length>0||i.length>0?y(g({},n),{children:i}):g({},n)),L(this,"_insert",(n,i,r)=>this.copy(Ub(n,{at:i,nodes:r,getChildren:this.getNodeChildren,create:this._create}))),L(this,"copy",n=>new pd(y(g({},this.options),{rootNode:n}))),L(this,"_replace",(n,i,r)=>this.copy(qb(n,{at:i,node:r,getChildren:this.getNodeChildren,create:this._create}))),L(this,"_move",(n,i,r)=>this.copy(Kb(n,{indexPaths:i,to:r,getChildren:this.getNodeChildren,create:this._create}))),L(this,"_remove",(n,i)=>this.copy(Wb(n,{indexPaths:i,getChildren:this.getNodeChildren,create:this._create}))),L(this,"replace",(n,i)=>this._replace(this.rootNode,n,i)),L(this,"remove",n=>this._remove(this.rootNode,n)),L(this,"insertBefore",(n,i)=>this.getParentNode(n)?this._insert(this.rootNode,n,i):void 0),L(this,"insertAfter",(n,i)=>{if(!this.getParentNode(n))return;let s=[...n.slice(0,-1),n[n.length-1]+1];return this._insert(this.rootNode,s,i)}),L(this,"move",(n,i)=>this._move(this.rootNode,n,i)),L(this,"filter",n=>{let i=Fb(this.rootNode,{predicate:n,getChildren:this.getNodeChildren,create:this._create});return this.copy(i)}),L(this,"toJSON",()=>this.getValues(this.rootNode)),this.rootNode=t.rootNode}},wi={nodeToValue(e){return typeof e=="string"?e:xt(e)&&$e(e,"value")?e.value:""},nodeToString(e){return typeof e=="string"?e:xt(e)&&$e(e,"label")?e.label:wi.nodeToValue(e)},isNodeDisabled(e){return xt(e)&&$e(e,"disabled")?!!e.disabled:!1},nodeToChildren(e){return e.children},nodeToChildrenCount(e){if(xt(e)&&$e(e,"childrenCount"))return e.childrenCount}}});function No(e,t,n){return Qe(e,Sn(t,n))}function Qt(e,t){return typeof e=="function"?e(t):e}function en(e){return e.split("-")[0]}function Ai(e){return e.split("-")[1]}function Lo(e){return e==="x"?"y":"x"}function Mo(e){return e==="y"?"height":"width"}function Rt(e){return Xb.has(en(e))?"y":"x"}function Fo(e){return Lo(Rt(e))}function Zb(e,t,n){n===void 0&&(n=!1);let i=Ai(e),r=Fo(e),s=Mo(r),a=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Hs(a)),[a,Hs(a)]}function Jb(e){let t=Hs(e);return[Ro(e),t,Ro(t)]}function Ro(e){return e.replace(/start|end/g,t=>jb[t])}function tE(e,t,n){switch(e){case"top":case"bottom":return n?t?md:fd:t?fd:md;case"left":case"right":return t?Qb:eE;default:return[]}}function nE(e,t,n,i){let r=Ai(e),s=tE(en(e),n==="start",i);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Ro)))),s}function Hs(e){return e.replace(/left|right|bottom|top/g,t=>Yb[t])}function iE(e){return g({top:0,right:0,bottom:0,left:0},e)}function Od(e){return typeof e!="number"?iE(e):{top:e,right:e,bottom:e,left:e}}function Bs(e){let{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function vd(e,t,n){let{reference:i,floating:r}=e,s=Rt(t),a=Fo(t),o=Mo(a),l=en(t),c=s==="y",u=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,m=i[o]/2-r[o]/2,d;switch(l){case"top":d={x:u,y:i.y-r.height};break;case"bottom":d={x:u,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:h};break;case"left":d={x:i.x-r.width,y:h};break;default:d={x:i.x,y:i.y}}switch(Ai(t)){case"start":d[a]-=m*(n&&c?-1:1);break;case"end":d[a]+=m*(n&&c?-1:1);break}return d}function rE(e,t){return Ve(this,null,function*(){var n;t===void 0&&(t={});let{x:i,y:r,platform:s,rects:a,elements:o,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:d=0}=Qt(t,e),p=Od(d),I=o[m?h==="floating"?"reference":"floating":h],T=Bs(yield s.getClippingRect({element:(n=yield s.isElement==null?void 0:s.isElement(I))==null||n?I:I.contextElement||(yield s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:u,strategy:l})),O=h==="floating"?{x:i,y:r,width:a.floating.width,height:a.floating.height}:a.reference,b=yield s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating),f=(yield s.isElement==null?void 0:s.isElement(b))?(yield s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},S=Bs(s.convertOffsetParentRelativeRectToViewportRelativeRect?yield s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:O,offsetParent:b,strategy:l}):O);return{top:(T.top-S.top+p.top)/f.y,bottom:(S.bottom-T.bottom+p.bottom)/f.y,left:(T.left-S.left+p.left)/f.x,right:(S.right-T.right+p.right)/f.x}})}function yd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bd(e){return zb.some(t=>e[t]>=0)}function cE(e,t){return Ve(this,null,function*(){let{placement:n,platform:i,elements:r}=e,s=yield i.isRTL==null?void 0:i.isRTL(r.floating),a=en(n),o=Ai(n),l=Rt(n)==="y",c=wd.has(a)?-1:1,u=s&&l?-1:1,h=Qt(t,e),{mainAxis:m,crossAxis:d,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof p=="number"&&(d=o==="end"?p*-1:p),l?{x:d*u,y:m*c}:{x:m*c,y:d*u}})}function _s(){return typeof window!="undefined"}function ki(e){return Vd(e)?(e.nodeName||"").toLowerCase():"#document"}function et(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mt(e){var t;return(t=(Vd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Vd(e){return _s()?e instanceof Node||e instanceof et(e).Node:!1}function bt(e){return _s()?e instanceof Element||e instanceof et(e).Element:!1}function Lt(e){return _s()?e instanceof HTMLElement||e instanceof et(e).HTMLElement:!1}function Ed(e){return!_s()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof et(e).ShadowRoot}function Ir(e){let{overflow:t,overflowX:n,overflowY:i,display:r}=Et(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!pE.has(r)}function mE(e){return fE.has(ki(e))}function Gs(e){return vE.some(t=>{try{return e.matches(t)}catch(n){return!1}})}function $o(e){let t=Ho(),n=bt(e)?Et(e):e;return yE.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||bE.some(i=>(n.willChange||"").includes(i))||EE.some(i=>(n.contain||"").includes(i))}function IE(e){let t=Tn(e);for(;Lt(t)&&!xi(t);){if($o(t))return t;if(Gs(t))return null;t=Tn(t)}return null}function Ho(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xi(e){return PE.has(ki(e))}function Et(e){return et(e).getComputedStyle(e)}function Us(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Tn(e){if(ki(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Ed(e)&&e.host||Mt(e);return Ed(t)?t.host:t}function xd(e){let t=Tn(e);return xi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Lt(t)&&Ir(t)?t:xd(t)}function Er(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);let r=xd(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),a=et(r);if(s){let o=Do(a);return t.concat(a,a.visualViewport||[],Ir(r)?r:[],o&&n?Er(o):[])}return t.concat(r,Er(r,[],n))}function Do(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ad(e){let t=Et(e),n=parseFloat(t.width)||0,i=parseFloat(t.height)||0,r=Lt(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:i,o=$s(n)!==s||$s(i)!==a;return o&&(n=s,i=a),{width:n,height:i,$:o}}function Bo(e){return bt(e)?e:e.contextElement}function Vi(e){let t=Bo(e);if(!Lt(t))return Dt(1);let n=t.getBoundingClientRect(),{width:i,height:r,$:s}=Ad(t),a=(s?$s(n.width):n.width)/i,o=(s?$s(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}function kd(e){let t=et(e);return!Ho()||!t.visualViewport?CE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function SE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==et(e)?!1:t}function qn(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=e.getBoundingClientRect(),s=Bo(e),a=Dt(1);t&&(i?bt(i)&&(a=Vi(i)):a=Vi(e));let o=SE(s,n,i)?kd(s):Dt(0),l=(r.left+o.x)/a.x,c=(r.top+o.y)/a.y,u=r.width/a.x,h=r.height/a.y;if(s){let m=et(s),d=i&&bt(i)?et(i):i,p=m,v=Do(p);for(;v&&i&&d!==p;){let I=Vi(v),T=v.getBoundingClientRect(),O=Et(v),b=T.left+(v.clientLeft+parseFloat(O.paddingLeft))*I.x,f=T.top+(v.clientTop+parseFloat(O.paddingTop))*I.y;l*=I.x,c*=I.y,u*=I.x,h*=I.y,l+=b,c+=f,p=et(v),v=Do(p)}}return Bs({width:u,height:h,x:l,y:c})}function qs(e,t){let n=Us(e).scrollLeft;return t?t.left+n:qn(Mt(e)).left+n}function Nd(e,t){let n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-qs(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function TE(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e,s=r==="fixed",a=Mt(i),o=t?Gs(t.floating):!1;if(i===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Dt(1),u=Dt(0),h=Lt(i);if((h||!h&&!s)&&((ki(i)!=="body"||Ir(a))&&(l=Us(i)),Lt(i))){let d=qn(i);c=Vi(i),u.x=d.x+i.clientLeft,u.y=d.y+i.clientTop}let m=a&&!h&&!s?Nd(a,l):Dt(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-l.scrollTop*c.y+u.y+m.y}}function OE(e){return Array.from(e.getClientRects())}function wE(e){let t=Mt(e),n=Us(e),i=e.ownerDocument.body,r=Qe(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=Qe(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),a=-n.scrollLeft+qs(e),o=-n.scrollTop;return Et(i).direction==="rtl"&&(a+=Qe(t.clientWidth,i.clientWidth)-r),{width:r,height:s,x:a,y:o}}function VE(e,t){let n=et(e),i=Mt(e),r=n.visualViewport,s=i.clientWidth,a=i.clientHeight,o=0,l=0;if(r){s=r.width,a=r.height;let u=Ho();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}let c=qs(i);if(c<=0){let u=i.ownerDocument,h=u.body,m=getComputedStyle(h),d=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(i.clientWidth-h.clientWidth-d);p<=Id&&(s-=p)}else c<=Id&&(s+=c);return{width:s,height:a,x:o,y:l}}function AE(e,t){let n=qn(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,s=Lt(e)?Vi(e):Dt(1),a=e.clientWidth*s.x,o=e.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:a,height:o,x:l,y:c}}function Pd(e,t,n){let i;if(t==="viewport")i=VE(e,n);else if(t==="document")i=wE(Mt(e));else if(bt(t))i=AE(t,n);else{let r=kd(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Bs(i)}function Rd(e,t){let n=Tn(e);return n===t||!bt(n)||xi(n)?!1:Et(n).position==="fixed"||Rd(n,t)}function kE(e,t){let n=t.get(e);if(n)return n;let i=Er(e,[],!1).filter(o=>bt(o)&&ki(o)!=="body"),r=null,s=Et(e).position==="fixed",a=s?Tn(e):e;for(;bt(a)&&!xi(a);){let o=Et(a),l=$o(a);!l&&o.position==="fixed"&&(r=null),(s?!l&&!r:!l&&o.position==="static"&&!!r&&xE.has(r.position)||Ir(a)&&!l&&Rd(e,a))?i=i.filter(u=>u!==a):r=o,a=Tn(a)}return t.set(e,i),i}function NE(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e,a=[...n==="clippingAncestors"?Gs(t)?[]:kE(t,this._c):[].concat(n),i],o=a[0],l=a.reduce((c,u)=>{let h=Pd(t,u,r);return c.top=Qe(h.top,c.top),c.right=Sn(h.right,c.right),c.bottom=Sn(h.bottom,c.bottom),c.left=Qe(h.left,c.left),c},Pd(t,o,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function RE(e){let{width:t,height:n}=Ad(e);return{width:t,height:n}}function DE(e,t,n){let i=Lt(t),r=Mt(t),s=n==="fixed",a=qn(e,!0,s,t),o={scrollLeft:0,scrollTop:0},l=Dt(0);function c(){l.x=qs(r)}if(i||!i&&!s)if((ki(t)!=="body"||Ir(r))&&(o=Us(t)),i){let d=qn(t,!0,s,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else r&&c();s&&!i&&r&&c();let u=r&&!i&&!s?Nd(r,o):Dt(0),h=a.left+o.scrollLeft-l.x-u.x,m=a.top+o.scrollTop-l.y-u.y;return{x:h,y:m,width:a.width,height:a.height}}function ko(e){return Et(e).position==="static"}function Cd(e,t){if(!Lt(e)||Et(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Mt(e)===n&&(n=n.ownerDocument.body),n}function Dd(e,t){let n=et(e);if(Gs(e))return n;if(!Lt(e)){let r=Tn(e);for(;r&&!xi(r);){if(bt(r)&&!ko(r))return r;r=Tn(r)}return n}let i=Cd(e,t);for(;i&&mE(i)&&ko(i);)i=Cd(i,t);return i&&xi(i)&&ko(i)&&!$o(i)?n:i||IE(e)||n}function ME(e){return Et(e).direction==="rtl"}function Ld(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $E(e,t){let n=null,i,r=Mt(e);function s(){var o;clearTimeout(i),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();let c=e.getBoundingClientRect(),{left:u,top:h,width:m,height:d}=c;if(o||t(),!m||!d)return;let p=Fs(h),v=Fs(r.clientWidth-(u+m)),I=Fs(r.clientHeight-(h+d)),T=Fs(u),b={rootMargin:-p+"px "+-v+"px "+-I+"px "+-T+"px",threshold:Qe(0,Sn(1,l))||1},f=!0;function S(P){let V=P[0].intersectionRatio;if(V!==l){if(!f)return a();V?a(!1,V):i=setTimeout(()=>{a(!1,1e-7)},1e3)}V===1&&!Ld(c,e.getBoundingClientRect())&&a(),f=!1}try{n=new IntersectionObserver(S,y(g({},b),{root:r.ownerDocument}))}catch(P){n=new IntersectionObserver(S,b)}n.observe(e)}return a(!0),s}function HE(e,t,n,i){i===void 0&&(i={});let{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=Bo(e),u=r||s?[...c?Er(c):[],...Er(t)]:[];u.forEach(T=>{r&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});let h=c&&o?$E(c,n):null,m=-1,d=null;a&&(d=new ResizeObserver(T=>{let[O]=T;O&&O.target===c&&d&&(d.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=d)==null||b.observe(t)})),n()}),c&&!l&&d.observe(c),d.observe(t));let p,v=l?qn(e):null;l&&I();function I(){let T=qn(e);v&&!Ld(v,T)&&n(),v=T,p=requestAnimationFrame(I)}return n(),()=>{var T;u.forEach(O=>{r&&O.removeEventListener("scroll",n),s&&O.removeEventListener("resize",n)}),h==null||h(),(T=d)==null||T.disconnect(),d=null,l&&cancelAnimationFrame(p)}}function Sd(e=0,t=0,n=0,i=0){if(typeof DOMRect=="function")return new DOMRect(e,t,n,i);let r={x:e,y:t,width:n,height:i,top:t,right:e+n,bottom:t+i,left:e};return y(g({},r),{toJSON:()=>r})}function YE(e){if(!e)return Sd();let{x:t,y:n,width:i,height:r}=e;return Sd(t,n,i,r)}function jE(e,t){return{contextElement:le(e)?e:e==null?void 0:e.contextElement,getBoundingClientRect:()=>{let n=e,i=t==null?void 0:t(n);return i||!n?YE(i):n.getBoundingClientRect()}}}function ZE(e,t){return{name:"transformOrigin",fn(n){var x,k,N,D,$;let{elements:i,middlewareData:r,placement:s,rects:a,y:o}=n,l=s.split("-")[0],c=XE(l),u=((x=r.arrow)==null?void 0:x.x)||0,h=((k=r.arrow)==null?void 0:k.y)||0,m=(t==null?void 0:t.clientWidth)||0,d=(t==null?void 0:t.clientHeight)||0,p=u+m/2,v=h+d/2,I=Math.abs(((N=r.shift)==null?void 0:N.y)||0),T=a.reference.height/2,O=d/2,b=($=(D=e.offset)==null?void 0:D.mainAxis)!=null?$:e.gutter,f=typeof b=="number"?b+O:b!=null?b:O,S=I>f,P={top:`${p}px calc(100% + ${f}px)`,bottom:`${p}px ${-f}px`,left:`calc(100% + ${f}px) ${v}px`,right:`${-f}px ${v}px`}[l],V=`${p}px ${a.reference.y+T-o}px`,A=!!e.overlap&&c==="y"&&S;return i.floating.style.setProperty(Jt.transformOrigin.variable,A?V:P),{data:{transformOrigin:A?V:P}}}}}function eI(e){let[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function Md(e){return e.split("-")[0]}function Td(e,t){let n=e.devicePixelRatio||1;return Math.round(t*n)/n}function _o(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function nI(e,t,n){let i=e||t.createElement("div");return WE({element:i,padding:n.arrowPadding})}function iI(e,t){var n;if(!Wc((n=t.offset)!=null?n:t.gutter))return BE(({placement:i})=>{var u,h,m,d;let r=((e==null?void 0:e.clientHeight)||0)/2,s=(h=(u=t.offset)==null?void 0:u.mainAxis)!=null?h:t.gutter,a=typeof s=="number"?s+r:s!=null?s:r,{hasAlign:o}=eI(i),l=o?void 0:t.shift,c=(d=(m=t.offset)==null?void 0:m.crossAxis)!=null?d:l;return Si({crossAxis:c,mainAxis:a,alignmentAxis:t.shift})})}function rI(e){if(!e.flip)return;let t=_o(e.boundary);return GE(y(g({},t?{boundary:t}:void 0),{padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}))}function sI(e){if(!e.slide&&!e.overlap)return;let t=_o(e.boundary);return _E(y(g({},t?{boundary:t}:void 0),{mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:KE()}))}function aI(e){return UE({padding:e.overflowPadding,apply({elements:t,rects:n,availableHeight:i,availableWidth:r}){let s=t.floating,a=Math.round(n.reference.width),o=Math.round(n.reference.height);r=Math.floor(r),i=Math.floor(i),s.style.setProperty("--reference-width",`${a}px`),s.style.setProperty("--reference-height",`${o}px`),s.style.setProperty("--available-width",`${r}px`),s.style.setProperty("--available-height",`${i}px`)}})}function oI(e){var t;if(e.hideWhenDetached)return qE({strategy:"referenceHidden",boundary:(t=_o(e.boundary))!=null?t:"clippingAncestors"})}function lI(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}function cI(e,t,n={}){var I,T;let i=(T=(I=n.getAnchorElement)==null?void 0:I.call(n))!=null?T:e,r=jE(i,n.getAnchorRect);if(!t||!r)return;let s=Object.assign({},tI,n),a=t.querySelector("[data-part=arrow]"),o=[iI(a,s),rI(s),sI(s),nI(a,t.ownerDocument,s),QE(a),ZE({gutter:s.gutter,offset:s.offset,overlap:s.overlap},a),aI(s),oI(s),JE],{placement:l,strategy:c,onComplete:u,onPositioned:h}=s,m=()=>Ve(null,null,function*(){var V;if(!r||!t)return;let O=yield zE(r,t,{placement:l,middleware:o,strategy:c});u==null||u(O),h==null||h({placed:!0});let b=ue(t),f=Td(b,O.x),S=Td(b,O.y);t.style.setProperty("--x",`${f}px`),t.style.setProperty("--y",`${S}px`),s.hideWhenDetached&&(((V=O.middlewareData.hide)==null?void 0:V.referenceHidden)?(t.style.setProperty("visibility","hidden"),t.style.setProperty("pointer-events","none")):(t.style.removeProperty("visibility"),t.style.removeProperty("pointer-events")));let P=t.firstElementChild;if(P){let A=at(P);t.style.setProperty("--z-index",A.zIndex)}}),d=()=>Ve(null,null,function*(){n.updatePosition?(yield n.updatePosition({updatePosition:m,floatingElement:t}),h==null||h({placed:!0})):yield m()}),p=lI(s.listeners),v=s.listeners?HE(r,t,d,p):zc;return d(),()=>{v==null||v(),h==null||h({placed:!1})}}function It(e,t,n={}){let o=n,{defer:i}=o,r=ft(o,["defer"]),s=i?H:l=>l(),a=[];return a.push(s(()=>{let l=typeof e=="function"?e():e,c=typeof t=="function"?t():t;a.push(cI(l,c,r))})),()=>{a.forEach(l=>l==null?void 0:l())}}function On(e={}){let{placement:t,sameWidth:n,fitViewport:i,strategy:r="absolute"}=e;return{arrow:{position:"absolute",width:Jt.arrowSize.reference,height:Jt.arrowSize.reference,[Jt.arrowSizeHalf.variable]:`calc(${Jt.arrowSize.reference} / 2)`,[Jt.arrowOffset.variable]:`calc(${Jt.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?uI[t.split("-")[0]]:void 0,background:Jt.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:r,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:i?"var(--available-width)":void 0,maxHeight:i?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}var zb,Sn,Qe,$s,Fs,Dt,Yb,jb,Xb,fd,md,Qb,eE,sE,aE,oE,lE,wd,uE,dE,hE,gE,pE,fE,vE,yE,bE,EE,PE,CE,Id,xE,LE,FE,BE,_E,GE,UE,qE,WE,KE,zE,br,Jt,XE,JE,QE,tI,uI,Pr=re(()=>{"use strict";se();zb=["top","right","bottom","left"],Sn=Math.min,Qe=Math.max,$s=Math.round,Fs=Math.floor,Dt=e=>({x:e,y:e}),Yb={left:"right",right:"left",bottom:"top",top:"bottom"},jb={start:"end",end:"start"};Xb=new Set(["top","bottom"]);fd=["left","right"],md=["right","left"],Qb=["top","bottom"],eE=["bottom","top"];sE=(e,t,n)=>Ve(null,null,function*(){let{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,o=s.filter(Boolean),l=yield a.isRTL==null?void 0:a.isRTL(t),c=yield a.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:h}=vd(c,i,l),m=i,d={},p=0;for(let I=0;I({name:"arrow",options:e,fn(n){return Ve(this,null,function*(){let{x:i,y:r,placement:s,rects:a,platform:o,elements:l,middlewareData:c}=n,{element:u,padding:h=0}=Qt(e,n)||{};if(u==null)return{};let m=Od(h),d={x:i,y:r},p=Fo(s),v=Mo(p),I=yield o.getDimensions(u),T=p==="y",O=T?"top":"left",b=T?"bottom":"right",f=T?"clientHeight":"clientWidth",S=a.reference[v]+a.reference[p]-d[p]-a.floating[v],P=d[p]-a.reference[p],V=yield o.getOffsetParent==null?void 0:o.getOffsetParent(u),A=V?V[f]:0;(!A||!(yield o.isElement==null?void 0:o.isElement(V)))&&(A=l.floating[f]||a.floating[v]);let x=S/2-P/2,k=A/2-I[v]/2-1,N=Sn(m[O],k),D=Sn(m[b],k),$=N,te=A-I[v]-D,Z=A/2-I[v]/2+x,ie=No($,Z,te),J=!c.arrow&&Ai(s)!=null&&Z!==ie&&a.reference[v]/2-(Z<$?N:D)-I[v]/2<0,Se=J?Z<$?Z-$:Z-te:0;return{[p]:d[p]+Se,data:g({[p]:ie,centerOffset:Z-ie-Se},J&&{alignmentOffset:Se}),reset:J}})}}),oE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,fn(n){return Ve(this,null,function*(){var i,r;let{placement:s,middlewareData:a,rects:o,initialPlacement:l,platform:c,elements:u}=n,Z=Qt(e,n),{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:I=!0}=Z,T=ft(Z,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((i=a.arrow)!=null&&i.alignmentOffset)return{};let O=en(s),b=Rt(l),f=en(l)===l,S=yield c.isRTL==null?void 0:c.isRTL(u.floating),P=d||(f||!I?[Hs(l)]:Jb(l)),V=v!=="none";!d&&V&&P.push(...nE(l,I,v,S));let A=[l,...P],x=yield c.detectOverflow(n,T),k=[],N=((r=a.flip)==null?void 0:r.overflows)||[];if(h&&k.push(x[O]),m){let ie=Zb(s,o,S);k.push(x[ie[0]],x[ie[1]])}if(N=[...N,{placement:s,overflows:k}],!k.every(ie=>ie<=0)){var D,$;let ie=(((D=a.flip)==null?void 0:D.index)||0)+1,J=A[ie];if(J&&(!(m==="alignment"?b!==Rt(J):!1)||N.every(ne=>Rt(ne.placement)===b?ne.overflows[0]>0:!0)))return{data:{index:ie,overflows:N},reset:{placement:J}};let Se=($=N.filter(Pe=>Pe.overflows[0]<=0).sort((Pe,ne)=>Pe.overflows[1]-ne.overflows[1])[0])==null?void 0:$.placement;if(!Se)switch(p){case"bestFit":{var te;let Pe=(te=N.filter(ne=>{if(V){let Ie=Rt(ne.placement);return Ie===b||Ie==="y"}return!0}).map(ne=>[ne.placement,ne.overflows.filter(Ie=>Ie>0).reduce((Ie,rt)=>Ie+rt,0)]).sort((ne,Ie)=>ne[1]-Ie[1])[0])==null?void 0:te[0];Pe&&(Se=Pe);break}case"initialPlacement":Se=l;break}if(s!==Se)return{reset:{placement:Se}}}return{}})}}};lE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,fn(n){return Ve(this,null,function*(){let{rects:i,platform:r}=n,o=Qt(e,n),{strategy:s="referenceHidden"}=o,a=ft(o,["strategy"]);switch(s){case"referenceHidden":{let l=yield r.detectOverflow(n,y(g({},a),{elementContext:"reference"})),c=yd(l,i.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:bd(c)}}}case"escaped":{let l=yield r.detectOverflow(n,y(g({},a),{altBoundary:!0})),c=yd(l,i.floating);return{data:{escapedOffsets:c,escaped:bd(c)}}}default:return{}}})}}},wd=new Set(["left","top"]);uE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return Ve(this,null,function*(){var i,r;let{x:s,y:a,placement:o,middlewareData:l}=n,c=yield cE(n,e);return o===((i=l.offset)==null?void 0:i.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:y(g({},c),{placement:o})}})}}},dE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,fn(n){return Ve(this,null,function*(){let{x:i,y:r,placement:s,platform:a}=n,O=Qt(e,n),{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:f,y:S}=b;return{x:f,y:S}}}}=O,u=ft(O,["mainAxis","crossAxis","limiter"]),h={x:i,y:r},m=yield a.detectOverflow(n,u),d=Rt(en(s)),p=Lo(d),v=h[p],I=h[d];if(o){let b=p==="y"?"top":"left",f=p==="y"?"bottom":"right",S=v+m[b],P=v-m[f];v=No(S,v,P)}if(l){let b=d==="y"?"top":"left",f=d==="y"?"bottom":"right",S=I+m[b],P=I-m[f];I=No(S,I,P)}let T=c.fn(y(g({},n),{[p]:v,[d]:I}));return y(g({},T),{data:{x:T.x-i,y:T.y-r,enabled:{[p]:o,[d]:l}}})})}}},hE=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:i,placement:r,rects:s,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=Qt(e,t),u={x:n,y:i},h=Rt(r),m=Lo(h),d=u[m],p=u[h],v=Qt(o,t),I=typeof v=="number"?{mainAxis:v,crossAxis:0}:g({mainAxis:0,crossAxis:0},v);if(l){let b=m==="y"?"height":"width",f=s.reference[m]-s.floating[b]+I.mainAxis,S=s.reference[m]+s.reference[b]-I.mainAxis;dS&&(d=S)}if(c){var T,O;let b=m==="y"?"width":"height",f=wd.has(en(r)),S=s.reference[h]-s.floating[b]+(f&&((T=a.offset)==null?void 0:T[h])||0)+(f?0:I.crossAxis),P=s.reference[h]+s.reference[b]+(f?0:((O=a.offset)==null?void 0:O[h])||0)-(f?I.crossAxis:0);pP&&(p=P)}return{[m]:d,[h]:p}}}},gE=function(e){return e===void 0&&(e={}),{name:"size",options:e,fn(n){return Ve(this,null,function*(){var i,r;let{placement:s,rects:a,platform:o,elements:l}=n,N=Qt(e,n),{apply:c=()=>{}}=N,u=ft(N,["apply"]),h=yield o.detectOverflow(n,u),m=en(s),d=Ai(s),p=Rt(s)==="y",{width:v,height:I}=a.floating,T,O;m==="top"||m==="bottom"?(T=m,O=d===((yield o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(O=m,T=d==="end"?"top":"bottom");let b=I-h.top-h.bottom,f=v-h.left-h.right,S=Sn(I-h[T],b),P=Sn(v-h[O],f),V=!n.middlewareData.shift,A=S,x=P;if((i=n.middlewareData.shift)!=null&&i.enabled.x&&(x=f),(r=n.middlewareData.shift)!=null&&r.enabled.y&&(A=b),V&&!d){let D=Qe(h.left,0),$=Qe(h.right,0),te=Qe(h.top,0),Z=Qe(h.bottom,0);p?x=v-2*(D!==0||$!==0?D+$:Qe(h.left,h.right)):A=I-2*(te!==0||Z!==0?te+Z:Qe(h.top,h.bottom))}yield c(y(g({},n),{availableWidth:x,availableHeight:A}));let k=yield o.getDimensions(l.floating);return v!==k.width||I!==k.height?{reset:{rects:!0}}:{}})}}};pE=new Set(["inline","contents"]);fE=new Set(["table","td","th"]);vE=[":popover-open",":modal"];yE=["transform","translate","scale","rotate","perspective"],bE=["transform","translate","scale","rotate","perspective","filter"],EE=["paint","layout","strict","content"];PE=new Set(["html","body","#document"]);CE=Dt(0);Id=25;xE=new Set(["absolute","fixed"]);LE=function(e){return Ve(this,null,function*(){let t=this.getOffsetParent||Dd,n=this.getDimensions,i=yield n(e.floating);return{reference:DE(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};FE={convertOffsetParentRelativeRectToViewportRelativeRect:TE,getDocumentElement:Mt,getClippingRect:NE,getOffsetParent:Dd,getElementRects:LE,getClientRects:OE,getDimensions:RE,getScale:Vi,isElement:bt,isRTL:ME};BE=uE,_E=dE,GE=oE,UE=gE,qE=lE,WE=aE,KE=hE,zE=(e,t,n)=>{let i=new Map,r=g({platform:FE},n),s=y(g({},r.platform),{_c:i});return sE(e,t,y(g({},r),{platform:s}))};br=e=>({variable:e,reference:`var(${e})`}),Jt={arrowSize:br("--arrow-size"),arrowSizeHalf:br("--arrow-size-half"),arrowBg:br("--arrow-background"),transformOrigin:br("--transform-origin"),arrowOffset:br("--arrow-offset")},XE=e=>e==="top"||e==="bottom"?"y":"x";JE={name:"rects",fn({rects:e}){return{data:e}}},QE=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};let{x:i,y:r}=n.arrow,s=t.split("-")[0];return Object.assign(e.style,{left:i!=null?`${i}px`:"",top:r!=null?`${r}px`:"",[s]:`calc(100% + ${Jt.arrowOffset.reference})`}),{}}}};tI={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};uI={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"}});function dI(e){let t={each(n){var i;for(let r=0;r<((i=e.frames)==null?void 0:i.length);r+=1){let s=e.frames[r];s&&n(s)}},addEventListener(n,i,r){return t.each(s=>{try{s.document.addEventListener(n,i,r)}catch(a){}}),()=>{try{t.removeEventListener(n,i,r)}catch(s){}}},removeEventListener(n,i,r){t.each(s=>{try{s.document.removeEventListener(n,i,r)}catch(a){}})}};return t}function hI(e){let t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,i,r)=>{try{t==null||t.addEventListener(n,i,r)}catch(s){}return()=>{try{t==null||t.removeEventListener(n,i,r)}catch(s){}}},removeEventListener:(n,i,r)=>{try{t==null||t.removeEventListener(n,i,r)}catch(s){}}}}function gI(e){for(let t of e)if(le(t)&&Ye(t))return!0;return!1}function pI(e,t){if(!_d(t)||!e)return!1;let n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function fI(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Hd(e,t){if(!t||!_d(e))return!1;let n=t.scrollHeight>t.clientHeight,i=n&&e.clientX>t.offsetLeft+t.clientWidth,r=t.scrollWidth>t.clientWidth,s=r&&e.clientY>t.offsetTop+t.clientHeight,a={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(r?16:0)},o={x:e.clientX,y:e.clientY};return fI(a,o)?i||s:!1}function mI(e,t){let{exclude:n,onFocusOutside:i,onPointerDownOutside:r,onInteractOutside:s,defer:a,followControlledElements:o=!0}=t;if(!e)return;let l=Le(e),c=ue(e),u=dI(c),h=hI(c);function m(b,f){if(!le(f)||!f.isConnected||ce(e,f)||pI(e,b)||o&&as(e,f))return!1;let S=l.querySelector(`[aria-controls="${e.id}"]`);if(S){let V=gs(S);if(Hd(b,V))return!1}let P=gs(e);return Hd(b,P)?!1:!(n!=null&&n(f))}let d=new Set,p=Ln(e==null?void 0:e.getRootNode());function v(b){function f(S){var x,k;let P=a&&!Ja()?H:N=>N(),V=S!=null?S:b,A=(k=(x=V==null?void 0:V.composedPath)==null?void 0:x.call(V))!=null?k:[V==null?void 0:V.target];P(()=>{let N=p?A[0]:j(b);if(!(!e||!m(b,N))){if(r||s){let D=At(r,s);e.addEventListener(Fd,D,{once:!0})}Bd(e,Fd,{bubbles:!1,cancelable:!0,detail:{originalEvent:V,contextmenu:hi(V),focusable:gI(A),target:N}})}})}b.pointerType==="touch"?(d.forEach(S=>S()),d.add(ee(l,"click",f,{once:!0})),d.add(h.addEventListener("click",f,{once:!0})),d.add(u.addEventListener("click",f,{once:!0}))):f()}let I=new Set,T=setTimeout(()=>{I.add(ee(l,"pointerdown",v,!0)),I.add(h.addEventListener("pointerdown",v,!0)),I.add(u.addEventListener("pointerdown",v,!0))},0);function O(b){(a?H:S=>S())(()=>{var V,A;let S=(A=(V=b==null?void 0:b.composedPath)==null?void 0:V.call(b))!=null?A:[b==null?void 0:b.target],P=p?S[0]:j(b);if(!(!e||!m(b,P))){if(i||s){let x=At(i,s);e.addEventListener($d,x,{once:!0})}Bd(e,$d,{bubbles:!1,cancelable:!0,detail:{originalEvent:b,contextmenu:!1,focusable:Ye(P),target:P}})}})}return Ja()||(I.add(ee(l,"focusin",O,!0)),I.add(h.addEventListener("focusin",O,!0)),I.add(u.addEventListener("focusin",O,!0))),()=>{clearTimeout(T),d.forEach(b=>b()),I.forEach(b=>b())}}function Ws(e,t){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=typeof e=="function"?e():e;r.push(mI(s,t))})),()=>{r.forEach(s=>s==null?void 0:s())}}function Bd(e,t,n){let i=e.ownerDocument.defaultView||window,r=new i.CustomEvent(t,n);return e.dispatchEvent(r)}var Fd,$d,_d,tn=re(()=>{"use strict";se();Fd="pointerdown.outside",$d="focus.outside";_d=e=>"clientY"in e});function vI(e,t){let n=i=>{i.key==="Escape"&&(i.isComposing||t==null||t(i))};return ee(Le(e),"keydown",n,{capture:!0})}function yI(e,t,n){let i=e.ownerDocument.defaultView||window,r=new i.CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(r)}function bI(e,t,n){e.addEventListener(t,n,{once:!0})}function qd(){We.layers.forEach(({node:e})=>{e.style.pointerEvents=We.isBelowPointerBlockingLayer(e)?"none":"auto"})}function EI(e){e.style.pointerEvents=""}function II(e,t){let n=Le(e),i=[];return We.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Ud=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),t==null||t.forEach(r=>{let[s,a]=Hc(()=>{let o=r();return le(o)?o:null},{timeout:1e3});s.then(o=>i.push(Hn(o,{pointerEvents:"auto"}))),i.push(a)}),()=>{We.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Ud,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),i.forEach(r=>r()))}}function PI(e,t){let{warnOnMissingNode:n=!0}=t;if(n&&!e){zt("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!e)return;let{onDismiss:i,onRequestDismiss:r,pointerBlocking:s,exclude:a,debug:o,type:l="dialog"}=t,c={dismiss:i,node:e,type:l,pointerBlocking:s,requestDismiss:r};We.add(c),qd();function u(v){var T,O;let I=j(v.detail.originalEvent);We.isBelowPointerBlockingLayer(e)||We.isInBranch(I)||((T=t.onPointerDownOutside)==null||T.call(t,v),(O=t.onInteractOutside)==null||O.call(t,v),!v.defaultPrevented&&(o&&console.log("onPointerDownOutside:",v.detail.originalEvent),i==null||i()))}function h(v){var T,O;let I=j(v.detail.originalEvent);We.isInBranch(I)||((T=t.onFocusOutside)==null||T.call(t,v),(O=t.onInteractOutside)==null||O.call(t,v),!v.defaultPrevented&&(o&&console.log("onFocusOutside:",v.detail.originalEvent),i==null||i()))}function m(v){var I;We.isTopMost(e)&&((I=t.onEscapeKeyDown)==null||I.call(t,v),!v.defaultPrevented&&i&&(v.preventDefault(),i()))}function d(v){var b;if(!e)return!1;let I=typeof a=="function"?a():a,T=Array.isArray(I)?I:[I],O=(b=t.persistentElements)==null?void 0:b.map(f=>f()).filter(le);return O&&T.push(...O),T.some(f=>ce(f,v))||We.isInNestedLayer(e,v)}let p=[s?II(e,t.persistentElements):void 0,vI(e,m),Ws(e,{exclude:d,onFocusOutside:h,onPointerDownOutside:u,defer:t.defer})];return()=>{We.remove(e),qd(),EI(e),p.forEach(v=>v==null?void 0:v())}}function Ft(e,t){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=Wt(e)?e():e;r.push(PI(s,t))})),()=>{r.forEach(s=>s==null?void 0:s())}}function Wd(e,t={}){let{defer:n}=t,i=n?H:s=>s(),r=[];return r.push(i(()=>{let s=Wt(e)?e():e;if(!s){zt("[@zag-js/dismissable] branch node is `null` or `undefined`");return}We.addBranch(s),r.push(()=>{We.removeBranch(s)})})),()=>{r.forEach(s=>s==null?void 0:s())}}var Gd,We,Ud,Wn=re(()=>{"use strict";tn();se();Gd="layer:request-dismiss",We={layers:[],branches:[],recentlyRemoved:new Set,count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){var i;let t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf((i=this.topMostPointerBlockingLayer())==null?void 0:i.node):-1;return tt.type===e)},getNestedLayersByType(e,t){let n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(i=>i.type===t)},getParentLayerOfType(e,t){let n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(i=>i.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(i=>ce(i.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>ce(t,e))},add(e){this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){let t=this.indexOf(e);t<0||(this.recentlyRemoved.add(e),$n(()=>this.recentlyRemoved.delete(e)),tWe.dismiss(i.node,e)),this.layers.splice(t,1),this.syncLayers())},removeBranch(e){let t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{e.node.style.setProperty("--layer-index",`${t}`),e.node.removeAttribute("data-nested"),e.node.removeAttribute("data-has-nested"),this.getParentLayerOfType(e.node,e.type)&&e.node.setAttribute("data-nested",e.type);let i=this.countNestedLayersOfType(e.node,e.type);i>0&&e.node.setAttribute("data-has-nested",e.type),e.node.style.setProperty("--nested-layer-count",`${i}`)})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){let n=this.indexOf(e);if(n===-1)return;let i=this.layers[n];bI(e,Gd,r=>{var s;(s=i.requestDismiss)==null||s.call(i,r),r.defaultPrevented||i==null||i.dismiss()}),yI(e,Gd,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}}});var nh={};he(nh,{Combobox:()=>BI});function VI(e,t){let{context:n,prop:i,state:r,send:s,scope:a,computed:o,event:l}=e,c=i("translations"),u=i("collection"),h=!!i("disabled"),m=o("isInteractive"),d=!!i("invalid"),p=!!i("required"),v=!!i("readOnly"),I=r.hasTag("open"),T=r.hasTag("focused"),O=i("composite"),b=n.get("highlightedValue"),f=On(y(g({},i("positioning")),{placement:n.get("currentPlacement")}));function S(P){let V=u.getItemDisabled(P.item),A=u.getItemValue(P.item);return vn(A,()=>`[zag-js] No value found for item ${JSON.stringify(P.item)}`),{value:A,disabled:!!(V||V),highlighted:b===A,selected:n.get("value").includes(A)}}return{focused:T,open:I,inputValue:n.get("inputValue"),highlightedValue:b,highlightedItem:n.get("highlightedItem"),value:n.get("value"),valueAsString:o("valueAsString"),hasSelectedItems:o("hasSelectedItems"),selectedItems:n.get("selectedItems"),collection:i("collection"),multiple:!!i("multiple"),disabled:!!h,syncSelectedItems(){s({type:"SELECTED_ITEMS.SYNC"})},reposition(P={}){s({type:"POSITIONING.SET",options:P})},setHighlightValue(P){s({type:"HIGHLIGHTED_VALUE.SET",value:P})},clearHighlightValue(){s({type:"HIGHLIGHTED_VALUE.CLEAR"})},selectValue(P){s({type:"ITEM.SELECT",value:P})},setValue(P){s({type:"VALUE.SET",value:P})},setInputValue(P,V="script"){s({type:"INPUT_VALUE.SET",value:P,src:V})},clearValue(P){P!=null?s({type:"ITEM.CLEAR",value:P}):s({type:"VALUE.CLEAR"})},focus(){var P;(P=zn(a))==null||P.focus()},setOpen(P,V="script"){r.hasTag("open")!==P&&s({type:P?"OPEN":"CLOSE",src:V})},getRootProps(){return t.element(y(g({},Ke.root.attrs),{dir:i("dir"),id:SI(a),"data-invalid":E(d),"data-readonly":E(v)}))},getLabelProps(){return t.label(y(g({},Ke.label.attrs),{dir:i("dir"),htmlFor:Ks(a),id:Go(a),"data-readonly":E(v),"data-disabled":E(h),"data-invalid":E(d),"data-required":E(p),"data-focus":E(T),onClick(P){var V;O||(P.preventDefault(),(V=Cr(a))==null||V.focus({preventScroll:!0}))}}))},getControlProps(){return t.element(y(g({},Ke.control.attrs),{dir:i("dir"),id:Jd(a),"data-state":I?"open":"closed","data-focus":E(T),"data-disabled":E(h),"data-invalid":E(d)}))},getPositionerProps(){return t.element(y(g({},Ke.positioner.attrs),{dir:i("dir"),id:Qd(a),style:f.floating}))},getInputProps(){return t.input(y(g({},Ke.input.attrs),{dir:i("dir"),"aria-invalid":X(d),"data-invalid":E(d),"data-autofocus":E(i("autoFocus")),name:i("name"),form:i("form"),disabled:h,required:i("required"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:"false",readOnly:v,placeholder:i("placeholder"),id:Ks(a),type:"text",role:"combobox",defaultValue:n.get("inputValue"),"aria-autocomplete":o("autoComplete")?"both":"list","aria-controls":zs(a),"aria-expanded":I,"data-state":I?"open":"closed","aria-activedescendant":b?zd(a,b):void 0,onClick(P){P.defaultPrevented||i("openOnClick")&&m&&s({type:"INPUT.CLICK",src:"input-click"})},onFocus(){h||s({type:"INPUT.FOCUS"})},onBlur(){h||s({type:"INPUT.BLUR"})},onChange(P){s({type:"INPUT.CHANGE",value:P.currentTarget.value,src:"input-change"})},onKeyDown(P){if(P.defaultPrevented||!m||P.ctrlKey||P.shiftKey||Re(P))return;let V=i("openOnKeyPress"),A=P.ctrlKey||P.metaKey||P.shiftKey,x=!0,k={ArrowDown($){!V&&!I||(s({type:$.altKey?"OPEN":"INPUT.ARROW_DOWN",keypress:x,src:"arrow-key"}),$.preventDefault())},ArrowUp(){!V&&!I||(s({type:P.altKey?"CLOSE":"INPUT.ARROW_UP",keypress:x,src:"arrow-key"}),P.preventDefault())},Home($){A||(s({type:"INPUT.HOME",keypress:x}),I&&$.preventDefault())},End($){A||(s({type:"INPUT.END",keypress:x}),I&&$.preventDefault())},Enter($){var Se;s({type:"INPUT.ENTER",keypress:x,src:"item-select"});let te=o("isCustomValue")&&i("allowCustomValue"),Z=b!=null,ie=i("alwaysSubmitOnEnter");if(I&&!te&&!ie&&Z&&$.preventDefault(),b==null)return;let J=Ni(a,b);st(J)&&((Se=i("navigate"))==null||Se({value:b,node:J,href:J.href}))},Escape(){s({type:"INPUT.ESCAPE",keypress:x,src:"escape-key"}),P.preventDefault()}},N=ge(P,{dir:i("dir")}),D=k[N];D==null||D(P)}}))},getTriggerProps(P={}){return t.button(y(g({},Ke.trigger.attrs),{dir:i("dir"),id:eh(a),"aria-haspopup":O?"listbox":"dialog",type:"button",tabIndex:P.focusable?void 0:-1,"aria-label":c.triggerLabel,"aria-expanded":I,"data-state":I?"open":"closed","aria-controls":I?zs(a):void 0,disabled:h,"data-invalid":E(d),"data-focusable":E(P.focusable),"data-readonly":E(v),"data-disabled":E(h),onFocus(){P.focusable&&s({type:"INPUT.FOCUS",src:"trigger"})},onClick(V){V.defaultPrevented||m&&pe(V)&&s({type:"TRIGGER.CLICK",src:"trigger-click"})},onPointerDown(V){m&&V.pointerType!=="touch"&&pe(V)&&(V.preventDefault(),queueMicrotask(()=>{var A;(A=zn(a))==null||A.focus({preventScroll:!0})}))},onKeyDown(V){if(V.defaultPrevented||O)return;let A={ArrowDown(){s({type:"INPUT.ARROW_DOWN",src:"arrow-key"})},ArrowUp(){s({type:"INPUT.ARROW_UP",src:"arrow-key"})}},x=ge(V,{dir:i("dir")}),k=A[x];k&&(k(V),V.preventDefault())}}))},getContentProps(){return t.element(y(g({},Ke.content.attrs),{dir:i("dir"),id:zs(a),role:O?"listbox":"dialog",tabIndex:-1,hidden:!I,"data-state":I?"open":"closed","data-placement":n.get("currentPlacement"),"aria-labelledby":Go(a),"aria-multiselectable":i("multiple")&&O?!0:void 0,"data-empty":E(u.size===0),onPointerDown(P){pe(P)&&P.preventDefault()}}))},getListProps(){return t.element(y(g({},Ke.list.attrs),{role:O?void 0:"listbox","data-empty":E(u.size===0),"aria-labelledby":Go(a),"aria-multiselectable":i("multiple")&&!O?!0:void 0}))},getClearTriggerProps(){return t.button(y(g({},Ke.clearTrigger.attrs),{dir:i("dir"),id:th(a),type:"button",tabIndex:-1,disabled:h,"data-invalid":E(d),"aria-label":c.clearTriggerLabel,"aria-controls":Ks(a),hidden:!n.get("value").length,onPointerDown(P){pe(P)&&P.preventDefault()},onClick(P){P.defaultPrevented||m&&s({type:"VALUE.CLEAR",src:"clear-trigger"})}}))},getItemState:S,getItemProps(P){let V=S(P),A=V.value;return t.element(y(g({},Ke.item.attrs),{dir:i("dir"),id:zd(a,A),role:"option",tabIndex:-1,"data-highlighted":E(V.highlighted),"data-state":V.selected?"checked":"unchecked","aria-selected":X(V.highlighted),"aria-disabled":X(V.disabled),"data-disabled":E(V.disabled),"data-value":V.value,onPointerMove(){V.disabled||V.highlighted||s({type:"ITEM.POINTER_MOVE",value:A})},onPointerLeave(){if(P.persistFocus||V.disabled)return;let x=l.previous();x!=null&&x.type.includes("POINTER")&&s({type:"ITEM.POINTER_LEAVE",value:A})},onClick(x){rr(x)||Fn(x)||hi(x)||V.disabled||s({type:"ITEM.CLICK",src:"item-select",value:A})}}))},getItemTextProps(P){let V=S(P);return t.element(y(g({},Ke.itemText.attrs),{dir:i("dir"),"data-state":V.selected?"checked":"unchecked","data-disabled":E(V.disabled),"data-highlighted":E(V.highlighted)}))},getItemIndicatorProps(P){let V=S(P);return t.element(y(g({"aria-hidden":!0},Ke.itemIndicator.attrs),{dir:i("dir"),"data-state":V.selected?"checked":"unchecked",hidden:!V.selected}))},getItemGroupProps(P){let{id:V}=P;return t.element(y(g({},Ke.itemGroup.attrs),{dir:i("dir"),id:TI(a,V),"aria-labelledby":Kd(a,V),"data-empty":E(u.size===0),role:"group"}))},getItemGroupLabelProps(P){let{htmlFor:V}=P;return t.element(y(g({},Ke.itemGroupLabel.attrs),{dir:i("dir"),id:Kd(a,V),role:"presentation"}))}}}function Zd(e){return(e.previousEvent||e).src}function $I(e){return e.replace(/_([a-z])/g,(t,n)=>n.toUpperCase())}function HI(e){let t={};for(let[n,i]of Object.entries(e)){let r=$I(n);t[r]=i}return t}var CI,Ke,Ys,SI,Go,Jd,Ks,zs,Qd,eh,th,TI,Kd,zd,Kn,zn,Yd,jd,Cr,OI,Ni,Xd,wI,xI,AI,kI,we,tt,NI,RI,ux,DI,dx,LI,hx,MI,gx,FI,BI,ih=re(()=>{"use strict";yr();Pr();Wn();tn();se();CI=U("combobox").parts("root","clearTrigger","content","control","input","item","itemGroup","itemGroupLabel","itemIndicator","itemText","label","list","positioner","trigger"),Ke=CI.build(),Ys=e=>new Nt(e);Ys.empty=()=>new Nt({items:[]});SI=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`combobox:${e.id}`},Go=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`combobox:${e.id}:label`},Jd=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`combobox:${e.id}:control`},Ks=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`combobox:${e.id}:input`},zs=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`combobox:${e.id}:content`},Qd=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`combobox:${e.id}:popper`},eh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`combobox:${e.id}:toggle-btn`},th=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`combobox:${e.id}:clear-btn`},TI=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:i.call(n,t))!=null?r:`combobox:${e.id}:optgroup:${t}`},Kd=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:i.call(n,t))!=null?r:`combobox:${e.id}:optgroup-label:${t}`},zd=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`combobox:${e.id}:option:${t}`},Kn=e=>e.getById(zs(e)),zn=e=>e.getById(Ks(e)),Yd=e=>e.getById(Qd(e)),jd=e=>e.getById(Jd(e)),Cr=e=>e.getById(eh(e)),OI=e=>e.getById(th(e)),Ni=(e,t)=>{if(t==null)return null;let n=`[role=option][data-value="${CSS.escape(t)}"]`;return vi(Kn(e),n)},Xd=e=>{let t=zn(e);e.isActiveElement(t)||t==null||t.focus({preventScroll:!0})},wI=e=>{let t=Cr(e);e.isActiveElement(t)||t==null||t.focus({preventScroll:!0})};({guards:xI,createMachine:AI,choose:kI}=ut()),{and:we,not:tt}=xI,NI=AI({props({props:e}){return y(g({loopFocus:!0,openOnClick:!1,defaultValue:[],defaultInputValue:"",closeOnSelect:!e.multiple,allowCustomValue:!1,alwaysSubmitOnEnter:!1,inputBehavior:"none",selectionBehavior:e.multiple?"clear":"replace",openOnKeyPress:!0,openOnChange:!0,composite:!0,navigate({node:t}){mi(t)},collection:Ys.empty()},e),{positioning:g({placement:"bottom",sameWidth:!0},e.positioning),translations:g({triggerLabel:"Toggle suggestions",clearTriggerLabel:"Clear value"},e.translations)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"suggesting":"idle"},context({prop:e,bindable:t,getContext:n,getEvent:i}){return{currentPlacement:t(()=>({defaultValue:void 0})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:fe,hash(r){return r.join(",")},onChange(r){var c;let s=n(),a=s.get("selectedItems"),o=e("collection"),l=r.map(u=>a.find(m=>o.getItemValue(m)===u)||o.find(u));s.set("selectedItems",l),(c=e("onValueChange"))==null||c({value:r,items:l})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(r){var a;let s=e("collection").find(r);(a=e("onHighlightChange"))==null||a({highlightedValue:r,highlightedItem:s})}})),inputValue:t(()=>{let r=e("inputValue")||e("defaultInputValue"),s=e("value")||e("defaultValue");if(!r.trim()&&!e("multiple")){let a=e("collection").stringifyMany(s);r=Ce(e("selectionBehavior"),{preserve:r||a,replace:a,clear:""})}return{defaultValue:r,value:e("inputValue"),onChange(a){var c;let o=i(),l=(o.previousEvent||o).src;(c=e("onInputValueChange"))==null||c({inputValue:a,reason:l})}}}),highlightedItem:t(()=>{let r=e("highlightedValue");return{defaultValue:e("collection").find(r)}}),selectedItems:t(()=>{let r=e("value")||e("defaultValue")||[];return{defaultValue:e("collection").findMany(r)}})}},computed:{isInputValueEmpty:({context:e})=>e.get("inputValue").length===0,isInteractive:({prop:e})=>!(e("readOnly")||e("disabled")),autoComplete:({prop:e})=>e("inputBehavior")==="autocomplete",autoHighlight:({prop:e})=>e("inputBehavior")==="autohighlight",hasSelectedItems:({context:e})=>e.get("value").length>0,valueAsString:({context:e,prop:t})=>t("collection").stringifyItems(e.get("selectedItems")),isCustomValue:({context:e,computed:t})=>e.get("inputValue")!==t("valueAsString")},watch({context:e,prop:t,track:n,action:i,send:r}){n([()=>e.hash("value")],()=>{i(["syncSelectedItems"])}),n([()=>e.get("inputValue")],()=>{i(["syncInputValue"])}),n([()=>e.get("highlightedValue")],()=>{i(["syncHighlightedItem","autofillInputValue"])}),n([()=>t("open")],()=>{i(["toggleVisibility"])}),n([()=>t("collection").toString()],()=>{r({type:"CHILDREN_CHANGE"})})},on:{"SELECTED_ITEMS.SYNC":{actions:["syncSelectedItems"]},"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedValue"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedValue"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setValue"]},"INPUT_VALUE.SET":{actions:["setInputValue"]},"POSITIONING.SET":{actions:["reposition"]}},entry:kI([{guard:"autoFocus",actions:["setInitialFocus"]}]),states:{idle:{tags:["idle","closed"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":{target:"interacting"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{target:"focused",actions:["clearInputValue","clearSelectedItems","setInitialFocus"]}}},focused:{tags:["focused","closed"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":[{guard:"isChangeEvent",target:"suggesting"},{target:"interacting"}],"INPUT.CHANGE":[{guard:we("isOpenControlled","openOnChange"),actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{guard:"openOnChange",target:"suggesting",actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{actions:["setInputValue"]}],"LAYER.INTERACT_OUTSIDE":{target:"idle"},"INPUT.ESCAPE":{guard:we("isCustomValue",tt("allowCustomValue")),actions:["revertInputValue"]},"INPUT.BLUR":{target:"idle"},"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_DOWN":[{guard:we("isOpenControlled","autoComplete"),actions:["invokeOnOpen"]},{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{guard:"isOpenControlled",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_UP":[{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{target:"interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{actions:["clearInputValue","clearSelectedItems"]}}},interacting:{tags:["open","focused"],entry:["setInitialFocus"],effects:["scrollToHighlightedItem","trackDismissableLayer","trackPlacement"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["setFinalFocus"]},{target:"idle"}],CHILDREN_CHANGE:[{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{actions:["scrollToHighlightedItem"]}],"INPUT.HOME":{actions:["highlightFirstItem"]},"INPUT.END":{actions:["highlightLastItem"]},"INPUT.ARROW_DOWN":[{guard:we("autoComplete","isLastItemHighlighted"),actions:["clearHighlightedValue","scrollContentToTop"]},{actions:["highlightNextItem"]}],"INPUT.ARROW_UP":[{guard:we("autoComplete","isFirstItemHighlighted"),actions:["clearHighlightedValue"]},{actions:["highlightPrevItem"]}],"INPUT.ENTER":[{guard:we("isOpenControlled","isCustomValue",tt("hasHighlightedItem"),tt("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:we("isCustomValue",tt("hasHighlightedItem"),tt("allowCustomValue")),target:"focused",actions:["revertInputValue","invokeOnClose"]},{guard:we("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"INPUT.CHANGE":[{guard:"autoComplete",target:"suggesting",actions:["setInputValue"]},{target:"suggesting",actions:["clearHighlightedValue","setInputValue"]}],"ITEM.POINTER_MOVE":{actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"ITEM.CLICK":[{guard:we("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],"LAYER.ESCAPE":[{guard:we("isOpenControlled","autoComplete"),actions:["syncInputValue","invokeOnClose"]},{guard:"autoComplete",target:"focused",actions:["syncInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"LAYER.INTERACT_OUTSIDE":[{guard:we("isOpenControlled","isCustomValue",tt("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:we("isCustomValue",tt("allowCustomValue")),target:"idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]}},suggesting:{tags:["open","focused"],effects:["trackDismissableLayer","scrollToHighlightedItem","trackPlacement"],entry:["setInitialFocus"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["setFinalFocus"]},{target:"idle"}],CHILDREN_CHANGE:[{guard:we("isHighlightedItemRemoved","hasCollectionItems","autoHighlight"),actions:["clearHighlightedValue","highlightFirstItem"]},{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{guard:"autoHighlight",actions:["highlightFirstItem"]}],"INPUT.ARROW_DOWN":{target:"interacting",actions:["highlightNextItem"]},"INPUT.ARROW_UP":{target:"interacting",actions:["highlightPrevItem"]},"INPUT.HOME":{target:"interacting",actions:["highlightFirstItem"]},"INPUT.END":{target:"interacting",actions:["highlightLastItem"]},"INPUT.ENTER":[{guard:we("isOpenControlled","isCustomValue",tt("hasHighlightedItem"),tt("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:we("isCustomValue",tt("hasHighlightedItem"),tt("allowCustomValue")),target:"focused",actions:["revertInputValue","invokeOnClose"]},{guard:we("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"INPUT.CHANGE":{actions:["setInputValue"]},"LAYER.ESCAPE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"ITEM.POINTER_MOVE":{target:"interacting",actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"LAYER.INTERACT_OUTSIDE":[{guard:we("isOpenControlled","isCustomValue",tt("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:we("isCustomValue",tt("allowCustomValue")),target:"idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"ITEM.CLICK":[{guard:we("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]}}},implementations:{guards:{isInputValueEmpty:({computed:e})=>e("isInputValueEmpty"),autoComplete:({computed:e,prop:t})=>e("autoComplete")&&!t("multiple"),autoHighlight:({computed:e})=>e("autoHighlight"),isFirstItemHighlighted:({prop:e,context:t})=>e("collection").firstValue===t.get("highlightedValue"),isLastItemHighlighted:({prop:e,context:t})=>e("collection").lastValue===t.get("highlightedValue"),isCustomValue:({computed:e})=>e("isCustomValue"),allowCustomValue:({prop:e})=>!!e("allowCustomValue"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null,openOnChange:({prop:e,context:t})=>{let n=e("openOnChange");return Uc(n)?n:!!(n!=null&&n({inputValue:t.get("inputValue")}))},restoreFocus:({event:e})=>{var n,i;let t=(i=e.restoreFocus)!=null?i:(n=e.previousEvent)==null?void 0:n.restoreFocus;return t==null?!0:!!t},isChangeEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="INPUT.CHANGE"},autoFocus:({prop:e})=>!!e("autoFocus"),isHighlightedItemRemoved:({prop:e,context:t})=>!e("collection").has(t.get("highlightedValue")),hasCollectionItems:({prop:e})=>e("collection").size>0},effects:{trackDismissableLayer({send:e,prop:t,scope:n}){return t("disableLayer")?void 0:Ft(()=>Kn(n),{type:"listbox",defer:!0,exclude:()=>[zn(n),Cr(n),OI(n)],onFocusOutside:t("onFocusOutside"),onPointerDownOutside:t("onPointerDownOutside"),onInteractOutside:t("onInteractOutside"),onEscapeKeyDown(r){r.preventDefault(),r.stopPropagation(),e({type:"LAYER.ESCAPE",src:"escape-key"})},onDismiss(){e({type:"LAYER.INTERACT_OUTSIDE",src:"interact-outside",restoreFocus:!1})}})},trackPlacement({context:e,prop:t,scope:n}){let i=()=>jd(n)||Cr(n),r=()=>Yd(n);return e.set("currentPlacement",t("positioning").placement),It(i,r,y(g({},t("positioning")),{defer:!0,onComplete(s){e.set("currentPlacement",s.placement)}}))},scrollToHighlightedItem({context:e,prop:t,scope:n,event:i}){let r=zn(n),s=[],a=c=>{let u=i.current().type.includes("POINTER"),h=e.get("highlightedValue");if(u||!h)return;let m=Kn(n),d=t("scrollToIndexFn");if(d){let I=t("collection").indexOf(h);d({index:I,immediate:c,getElement:()=>Ni(n,h)});return}let p=Ni(n,h),v=H(()=>{Xt(p,{rootEl:m,block:"nearest"})});s.push(v)},o=H(()=>a(!0));s.push(o);let l=ot(r,{attributes:["aria-activedescendant"],callback:()=>a(!1)});return s.push(l),()=>{s.forEach(c=>c())}}},actions:{reposition({context:e,prop:t,scope:n,event:i}){It(()=>jd(n),()=>Yd(n),y(g(g({},t("positioning")),i.options),{defer:!0,listeners:!1,onComplete(a){e.set("currentPlacement",a.placement)}}))},setHighlightedValue({context:e,event:t}){t.value!=null&&e.set("highlightedValue",t.value)},clearHighlightedValue({context:e}){e.set("highlightedValue",null)},selectHighlightedItem(e){var o;let{context:t,prop:n}=e,i=n("collection"),r=t.get("highlightedValue");if(!r||!i.has(r))return;let s=n("multiple")?yt(t.get("value"),r):[r];(o=n("onSelect"))==null||o({value:s,itemValue:r}),t.set("value",s);let a=Ce(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:i.stringifyMany(s),clear:""});t.set("inputValue",a)},scrollToHighlightedItem({context:e,prop:t,scope:n}){$n(()=>{let i=e.get("highlightedValue");if(i==null)return;let r=Ni(n,i),s=Kn(n),a=t("scrollToIndexFn");if(a){let o=t("collection").indexOf(i);a({index:o,immediate:!0,getElement:()=>Ni(n,i)});return}Xt(r,{rootEl:s,block:"nearest"})})},selectItem(e){let{context:t,event:n,flush:i,prop:r}=e;n.value!=null&&i(()=>{var o;let s=r("multiple")?yt(t.get("value"),n.value):[n.value];(o=r("onSelect"))==null||o({value:s,itemValue:n.value}),t.set("value",s);let a=Ce(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany(s),clear:""});t.set("inputValue",a)})},clearItem(e){let{context:t,event:n,flush:i,prop:r}=e;n.value!=null&&i(()=>{let s=ct(t.get("value"),n.value);t.set("value",s);let a=Ce(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany(s),clear:""});t.set("inputValue",a)})},setInitialFocus({scope:e}){H(()=>{Xd(e)})},setFinalFocus({scope:e}){H(()=>{let t=Cr(e);(t==null?void 0:t.dataset.focusable)==null?Xd(e):wI(e)})},syncInputValue({context:e,scope:t,event:n}){let i=zn(t);i&&(i.value=e.get("inputValue"),queueMicrotask(()=>{n.current().type!=="INPUT.CHANGE"&&tr(i)}))},setInputValue({context:e,event:t}){e.set("inputValue",t.value)},clearInputValue({context:e}){e.set("inputValue","")},revertInputValue({context:e,prop:t,computed:n}){let i=t("selectionBehavior"),r=Ce(i,{replace:n("hasSelectedItems")?n("valueAsString"):"",preserve:e.get("inputValue"),clear:""});e.set("inputValue",r)},setValue(e){let{context:t,flush:n,event:i,prop:r}=e;n(()=>{t.set("value",i.value);let s=Ce(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany(i.value),clear:""});t.set("inputValue",s)})},clearSelectedItems(e){let{context:t,flush:n,prop:i}=e;n(()=>{t.set("value",[]);let r=Ce(i("selectionBehavior"),{preserve:t.get("inputValue"),replace:i("collection").stringifyMany([]),clear:""});t.set("inputValue",r)})},scrollContentToTop({prop:e,scope:t}){let n=e("scrollToIndexFn");if(n){let i=e("collection").firstValue;n({index:0,immediate:!0,getElement:()=>Ni(t,i)})}else{let i=Kn(t);if(!i)return;i.scrollTop=0}},invokeOnOpen({prop:e,event:t,context:n}){var r;let i=Zd(t);(r=e("onOpenChange"))==null||r({open:!0,reason:i,value:n.get("value")})},invokeOnClose({prop:e,event:t,context:n}){var r;let i=Zd(t);(r=e("onOpenChange"))==null||r({open:!1,reason:i,value:n.get("value")})},highlightFirstItem({context:e,prop:t,scope:n}){(Kn(n)?queueMicrotask:H)(()=>{let r=t("collection").firstValue;r&&e.set("highlightedValue",r)})},highlightFirstItemIfNeeded({computed:e,action:t}){e("autoHighlight")&&t(["highlightFirstItem"])},highlightLastItem({context:e,prop:t,scope:n}){(Kn(n)?queueMicrotask:H)(()=>{let r=t("collection").lastValue;r&&e.set("highlightedValue",r)})},highlightNextItem({context:e,prop:t}){let n=null,i=e.get("highlightedValue"),r=t("collection");i?(n=r.getNextValue(i),!n&&t("loopFocus")&&(n=r.firstValue)):n=r.firstValue,n&&e.set("highlightedValue",n)},highlightPrevItem({context:e,prop:t}){let n=null,i=e.get("highlightedValue"),r=t("collection");i?(n=r.getPreviousValue(i),!n&&t("loopFocus")&&(n=r.lastValue)):n=r.lastValue,n&&e.set("highlightedValue",n)},highlightFirstSelectedItem({context:e,prop:t}){H(()=>{let[n]=t("collection").sort(e.get("value"));n&&e.set("highlightedValue",n)})},highlightFirstOrSelectedItem({context:e,prop:t,computed:n}){H(()=>{let i=null;n("hasSelectedItems")?i=t("collection").sort(e.get("value"))[0]:i=t("collection").firstValue,i&&e.set("highlightedValue",i)})},highlightLastOrSelectedItem({context:e,prop:t,computed:n}){H(()=>{let i=t("collection"),r=null;n("hasSelectedItems")?r=i.sort(e.get("value"))[0]:r=i.lastValue,r&&e.set("highlightedValue",r)})},autofillInputValue({context:e,computed:t,prop:n,event:i,scope:r}){let s=zn(r),a=n("collection");if(!t("autoComplete")||!s||!i.keypress)return;let o=a.stringify(e.get("highlightedValue"));H(()=>{s.value=o||e.get("inputValue")})},syncSelectedItems(e){queueMicrotask(()=>{let{context:t,prop:n}=e,i=n("collection"),r=t.get("value"),s=r.map(o=>t.get("selectedItems").find(c=>i.getItemValue(c)===o)||i.find(o));t.set("selectedItems",s);let a=Ce(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:i.stringifyMany(r),clear:""});t.set("inputValue",a)})},syncHighlightedItem({context:e,prop:t}){let n=t("collection").find(e.get("highlightedValue"));e.set("highlightedItem",n)},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}});RI=_()(["allowCustomValue","autoFocus","closeOnSelect","collection","composite","defaultHighlightedValue","defaultInputValue","defaultOpen","defaultValue","dir","disabled","disableLayer","form","getRootNode","highlightedValue","id","ids","inputBehavior","inputValue","invalid","loopFocus","multiple","name","navigate","onFocusOutside","onHighlightChange","onInputValueChange","onInteractOutside","onOpenChange","onOpenChange","onPointerDownOutside","onSelect","onValueChange","open","openOnChange","openOnClick","openOnKeyPress","placeholder","positioning","readOnly","required","scrollToIndexFn","selectionBehavior","translations","value","alwaysSubmitOnEnter"]),ux=B(RI),DI=_()(["htmlFor"]),dx=B(DI),LI=_()(["id"]),hx=B(LI),MI=_()(["item","persistFocus"]),gx=B(MI),FI=class extends K{constructor(){super(...arguments);z(this,"options",[]);z(this,"allOptions",[]);z(this,"hasGroups",!1)}setAllOptions(t){this.allOptions=t,this.options=t}getCollection(){let t=this.options||this.allOptions||[];return this.hasGroups?Ys({items:t,itemToValue:n=>{var i;return(i=n.id)!=null?i:""},itemToString:n=>n.label,isItemDisabled:n=>{var i;return(i=n.disabled)!=null?i:!1},groupBy:n=>{var i;return(i=n.group)!=null?i:""}}):Ys({items:t,itemToValue:n=>{var i;return(i=n.id)!=null?i:""},itemToString:n=>n.label,isItemDisabled:n=>{var i;return(i=n.disabled)!=null?i:!1}})}initMachine(t){let n=this.getCollection.bind(this);return new W(NI,y(g({},t),{get collection(){return n()},onOpenChange:i=>{i.open&&(this.options=this.allOptions),t.onOpenChange&&t.onOpenChange(i)},onInputValueChange:i=>{let r=this.allOptions.filter(s=>s.label.toLowerCase().includes(i.inputValue.toLowerCase()));this.options=r.length>0?r:this.allOptions,t.onInputValueChange&&t.onInputValueChange(i)}}))}initApi(){return VI(this.machine.service,q)}renderItems(){var i,r,s,a;let t=this.el.querySelector('[data-scope="combobox"][data-part="content"]');if(!t)return;let n=this.el.querySelector('[data-templates="combobox"]');if(n)if(t.querySelectorAll('[data-scope="combobox"][data-part="item"]:not([data-template])').forEach(o=>o.remove()),t.querySelectorAll('[data-scope="combobox"][data-part="item-group"]:not([data-template])').forEach(o=>o.remove()),this.hasGroups){let o=(s=(r=(i=this.api.collection).group)==null?void 0:r.call(i))!=null?s:[];this.renderGroupedItems(t,n,o)}else{let o=(a=this.options)!=null&&a.length?this.options:this.allOptions;this.renderFlatItems(t,n,o)}}renderGroupedItems(t,n,i){for(let[r,s]of i){if(r==null)continue;let a=n.querySelector(`[data-scope="combobox"][data-part="item-group"][data-id="${r}"][data-template]`);if(!a)continue;let o=a.cloneNode(!0);o.removeAttribute("data-template"),this.spreadProps(o,this.api.getItemGroupProps({id:r}));let l=o.querySelector('[data-scope="combobox"][data-part="item-group-label"]');l&&this.spreadProps(l,this.api.getItemGroupLabelProps({htmlFor:r}));let c=o.querySelector('[data-scope="combobox"][data-part="item-group-content"]');if(c){c.innerHTML="";for(let u of s){let h=this.cloneItem(n,u);h&&c.appendChild(h)}t.appendChild(o)}}}renderFlatItems(t,n,i){for(let r of i){let s=this.cloneItem(n,r);s&&t.appendChild(s)}}cloneItem(t,n){var l,c,u,h;let i=(h=(u=(c=(l=this.api.collection).getItemValue)==null?void 0:c.call(l,n))!=null?u:n.id)!=null?h:"",r=t.querySelector(`[data-scope="combobox"][data-part="item"][data-value="${i}"][data-template]`);if(!r)return null;let s=r.cloneNode(!0);s.removeAttribute("data-template"),this.spreadProps(s,this.api.getItemProps({item:n}));let a=s.querySelector('[data-scope="combobox"][data-part="item-text"]');a&&(this.spreadProps(a,this.api.getItemTextProps({item:n})),a.children.length===0&&(a.textContent=n.label||""));let o=s.querySelector('[data-scope="combobox"][data-part="item-indicator"]');return o&&this.spreadProps(o,this.api.getItemIndicatorProps({item:n})),s}render(){let t=this.el.querySelector('[data-scope="combobox"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps()),["label","control","input","trigger","clear-trigger","positioner"].forEach(i=>{let r=this.el.querySelector(`[data-scope="combobox"][data-part="${i}"]`);if(!r)return;let s="get"+i.split("-").map(a=>a[0].toUpperCase()+a.slice(1)).join("")+"Props";this.spreadProps(r,this.api[s]())});let n=this.el.querySelector('[data-scope="combobox"][data-part="content"]');n&&(this.spreadProps(n,this.api.getContentProps()),this.renderItems())}};BI={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=JSON.parse(e.dataset.collection||"[]"),i=n.some(l=>!!l.group),r=y(g({id:e.id},C(e,"controlled")?{value:Q(e,"value")}:{defaultValue:Q(e,"defaultValue")}),{disabled:C(e,"disabled"),placeholder:w(e,"placeholder"),alwaysSubmitOnEnter:C(e,"alwaysSubmitOnEnter"),autoFocus:C(e,"autoFocus"),closeOnSelect:C(e,"closeOnSelect"),dir:w(e,"dir",["ltr","rtl"]),inputBehavior:w(e,"inputBehavior",["autohighlight","autocomplete","none"]),loopFocus:C(e,"loopFocus"),multiple:C(e,"multiple"),invalid:C(e,"invalid"),allowCustomValue:!1,selectionBehavior:"replace",name:"",form:w(e,"form"),readOnly:C(e,"readOnly"),required:C(e,"required"),positioning:(()=>{let l=e.dataset.positioning;if(l)try{let c=JSON.parse(l);return HI(c)}catch(c){return}})(),onOpenChange:l=>{let c=w(e,"onOpenChange");c&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(c,{open:l.open,reason:l.reason,value:l.value,id:e.id});let u=w(e,"onOpenChangeClient");u&&e.dispatchEvent(new CustomEvent(u,{bubbles:C(e,"bubble"),detail:{open:l.open,reason:l.reason,value:l.value,id:e.id}}))},onInputValueChange:l=>{let c=w(e,"onInputValueChange");c&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(c,{value:l.inputValue,reason:l.reason,id:e.id});let u=w(e,"onInputValueChangeClient");u&&e.dispatchEvent(new CustomEvent(u,{bubbles:C(e,"bubble"),detail:{value:l.inputValue,reason:l.reason,id:e.id}}))},onValueChange:l=>{let c=e.querySelector('[data-scope="combobox"][data-part="value-input"]');if(c){let m=O=>{var f;let b=n.find(S=>{var P;return String((P=S.id)!=null?P:"")===O||S.label===O});return b?String((f=b.id)!=null?f:""):O},d=l.value.length===0?"":l.value.length===1?m(String(l.value[0])):l.value.map(O=>m(String(O))).join(",");c.value=d;let p=c.getAttribute("form"),v=null;p?v=document.getElementById(p):v=c.closest("form");let I=new Event("change",{bubbles:!0,cancelable:!0});c.dispatchEvent(I);let T=new Event("input",{bubbles:!0,cancelable:!0});c.dispatchEvent(T),v&&v.hasAttribute("phx-change")&&requestAnimationFrame(()=>{let O=v.querySelector("input, select, textarea");if(O){let b=new Event("change",{bubbles:!0,cancelable:!0});O.dispatchEvent(b)}else{let b=new Event("change",{bubbles:!0,cancelable:!0});v.dispatchEvent(b)}})}let u=w(e,"onValueChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(u,{value:l.value,items:l.items,id:e.id});let h=w(e,"onValueChangeClient");h&&e.dispatchEvent(new CustomEvent(h,{bubbles:C(e,"bubble"),detail:{value:l.value,items:l.items,id:e.id}}))}}),s=new FI(e,r);s.hasGroups=i,s.setAllOptions(n),s.init();let a=e.querySelector('[data-scope="combobox"][data-part="input"]');a&&(a.removeAttribute("name"),a.removeAttribute("form"));let o=C(e,"controlled")?Q(e,"value"):Q(e,"defaultValue");if(o&&o.length>0){let l=n.filter(c=>{var u;return o.includes((u=c.id)!=null?u:"")});if(l.length>0){let c=l.map(u=>{var h;return(h=u.label)!=null?h:""}).join(", ");if(s.api&&typeof s.api.setInputValue=="function")s.api.setInputValue(c);else{let u=e.querySelector('[data-scope="combobox"][data-part="input"]');u&&(u.value=c)}}}this.combobox=s,this.handlers=[]},updated(){let e=JSON.parse(this.el.dataset.collection||"[]"),t=e.some(n=>!!n.group);if(this.combobox){this.combobox.hasGroups=t,this.combobox.setAllOptions(e),this.combobox.updateProps(y(g({},C(this.el,"controlled")?{value:Q(this.el,"value")}:{defaultValue:Q(this.el,"defaultValue")}),{name:w(this.el,"name"),form:w(this.el,"form"),disabled:C(this.el,"disabled"),multiple:C(this.el,"multiple"),dir:w(this.el,"dir",["ltr","rtl"]),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly")}));let n=this.el.querySelector('[data-scope="combobox"][data-part="input"]');n&&(n.removeAttribute("name"),n.removeAttribute("form"),n.name="")}},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.combobox)==null||e.destroy()}}});var eg={};he(eg,{DatePicker:()=>kC});function Uo(e,t){return e-t*Math.floor(e/t)}function js(e,t,n,i){t=al(e,t);let r=t-1,s=-2;return n<=2?s=0:na(t)&&(s=-1),bh-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+s+i)}function na(e){return e%4===0&&(e%100!==0||e%400===0)}function al(e,t){return e==="BC"?1-t:t}function _I(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}function Zn(e,t){return t=it(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function qI(e,t){return t=it(t,e.calendar),e=rn(e),t=rn(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function WI(e,t){return t=it(t,e.calendar),e=Or(e),t=Or(t),e.era===t.era&&e.year===t.year}function KI(e,t){return aa(e.calendar,t.calendar)&&Zn(e,t)}function zI(e,t){return aa(e.calendar,t.calendar)&&qI(e,t)}function YI(e,t){return aa(e.calendar,t.calendar)&&WI(e,t)}function aa(e,t){var n,i,r,s;return(s=(r=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,t))!==null&&r!==void 0?r:(i=t.isEqual)===null||i===void 0?void 0:i.call(t,e))!==null&&s!==void 0?s:e.identifier===t.identifier}function jI(e,t){return Zn(e,oa(t))}function Eh(e,t,n){let i=e.calendar.toJulianDay(e),r=n?XI[n]:QI(t),s=Math.ceil(i+1-r)%7;return s<0&&(s+=7),s}function Ih(e){return sn(Date.now(),e)}function oa(e){return Yn(Ih(e))}function Ph(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function ZI(e,t){return rh(e)-rh(t)}function rh(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}function ol(){return qo==null&&(qo=new Intl.DateTimeFormat().resolvedOptions().timeZone),qo}function rn(e){return e.subtract({days:e.day-1})}function Zo(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function Or(e){return rn(e.subtract({months:e.month-1}))}function JI(e){return Zo(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function wr(e,t,n){let i=Eh(e,t,n);return e.subtract({days:i})}function sh(e,t,n){return wr(e,t,n).add({days:6})}function Ch(e){if(Intl.Locale){let n=ah.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&ah.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function QI(e){let t=Wo.get(e);if(!t){if(Intl.Locale){let i=new Intl.Locale(e);if("getWeekInfo"in i&&(t=i.getWeekInfo(),t))return Wo.set(e,t),t.firstDay}let n=Ch(e);if(e.includes("-fw-")){let i=e.split("-fw-")[1].split("-")[0];i==="mon"?t={firstDay:1}:i==="tue"?t={firstDay:2}:i==="wed"?t={firstDay:3}:i==="thu"?t={firstDay:4}:i==="fri"?t={firstDay:5}:i==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:n&&UI[n]||0};Wo.set(e,t)}return t.firstDay}function eP(e,t,n){let i=e.calendar.getDaysInMonth(e);return Math.ceil((Eh(rn(e),t,n)+i)/7)}function Sh(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function Th(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}function nP(e,t){let n=e.calendar.toJulianDay(e),i=Math.ceil(n+1)%7;i<0&&(i+=7);let r=Ch(t),[s,a]=tP[r]||[6,0];return i===s||i===a}function Fi(e){e=it(e,new Mi);let t=al(e.era,e.year);return Oh(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Oh(e,t,n,i,r,s,a){let o=new Date;return o.setUTCHours(i,r,s,a),o.setUTCFullYear(e,t-1,n),o.getTime()}function Jo(e,t){if(t==="UTC")return 0;if(e>0&&t===ol())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:i,day:r,hour:s,minute:a,second:o}=wh(e,t);return Oh(n,i,r,s,a,o,0)-Math.floor(e/1e3)*1e3}function wh(e,t){let n=oh.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),oh.set(t,n));let i=n.formatToParts(new Date(e)),r={};for(let s of i)s.type!=="literal"&&(r[s.type]=s.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}function iP(e,t,n,i){return(n===i?[n]:[n,i]).filter(s=>rP(e,t,s))}function rP(e,t,n){let i=wh(n,t);return e.year===i.year&&e.month===i.month&&e.day===i.day&&e.hour===i.hour&&e.minute===i.minute&&e.second===i.second}function nn(e,t,n="compatible"){let i=jn(e);if(t==="UTC")return Fi(i);if(t===ol()&&n==="compatible"){i=it(i,new Mi);let l=new Date,c=al(i.era,i.year);return l.setFullYear(c,i.month-1,i.day),l.setHours(i.hour,i.minute,i.second,i.millisecond),l.getTime()}let r=Fi(i),s=Jo(r-lh,t),a=Jo(r+lh,t),o=iP(i,t,r-s,r-a);if(o.length===1)return o[0];if(o.length>1)switch(n){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-s,r-a);case"compatible":case"later":return Math.max(r-s,r-a);case"reject":throw new RangeError("No such absolute time found")}}function Vh(e,t,n="compatible"){return new Date(nn(e,t,n))}function sn(e,t){let n=Jo(e,t),i=new Date(e+n),r=i.getUTCFullYear(),s=i.getUTCMonth()+1,a=i.getUTCDate(),o=i.getUTCHours(),l=i.getUTCMinutes(),c=i.getUTCSeconds(),u=i.getUTCMilliseconds();return new Mh(r<1?"BC":"AD",r<1?-r+1:r,s,a,t,n,o,l,c,u)}function Yn(e){return new $i(e.calendar,e.era,e.year,e.month,e.day)}function jn(e,t){let n=0,i=0,r=0,s=0;if("timeZone"in e)({hour:n,minute:i,second:r,millisecond:s}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:i,second:r,millisecond:s}=t),new TP(e.calendar,e.era,e.year,e.month,e.day,n,i,r,s)}function it(e,t){if(aa(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),i=e.copy();return i.calendar=t,i.era=n.era,i.year=n.year,i.month=n.month,i.day=n.day,Xn(i),i}function sP(e,t,n){if(e instanceof Mh)return e.timeZone===t?e:oP(e,t);let i=nn(e,t,n);return sn(i,t)}function aP(e){let t=Fi(e)-e.offset;return new Date(t)}function oP(e,t){let n=Fi(e)-e.offset;return it(sn(n,t),e.calendar)}function la(e,t){let n=e.copy(),i="hour"in n?dP(n,t):0;Qo(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,el(n),xh(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=i,lP(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){var s,a;let l=(s=(a=n.calendar).isInverseEra)===null||s===void 0?void 0:s.call(a,n);n.year=r,n.month=l?1:n.calendar.getMonthsInYear(n),n.day=l?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let o=n.calendar.getMonthsInYear(n);return n.month>o&&(n.month=o,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function Qo(e,t){var n,i;!((n=(i=e.calendar).isInverseEra)===null||n===void 0)&&n.call(i,e)&&(t=-t),e.year+=t}function el(e){for(;e.month<1;)Qo(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Qo(e,1)}function lP(e){for(;e.day<1;)e.month--,el(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,el(e)}function xh(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Xn(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),xh(e)}function Ah(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function kh(e,t){return la(e,Ah(t))}function ll(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),Xn(n),n}function sa(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),uP(n),n}function cP(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Xs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Xs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Xs(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Xs(e.hour,24),t}function uP(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Xs(e,t){let n=e%t;return n<0&&(n+=t),n}function dP(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,cP(e)}function cl(e,t,n,i){let r=e.copy();switch(t){case"era":{let o=e.calendar.getEras(),l=o.indexOf(e.era);if(l<0)throw new Error("Invalid era: "+e.era);l=an(l,n,0,o.length-1,i==null?void 0:i.round),r.era=o[l],Xn(r);break}case"year":var s,a;!((s=(a=r.calendar).isInverseEra)===null||s===void 0)&&s.call(a,r)&&(n=-n),r.year=an(e.year,n,-1/0,9999,i==null?void 0:i.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=an(e.month,n,1,e.calendar.getMonthsInYear(e),i==null?void 0:i.round);break;case"day":r.day=an(e.day,n,1,e.calendar.getDaysInMonth(e),i==null?void 0:i.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Xn(r),r}function Nh(e,t,n,i){let r=e.copy();switch(t){case"hour":{let s=e.hour,a=0,o=23;if((i==null?void 0:i.hourCycle)===12){let l=s>=12;a=l?12:0,o=l?23:11}r.hour=an(s,n,a,o,i==null?void 0:i.round);break}case"minute":r.minute=an(e.minute,n,0,59,i==null?void 0:i.round);break;case"second":r.second=an(e.second,n,0,59,i==null?void 0:i.round);break;case"millisecond":r.millisecond=an(e.millisecond,n,0,999,i==null?void 0:i.round);break;default:throw new Error("Unsupported field "+t)}return r}function an(e,t,n,i,r=!1){if(r){e+=Math.sign(t),e0?e=Math.ceil(e/s)*s:e=Math.floor(e/s)*s,e>i&&(e=n)}else e+=t,ei&&(e=n+(e-i-1));return e}function Rh(e,t){let n;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let r=la(jn(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=nn(r,e.timeZone)}else n=Fi(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let i=sn(n,e.timeZone);return it(i,e.calendar)}function hP(e,t){return Rh(e,Ah(t))}function gP(e,t,n,i){switch(t){case"hour":{let r=0,s=23;if((i==null?void 0:i.hourCycle)===12){let p=e.hour>=12;r=p?12:0,s=p?23:11}let a=jn(e),o=it(sa(a,{hour:r}),new Mi),l=[nn(o,e.timeZone,"earlier"),nn(o,e.timeZone,"later")].filter(p=>sn(p,e.timeZone).day===o.day)[0],c=it(sa(a,{hour:s}),new Mi),u=[nn(c,e.timeZone,"earlier"),nn(c,e.timeZone,"later")].filter(p=>sn(p,e.timeZone).day===c.day).pop(),h=Fi(e)-e.offset,m=Math.floor(h/Sr),d=h%Sr;return h=an(m,n,Math.floor(l/Sr),Math.floor(u/Sr),i==null?void 0:i.round)*Sr+d,it(sn(h,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return Nh(e,t,n,i);case"era":case"year":case"month":case"day":{let r=cl(jn(e),t,n,i),s=nn(r,e.timeZone);return it(sn(s,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function pP(e,t,n){let i=jn(e),r=sa(ll(i,t),t);if(r.compare(i)===0)return e;let s=nn(r,e.timeZone,n);return it(sn(s,e.timeZone),e.calendar)}function yP(e){let t=e.match(fP);if(!t)throw mP.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new $i(Ko(t[1],0,9999),Ko(t[2],1,12),1);return n.day=Ko(t[3],1,n.calendar.getDaysInMonth(n)),n}function Ko(e,t,n){let i=Number(e);if(in)throw new RangeError(`Value out of range: ${t} <= ${i} <= ${n}`);return i}function bP(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function Dh(e){let t=it(e,new Mi),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Lh(e){return`${Dh(e)}T${bP(e)}`}function EP(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let n=Math.floor(e/36e5),i=Math.floor(e%36e5/6e4),r=Math.floor(e%36e5%6e4/1e3),s=`${t}${String(n).padStart(2,"0")}:${String(i).padStart(2,"0")}`;return r!==0&&(s+=`:${String(r).padStart(2,"0")}`),s}function IP(e){return`${Lh(e)}${EP(e.offset)}[${e.timeZone}]`}function PP(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ul(e,t,n){PP(e,t),t.set(e,n)}function dl(e){let t=typeof e[0]=="object"?e.shift():new Mi,n;if(typeof e[0]=="string")n=e.shift();else{let a=t.getEras();n=a[a.length-1]}let i=e.shift(),r=e.shift(),s=e.shift();return[t,n,i,r,s]}function Fh(e,t={}){if(typeof t.hour12=="boolean"&&VP()){t=g({},t);let r=wP[String(t.hour12)][e.split("-")[0]],s=t.hour12?"h12":"h23";t.hourCycle=r!=null?r:s,delete t.hour12}let n=e+(t?Object.entries(t).sort((r,s)=>r[0]s.type==="hour").value,10),r=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(s=>s.type==="hour").value,10);if(i===0&&r===23)return"h23";if(i===24&&r===23)return"h24";if(i===0&&r===11)return"h11";if(i===12&&r===11)return"h12";throw new Error("Unexpected hour cycle result")}function kP(e,t,n,i,r){let s={};for(let o in t){let l=o,c=t[l];c!=null&&(s[l]=Math.floor(c/2),s[l]>0&&c%2===0&&s[l]--)}let a=Jn(e,t,n).subtract(s);return Vr(e,a,t,n,i,r)}function Jn(e,t,n,i,r){let s=e;return t.years?s=Or(e):t.months?s=rn(e):t.weeks&&(s=wr(e,n)),Vr(e,s,t,n,i,r)}function hl(e,t,n,i,r){let s=g({},t);s.days?s.days--:s.weeks?s.weeks--:s.months?s.months--:s.years&&s.years--;let a=Jn(e,t,n).subtract(s);return Vr(e,a,t,n,i,r)}function Vr(e,t,n,i,r,s){return r&&e.compare(r)>=0&&(t=Th(t,Jn(Yn(r),n,i))),s&&e.compare(s)<=0&&(t=Sh(t,hl(Yn(s),n,i))),t}function Pt(e,t,n){let i=Yn(e);return t&&(i=Th(i,Yn(t))),n&&(i=Sh(i,Yn(n))),i}function ch(e,t,n,i,r,s){switch(t){case"start":return Jn(e,n,i,r,s);case"end":return hl(e,n,i,r,s);case"center":default:return kP(e,n,i,r,s)}}function nt(e,t){return e==null||t==null?e===t:Zn(e,t)}function uh(e,t,n,i,r){return e?t!=null&&t(e,n)?!0:$t(e,i,r):!1}function $t(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function NP(e,t,n){let i=e.subtract({days:1});return Zn(i,e)||$t(i,t,n)}function RP(e,t,n){let i=e.add({days:1});return Zn(i,e)||$t(i,t,n)}function gl(e){let t=g({},e);for(let n in t)t[n]=1;return t}function $h(e,t){let n=g({},t);return n.days?n.days--:n.days=-1,e.add(n)}function Hh(e){return(e==null?void 0:e.calendar.identifier)==="gregory"&&e.era==="BC"?"short":void 0}function Bh(e,t){let n=jn(oa(t));return new Ct(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:Hh(n),timeZone:t})}function dh(e,t){let n=oa(t);return new Ct(e,{month:"long",year:"numeric",era:Hh(n),calendar:n==null?void 0:n.calendar.identifier,timeZone:t})}function DP(e,t,n,i,r){let s=n.formatRangeToParts(e.toDate(r),t.toDate(r)),a=-1;for(let c=0;ca&&(l+=s[c].value);return i(o,l)}function Zs(e,t,n,i){if(!e)return"";let r=e,s=t!=null?t:e,a=Bh(n,i);return Zn(r,s)?a.format(r.toDate(i)):DP(r,s,a,(o,l)=>`${o} \u2013 ${l}`,i)}function _h(e){return e!=null?LP[e]:void 0}function Gh(e,t,n){let i=_h(n);return wr(e,t,i)}function Uh(e,t,n,i){let r=t.add({weeks:e}),s=[],a=Gh(r,n,i);for(;s.length<7;){s.push(a);let o=a.add({days:1});if(Zn(a,o))break;a=o}return s}function MP(e,t,n,i){let r=_h(i),s=n!=null?n:eP(e,t,r);return[...new Array(s).keys()].map(o=>Uh(o,e,t,i))}function FP(e,t){let n=new Ct(e,{weekday:"long",timeZone:t}),i=new Ct(e,{weekday:"short",timeZone:t}),r=new Ct(e,{weekday:"narrow",timeZone:t});return s=>{let a=s instanceof Date?s:s.toDate(t);return{value:s,short:i.format(a),long:n.format(a),narrow:r.format(a)}}}function $P(e,t,n,i){let r=Gh(e,i,t),s=[...new Array(7).keys()],a=FP(i,n);return s.map(o=>a(r.add({days:o})))}function HP(e,t="long"){let n=new Date(2021,0,1),i=[];for(let r=0;r<12;r++)i.push(n.toLocaleString(e,{month:t})),n.setMonth(n.getMonth()+1);return i}function BP(e){let t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}function GP(e){if(e){if(e.length===3)return e.padEnd(4,"0");if(e.length===2){let t=new Date().getFullYear(),n=Math.floor(t/100)*100,i=parseInt(e.slice(-2),10),r=n+i;return r>t+_P?(r-100).toString():r.toString()}return e}}function Li(e,t){let n=t!=null&&t.strict?10:12,i=e-e%10,r=[];for(let s=0;s0?{startDate:Jn(o,e,t,n,i),endDate:l,focusedDate:Pt(o,n,i)}:{startDate:a,endDate:l,focusedDate:Pt(o,n,i)}}}function qh(e,t,n,i,r,s){let a=xr(n,i,r,s),o=t.add(n);return a({focusedDate:e.add(n),startDate:Jn(Vr(e,o,n,i,r,s),n,i)})}function Wh(e,t,n,i,r,s){let a=xr(n,i,r,s),o=t.subtract(n);return a({focusedDate:e.subtract(n),startDate:Jn(Vr(e,o,n,i,r,s),n,i)})}function UP(e,t,n,i,r,s,a){let o=xr(i,r,s,a);if(!n&&!i.days)return o({focusedDate:e.add(gl(i)),startDate:t});if(i.days)return qh(e,t,i,r,s,a);if(i.weeks)return o({focusedDate:e.add({months:1}),startDate:t});if(i.months||i.years)return o({focusedDate:e.add({years:1}),startDate:t})}function qP(e,t,n,i,r,s,a){let o=xr(i,r,s,a);if(!n&&!i.days)return o({focusedDate:e.subtract(gl(i)),startDate:t});if(i.days)return Wh(e,t,i,r,s,a);if(i.weeks)return o({focusedDate:e.subtract({months:1}),startDate:t});if(i.months||i.years)return o({focusedDate:e.subtract({years:1}),startDate:t})}function zP(e,t,n){var c;let i=YP(t,n),{year:r,month:s,day:a}=(c=jP(i,e))!=null?c:{};if(r!=null||s!=null||a!=null){let u=new Date;r||(r=u.getFullYear().toString()),s||(s=(u.getMonth()+1).toString()),a||(a=u.getDate().toString())}if(hh(r)||(r=GP(r)),hh(r)&&WP(s)&&KP(a))return new $i(+r,+s,+a);let l=Date.parse(e);if(!isNaN(l)){let u=new Date(l);return new $i(u.getFullYear(),u.getMonth()+1,u.getDate())}}function YP(e,t){return new Ct(e,{day:"numeric",month:"numeric",year:"numeric",timeZone:t}).formatToParts(new Date(2e3,11,25)).map(({type:r,value:s})=>r==="literal"?`${s}?`:`((?!=<${r}>)\\d+)?`).join("")}function jP(e,t){var i;let n=t.match(e);return(i=e.toString().match(/<(.+?)>/g))==null?void 0:i.map(r=>{var a;let s=r.match(/<(.+)>/);return!s||s.length<=0?null:(a=r.match(/<(.+)>/))==null?void 0:a[1]}).reduce((r,s,a)=>(s&&(n&&n.length>a?r[s]=n[a+1]:r[s]=null),r),{})}function gh(e,t,n){let i=Yn(Ih(n));switch(e){case"thisWeek":return[wr(i,t),sh(i,t)];case"thisMonth":return[rn(i),i];case"thisQuarter":return[rn(i).add({months:-((i.month-1)%3)}),i];case"thisYear":return[Or(i),i];case"last3Days":return[i.add({days:-2}),i];case"last7Days":return[i.add({days:-6}),i];case"last14Days":return[i.add({days:-13}),i];case"last30Days":return[i.add({days:-29}),i];case"last90Days":return[i.add({days:-89}),i];case"lastMonth":return[rn(i.add({months:-1})),Zo(i.add({months:-1}))];case"lastQuarter":return[rn(i.add({months:-((i.month-1)%3)-3})),Zo(i.add({months:-((i.month-1)%3)-1}))];case"lastWeek":return[wr(i,t).add({weeks:-1}),sh(i,t).add({weeks:-1})];case"lastYear":return[Or(i.add({years:-1})),JI(i.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}function XP(e={}){var c;let{level:t="polite",document:n=document,root:i,delay:r=0}=e,s=(c=n.defaultView)!=null?c:window,a=i!=null?i:n.body;function o(u,h){let m=n.getElementById(Js);m==null||m.remove(),h=h!=null?h:r;let d=n.createElement("span");d.id=Js,d.dataset.liveAnnouncer="true";let p=t!=="assertive"?"status":"alert";d.setAttribute("aria-live",t),d.setAttribute("role",p),Object.assign(d.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}),a.appendChild(d),s.setTimeout(()=>{d.textContent=u},h)}function l(){let u=n.getElementById(Js);u==null||u.remove()}return{announce:o,destroy:l,toJSON(){return Js}}}function sl(e){let[t,n]=e,i;return!t||!n?i=e:i=t.compare(n)<=0?e:[n,t],i}function Ri(e,t){let[n,i]=t;return!n||!i?!1:n.compare(e)<=0&&i.compare(e)>=0}function Qs(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function lC(e){return Ce(e,{year:"calendar decade",month:"calendar year",day:"calendar month"})}function uC(e){return new Ct(e).formatToParts(new Date).map(t=>{var n;return(n=cC[t.type])!=null?n:t.value}).join("")}function hC(e){let i=new Intl.DateTimeFormat(e).formatToParts(new Date).find(r=>r.type==="literal");return i?i.value:"/"}function on(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function pl(e){return e===0?"day":e===1?"month":"year"}function fl(e,t,n){return pl(He(on(e,0),on(t,0),on(n,2)))}function pC(e,t){return on(e,0)>on(t,0)}function fC(e,t){return on(e,0)e(t))}function IC(e,t){let{state:n,context:i,prop:r,send:s,computed:a,scope:o}=e,l=i.get("startValue"),c=a("endValue"),u=i.get("value"),h=i.get("focusedValue"),m=i.get("hoveredValue"),d=m?sl([u[0],m]):[],p=!!r("disabled"),v=!!r("readOnly"),I=!!r("invalid"),T=a("isInteractive"),O=u.length===0,b=r("min"),f=r("max"),S=r("locale"),P=r("timeZone"),V=r("startOfWeek"),A=n.matches("focused"),x=n.matches("open"),k=r("selectionMode")==="range",N=r("isDateUnavailable"),D=i.get("currentPlacement"),$=On(y(g({},r("positioning")),{placement:D})),te=hC(S),Z=g(g({},gC),r("translations"));function ie(M=l){let R=r("fixedWeeks")?6:void 0;return MP(M,S,R,V)}function J(M={}){let{format:R}=M;return HP(S,R).map((F,G)=>{let ae=G+1,ze=h.set({month:ae}),Ne=$t(ze,b,f);return{label:F,value:ae,disabled:Ne}})}function Se(){var R,F;return BP({from:(R=b==null?void 0:b.year)!=null?R:1900,to:(F=f==null?void 0:f.year)!=null?F:2100}).map(G=>({label:G.toString(),value:G,disabled:!Pi(G,b==null?void 0:b.year,f==null?void 0:f.year)}))}function Pe(M){return uh(M,N,S,b,f)}function ne(M){let R=l!=null?l:Di(P);s({type:"FOCUS.SET",value:R.set({month:M})})}function Ie(M){let R=l!=null?l:Di(P);s({type:"FOCUS.SET",value:R.set({year:M})})}function rt(M){let{value:R,disabled:F}=M,G=h.set({year:R}),ze=!Li(l.year,{strict:!0}).includes(R),Ne=Pi(R,b==null?void 0:b.year,f==null?void 0:f.year),Tt={focused:h.year===M.value,selectable:ze||Ne,outsideRange:ze,selected:!!u.find(Zi=>Zi&&Zi.year===R),valueText:R.toString(),inRange:k&&(Ri(G,u)||Ri(G,d)),value:G,get disabled(){return F||!Tt.selectable}};return Tt}function Ut(M){let{value:R,disabled:F}=M,G=h.set({month:R}),ae=dh(S,P),ze={focused:h.month===M.value,selectable:!$t(G,b,f),selected:!!u.find(Ne=>Ne&&Ne.month===R&&Ne.year===h.year),valueText:ae.format(G.toDate(P)),inRange:k&&(Ri(G,u)||Ri(G,d)),value:G,get disabled(){return F||!ze.selectable}};return ze}function Xi(M){let{value:R,disabled:F,visibleRange:G=a("visibleRange")}=M,ae=Bh(S,P),ze=gl(a("visibleDuration")),Ne=r("outsideDaySelectable"),Tt=G.start.add(ze).subtract({days:1}),Zi=$t(R,G.start,Tt),kf=k&&Ri(R,u),Nf=k&&nt(R,u[0]),Rf=k&&nt(R,u[1]),Ma=k&&d.length>0,ic=Ma&&Ri(R,d),Df=Ma&&nt(R,d[0]),Lf=Ma&&nt(R,d[1]),Ji={invalid:$t(R,b,f),disabled:F||!Ne&&Zi||$t(R,b,f),selected:u.some(Mf=>nt(R,Mf)),unavailable:uh(R,N,S,b,f)&&!F,outsideRange:Zi,today:jI(R,P),weekend:nP(R,S),formattedDate:ae.format(R.toDate(P)),get focused(){return nt(R,h)&&(!Ji.outsideRange||Ne)},get ariaLabel(){return Z.dayCell(Ji)},get selectable(){return!Ji.disabled&&!Ji.unavailable},inRange:kf||ic,firstInRange:Nf,lastInRange:Rf,inHoveredRange:ic,firstInHoveredRange:Df,lastInHoveredRange:Lf};return Ji}function La(M){let{view:R="day",id:F}=M;return[R,F].filter(Boolean).join(" ")}return{focused:A,open:x,disabled:p,invalid:I,readOnly:v,inline:!!r("inline"),numOfMonths:r("numOfMonths"),selectionMode:r("selectionMode"),view:i.get("view"),getRangePresetValue(M){return gh(M,S,P)},getDaysInWeek(M,R=l){return Uh(M,R,S,V)},getOffset(M){let R=l.add(M),F=c.add(M),G=dh(S,P);return{visibleRange:{start:R,end:F},weeks:ie(R),visibleRangeText:{start:G.format(R.toDate(P)),end:G.format(F.toDate(P))}}},getMonthWeeks:ie,isUnavailable:Pe,weeks:ie(),weekDays:$P(Di(P),V,P,S),visibleRangeText:a("visibleRangeText"),value:u,valueAsDate:u.filter(M=>M!=null).map(M=>M.toDate(P)),valueAsString:a("valueAsString"),focusedValue:h,focusedValueAsDate:h==null?void 0:h.toDate(P),focusedValueAsString:r("format")(h,{locale:S,timeZone:P}),visibleRange:a("visibleRange"),selectToday(){let M=Pt(Di(P),b,f);s({type:"VALUE.SET",value:M})},setValue(M){let R=M.map(F=>Pt(F,b,f));s({type:"VALUE.SET",value:R})},clearValue(){s({type:"VALUE.CLEAR"})},setFocusedValue(M){s({type:"FOCUS.SET",value:M})},setOpen(M){r("inline")||n.matches("open")===M||s({type:M?"OPEN":"CLOSE"})},focusMonth:ne,focusYear:Ie,getYears:Se,getMonths:J,getYearsGrid(M={}){let{columns:R=1}=M,F=Li(l.year,{strict:!0}).map(G=>({label:G.toString(),value:G,disabled:!Pi(G,b==null?void 0:b.year,f==null?void 0:f.year)}));return cr(F,R)},getDecade(){let M=Li(l.year,{strict:!0});return{start:M.at(0),end:M.at(-1)}},getMonthsGrid(M={}){let{columns:R=1,format:F}=M;return cr(J({format:F}),R)},format(M,R={month:"long",year:"numeric"}){return new Ct(S,R).format(M.toDate(P))},setView(M){s({type:"VIEW.SET",view:M})},goToNext(){s({type:"GOTO.NEXT",view:i.get("view")})},goToPrev(){s({type:"GOTO.PREV",view:i.get("view")})},getRootProps(){return t.element(y(g({},de.root.attrs),{dir:r("dir"),id:QP(o),"data-state":x?"open":"closed","data-disabled":E(p),"data-readonly":E(v),"data-empty":E(O)}))},getLabelProps(M={}){let{index:R=0}=M;return t.label(y(g({},de.label.attrs),{id:JP(o,R),dir:r("dir"),htmlFor:ph(o,R),"data-state":x?"open":"closed","data-index":R,"data-disabled":E(p),"data-readonly":E(v)}))},getControlProps(){return t.element(y(g({},de.control.attrs),{dir:r("dir"),id:zh(o),"data-disabled":E(p),"data-placeholder-shown":E(O)}))},getRangeTextProps(){return t.element(y(g({},de.rangeText.attrs),{dir:r("dir")}))},getContentProps(){return t.element(y(g({},de.content.attrs),{hidden:!x,dir:r("dir"),"data-state":x?"open":"closed","data-placement":D,"data-inline":E(r("inline")),id:rl(o),tabIndex:-1,role:"application","aria-roledescription":"datepicker","aria-label":Z.content}))},getTableProps(M={}){let{view:R="day",columns:F=R==="day"?7:4}=M,G=La(M);return t.element(y(g({},de.table.attrs),{role:"grid","data-columns":F,"aria-roledescription":lC(R),id:eC(o,G),"aria-readonly":X(v),"aria-disabled":X(p),"aria-multiselectable":X(r("selectionMode")!=="single"),"data-view":R,dir:r("dir"),tabIndex:-1,onKeyDown(ae){if(ae.defaultPrevented)return;let Ne={Enter(){R==="day"&&Pe(h)||R==="month"&&!Ut({value:h.month}).selectable||R==="year"&&!rt({value:h.year}).selectable||s({type:"TABLE.ENTER",view:R,columns:F,focus:!0})},ArrowLeft(){s({type:"TABLE.ARROW_LEFT",view:R,columns:F,focus:!0})},ArrowRight(){s({type:"TABLE.ARROW_RIGHT",view:R,columns:F,focus:!0})},ArrowUp(){s({type:"TABLE.ARROW_UP",view:R,columns:F,focus:!0})},ArrowDown(){s({type:"TABLE.ARROW_DOWN",view:R,columns:F,focus:!0})},PageUp(Tt){s({type:"TABLE.PAGE_UP",larger:Tt.shiftKey,view:R,columns:F,focus:!0})},PageDown(Tt){s({type:"TABLE.PAGE_DOWN",larger:Tt.shiftKey,view:R,columns:F,focus:!0})},Home(){s({type:"TABLE.HOME",view:R,columns:F,focus:!0})},End(){s({type:"TABLE.END",view:R,columns:F,focus:!0})}}[ge(ae,{dir:r("dir")})];Ne&&(Ne(ae),ae.preventDefault(),ae.stopPropagation())},onPointerLeave(){s({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){s({type:"TABLE.POINTER_DOWN",view:R})},onPointerUp(){s({type:"TABLE.POINTER_UP",view:R})}}))},getTableHeadProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.tableHead.attrs),{"aria-hidden":!0,dir:r("dir"),"data-view":R,"data-disabled":E(p)}))},getTableHeaderProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.tableHeader.attrs),{dir:r("dir"),"data-view":R,"data-disabled":E(p)}))},getTableBodyProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.tableBody.attrs),{"data-view":R,"data-disabled":E(p)}))},getTableRowProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.tableRow.attrs),{"aria-disabled":X(p),"data-disabled":E(p),"data-view":R}))},getDayTableCellState:Xi,getDayTableCellProps(M){let{value:R}=M,F=Xi(M);return t.element(y(g({},de.tableCell.attrs),{role:"gridcell","aria-disabled":X(!F.selectable),"aria-selected":F.selected||F.inRange,"aria-invalid":X(F.invalid),"aria-current":F.today?"date":void 0,"data-value":R.toString()}))},getDayTableCellTriggerProps(M){let{value:R}=M,F=Xi(M);return t.element(y(g({},de.tableCellTrigger.attrs),{id:Xo(o,R.toString()),role:"button",dir:r("dir"),tabIndex:F.focused?0:-1,"aria-label":F.ariaLabel,"aria-disabled":X(!F.selectable),"aria-invalid":X(F.invalid),"data-disabled":E(!F.selectable),"data-selected":E(F.selected),"data-value":R.toString(),"data-view":"day","data-today":E(F.today),"data-focus":E(F.focused),"data-unavailable":E(F.unavailable),"data-range-start":E(F.firstInRange),"data-range-end":E(F.lastInRange),"data-in-range":E(F.inRange),"data-outside-range":E(F.outsideRange),"data-weekend":E(F.weekend),"data-in-hover-range":E(F.inHoveredRange),"data-hover-range-start":E(F.firstInHoveredRange),"data-hover-range-end":E(F.lastInHoveredRange),onClick(G){G.defaultPrevented||F.selectable&&s({type:"CELL.CLICK",cell:"day",value:R})},onPointerMove:k?G=>{if(G.pointerType==="touch"||!F.selectable)return;let ae=!o.isActiveElement(G.currentTarget);m&&KI(R,m)||s({type:"CELL.POINTER_MOVE",cell:"day",value:R,focus:ae})}:void 0}))},getMonthTableCellState:Ut,getMonthTableCellProps(M){let{value:R,columns:F}=M,G=Ut(M);return t.element(y(g({},de.tableCell.attrs),{dir:r("dir"),colSpan:F,role:"gridcell","aria-selected":X(G.selected||G.inRange),"data-selected":E(G.selected),"aria-disabled":X(!G.selectable),"data-value":R}))},getMonthTableCellTriggerProps(M){let{value:R}=M,F=Ut(M);return t.element(y(g({},de.tableCellTrigger.attrs),{dir:r("dir"),role:"button",id:Xo(o,R.toString()),"data-selected":E(F.selected),"aria-disabled":X(!F.selectable),"data-disabled":E(!F.selectable),"data-focus":E(F.focused),"data-in-range":E(F.inRange),"data-outside-range":E(F.outsideRange),"aria-label":F.valueText,"data-view":"month","data-value":R,tabIndex:F.focused?0:-1,onClick(G){G.defaultPrevented||F.selectable&&s({type:"CELL.CLICK",cell:"month",value:R})},onPointerMove:k?G=>{if(G.pointerType==="touch"||!F.selectable)return;let ae=!o.isActiveElement(G.currentTarget);m&&F.value&&zI(F.value,m)||s({type:"CELL.POINTER_MOVE",cell:"month",value:F.value,focus:ae})}:void 0}))},getYearTableCellState:rt,getYearTableCellProps(M){let{value:R,columns:F}=M,G=rt(M);return t.element(y(g({},de.tableCell.attrs),{dir:r("dir"),colSpan:F,role:"gridcell","aria-selected":X(G.selected),"data-selected":E(G.selected),"aria-disabled":X(!G.selectable),"data-value":R}))},getYearTableCellTriggerProps(M){let{value:R}=M,F=rt(M);return t.element(y(g({},de.tableCellTrigger.attrs),{dir:r("dir"),role:"button",id:Xo(o,R.toString()),"data-selected":E(F.selected),"data-focus":E(F.focused),"data-in-range":E(F.inRange),"aria-disabled":X(!F.selectable),"data-disabled":E(!F.selectable),"aria-label":F.valueText,"data-outside-range":E(F.outsideRange),"data-value":R,"data-view":"year",tabIndex:F.focused?0:-1,onClick(G){G.defaultPrevented||F.selectable&&s({type:"CELL.CLICK",cell:"year",value:R})},onPointerMove:k?G=>{if(G.pointerType==="touch"||!F.selectable)return;let ae=!o.isActiveElement(G.currentTarget);m&&F.value&&YI(F.value,m)||s({type:"CELL.POINTER_MOVE",cell:"year",value:F.value,focus:ae})}:void 0}))},getNextTriggerProps(M={}){let{view:R="day"}=M,F=p||!a("isNextVisibleRangeValid");return t.button(y(g({},de.nextTrigger.attrs),{dir:r("dir"),id:nC(o,R),type:"button","aria-label":Z.nextTrigger(R),disabled:F,"data-disabled":E(F),onClick(G){G.defaultPrevented||s({type:"GOTO.NEXT",view:R})}}))},getPrevTriggerProps(M={}){let{view:R="day"}=M,F=p||!a("isPrevVisibleRangeValid");return t.button(y(g({},de.prevTrigger.attrs),{dir:r("dir"),id:tC(o,R),type:"button","aria-label":Z.prevTrigger(R),disabled:F,"data-disabled":E(F),onClick(G){G.defaultPrevented||s({type:"GOTO.PREV",view:R})}}))},getClearTriggerProps(){return t.button(y(g({},de.clearTrigger.attrs),{id:Kh(o),dir:r("dir"),type:"button","aria-label":Z.clearTrigger,hidden:!u.length,onClick(M){M.defaultPrevented||s({type:"VALUE.CLEAR"})}}))},getTriggerProps(){return t.button(y(g({},de.trigger.attrs),{id:Yh(o),dir:r("dir"),type:"button","data-placement":D,"aria-label":Z.trigger(x),"aria-controls":rl(o),"data-state":x?"open":"closed","data-placeholder-shown":E(O),"aria-haspopup":"grid",disabled:p,onClick(M){M.defaultPrevented||T&&s({type:"TRIGGER.CLICK"})}}))},getViewProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.view.attrs),{"data-view":R,hidden:i.get("view")!==R}))},getViewTriggerProps(M={}){let{view:R="day"}=M;return t.button(y(g({},de.viewTrigger.attrs),{"data-view":R,dir:r("dir"),id:iC(o,R),type:"button",disabled:p,"aria-label":Z.viewTrigger(R),onClick(F){F.defaultPrevented||T&&s({type:"VIEW.TOGGLE",src:"viewTrigger"})}}))},getViewControlProps(M={}){let{view:R="day"}=M;return t.element(y(g({},de.viewControl.attrs),{"data-view":R,dir:r("dir")}))},getInputProps(M={}){let{index:R=0,fixOnBlur:F=!0}=M;return t.input(y(g({},de.input.attrs),{id:ph(o,R),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":R,"data-state":x?"open":"closed","data-placeholder-shown":E(O),readOnly:v,disabled:p,required:r("required"),"aria-invalid":X(I),"data-invalid":E(I),placeholder:r("placeholder")||uC(S),defaultValue:a("valueAsString")[R],onBeforeInput(G){let{data:ae}=Yt(G);Qh(ae,te)||G.preventDefault()},onFocus(){s({type:"INPUT.FOCUS",index:R})},onBlur(G){let ae=G.currentTarget.value.trim();s({type:"INPUT.BLUR",value:ae,index:R,fixOnBlur:F})},onKeyDown(G){if(G.defaultPrevented||!T)return;let ze={Enter(Ne){Re(Ne)||Pe(h)||Ne.currentTarget.value.trim()!==""&&s({type:"INPUT.ENTER",value:Ne.currentTarget.value,index:R})}}[G.key];ze&&(ze(G),G.preventDefault())},onInput(G){let ae=G.currentTarget.value;s({type:"INPUT.CHANGE",value:dC(ae,te),index:R})}}))},getMonthSelectProps(){return t.select(y(g({},de.monthSelect.attrs),{id:Xh(o),"aria-label":Z.monthSelect,disabled:p,dir:r("dir"),defaultValue:l.month,onChange(M){ne(Number(M.currentTarget.value))}}))},getYearSelectProps(){return t.select(y(g({},de.yearSelect.attrs),{id:Zh(o),disabled:p,"aria-label":Z.yearSelect,dir:r("dir"),defaultValue:l.year,onChange(M){Ie(Number(M.currentTarget.value))}}))},getPositionerProps(){return t.element(y(g({id:jh(o)},de.positioner.attrs),{dir:r("dir"),style:$.floating}))},getPresetTriggerProps(M){let R=Array.isArray(M.value)?M.value:gh(M.value,S,P),F=R.filter(G=>G!=null).map(G=>G.toDate(P).toDateString());return t.button(y(g({},de.presetTrigger.attrs),{"aria-label":Z.presetTrigger(F),type:"button",onClick(G){G.defaultPrevented||s({type:"PRESET.CLICK",value:R})}}))}}}function PC(e,t){if((e==null?void 0:e.length)!==(t==null?void 0:t.length))return!1;let n=Math.max(e.length,t.length);for(let i=0;in==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}function ve(e,t){let{context:n,prop:i,computed:r}=e;if(!t)return;let s=ra(e,t);if(nt(n.get("focusedValue"),s))return;let o=xr(r("visibleDuration"),i("locale"),i("min"),i("max"))({focusedDate:s,startDate:n.get("startValue")});n.set("startValue",o.startDate),n.set("focusedValue",o.focusedDate)}function ta(e,t){let{context:n}=e;n.set("startValue",t.startDate);let i=n.get("focusedValue");nt(i,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function gt(e){return Array.isArray(e)?e.map(t=>gt(t)):e instanceof Date?new $i(e.getFullYear(),e.getMonth()+1,e.getDate()):yP(e)}function yh(e){let t=n=>String(n).padStart(2,"0");return`${e.year}-${t(e.month)}-${t(e.day)}`}var bh,GI,Mi,UI,XI,qo,ah,Wo,tP,oh,lh,Sr,fP,mP,vP,Ex,CP,$i,SP,TP,OP,Mh,zo,Ct,wP,Yo,jo,LP,_P,hh,WP,KP,Js,ZP,de,JP,QP,eC,rl,Xo,tC,nC,iC,Kh,zh,ph,Yh,jh,Xh,Zh,fh,mh,ia,Tr,rC,sC,aC,oC,Jh,cC,Qh,vh,dC,gC,yC,EC,ht,CC,ra,SC,Ix,TC,Px,OC,Cx,wC,Sx,VC,Tx,xC,Ox,AC,kC,tg=re(()=>{"use strict";Pr();Wn();tn();se();bh=1721426;GI={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},Mi=class{fromJulianDay(e){let t=e,n=t-bh,i=Math.floor(n/146097),r=Uo(n,146097),s=Math.floor(r/36524),a=Uo(r,36524),o=Math.floor(a/1461),l=Uo(a,1461),c=Math.floor(l/365),u=i*400+s*100+o*4+c+(s!==4&&c!==4?1:0),[h,m]=_I(u),d=t-js(h,m,1,1),p=2;t= start date");return`${this.formatter.format(e)} \u2013 ${this.formatter.format(t)}`}formatRangeToParts(e,t){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(e,t);if(t= start date");let n=this.formatter.formatToParts(e),i=this.formatter.formatToParts(t);return[...n.map(r=>y(g({},r),{source:"startRange"})),{type:"literal",value:" \u2013 ",source:"shared"},...i.map(r=>y(g({},r),{source:"endRange"}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return xP()&&(this.resolvedHourCycle||(this.resolvedHourCycle=AP(e.locale,this.options)),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),e.calendar==="ethiopic-amete-alem"&&(e.calendar="ethioaa"),e}constructor(e,t={}){this.formatter=Fh(e,t),this.options=t}},wP={true:{ja:"h11"},false:{}};Yo=null;jo=null;LP=["sun","mon","tue","wed","thu","fri","sat"];_P=10;hh=e=>e!=null&&e.length===4,WP=e=>e!=null&&parseFloat(e)<=12,KP=e=>e!=null&&parseFloat(e)<=31;Js="__live-region__";ZP=U("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),de=ZP.build(),JP=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.label)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:label:${t}`},QP=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`datepicker:${e.id}`},eC=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.table)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:table:${t}`},rl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`datepicker:${e.id}:content`},Xo=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.cellTrigger)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:cell-trigger:${t}`},tC=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.prevTrigger)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:prev:${t}`},nC=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.nextTrigger)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:next:${t}`},iC=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.viewTrigger)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:view:${t}`},Kh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`datepicker:${e.id}:clear`},zh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`datepicker:${e.id}:control`},ph=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.input)==null?void 0:i.call(n,t))!=null?r:`datepicker:${e.id}:input:${t}`},Yh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`datepicker:${e.id}:trigger`},jh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`datepicker:${e.id}:positioner`},Xh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.monthSelect)!=null?n:`datepicker:${e.id}:month-select`},Zh=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.yearSelect)!=null?n:`datepicker:${e.id}:year-select`},fh=(e,t)=>vi(ia(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),mh=e=>e.getById(Yh(e)),ia=e=>e.getById(rl(e)),Tr=e=>Fe(Jh(e),"[data-part=input]"),rC=e=>e.getById(Zh(e)),sC=e=>e.getById(Xh(e)),aC=e=>e.getById(Kh(e)),oC=e=>e.getById(jh(e)),Jh=e=>e.getById(zh(e));cC={day:"dd",month:"mm",year:"yyyy"};Qh=(e,t)=>e?/\d/.test(e)||e===t||e.length!==1:!0,vh=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),dC=(e,t)=>e.split("").filter(n=>Qh(n,t)).join("");gC={dayCell(e){return e.unavailable?`Not available. ${e.formattedDate}`:e.selected?`Selected date. ${e.formattedDate}`:`Choose ${e.formattedDate}`},trigger(e){return e?"Close calendar":"Open calendar"},viewTrigger(e){return Ce(e,{year:"Switch to month view",month:"Switch to day view",day:"Switch to year view"})},presetTrigger(e){let[t="",n=""]=e;return`select ${t} to ${n}`},prevTrigger(e){return Ce(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return Ce(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates"};yC=["day","month","year"];EC=Bn(e=>[e.view,e.startValue.toString(),e.endValue.toString(),e.locale],([e],t)=>{let{startValue:n,endValue:i,locale:r,timeZone:s,selectionMode:a}=t;if(e==="year"){let h=Li(n.year,{strict:!0}),m=h.at(0).toString(),d=h.at(-1).toString();return{start:m,end:d,formatted:`${m} - ${d}`}}if(e==="month"){let h=new Ct(r,{year:"numeric",timeZone:s}),m=h.format(n.toDate(s)),d=h.format(i.toDate(s)),p=a==="range"?`${m} - ${d}`:m;return{start:m,end:d,formatted:p}}let o=new Ct(r,{month:"long",year:"numeric",timeZone:s}),l=o.format(n.toDate(s)),c=o.format(i.toDate(s)),u=a==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:u}});({and:ht}=Ee());CC={props({props:e}){let t=e.locale||"en-US",n=e.timeZone||"UTC",i=e.selectionMode||"single",r=e.numOfMonths||1,s=e.defaultValue?Qs(e.defaultValue).map(h=>Pt(h,e.min,e.max)):void 0,a=e.value?Qs(e.value).map(h=>Pt(h,e.min,e.max)):void 0,o=e.focusedValue||e.defaultFocusedValue||(a==null?void 0:a[0])||(s==null?void 0:s[0])||Di(n);o=Pt(o,e.min,e.max);let l="day",c="year",u=fl(e.view||l,l,c);return y(g({locale:t,numOfMonths:r,timeZone:n,selectionMode:i,defaultView:u,minView:l,maxView:c,outsideDaySelectable:!1,closeOnSelect:!0,format(h,{locale:m,timeZone:d}){return new Ct(m,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric"}).format(h.toDate(d))},parse(h,{locale:m,timeZone:d}){return zP(h,m,d)}},e),{focusedValue:typeof e.focusedValue=="undefined"?void 0:o,defaultFocusedValue:o,value:a,defaultValue:s!=null?s:[],positioning:g({placement:"bottom"},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")||e("inline")?"open":"idle"},refs(){return{announcer:void 0}},context({prop:e,bindable:t,getContext:n}){return{focusedValue:t(()=>({defaultValue:e("defaultFocusedValue"),value:e("focusedValue"),isEqual:nt,hash:i=>i.toString(),sync:!0,onChange(i){var l;let r=n(),s=r.get("view"),a=r.get("value"),o=ea(a,e);(l=e("onFocusChange"))==null||l({value:a,valueAsString:o,view:s,focusedValue:i})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:PC,hash:i=>i.map(r=>{var s;return(s=r==null?void 0:r.toString())!=null?s:""}).join(","),onChange(i){var a;let r=n(),s=ea(i,e);(a=e("onValueChange"))==null||a({value:i,valueAsString:s,view:r.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual:nt})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(i){var r;(r=e("onViewChange"))==null||r({view:i})}})),startValue:t(()=>{let i=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:ch(i,"start",{months:e("numOfMonths")},e("locale")),isEqual:nt,hash:r=>r.toString()}}),currentPlacement:t(()=>({defaultValue:void 0})),restoreFocus:t(()=>({defaultValue:!1}))}},computed:{isInteractive:({prop:e})=>!e("disabled")&&!e("readOnly"),visibleDuration:({prop:e})=>({months:e("numOfMonths")}),endValue:({context:e,computed:t})=>$h(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>EC({view:e.get("view"),startValue:e.get("startValue"),endValue:n("endValue"),locale:t("locale"),timeZone:t("timeZone"),selectionMode:t("selectionMode")}),isPrevVisibleRangeValid:({context:e,prop:t})=>!NP(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!RP(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>ea(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:i,computed:r}){e([()=>t("locale")],()=>{i(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{i(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{i(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{i(["syncInputValue"])}),e([()=>n.hash("value")],()=>{i(["syncInputElement"])}),e([()=>r("valueAsString").toString()],()=>{i(["announceValueText"])}),e([()=>n.get("view")],()=>{i(["focusActiveCell"])}),e([()=>t("open")],()=>{i(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate","resetView"],on:{"CONTROLLED.CLOSE":[{guard:ht("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["focusTriggerElement"]},{guard:"shouldRestoreFocus",target:"focused",actions:["focusInputElement"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ht("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ht("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ht("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","focusInputElement"]},{guard:ht("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:"isMultiPicker",actions:["setFocusedDate","toggleSelectedDate"]},{guard:ht("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","focusInputElement"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":{guard:ht("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]},"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","focusTriggerElement"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:ht("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","clearDateValue","setSelectedDate","setActiveIndexToEnd"]},{guard:ht("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ht("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","focusInputElement"]},{guard:ht("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:"isMultiPicker",actions:["toggleSelectedDate"]},{guard:ht("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","focusInputElement"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","focusTriggerElement"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>pC(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",shouldRestoreFocus:({context:e})=>!!e.get("restoreFocus"),isSelectingEndDate:({context:e})=>e.get("activeIndex")===1,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),isInteractOutsideEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="INTERACT_OUTSIDE"},isInputValueEmpty:({event:e})=>e.value.trim()==="",shouldFixOnBlur:({event:e})=>!!e.fixOnBlur},effects:{trackPositioning({context:e,prop:t,scope:n}){if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement);let i=Jh(n);return It(i,()=>oC(n),y(g({},t("positioning")),{defer:!0,onComplete(s){e.set("currentPlacement",s.placement)}}))},setupLiveRegion({scope:e,refs:t}){let n=e.getDoc();return t.set("announcer",XP({level:"assertive",document:n})),()=>{var i,r;return(r=(i=t.get("announcer"))==null?void 0:i.destroy)==null?void 0:r.call(i)}},trackDismissableElement({scope:e,send:t,context:n,prop:i}){return i("inline")?void 0:Ft(()=>ia(e),{type:"popover",defer:!0,exclude:[...Tr(e),mh(e),aC(e)],onInteractOutside(s){n.set("restoreFocus",!s.detail.focusable)},onDismiss(){t({type:"INTERACT_OUTSIDE"})},onEscapeKeyDown(s){s.preventDefault(),t({type:"TABLE.ESCAPE",src:"dismissable"})}})}},actions:{setNextView({context:e,prop:t}){let n=mC(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){let n=vC(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){var o;let i=e.get("value"),r=t("locale"),s=t("timeZone"),a;if(t("selectionMode")==="range"){let[l,c]=i;l&&c?a=Zs(l,c,r,s):l?a=Zs(l,null,r,s):c?a=Zs(c,null,r,s):a=""}else a=i.map(l=>Zs(l,null,r,s)).filter(Boolean).join(",");(o=n.get("announcer"))==null||o.announce(a,3e3)},announceVisibleRange({computed:e,refs:t}){var i;let{formatted:n}=e("visibleRangeText");(i=t.get("announcer"))==null||i.announce(n)},disableTextSelection({scope:e}){io({target:ia(e),doc:e.getDoc()})},enableTextSelection({scope:e}){no({doc:e.getDoc(),target:ia(e)})},focusFirstSelectedDate(e){let{context:t}=e;t.get("value").length&&ve(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){H(()=>{Tr(e).forEach((i,r)=>{Me(i,t("valueAsString")[r]||"")})})},setFocusedDate(e){let{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;ve(e,n)},setFocusedValueForView(e){let{context:t,event:n}=e;ve(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){let{context:t}=e;ve(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){let{context:t}=e;ve(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;let i=t.value.map(r=>Pt(r,n("min"),n("max")));e.set("value",i)},clearDateValue({context:e}){e.set("value",[])},setSelectedDate(e){var r;let{context:t,event:n}=e,i=Array.from(t.get("value"));i[t.get("activeIndex")]=ra(e,(r=n.value)!=null?r:t.get("focusedValue")),t.set("value",sl(i))},resetSelection(e){var r;let{context:t,event:n}=e,i=ra(e,(r=n.value)!=null?r:t.get("focusedValue"));t.set("value",[i])},toggleSelectedDate(e){var s;let{context:t,event:n}=e,i=ra(e,(s=n.value)!=null?s:t.get("focusedValue")),r=t.get("value").findIndex(a=>nt(a,i));if(r===-1){let a=[...t.get("value"),i];t.set("value",Qs(a))}else{let a=Array.from(t.get("value"));a.splice(r,1),t.set("value",Qs(a))}},setHoveredDate({context:e,event:t}){e.set("hoveredValue",t.value)},clearHoveredDate({context:e}){e.set("hoveredValue",null)},selectFocusedDate({context:e,computed:t}){let n=Array.from(e.get("value")),i=e.get("activeIndex");n[i]=e.get("focusedValue").copy(),e.set("value",sl(n));let r=t("valueAsString");e.set("inputValue",r[i])},focusPreviousDay(e){let{context:t}=e,n=t.get("focusedValue").subtract({days:1});ve(e,n)},focusNextDay(e){let{context:t}=e,n=t.get("focusedValue").add({days:1});ve(e,n)},focusPreviousWeek(e){let{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});ve(e,n)},focusNextWeek(e){let{context:t}=e,n=t.get("focusedValue").add({weeks:1});ve(e,n)},focusNextPage(e){let{context:t,computed:n,prop:i}=e,r=qh(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),i("locale"),i("min"),i("max"));ta(e,r)},focusPreviousPage(e){let{context:t,computed:n,prop:i}=e,r=Wh(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),i("locale"),i("min"),i("max"));ta(e,r)},focusSectionStart(e){let{context:t}=e;ve(e,t.get("startValue").copy())},focusSectionEnd(e){let{computed:t}=e;ve(e,t("endValue").copy())},focusNextSection(e){let{context:t,event:n,computed:i,prop:r}=e,s=UP(t.get("focusedValue"),t.get("startValue"),n.larger,i("visibleDuration"),r("locale"),r("min"),r("max"));s&&ta(e,s)},focusPreviousSection(e){let{context:t,event:n,computed:i,prop:r}=e,s=qP(t.get("focusedValue"),t.get("startValue"),n.larger,i("visibleDuration"),r("locale"),r("min"),r("max"));s&&ta(e,s)},focusNextYear(e){let{context:t}=e,n=t.get("focusedValue").add({years:1});ve(e,n)},focusPreviousYear(e){let{context:t}=e,n=t.get("focusedValue").subtract({years:1});ve(e,n)},focusNextDecade(e){let{context:t}=e,n=t.get("focusedValue").add({years:10});ve(e,n)},focusPreviousDecade(e){let{context:t}=e,n=t.get("focusedValue").subtract({years:10});ve(e,n)},clearFocusedDate(e){let{prop:t}=e;ve(e,Di(t("timeZone")))},focusPreviousMonthColumn(e){let{context:t,event:n}=e,i=t.get("focusedValue").subtract({months:n.columns});ve(e,i)},focusNextMonthColumn(e){let{context:t,event:n}=e,i=t.get("focusedValue").add({months:n.columns});ve(e,i)},focusPreviousYearColumn(e){let{context:t,event:n}=e,i=t.get("focusedValue").subtract({years:n.columns});ve(e,i)},focusNextYearColumn(e){let{context:t,event:n}=e,i=t.get("focusedValue").add({years:n.columns});ve(e,i)},focusFirstMonth(e){let{context:t}=e,n=t.get("focusedValue").set({month:1});ve(e,n)},focusLastMonth(e){let{context:t}=e,n=t.get("focusedValue").set({month:12});ve(e,n)},focusFirstYear(e){let{context:t}=e,n=Li(t.get("focusedValue").year),i=t.get("focusedValue").set({year:n[0]});ve(e,i)},focusLastYear(e){let{context:t}=e,n=Li(t.get("focusedValue").year),i=t.get("focusedValue").set({year:n[n.length-1]});ve(e,i)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},focusActiveCell({scope:e,context:t}){H(()=>{var i;let n=t.get("view");(i=fh(e,n))==null||i.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&H(()=>{var r;let i=t.get("view");(r=fh(e,i))==null||r.focus({preventScroll:!0})})},setHoveredValueIfKeyboard({context:e,event:t,prop:n}){!t.type.startsWith("TABLE.ARROW")||n("selectionMode")!=="range"||e.get("activeIndex")===0||e.set("hoveredValue",e.get("focusedValue").copy())},focusTriggerElement({scope:e}){H(()=>{var t;(t=mh(e))==null||t.focus({preventScroll:!0})})},focusFirstInputElement({scope:e}){H(()=>{let[t]=Tr(e);t==null||t.focus({preventScroll:!0})})},focusInputElement({scope:e}){H(()=>{let t=Tr(e),n=t.findLastIndex(s=>s.value!==""),i=Math.max(n,0),r=t[i];r==null||r.focus({preventScroll:!0}),r==null||r.setSelectionRange(r.value.length,r.value.length)})},syncMonthSelectElement({scope:e,context:t}){let n=sC(e);Me(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){let n=rC(e);Me(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{var s;let i=Tr(e),r=(s=n.index)!=null?s:t.get("activeIndex");Me(i[r],t.get("inputValue"))})},focusParsedDate(e){let{event:t,prop:n}=e;if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!r||!vh(r)||ve(e,r)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!r||!vh(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=Pt(r,n("min"),n("max"));let s=Array.from(e.get("value"));s[t.index]=r,e.set("value",s);let a=ea(s,n);e.set("inputValue",a[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){let i=e.get("focusedValue");if(!$t(i,e.get("startValue"),t("endValue")))return;let s=ch(i,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",s)},invokeOnOpen({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;e("inline")||(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){var i;(i=e("onVisibleRangeChange"))==null||i({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}},ra=(e,t)=>{let{context:n,prop:i}=e,r=n.get("view"),s=typeof t=="number"?n.get("focusedValue").set({[r]:t}):t;return bC(a=>{fC(a,i("minView"))&&(s=s.set({[a]:a==="day"?1:0}))}),s};SC=_()(["closeOnSelect","dir","disabled","fixedWeeks","focusedValue","format","parse","placeholder","getRootNode","id","ids","inline","invalid","isDateUnavailable","locale","max","min","name","numOfMonths","onFocusChange","onOpenChange","onValueChange","onViewChange","onVisibleRangeChange","open","defaultOpen","positioning","readOnly","required","selectionMode","startOfWeek","timeZone","translations","value","defaultView","defaultValue","view","defaultFocusedValue","outsideDaySelectable","minView","maxView"]),Ix=B(SC),TC=_()(["index","fixOnBlur"]),Px=B(TC),OC=_()(["value"]),Cx=B(OC),wC=_()(["columns","id","view"]),Sx=B(wC),VC=_()(["disabled","value","columns"]),Tx=B(VC),xC=_()(["view"]),Ox=B(xC),AC=class extends K{constructor(){super(...arguments);z(this,"getDayView",()=>this.el.querySelector('[data-part="day-view"]'));z(this,"getMonthView",()=>this.el.querySelector('[data-part="month-view"]'));z(this,"getYearView",()=>this.el.querySelector('[data-part="year-view"]'));z(this,"renderDayTableHeader",()=>{let t=this.getDayView(),n=t==null?void 0:t.querySelector("thead");if(!n||!this.api.weekDays)return;let i=this.doc.createElement("tr");this.spreadProps(i,this.api.getTableRowProps({view:"day"})),this.api.weekDays.forEach(r=>{let s=this.doc.createElement("th");s.scope="col",s.setAttribute("aria-label",r.long),s.textContent=r.narrow,i.appendChild(s)}),n.innerHTML="",n.appendChild(i)});z(this,"renderDayTableBody",()=>{let t=this.getDayView(),n=t==null?void 0:t.querySelector("tbody");n&&(this.spreadProps(n,this.api.getTableBodyProps({view:"day"})),this.api.weeks&&(n.innerHTML="",this.api.weeks.forEach(i=>{let r=this.doc.createElement("tr");this.spreadProps(r,this.api.getTableRowProps({view:"day"})),i.forEach(s=>{let a=this.doc.createElement("td");this.spreadProps(a,this.api.getDayTableCellProps({value:s}));let o=this.doc.createElement("div");this.spreadProps(o,this.api.getDayTableCellTriggerProps({value:s})),o.textContent=String(s.day),a.appendChild(o),r.appendChild(a)}),n.appendChild(r)})))});z(this,"renderMonthTableBody",()=>{let t=this.getMonthView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;this.spreadProps(n,this.api.getTableBodyProps({view:"month"}));let i=this.api.getMonthsGrid({columns:4,format:"short"});n.innerHTML="",i.forEach(r=>{let s=this.doc.createElement("tr");this.spreadProps(s,this.api.getTableRowProps()),r.forEach(a=>{let o=this.doc.createElement("td");this.spreadProps(o,this.api.getMonthTableCellProps(y(g({},a),{columns:4})));let l=this.doc.createElement("div");this.spreadProps(l,this.api.getMonthTableCellTriggerProps(y(g({},a),{columns:4}))),l.textContent=a.label,o.appendChild(l),s.appendChild(o)}),n.appendChild(s)})});z(this,"renderYearTableBody",()=>{let t=this.getYearView(),n=t==null?void 0:t.querySelector("tbody");if(!n)return;this.spreadProps(n,this.api.getTableBodyProps());let i=this.api.getYearsGrid({columns:4});n.innerHTML="",i.forEach(r=>{let s=this.doc.createElement("tr");this.spreadProps(s,this.api.getTableRowProps({view:"year"})),r.forEach(a=>{let o=this.doc.createElement("td");this.spreadProps(o,this.api.getYearTableCellProps(y(g({},a),{columns:4})));let l=this.doc.createElement("div");this.spreadProps(l,this.api.getYearTableCellTriggerProps(y(g({},a),{columns:4}))),l.textContent=a.label,o.appendChild(l),s.appendChild(o)}),n.appendChild(s)})})}initMachine(t){return new W(CC,t)}initApi(){return IC(this.machine.service,q)}render(){let t=this.el.querySelector('[data-scope="date-picker"][data-part="root"]');t&&this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="date-picker"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=this.el.querySelector('[data-scope="date-picker"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps());let r=this.el.querySelector('[data-scope="date-picker"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let s=this.el.querySelector('[data-scope="date-picker"][data-part="trigger"]');s&&this.spreadProps(s,this.api.getTriggerProps());let a=this.el.querySelector('[data-scope="date-picker"][data-part="positioner"]');a&&this.spreadProps(a,this.api.getPositionerProps());let o=this.el.querySelector('[data-scope="date-picker"][data-part="content"]');if(o&&this.spreadProps(o,this.api.getContentProps()),this.api.open){let l=this.getDayView(),c=this.getMonthView(),u=this.getYearView();if(l&&(l.hidden=this.api.view!=="day"),c&&(c.hidden=this.api.view!=="month"),u&&(u.hidden=this.api.view!=="year"),this.api.view==="day"&&l){let h=l.querySelector('[data-part="view-control"]');h&&this.spreadProps(h,this.api.getViewControlProps({view:"year"}));let m=l.querySelector('[data-part="prev-trigger"]');m&&this.spreadProps(m,this.api.getPrevTriggerProps());let d=l.querySelector('[data-part="view-trigger"]');d&&(this.spreadProps(d,this.api.getViewTriggerProps()),d.textContent=this.api.visibleRangeText.start);let p=l.querySelector('[data-part="next-trigger"]');p&&this.spreadProps(p,this.api.getNextTriggerProps());let v=l.querySelector("table");v&&this.spreadProps(v,this.api.getTableProps({view:"day"}));let I=l.querySelector("thead");I&&this.spreadProps(I,this.api.getTableHeaderProps({view:"day"})),this.renderDayTableHeader(),this.renderDayTableBody()}else if(this.api.view==="month"&&c){let h=c.querySelector('[data-part="view-control"]');h&&this.spreadProps(h,this.api.getViewControlProps({view:"month"}));let m=c.querySelector('[data-part="prev-trigger"]');m&&this.spreadProps(m,this.api.getPrevTriggerProps({view:"month"}));let d=c.querySelector('[data-part="view-trigger"]');d&&(this.spreadProps(d,this.api.getViewTriggerProps({view:"month"})),d.textContent=String(this.api.visibleRange.start.year));let p=c.querySelector('[data-part="next-trigger"]');p&&this.spreadProps(p,this.api.getNextTriggerProps({view:"month"}));let v=c.querySelector("table");v&&this.spreadProps(v,this.api.getTableProps({view:"month",columns:4})),this.renderMonthTableBody()}else if(this.api.view==="year"&&u){let h=u.querySelector('[data-part="view-control"]');h&&this.spreadProps(h,this.api.getViewControlProps({view:"year"}));let m=u.querySelector('[data-part="prev-trigger"]');m&&this.spreadProps(m,this.api.getPrevTriggerProps({view:"year"}));let d=u.querySelector('[data-part="decade"]');if(d){let I=this.api.getDecade();d.textContent=`${I.start} - ${I.end}`}let p=u.querySelector('[data-part="next-trigger"]');p&&this.spreadProps(p,this.api.getNextTriggerProps({view:"year"}));let v=u.querySelector("table");v&&this.spreadProps(v,this.api.getTableProps({view:"year",columns:4})),this.renderYearTableBody()}}}};kC={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=this.liveSocket,i=w(e,"min"),r=w(e,"max"),s=w(e,"positioning"),a=u=>u?u.map(h=>gt(h)):void 0,o=u=>u?gt(u):void 0,l=new AC(e,y(g({id:e.id},C(e,"controlled")?{value:a(Q(e,"value"))}:{defaultValue:a(Q(e,"defaultValue"))}),{defaultFocusedValue:o(w(e,"focusedValue")),defaultView:w(e,"defaultView",["day","month","year"]),dir:w(e,"dir",["ltr","rtl"]),locale:w(e,"locale"),timeZone:w(e,"timeZone"),disabled:C(e,"disabled"),readOnly:C(e,"readOnly"),required:C(e,"required"),invalid:C(e,"invalid"),outsideDaySelectable:C(e,"outsideDaySelectable"),closeOnSelect:C(e,"closeOnSelect"),min:i?gt(i):void 0,max:r?gt(r):void 0,numOfMonths:Y(e,"numOfMonths"),startOfWeek:Y(e,"startOfWeek"),fixedWeeks:C(e,"fixedWeeks"),selectionMode:w(e,"selectionMode",["single","multiple","range"]),placeholder:w(e,"placeholder"),minView:w(e,"minView",["day","month","year"]),maxView:w(e,"maxView",["day","month","year"]),inline:C(e,"inline"),positioning:s?JSON.parse(s):void 0,onValueChange:u=>{var p;let h=(p=u.value)!=null&&p.length?u.value.map(v=>yh(v)).join(","):"",m=e.querySelector(`#${e.id}-value`);m&&m.value!==h&&(m.value=h,m.dispatchEvent(new Event("input",{bubbles:!0})),m.dispatchEvent(new Event("change",{bubbles:!0})));let d=w(e,"onValueChange");d&&n.main.isConnected()&&t(d,{id:e.id,value:h||null})},onFocusChange:u=>{var m;let h=w(e,"onFocusChange");h&&n.main.isConnected()&&t(h,{id:e.id,focused:(m=u.focused)!=null?m:!1})},onViewChange:u=>{let h=w(e,"onViewChange");h&&n.main.isConnected()&&t(h,{id:e.id,view:u.view})},onVisibleRangeChange:u=>{let h=w(e,"onVisibleRangeChange");h&&n.main.isConnected()&&t(h,{id:e.id,start:u.start,end:u.end})},onOpenChange:u=>{let h=w(e,"onOpenChange");h&&n.main.isConnected()&&t(h,{id:e.id,open:u.open})}}));l.init(),this.datePicker=l;let c=e.querySelector('[data-scope="date-picker"][data-part="input-wrapper"]');c&&c.removeAttribute("data-loading"),this.handlers=[],this.handlers.push(this.handleEvent("date_picker_set_value",u=>{let h=u.date_picker_id;h&&h!==e.id||l.api.setValue([gt(u.value)])})),this.onSetValue=u=>{var m;let h=(m=u.detail)==null?void 0:m.value;typeof h=="string"&&l.api.setValue([gt(h)])},e.addEventListener("phx:date-picker:set-value",this.onSetValue)},updated(){var l,c;let e=this.el,t=e.querySelector('[data-scope="date-picker"][data-part="input-wrapper"]');t&&t.removeAttribute("data-loading");let n=u=>u?u.map(h=>gt(h)):void 0,i=w(e,"min"),r=w(e,"max"),s=w(e,"positioning"),a=C(e,"controlled"),o=w(e,"focusedValue");if((l=this.datePicker)==null||l.updateProps(y(g({},C(e,"controlled")?{value:n(Q(e,"value"))}:{defaultValue:n(Q(e,"defaultValue"))}),{defaultFocusedValue:o?gt(o):void 0,defaultView:w(e,"defaultView",["day","month","year"]),dir:w(this.el,"dir",["ltr","rtl"]),locale:w(this.el,"locale"),timeZone:w(this.el,"timeZone"),disabled:C(this.el,"disabled"),readOnly:C(this.el,"readOnly"),required:C(this.el,"required"),invalid:C(this.el,"invalid"),outsideDaySelectable:C(this.el,"outsideDaySelectable"),closeOnSelect:C(this.el,"closeOnSelect"),min:i?gt(i):void 0,max:r?gt(r):void 0,numOfMonths:Y(this.el,"numOfMonths"),startOfWeek:Y(this.el,"startOfWeek"),fixedWeeks:C(this.el,"fixedWeeks"),selectionMode:w(this.el,"selectionMode",["single","multiple","range"]),placeholder:w(this.el,"placeholder"),minView:w(this.el,"minView",["day","month","year"]),maxView:w(this.el,"maxView",["day","month","year"]),inline:C(this.el,"inline"),positioning:s?JSON.parse(s):void 0})),a&&this.datePicker){let u=Q(e,"value"),h=(c=u==null?void 0:u.join(","))!=null?c:"",m=this.datePicker.api.value,d=m!=null&&m.length?m.map(p=>yh(p)).join(","):"";if(h!==d){let p=u!=null&&u.length?u.map(v=>gt(v)):[];this.datePicker.api.setValue(p)}}},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:date-picker:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.datePicker)==null||e.destroy()}}});var ug={};he(ug,{Dialog:()=>lS});function HC(e,t={}){let{defer:n=!0}=t,i=n?$C:s=>s(),r=[];return r.push(i(()=>{let a=(typeof e=="function"?e():e).filter(Boolean);a.length!==0&&r.push(FC(a))})),()=>{r.forEach(s=>s==null?void 0:s())}}function YC(e,t={}){let n,i=H(()=>{let s=(Array.isArray(e)?e:[e]).map(o=>typeof o=="function"?o():o).filter(o=>o!=null);if(s.length===0)return;let a=s[0];n=new UC(s,y(g({escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:a},t),{document:Le(a)}));try{n.activate()}catch(o){}});return function(){n==null||n.deactivate(),i()}}function jC(e){let t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?"paddingLeft":"paddingRight"}function rg(e){let t=at(e),n=t==null?void 0:t.scrollbarGutter;return n==="stable"||(n==null?void 0:n.startsWith("stable "))===!0}function XC(e){var d;let t=e!=null?e:document,n=(d=t.defaultView)!=null?d:window,{documentElement:i,body:r}=t;if(r.hasAttribute(yl))return;let a=rg(i)||rg(r),o=n.innerWidth-i.clientWidth;r.setAttribute(yl,"");let l=()=>$c(i,"--scrollbar-width",`${o}px`),c=jC(i),u=()=>{let p={overflow:"hidden"};return!a&&o>0&&(p[c]=`${o}px`),Hn(r,p)},h=()=>{var S,P;let{scrollX:p,scrollY:v,visualViewport:I}=n,T=(S=I==null?void 0:I.offsetLeft)!=null?S:0,O=(P=I==null?void 0:I.offsetTop)!=null?P:0,b={position:"fixed",overflow:"hidden",top:`${-(v-Math.floor(O))}px`,left:`${-(p-Math.floor(T))}px`,right:"0"};!a&&o>0&&(b[c]=`${o}px`);let f=Hn(r,b);return()=>{f==null||f(),n.scrollTo({left:p,top:v,behavior:"instant"})}},m=[l(),ir()?h():u()];return()=>{m.forEach(p=>p==null?void 0:p()),r.removeAttribute(yl)}}function rS(e,t){let{state:n,send:i,context:r,prop:s,scope:a}=e,o=s("aria-label"),l=n.matches("open");return{open:l,setOpen(c){n.matches("open")!==c&&i({type:c?"OPEN":"CLOSE"})},getTriggerProps(){return t.button(y(g({},Qn.trigger.attrs),{dir:s("dir"),id:lg(a),"aria-haspopup":"dialog",type:"button","aria-expanded":l,"data-state":l?"open":"closed","aria-controls":bl(a),onClick(c){c.defaultPrevented||i({type:"TOGGLE"})}}))},getBackdropProps(){return t.element(y(g({},Qn.backdrop.attrs),{dir:s("dir"),hidden:!l,id:og(a),"data-state":l?"open":"closed"}))},getPositionerProps(){return t.element(y(g({},Qn.positioner.attrs),{dir:s("dir"),id:ag(a),style:{pointerEvents:l?void 0:"none"}}))},getContentProps(){let c=r.get("rendered");return t.element(y(g({},Qn.content.attrs),{dir:s("dir"),role:s("role"),hidden:!l,id:bl(a),tabIndex:-1,"data-state":l?"open":"closed","aria-modal":!0,"aria-label":o||void 0,"aria-labelledby":o||!c.title?void 0:El(a),"aria-describedby":c.description?Il(a):void 0}))},getTitleProps(){return t.element(y(g({},Qn.title.attrs),{dir:s("dir"),id:El(a)}))},getDescriptionProps(){return t.element(y(g({},Qn.description.attrs),{dir:s("dir"),id:Il(a)}))},getCloseTriggerProps(){return t.button(y(g({},Qn.closeTrigger.attrs),{dir:s("dir"),id:cg(a),type:"button",onClick(c){c.defaultPrevented||(c.stopPropagation(),i({type:"CLOSE"}))}}))}}}var Hi,ca,ua,ml,sg,NC,RC,DC,LC,MC,FC,$C,BC,_C,be,ng,GC,UC,Pl,vl,qC,WC,Ar,KC,ig,zC,yl,ZC,Qn,ag,og,bl,lg,El,Il,cg,da,JC,QC,eS,tS,nS,iS,sS,aS,Dx,oS,lS,dg=re(()=>{"use strict";Wn();tn();se();Hi=new WeakMap,ca=new WeakMap,ua={},ml=0,sg=e=>e&&(e.host||sg(e.parentNode)),NC=(e,t)=>t.map(n=>{if(e.contains(n))return n;let i=sg(n);return i&&e.contains(i)?i:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",e,". Doing nothing"),null)}).filter(n=>!!n),RC=new Set(["script","output","status","next-route-announcer"]),DC=e=>RC.has(e.localName)||e.role==="status"||e.hasAttribute("aria-live")?!0:e.matches("[data-live-announcer]"),LC=(e,t)=>{let{parentNode:n,markerName:i,controlAttribute:r,followControlledElements:s=!0}=t,a=NC(n,Array.isArray(e)?e:[e]);ua[i]||(ua[i]=new WeakMap);let o=ua[i],l=[],c=new Set,u=new Set(a),h=d=>{!d||c.has(d)||(c.add(d),h(d.parentNode))};a.forEach(d=>{h(d),s&&le(d)&&Xa(d,p=>{h(p)})});let m=d=>{!d||u.has(d)||Array.prototype.forEach.call(d.children,p=>{if(c.has(p))m(p);else try{if(DC(p))return;let I=p.getAttribute(r)==="true",T=(Hi.get(p)||0)+1,O=(o.get(p)||0)+1;Hi.set(p,T),o.set(p,O),l.push(p),T===1&&I&&ca.set(p,!0),O===1&&p.setAttribute(i,""),I||p.setAttribute(r,"true")}catch(v){console.error("[zag-js > ariaHidden] cannot operate on ",p,v)}})};return m(n),c.clear(),ml++,()=>{l.forEach(d=>{let p=Hi.get(d)-1,v=o.get(d)-1;Hi.set(d,p),o.set(d,v),p||(ca.has(d)||d.removeAttribute(r),ca.delete(d)),v||d.removeAttribute(i)}),ml--,ml||(Hi=new WeakMap,Hi=new WeakMap,ca=new WeakMap,ua={})}},MC=e=>(Array.isArray(e)?e[0]:e).ownerDocument.body,FC=(e,t=MC(e),n="data-aria-hidden",i=!0)=>{if(t)return LC(e,{parentNode:t,markerName:n,controlAttribute:"aria-hidden",followControlledElements:i})},$C=e=>{let t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)};BC=Object.defineProperty,_C=(e,t,n)=>t in e?BC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,be=(e,t,n)=>_C(e,typeof t!="symbol"?t+"":t,n),ng={activateTrap(e,t){if(e.length>0){let i=e[e.length-1];i!==t&&i.pause()}let n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},GC=[],UC=class{constructor(e,t){be(this,"trapStack"),be(this,"config"),be(this,"doc"),be(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),be(this,"portalContainers",new Set),be(this,"listenerCleanups",[]),be(this,"handleFocus",i=>{let r=j(i),s=this.findContainerIndex(r,i)>=0;if(s||nr(r))s&&(this.state.mostRecentlyFocusedNode=r);else{i.stopImmediatePropagation();let a,o=!0;if(this.state.mostRecentlyFocusedNode)if(fi(this.state.mostRecentlyFocusedNode)>0){let l=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:c}=this.state.containerGroups[l];if(c.length>0){let u=c.findIndex(h=>h===this.state.mostRecentlyFocusedNode);u>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?u+1=0&&(a=c[u-1],o=!1))}}else this.state.containerGroups.some(l=>l.tabbableNodes.some(c=>fi(c)>0))||(o=!1);else o=!1;o&&(a=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),a?this.tryFocus(a):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),be(this,"handlePointerDown",i=>{let r=j(i);if(!(this.findContainerIndex(r,i)>=0)){if(Ar(this.config.clickOutsideDeactivates,i)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}Ar(this.config.allowOutsideClick,i)||i.preventDefault()}}),be(this,"handleClick",i=>{let r=j(i);this.findContainerIndex(r,i)>=0||Ar(this.config.clickOutsideDeactivates,i)||Ar(this.config.allowOutsideClick,i)||(i.preventDefault(),i.stopImmediatePropagation())}),be(this,"handleTabKey",i=>{if(this.config.isKeyForward(i)||this.config.isKeyBackward(i)){this.state.recentNavEvent=i;let r=this.config.isKeyBackward(i),s=this.findNextNavNode({event:i,isBackward:r});if(!s)return;vl(i)&&i.preventDefault(),this.tryFocus(s)}}),be(this,"handleEscapeKey",i=>{KC(i)&&Ar(this.config.escapeDeactivates,i)!==!1&&(i.preventDefault(),this.deactivate())}),be(this,"_mutationObserver"),be(this,"setupMutationObserver",()=>{let i=this.doc.defaultView||window;this._mutationObserver=new i.MutationObserver(r=>{r.some(o=>Array.from(o.removedNodes).some(c=>c===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode()),r.some(o=>o.type==="attributes"&&(o.attributeName==="aria-controls"||o.attributeName==="aria-expanded")?!0:o.type==="childList"&&o.addedNodes.length>0?Array.from(o.addedNodes).some(l=>{if(l.nodeType!==Node.ELEMENT_NODE)return!1;let c=l;return Pc(c)?!0:c.id&&!this.state.containers.some(u=>u.contains(c))?Cc(c):!1}):!1)&&this.state.active&&!this.state.paused&&(this.updateTabbableNodes(),this.updatePortalContainers())})}),be(this,"updateObservedNodes",()=>{var i;(i=this._mutationObserver)==null||i.disconnect(),this.state.active&&!this.state.paused&&(this.state.containers.map(r=>{var s;(s=this._mutationObserver)==null||s.observe(r,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-controls","aria-expanded"]})}),this.portalContainers.forEach(r=>{this.observePortalContainer(r)}))}),be(this,"getInitialFocusNode",()=>{let i=this.getNodeForOption("initialFocus",{hasFallback:!0});if(i===!1)return!1;if(i===void 0||i&&!Ye(i)){let r=ui(this.doc);if(r&&this.findContainerIndex(r)>=0)i=r;else{let s=this.state.tabbableGroups[0];i=s&&s.firstTabbableNode||this.getNodeForOption("fallbackFocus")}}else i===null&&(i=this.getNodeForOption("fallbackFocus"));if(!i)throw new Error("Your focus-trap needs to have at least one focusable element");return i.isConnected||(i=this.getNodeForOption("fallbackFocus")),i}),be(this,"tryFocus",i=>{if(i!==!1&&i!==ui(this.doc)){if(!i||!i.focus){this.tryFocus(this.getInitialFocusNode());return}i.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=i,zC(i)&&i.select()}}),be(this,"deactivate",i=>{if(!this.state.active)return this;let r=g({onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus},i);clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),ng.deactivateTrap(this.trapStack,this),this.portalContainers.clear();let s=this.getOption(r,"onDeactivate"),a=this.getOption(r,"onPostDeactivate"),o=this.getOption(r,"checkCanReturnFocus"),l=this.getOption(r,"returnFocus","returnFocusOnDeactivate");s==null||s();let c=()=>{ig(()=>{if(l){let u=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(u)}a==null||a()})};if(l&&o){let u=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return o(u).then(c,c),this}return c(),this}),be(this,"pause",i=>{if(this.state.paused||!this.state.active)return this;let r=this.getOption(i,"onPause"),s=this.getOption(i,"onPostPause");return this.state.paused=!0,r==null||r(),this.removeListeners(),this.updateObservedNodes(),s==null||s(),this}),be(this,"unpause",i=>{if(!this.state.paused||!this.state.active)return this;let r=this.getOption(i,"onUnpause"),s=this.getOption(i,"onPostUnpause");return this.state.paused=!1,r==null||r(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),s==null||s(),this}),be(this,"updateContainerElements",i=>(this.state.containers=Array.isArray(i)?i.filter(Boolean):[i].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),be(this,"getReturnFocusNode",i=>{let r=this.getNodeForOption("setReturnFocus",{params:[i]});return r||(r===!1?!1:i)}),be(this,"getOption",(i,r,s)=>i&&i[r]!==void 0?i[r]:this.config[s||r]),be(this,"getNodeForOption",(i,{hasFallback:r=!1,params:s=[]}={})=>{let a=this.config[i];if(typeof a=="function"&&(a=a(...s)),a===!0&&(a=void 0),!a){if(a===void 0||a===!1)return a;throw new Error(`\`${i}\` was specified but was not a node, or did not return a node`)}let o=a;if(typeof a=="string"){try{o=this.doc.querySelector(a)}catch(l){throw new Error(`\`${i}\` appears to be an invalid selector; error="${l.message}"`)}if(!o&&!r)throw new Error(`\`${i}\` as selector refers to no known node`)}return o}),be(this,"findNextNavNode",i=>{let{event:r,isBackward:s=!1}=i,a=i.target||j(r);this.updateTabbableNodes();let o=null;if(this.state.tabbableGroups.length>0){let l=this.findContainerIndex(a,r),c=l>=0?this.state.containerGroups[l]:void 0;if(l<0)s?o=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:o=this.state.tabbableGroups[0].firstTabbableNode;else if(s){let u=this.state.tabbableGroups.findIndex(({firstTabbableNode:h})=>a===h);if(u<0&&((c==null?void 0:c.container)===a||Ye(a)&&!dn(a)&&!(c!=null&&c.nextTabbableNode(a,!1)))&&(u=l),u>=0){let h=u===0?this.state.tabbableGroups.length-1:u-1,m=this.state.tabbableGroups[h];o=fi(a)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else vl(r)||(o=c==null?void 0:c.nextTabbableNode(a,!1))}else{let u=this.state.tabbableGroups.findIndex(({lastTabbableNode:h})=>a===h);if(u<0&&((c==null?void 0:c.container)===a||Ye(a)&&!dn(a)&&!(c!=null&&c.nextTabbableNode(a)))&&(u=l),u>=0){let h=u===this.state.tabbableGroups.length-1?0:u+1,m=this.state.tabbableGroups[h];o=fi(a)>=0?m.firstTabbableNode:m.firstDomTabbableNode}else vl(r)||(o=c==null?void 0:c.nextTabbableNode(a))}}else o=this.getNodeForOption("fallbackFocus");return o}),this.trapStack=t.trapStack||GC;let n=g({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,followControlledElements:!0,isKeyForward:qC,isKeyBackward:WC},t);this.doc=n.document||Le(Array.isArray(e)?e[0]:e),this.config=n,this.updateContainerElements(e),this.setupMutationObserver()}addPortalContainer(e){let t=e.parentElement;t&&!this.portalContainers.has(t)&&(this.portalContainers.add(t),this.state.active&&!this.state.paused&&this.observePortalContainer(t))}observePortalContainer(e){var t;(t=this._mutationObserver)==null||t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["aria-controls","aria-expanded"]})}updatePortalContainers(){this.config.followControlledElements&&this.state.containers.forEach(e=>{Ic(e).forEach(n=>{this.addPortalContainer(n)})})}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(e,t){let n=typeof(t==null?void 0:t.composedPath)=="function"?t.composedPath():void 0;return this.state.containerGroups.findIndex(({container:i,tabbableNodes:r})=>i.contains(e)||(n==null?void 0:n.includes(i))||r.find(s=>s===e)||this.isControlledElement(i,e))}isControlledElement(e,t){return this.config.followControlledElements?as(e,t):!1}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(e=>{let t=jt(e,{getShadowRoot:this.config.getShadowRoot}),n=ar(e,{getShadowRoot:this.config.getShadowRoot}),i=t[0],r=t[t.length-1],s=i,a=r,o=!1;for(let c=0;c0){o=!0;break}function l(c,u=!0){let h=t.indexOf(c);if(h>=0)return t[h+(u?1:-1)];let m=n.indexOf(c);if(!(m<0)){if(u){for(let d=m+1;d=0;d--)if(dn(n[d]))return n[d]}}return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:o,firstTabbableNode:i,lastTabbableNode:r,firstDomTabbableNode:s,lastDomTabbableNode:a,nextTabbableNode:l}}),this.state.tabbableGroups=this.state.containerGroups.filter(e=>e.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(e=>e.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return ng.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?ig(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(ee(this.doc,"focusin",this.handleFocus,!0),ee(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),ee(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),ee(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),ee(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),ee(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(e=>e()),this.listenerCleanups=[],this}activate(e){if(this.state.active)return this;let t=this.getOption(e,"onActivate"),n=this.getOption(e,"onPostActivate"),i=this.getOption(e,"checkCanFocusTrap");i||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=ui(this.doc),t==null||t();let r=()=>{i&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n==null||n()};return i?(i(this.state.containers.concat()).then(r,r),this):(r(),this)}},Pl=e=>e.type==="keydown",vl=e=>Pl(e)&&(e==null?void 0:e.key)==="Tab",qC=e=>Pl(e)&&e.key==="Tab"&&!(e!=null&&e.shiftKey),WC=e=>Pl(e)&&e.key==="Tab"&&(e==null?void 0:e.shiftKey),Ar=(e,...t)=>typeof e=="function"?e(...t):e,KC=e=>!e.isComposing&&e.key==="Escape",ig=e=>setTimeout(e,0),zC=e=>e.localName==="input"&&"select"in e&&typeof e.select=="function";yl="data-scroll-lock";ZC=U("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),Qn=ZC.build(),ag=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`dialog:${e.id}:positioner`},og=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.backdrop)!=null?n:`dialog:${e.id}:backdrop`},bl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`dialog:${e.id}:content`},lg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`dialog:${e.id}:trigger`},El=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`dialog:${e.id}:title`},Il=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.description)!=null?n:`dialog:${e.id}:description`},cg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.closeTrigger)!=null?n:`dialog:${e.id}:close`},da=e=>e.getById(bl(e)),JC=e=>e.getById(ag(e)),QC=e=>e.getById(og(e)),eS=e=>e.getById(lg(e)),tS=e=>e.getById(El(e)),nS=e=>e.getById(Il(e)),iS=e=>e.getById(cg(e));sS={props({props:e,scope:t}){let n=e.role==="alertdialog",i=n?()=>iS(t):void 0,r=typeof e.modal=="boolean"?e.modal:!0;return g({role:"dialog",modal:r,trapFocus:r,preventScroll:r,closeOnInteractOutside:!n,closeOnEscape:!0,restoreFocus:!0,initialFocusEl:i},e)},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({bindable:e}){return{rendered:e(()=>({defaultValue:{title:!0,description:!0}}))}},watch({track:e,action:t,prop:n}){e([()=>n("open")],()=>{t(["toggleVisibility"])})},states:{open:{entry:["checkRenderedElements","syncZIndex"],effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}},implementations:{guards:{isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackDismissableElement({scope:e,send:t,prop:n}){return Ft(()=>da(e),{type:"dialog",defer:!0,pointerBlocking:n("modal"),exclude:[eS(e)],onInteractOutside(r){var s;(s=n("onInteractOutside"))==null||s(r),n("closeOnInteractOutside")||r.preventDefault()},persistentElements:n("persistentElements"),onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onRequestDismiss:n("onRequestDismiss"),onEscapeKeyDown(r){var s;(s=n("onEscapeKeyDown"))==null||s(r),n("closeOnEscape")||r.preventDefault()},onDismiss(){t({type:"CLOSE",src:"interact-outside"})}})},preventScroll({scope:e,prop:t}){if(t("preventScroll"))return XC(e.getDoc())},trapFocus({scope:e,prop:t}){return t("trapFocus")?YC(()=>da(e),{preventScroll:!0,returnFocusOnDeactivate:!!t("restoreFocus"),initialFocus:t("initialFocusEl"),setReturnFocus:i=>{var r,s;return(s=(r=t("finalFocusEl"))==null?void 0:r())!=null?s:i},getShadowRoot:!0}):void 0},hideContentBelow({scope:e,prop:t}){return t("modal")?HC(()=>[da(e)],{defer:!0}):void 0}},actions:{checkRenderedElements({context:e,scope:t}){H(()=>{e.set("rendered",{title:!!tS(t),description:!!nS(t)})})},syncZIndex({scope:e}){H(()=>{let t=da(e);if(!t)return;let n=at(t);[JC(e),QC(e)].forEach(r=>{r==null||r.style.setProperty("--z-index",n.zIndex),r==null||r.style.setProperty("--layer-index",n.getPropertyValue("--layer-index"))})})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},toggleVisibility({prop:e,send:t,event:n}){t({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}},aS=_()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","defaultOpen","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]),Dx=B(aS),oS=class extends K{initMachine(e){return new W(sS,e)}initApi(){return rS(this.machine.service,q)}render(){let e=this.el,t=e.querySelector('[data-scope="dialog"][data-part="trigger"]');t&&this.spreadProps(t,this.api.getTriggerProps());let n=e.querySelector('[data-scope="dialog"][data-part="backdrop"]');n&&this.spreadProps(n,this.api.getBackdropProps());let i=e.querySelector('[data-scope="dialog"][data-part="positioner"]');i&&this.spreadProps(i,this.api.getPositionerProps());let r=e.querySelector('[data-scope="dialog"][data-part="content"]');r&&this.spreadProps(r,this.api.getContentProps());let s=e.querySelector('[data-scope="dialog"][data-part="title"]');s&&this.spreadProps(s,this.api.getTitleProps());let a=e.querySelector('[data-scope="dialog"][data-part="description"]');a&&this.spreadProps(a,this.api.getDescriptionProps());let o=e.querySelector('[data-scope="dialog"][data-part="close-trigger"]');o&&this.spreadProps(o,this.api.getCloseTriggerProps())}},lS={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=new oS(e,y(g({id:e.id},C(e,"controlled")?{open:C(e,"open")}:{defaultOpen:C(e,"defaultOpen")}),{modal:C(e,"modal"),closeOnInteractOutside:C(e,"closeOnInteractOutside"),closeOnEscape:C(e,"closeOnEscapeKeyDown"),preventScroll:C(e,"preventScroll"),restoreFocus:C(e,"restoreFocus"),dir:w(e,"dir",["ltr","rtl"]),onOpenChange:i=>{let r=w(e,"onOpenChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,open:i.open});let s=w(e,"onOpenChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,open:i.open}}))}}));n.init(),this.dialog=n,this.onSetOpen=i=>{let{open:r}=i.detail;n.api.setOpen(r)},e.addEventListener("phx:dialog:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("dialog_set_open",i=>{let r=i.dialog_id;r&&r!==e.id||n.api.setOpen(i.open)})),this.handlers.push(this.handleEvent("dialog_open",()=>{this.pushEvent("dialog_open_response",{value:n.api.open})}))},updated(){var e;(e=this.dialog)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{open:C(this.el,"open")}:{defaultOpen:C(this.el,"defaultOpen")}),{modal:C(this.el,"modal"),closeOnInteractOutside:C(this.el,"closeOnInteractOutside"),closeOnEscape:C(this.el,"closeOnEscapeKeyDown"),preventScroll:C(this.el,"preventScroll"),restoreFocus:C(this.el,"restoreFocus"),dir:w(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onSetOpen&&this.el.removeEventListener("phx:dialog:set-open",this.onSetOpen),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.dialog)==null||e.destroy()}}});var mg={};he(mg,{Editable:()=>PS});function yS(e,t){var S;let{state:n,context:i,send:r,prop:s,scope:a,computed:o}=e,l=!!s("disabled"),c=o("isInteractive"),u=!!s("readOnly"),h=!!s("required"),m=!!s("invalid"),d=!!s("autoResize"),p=s("translations"),v=n.matches("edit"),I=s("placeholder"),T=typeof I=="string"?{edit:I,preview:I}:I,O=i.get("value"),b=O.trim()==="",f=b?(S=T==null?void 0:T.preview)!=null?S:"":O;return{editing:v,empty:b,value:O,valueText:f,setValue(P){r({type:"VALUE.SET",value:P,src:"setValue"})},clearValue(){r({type:"VALUE.SET",value:"",src:"clearValue"})},edit(){c&&r({type:"EDIT"})},cancel(){c&&r({type:"CANCEL"})},submit(){c&&r({type:"SUBMIT"})},getRootProps(){return t.element(y(g({},ln.root.attrs),{id:uS(a),dir:s("dir")}))},getAreaProps(){return t.element(y(g({},ln.area.attrs),{id:dS(a),dir:s("dir"),style:d?{display:"inline-grid"}:void 0,"data-focus":E(v),"data-disabled":E(l),"data-placeholder-shown":E(b)}))},getLabelProps(){return t.label(y(g({},ln.label.attrs),{id:hS(a),dir:s("dir"),htmlFor:Cl(a),"data-focus":E(v),"data-invalid":E(m),"data-required":E(h),onClick(){if(v)return;let P=pS(a);P==null||P.focus({preventScroll:!0})}}))},getInputProps(){return t.input(y(g({},ln.input.attrs),{dir:s("dir"),"aria-label":p==null?void 0:p.input,name:s("name"),form:s("form"),id:Cl(a),hidden:d?void 0:!v,placeholder:T==null?void 0:T.edit,maxLength:s("maxLength"),required:s("required"),disabled:l,"data-disabled":E(l),readOnly:u,"data-readonly":E(u),"aria-invalid":X(m),"data-invalid":E(m),"data-autoresize":E(d),defaultValue:O,size:d?1:void 0,onChange(P){r({type:"VALUE.SET",src:"input.change",value:P.currentTarget.value})},onKeyDown(P){if(P.defaultPrevented||Re(P))return;let A={Escape(){r({type:"CANCEL"}),P.preventDefault()},Enter(x){if(!o("submitOnEnter"))return;let{localName:k}=x.currentTarget;if(k==="textarea"){if(!(Qa()?x.metaKey:x.ctrlKey))return;r({type:"SUBMIT",src:"keydown.enter"});return}k==="input"&&!x.shiftKey&&!x.metaKey&&(r({type:"SUBMIT",src:"keydown.enter"}),x.preventDefault())}}[P.key];A&&A(P)},style:d?{gridArea:"1 / 1 / auto / auto",visibility:v?void 0:"hidden"}:void 0}))},getPreviewProps(){return t.element(y(g({id:hg(a)},ln.preview.attrs),{dir:s("dir"),"data-placeholder-shown":E(b),"aria-readonly":X(u),"data-readonly":E(l),"data-disabled":E(l),"aria-disabled":X(l),"aria-invalid":X(m),"data-invalid":E(m),"aria-label":p==null?void 0:p.edit,"data-autoresize":E(d),children:f,hidden:d?void 0:v,tabIndex:c?0:void 0,onClick(){c&&s("activationMode")==="click"&&r({type:"EDIT",src:"click"})},onFocus(){c&&s("activationMode")==="focus"&&r({type:"EDIT",src:"focus"})},onDoubleClick(P){P.defaultPrevented||c&&s("activationMode")==="dblclick"&&r({type:"EDIT",src:"dblclick"})},style:d?{whiteSpace:"pre",gridArea:"1 / 1 / auto / auto",visibility:v?"hidden":void 0,overflow:"hidden",textOverflow:"ellipsis"}:void 0}))},getEditTriggerProps(){return t.button(y(g({},ln.editTrigger.attrs),{id:fg(a),dir:s("dir"),"aria-label":p==null?void 0:p.edit,hidden:v,type:"button",disabled:l,onClick(P){P.defaultPrevented||c&&r({type:"EDIT",src:"edit.click"})}}))},getControlProps(){return t.element(y(g({id:gS(a)},ln.control.attrs),{dir:s("dir")}))},getSubmitTriggerProps(){return t.button(y(g({},ln.submitTrigger.attrs),{dir:s("dir"),id:gg(a),"aria-label":p==null?void 0:p.submit,hidden:!v,disabled:l,type:"button",onClick(P){P.defaultPrevented||c&&r({type:"SUBMIT",src:"submit.click"})}}))},getCancelTriggerProps(){return t.button(y(g({},ln.cancelTrigger.attrs),{dir:s("dir"),"aria-label":p==null?void 0:p.cancel,id:pg(a),hidden:!v,type:"button",disabled:l,onClick(P){P.defaultPrevented||c&&r({type:"CANCEL",src:"cancel.click"})}}))}}}var cS,ln,uS,dS,hS,hg,Cl,gS,gg,pg,fg,ha,pS,fS,mS,vS,bS,ES,Bx,IS,PS,vg=re(()=>{"use strict";tn();se();cS=U("editable").parts("root","area","label","preview","input","editTrigger","submitTrigger","cancelTrigger","control"),ln=cS.build(),uS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`editable:${e.id}`},dS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`editable:${e.id}:area`},hS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`editable:${e.id}:label`},hg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.preview)!=null?n:`editable:${e.id}:preview`},Cl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`editable:${e.id}:input`},gS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`editable:${e.id}:control`},gg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.submitTrigger)!=null?n:`editable:${e.id}:submit`},pg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.cancelTrigger)!=null?n:`editable:${e.id}:cancel`},fg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.editTrigger)!=null?n:`editable:${e.id}:edit`},ha=e=>e.getById(Cl(e)),pS=e=>e.getById(hg(e)),fS=e=>e.getById(gg(e)),mS=e=>e.getById(pg(e)),vS=e=>e.getById(fg(e));bS={props({props:e}){return y(g({activationMode:"focus",submitMode:"both",defaultValue:"",selectOnFocus:!0},e),{translations:g({input:"editable input",edit:"edit",submit:"submit",cancel:"cancel"},e.translations)})},initialState({prop:e}){return e("edit")||e("defaultEdit")?"edit":"preview"},entry:["focusInputIfNeeded"],context:({bindable:e,prop:t})=>({value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var i;return(i=t("onValueChange"))==null?void 0:i({value:n})}})),previousValue:e(()=>({defaultValue:""}))}),watch({track:e,action:t,context:n,prop:i}){e([()=>n.get("value")],()=>{t(["syncInputValue"])}),e([()=>i("edit")],()=>{t(["toggleEditing"])})},computed:{submitOnEnter({prop:e}){let t=e("submitMode");return t==="both"||t==="enter"},submitOnBlur({prop:e}){let t=e("submitMode");return t==="both"||t==="blur"},isInteractive({prop:e}){return!(e("disabled")||e("readOnly"))}},on:{"VALUE.SET":{actions:["setValue"]}},states:{preview:{entry:["blurInput"],on:{"CONTROLLED.EDIT":{target:"edit",actions:["setPreviousValue","focusInput"]},EDIT:[{guard:"isEditControlled",actions:["invokeOnEdit"]},{target:"edit",actions:["setPreviousValue","focusInput","invokeOnEdit"]}]}},edit:{effects:["trackInteractOutside"],entry:["syncInputValue"],on:{"CONTROLLED.PREVIEW":[{guard:"isSubmitEvent",target:"preview",actions:["setPreviousValue","restoreFocus","invokeOnSubmit"]},{target:"preview",actions:["revertValue","restoreFocus","invokeOnCancel"]}],CANCEL:[{guard:"isEditControlled",actions:["invokeOnPreview"]},{target:"preview",actions:["revertValue","restoreFocus","invokeOnCancel","invokeOnPreview"]}],SUBMIT:[{guard:"isEditControlled",actions:["invokeOnPreview"]},{target:"preview",actions:["setPreviousValue","restoreFocus","invokeOnSubmit","invokeOnPreview"]}]}}},implementations:{guards:{isEditControlled:({prop:e})=>e("edit")!=null,isSubmitEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="SUBMIT"}},effects:{trackInteractOutside({send:e,scope:t,prop:n,computed:i}){return Ws(ha(t),{exclude(r){return[mS(t),fS(t)].some(a=>ce(a,r))},onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(r){var a;if((a=n("onInteractOutside"))==null||a(r),r.defaultPrevented)return;let{focusable:s}=r.detail;e({type:i("submitOnBlur")?"SUBMIT":"CANCEL",src:"interact-outside",focusable:s})}})}},actions:{restoreFocus({event:e,scope:t,prop:n}){e.focusable||H(()=>{var r,s;let i=(s=(r=n("finalFocusEl"))==null?void 0:r())!=null?s:vS(t);i==null||i.focus({preventScroll:!0})})},clearValue({context:e}){e.set("value","")},focusInputIfNeeded({action:e,prop:t}){(t("edit")||t("defaultEdit"))&&e(["focusInput"])},focusInput({scope:e,prop:t}){H(()=>{let n=ha(e);n&&(t("selectOnFocus")?n.select():n.focus({preventScroll:!0}))})},invokeOnCancel({prop:e,context:t}){var i;let n=t.get("previousValue");(i=e("onValueRevert"))==null||i({value:n})},invokeOnSubmit({prop:e,context:t}){var i;let n=t.get("value");(i=e("onValueCommit"))==null||i({value:n})},invokeOnEdit({prop:e}){var t;(t=e("onEditChange"))==null||t({edit:!0})},invokeOnPreview({prop:e}){var t;(t=e("onEditChange"))==null||t({edit:!1})},toggleEditing({prop:e,send:t,event:n}){t({type:e("edit")?"CONTROLLED.EDIT":"CONTROLLED.PREVIEW",previousEvent:n})},syncInputValue({context:e,scope:t}){let n=ha(t);n&&Me(n,e.get("value"))},setValue({context:e,prop:t,event:n}){let i=t("maxLength"),r=i!=null?n.value.slice(0,i):n.value;e.set("value",r)},setPreviousValue({context:e}){e.set("previousValue",e.get("value"))},revertValue({context:e}){let t=e.get("previousValue");t&&e.set("value",t)},blurInput({scope:e}){var t;(t=ha(e))==null||t.blur()}}}},ES=_()(["activationMode","autoResize","dir","disabled","finalFocusEl","form","getRootNode","id","ids","invalid","maxLength","name","onEditChange","onFocusOutside","onInteractOutside","onPointerDownOutside","onValueChange","onValueCommit","onValueRevert","placeholder","readOnly","required","selectOnFocus","edit","defaultEdit","submitMode","translations","defaultValue","value"]),Bx=B(ES),IS=class extends K{initMachine(e){return new W(bS,e)}initApi(){return yS(this.machine.service,q)}render(){var l;let e=(l=this.el.querySelector('[data-scope="editable"][data-part="root"]'))!=null?l:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="editable"][data-part="area"]');t&&this.spreadProps(t,this.api.getAreaProps());let n=this.el.querySelector('[data-scope="editable"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=this.el.querySelector('[data-scope="editable"][data-part="input"]');i&&this.spreadProps(i,this.api.getInputProps());let r=this.el.querySelector('[data-scope="editable"][data-part="preview"]');r&&this.spreadProps(r,this.api.getPreviewProps());let s=this.el.querySelector('[data-scope="editable"][data-part="edit-trigger"]');s&&this.spreadProps(s,this.api.getEditTriggerProps());let a=this.el.querySelector('[data-scope="editable"][data-part="submit-trigger"]');a&&this.spreadProps(a,this.api.getSubmitTriggerProps());let o=this.el.querySelector('[data-scope="editable"][data-part="cancel-trigger"]');o&&this.spreadProps(o,this.api.getCancelTriggerProps())}},PS={mounted(){let e=this.el,t=w(e,"value"),n=w(e,"defaultValue"),i=C(e,"controlled"),r=w(e,"placeholder"),s=w(e,"activationMode"),a=C(e,"selectOnFocus"),o=new IS(e,y(g(g(g(g(y(g({id:e.id},i&&t!==void 0?{value:t}:{defaultValue:n!=null?n:""}),{disabled:C(e,"disabled"),readOnly:C(e,"readOnly"),required:C(e,"required"),invalid:C(e,"invalid"),name:w(e,"name"),form:w(e,"form"),dir:Oe(e)}),r!==void 0?{placeholder:r}:{}),s!==void 0?{activationMode:s}:{}),a!==void 0?{selectOnFocus:a}:{}),C(e,"controlledEdit")?{edit:C(e,"edit")}:{defaultEdit:C(e,"defaultEdit")}),{onValueChange:l=>{let c=e.querySelector('[data-scope="editable"][data-part="input"]');c&&(c.value=l.value,c.dispatchEvent(new Event("input",{bubbles:!0})),c.dispatchEvent(new Event("change",{bubbles:!0})));let u=w(e,"onValueChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{value:l.value,id:e.id});let h=w(e,"onValueChangeClient");h&&e.dispatchEvent(new CustomEvent(h,{bubbles:!0,detail:{value:l,id:e.id}}))}}));o.init(),this.editable=o,this.handlers=[]},updated(){var n;let e=w(this.el,"value"),t=C(this.el,"controlled");(n=this.editable)==null||n.updateProps(y(g({id:this.el.id},t&&e!==void 0?{value:e}:{}),{disabled:C(this.el,"disabled"),readOnly:C(this.el,"readOnly"),required:C(this.el,"required"),invalid:C(this.el,"invalid"),name:w(this.el,"name"),form:w(this.el,"form")}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.editable)==null||e.destroy()}}});var Vg={};he(Vg,{FloatingPanel:()=>RS});function TS(e){switch(e){case"n":return{cursor:"n-resize",width:"100%",top:0,left:"50%",translate:"-50%"};case"e":return{cursor:"e-resize",height:"100%",right:0,top:"50%",translate:"0 -50%"};case"s":return{cursor:"s-resize",width:"100%",bottom:0,left:"50%",translate:"-50%"};case"w":return{cursor:"w-resize",height:"100%",left:0,top:"50%",translate:"0 -50%"};case"se":return{cursor:"se-resize",bottom:0,right:0};case"sw":return{cursor:"sw-resize",bottom:0,left:0};case"ne":return{cursor:"ne-resize",top:0,right:0};case"nw":return{cursor:"nw-resize",top:0,left:0};default:throw new Error(`Invalid axis: ${e}`)}}function OS(e,t){let{state:n,send:i,scope:r,prop:s,computed:a,context:o}=e,l=n.hasTag("open"),c=n.matches("open.dragging"),u=n.matches("open.resizing"),h=o.get("isTopmost"),m=o.get("size"),d=o.get("position"),p=a("isMaximized"),v=a("isMinimized"),I=a("isStaged"),T=a("canResize"),O=a("canDrag");return{open:l,resizable:s("resizable"),draggable:s("draggable"),setOpen(b){n.hasTag("open")!==b&&i({type:b?"OPEN":"CLOSE"})},dragging:c,resizing:u,position:d,size:m,setPosition(b){i({type:"SET_POSITION",position:b})},setSize(b){i({type:"SET_SIZE",size:b})},minimize(){i({type:"MINIMIZE"})},maximize(){i({type:"MAXIMIZE"})},restore(){i({type:"RESTORE"})},getTriggerProps(){return t.button(y(g({},St.trigger.attrs),{dir:s("dir"),type:"button",disabled:s("disabled"),id:Tg(r),"data-state":l?"open":"closed","data-dragging":E(c),"aria-controls":Sl(r),onClick(b){if(b.defaultPrevented||s("disabled"))return;let f=n.hasTag("open");i({type:f?"CLOSE":"OPEN",src:"trigger"})}}))},getPositionerProps(){return t.element(y(g({},St.positioner.attrs),{dir:s("dir"),id:Og(r),style:{"--width":ye(m==null?void 0:m.width),"--height":ye(m==null?void 0:m.height),"--x":ye(d==null?void 0:d.x),"--y":ye(d==null?void 0:d.y),position:s("strategy"),top:"var(--y)",left:"var(--x)"}}))},getContentProps(){return t.element(y(g({},St.content.attrs),{dir:s("dir"),role:"dialog",tabIndex:0,hidden:!l,id:Sl(r),"aria-labelledby":yg(r),"data-state":l?"open":"closed","data-dragging":E(c),"data-topmost":E(h),"data-behind":E(!h),"data-minimized":E(v),"data-maximized":E(p),"data-staged":E(I),style:{width:"var(--width)",height:"var(--height)",overflow:v?"hidden":void 0},onFocus(){i({type:"CONTENT_FOCUS"})},onKeyDown(b){if(b.defaultPrevented||b.currentTarget!==j(b))return;let f=gi(b)*s("gridSize"),P={Escape(){h&&i({type:"ESCAPE"})},ArrowLeft(){i({type:"MOVE",direction:"left",step:f})},ArrowRight(){i({type:"MOVE",direction:"right",step:f})},ArrowUp(){i({type:"MOVE",direction:"up",step:f})},ArrowDown(){i({type:"MOVE",direction:"down",step:f})}}[ge(b,{dir:s("dir")})];P&&(b.preventDefault(),P(b))}}))},getCloseTriggerProps(){return t.button(y(g({},St.closeTrigger.attrs),{dir:s("dir"),disabled:s("disabled"),"aria-label":"Close Window",type:"button",onClick(b){b.defaultPrevented||i({type:"CLOSE"})}}))},getStageTriggerProps(b){if(!Pg.has(b.stage))throw new Error(`[zag-js] Invalid stage: ${b.stage}. Must be one of: ${Array.from(Pg).join(", ")}`);let f=s("translations"),S=Ce(b.stage,{minimized:()=>({"aria-label":f.minimize,hidden:I}),maximized:()=>({"aria-label":f.maximize,hidden:I}),default:()=>({"aria-label":f.restore,hidden:!I})});return t.button(y(g(y(g({},St.stageTrigger.attrs),{dir:s("dir"),disabled:s("disabled"),"data-stage":b.stage}),S),{type:"button",onClick(P){if(P.defaultPrevented||!s("resizable"))return;let V=Ce(b.stage,{minimized:()=>"MINIMIZE",maximized:()=>"MAXIMIZE",default:()=>"RESTORE"});i({type:V.toUpperCase()})}}))},getResizeTriggerProps(b){return t.element(y(g({},St.resizeTrigger.attrs),{dir:s("dir"),"data-disabled":E(!T),"data-axis":b.axis,onPointerDown(f){T&&pe(f)&&(f.currentTarget.setPointerCapture(f.pointerId),f.stopPropagation(),i({type:"RESIZE_START",axis:b.axis,position:{x:f.clientX,y:f.clientY}}))},onPointerUp(f){if(!T)return;let S=f.currentTarget;S.hasPointerCapture(f.pointerId)&&S.releasePointerCapture(f.pointerId)},style:g({position:"absolute",touchAction:"none"},TS(b.axis))}))},getDragTriggerProps(){return t.element(y(g({},St.dragTrigger.attrs),{dir:s("dir"),"data-disabled":E(!O),onPointerDown(b){if(!O||!pe(b))return;let f=j(b);f!=null&&f.closest("button")||f!=null&&f.closest("[data-no-drag]")||(b.currentTarget.setPointerCapture(b.pointerId),b.stopPropagation(),i({type:"DRAG_START",pointerId:b.pointerId,position:{x:b.clientX,y:b.clientY}}))},onPointerUp(b){if(!O)return;let f=b.currentTarget;f.hasPointerCapture(b.pointerId)&&f.releasePointerCapture(b.pointerId)},onDoubleClick(b){b.defaultPrevented||s("resizable")&&i({type:I?"RESTORE":"MAXIMIZE"})},style:{WebkitUserSelect:"none",userSelect:"none",touchAction:"none",cursor:"move"}}))},getControlProps(){return t.element(y(g({},St.control.attrs),{dir:s("dir"),"data-disabled":E(s("disabled")),"data-stage":o.get("stage"),"data-minimized":E(v),"data-maximized":E(p),"data-staged":E(I)}))},getTitleProps(){return t.element(y(g({},St.title.attrs),{dir:s("dir"),id:yg(r)}))},getHeaderProps(){return t.element(y(g({},St.header.attrs),{dir:s("dir"),id:wg(r),"data-dragging":E(c),"data-topmost":E(h),"data-behind":E(!h),"data-minimized":E(v),"data-maximized":E(p),"data-staged":E(I)}))},getBodyProps(){return t.element(y(g({},St.body.attrs),{dir:s("dir"),"data-dragging":E(c),"data-minimized":E(v),"data-maximized":E(p),"data-staged":E(I),hidden:v}))}}}function ga(e){if(e)try{let t=JSON.parse(e);if(typeof t.width=="number"&&typeof t.height=="number")return{width:t.width,height:t.height}}catch(t){}}function Sg(e){if(e)try{let t=JSON.parse(e);if(typeof t.x=="number"&&typeof t.y=="number")return{x:t.x,y:t.y}}catch(t){}}var CS,St,Tg,Og,Sl,yg,wg,bg,Eg,Ig,SS,wn,Pg,kr,Cg,wS,VS,xS,AS,Wx,kS,Kx,NS,RS,xg=re(()=>{"use strict";Cs();se();CS=U("floating-panel").parts("trigger","positioner","content","header","body","title","resizeTrigger","dragTrigger","stageTrigger","closeTrigger","control"),St=CS.build(),Tg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`float:${e.id}:trigger`},Og=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`float:${e.id}:positioner`},Sl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`float:${e.id}:content`},yg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`float:${e.id}:title`},wg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.header)!=null?n:`float:${e.id}:header`},bg=e=>e.getById(Tg(e)),Eg=e=>e.getById(Og(e)),Ig=e=>e.getById(Sl(e)),SS=e=>e.getById(wg(e)),wn=(e,t,n)=>{let i;return le(t)?i=po(t):i=Cu(e.getWin()),n&&(i=bn({x:-i.width,y:i.minY,width:i.width*3,height:i.height*2})),fn(i,["x","y","width","height"])};Pg=new Set(["minimized","maximized","default"]);kr=ys({stack:[],count(){return this.stack.length},add(e){this.stack.includes(e)||this.stack.push(e)},remove(e){let t=this.stack.indexOf(e);t<0||this.stack.splice(t,1)},bringToFront(e){this.remove(e),this.add(e)},isTopmost(e){return this.stack[this.stack.length-1]===e},indexOf(e){return this.stack.indexOf(e)}}),{not:Cg,and:wS}=Ee(),VS={minimize:"Minimize window",maximize:"Maximize window",restore:"Restore window"},xS={props({props:e}){return yn(e,["id"],"floating-panel"),y(g({strategy:"fixed",gridSize:1,defaultSize:{width:320,height:240},defaultPosition:{x:300,y:100},allowOverflow:!0,resizable:!0,draggable:!0},e),{hasSpecifiedPosition:!!e.defaultPosition||!!e.position,translations:g(g({},VS),e.translations)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"closed"},context({prop:e,bindable:t}){return{size:t(()=>({defaultValue:e("defaultSize"),value:e("size"),isEqual:Iu,sync:!0,hash(n){return`W:${n.width} H:${n.height}`},onChange(n){var i;(i=e("onSizeChange"))==null||i({size:n})}})),position:t(()=>({defaultValue:e("defaultPosition"),value:e("position"),isEqual:Pu,sync:!0,hash(n){return`X:${n.x} Y:${n.y}`},onChange(n){var i;(i=e("onPositionChange"))==null||i({position:n})}})),stage:t(()=>({defaultValue:"default",onChange(n){var i;(i=e("onStageChange"))==null||i({stage:n})}})),lastEventPosition:t(()=>({defaultValue:null})),prevPosition:t(()=>({defaultValue:null})),prevSize:t(()=>({defaultValue:null})),isTopmost:t(()=>({defaultValue:void 0}))}},computed:{isMaximized:({context:e})=>e.get("stage")==="maximized",isMinimized:({context:e})=>e.get("stage")==="minimized",isStaged:({context:e})=>e.get("stage")!=="default",canResize:({context:e,prop:t})=>t("resizable")&&!t("disabled")&&e.get("stage")==="default",canDrag:({prop:e,computed:t})=>e("draggable")&&!e("disabled")&&!t("isMaximized")},watch({track:e,context:t,action:n,prop:i}){e([()=>t.hash("position")],()=>{n(["setPositionStyle"])}),e([()=>t.hash("size")],()=>{n(["setSizeStyle"])}),e([()=>i("open")],()=>{n(["toggleVisibility"])})},effects:["trackPanelStack"],on:{CONTENT_FOCUS:{actions:["bringToFrontOfPanelStack"]},SET_POSITION:{actions:["setPosition"]},SET_SIZE:{actions:["setSize"]}},states:{closed:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["setAnchorPosition","setPositionStyle","setSizeStyle","focusContentEl"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setAnchorPosition","setPositionStyle","setSizeStyle","focusContentEl"]}]}},open:{tags:["open"],entry:["bringToFrontOfPanelStack"],effects:["trackBoundaryRect"],on:{DRAG_START:{guard:Cg("isMaximized"),target:"open.dragging",actions:["setPrevPosition"]},RESIZE_START:{guard:Cg("isMinimized"),target:"open.resizing",actions:["setPrevSize"]},"CONTROLLED.CLOSE":{target:"closed",actions:["resetRect","focusTriggerEl"]},CLOSE:[{guard:"isOpenControlled",target:"closed",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","resetRect","focusTriggerEl"]}],ESCAPE:[{guard:wS("isOpenControlled","closeOnEsc"),actions:["invokeOnClose"]},{guard:"closeOnEsc",target:"closed",actions:["invokeOnClose","resetRect","focusTriggerEl"]}],MINIMIZE:{actions:["setMinimized"]},MAXIMIZE:{actions:["setMaximized"]},RESTORE:{actions:["setRestored"]},MOVE:{actions:["setPositionFromKeyboard"]}}},"open.dragging":{tags:["open"],effects:["trackPointerMove"],exit:["clearPrevPosition"],on:{DRAG:{actions:["setPosition"]},DRAG_END:{target:"open",actions:["invokeOnDragEnd"]},"CONTROLLED.CLOSE":{target:"closed",actions:["resetRect"]},CLOSE:[{guard:"isOpenControlled",target:"closed",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","resetRect"]}],ESCAPE:{target:"open"}}},"open.resizing":{tags:["open"],effects:["trackPointerMove"],exit:["clearPrevSize"],on:{DRAG:{actions:["setSize"]},DRAG_END:{target:"open",actions:["invokeOnResizeEnd"]},"CONTROLLED.CLOSE":{target:"closed",actions:["resetRect"]},CLOSE:[{guard:"isOpenControlled",target:"closed",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","resetRect"]}],ESCAPE:{target:"open"}}}},implementations:{guards:{closeOnEsc:({prop:e})=>!!e("closeOnEscape"),isMaximized:({context:e})=>e.get("stage")==="maximized",isMinimized:({context:e})=>e.get("stage")==="minimized",isOpenControlled:({prop:e})=>e("open")!=null},effects:{trackPointerMove({scope:e,send:t,event:n,prop:i}){var o;let r=e.getDoc(),s=(o=i("getBoundaryEl"))==null?void 0:o(),a=wn(e,s,!1);return hn(r,{onPointerMove({point:l,event:c}){let{altKey:u,shiftKey:h}=c,m=He(l.x,a.x,a.x+a.width),d=He(l.y,a.y,a.y+a.height);t({type:"DRAG",position:{x:m,y:d},axis:n.axis,altKey:u,shiftKey:h})},onPointerUp(){t({type:"DRAG_END"})}})},trackBoundaryRect({context:e,scope:t,prop:n,computed:i}){var l;let r=t.getWin(),s=!0,a=()=>{var h;if(s){s=!1;return}let c=(h=n("getBoundaryEl"))==null?void 0:h(),u=wn(t,c,!1);if(!i("isMaximized")){let m=g(g({},e.get("position")),e.get("size"));u=Eu(m,u)}e.set("size",fn(u,["width","height"])),e.set("position",fn(u,["x","y"]))},o=(l=n("getBoundaryEl"))==null?void 0:l();return le(o)?gn.observe(o,a):ee(r,"resize",a)},trackPanelStack({context:e,scope:t}){let n=ns(kr,()=>{e.set("isTopmost",kr.isTopmost(t.id));let i=Ig(t);if(!i)return;let r=kr.indexOf(t.id);r!==-1&&i.style.setProperty("--z-index",`${r+1}`)});return()=>{kr.remove(t.id),n()}}},actions:{setAnchorPosition({context:e,prop:t,scope:n}){if(t("hasSpecifiedPosition"))return;let i=e.get("prevPosition")||e.get("prevSize");t("persistRect")&&i||H(()=>{var o,l;let r=bg(n),s=wn(n,(o=t("getBoundaryEl"))==null?void 0:o(),!1),a=(l=t("getAnchorPosition"))==null?void 0:l({triggerRect:r?DOMRect.fromRect(po(r)):null,boundaryRect:DOMRect.fromRect(s)});if(!a){let c=e.get("size");a={x:s.x+(s.width-c.width)/2,y:s.y+(s.height-c.height)/2}}a&&e.set("position",a)})},setPrevPosition({context:e,event:t}){e.set("prevPosition",g({},e.get("position"))),e.set("lastEventPosition",t.position)},clearPrevPosition({context:e,prop:t}){t("persistRect")||e.set("prevPosition",null),e.set("lastEventPosition",null)},setPosition({context:e,event:t,prop:n,scope:i}){var c;let r=go(t.position,e.get("lastEventPosition"));r.x=Math.round(r.x/n("gridSize"))*n("gridSize"),r.y=Math.round(r.y/n("gridSize"))*n("gridSize");let s=e.get("prevPosition");if(!s)return;let a=bu(s,r),o=(c=n("getBoundaryEl"))==null?void 0:c(),l=wn(i,o,n("allowOverflow"));a=hr(a,e.get("size"),l),e.set("position",a)},setPositionStyle({scope:e,context:t}){let n=Eg(e),i=t.get("position");n==null||n.style.setProperty("--x",`${i.x}px`),n==null||n.style.setProperty("--y",`${i.y}px`)},resetRect({context:e,prop:t}){e.set("stage","default"),t("persistRect")||(e.set("position",e.initial("position")),e.set("size",e.initial("size")))},setPrevSize({context:e,event:t}){e.set("prevSize",g({},e.get("size"))),e.set("prevPosition",g({},e.get("position"))),e.set("lastEventPosition",t.position)},clearPrevSize({context:e}){e.set("prevSize",null),e.set("prevPosition",null),e.set("lastEventPosition",null)},setSize({context:e,event:t,scope:n,prop:i}){var p;let r=e.get("prevSize"),s=e.get("prevPosition"),a=e.get("lastEventPosition");if(!r||!s||!a)return;let o=bn(g(g({},s),r)),l=go(t.position,a),c=Tu(o,l,t.axis,{scalingOriginMode:t.altKey?"center":"extent",lockAspectRatio:!!i("lockAspectRatio")||t.shiftKey}),u=fn(c,["width","height"]),h=fn(c,["x","y"]),m=(p=i("getBoundaryEl"))==null?void 0:p(),d=wn(n,m,!1);if(u=gr(u,i("minSize"),i("maxSize")),u=gr(u,i("minSize"),d),e.set("size",u),h){let v=hr(h,u,d);e.set("position",v)}},setSizeStyle({scope:e,context:t}){queueMicrotask(()=>{let n=Eg(e),i=t.get("size");n==null||n.style.setProperty("--width",`${i.width}px`),n==null||n.style.setProperty("--height",`${i.height}px`)})},setMaximized({context:e,prop:t,scope:n}){var s;e.set("stage","maximized"),e.set("prevSize",e.get("size")),e.set("prevPosition",e.get("position"));let i=(s=t("getBoundaryEl"))==null?void 0:s(),r=wn(n,i,!1);e.set("position",fn(r,["x","y"])),e.set("size",fn(r,["height","width"]))},setMinimized({context:e,scope:t}){e.set("stage","minimized"),e.set("prevSize",e.get("size")),e.set("prevPosition",e.get("position"));let n=SS(t);if(!n)return;let i=y(g({},e.get("size")),{height:n==null?void 0:n.offsetHeight});e.set("size",i)},setRestored({context:e,prop:t,scope:n}){var s;let i=wn(n,(s=t("getBoundaryEl"))==null?void 0:s(),!1);e.set("stage","default");let r=e.get("prevSize");if(r){let a=r;a=gr(a,t("minSize"),t("maxSize")),a=gr(a,t("minSize"),i),e.set("size",a),e.set("prevSize",null)}if(e.get("prevPosition")){let a=e.get("prevPosition");a=hr(a,e.get("size"),i),e.set("position",a),e.set("prevPosition",null)}},setPositionFromKeyboard({context:e,event:t,prop:n,scope:i}){var c;vs(t.step==null,"step is required");let r=e.get("position"),s=t.step,a=Ce(t.direction,{left:{x:r.x-s,y:r.y},right:{x:r.x+s,y:r.y},up:{x:r.x,y:r.y-s},down:{x:r.x,y:r.y+s}}),o=(c=n("getBoundaryEl"))==null?void 0:c(),l=wn(i,o,!1);a=hr(a,e.get("size"),l),e.set("position",a)},bringToFrontOfPanelStack({prop:e}){kr.bringToFront(e("id"))},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},invokeOnDragEnd({context:e,prop:t}){var n;(n=t("onPositionChangeEnd"))==null||n({position:e.get("position")})},invokeOnResizeEnd({context:e,prop:t}){var n;(n=t("onSizeChangeEnd"))==null||n({size:e.get("size")})},focusTriggerEl({scope:e}){H(()=>{var t;(t=bg(e))==null||t.focus()})},focusContentEl({scope:e}){H(()=>{var t;(t=Ig(e))==null||t.focus()})},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})}}}},AS=_()(["allowOverflow","closeOnEscape","defaultOpen","defaultPosition","defaultSize","dir","disabled","draggable","getAnchorPosition","getBoundaryEl","getRootNode","gridSize","id","ids","lockAspectRatio","maxSize","minSize","onOpenChange","onPositionChange","onPositionChangeEnd","onSizeChange","onSizeChangeEnd","onStageChange","open","persistRect","position","resizable","size","strategy","translations"]),Wx=B(AS),kS=_()(["axis"]),Kx=B(kS),NS=class extends K{initMachine(e){return new W(xS,e)}initApi(){return OS(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="floating-panel"][data-part="trigger"]');e&&this.spreadProps(e,this.api.getTriggerProps());let t=this.el.querySelector('[data-scope="floating-panel"][data-part="positioner"]');t&&this.spreadProps(t,this.api.getPositionerProps());let n=this.el.querySelector('[data-scope="floating-panel"][data-part="content"]');n&&this.spreadProps(n,this.api.getContentProps());let i=this.el.querySelector('[data-scope="floating-panel"][data-part="title"]');i&&this.spreadProps(i,this.api.getTitleProps());let r=this.el.querySelector('[data-scope="floating-panel"][data-part="header"]');r&&this.spreadProps(r,this.api.getHeaderProps());let s=this.el.querySelector('[data-scope="floating-panel"][data-part="body"]');s&&this.spreadProps(s,this.api.getBodyProps());let a=this.el.querySelector('[data-scope="floating-panel"][data-part="drag-trigger"]');a&&this.spreadProps(a,this.api.getDragTriggerProps()),["s","w","e","n","sw","nw","se","ne"].forEach(h=>{let m=this.el.querySelector(`[data-scope="floating-panel"][data-part="resize-trigger"][data-axis="${h}"]`);m&&this.spreadProps(m,this.api.getResizeTriggerProps({axis:h}))});let l=this.el.querySelector('[data-scope="floating-panel"][data-part="close-trigger"]');l&&this.spreadProps(l,this.api.getCloseTriggerProps());let c=this.el.querySelector('[data-scope="floating-panel"][data-part="control"]');c&&this.spreadProps(c,this.api.getControlProps()),["minimized","maximized","default"].forEach(h=>{let m=this.el.querySelector(`[data-scope="floating-panel"][data-part="stage-trigger"][data-stage="${h}"]`);m&&this.spreadProps(m,this.api.getStageTriggerProps({stage:h}))})}};RS={mounted(){let e=this.el,t=C(e,"open"),n=C(e,"defaultOpen"),i=C(e,"controlled"),r=ga(e.dataset.size),s=ga(e.dataset.defaultSize),a=Sg(e.dataset.position),o=Sg(e.dataset.defaultPosition),l=new NS(e,y(g({id:e.id},i?{open:t}:{defaultOpen:n}),{draggable:C(e,"draggable")!==!1,resizable:C(e,"resizable")!==!1,allowOverflow:C(e,"allowOverflow")!==!1,closeOnEscape:C(e,"closeOnEscape")!==!1,disabled:C(e,"disabled"),dir:Oe(e),size:r,defaultSize:s,position:a,defaultPosition:o,minSize:ga(e.dataset.minSize),maxSize:ga(e.dataset.maxSize),persistRect:C(e,"persistRect"),gridSize:Number(e.dataset.gridSize)||1,onOpenChange:c=>{let u=w(e,"onOpenChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{open:c.open,id:e.id});let h=w(e,"onOpenChangeClient");h&&e.dispatchEvent(new CustomEvent(h,{bubbles:!0,detail:{value:c,id:e.id}}))},onPositionChange:c=>{let u=w(e,"onPositionChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{position:c.position,id:e.id})},onSizeChange:c=>{let u=w(e,"onSizeChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{size:c.size,id:e.id})},onStageChange:c=>{let u=w(e,"onStageChange");u&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(u,{stage:c.stage,id:e.id})}}));l.init(),this.floatingPanel=l,this.handlers=[]},updated(){var n;let e=C(this.el,"open"),t=C(this.el,"controlled");(n=this.floatingPanel)==null||n.updateProps(y(g({id:this.el.id},t?{open:e}:{}),{disabled:C(this.el,"disabled"),dir:Oe(this.el)}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.floatingPanel)==null||e.destroy()}}});var Dg={};he(Dg,{Listbox:()=>jS});function $S(e,t){let{context:n,prop:i,scope:r,computed:s,send:a,refs:o}=e,l=i("disabled"),c=i("collection"),u=Cn(c)?"grid":"list",h=n.get("focused"),m=o.get("focusVisible")&&h,d=o.get("inputState"),p=n.get("value"),v=n.get("selectedItems"),I=n.get("highlightedValue"),T=n.get("highlightedItem"),O=s("isTypingAhead"),b=s("isInteractive"),f=I?Ol(r,I):void 0;function S(P){let V=c.getItemDisabled(P.item),A=c.getItemValue(P.item);vn(A,()=>`[zag-js] No value found for item ${JSON.stringify(P.item)}`);let x=I===A;return{value:A,disabled:!!(l||V),focused:x&&h,focusVisible:x&&m,highlighted:x&&(d.focused?h:m),selected:n.get("value").includes(A)}}return{empty:p.length===0,highlightedItem:T,highlightedValue:I,clearHighlightedValue(){a({type:"HIGHLIGHTED_VALUE.SET",value:null})},selectedItems:v,hasSelectedItems:s("hasSelectedItems"),value:p,valueAsString:s("valueAsString"),collection:c,disabled:!!l,selectValue(P){a({type:"ITEM.SELECT",value:P})},setValue(P){a({type:"VALUE.SET",value:P})},selectAll(){if(!s("multiple"))throw new Error("[zag-js] Cannot select all items in a single-select listbox");a({type:"VALUE.SET",value:c.getValues()})},highlightValue(P){a({type:"HIGHLIGHTED_VALUE.SET",value:P})},clearValue(P){a(P?{type:"ITEM.CLEAR",value:P}:{type:"VALUE.CLEAR"})},getItemState:S,getRootProps(){return t.element(y(g({},Ht.root.attrs),{dir:i("dir"),id:MS(r),"data-orientation":i("orientation"),"data-disabled":E(l)}))},getInputProps(P={}){return t.input(y(g({},Ht.input.attrs),{dir:i("dir"),disabled:l,"data-disabled":E(l),autoComplete:"off",autoCorrect:"off","aria-haspopup":"listbox","aria-controls":Tl(r),"aria-autocomplete":"list","aria-activedescendant":f,spellCheck:!1,enterKeyHint:"go",onFocus(){queueMicrotask(()=>{a({type:"INPUT.FOCUS",autoHighlight:!!(P!=null&&P.autoHighlight)})})},onBlur(){a({type:"CONTENT.BLUR",src:"input"})},onInput(V){P!=null&&P.autoHighlight&&(V.currentTarget.value.trim()||queueMicrotask(()=>{a({type:"HIGHLIGHTED_VALUE.SET",value:null})}))},onKeyDown(V){if(V.defaultPrevented||Re(V))return;let A=Yt(V),x=()=>{var D;V.preventDefault();let k=r.getWin(),N=new k.KeyboardEvent(A.type,A);(D=pa(r))==null||D.dispatchEvent(N)};switch(A.key){case"ArrowLeft":case"ArrowRight":{if(!Cn(c)||V.ctrlKey)return;x()}case"Home":case"End":{if(I==null&&V.shiftKey)return;x()}case"ArrowDown":case"ArrowUp":{x();break}case"Enter":I!=null&&(V.preventDefault(),a({type:"ITEM.CLICK",value:I}));break}}}))},getLabelProps(){return t.element(y(g({dir:i("dir"),id:Ag(r)},Ht.label.attrs),{"data-disabled":E(l)}))},getValueTextProps(){return t.element(y(g({},Ht.valueText.attrs),{dir:i("dir"),"data-disabled":E(l)}))},getItemProps(P){let V=S(P);return t.element(y(g({id:Ol(r,V.value),role:"option"},Ht.item.attrs),{dir:i("dir"),"data-value":V.value,"aria-selected":V.selected,"data-selected":E(V.selected),"data-layout":u,"data-state":V.selected?"checked":"unchecked","data-orientation":i("orientation"),"data-highlighted":E(V.highlighted),"data-disabled":E(V.disabled),"aria-disabled":X(V.disabled),onPointerMove(A){P.highlightOnHover&&(V.disabled||A.pointerType!=="mouse"||V.highlighted||a({type:"ITEM.POINTER_MOVE",value:V.value}))},onMouseDown(A){var x;A.preventDefault(),(x=pa(r))==null||x.focus()},onClick(A){A.defaultPrevented||V.disabled||a({type:"ITEM.CLICK",value:V.value,shiftKey:A.shiftKey,anchorValue:I,metaKey:ls(A)})}}))},getItemTextProps(P){let V=S(P);return t.element(y(g({},Ht.itemText.attrs),{"data-state":V.selected?"checked":"unchecked","data-disabled":E(V.disabled),"data-highlighted":E(V.highlighted)}))},getItemIndicatorProps(P){let V=S(P);return t.element(y(g({},Ht.itemIndicator.attrs),{"aria-hidden":!0,"data-state":V.selected?"checked":"unchecked",hidden:!V.selected}))},getItemGroupLabelProps(P){let{htmlFor:V}=P;return t.element(y(g({},Ht.itemGroupLabel.attrs),{id:kg(r,V),dir:i("dir"),role:"presentation"}))},getItemGroupProps(P){let{id:V}=P;return t.element(y(g({},Ht.itemGroup.attrs),{"data-disabled":E(l),"data-orientation":i("orientation"),"data-empty":E(c.size===0),id:FS(r,V),"aria-labelledby":kg(r,V),role:"group",dir:i("dir")}))},getContentProps(){return t.element(y(g({dir:i("dir"),id:Tl(r),role:"listbox"},Ht.content.attrs),{"data-activedescendant":f,"aria-activedescendant":f,"data-orientation":i("orientation"),"aria-multiselectable":s("multiple")?!0:void 0,"aria-labelledby":Ag(r),tabIndex:0,"data-layout":u,"data-empty":E(c.size===0),style:{"--column-count":Cn(c)?c.columnCount:1},onFocus(){a({type:"CONTENT.FOCUS"})},onBlur(){a({type:"CONTENT.BLUR"})},onKeyDown(P){if(!b||!ce(P.currentTarget,j(P)))return;let V=P.shiftKey,A={ArrowUp(N){let D=null;Cn(c)&&I?D=c.getPreviousRowValue(I):I&&(D=c.getPreviousValue(I)),!D&&(i("loopFocus")||!I)&&(D=c.lastValue),D&&(N.preventDefault(),a({type:"NAVIGATE",value:D,shiftKey:V,anchorValue:I}))},ArrowDown(N){let D=null;Cn(c)&&I?D=c.getNextRowValue(I):I&&(D=c.getNextValue(I)),!D&&(i("loopFocus")||!I)&&(D=c.firstValue),D&&(N.preventDefault(),a({type:"NAVIGATE",value:D,shiftKey:V,anchorValue:I}))},ArrowLeft(){if(!Cn(c)&&i("orientation")==="vertical")return;let N=I?c.getPreviousValue(I):null;!N&&i("loopFocus")&&(N=c.lastValue),N&&(P.preventDefault(),a({type:"NAVIGATE",value:N,shiftKey:V,anchorValue:I}))},ArrowRight(){if(!Cn(c)&&i("orientation")==="vertical")return;let N=I?c.getNextValue(I):null;!N&&i("loopFocus")&&(N=c.firstValue),N&&(P.preventDefault(),a({type:"NAVIGATE",value:N,shiftKey:V,anchorValue:I}))},Home(N){N.preventDefault();let D=c.firstValue;a({type:"NAVIGATE",value:D,shiftKey:V,anchorValue:I})},End(N){N.preventDefault();let D=c.lastValue;a({type:"NAVIGATE",value:D,shiftKey:V,anchorValue:I})},Enter(){a({type:"ITEM.CLICK",value:I})},a(N){ls(N)&&s("multiple")&&!i("disallowSelectAll")&&(N.preventDefault(),a({type:"VALUE.SET",value:c.getValues()}))},Space(N){var D;O&&i("typeahead")?a({type:"CONTENT.TYPEAHEAD",key:N.key}):(D=A.Enter)==null||D.call(A,N)},Escape(N){i("deselectable")&&p.length>0&&(N.preventDefault(),N.stopPropagation(),a({type:"VALUE.CLEAR"}))}},x=A[ge(P)];if(x){x(P);return}let k=j(P);Ot(k)||Ue.isValidEvent(P)&&i("typeahead")&&(a({type:"CONTENT.TYPEAHEAD",key:P.key}),P.preventDefault())}}))}}}function Nr(e,t,n){let i=US(t,e);for(let r of i)n==null||n({value:r})}function Rg(e,t){return Bi(t?{items:e,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var i;return(i=n.group)!=null?i:""}}:{items:e,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled})}var DS,Ht,Bi,LS,MS,Tl,Ag,Ol,FS,kg,pa,Ng,HS,BS,_S,GS,US,qS,Jx,WS,Qx,KS,eA,zS,tA,YS,jS,Lg=re(()=>{"use strict";pr();yr();se();DS=U("listbox").parts("label","input","item","itemText","itemIndicator","itemGroup","itemGroupLabel","content","root","valueText"),Ht=DS.build(),Bi=e=>new Nt(e);Bi.empty=()=>new Nt({items:[]});LS=e=>new Vo(e);LS.empty=()=>new Vo({items:[],columnCount:0});MS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`select:${e.id}`},Tl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`select:${e.id}:content`},Ag=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`select:${e.id}:label`},Ol=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:option:${t}`},FS=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:optgroup:${t}`},kg=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:optgroup-label:${t}`},pa=e=>e.getById(Tl(e)),Ng=(e,t)=>e.getById(Ol(e,t));({guards:HS,createMachine:BS}=ut()),{or:_S}=HS,GS=BS({props({props:e}){return g({loopFocus:!1,composite:!0,defaultValue:[],multiple:!1,typeahead:!0,collection:Bi.empty(),orientation:"vertical",selectionMode:"single"},e)},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:fe,onChange(n){var r;let i=e("collection").findMany(n);return(r=e("onValueChange"))==null?void 0:r({value:n,items:i})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),sync:!0,onChange(n){var i;(i=e("onHighlightChange"))==null||i({highlightedValue:n,highlightedItem:e("collection").find(n),highlightedIndex:e("collection").indexOf(n)})}})),highlightedItem:t(()=>({defaultValue:null})),selectedItems:t(()=>{var r,s;let n=(s=(r=e("value"))!=null?r:e("defaultValue"))!=null?s:[];return{defaultValue:e("collection").findMany(n)}}),focused:t(()=>({sync:!0,defaultValue:!1}))}},refs(){return{typeahead:g({},Ue.defaultOptions),focusVisible:!1,inputState:{autoHighlight:!1,focused:!1}}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isInteractive:({prop:e})=>!e("disabled"),selection:({context:e,prop:t})=>{let n=new ld(e.get("value"));return n.selectionMode=t("selectionMode"),n.deselectable=!!t("deselectable"),n},multiple:({prop:e})=>e("selectionMode")==="multiple"||e("selectionMode")==="extended",valueAsString:({context:e,prop:t})=>t("collection").stringifyItems(e.get("selectedItems"))},initialState(){return"idle"},watch({context:e,prop:t,track:n,action:i}){n([()=>e.get("value").toString()],()=>{i(["syncSelectedItems"])}),n([()=>e.get("highlightedValue")],()=>{i(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{i(["syncHighlightedValue"])})},effects:["trackFocusVisible"],on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]}},states:{idle:{effects:["scrollToHighlightedItem"],on:{"INPUT.FOCUS":{actions:["setFocused","setInputState"]},"CONTENT.FOCUS":[{guard:_S("hasSelectedValue","hasHighlightedValue"),actions:["setFocused"]},{actions:["setFocused","setDefaultHighlightedValue"]}],"CONTENT.BLUR":{actions:["clearFocused","clearInputState"]},"ITEM.CLICK":{actions:["setHighlightedItem","selectHighlightedItem"]},"CONTENT.TYPEAHEAD":{actions:["setFocused","highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},NAVIGATE:{actions:["setFocused","setHighlightedItem","selectWithKeyboard"]}}}},implementations:{guards:{hasSelectedValue:({context:e})=>e.get("value").length>0,hasHighlightedValue:({context:e})=>e.get("highlightedValue")!=null},effects:{trackFocusVisible:({scope:e,refs:t})=>{var n;return Pn({root:(n=e.getRootNode)==null?void 0:n.call(e),onChange(i){t.set("focusVisible",i.isFocusVisible)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){let i=s=>{let a=e.get("highlightedValue");if(a==null||ju()!=="keyboard")return;let l=pa(n),c=t("scrollToIndexFn");if(c){let h=t("collection").indexOf(a);c==null||c({index:h,immediate:s,getElement(){return Ng(n,a)}});return}let u=Ng(n,a);Xt(u,{rootEl:l,block:"nearest"})};return H(()=>i(!0)),ot(()=>pa(n),{defer:!0,attributes:["data-activedescendant"],callback(){i(!1)}})}},actions:{selectHighlightedItem({context:e,prop:t,event:n,computed:i}){var o;let r=(o=n.value)!=null?o:e.get("highlightedValue"),s=t("collection");if(r==null||!s.has(r))return;let a=i("selection");if(n.shiftKey&&i("multiple")&&n.anchorValue){let l=a.extendSelection(s,n.anchorValue,r);Nr(a,l,t("onSelect")),e.set("value",Array.from(l))}else{let l=a.select(s,r,n.metaKey);Nr(a,l,t("onSelect")),e.set("value",Array.from(l))}},selectWithKeyboard({context:e,prop:t,event:n,computed:i}){let r=i("selection"),s=t("collection");if(n.shiftKey&&i("multiple")&&n.anchorValue){let a=r.extendSelection(s,n.anchorValue,n.value);Nr(r,a,t("onSelect")),e.set("value",Array.from(a));return}if(t("selectOnHighlight")){let a=r.replaceSelection(s,n.value);Nr(r,a,t("onSelect")),e.set("value",Array.from(a))}},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:i}){let r=t("collection").search(n.key,{state:i.get("typeahead"),currentValue:e.get("highlightedValue")});r!=null&&e.set("highlightedValue",r)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n,computed:i}){let r=t("collection"),s=i("selection"),a=s.select(r,n.value);Nr(s,a,t("onSelect")),e.set("value",Array.from(a))},clearItem({context:e,event:t,computed:n}){let r=n("selection").deselect(t.value);e.set("value",Array.from(r))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},syncSelectedItems({context:e,prop:t}){let n=t("collection"),i=e.get("selectedItems"),s=e.get("value").map(a=>i.find(l=>n.getItemValue(l)===a)||n.find(a));e.set("selectedItems",s)},syncHighlightedItem({context:e,prop:t}){let n=t("collection"),i=e.get("highlightedValue"),r=i?n.find(i):null;e.set("highlightedItem",r)},syncHighlightedValue({context:e,prop:t,refs:n}){let i=t("collection"),r=e.get("highlightedValue"),{autoHighlight:s}=n.get("inputState");if(s){queueMicrotask(()=>{var a;e.set("highlightedValue",(a=t("collection").firstValue)!=null?a:null)});return}r!=null&&!i.has(r)&&queueMicrotask(()=>{e.set("highlightedValue",null)})},setFocused({context:e}){e.set("focused",!0)},setDefaultHighlightedValue({context:e,prop:t}){let i=t("collection").firstValue;i!=null&&e.set("highlightedValue",i)},clearFocused({context:e}){e.set("focused",!1)},setInputState({refs:e,event:t}){e.set("inputState",{autoHighlight:!!t.autoHighlight,focused:!0})},clearInputState({refs:e}){e.set("inputState",{autoHighlight:!1,focused:!1})}}}}),US=(e,t)=>{let n=new Set(e);for(let i of t)n.delete(i);return n};qS=_()(["collection","defaultHighlightedValue","defaultValue","dir","disabled","deselectable","disallowSelectAll","getRootNode","highlightedValue","id","ids","loopFocus","onHighlightChange","onSelect","onValueChange","orientation","scrollToIndexFn","selectionMode","selectOnHighlight","typeahead","value"]),Jx=B(qS),WS=_()(["item","highlightOnHover"]),Qx=B(WS),KS=_()(["id"]),eA=B(KS),zS=_()(["htmlFor"]),tA=B(zS),YS=class extends K{constructor(t,n){var r;super(t,n);z(this,"_options",[]);z(this,"hasGroups",!1);z(this,"init",()=>{this.machine.start(),this.render(),this.machine.subscribe(()=>{this.api=this.initApi(),this.render()})});let i=n.collection;this._options=(r=i==null?void 0:i.items)!=null?r:[]}get options(){return Array.isArray(this._options)?this._options:[]}setOptions(t){this._options=Array.isArray(t)?t:[]}getCollection(){let t=this.options;return this.hasGroups?Bi({items:t,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var i;return(i=n.group)!=null?i:""}}):Bi({items:t,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled})}initMachine(t){let n=this.getCollection.bind(this),i=t.collection;return new W(GS,y(g({},t),{get collection(){return i!=null?i:n()}}))}initApi(){return $S(this.machine.service,q)}applyItemProps(){let t=this.el.querySelector('[data-scope="listbox"][data-part="content"]');t&&(t.querySelectorAll('[data-scope="listbox"][data-part="item-group"]').forEach(n=>{var s;let i=(s=n.dataset.id)!=null?s:"";this.spreadProps(n,this.api.getItemGroupProps({id:i}));let r=n.querySelector('[data-scope="listbox"][data-part="item-group-label"]');r&&this.spreadProps(r,this.api.getItemGroupLabelProps({htmlFor:i}))}),t.querySelectorAll('[data-scope="listbox"][data-part="item"]').forEach(n=>{var o;let i=(o=n.dataset.value)!=null?o:"",r=this.options.find(l=>{var c,u;return String((u=(c=l.id)!=null?c:l.value)!=null?u:"")===String(i)});if(!r)return;this.spreadProps(n,this.api.getItemProps({item:r}));let s=n.querySelector('[data-scope="listbox"][data-part="item-text"]');s&&this.spreadProps(s,this.api.getItemTextProps({item:r}));let a=n.querySelector('[data-scope="listbox"][data-part="item-indicator"]');a&&this.spreadProps(a,this.api.getItemIndicatorProps({item:r}))}))}render(){var a;let t=(a=this.el.querySelector('[data-scope="listbox"][data-part="root"]'))!=null?a:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="listbox"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=this.el.querySelector('[data-scope="listbox"][data-part="value-text"]');i&&this.spreadProps(i,this.api.getValueTextProps());let r=this.el.querySelector('[data-scope="listbox"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let s=this.el.querySelector('[data-scope="listbox"][data-part="content"]');s&&(this.spreadProps(s,this.api.getContentProps()),this.applyItemProps())}};jS={mounted(){var o;let e=this.el,t=JSON.parse((o=e.dataset.collection)!=null?o:"[]"),n=t.some(l=>l.group!==void 0),i=Q(e,"value"),r=Q(e,"defaultValue"),s=C(e,"controlled"),a=new YS(e,y(g({id:e.id,collection:Rg(t,n)},s&&i?{value:i}:{defaultValue:r!=null?r:[]}),{disabled:C(e,"disabled"),dir:w(e,"dir",["ltr","rtl"]),orientation:w(e,"orientation",["horizontal","vertical"]),loopFocus:C(e,"loopFocus"),selectionMode:w(e,"selectionMode",["single","multiple","extended"]),selectOnHighlight:C(e,"selectOnHighlight"),deselectable:C(e,"deselectable"),typeahead:C(e,"typeahead"),onValueChange:l=>{let c=w(e,"onValueChange");c&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(c,{value:l.value,items:l.items,id:e.id});let u=w(e,"onValueChangeClient");u&&e.dispatchEvent(new CustomEvent(u,{bubbles:!0,detail:{value:l,id:e.id}}))}}));a.hasGroups=n,a.setOptions(t),a.init(),this.listbox=a,this.handlers=[]},updated(){var r;let e=JSON.parse((r=this.el.dataset.collection)!=null?r:"[]"),t=e.some(s=>s.group!==void 0),n=Q(this.el,"value"),i=C(this.el,"controlled");this.listbox&&(this.listbox.hasGroups=t,this.listbox.setOptions(e),this.listbox.updateProps(y(g({collection:Rg(e,t),id:this.el.id},i&&n?{value:n}:{}),{disabled:C(this.el,"disabled"),dir:w(this.el,"dir",["ltr","rtl"]),orientation:w(this.el,"orientation",["horizontal","vertical"])})))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.listbox)==null||e.destroy()}}});var Ug={};he(Ug,{Menu:()=>mT});function sT(e,t){if(!e)return;let n=ue(e),i=new n.CustomEvent(Vl,{detail:{value:t}});e.dispatchEvent(i)}function aT(e,t){let{context:n,send:i,state:r,computed:s,prop:a,scope:o}=e,l=r.hasTag("open"),c=n.get("isSubmenu"),u=s("isTypingAhead"),h=a("composite"),m=n.get("currentPlacement"),d=n.get("anchorPoint"),p=n.get("highlightedValue"),v=On(y(g({},a("positioning")),{placement:d?"bottom":m}));function I(f){return{id:Rr(o,f.value),disabled:!!f.disabled,highlighted:p===f.value}}function T(f){var P;let S=(P=f.valueText)!=null?P:f.value;return y(g({},f),{id:f.value,valueText:S})}function O(f){let S=I(T(f));return y(g({},S),{checked:!!f.checked})}function b(f){let{closeOnSelect:S,valueText:P,value:V}=f,A=I(f),x=Rr(o,V);return t.element(y(g({},Be.item.attrs),{id:x,role:"menuitem","aria-disabled":X(A.disabled),"data-disabled":E(A.disabled),"data-ownedby":Gi(o),"data-highlighted":E(A.highlighted),"data-value":V,"data-valuetext":P,onDragStart(k){k.currentTarget.matches("a[href]")&&k.preventDefault()},onPointerMove(k){if(A.disabled||k.pointerType!=="mouse")return;let N=k.currentTarget;if(A.highlighted)return;let D=je(k);i({type:"ITEM_POINTERMOVE",id:x,target:N,closeOnSelect:S,point:D})},onPointerLeave(k){var $;if(A.disabled||k.pointerType!=="mouse"||!(($=e.event.previous())==null?void 0:$.type.includes("POINTER")))return;let D=k.currentTarget;i({type:"ITEM_POINTERLEAVE",id:x,target:D,closeOnSelect:S})},onPointerDown(k){if(A.disabled)return;let N=k.currentTarget;i({type:"ITEM_POINTERDOWN",target:N,id:x,closeOnSelect:S})},onClick(k){if(rr(k)||Fn(k)||A.disabled)return;let N=k.currentTarget;i({type:"ITEM_CLICK",target:N,id:x,closeOnSelect:S})}}))}return{highlightedValue:p,open:l,setOpen(f){r.hasTag("open")!==f&&i({type:f?"OPEN":"CLOSE"})},setHighlightedValue(f){i({type:"HIGHLIGHTED.SET",value:f})},setParent(f){i({type:"PARENT.SET",value:f,id:f.prop("id")})},setChild(f){i({type:"CHILD.SET",value:f,id:f.prop("id")})},reposition(f={}){i({type:"POSITIONING.SET",options:f})},addItemListener(f){let S=o.getById(f.id);if(!S)return;let P=()=>{var V;return(V=f.onSelect)==null?void 0:V.call(f)};return S.addEventListener(Vl,P),()=>S.removeEventListener(Vl,P)},getContextTriggerProps(){return t.element(y(g({},Be.contextTrigger.attrs),{dir:a("dir"),id:_g(o),"data-state":l?"open":"closed",onPointerDown(f){if(f.pointerType==="mouse")return;let S=je(f);i({type:"CONTEXT_MENU_START",point:S})},onPointerCancel(f){f.pointerType!=="mouse"&&i({type:"CONTEXT_MENU_CANCEL"})},onPointerMove(f){f.pointerType!=="mouse"&&i({type:"CONTEXT_MENU_CANCEL"})},onPointerUp(f){f.pointerType!=="mouse"&&i({type:"CONTEXT_MENU_CANCEL"})},onContextMenu(f){let S=je(f);i({type:"CONTEXT_MENU",point:S}),f.preventDefault()},style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none"}}))},getTriggerItemProps(f){let S=f.getTriggerProps();return au(b({value:S.id}),S)},getTriggerProps(){return t.button(y(g({},c?Be.triggerItem.attrs:Be.trigger.attrs),{"data-placement":n.get("currentPlacement"),type:"button",dir:a("dir"),id:va(o),"data-uid":a("id"),"aria-haspopup":h?"menu":"dialog","aria-controls":Gi(o),"data-controls":Gi(o),"aria-expanded":l||void 0,"data-state":l?"open":"closed",onPointerMove(f){if(f.pointerType!=="mouse"||ma(f.currentTarget)||!c)return;let P=je(f);i({type:"TRIGGER_POINTERMOVE",target:f.currentTarget,point:P})},onPointerLeave(f){if(ma(f.currentTarget)||f.pointerType!=="mouse"||!c)return;let S=je(f);i({type:"TRIGGER_POINTERLEAVE",target:f.currentTarget,point:S})},onPointerDown(f){ma(f.currentTarget)||hi(f)||f.preventDefault()},onClick(f){f.defaultPrevented||ma(f.currentTarget)||i({type:"TRIGGER_CLICK",target:f.currentTarget})},onBlur(){i({type:"TRIGGER_BLUR"})},onFocus(){i({type:"TRIGGER_FOCUS"})},onKeyDown(f){if(f.defaultPrevented)return;let S={ArrowDown(){i({type:"ARROW_DOWN"})},ArrowUp(){i({type:"ARROW_UP"})},Enter(){i({type:"ARROW_DOWN",src:"enter"})},Space(){i({type:"ARROW_DOWN",src:"space"})}},P=ge(f,{orientation:"vertical",dir:a("dir")}),V=S[P];V&&(f.preventDefault(),V(f))}}))},getIndicatorProps(){return t.element(y(g({},Be.indicator.attrs),{dir:a("dir"),"data-state":l?"open":"closed"}))},getPositionerProps(){return t.element(y(g({},Be.positioner.attrs),{dir:a("dir"),id:Gg(o),style:v.floating}))},getArrowProps(){return t.element(y(g({id:ZS(o)},Be.arrow.attrs),{dir:a("dir"),style:v.arrow}))},getArrowTipProps(){return t.element(y(g({},Be.arrowTip.attrs),{dir:a("dir"),style:v.arrowTip}))},getContentProps(){return t.element(y(g({},Be.content.attrs),{id:Gi(o),"aria-label":a("aria-label"),hidden:!l,"data-state":l?"open":"closed",role:h?"menu":"dialog",tabIndex:0,dir:a("dir"),"aria-activedescendant":s("highlightedId")||void 0,"aria-labelledby":va(o),"data-placement":m,onPointerEnter(f){f.pointerType==="mouse"&&i({type:"MENU_POINTERENTER"})},onKeyDown(f){if(f.defaultPrevented||!ce(f.currentTarget,j(f)))return;let S=j(f);if(!((S==null?void 0:S.closest("[role=menu]"))===f.currentTarget||S===f.currentTarget))return;if(f.key==="Tab"&&!ds(f)){f.preventDefault();return}let V={ArrowDown(){i({type:"ARROW_DOWN"})},ArrowUp(){i({type:"ARROW_UP"})},ArrowLeft(){i({type:"ARROW_LEFT"})},ArrowRight(){i({type:"ARROW_RIGHT"})},Enter(){i({type:"ENTER"})},Space(k){var N;u?i({type:"TYPEAHEAD",key:k.key}):(N=V.Enter)==null||N.call(V,k)},Home(){i({type:"HOME"})},End(){i({type:"END"})}},A=ge(f,{dir:a("dir")}),x=V[A];if(x){x(f),f.stopPropagation(),f.preventDefault();return}a("typeahead")&&wc(f)&&(xe(f)||Ot(S)||(i({type:"TYPEAHEAD",key:f.key}),f.preventDefault()))}}))},getSeparatorProps(){return t.element(y(g({},Be.separator.attrs),{role:"separator",dir:a("dir"),"aria-orientation":"horizontal"}))},getItemState:I,getItemProps:b,getOptionItemState:O,getOptionItemProps(f){let{type:S,disabled:P,closeOnSelect:V}=f,A=T(f),x=O(f);return g(g({},b(A)),t.element(y(g({"data-type":S},Be.item.attrs),{dir:a("dir"),"data-value":A.value,role:`menuitem${S}`,"aria-checked":!!x.checked,"data-state":x.checked?"checked":"unchecked",onClick(k){if(P||rr(k)||Fn(k))return;let N=k.currentTarget;i({type:"ITEM_CLICK",target:N,option:A,closeOnSelect:V})}})))},getItemIndicatorProps(f){let S=O(lo(f)),P=S.checked?"checked":"unchecked";return t.element(y(g({},Be.itemIndicator.attrs),{dir:a("dir"),"data-disabled":E(S.disabled),"data-highlighted":E(S.highlighted),"data-state":$e(f,"checked")?P:void 0,hidden:$e(f,"checked")?!S.checked:void 0}))},getItemTextProps(f){let S=O(lo(f)),P=S.checked?"checked":"unchecked";return t.element(y(g({},Be.itemText.attrs),{dir:a("dir"),"data-disabled":E(S.disabled),"data-highlighted":E(S.highlighted),"data-state":$e(f,"checked")?P:void 0}))},getItemGroupLabelProps(f){return t.element(y(g({},Be.itemGroupLabel.attrs),{id:Mg(o,f.htmlFor),dir:a("dir")}))},getItemGroupProps(f){return t.element(y(g({id:JS(o,f.id)},Be.itemGroup.attrs),{dir:a("dir"),"aria-labelledby":Mg(o,f.id),role:"group"}))}}}function Hg(e){let t=e.parent;for(;t&&t.context.get("isSubmenu");)t=t.refs.get("parent");t==null||t.send({type:"CLOSE"})}function cT(e,t){return e?fo(e,t):!1}function uT(e,t,n){let i=Object.keys(e).length>0;if(!t)return null;if(!i)return Rr(n,t);for(let r in e){let s=e[r],a=va(s.scope);if(a===t)return a}return Rr(n,t)}var XS,Be,va,_g,Gi,ZS,Gg,JS,Rr,ei,Mg,cn,Fg,fa,QS,wl,Dr,eT,tT,xl,nT,iT,rT,ma,$g,Vl,pt,_i,oT,lT,dT,cA,hT,uA,gT,dA,pT,hA,fT,gA,Bg,mT,qg=re(()=>{"use strict";Cs();Pr();Wn();tn();se();XS=U("menu").parts("arrow","arrowTip","content","contextTrigger","indicator","item","itemGroup","itemGroupLabel","itemIndicator","itemText","positioner","separator","trigger","triggerItem"),Be=XS.build(),va=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`menu:${e.id}:trigger`},_g=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.contextTrigger)!=null?n:`menu:${e.id}:ctx-trigger`},Gi=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`menu:${e.id}:content`},ZS=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.arrow)!=null?n:`menu:${e.id}:arrow`},Gg=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`menu:${e.id}:popper`},JS=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.group)==null?void 0:i.call(n,t))!=null?r:`menu:${e.id}:group:${t}`},Rr=(e,t)=>`${e.id}/${t}`,ei=e=>{var t;return(t=e==null?void 0:e.dataset.value)!=null?t:null},Mg=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.groupLabel)==null?void 0:i.call(n,t))!=null?r:`menu:${e.id}:group-label:${t}`},cn=e=>e.getById(Gi(e)),Fg=e=>e.getById(Gg(e)),fa=e=>e.getById(va(e)),QS=(e,t)=>t?e.getById(Rr(e,t)):null,wl=e=>e.getById(_g(e)),Dr=e=>{let n=`[role^="menuitem"][data-ownedby=${CSS.escape(Gi(e))}]:not([data-disabled])`;return Fe(cn(e),n)},eT=e=>lt(Dr(e)),tT=e=>mt(Dr(e)),xl=(e,t)=>t?e.id===t||e.dataset.value===t:!1,nT=(e,t)=>{var r;let n=Dr(e),i=n.findIndex(s=>xl(s,t.value));return _c(n,i,{loop:(r=t.loop)!=null?r:t.loopFocus})},iT=(e,t)=>{var r;let n=Dr(e),i=n.findIndex(s=>xl(s,t.value));return Gc(n,i,{loop:(r=t.loop)!=null?r:t.loopFocus})},rT=(e,t)=>{var r;let n=Dr(e),i=n.find(s=>xl(s,t.value));return Ue(n,{state:t.typeaheadState,key:t.key,activeId:(r=i==null?void 0:i.id)!=null?r:null})},ma=e=>le(e)&&(e.dataset.disabled===""||e.hasAttribute("disabled")),$g=e=>{var t;return!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))&&!!(e!=null&&e.hasAttribute("data-controls"))},Vl="menu:select";({not:pt,and:_i,or:oT}=Ee()),lT={props({props:e}){return y(g({closeOnSelect:!0,typeahead:!0,composite:!0,loopFocus:!1,navigate(t){mi(t.node)}},e),{positioning:g({placement:"bottom-start",gutter:8},e.positioning)})},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},context({bindable:e,prop:t}){return{suspendPointer:e(()=>({defaultValue:!1})),highlightedValue:e(()=>({defaultValue:t("defaultHighlightedValue")||null,value:t("highlightedValue"),onChange(n){var i;(i=t("onHighlightChange"))==null||i({highlightedValue:n})}})),lastHighlightedValue:e(()=>({defaultValue:null})),currentPlacement:e(()=>({defaultValue:void 0})),intentPolygon:e(()=>({defaultValue:null})),anchorPoint:e(()=>({defaultValue:null,hash(n){return`x: ${n==null?void 0:n.x}, y: ${n==null?void 0:n.y}`}})),isSubmenu:e(()=>({defaultValue:!1}))}},refs(){return{parent:null,children:{},typeaheadState:g({},Ue.defaultOptions),positioningOverride:{}}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",isTypingAhead:({refs:e})=>e.get("typeaheadState").keysSoFar!=="",highlightedId:({context:e,scope:t,refs:n})=>uT(n.get("children"),e.get("highlightedValue"),t)},watch({track:e,action:t,context:n,prop:i}){e([()=>n.get("isSubmenu")],()=>{t(["setSubmenuPlacement"])}),e([()=>n.hash("anchorPoint")],()=>{n.get("anchorPoint")&&t(["reposition"])}),e([()=>i("open")],()=>{t(["toggleVisibility"])})},on:{"PARENT.SET":{actions:["setParentMenu"]},"CHILD.SET":{actions:["setChildMenu"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],OPEN_AUTOFOCUS:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightFirstItem","invokeOnOpen"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"HIGHLIGHTED.RESTORE":{actions:["restoreHighlightedItem"]},"HIGHLIGHTED.SET":{actions:["setHighlightedItem"]}},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TRIGGER_FOCUS:{guard:pt("isSubmenu"),target:"closed"},TRIGGER_POINTERMOVE:{guard:"isSubmenu",target:"opening"}}},"opening:contextmenu":{tags:["closed"],effects:["waitForLongPress"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},CONTEXT_MENU_CANCEL:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"LONG_PRESS.OPEN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}},opening:{tags:["closed"],effects:["waitForOpenDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},BLUR:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TRIGGER_POINTERLEAVE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"DELAY.OPEN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}},closing:{tags:["open"],effects:["trackPointerMove","trackInteractOutside","waitForCloseDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]},MENU_POINTERENTER:{target:"open",actions:["clearIntentPolygon"]},POINTER_MOVED_AWAY_FROM_SUBMENU:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]}],"DELAY.CLOSE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem","invokeOnClose"]}]}},closed:{tags:["closed"],entry:["clearHighlightedItem","focusTrigger","resumePointer","clearAnchorPoint"],on:{"CONTROLLED.OPEN":[{guard:oT("isOpenAutoFocusEvent","isArrowDownEvent"),target:"open",actions:["highlightFirstItem"]},{guard:"isArrowUpEvent",target:"open",actions:["highlightLastItem"]},{target:"open"}],CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",target:"opening"},TRIGGER_BLUR:{target:"idle"},ARROW_DOWN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightFirstItem","invokeOnOpen"]}],ARROW_UP:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightLastItem","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackInteractOutside","trackPositioning","scrollToHighlightedItem"],entry:["focusMenu","resumePointer"],on:{"CONTROLLED.CLOSE":[{target:"closed",guard:"isArrowLeftEvent",actions:["focusParentMenu"]},{target:"closed"}],TRIGGER_CLICK:[{guard:_i(pt("isTriggerItem"),"isOpenControlled"),actions:["invokeOnClose"]},{guard:pt("isTriggerItem"),target:"closed",actions:["invokeOnClose"]}],CONTEXT_MENU:{actions:["setAnchorPoint","focusMenu"]},ARROW_UP:{actions:["highlightPrevItem","focusMenu"]},ARROW_DOWN:{actions:["highlightNextItem","focusMenu"]},ARROW_LEFT:[{guard:_i("isSubmenu","isOpenControlled"),actions:["invokeOnClose"]},{guard:"isSubmenu",target:"closed",actions:["focusParentMenu","invokeOnClose"]}],HOME:{actions:["highlightFirstItem","focusMenu"]},END:{actions:["highlightLastItem","focusMenu"]},ARROW_RIGHT:{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},ENTER:[{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},{actions:["clickHighlightedItem"]}],ITEM_POINTERMOVE:[{guard:pt("isPointerSuspended"),actions:["setHighlightedItem","focusMenu","closeSiblingMenus"]},{actions:["setLastHighlightedItem","closeSiblingMenus"]}],ITEM_POINTERLEAVE:{guard:_i(pt("isPointerSuspended"),pt("isTriggerItem")),actions:["clearHighlightedItem"]},ITEM_CLICK:[{guard:_i(pt("isTriggerItemHighlighted"),pt("isHighlightedItemEditable"),"closeOnSelect","isOpenControlled"),actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose"]},{guard:_i(pt("isTriggerItemHighlighted"),pt("isHighlightedItemEditable"),"closeOnSelect"),target:"closed",actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose"]},{guard:_i(pt("isTriggerItemHighlighted"),pt("isHighlightedItemEditable")),actions:["invokeOnSelect","setOptionState"]},{actions:["setHighlightedItem"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",actions:["setIntentPolygon"]},TRIGGER_POINTERLEAVE:{target:"closing",actions:["setIntentPolygon"]},ITEM_POINTERDOWN:{actions:["setHighlightedItem"]},TYPEAHEAD:{actions:["highlightMatchedItem"]},FOCUS_MENU:{actions:["focusMenu"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{closeOnSelect:({prop:e,event:t})=>{var n;return!!((n=t==null?void 0:t.closeOnSelect)!=null?n:e("closeOnSelect"))},isTriggerItem:({event:e})=>$g(e.target),isTriggerItemHighlighted:({event:e,scope:t,computed:n})=>{var r;let i=(r=e.target)!=null?r:t.getById(n("highlightedId"));return!!(i!=null&&i.hasAttribute("data-controls"))},isSubmenu:({context:e})=>e.get("isSubmenu"),isPointerSuspended:({context:e})=>e.get("suspendPointer"),isHighlightedItemEditable:({scope:e,computed:t})=>Ot(e.getById(t("highlightedId"))),isOpenControlled:({prop:e})=>e("open")!==void 0,isArrowLeftEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_LEFT"},isArrowUpEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_UP"},isArrowDownEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="ARROW_DOWN"},isOpenAutoFocusEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="OPEN_AUTOFOCUS"}},effects:{waitForOpenDelay({send:e}){let t=setTimeout(()=>{e({type:"DELAY.OPEN"})},200);return()=>clearTimeout(t)},waitForCloseDelay({send:e}){let t=setTimeout(()=>{e({type:"DELAY.CLOSE"})},100);return()=>clearTimeout(t)},waitForLongPress({send:e}){let t=setTimeout(()=>{e({type:"LONG_PRESS.OPEN"})},700);return()=>clearTimeout(t)},trackPositioning({context:e,prop:t,scope:n,refs:i}){if(wl(n))return;let r=g(g({},t("positioning")),i.get("positioningOverride"));e.set("currentPlacement",r.placement);let s=()=>Fg(n);return It(fa(n),s,y(g({},r),{defer:!0,onComplete(a){e.set("currentPlacement",a.placement)}}))},trackInteractOutside({refs:e,scope:t,prop:n,context:i,send:r}){let s=()=>cn(t),a=!0;return Ft(s,{type:"menu",defer:!0,exclude:[fa(t)],onInteractOutside:n("onInteractOutside"),onRequestDismiss:n("onRequestDismiss"),onFocusOutside(o){var u;(u=n("onFocusOutside"))==null||u(o);let l=j(o.detail.originalEvent);if(ce(wl(t),l)){o.preventDefault();return}},onEscapeKeyDown(o){var l;(l=n("onEscapeKeyDown"))==null||l(o),i.get("isSubmenu")&&o.preventDefault(),Hg({parent:e.get("parent")})},onPointerDownOutside(o){var u;(u=n("onPointerDownOutside"))==null||u(o);let l=j(o.detail.originalEvent);if(ce(wl(t),l)&&o.detail.contextmenu){o.preventDefault();return}a=!o.detail.focusable},onDismiss(){r({type:"CLOSE",src:"interact-outside",restoreFocus:a})}})},trackPointerMove({context:e,scope:t,send:n,refs:i,flush:r}){let s=i.get("parent");r(()=>{s.context.set("suspendPointer",!0)});let a=t.getDoc();return ee(a,"pointermove",o=>{cT(e.get("intentPolygon"),{x:o.clientX,y:o.clientY})||(n({type:"POINTER_MOVED_AWAY_FROM_SUBMENU"}),s.context.set("suspendPointer",!1))})},scrollToHighlightedItem({event:e,scope:t,computed:n}){let i=()=>{if(e.current().type.startsWith("ITEM_POINTER"))return;let s=t.getById(n("highlightedId")),a=cn(t);Xt(s,{rootEl:a,block:"nearest"})};return H(()=>i()),ot(()=>cn(t),{defer:!0,attributes:["aria-activedescendant"],callback:i})}},actions:{setAnchorPoint({context:e,event:t}){e.set("anchorPoint",n=>fe(n,t.point)?n:t.point)},setSubmenuPlacement({context:e,computed:t,refs:n}){if(!e.get("isSubmenu"))return;let i=t("isRtl")?"left-start":"right-start";n.set("positioningOverride",{placement:i,gutter:0})},reposition({context:e,scope:t,prop:n,event:i,refs:r}){var c;let s=()=>Fg(t),a=e.get("anchorPoint"),o=a?()=>g({width:0,height:0},a):void 0,l=g(g({},n("positioning")),r.get("positioningOverride"));It(fa(t),s,y(g(y(g({},l),{defer:!0,getAnchorRect:o}),(c=i.options)!=null?c:{}),{listeners:!1,onComplete(u){e.set("currentPlacement",u.placement)}}))},setOptionState({event:e}){if(!e.option)return;let{checked:t,onCheckedChange:n,type:i}=e.option;i==="radio"?n==null||n(!0):i==="checkbox"&&(n==null||n(!t))},clickHighlightedItem({scope:e,computed:t,prop:n,context:i}){var a;let r=e.getById(t("highlightedId"));if(!r||r.dataset.disabled)return;let s=i.get("highlightedValue");st(r)?(a=n("navigate"))==null||a({value:s,node:r,href:r.href}):queueMicrotask(()=>r.click())},setIntentPolygon({context:e,scope:t,event:n}){let i=cn(t),r=e.get("currentPlacement");if(!i||!r)return;let s=i.getBoundingClientRect(),a=Su(s,r);if(!a)return;let l=Md(r)==="right"?-5:5;e.set("intentPolygon",[y(g({},n.point),{x:n.point.x+l}),...a])},clearIntentPolygon({context:e}){e.set("intentPolygon",null)},clearAnchorPoint({context:e}){e.set("anchorPoint",null)},resumePointer({refs:e,flush:t}){let n=e.get("parent");n&&t(()=>{n.context.set("suspendPointer",!1)})},setHighlightedItem({context:e,event:t}){let n=t.value||ei(t.target);e.set("highlightedValue",n)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},focusMenu({scope:e}){H(()=>{let t=cn(e),n=us({root:t,enabled:!ce(t,e.getActiveElement()),filter(i){var r;return!((r=i.role)!=null&&r.startsWith("menuitem"))}});n==null||n.focus({preventScroll:!0})})},highlightFirstItem({context:e,scope:t}){(cn(t)?queueMicrotask:H)(()=>{let i=eT(t);i&&e.set("highlightedValue",ei(i))})},highlightLastItem({context:e,scope:t}){(cn(t)?queueMicrotask:H)(()=>{let i=tT(t);i&&e.set("highlightedValue",ei(i))})},highlightNextItem({context:e,scope:t,event:n,prop:i}){let r=nT(t,{loop:n.loop,value:e.get("highlightedValue"),loopFocus:i("loopFocus")});e.set("highlightedValue",ei(r))},highlightPrevItem({context:e,scope:t,event:n,prop:i}){let r=iT(t,{loop:n.loop,value:e.get("highlightedValue"),loopFocus:i("loopFocus")});e.set("highlightedValue",ei(r))},invokeOnSelect({context:e,prop:t,scope:n}){var s;let i=e.get("highlightedValue");if(i==null)return;let r=QS(n,i);sT(r,i),(s=t("onSelect"))==null||s({value:i})},focusTrigger({scope:e,context:t,event:n}){t.get("isSubmenu")||t.get("anchorPoint")||n.restoreFocus===!1||queueMicrotask(()=>{var i;return(i=fa(e))==null?void 0:i.focus({preventScroll:!0})})},highlightMatchedItem({scope:e,context:t,event:n,refs:i}){let r=rT(e,{key:n.key,value:t.get("highlightedValue"),typeaheadState:i.get("typeaheadState")});r&&t.set("highlightedValue",ei(r))},setParentMenu({refs:e,event:t,context:n}){e.set("parent",t.value),n.set("isSubmenu",!0)},setChildMenu({refs:e,event:t}){let n=e.get("children");n[t.id]=t.value,e.set("children",n)},closeSiblingMenus({refs:e,event:t,scope:n}){var a;let i=t.target;if(!$g(i))return;let r=i==null?void 0:i.getAttribute("data-uid"),s=e.get("children");for(let o in s){if(o===r)continue;let l=s[o],c=l.context.get("intentPolygon");c&&t.point&&fo(c,t.point)||((a=cn(n))==null||a.focus({preventScroll:!0}),l.send({type:"CLOSE"}))}},closeRootMenu({refs:e}){Hg({parent:e.get("parent")})},openSubmenu({refs:e,scope:t,computed:n}){let i=t.getById(n("highlightedId")),r=i==null?void 0:i.getAttribute("data-uid"),s=e.get("children"),a=r?s[r]:null;a==null||a.send({type:"OPEN_AUTOFOCUS"})},focusParentMenu({refs:e}){var t;(t=e.get("parent"))==null||t.send({type:"FOCUS_MENU"})},setLastHighlightedItem({context:e,event:t}){e.set("lastHighlightedValue",ei(t.target))},restoreHighlightedItem({context:e}){e.get("lastHighlightedValue")&&(e.set("highlightedValue",e.get("lastHighlightedValue")),e.set("lastHighlightedValue",null))},restoreParentHighlightedItem({refs:e}){var t;(t=e.get("parent"))==null||t.send({type:"HIGHLIGHTED.RESTORE"})},invokeOnOpen({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!0})},invokeOnClose({prop:e}){var t;(t=e("onOpenChange"))==null||t({open:!1})},toggleVisibility({prop:e,event:t,send:n}){n({type:e("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:t})}}}};dT=_()(["anchorPoint","aria-label","closeOnSelect","composite","defaultHighlightedValue","defaultOpen","dir","getRootNode","highlightedValue","id","ids","loopFocus","navigate","onEscapeKeyDown","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onRequestDismiss","onSelect","open","positioning","typeahead"]),cA=B(dT),hT=_()(["closeOnSelect","disabled","value","valueText"]),uA=B(hT),gT=_()(["htmlFor"]),dA=B(gT),pT=_()(["id"]),hA=B(pT),fT=_()(["checked","closeOnSelect","disabled","onCheckedChange","type","value","valueText"]),gA=B(fT),Bg=class extends K{constructor(){super(...arguments);z(this,"children",[])}initMachine(t){return new W(lT,t)}initApi(){return aT(this.machine.service,q)}setChild(t){this.api.setChild(t.machine.service),this.children.includes(t)||this.children.push(t)}setParent(t){this.api.setParent(t.machine.service)}isOwnElement(t){return t.closest('[phx-hook="Menu"]')===this.el}renderSubmenuTriggers(){let t=this.el.querySelector('[data-scope="menu"][data-part="content"]');if(!t)return;let n=t.querySelectorAll('[data-scope="menu"][data-nested-menu]');for(let i of n){if(!this.isOwnElement(i))continue;let r=i.dataset.nestedMenu;if(!r)continue;let s=this.children.find(o=>o.el.id===`menu:${r}`);if(!s)continue;let a=()=>{let o=this.api.getTriggerItemProps(s.api);this.spreadProps(i,o)};a(),this.machine.subscribe(a),s.machine.subscribe(a)}}render(){let t=this.el.querySelector('[data-scope="menu"][data-part="trigger"]');t&&this.spreadProps(t,this.api.getTriggerProps());let n=this.el.querySelector('[data-scope="menu"][data-part="positioner"]'),i=this.el.querySelector('[data-scope="menu"][data-part="content"]');if(n&&i){this.spreadProps(n,this.api.getPositionerProps()),this.spreadProps(i,this.api.getContentProps()),i.style.pointerEvents="auto",n.hidden=!this.api.open;let s=!this.el.querySelector('[data-scope="menu"][data-part="trigger"]');(this.api.open||s)&&(i.querySelectorAll('[data-scope="menu"][data-part="item"]').forEach(u=>{if(!this.isOwnElement(u))return;let h=u.dataset.value;if(h){let m=u.hasAttribute("data-disabled");this.spreadProps(u,this.api.getItemProps({value:h,disabled:m||void 0}))}}),i.querySelectorAll('[data-scope="menu"][data-part="item-group"]').forEach(u=>{if(!this.isOwnElement(u))return;let h=u.id;h&&this.spreadProps(u,this.api.getItemGroupProps({id:h}))}),i.querySelectorAll('[data-scope="menu"][data-part="separator"]').forEach(u=>{this.isOwnElement(u)&&this.spreadProps(u,this.api.getSeparatorProps())}))}let r=this.el.querySelector('[data-scope="menu"][data-part="indicator"]');r&&this.spreadProps(r,this.api.getIndicatorProps())}},mT={mounted(){let e=this.el;if(e.hasAttribute("data-nested"))return;let t=this.pushEvent.bind(this),n=()=>{var a;return(a=this.liveSocket)==null?void 0:a.main},i=new Bg(e,y(g({id:e.id.replace("menu:","")},C(e,"controlled")?{open:C(e,"open")}:{defaultOpen:C(e,"defaultOpen")}),{closeOnSelect:C(e,"closeOnSelect"),loopFocus:C(e,"loopFocus"),typeahead:C(e,"typeahead"),composite:C(e,"composite"),dir:w(e,"dir",["ltr","rtl"]),onSelect:a=>{var v,I,T;let o=C(e,"redirect"),l=[...e.querySelectorAll('[data-scope="menu"][data-part="item"]')].find(O=>O.getAttribute("data-value")===a.value),c=l==null?void 0:l.getAttribute("data-redirect"),u=l==null?void 0:l.hasAttribute("data-new-tab"),h=n();o&&a.value&&((v=h==null?void 0:h.isDead)!=null?v:!0)&&c!=="false"&&(u?window.open(a.value,"_blank","noopener,noreferrer"):window.location.href=a.value);let d=w(e,"onSelect");d&&h&&!h.isDead&&h.isConnected()&&t(d,{id:e.id,value:(I=a.value)!=null?I:null});let p=w(e,"onSelectClient");p&&e.dispatchEvent(new CustomEvent(p,{bubbles:!0,detail:{id:e.id,value:(T=a.value)!=null?T:null}}))},onOpenChange:a=>{var u,h;let o=n(),l=w(e,"onOpenChange");l&&o&&!o.isDead&&o.isConnected()&&t(l,{id:e.id,open:(u=a.open)!=null?u:!1});let c=w(e,"onOpenChangeClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:{id:e.id,open:(h=a.open)!=null?h:!1}}))}}));i.init(),this.menu=i,this.nestedMenus=new Map;let r=e.querySelectorAll('[data-scope="menu"][data-nested="menu"]'),s=[];r.forEach((a,o)=>{var c;let l=a.id;if(l){let u=`${l}-${o}`,h=new Bg(a,{id:u,dir:w(a,"dir",["ltr","rtl"]),closeOnSelect:C(a,"closeOnSelect"),loopFocus:C(a,"loopFocus"),typeahead:C(a,"typeahead"),composite:C(a,"composite"),onSelect:m=>{var S,P,V;let d=C(e,"redirect"),p=[...e.querySelectorAll('[data-scope="menu"][data-part="item"]')].find(A=>A.getAttribute("data-value")===m.value),v=p==null?void 0:p.getAttribute("data-redirect"),I=p==null?void 0:p.hasAttribute("data-new-tab"),T=n();d&&m.value&&((S=T==null?void 0:T.isDead)!=null?S:!0)&&v!=="false"&&(I?window.open(m.value,"_blank","noopener,noreferrer"):window.location.href=m.value);let b=w(e,"onSelect");b&&T&&!T.isDead&&T.isConnected()&&t(b,{id:e.id,value:(P=m.value)!=null?P:null});let f=w(e,"onSelectClient");f&&e.dispatchEvent(new CustomEvent(f,{bubbles:!0,detail:{id:e.id,value:(V=m.value)!=null?V:null}}))}});h.init(),(c=this.nestedMenus)==null||c.set(l,h),s.push(h)}}),setTimeout(()=>{s.forEach(a=>{this.menu&&(this.menu.setChild(a),a.setParent(this.menu))}),this.menu&&this.menu.children.length>0&&this.menu.renderSubmenuTriggers()},0),this.onSetOpen=a=>{let{open:o}=a.detail;i.api.open!==o&&i.api.setOpen(o)},e.addEventListener("phx:menu:set-open",this.onSetOpen),this.handlers=[],this.handlers.push(this.handleEvent("menu_set_open",a=>{let o=a.menu_id;(!o||e.id===o||e.id===`menu:${o}`)&&i.api.setOpen(a.open)})),this.handlers.push(this.handleEvent("menu_open",()=>{this.pushEvent("menu_open_response",{open:i.api.open})}))},updated(){var e;this.el.hasAttribute("data-nested")||(e=this.menu)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{open:C(this.el,"open")}:{defaultOpen:C(this.el,"defaultOpen")}),{closeOnSelect:C(this.el,"closeOnSelect"),loopFocus:C(this.el,"loopFocus"),typeahead:C(this.el,"typeahead"),composite:C(this.el,"composite"),dir:w(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(!this.el.hasAttribute("data-nested")){if(this.onSetOpen&&this.el.removeEventListener("phx:menu:set-open",this.onSetOpen),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);if(this.nestedMenus)for(let[,t]of this.nestedMenus)t.destroy();(e=this.menu)==null||e.destroy()}}}});var rp={};he(rp,{NumberInput:()=>zT});function yT(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes("-nu-")&&(e.includes("-u-")||(e+="-u-"),e+=`-nu-${n}`),t.style==="unit"&&!ya){var i;let{unit:a,unitDisplay:o="short"}=t;if(!a)throw new Error('unit option must be provided with style: "unit"');if(!(!((i=Jg[a])===null||i===void 0)&&i[o]))throw new Error(`Unsupported unit ${a} with unitDisplay = ${o}`);t=y(g({},t),{style:"decimal"})}let r=e+(t?Object.entries(t).sort((a,o)=>a[0]0||Object.is(n,0):t==="exceptZero"&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):i=n>0),i){let r=e.format(-n),s=e.format(n),a=r.replace(s,"").replace(/\u200e|\u061C/,"");return[...a].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),r.replace(s,"!!!").replace(a,"+").replace("!!!",s)}else return e.format(n)}}function kl(e,t,n){let i=Kg(e,t);if(!e.includes("-nu-")&&!i.isValidPartialNumber(n)){for(let r of IT)if(r!==i.options.numberingSystem){let s=Kg(e+(e.includes("-u-")?"-nu-":"-u-nu-")+r,t);if(s.isValidPartialNumber(n))return s}}return i}function Kg(e,t){let n=e+(t?Object.entries(t).sort((r,s)=>r[0]l.formatToParts(k));var m;let d=(m=(r=c.find(k=>k.type==="minusSign"))===null||r===void 0?void 0:r.value)!==null&&m!==void 0?m:"-",p=(s=u.find(k=>k.type==="plusSign"))===null||s===void 0?void 0:s.value;!p&&((i==null?void 0:i.signDisplay)==="exceptZero"||(i==null?void 0:i.signDisplay)==="always")&&(p="+");let I=(a=new Intl.NumberFormat(e,y(g({},n),{minimumFractionDigits:2,maximumFractionDigits:2})).formatToParts(.001).find(k=>k.type==="decimal"))===null||a===void 0?void 0:a.value,T=(o=c.find(k=>k.type==="group"))===null||o===void 0?void 0:o.value,O=c.filter(k=>!zg.has(k.type)).map(k=>Yg(k.value)),b=h.flatMap(k=>k.filter(N=>!zg.has(N.type)).map(N=>Yg(N.value))),f=[...new Set([...O,...b])].sort((k,N)=>N.length-k.length),S=f.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${f.join("|")}|[\\p{White_Space}]`,"gu"),P=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),V=new Map(P.map((k,N)=>[k,N])),A=new RegExp(`[${P.join("")}]`,"g");return{minusSign:d,plusSign:p,decimal:I,group:T,literals:S,numeral:A,index:k=>String(V.get(k))}}function Ui(e,t,n){return e.replaceAll?e.replaceAll(t,n):e.split(t).join(n)}function Yg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Dl(e,t){if(!(!e||!t.isActiveElement(e)))try{let{selectionStart:n,selectionEnd:i,value:r}=e;return n==null||i==null?void 0:{start:n,end:i,value:r}}catch(n){return}}function OT(e,t,n){if(!(!e||!n.isActiveElement(e))){if(!t){let i=e.value.length;e.setSelectionRange(i,i);return}try{let i=e.value,{start:r,end:s,value:a}=t;if(i===a){e.setSelectionRange(r,s);return}let o=jg(a,i,r),l=r===s?o:jg(a,i,s),c=Math.max(0,Math.min(o,i.length)),u=Math.max(c,Math.min(l,i.length));e.setSelectionRange(c,u)}catch(i){let r=e.value.length;e.setSelectionRange(r,r)}}}function jg(e,t,n){let i=e.slice(0,n),r=e.slice(n),s=0,a=Math.min(i.length,t.length);for(let c=0;c0&&s>=i.length)return s;if(o>=r.length)return t.length-o;if(s>0)return s;if(o>0)return t.length-o;if(n===0&&s===0&&o===0)return t.length;if(e.length>0){let c=n/e.length;return Math.round(c*t.length)}return t.length}function FT(e,t){let{state:n,send:i,prop:r,scope:s,computed:a}=e,o=n.hasTag("focus"),l=a("isDisabled"),c=!!r("readOnly"),u=!!r("required"),h=n.matches("scrubbing"),m=a("isValueEmpty"),d=a("isOutOfRange")||!!r("invalid"),p=l||!a("canIncrement")||c,v=l||!a("canDecrement")||c,I=r("translations");return{focused:o,invalid:d,empty:m,value:a("formattedValue"),valueAsNumber:a("valueAsNumber"),setValue(T){i({type:"VALUE.SET",value:T})},clearValue(){i({type:"VALUE.CLEAR"})},increment(){i({type:"VALUE.INCREMENT"})},decrement(){i({type:"VALUE.DECREMENT"})},setToMax(){i({type:"VALUE.SET",value:r("max")})},setToMin(){i({type:"VALUE.SET",value:r("min")})},focus(){var T;(T=ni(s))==null||T.focus()},getRootProps(){return t.element(y(g({id:wT(s)},Vn.root.attrs),{dir:r("dir"),"data-disabled":E(l),"data-focus":E(o),"data-invalid":E(d),"data-scrubbing":E(h)}))},getLabelProps(){return t.label(y(g({},Vn.label.attrs),{dir:r("dir"),"data-disabled":E(l),"data-focus":E(o),"data-invalid":E(d),"data-required":E(u),"data-scrubbing":E(h),id:xT(s),htmlFor:Lr(s),onClick(){H(()=>{tr(ni(s))})}}))},getControlProps(){return t.element(y(g({},Vn.control.attrs),{dir:r("dir"),role:"group","aria-disabled":l,"data-focus":E(o),"data-disabled":E(l),"data-invalid":E(d),"data-scrubbing":E(h),"aria-invalid":X(d)}))},getValueTextProps(){return t.element(y(g({},Vn.valueText.attrs),{dir:r("dir"),"data-disabled":E(l),"data-invalid":E(d),"data-focus":E(o),"data-scrubbing":E(h)}))},getInputProps(){return t.input(y(g({},Vn.input.attrs),{dir:r("dir"),name:r("name"),form:r("form"),id:Lr(s),role:"spinbutton",defaultValue:a("formattedValue"),pattern:r("formatOptions")?void 0:r("pattern"),inputMode:r("inputMode"),"aria-invalid":X(d),"data-invalid":E(d),disabled:l,"data-disabled":E(l),readOnly:c,required:r("required"),autoComplete:"off",autoCorrect:"off",spellCheck:"false",type:"text","aria-roledescription":"numberfield","aria-valuemin":r("min"),"aria-valuemax":r("max"),"aria-valuenow":Number.isNaN(a("valueAsNumber"))?void 0:a("valueAsNumber"),"aria-valuetext":a("valueText"),"data-scrubbing":E(h),onFocus(){i({type:"INPUT.FOCUS"})},onBlur(){i({type:"INPUT.BLUR"})},onInput(T){let O=Dl(T.currentTarget,s);i({type:"INPUT.CHANGE",target:T.currentTarget,hint:"set",selection:O})},onBeforeInput(T){var O;try{let{selectionStart:b,selectionEnd:f,value:S}=T.currentTarget,P=S.slice(0,b)+((O=T.data)!=null?O:"")+S.slice(f);a("parser").isValidPartialNumber(P)||T.preventDefault()}catch(b){}},onKeyDown(T){if(T.defaultPrevented||c||Re(T))return;let O=gi(T)*r("step"),f={ArrowUp(){i({type:"INPUT.ARROW_UP",step:O}),T.preventDefault()},ArrowDown(){i({type:"INPUT.ARROW_DOWN",step:O}),T.preventDefault()},Home(){xe(T)||(i({type:"INPUT.HOME"}),T.preventDefault())},End(){xe(T)||(i({type:"INPUT.END"}),T.preventDefault())},Enter(S){let P=Dl(S.currentTarget,s);i({type:"INPUT.ENTER",selection:P})}}[T.key];f==null||f(T)}}))},getDecrementTriggerProps(){return t.button(y(g({},Vn.decrementTrigger.attrs),{dir:r("dir"),id:tp(s),disabled:v,"data-disabled":E(v),"aria-label":I.decrementLabel,type:"button",tabIndex:-1,"aria-controls":Lr(s),"data-scrubbing":E(h),onPointerDown(T){var O;v||pe(T)&&(i({type:"TRIGGER.PRESS_DOWN",hint:"decrement",pointerType:T.pointerType}),T.pointerType==="mouse"&&T.preventDefault(),T.pointerType==="touch"&&((O=T.currentTarget)==null||O.focus({preventScroll:!0})))},onPointerUp(T){i({type:"TRIGGER.PRESS_UP",hint:"decrement",pointerType:T.pointerType})},onPointerLeave(){v||i({type:"TRIGGER.PRESS_UP",hint:"decrement"})}}))},getIncrementTriggerProps(){return t.button(y(g({},Vn.incrementTrigger.attrs),{dir:r("dir"),id:ep(s),disabled:p,"data-disabled":E(p),"aria-label":I.incrementLabel,type:"button",tabIndex:-1,"aria-controls":Lr(s),"data-scrubbing":E(h),onPointerDown(T){var O;p||!pe(T)||(i({type:"TRIGGER.PRESS_DOWN",hint:"increment",pointerType:T.pointerType}),T.pointerType==="mouse"&&T.preventDefault(),T.pointerType==="touch"&&((O=T.currentTarget)==null||O.focus({preventScroll:!0})))},onPointerUp(T){i({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:T.pointerType})},onPointerLeave(T){i({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:T.pointerType})}}))},getScrubberProps(){return t.element(y(g({},Vn.scrubber.attrs),{dir:r("dir"),"data-disabled":E(l),id:VT(s),role:"presentation","data-scrubbing":E(h),onMouseDown(T){if(l||!pe(T))return;let O=je(T),f=ue(T.currentTarget).devicePixelRatio;O.x=O.x-Ci(7.5,f),O.y=O.y-Ci(7.5,f),i({type:"SCRUBBER.PRESS_DOWN",point:O}),T.preventDefault(),H(()=>{tr(ni(s))})},style:{cursor:l?void 0:"ew-resize"}}))}}}var Al,Rl,ya,Jg,vT,ET,IT,Qg,Wg,PT,zg,CT,TT,Vn,wT,Lr,ep,tp,VT,np,xT,ni,AT,kT,ip,NT,RT,DT,LT,MT,$T,HT,Nl,ti,BT,_T,GT,UT,Xg,Zg,qT,WT,vA,KT,zT,sp=re(()=>{"use strict";se();Al=new Map,Rl=!1;try{Rl=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch(e){}ya=!1;try{ya=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch(e){}Jg={degree:{narrow:{default:"\xB0","ja-JP":" \u5EA6","zh-TW":"\u5EA6","sl-SI":" \xB0"}}},vT=class{format(e){let t="";if(!Rl&&this.options.signDisplay!=null?t=bT(this.numberFormatter,this.options.signDisplay,e):t=this.numberFormatter.format(e),this.options.style==="unit"&&!ya){var n;let{unit:i,unitDisplay:r="short",locale:s}=this.resolvedOptions();if(!i)return t;let a=(n=Jg[i])===null||n===void 0?void 0:n[r];t+=a[s]||a.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,t);if(t= start date");return`${this.format(e)} \u2013 ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,t);if(t= start date");let n=this.numberFormatter.formatToParts(e),i=this.numberFormatter.formatToParts(t);return[...n.map(r=>y(g({},r),{source:"startRange"})),{type:"literal",value:" \u2013 ",source:"shared"},...i.map(r=>y(g({},r),{source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!Rl&&this.options.signDisplay!=null&&(e=y(g({},e),{signDisplay:this.options.signDisplay})),!ya&&this.options.style==="unit"&&(e=y(g({},e),{style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay})),e}constructor(e,t={}){this.numberFormatter=yT(e,t),this.options=t}};ET=new RegExp("^.*\\(.*\\).*$"),IT=["latn","arab","hanidec","deva","beng","fullwide"],Qg=class{parse(e){return kl(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,n){return kl(this.locale,this.options,e).isValidPartialNumber(e,t,n)}getNumberingSystem(e){return kl(this.locale,this.options,e).options.numberingSystem}constructor(e,t={}){this.locale=e,this.options=t}},Wg=new Map;PT=class{parse(e){let t=this.sanitize(e);if(this.symbols.group&&(t=Ui(t,this.symbols.group,"")),this.symbols.decimal&&(t=t.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(t=t.replace(this.symbols.minusSign,"-")),t=t.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let s=t.indexOf("-");t=t.replace("-",""),t=t.replace("+","");let a=t.indexOf(".");a===-1&&(a=t.length),t=t.replace(".",""),a-2===0?t=`0.${t}`:a-2===-1?t=`0.0${t}`:a-2===-2?t="0.00":t=`${t.slice(0,a-2)}.${t.slice(a-2)}`,s>-1&&(t=`-${t}`)}let n=t?+t:NaN;if(isNaN(n))return NaN;if(this.options.style==="percent"){var i,r;let s=y(g({},this.options),{style:"decimal",minimumFractionDigits:Math.min(((i=this.options.minimumFractionDigits)!==null&&i!==void 0?i:0)+2,20),maximumFractionDigits:Math.min(((r=this.options.maximumFractionDigits)!==null&&r!==void 0?r:0)+2,20)});return new Qg(this.locale,s).parse(new vT(this.locale,s).format(n))}return this.options.currencySign==="accounting"&&ET.test(e)&&(n=-1*n),n}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("\u060C",this.symbols.decimal)),this.symbols.group&&(e=Ui(e,".",this.symbols.group))),this.symbols.group==="\u2019"&&e.includes("'")&&(e=Ui(e,"'",this.symbols.group)),this.options.locale==="fr-FR"&&this.symbols.group&&(e=Ui(e," ",this.symbols.group),e=Ui(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,t=-1/0,n=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&n>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=Ui(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits==null&&(t.minimumFractionDigits=t.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=ST(e,this.formatter,this.options,t);var n,i;this.options.style==="percent"&&(((n=this.options.minimumFractionDigits)!==null&&n!==void 0?n:0)>18||((i=this.options.maximumFractionDigits)!==null&&i!==void 0?i:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}},zg=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),CT=[0,4,2,1,11,20,3,7,100,21,.1,1.1];TT=U("numberInput").parts("root","label","input","control","valueText","incrementTrigger","decrementTrigger","scrubber"),Vn=TT.build();wT=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`number-input:${e.id}`},Lr=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`number-input:${e.id}:input`},ep=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.incrementTrigger)!=null?n:`number-input:${e.id}:inc`},tp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.decrementTrigger)!=null?n:`number-input:${e.id}:dec`},VT=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.scrubber)!=null?n:`number-input:${e.id}:scrubber`},np=e=>`number-input:${e.id}:cursor`,xT=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`number-input:${e.id}:label`},ni=e=>e.getById(Lr(e)),AT=e=>e.getById(ep(e)),kT=e=>e.getById(tp(e)),ip=e=>e.getDoc().getElementById(np(e)),NT=(e,t)=>{let n=null;return t==="increment"&&(n=AT(e)),t==="decrement"&&(n=kT(e)),n},RT=(e,t)=>{if(!Xe())return MT(e,t),()=>{var n;(n=ip(e))==null||n.remove()}},DT=e=>{let t=e.getDoc(),n=t.documentElement,i=t.body;return i.style.pointerEvents="none",n.style.userSelect="none",n.style.cursor="ew-resize",()=>{i.style.pointerEvents="",n.style.userSelect="",n.style.cursor="",n.style.length||n.removeAttribute("style"),i.style.length||i.removeAttribute("style")}},LT=(e,t)=>{let{point:n,isRtl:i,event:r}=t,s=e.getWin(),a=Ci(r.movementX,s.devicePixelRatio),o=Ci(r.movementY,s.devicePixelRatio),l=a>0?"increment":a<0?"decrement":null;i&&l==="increment"&&(l="decrement"),i&&l==="decrement"&&(l="increment");let c={x:n.x+a,y:n.y+o},u=s.innerWidth,h=Ci(7.5,s.devicePixelRatio);return c.x=Zc(c.x+h,u)-h,{hint:l,point:c}},MT=(e,t)=>{let n=e.getDoc(),i=n.createElement("div");i.className="scrubber--cursor",i.id=np(e),Object.assign(i.style,{width:"15px",height:"15px",position:"fixed",pointerEvents:"none",left:"0px",top:"0px",zIndex:ss,transform:t?`translate3d(${t.x}px, ${t.y}px, 0px)`:void 0,willChange:"transform"}),i.innerHTML=` - `,n.body.appendChild(i)};$T=(e,t={})=>new Intl.NumberFormat(e,t),HT=(e,t={})=>new Qg(e,t),Nl=(e,t)=>{let{prop:n,computed:i}=t;return n("formatOptions")?e===""?Number.NaN:i("parser").parse(e):parseFloat(e)},ti=(e,t)=>{let{prop:n,computed:i}=t;return Number.isNaN(e)?"":n("formatOptions")?i("formatter").format(e):e.toString()},BT=(e,t)=>{let n=e!==void 0&&!Number.isNaN(e)?e:1;return(t==null?void 0:t.style)==="percent"&&(e===void 0||Number.isNaN(e))&&(n=.01),n},{choose:_T,guards:GT,createMachine:UT}=ut(),{not:Xg,and:Zg}=GT,qT=UT({props({props:e}){let t=BT(e.step,e.formatOptions);return y(g({dir:"ltr",locale:"en-US",focusInputOnChange:!0,clampValueOnBlur:!e.allowOverflow,allowOverflow:!1,inputMode:"decimal",pattern:"-?[0-9]*(.[0-9]+)?",defaultValue:"",step:t,min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,spinOnPress:!0},e),{translations:g({incrementLabel:"increment value",decrementLabel:"decrease value"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getComputed:n}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(i){var a;let r=n(),s=Nl(i,{computed:r,prop:e});(a=e("onValueChange"))==null||a({value:i,valueAsNumber:s})}})),hint:t(()=>({defaultValue:null})),scrubberCursorPoint:t(()=>({defaultValue:null,hash(i){return i?`x:${i.x}, y:${i.y}`:""}})),fieldsetDisabled:t(()=>({defaultValue:!1}))}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",valueAsNumber:({context:e,computed:t,prop:n})=>Nl(e.get("value"),{computed:t,prop:n}),formattedValue:({computed:e,prop:t})=>ti(e("valueAsNumber"),{computed:e,prop:t}),isAtMin:({computed:e,prop:t})=>Qc(e("valueAsNumber"),t("min")),isAtMax:({computed:e,prop:t})=>Jc(e("valueAsNumber"),t("max")),isOutOfRange:({computed:e,prop:t})=>!Pi(e("valueAsNumber"),t("min"),t("max")),isValueEmpty:({context:e})=>e.get("value")==="",isDisabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled"),canIncrement:({prop:e,computed:t})=>e("allowOverflow")||!t("isAtMax"),canDecrement:({prop:e,computed:t})=>e("allowOverflow")||!t("isAtMin"),valueText:({prop:e,context:t})=>{var n,i;return(i=(n=e("translations")).valueText)==null?void 0:i.call(n,t.get("value"))},formatter:Bn(({prop:e})=>[e("locale"),e("formatOptions")],([e,t])=>$T(e,t)),parser:Bn(({prop:e})=>[e("locale"),e("formatOptions")],([e,t])=>HT(e,t))},watch({track:e,action:t,context:n,computed:i,prop:r}){e([()=>n.get("value"),()=>r("locale"),()=>JSON.stringify(r("formatOptions"))],()=>{t(["syncInputElement"])}),e([()=>i("isOutOfRange")],()=>{t(["invokeOnInvalid"])}),e([()=>n.hash("scrubberCursorPoint")],()=>{t(["setVirtualCursorPosition"])})},effects:["trackFormControl"],on:{"VALUE.SET":{actions:["setRawValue"]},"VALUE.CLEAR":{actions:["clearValue"]},"VALUE.INCREMENT":{actions:["increment"]},"VALUE.DECREMENT":{actions:["decrement"]}},states:{idle:{on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","invokeOnFocus","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","invokeOnFocus","setHint","setCursorPoint"]},"INPUT.FOCUS":{target:"focused",actions:["focusInput","invokeOnFocus"]}}},focused:{tags:["focus"],effects:["attachWheelListener"],on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","setHint","setCursorPoint"]},"INPUT.ARROW_UP":{actions:["increment"]},"INPUT.ARROW_DOWN":{actions:["decrement"]},"INPUT.HOME":{actions:["decrementToMin"]},"INPUT.END":{actions:["incrementToMax"]},"INPUT.CHANGE":{actions:["setValue","setHint"]},"INPUT.BLUR":[{guard:Zg("clampValueOnBlur",Xg("isInRange")),target:"idle",actions:["setClampedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]},{guard:Xg("isInRange"),target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnInvalid","invokeOnValueCommit"]},{target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]}],"INPUT.ENTER":{actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]}}},"before:spin":{tags:["focus"],effects:["trackButtonDisabled","waitForChangeDelay"],entry:_T([{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}]),on:{CHANGE_DELAY:{target:"spinning",guard:Zg("isInRange","spinOnPress")},"TRIGGER.PRESS_UP":[{guard:"isTouchPointer",target:"focused",actions:["clearHint"]},{target:"focused",actions:["focusInput","clearHint"]}]}},spinning:{tags:["focus"],effects:["trackButtonDisabled","spinValue"],on:{SPIN:[{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}],"TRIGGER.PRESS_UP":{target:"focused",actions:["focusInput","clearHint"]}}},scrubbing:{tags:["focus"],effects:["activatePointerLock","trackMousemove","setupVirtualCursor","preventTextSelection"],on:{"SCRUBBER.POINTER_UP":{target:"focused",actions:["focusInput","clearCursorPoint"]},"SCRUBBER.POINTER_MOVE":[{guard:"isIncrementHint",actions:["increment","setCursorPoint"]},{guard:"isDecrementHint",actions:["decrement","setCursorPoint"]}]}}},implementations:{guards:{clampValueOnBlur:({prop:e})=>e("clampValueOnBlur"),spinOnPress:({prop:e})=>!!e("spinOnPress"),isInRange:({computed:e})=>!e("isOutOfRange"),isDecrementHint:({context:e,event:t})=>{var n;return((n=t.hint)!=null?n:e.get("hint"))==="decrement"},isIncrementHint:({context:e,event:t})=>{var n;return((n=t.hint)!=null?n:e.get("hint"))==="increment"},isTouchPointer:({event:e})=>e.pointerType==="touch"},effects:{waitForChangeDelay({send:e}){let t=setTimeout(()=>{e({type:"CHANGE_DELAY"})},300);return()=>clearTimeout(t)},spinValue({send:e}){let t=setInterval(()=>{e({type:"SPIN"})},50);return()=>clearInterval(t)},trackFormControl({context:e,scope:t}){let n=ni(t);return wt(n,{onFieldsetDisabledChange(i){e.set("fieldsetDisabled",i)},onFormReset(){e.set("value",e.initial("value"))}})},setupVirtualCursor({context:e,scope:t}){let n=e.get("scrubberCursorPoint");return RT(t,n)},preventTextSelection({scope:e}){return DT(e)},trackButtonDisabled({context:e,scope:t,send:n}){let i=e.get("hint"),r=NT(t,i);return ot(r,{attributes:["disabled"],callback(){n({type:"TRIGGER.PRESS_UP",src:"attr"})}})},attachWheelListener({scope:e,send:t,prop:n}){let i=ni(e);if(!i||!e.isActiveElement(i)||!n("allowMouseWheel"))return;function r(s){s.preventDefault();let a=Math.sign(s.deltaY)*-1;a===1?t({type:"VALUE.INCREMENT"}):a===-1&&t({type:"VALUE.DECREMENT"})}return ee(i,"wheel",r,{passive:!1})},activatePointerLock({scope:e}){if(!Xe())return Mc(e.getDoc())},trackMousemove({scope:e,send:t,context:n,computed:i}){let r=e.getDoc();function s(o){let l=n.get("scrubberCursorPoint"),c=i("isRtl"),u=LT(e,{point:l,isRtl:c,event:o});u.hint&&t({type:"SCRUBBER.POINTER_MOVE",hint:u.hint,point:u.point})}function a(){t({type:"SCRUBBER.POINTER_UP"})}return At(ee(r,"mousemove",s,!1),ee(r,"mouseup",a,!1))}},actions:{focusInput({scope:e,prop:t}){if(!t("focusInputOnChange"))return;let n=ni(e);e.isActiveElement(n)||H(()=>n==null?void 0:n.focus({preventScroll:!0}))},increment({context:e,event:t,prop:n,computed:i}){var s;let r=nu(i("valueAsNumber"),(s=t.step)!=null?s:n("step"));n("allowOverflow")||(r=He(r,n("min"),n("max"))),e.set("value",ti(r,{computed:i,prop:n}))},decrement({context:e,event:t,prop:n,computed:i}){var s;let r=iu(i("valueAsNumber"),(s=t.step)!=null?s:n("step"));n("allowOverflow")||(r=He(r,n("min"),n("max"))),e.set("value",ti(r,{computed:i,prop:n}))},setClampedValue({context:e,prop:t,computed:n}){let i=He(n("valueAsNumber"),t("min"),t("max"));e.set("value",ti(i,{computed:n,prop:t}))},setRawValue({context:e,event:t,prop:n,computed:i}){let r=Nl(t.value,{computed:i,prop:n});n("allowOverflow")||(r=He(r,n("min"),n("max"))),e.set("value",ti(r,{computed:i,prop:n}))},setValue({context:e,event:t}){var i,r;let n=(r=(i=t.target)==null?void 0:i.value)!=null?r:t.value;e.set("value",n)},clearValue({context:e}){e.set("value","")},incrementToMax({context:e,prop:t,computed:n}){let i=ti(t("max"),{computed:n,prop:t});e.set("value",i)},decrementToMin({context:e,prop:t,computed:n}){let i=ti(t("min"),{computed:n,prop:t});e.set("value",i)},setHint({context:e,event:t}){e.set("hint",t.hint)},clearHint({context:e}){e.set("hint",null)},invokeOnFocus({computed:e,prop:t}){var n;(n=t("onFocusChange"))==null||n({focused:!0,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnBlur({computed:e,prop:t}){var n;(n=t("onFocusChange"))==null||n({focused:!1,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnInvalid({computed:e,prop:t,event:n}){var r;if(n.type==="INPUT.CHANGE")return;let i=e("valueAsNumber")>t("max")?"rangeOverflow":"rangeUnderflow";(r=t("onValueInvalid"))==null||r({reason:i,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnValueCommit({computed:e,prop:t}){var n;(n=t("onValueCommit"))==null||n({value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},syncInputElement({context:e,event:t,computed:n,scope:i}){var o;let r=t.type.endsWith("CHANGE")?e.get("value"):n("formattedValue"),s=ni(i),a=(o=t.selection)!=null?o:Dl(s,i);H(()=>{Me(s,r),OT(s,a,i)})},setFormattedValue({context:e,computed:t,action:n}){e.set("value",t("formattedValue")),n(["syncInputElement"])},setCursorPoint({context:e,event:t}){e.set("scrubberCursorPoint",t.point)},clearCursorPoint({context:e}){e.set("scrubberCursorPoint",null)},setVirtualCursorPosition({context:e,scope:t}){let n=ip(t),i=e.get("scrubberCursorPoint");!n||!i||(n.style.transform=`translate3d(${i.x}px, ${i.y}px, 0px)`)}}}}),WT=_()(["allowMouseWheel","allowOverflow","clampValueOnBlur","dir","disabled","focusInputOnChange","form","formatOptions","getRootNode","id","ids","inputMode","invalid","locale","max","min","name","onFocusChange","onValueChange","onValueCommit","onValueInvalid","pattern","required","readOnly","spinOnPress","step","translations","value","defaultValue"]),vA=B(WT),KT=class extends K{initMachine(e){return new W(qT,e)}initApi(){return FT(this.machine.service,q)}render(){var l;let e=(l=this.el.querySelector('[data-scope="number-input"][data-part="root"]'))!=null?l:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="number-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="number-input"][data-part="control"]');n&&this.spreadProps(n,this.api.getControlProps());let i=this.el.querySelector('[data-scope="number-input"][data-part="value-text"]');i&&this.spreadProps(i,this.api.getValueTextProps());let r=this.el.querySelector('[data-scope="number-input"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let s=this.el.querySelector('[data-scope="number-input"][data-part="decrement-trigger"]');s&&this.spreadProps(s,this.api.getDecrementTriggerProps());let a=this.el.querySelector('[data-scope="number-input"][data-part="increment-trigger"]');a&&this.spreadProps(a,this.api.getIncrementTriggerProps());let o=this.el.querySelector('[data-scope="number-input"][data-part="scrubber"]');o&&(this.spreadProps(o,this.api.getScrubberProps()),o.setAttribute("aria-label","Scrub to adjust value"),o.removeAttribute("role"))}},zT={mounted(){let e=this.el,t=O(e,"value"),n=O(e,"defaultValue"),i=C(e,"controlled"),r=new KT(e,y(g({id:e.id},i&&t!==void 0?{value:t}:{defaultValue:n}),{min:Y(e,"min"),max:Y(e,"max"),step:Y(e,"step"),disabled:C(e,"disabled"),readOnly:C(e,"readOnly"),invalid:C(e,"invalid"),required:C(e,"required"),allowMouseWheel:C(e,"allowMouseWheel"),name:O(e,"name"),form:O(e,"form"),onValueChange:s=>{let a=e.querySelector('[data-scope="number-input"][data-part="input"]');a&&(a.value=s.value,a.dispatchEvent(new Event("input",{bubbles:!0})),a.dispatchEvent(new Event("change",{bubbles:!0})));let o=O(e,"onValueChange");o&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(o,{value:s.value,valueAsNumber:s.valueAsNumber,id:e.id});let l=O(e,"onValueChangeClient");l&&e.dispatchEvent(new CustomEvent(l,{bubbles:!0,detail:{value:s,id:e.id}}))}}));r.init(),this.numberInput=r,this.handlers=[]},updated(){var n;let e=O(this.el,"value"),t=C(this.el,"controlled");(n=this.numberInput)==null||n.updateProps(y(g({id:this.el.id},t&&e!==void 0?{value:e}:{}),{min:Y(this.el,"min"),max:Y(this.el,"max"),step:Y(this.el,"step"),disabled:C(this.el,"disabled"),readOnly:C(this.el,"readOnly"),invalid:C(this.el,"invalid"),required:C(this.el,"required"),name:O(this.el,"name"),form:O(this.el,"form")}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.numberInput)==null||e.destroy()}}});var ap={};he(ap,{PasswordInput:()=>eO});function jT(e,t){let{scope:n,prop:i,context:r}=e,s=r.get("visible"),a=!!i("disabled"),o=!!i("invalid"),l=!!i("readOnly"),c=!!i("required"),u=!(l||a),h=i("translations");return{visible:s,disabled:a,invalid:o,focus(){var m;(m=Ll(n))==null||m.focus()},setVisible(m){e.send({type:"VISIBILITY.SET",value:m})},toggleVisible(){e.send({type:"VISIBILITY.SET",value:!s})},getRootProps(){return t.element(y(g({},qi.root.attrs),{dir:i("dir"),"data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l)}))},getLabelProps(){return t.label(y(g({},qi.label.attrs),{htmlFor:ba(n),"data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l),"data-required":E(c)}))},getInputProps(){return t.input(g(y(g({},qi.input.attrs),{id:ba(n),autoCapitalize:"off",name:i("name"),required:i("required"),autoComplete:i("autoComplete"),spellCheck:!1,readOnly:l,disabled:a,type:s?"text":"password","data-state":s?"visible":"hidden","aria-invalid":X(o),"data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l)}),i("ignorePasswordManagers")?XT:{}))},getVisibilityTriggerProps(){var m;return t.button(y(g({},qi.visibilityTrigger.attrs),{type:"button",tabIndex:-1,"aria-controls":ba(n),"aria-expanded":s,"data-readonly":E(l),disabled:a,"data-disabled":E(a),"data-state":s?"visible":"hidden","aria-label":(m=h==null?void 0:h.visibilityTrigger)==null?void 0:m.call(h,s),onPointerDown(d){pe(d)&&u&&(d.preventDefault(),e.send({type:"TRIGGER.CLICK"}))}}))},getIndicatorProps(){return t.element(y(g({},qi.indicator.attrs),{"aria-hidden":!0,"data-state":s?"visible":"hidden","data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l)}))},getControlProps(){return t.element(y(g({},qi.control.attrs),{"data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l)}))}}}var YT,qi,ba,Ll,XT,ZT,JT,SA,QT,eO,op=re(()=>{"use strict";se();YT=U("password-input").parts("root","input","label","control","indicator","visibilityTrigger"),qi=YT.build(),ba=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`p-input-${e.id}-input`},Ll=e=>e.getById(ba(e));XT={"data-1p-ignore":"","data-lpignore":"true","data-bwignore":"true","data-form-type":"other","data-protonpass-ignore":"true"},ZT={props({props:e}){return y(g({id:ur(),defaultVisible:!1,autoComplete:"current-password",ignorePasswordManagers:!1},e),{translations:g({visibilityTrigger(t){return t?"Hide password":"Show password"}},e.translations)})},context({prop:e,bindable:t}){return{visible:t(()=>({value:e("visible"),defaultValue:e("defaultVisible"),onChange(n){var i;(i=e("onVisibilityChange"))==null||i({visible:n})}}))}},initialState(){return"idle"},effects:["trackFormEvents"],states:{idle:{on:{"VISIBILITY.SET":{actions:["setVisibility"]},"TRIGGER.CLICK":{actions:["toggleVisibility","focusInputEl"]}}}},implementations:{actions:{setVisibility({context:e,event:t}){e.set("visible",t.value)},toggleVisibility({context:e}){e.set("visible",t=>!t)},focusInputEl({scope:e}){let t=Ll(e);t==null||t.focus()}},effects:{trackFormEvents({scope:e,send:t}){let n=Ll(e),i=n==null?void 0:n.form;if(!i)return;let r=e.getWin(),s=new r.AbortController;return i.addEventListener("reset",a=>{a.defaultPrevented||t({type:"VISIBILITY.SET",value:!1})},{signal:s.signal}),i.addEventListener("submit",()=>{t({type:"VISIBILITY.SET",value:!1})},{signal:s.signal}),()=>s.abort()}}}},JT=_()(["defaultVisible","dir","id","onVisibilityChange","visible","ids","getRootNode","disabled","invalid","required","readOnly","translations","ignorePasswordManagers","autoComplete","name"]),SA=B(JT),QT=class extends K{initMachine(e){return new W(ZT,e)}initApi(){return jT(this.machine.service,q)}render(){var a;let e=(a=this.el.querySelector('[data-scope="password-input"][data-part="root"]'))!=null?a:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="password-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="password-input"][data-part="control"]');n&&this.spreadProps(n,this.api.getControlProps());let i=this.el.querySelector('[data-scope="password-input"][data-part="input"]');i&&this.spreadProps(i,this.api.getInputProps());let r=this.el.querySelector('[data-scope="password-input"][data-part="visibility-trigger"]');r&&this.spreadProps(r,this.api.getVisibilityTriggerProps());let s=this.el.querySelector('[data-scope="password-input"][data-part="indicator"]');s&&this.spreadProps(s,this.api.getIndicatorProps())}},eO={mounted(){let e=this.el,t=new QT(e,y(g({id:e.id},C(e,"controlledVisible")?{visible:C(e,"visible")}:{defaultVisible:C(e,"defaultVisible")}),{disabled:C(e,"disabled"),invalid:C(e,"invalid"),readOnly:C(e,"readOnly"),required:C(e,"required"),ignorePasswordManagers:C(e,"ignorePasswordManagers"),name:O(e,"name"),dir:Oe(e),autoComplete:O(e,"autoComplete",["current-password","new-password"]),onVisibilityChange:n=>{let i=O(e,"onVisibilityChange");i&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(i,{visible:n.visible,id:e.id});let r=O(e,"onVisibilityChangeClient");r&&e.dispatchEvent(new CustomEvent(r,{bubbles:!0,detail:{value:n,id:e.id}}))}}));t.init(),this.passwordInput=t,this.handlers=[]},updated(){var e;(e=this.passwordInput)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlledVisible")?{visible:C(this.el,"visible")}:{}),{disabled:C(this.el,"disabled"),invalid:C(this.el,"invalid"),readOnly:C(this.el,"readOnly"),required:C(this.el,"required"),name:O(this.el,"name"),form:O(this.el,"form"),dir:Oe(this.el)}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.passwordInput)==null||e.destroy()}}});var dp={};he(dp,{PinInput:()=>fO});function lO(e,t){var n;return e?!!((n=oO[e])!=null&&n.test(t)):!0}function cp(e,t,n){return n?new RegExp(n,"g").test(e):lO(t,e)}function cO(e,t){let{send:n,context:i,computed:r,prop:s,scope:a}=e,o=r("isValueComplete"),l=!!s("disabled"),c=!!s("readOnly"),u=!!s("invalid"),h=!!s("required"),m=s("translations"),d=i.get("focusedIndex");function p(){var v;(v=aO(a))==null||v.focus()}return{focus:p,count:i.get("count"),items:Array.from({length:i.get("count")}).map((v,I)=>I),value:i.get("value"),valueAsString:r("valueAsString"),complete:o,setValue(v){Array.isArray(v)||vs("[pin-input/setValue] value must be an array"),n({type:"VALUE.SET",value:v})},clearValue(){n({type:"VALUE.CLEAR"})},setValueAtIndex(v,I){n({type:"VALUE.SET",value:I,index:v})},getRootProps(){return t.element(y(g({dir:s("dir")},Ea.root.attrs),{id:Fr(a),"data-invalid":E(u),"data-disabled":E(l),"data-complete":E(o),"data-readonly":E(c)}))},getLabelProps(){return t.label(y(g({},Ea.label.attrs),{dir:s("dir"),htmlFor:Fl(a),id:iO(a),"data-invalid":E(u),"data-disabled":E(l),"data-complete":E(o),"data-required":E(h),"data-readonly":E(c),onClick(v){v.preventDefault(),p()}}))},getHiddenInputProps(){return t.input({"aria-hidden":!0,type:"text",tabIndex:-1,id:Fl(a),readOnly:c,disabled:l,required:h,name:s("name"),form:s("form"),style:Vt,maxLength:r("valueLength"),defaultValue:r("valueAsString")})},getControlProps(){return t.element(y(g({},Ea.control.attrs),{dir:s("dir"),id:rO(a)}))},getInputProps(v){var w;let{index:I}=v,T=s("type")==="numeric"?"tel":"text";return t.input(y(g({},Ea.input.attrs),{dir:s("dir"),disabled:l,"data-disabled":E(l),"data-complete":E(o),id:nO(a,I.toString()),"data-index":I,"data-ownedby":Fr(a),"aria-label":(w=m==null?void 0:m.inputLabel)==null?void 0:w.call(m,I,r("valueLength")),inputMode:s("otp")||s("type")==="numeric"?"numeric":"text","aria-invalid":X(u),"data-invalid":E(u),type:s("mask")?"password":T,defaultValue:i.get("value")[I]||"",readOnly:c,autoCapitalize:"none",autoComplete:s("otp")?"one-time-code":"off",placeholder:d===I?"":s("placeholder"),onPaste(b){var P;let f=(P=b.clipboardData)==null?void 0:P.getData("text/plain");if(!f)return;if(!cp(f,s("type"),s("pattern"))){n({type:"VALUE.INVALID",value:f}),b.preventDefault();return}b.preventDefault(),n({type:"INPUT.PASTE",value:f})},onBeforeInput(b){try{let f=Oc(b);cp(f,s("type"),s("pattern"))||(n({type:"VALUE.INVALID",value:f}),b.preventDefault()),f.length>1&&b.currentTarget.setSelectionRange(0,1,"forward")}catch(f){}},onChange(b){let f=Yt(b),{value:S}=b.currentTarget;if(f.inputType==="insertFromPaste"){b.currentTarget.value=S[0]||"";return}if(S.length>2){n({type:"INPUT.PASTE",value:S}),b.currentTarget.value=S[0],b.preventDefault();return}if(f.inputType==="deleteContentBackward"){n({type:"INPUT.BACKSPACE"});return}n({type:"INPUT.CHANGE",value:S,index:I})},onKeyDown(b){if(b.defaultPrevented||Re(b)||xe(b))return;let S={Backspace(){n({type:"INPUT.BACKSPACE"})},Delete(){n({type:"INPUT.DELETE"})},ArrowLeft(){n({type:"INPUT.ARROW_LEFT"})},ArrowRight(){n({type:"INPUT.ARROW_RIGHT"})},Enter(){n({type:"INPUT.ENTER"})}}[ge(b,{dir:s("dir"),orientation:"horizontal"})];S&&(S(b),b.preventDefault())},onFocus(){n({type:"INPUT.FOCUS",index:I})},onBlur(b){let f=b.relatedTarget;le(f)&&f.dataset.ownedby===Fr(a)||n({type:"INPUT.BLUR",index:I})}}))}}}function up(e,t){let n=t;e[0]===t[0]?n=t[1]:e[0]===t[1]&&(n=t[0]);let i=n.split("");return n=i[i.length-1],n!=null?n:""}function Ia(e,t){return Array.from({length:t}).fill("").map((n,i)=>e[i]||n)}var tO,Ea,Fr,nO,Fl,iO,rO,sO,Pa,Mr,aO,lp,Ml,oO,uO,dO,hO,gO,VA,pO,fO,hp=re(()=>{"use strict";se();tO=U("pinInput").parts("root","label","input","control"),Ea=tO.build(),Fr=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`pin-input:${e.id}`},nO=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.input)==null?void 0:i.call(n,t))!=null?r:`pin-input:${e.id}:${t}`},Fl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`pin-input:${e.id}:hidden`},iO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`pin-input:${e.id}:label`},rO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`pin-input:${e.id}:control`},sO=e=>e.getById(Fr(e)),Pa=e=>{let n=`input[data-ownedby=${CSS.escape(Fr(e))}]`;return Fe(sO(e),n)},Mr=(e,t)=>Pa(e)[t],aO=e=>Pa(e)[0],lp=e=>e.getById(Fl(e)),Ml=(e,t)=>{e.value=t,e.setAttribute("value",t)},oO={numeric:/^[0-9]+$/,alphabetic:/^[A-Za-z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/i};({choose:uO,createMachine:dO}=ut()),hO=dO({props({props:e}){return y(g({placeholder:"\u25CB",otp:!1,type:"numeric",defaultValue:e.count?Ia([],e.count):[]},e),{translations:g({inputLabel:(t,n)=>`pin code ${t+1} of ${n}`},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({value:e("value"),defaultValue:e("defaultValue"),isEqual:fe,onChange(n){var i;(i=e("onValueChange"))==null||i({value:n,valueAsString:n.join("")})}})),focusedIndex:t(()=>({sync:!0,defaultValue:-1})),count:t(()=>({defaultValue:e("count")}))}},computed:{_value:({context:e})=>Ia(e.get("value"),e.get("count")),valueLength:({computed:e})=>e("_value").length,filledValueLength:({computed:e})=>e("_value").filter(t=>(t==null?void 0:t.trim())!=="").length,isValueComplete:({computed:e})=>e("valueLength")===e("filledValueLength"),valueAsString:({computed:e})=>e("_value").join(""),focusedValue:({computed:e,context:t})=>e("_value")[t.get("focusedIndex")]||""},entry:uO([{guard:"autoFocus",actions:["setInputCount","setFocusIndexToFirst"]},{actions:["setInputCount"]}]),watch({action:e,track:t,context:n,computed:i}){t([()=>n.get("focusedIndex")],()=>{e(["focusInput","selectInputIfNeeded"])}),t([()=>n.get("value").join(",")],()=>{e(["syncInputElements","dispatchInputEvent"])}),t([()=>i("isValueComplete")],()=>{e(["invokeOnComplete","blurFocusedInputIfNeeded"])})},on:{"VALUE.SET":[{guard:"hasIndex",actions:["setValueAtIndex"]},{actions:["setValue"]}],"VALUE.CLEAR":{actions:["clearValue","setFocusIndexToFirst"]}},states:{idle:{on:{"INPUT.FOCUS":{target:"focused",actions:["setFocusedIndex"]}}},focused:{on:{"INPUT.CHANGE":{actions:["setFocusedValue","syncInputValue","setNextFocusedIndex"]},"INPUT.PASTE":{actions:["setPastedValue","setLastValueFocusIndex"]},"INPUT.FOCUS":{actions:["setFocusedIndex"]},"INPUT.BLUR":{target:"idle",actions:["clearFocusedIndex"]},"INPUT.DELETE":{guard:"hasValue",actions:["clearFocusedValue"]},"INPUT.ARROW_LEFT":{actions:["setPrevFocusedIndex"]},"INPUT.ARROW_RIGHT":{actions:["setNextFocusedIndex"]},"INPUT.BACKSPACE":[{guard:"hasValue",actions:["clearFocusedValue"]},{actions:["setPrevFocusedIndex","clearFocusedValue"]}],"INPUT.ENTER":{guard:"isValueComplete",actions:["requestFormSubmit"]},"VALUE.INVALID":{actions:["invokeOnInvalid"]}}}},implementations:{guards:{autoFocus:({prop:e})=>!!e("autoFocus"),hasValue:({context:e})=>e.get("value")[e.get("focusedIndex")]!=="",isValueComplete:({computed:e})=>e("isValueComplete"),hasIndex:({event:e})=>e.index!==void 0},actions:{dispatchInputEvent({computed:e,scope:t}){let n=lp(t);Ac(n,{value:e("valueAsString")})},setInputCount({scope:e,context:t,prop:n}){if(n("count"))return;let i=Pa(e);t.set("count",i.length)},focusInput({context:e,scope:t}){var i;let n=e.get("focusedIndex");n!==-1&&((i=Mr(t,n))==null||i.focus({preventScroll:!0}))},selectInputIfNeeded({context:e,prop:t,scope:n}){let i=e.get("focusedIndex");!t("selectOnFocus")||i===-1||H(()=>{var r;(r=Mr(n,i))==null||r.select()})},invokeOnComplete({computed:e,prop:t}){var n;e("isValueComplete")&&((n=t("onValueComplete"))==null||n({value:e("_value"),valueAsString:e("valueAsString")}))},invokeOnInvalid({context:e,event:t,prop:n}){var i;(i=n("onValueInvalid"))==null||i({value:t.value,index:e.get("focusedIndex")})},clearFocusedIndex({context:e}){e.set("focusedIndex",-1)},setFocusedIndex({context:e,event:t}){e.set("focusedIndex",t.index)},setValue({context:e,event:t}){let n=Ia(t.value,e.get("count"));e.set("value",n)},setFocusedValue({context:e,event:t,computed:n,flush:i}){let r=n("focusedValue"),s=e.get("focusedIndex"),a=up(r,t.value);i(()=>{e.set("value",ms(n("_value"),s,a))})},revertInputValue({context:e,computed:t,scope:n}){let i=Mr(n,e.get("focusedIndex"));Ml(i,t("focusedValue"))},syncInputValue({context:e,event:t,scope:n}){let i=e.get("value"),r=Mr(n,t.index);Ml(r,i[t.index])},syncInputElements({context:e,scope:t}){let n=Pa(t),i=e.get("value");n.forEach((r,s)=>{Ml(r,i[s])})},setPastedValue({context:e,event:t,computed:n,flush:i}){H(()=>{let r=n("valueAsString"),s=e.get("focusedIndex"),a=n("valueLength"),o=n("filledValueLength"),l=Math.min(s,o),c=l>0?r.substring(0,s):"",u=t.value.substring(0,a-l),h=Ia(`${c}${u}`.split(""),a);i(()=>{e.set("value",h)})})},setValueAtIndex({context:e,event:t,computed:n}){let i=up(n("focusedValue"),t.value);e.set("value",ms(n("_value"),t.index,i))},clearValue({context:e}){let t=Array.from({length:e.get("count")}).fill("");queueMicrotask(()=>{e.set("value",t)})},clearFocusedValue({context:e,computed:t}){let n=e.get("focusedIndex");n!==-1&&e.set("value",ms(t("_value"),n,""))},setFocusIndexToFirst({context:e}){e.set("focusedIndex",0)},setNextFocusedIndex({context:e,computed:t}){e.set("focusedIndex",Math.min(e.get("focusedIndex")+1,t("valueLength")-1))},setPrevFocusedIndex({context:e}){e.set("focusedIndex",Math.max(e.get("focusedIndex")-1,0))},setLastValueFocusIndex({context:e,computed:t}){H(()=>{e.set("focusedIndex",Math.min(t("filledValueLength"),t("valueLength")-1))})},blurFocusedInputIfNeeded({context:e,prop:t,scope:n}){t("blurOnComplete")&&H(()=>{var i;(i=Mr(n,e.get("focusedIndex")))==null||i.blur()})},requestFormSubmit({computed:e,prop:t,scope:n}){var r;if(!t("name")||!e("isValueComplete"))return;let i=lp(n);(r=i==null?void 0:i.form)==null||r.requestSubmit()}}}});gO=_()(["autoFocus","blurOnComplete","count","defaultValue","dir","disabled","form","getRootNode","id","ids","invalid","mask","name","onValueChange","onValueComplete","onValueInvalid","otp","pattern","placeholder","readOnly","required","selectOnFocus","translations","type","value"]),VA=B(gO),pO=class extends K{initMachine(e){return new W(hO,e)}initApi(){return cO(this.machine.service,q)}render(){var r;let e=(r=this.el.querySelector('[data-scope="pin-input"][data-part="root"]'))!=null?r:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="pin-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="pin-input"][data-part="hidden-input"]');n&&this.spreadProps(n,this.api.getHiddenInputProps());let i=this.el.querySelector('[data-scope="pin-input"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps()),this.api.items.forEach(s=>{let a=this.el.querySelector(`[data-scope="pin-input"][data-part="input"][data-index="${s}"]`);a&&this.spreadProps(a,this.api.getInputProps({index:s}))})}},fO={mounted(){var s;let e=this.el,t=Z(e,"value"),n=Z(e,"defaultValue"),i=C(e,"controlled"),r=new pO(e,y(g({id:e.id,count:(s=Y(e,"count"))!=null?s:4},i&&t?{value:t}:{defaultValue:n!=null?n:[]}),{disabled:C(e,"disabled"),invalid:C(e,"invalid"),required:C(e,"required"),readOnly:C(e,"readOnly"),mask:C(e,"mask"),otp:C(e,"otp"),blurOnComplete:C(e,"blurOnComplete"),selectOnFocus:C(e,"selectOnFocus"),name:O(e,"name"),form:O(e,"form"),dir:O(e,"dir",["ltr","rtl"]),type:O(e,"type",["alphanumeric","numeric","alphabetic"]),placeholder:O(e,"placeholder"),onValueChange:a=>{let o=e.querySelector('[data-scope="pin-input"][data-part="hidden-input"]');o&&(o.value=a.valueAsString,o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0})));let l=O(e,"onValueChange");l&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(l,{value:a.value,valueAsString:a.valueAsString,id:e.id});let c=O(e,"onValueChangeClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:{value:a,id:e.id}}))},onValueComplete:a=>{let o=O(e,"onValueComplete");o&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(o,{value:a.value,valueAsString:a.valueAsString,id:e.id})}}));r.init(),this.pinInput=r,this.handlers=[]},updated(){var n,i,r,s;let e=Z(this.el,"value"),t=C(this.el,"controlled");(s=this.pinInput)==null||s.updateProps(y(g({id:this.el.id,count:(r=(i=Y(this.el,"count"))!=null?i:(n=this.pinInput)==null?void 0:n.api.count)!=null?r:4},t&&e?{value:e}:{}),{disabled:C(this.el,"disabled"),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly"),name:O(this.el,"name"),form:O(this.el,"form")}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.pinInput)==null||e.destroy()}}});var vp={};he(vp,{RadioGroup:()=>kO});function TO(e,t){let{context:n,send:i,computed:r,prop:s,scope:a}=e,o=r("isDisabled"),l=s("invalid"),c=s("readOnly");function u(d){return{value:d.value,invalid:!!d.invalid||!!l,disabled:!!d.disabled||o,checked:n.get("value")===d.value,focused:n.get("focusedValue")===d.value,focusVisible:n.get("focusVisibleValue")===d.value,hovered:n.get("hoveredValue")===d.value,active:n.get("activeValue")===d.value}}function h(d){let p=u(d);return{"data-focus":E(p.focused),"data-focus-visible":E(p.focusVisible),"data-disabled":E(p.disabled),"data-readonly":E(c),"data-state":p.checked?"checked":"unchecked","data-hover":E(p.hovered),"data-invalid":E(p.invalid),"data-orientation":s("orientation"),"data-ssr":E(n.get("ssr"))}}let m=()=>{var p;let d=(p=PO(a))!=null?p:IO(a);d==null||d.focus()};return{focus:m,value:n.get("value"),setValue(d){i({type:"SET_VALUE",value:d,isTrusted:!1})},clearValue(){i({type:"SET_VALUE",value:null,isTrusted:!1})},getRootProps(){return t.element(y(g({},Wi.root.attrs),{role:"radiogroup",id:Ca(a),"aria-labelledby":gp(a),"aria-required":s("required")||void 0,"aria-disabled":o||void 0,"aria-readonly":c||void 0,"data-orientation":s("orientation"),"data-disabled":E(o),"data-invalid":E(l),"data-required":E(s("required")),"aria-orientation":s("orientation"),dir:s("dir"),style:{position:"relative"}}))},getLabelProps(){return t.element(y(g({},Wi.label.attrs),{dir:s("dir"),"data-orientation":s("orientation"),"data-disabled":E(o),"data-invalid":E(l),"data-required":E(s("required")),id:gp(a),onClick:m}))},getItemState:u,getItemProps(d){let p=u(d);return t.label(y(g(y(g({},Wi.item.attrs),{dir:s("dir"),id:fp(a,d.value),htmlFor:$l(a,d.value)}),h(d)),{onPointerMove(){p.disabled||p.hovered||i({type:"SET_HOVERED",value:d.value,hovered:!0})},onPointerLeave(){p.disabled||i({type:"SET_HOVERED",value:null})},onPointerDown(v){p.disabled||pe(v)&&(p.focused&&v.pointerType==="mouse"&&v.preventDefault(),i({type:"SET_ACTIVE",value:d.value,active:!0}))},onPointerUp(){p.disabled||i({type:"SET_ACTIVE",value:null})},onClick(){var v;!p.disabled&&Xe()&&((v=bO(a,d.value))==null||v.focus())}}))},getItemTextProps(d){return t.element(g(y(g({},Wi.itemText.attrs),{dir:s("dir"),id:yO(a,d.value)}),h(d)))},getItemControlProps(d){let p=u(d);return t.element(g(y(g({},Wi.itemControl.attrs),{dir:s("dir"),id:vO(a,d.value),"data-active":E(p.active),"aria-hidden":!0}),h(d)))},getItemHiddenInputProps(d){let p=u(d);return t.input({"data-ownedby":Ca(a),id:$l(a,d.value),type:"radio",name:s("name")||s("id"),form:s("form"),value:d.value,required:s("required"),"aria-invalid":p.invalid||void 0,onClick(v){if(c){v.preventDefault();return}v.currentTarget.checked&&i({type:"SET_VALUE",value:d.value,isTrusted:!0})},onBlur(){i({type:"SET_FOCUSED",value:null,focused:!1,focusVisible:!1})},onFocus(){let v=En();i({type:"SET_FOCUSED",value:d.value,focused:!0,focusVisible:v})},onKeyDown(v){v.defaultPrevented||v.key===" "&&i({type:"SET_ACTIVE",value:d.value,active:!0})},onKeyUp(v){v.defaultPrevented||v.key===" "&&i({type:"SET_ACTIVE",value:null})},disabled:p.disabled||c,defaultChecked:p.checked,style:Vt})},getIndicatorProps(){let d=n.get("indicatorRect"),p=d==null||d.width===0&&d.height===0&&d.x===0&&d.y===0;return t.element(y(g({id:mp(a)},Wi.indicator.attrs),{dir:s("dir"),hidden:n.get("value")==null||p,"data-disabled":E(o),"data-orientation":s("orientation"),style:{"--transition-property":"left, top, width, height","--left":ye(d==null?void 0:d.x),"--top":ye(d==null?void 0:d.y),"--width":ye(d==null?void 0:d.width),"--height":ye(d==null?void 0:d.height),position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:"var(--transition-duration, 150ms)",transitionTimingFunction:"var(--transition-timing-function)",[s("orientation")==="horizontal"?"left":"top"]:s("orientation")==="horizontal"?"var(--left)":"var(--top)"}}))}}}var mO,Wi,Ca,gp,fp,$l,vO,yO,mp,Sa,bO,EO,IO,PO,pp,CO,SO,OO,wO,VO,RA,xO,DA,AO,kO,yp=re(()=>{"use strict";pr();se();mO=U("radio-group").parts("root","label","item","itemText","itemControl","indicator"),Wi=mO.build(),Ca=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`radio-group:${e.id}`},gp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`radio-group:${e.id}:label`},fp=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`radio-group:${e.id}:radio:${t}`},$l=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemHiddenInput)==null?void 0:i.call(n,t))!=null?r:`radio-group:${e.id}:radio:input:${t}`},vO=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemControl)==null?void 0:i.call(n,t))!=null?r:`radio-group:${e.id}:radio:control:${t}`},yO=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemLabel)==null?void 0:i.call(n,t))!=null?r:`radio-group:${e.id}:radio:label:${t}`},mp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicator)!=null?n:`radio-group:${e.id}:indicator`},Sa=e=>e.getById(Ca(e)),bO=(e,t)=>e.getById($l(e,t)),EO=e=>e.getById(mp(e)),IO=e=>{var t;return(t=Sa(e))==null?void 0:t.querySelector("input:not(:disabled)")},PO=e=>{var t;return(t=Sa(e))==null?void 0:t.querySelector("input:not(:disabled):checked")},pp=e=>{let n=`input[type=radio][data-ownedby='${CSS.escape(Ca(e))}']:not([disabled])`;return Fe(Sa(e),n)},CO=(e,t)=>{if(t)return e.getById(fp(e,t))},SO=e=>{var t,n,i,r;return{x:(t=e==null?void 0:e.offsetLeft)!=null?t:0,y:(n=e==null?void 0:e.offsetTop)!=null?n:0,width:(i=e==null?void 0:e.offsetWidth)!=null?i:0,height:(r=e==null?void 0:e.offsetHeight)!=null?r:0}};({not:OO}=Ee()),wO={props({props:e}){return g({orientation:"vertical"},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}})),activeValue:t(()=>({defaultValue:null})),focusedValue:t(()=>({defaultValue:null})),focusVisibleValue:t(()=>({defaultValue:null})),hoveredValue:t(()=>({defaultValue:null})),indicatorRect:t(()=>({defaultValue:null})),fieldsetDisabled:t(()=>({defaultValue:!1})),ssr:t(()=>({defaultValue:!0}))}},refs(){return{indicatorCleanup:null,focusVisibleValue:null}},computed:{isDisabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled")},entry:["syncIndicatorRect","syncSsr"],exit:["cleanupObserver"],effects:["trackFormControlState","trackFocusVisible"],watch({track:e,action:t,context:n}){e([()=>n.get("value")],()=>{t(["syncIndicatorRect","syncInputElements"])})},on:{SET_VALUE:[{guard:OO("isTrusted"),actions:["setValue","dispatchChangeEvent"]},{actions:["setValue"]}],SET_HOVERED:{actions:["setHovered"]},SET_ACTIVE:{actions:["setActive"]},SET_FOCUSED:{actions:["setFocused"]}},states:{idle:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackFormControlState({context:e,scope:t}){return wt(Sa(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){e.set("value",e.initial("value"))}})},trackFocusVisible({scope:e}){var t;return Pn({root:(t=e.getRootNode)==null?void 0:t.call(e)})}},actions:{setValue({context:e,event:t}){e.set("value",t.value)},setHovered({context:e,event:t}){e.set("hoveredValue",t.value)},setActive({context:e,event:t}){e.set("activeValue",t.value)},setFocused({context:e,event:t}){e.set("focusedValue",t.value);let n=t.value!=null&&t.focusVisible?t.value:null;e.set("focusVisibleValue",n)},syncInputElements({context:e,scope:t}){pp(t).forEach(i=>{i.checked=i.value===e.get("value")})},cleanupObserver({refs:e}){var t;(t=e.get("indicatorCleanup"))==null||t()},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,scope:t,refs:n}){var o;if((o=n.get("indicatorCleanup"))==null||o(),!EO(t))return;let i=e.get("value"),r=CO(t,i);if(i==null||!r){e.set("indicatorRect",null);return}let s=()=>{e.set("indicatorRect",SO(r))};s();let a=gn.observe(r,s);n.set("indicatorCleanup",a)},dispatchChangeEvent({context:e,scope:t}){pp(t).forEach(i=>{let r=i.value===e.get("value");r!==i.checked&&pi(i,{checked:r})})}}}},VO=_()(["dir","disabled","form","getRootNode","id","ids","invalid","name","onValueChange","orientation","readOnly","required","value","defaultValue"]),RA=B(VO),xO=_()(["value","disabled","invalid"]),DA=B(xO),AO=class extends K{initMachine(e){return new W(wO,e)}initApi(){return TO(this.machine.service,q)}render(){var i;let e=(i=this.el.querySelector('[data-scope="radio-group"][data-part="root"]'))!=null?i:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="radio-group"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="radio-group"][data-part="indicator"]');n&&this.spreadProps(n,this.api.getIndicatorProps()),this.el.querySelectorAll('[data-scope="radio-group"][data-part="item"]').forEach(r=>{let s=r.dataset.value;if(s==null)return;let a=r.dataset.disabled==="true",o=r.dataset.invalid==="true";this.spreadProps(r,this.api.getItemProps({value:s,disabled:a,invalid:o}));let l=r.querySelector('[data-scope="radio-group"][data-part="item-text"]');l&&this.spreadProps(l,this.api.getItemTextProps({value:s,disabled:a,invalid:o}));let c=r.querySelector('[data-scope="radio-group"][data-part="item-control"]');c&&this.spreadProps(c,this.api.getItemControlProps({value:s,disabled:a,invalid:o}));let u=r.querySelector('[data-scope="radio-group"][data-part="item-hidden-input"]');u&&this.spreadProps(u,this.api.getItemHiddenInputProps({value:s,disabled:a,invalid:o}))})}},kO={mounted(){let e=this.el,t=O(e,"value"),n=O(e,"defaultValue"),i=C(e,"controlled"),r=new AO(e,y(g({id:e.id},i&&t!==void 0?{value:t!=null?t:null}:{defaultValue:n!=null?n:null}),{name:O(e,"name"),form:O(e,"form"),disabled:C(e,"disabled"),invalid:C(e,"invalid"),required:C(e,"required"),readOnly:C(e,"readOnly"),dir:O(e,"dir",["ltr","rtl"]),orientation:O(e,"orientation",["horizontal","vertical"]),onValueChange:s=>{let a=O(e,"onValueChange");a&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(a,{value:s.value,id:e.id});let o=O(e,"onValueChangeClient");o&&e.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:{value:s,id:e.id}}))}}));r.init(),this.radioGroup=r,this.handlers=[]},updated(){var n;let e=O(this.el,"value"),t=C(this.el,"controlled");(n=this.radioGroup)==null||n.updateProps(y(g({id:this.el.id},t&&e!==void 0?{value:e!=null?e:null}:{}),{name:O(this.el,"name"),form:O(this.el,"form"),disabled:C(this.el,"disabled"),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly"),orientation:O(this.el,"orientation",["horizontal","vertical"])}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.radioGroup)==null||e.destroy()}}});var Tp={};he(Tp,{Select:()=>zO});function FO(e,t){let{context:n,prop:i,scope:r,state:s,computed:a,send:o}=e,l=i("disabled")||n.get("fieldsetDisabled"),c=!!i("invalid"),u=!!i("required"),h=!!i("readOnly"),m=i("composite"),d=i("collection"),p=s.hasTag("open"),v=s.matches("focused"),I=n.get("highlightedValue"),T=n.get("highlightedItem"),w=n.get("selectedItems"),b=n.get("currentPlacement"),f=a("isTypingAhead"),S=a("isInteractive"),P=I?Ul(r,I):void 0;function V(x){let k=d.getItemDisabled(x.item),N=d.getItemValue(x.item);return vn(N,()=>`[zag-js] No value found for item ${JSON.stringify(x.item)}`),{value:N,disabled:!!(l||k),highlighted:I===N,selected:n.get("value").includes(N)}}let A=On(y(g({},i("positioning")),{placement:b}));return{open:p,focused:v,empty:n.get("value").length===0,highlightedItem:T,highlightedValue:I,selectedItems:w,hasSelectedItems:a("hasSelectedItems"),value:n.get("value"),valueAsString:a("valueAsString"),collection:d,multiple:!!i("multiple"),disabled:!!l,reposition(x={}){o({type:"POSITIONING.SET",options:x})},focus(){var x;(x=ri(r))==null||x.focus({preventScroll:!0})},setOpen(x){s.hasTag("open")!==x&&o({type:x?"OPEN":"CLOSE"})},selectValue(x){o({type:"ITEM.SELECT",value:x})},setValue(x){o({type:"VALUE.SET",value:x})},selectAll(){o({type:"VALUE.SET",value:d.getValues()})},setHighlightValue(x){o({type:"HIGHLIGHTED_VALUE.SET",value:x})},clearHighlightValue(){o({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(x){o(x?{type:"ITEM.CLEAR",value:x}:{type:"VALUE.CLEAR"})},getItemState:V,getRootProps(){return t.element(y(g({},_e.root.attrs),{dir:i("dir"),id:RO(r),"data-invalid":E(c),"data-readonly":E(h)}))},getLabelProps(){return t.label(y(g({dir:i("dir"),id:Ta(r)},_e.label.attrs),{"data-disabled":E(l),"data-invalid":E(c),"data-readonly":E(h),"data-required":E(u),htmlFor:ql(r),onClick(x){var k;x.defaultPrevented||l||(k=ri(r))==null||k.focus({preventScroll:!0})}}))},getControlProps(){return t.element(y(g({},_e.control.attrs),{dir:i("dir"),id:DO(r),"data-state":p?"open":"closed","data-focus":E(v),"data-disabled":E(l),"data-invalid":E(c)}))},getValueTextProps(){return t.element(y(g({},_e.valueText.attrs),{dir:i("dir"),"data-disabled":E(l),"data-invalid":E(c),"data-focus":E(v)}))},getTriggerProps(){return t.button(y(g({id:Gl(r),disabled:l,dir:i("dir"),type:"button",role:"combobox","aria-controls":_l(r),"aria-expanded":p,"aria-haspopup":"listbox","data-state":p?"open":"closed","aria-invalid":c,"aria-required":u,"aria-labelledby":Ta(r)},_e.trigger.attrs),{"data-disabled":E(l),"data-invalid":E(c),"data-readonly":E(h),"data-placement":b,"data-placeholder-shown":E(!a("hasSelectedItems")),onClick(x){S&&(x.defaultPrevented||o({type:"TRIGGER.CLICK"}))},onFocus(){o({type:"TRIGGER.FOCUS"})},onBlur(){o({type:"TRIGGER.BLUR"})},onKeyDown(x){if(x.defaultPrevented||!S)return;let N={ArrowUp(){o({type:"TRIGGER.ARROW_UP"})},ArrowDown(D){o({type:D.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){o({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){o({type:"TRIGGER.ARROW_RIGHT"})},Home(){o({type:"TRIGGER.HOME"})},End(){o({type:"TRIGGER.END"})},Enter(){o({type:"TRIGGER.ENTER"})},Space(D){o(f?{type:"TRIGGER.TYPEAHEAD",key:D.key}:{type:"TRIGGER.ENTER"})}}[ge(x,{dir:i("dir"),orientation:"vertical"})];if(N){N(x),x.preventDefault();return}Ue.isValidEvent(x)&&(o({type:"TRIGGER.TYPEAHEAD",key:x.key}),x.preventDefault())}}))},getIndicatorProps(){return t.element(y(g({},_e.indicator.attrs),{dir:i("dir"),"aria-hidden":!0,"data-state":p?"open":"closed","data-disabled":E(l),"data-invalid":E(c),"data-readonly":E(h)}))},getItemProps(x){let k=V(x);return t.element(y(g({id:Ul(r,k.value),role:"option"},_e.item.attrs),{dir:i("dir"),"data-value":k.value,"aria-selected":k.selected,"data-state":k.selected?"checked":"unchecked","data-highlighted":E(k.highlighted),"data-disabled":E(k.disabled),"aria-disabled":X(k.disabled),onPointerMove(N){k.disabled||N.pointerType!=="mouse"||k.value!==I&&o({type:"ITEM.POINTER_MOVE",value:k.value})},onClick(N){N.defaultPrevented||k.disabled||o({type:"ITEM.CLICK",src:"pointerup",value:k.value})},onPointerLeave(N){var $;k.disabled||x.persistFocus||N.pointerType!=="mouse"||!(($=e.event.previous())!=null&&$.type.includes("POINTER"))||o({type:"ITEM.POINTER_LEAVE"})}}))},getItemTextProps(x){let k=V(x);return t.element(y(g({},_e.itemText.attrs),{"data-state":k.selected?"checked":"unchecked","data-disabled":E(k.disabled),"data-highlighted":E(k.highlighted)}))},getItemIndicatorProps(x){let k=V(x);return t.element(y(g({"aria-hidden":!0},_e.itemIndicator.attrs),{"data-state":k.selected?"checked":"unchecked",hidden:!k.selected}))},getItemGroupLabelProps(x){let{htmlFor:k}=x;return t.element(y(g({},_e.itemGroupLabel.attrs),{id:bp(r,k),dir:i("dir"),role:"presentation"}))},getItemGroupProps(x){let{id:k}=x;return t.element(y(g({},_e.itemGroup.attrs),{"data-disabled":E(l),id:LO(r,k),"aria-labelledby":bp(r,k),role:"group",dir:i("dir")}))},getClearTriggerProps(){return t.button(y(g({},_e.clearTrigger.attrs),{id:Cp(r),type:"button","aria-label":"Clear value","data-invalid":E(c),disabled:l,hidden:!a("hasSelectedItems"),dir:i("dir"),onClick(x){x.defaultPrevented||o({type:"CLEAR.CLICK"})}}))},getHiddenSelectProps(){let x=n.get("value"),k=i("multiple")?x:x==null?void 0:x[0];return t.select({name:i("name"),form:i("form"),disabled:l,multiple:i("multiple"),required:i("required"),"aria-hidden":!0,id:ql(r),defaultValue:k,style:Vt,tabIndex:-1,onFocus(){var N;(N=ri(r))==null||N.focus({preventScroll:!0})},"aria-labelledby":Ta(r)})},getPositionerProps(){return t.element(y(g({},_e.positioner.attrs),{dir:i("dir"),id:Sp(r),style:A.floating}))},getContentProps(){return t.element(y(g({hidden:!p,dir:i("dir"),id:_l(r),role:m?"listbox":"dialog"},_e.content.attrs),{"data-state":p?"open":"closed","data-placement":b,"data-activedescendant":P,"aria-activedescendant":m?P:void 0,"aria-multiselectable":i("multiple")&&m?!0:void 0,"aria-labelledby":Ta(r),tabIndex:0,onKeyDown(x){if(!S||!ce(x.currentTarget,j(x)))return;if(x.key==="Tab"&&!ds(x)){x.preventDefault();return}let k={ArrowUp(){o({type:"CONTENT.ARROW_UP"})},ArrowDown(){o({type:"CONTENT.ARROW_DOWN"})},Home(){o({type:"CONTENT.HOME"})},End(){o({type:"CONTENT.END"})},Enter(){o({type:"ITEM.CLICK",src:"keydown.enter"})},Space($){var te;f?o({type:"CONTENT.TYPEAHEAD",key:$.key}):(te=k.Enter)==null||te.call(k,$)}},N=k[ge(x)];if(N){N(x),x.preventDefault();return}let D=j(x);Ot(D)||Ue.isValidEvent(x)&&(o({type:"CONTENT.TYPEAHEAD",key:x.key}),x.preventDefault())}}))},getListProps(){return t.element(y(g({},_e.list.attrs),{tabIndex:0,role:m?void 0:"listbox","aria-labelledby":Gl(r),"aria-activedescendant":m?void 0:P,"aria-multiselectable":!m&&i("multiple")?!0:void 0}))}}}function Ip(e){var n,i;let t=(i=e.restoreFocus)!=null?i:(n=e.previousEvent)==null?void 0:n.restoreFocus;return t==null||!!t}function Pp(e,t){return Ki(t?{items:e,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var i;return(i=n.group)!=null?i:""}}:{items:e,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled})}function WO(e){return e.replace(/_([a-z])/g,(t,n)=>n.toUpperCase())}function KO(e){let t={};for(let[n,i]of Object.entries(e)){let r=WO(n);t[r]=i}return t}var NO,_e,Ki,RO,_l,Gl,Cp,Ta,DO,Ul,ql,Sp,LO,bp,Hl,$r,ri,MO,Ep,Bl,Hr,ii,$O,HO,BO,GA,_O,UA,GO,qA,UO,WA,qO,zO,Op=re(()=>{"use strict";yr();Pr();Wn();tn();se();NO=U("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),_e=NO.build(),Ki=e=>new Nt(e);Ki.empty=()=>new Nt({items:[]});RO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`select:${e.id}`},_l=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`select:${e.id}:content`},Gl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`select:${e.id}:trigger`},Cp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`select:${e.id}:clear-trigger`},Ta=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`select:${e.id}:label`},DO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`select:${e.id}:control`},Ul=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:option:${t}`},ql=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenSelect)!=null?n:`select:${e.id}:select`},Sp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`select:${e.id}:positioner`},LO=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:optgroup:${t}`},bp=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:optgroup-label:${t}`},Hl=e=>e.getById(ql(e)),$r=e=>e.getById(_l(e)),ri=e=>e.getById(Gl(e)),MO=e=>e.getById(Cp(e)),Ep=e=>e.getById(Sp(e)),Bl=(e,t)=>t==null?null:e.getById(Ul(e,t));({and:Hr,not:ii,or:$O}=Ee()),HO={props({props:e}){var t;return y(g({loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[]},e),{collection:(t=e.collection)!=null?t:Ki.empty(),positioning:g({placement:"bottom-start",gutter:8},e.positioning)})},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:fe,onChange(n){var r;let i=e("collection").findMany(n);return(r=e("onValueChange"))==null?void 0:r({value:n,items:i})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(n){var i;(i=e("onHighlightChange"))==null||i({highlightedValue:n,highlightedItem:e("collection").find(n),highlightedIndex:e("collection").indexOf(n)})}})),currentPlacement:t(()=>({defaultValue:void 0})),fieldsetDisabled:t(()=>({defaultValue:!1})),highlightedItem:t(()=>({defaultValue:null})),selectedItems:t(()=>{var r,s;let n=(s=(r=e("value"))!=null?r:e("defaultValue"))!=null?s:[];return{defaultValue:e("collection").findMany(n)}})}},refs(){return{typeahead:g({},Ue.defaultOptions)}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isDisabled:({prop:e,context:t})=>!!e("disabled")||!!t.get("fieldsetDisabled"),isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),valueAsString:({context:e,prop:t})=>t("collection").stringifyItems(e.get("selectedItems"))},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},entry:["syncSelectElement"],watch({context:e,prop:t,track:n,action:i}){n([()=>e.get("value").toString()],()=>{i(["syncSelectedItems","syncSelectElement","dispatchChangeEvent"])}),n([()=>t("open")],()=>{i(["toggleVisibility"])}),n([()=>e.get("highlightedValue")],()=>{i(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{i(["syncCollection"])})},on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"CLEAR.CLICK":{actions:["clearSelectedItems","focusTriggerEl"]}},effects:["trackFormControlState"],states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{target:"open",actions:["setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus","highlightFirstSelectedItem"]}],"TRIGGER.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{guard:"isTriggerArrowUpEvent",target:"open",actions:["setInitialFocus","highlightComputedLastItem"]},{guard:$O("isTriggerArrowDownEvent","isTriggerEnterEvent"),target:"open",actions:["setInitialFocus","highlightComputedFirstItem"]},{target:"open",actions:["setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}],"TRIGGER.BLUR":{target:"idle"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightFirstSelectedItem"]}],"TRIGGER.ENTER":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_UP":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedLastItem"]}],"TRIGGER.ARROW_DOWN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_LEFT":[{guard:Hr(ii("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:ii("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:Hr(ii("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:ii("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:ii("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:ii("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:ii("multiple"),actions:["selectMatchingItem"]}}},open:{tags:["open"],exit:["scrollContentToTop"],effects:["trackDismissableElement","computePlacement","scrollToHighlightedItem"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["clearHighlightedItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"restoreFocus",target:"focused",actions:["invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["invokeOnClose","clearHighlightedItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","clearHighlightedItem"]}],"ITEM.CLICK":[{guard:Hr("closeOnSelect","isOpenControlled"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{actions:["selectHighlightedItem"]}],"CONTENT.HOME":{actions:["highlightFirstItem"]},"CONTENT.END":{actions:["highlightLastItem"]},"CONTENT.ARROW_DOWN":[{guard:Hr("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:Hr("hasHighlightedItem","loop","isFirstItemHighlighted"),actions:["highlightLastItem"]},{guard:"hasHighlightedItem",actions:["highlightPreviousItem"]},{actions:["highlightLastItem"]}],"CONTENT.TYPEAHEAD":{actions:["highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{loop:({prop:e})=>!!e("loopFocus"),multiple:({prop:e})=>!!e("multiple"),hasSelectedItems:({computed:e})=>!!e("hasSelectedItems"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,isFirstItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").firstValue,isLastItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").lastValue,closeOnSelect:({prop:e,event:t})=>{var n;return!!((n=t.closeOnSelect)!=null?n:e("closeOnSelect"))},restoreFocus:({event:e})=>Ip(e),isOpenControlled:({prop:e})=>e("open")!==void 0,isTriggerClickEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.CLICK"},isTriggerEnterEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ENTER"},isTriggerArrowUpEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ARROW_UP"},isTriggerArrowDownEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ARROW_DOWN"}},effects:{trackFormControlState({context:e,scope:t}){return wt(Hl(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){let n=e.initial("value");e.set("value",n)}})},trackDismissableElement({scope:e,send:t,prop:n}){let i=()=>$r(e),r=!0;return Ft(i,{type:"listbox",defer:!0,exclude:[ri(e),MO(e)],onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(s){var a;(a=n("onInteractOutside"))==null||a(s),r=!(s.detail.focusable||s.detail.contextmenu)},onDismiss(){t({type:"CLOSE",src:"interact-outside",restoreFocus:r})}})},computePlacement({context:e,prop:t,scope:n}){let i=t("positioning");return e.set("currentPlacement",i.placement),It(()=>ri(n),()=>Ep(n),y(g({defer:!0},i),{onComplete(a){e.set("currentPlacement",a.placement)}}))},scrollToHighlightedItem({context:e,prop:t,scope:n,event:i}){let r=a=>{let o=e.get("highlightedValue");if(o==null||i.current().type.includes("POINTER"))return;let l=$r(n),c=t("scrollToIndexFn");if(c){let h=t("collection").indexOf(o);c==null||c({index:h,immediate:a,getElement:()=>Bl(n,o)});return}let u=Bl(n,o);Xt(u,{rootEl:l,block:"nearest"})};return H(()=>r(!0)),ot(()=>$r(n),{defer:!0,attributes:["data-activedescendant"],callback(){r(!1)}})}},actions:{reposition({context:e,prop:t,scope:n,event:i}){let r=()=>Ep(n);It(ri(n),r,y(g(g({},t("positioning")),i.options),{defer:!0,listeners:!1,onComplete(s){e.set("currentPlacement",s.placement)}}))},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})},highlightPreviousItem({context:e,prop:t}){let n=e.get("highlightedValue");if(n==null)return;let i=t("collection").getPreviousValue(n,1,t("loopFocus"));i!=null&&e.set("highlightedValue",i)},highlightNextItem({context:e,prop:t}){let n=e.get("highlightedValue");if(n==null)return;let i=t("collection").getNextValue(n,1,t("loopFocus"));i!=null&&e.set("highlightedValue",i)},highlightFirstItem({context:e,prop:t}){let n=t("collection").firstValue;e.set("highlightedValue",n)},highlightLastItem({context:e,prop:t}){let n=t("collection").lastValue;e.set("highlightedValue",n)},setInitialFocus({scope:e}){H(()=>{let t=us({root:$r(e)});t==null||t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){Ip(e)&&H(()=>{let n=ri(t);n==null||n.focus({preventScroll:!0})})},selectHighlightedItem({context:e,prop:t,event:n}){var s,a;let i=(s=n.value)!=null?s:e.get("highlightedValue");if(i==null||!t("collection").has(i))return;(a=t("onSelect"))==null||a({value:i}),i=t("deselectable")&&!t("multiple")&&e.get("value").includes(i)?null:i,e.set("value",o=>i==null?[]:t("multiple")?yt(o,i):[i])},highlightComputedFirstItem({context:e,prop:t,computed:n}){let i=t("collection"),r=n("hasSelectedItems")?i.sort(e.get("value"))[0]:i.firstValue;e.set("highlightedValue",r)},highlightComputedLastItem({context:e,prop:t,computed:n}){let i=t("collection"),r=n("hasSelectedItems")?i.sort(e.get("value"))[0]:i.lastValue;e.set("highlightedValue",r)},highlightFirstSelectedItem({context:e,prop:t,computed:n}){if(!n("hasSelectedItems"))return;let i=t("collection").sort(e.get("value"))[0];e.set("highlightedValue",i)},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:i}){let r=t("collection").search(n.key,{state:i.get("typeahead"),currentValue:e.get("highlightedValue")});r!=null&&e.set("highlightedValue",r)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n}){var s;(s=t("onSelect"))==null||s({value:n.value});let r=t("deselectable")&&!t("multiple")&&e.get("value").includes(n.value)?null:n.value;e.set("value",a=>r==null?[]:t("multiple")?yt(a,r):[r])},clearItem({context:e,event:t}){e.set("value",n=>n.filter(i=>i!==t.value))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},selectPreviousItem({context:e,prop:t}){let[n]=e.get("value"),i=t("collection").getPreviousValue(n);i&&e.set("value",[i])},selectNextItem({context:e,prop:t}){let[n]=e.get("value"),i=t("collection").getNextValue(n);i&&e.set("value",[i])},selectFirstItem({context:e,prop:t}){let n=t("collection").firstValue;n&&e.set("value",[n])},selectLastItem({context:e,prop:t}){let n=t("collection").lastValue;n&&e.set("value",[n])},selectMatchingItem({context:e,prop:t,event:n,refs:i}){let r=t("collection").search(n.key,{state:i.get("typeahead"),currentValue:e.get("value")[0]});r!=null&&e.set("value",[r])},scrollContentToTop({prop:e,scope:t}){var n,i;if(e("scrollToIndexFn")){let r=e("collection").firstValue;(n=e("scrollToIndexFn"))==null||n({index:0,immediate:!0,getElement:()=>Bl(t,r)})}else(i=$r(t))==null||i.scrollTo(0,0)},invokeOnOpen({prop:e,context:t}){var n;(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},syncSelectElement({context:e,prop:t,scope:n}){let i=Hl(n);if(i){if(e.get("value").length===0&&!t("multiple")){i.selectedIndex=-1;return}for(let r of i.options)r.selected=e.get("value").includes(r.value)}},syncCollection({context:e,prop:t}){let n=t("collection"),i=n.find(e.get("highlightedValue"));i&&e.set("highlightedItem",i);let r=n.findMany(e.get("value"));e.set("selectedItems",r)},syncSelectedItems({context:e,prop:t}){let n=t("collection"),i=e.get("selectedItems"),s=e.get("value").map(a=>i.find(l=>n.getItemValue(l)===a)||n.find(a));e.set("selectedItems",s)},syncHighlightedItem({context:e,prop:t}){let n=t("collection"),i=e.get("highlightedValue"),r=i?n.find(i):null;e.set("highlightedItem",r)},dispatchChangeEvent({scope:e}){queueMicrotask(()=>{let t=Hl(e);if(!t)return;let n=e.getWin(),i=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(i)})}}}};BO=_()(["closeOnSelect","collection","composite","defaultHighlightedValue","defaultOpen","defaultValue","deselectable","dir","disabled","form","getRootNode","highlightedValue","id","ids","invalid","loopFocus","multiple","name","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onSelect","onValueChange","open","positioning","readOnly","required","scrollToIndexFn","value"]),GA=B(BO),_O=_()(["item","persistFocus"]),UA=B(_O),GO=_()(["id"]),qA=B(GO),UO=_()(["htmlFor"]),WA=B(UO),qO=class extends K{constructor(t,n){var r;super(t,n);z(this,"_options",[]);z(this,"hasGroups",!1);z(this,"placeholder","");z(this,"init",()=>{this.machine.start(),this.render(),this.machine.subscribe(()=>{this.api=this.initApi(),this.render()})});let i=n.collection;this._options=(r=i==null?void 0:i.items)!=null?r:[],this.placeholder=O(this.el,"placeholder")||""}get options(){return Array.isArray(this._options)?this._options:[]}setOptions(t){this._options=Array.isArray(t)?t:[]}getCollection(){let t=this.options;return this.hasGroups?Ki({items:t,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var i;return(i=n.group)!=null?i:""}}):Ki({items:t,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled})}initMachine(t){let n=this.getCollection.bind(this),i=t.collection;return new W(HO,y(g({},t),{get collection(){return i!=null?i:n()}}))}initApi(){return FO(this.machine.service,q)}applyItemProps(){let t=this.el.querySelector('[data-scope="select"][data-part="content"]');t&&(t.querySelectorAll('[data-scope="select"][data-part="item-group"]').forEach(n=>{var s;let i=(s=n.dataset.id)!=null?s:"";this.spreadProps(n,this.api.getItemGroupProps({id:i}));let r=n.querySelector('[data-scope="select"][data-part="item-group-label"]');r&&this.spreadProps(r,this.api.getItemGroupLabelProps({htmlFor:i}))}),t.querySelectorAll('[data-scope="select"][data-part="item"]').forEach(n=>{var o;let i=(o=n.dataset.value)!=null?o:"",r=this.options.find(l=>{var c,u;return String((u=(c=l.id)!=null?c:l.value)!=null?u:"")===String(i)});if(!r)return;this.spreadProps(n,this.api.getItemProps({item:r}));let s=n.querySelector('[data-scope="select"][data-part="item-text"]');s&&this.spreadProps(s,this.api.getItemTextProps({item:r}));let a=n.querySelector('[data-scope="select"][data-part="item-indicator"]');a&&this.spreadProps(a,this.api.getItemIndicatorProps({item:r}))}))}render(){var a;let t=(a=this.el.querySelector('[data-scope="select"][data-part="root"]'))!=null?a:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="select"][data-part="hidden-select"]'),i=this.el.querySelector('[data-scope="select"][data-part="value-input"]');i&&(!this.api.value||this.api.value.length===0?i.value="":this.api.value.length===1?i.value=String(this.api.value[0]):i.value=this.api.value.map(String).join(",")),n&&this.spreadProps(n,this.api.getHiddenSelectProps()),["label","control","trigger","indicator","clear-trigger","positioner"].forEach(o=>{let l=this.el.querySelector(`[data-scope="select"][data-part="${o}"]`);if(!l)return;let c="get"+o.split("-").map(u=>u[0].toUpperCase()+u.slice(1)).join("")+"Props";this.spreadProps(l,this.api[c]())});let r=this.el.querySelector('[data-scope="select"][data-part="item-text"]');if(r){let o=this.api.valueAsString;if(this.api.value&&this.api.value.length>0&&!o){let l=this.api.value[0],c=this.options.find(u=>{var m,d;let h=(d=(m=u.id)!=null?m:u.value)!=null?d:"";return String(h)===String(l)});c?r.textContent=c.label:r.textContent=this.placeholder||""}else r.textContent=o||this.placeholder||""}let s=this.el.querySelector('[data-scope="select"][data-part="content"]');s&&(this.spreadProps(s,this.api.getContentProps()),this.applyItemProps())}};zO={mounted(){let e=this.el,t=JSON.parse(e.dataset.collection||"[]"),n=t.some(s=>s.group!==void 0),i=Pp(t,n),r=new qO(e,y(g({id:e.id,collection:i},C(e,"controlled")?{value:Z(e,"value")}:{defaultValue:Z(e,"defaultValue")}),{disabled:C(e,"disabled"),closeOnSelect:C(e,"closeOnSelect"),dir:O(e,"dir",["ltr","rtl"]),loopFocus:C(e,"loopFocus"),multiple:C(e,"multiple"),invalid:C(e,"invalid"),name:O(e,"name"),form:O(e,"form"),readOnly:C(e,"readOnly"),required:C(e,"required"),positioning:(()=>{let s=e.dataset.positioning;if(s)try{let a=JSON.parse(s);return KO(a)}catch(a){return}})(),onValueChange:s=>{var T;let a=C(e,"redirect"),o=s.value.length>0?String(s.value[0]):null,l=(T=s.items)!=null&&T.length?s.items[0]:null,c=l&&typeof l=="object"&&l!==null&&"redirect"in l?l.redirect:void 0,u=l&&typeof l=="object"&&l!==null&&"new_tab"in l?l.new_tab:void 0;a&&o&&this.liveSocket.main.isDead&&c!==!1&&(u===!0?window.open(o,"_blank","noopener,noreferrer"):window.location.href=o);let d=e.querySelector('[data-scope="select"][data-part="value-input"]');d&&(d.value=s.value.length===0?"":s.value.length===1?String(s.value[0]):s.value.map(String).join(","),d.dispatchEvent(new Event("input",{bubbles:!0})),d.dispatchEvent(new Event("change",{bubbles:!0})));let p={value:s.value,items:s.items,id:e.id},v=O(e,"onValueChangeClient");v&&e.dispatchEvent(new CustomEvent(v,{bubbles:!0,detail:p}));let I=O(e,"onValueChange");I&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(I,p)}}));r.hasGroups=n,r.setOptions(t),r.init(),this.select=r,this.handlers=[]},updated(){let e=JSON.parse(this.el.dataset.collection||"[]"),t=e.some(n=>n.group!==void 0);this.select&&(this.select.hasGroups=t,this.select.setOptions(e),this.select.updateProps(y(g({collection:Pp(e,t),id:this.el.id},C(this.el,"controlled")?{value:Z(this.el,"value")}:{defaultValue:Z(this.el,"defaultValue")}),{name:O(this.el,"name"),form:O(this.el,"form"),disabled:C(this.el,"disabled"),multiple:C(this.el,"multiple"),dir:O(this.el,"dir",["ltr","rtl"]),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly")})))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.select)==null||e.destroy()}}});var Kp={};he(Kp,{SignaturePad:()=>Ew});function xp(e,t,n,i=r=>r){return e*i(.5-t*(.5-n))}function Bp(e,t,n){let i=Wl(1,t/n);return Wl(1,e+(Wl(1,1-i)-e)*(i*.275))}function jO(e){return[-e[0],-e[1]]}function Bt(e,t){return[e[0]+t[0],e[1]+t[1]]}function Ap(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function Nn(e,t){return[e[0]-t[0],e[1]-t[1]]}function Yl(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function kn(e,t){return[e[0]*t,e[1]*t]}function Kl(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function XO(e,t){return[e[0]/t,e[1]/t]}function _p(e){return[e[1],-e[0]]}function zl(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function kp(e,t){return e[0]*t[0]+e[1]*t[1]}function ZO(e,t){return e[0]===t[0]&&e[1]===t[1]}function JO(e){return Math.hypot(e[0],e[1])}function Np(e,t){let n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i}function Gp(e){return XO(e,JO(e))}function QO(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function jl(e,t,n){let i=Math.sin(n),r=Math.cos(n),s=e[0]-t[0],a=e[1]-t[1],o=s*r-a*i,l=s*i+a*r;return[o+t[0],l+t[1]]}function Rp(e,t,n,i){let r=Math.sin(i),s=Math.cos(i),a=t[0]-n[0],o=t[1]-n[1],l=a*s-o*r,c=a*r+o*s;return e[0]=l+n[0],e[1]=c+n[1],e}function Dp(e,t,n){return Bt(e,kn(Nn(t,e),n))}function ew(e,t,n,i){let r=n[0]-t[0],s=n[1]-t[1];return e[0]=t[0]+r*i,e[1]=t[1]+s*i,e}function Up(e,t,n){return Bt(e,kn(t,n))}function tw(e,t){let n=Up(e,Gp(_p(Nn(e,Bt(e,[1,1])))),-t),i=[],r=1/13;for(let s=r;s<=1;s+=r)i.push(jl(n,e,Br*2*s));return i}function nw(e,t,n){let i=[],r=1/n;for(let s=r;s<=1;s+=r)i.push(jl(t,e,Br*s));return i}function iw(e,t,n){let i=Nn(t,n),r=kn(i,.5),s=kn(i,.51);return[Nn(e,r),Nn(e,s),Bt(e,s),Bt(e,r)]}function rw(e,t,n,i){let r=[],s=Up(e,t,n),a=1/i;for(let o=a;o<1;o+=a)r.push(jl(s,e,Br*3*o));return r}function sw(e,t,n){return[Bt(e,kn(t,n)),Bt(e,kn(t,n*.99)),Nn(e,kn(t,n*.99)),Nn(e,kn(t,n))]}function Lp(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function aw(e,t,n){return e.slice(0,10).reduce((i,r)=>{let s=r.pressure;return t&&(s=Bp(i,r.distance,n)),(i+s)/2},e[0].pressure)}function ow(e,t={}){let{size:n=16,smoothing:i=.5,thinning:r=.5,simulatePressure:s=!0,easing:a=Q=>Q,start:o={},end:l={},last:c=!1}=t,{cap:u=!0,easing:h=Q=>Q*(2-Q)}=o,{cap:m=!0,easing:d=Q=>--Q*Q*Q+1}=l;if(e.length===0||n<=0)return[];let p=e[e.length-1].runningLength,v=Lp(o.taper,n,p),I=Lp(l.taper,n,p),T=(n*i)**2,w=[],b=[],f=aw(e,s,n),S=xp(n,r,e[e.length-1].pressure,a),P,V=e[0].vector,A=e[0].point,x=A,k=A,N=x,D=!1;for(let Q=0;QT)&&(w.push(k),A=k),Ap(An,Pe,De),N=[An[0],An[1]],(Q<=1||Np(x,N)>T)&&(b.push(N),x=N),f=Se,V=ne}let $=[e[0].point[0],e[0].point[1]],te=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:Bt(e[0].point,[1,1]),J=[],ie=[];if(e.length===1){if(!(v||I)||c)return tw($,P||S)}else{v||I&&e.length===1||(u?J.push(...nw($,b[0],13)):J.push(...iw($,w[0],b[0])));let Q=_p(jO(e[e.length-1].vector));I||v&&e.length===1?ie.push(te):m?ie.push(...rw(te,Q,S,29)):ie.push(...sw(te,Q,S))}return w.concat(ie,b.reverse(),J)}function Fp(e){return e!=null&&e>=0}function lw(e,t={}){var m;let{streamline:n=.5,size:i=16,last:r=!1}=t;if(e.length===0)return[];let s=.15+(1-n)*.85,a=Array.isArray(e[0])?e:e.map(({x:d,y:p,pressure:v=wp})=>[d,p,v]);if(a.length===2){let d=a[1];a=a.slice(0,-1);for(let p=1;p<5;p++)a.push(Dp(a[0],d,p/4))}a.length===1&&(a=[...a,[...Bt(a[0],Vp),...a[0].slice(2)]]);let o=[{point:[a[0][0],a[0][1]],pressure:Fp(a[0][2])?a[0][2]:.25,vector:[...Vp],distance:0,runningLength:0}],l=!1,c=0,u=o[0],h=a.length-1;for(let d=1;d{"use strict";se();({PI:YO}=Math),Br=YO+1e-4,wp=.5,Vp=[1,1];({min:Wl}=Math);De=[0,0],xn=[0,0],An=[0,0];Mp=[0,0];uw=cw,dw=U("signature-pad").parts("root","control","segment","segmentPath","guide","clearTrigger","label"),si=dw.build(),hw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`signature-${e.id}`},qp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`signature-control-${e.id}`},gw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`signature-label-${e.id}`},$p=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`signature-input-${e.id}`},Va=e=>e.getById(qp(e)),pw=e=>vi(Va(e),"[data-part=segment]"),Wp=(e,t)=>Sc(pw(e),t);Oa=(e,t)=>(e+t)/2;vw={props({props:e}){return y(g({defaultPaths:[]},e),{drawing:g({size:2,simulatePressure:!1,thinning:.7,smoothing:.4,streamline:.6},e.drawing),translations:g({control:"signature pad",clearTrigger:"clear signature"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{paths:t(()=>({defaultValue:e("defaultPaths"),value:e("paths"),sync:!0,onChange(n){var i;(i=e("onDraw"))==null||i({paths:n})}})),currentPoints:t(()=>({defaultValue:[]})),currentPath:t(()=>({defaultValue:null}))}},computed:{isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),isEmpty:({context:e})=>e.get("paths").length===0},on:{CLEAR:{actions:["clearPoints","invokeOnDrawEnd","focusCanvasEl"]}},states:{idle:{on:{POINTER_DOWN:{target:"drawing",actions:["addPoint"]}}},drawing:{effects:["trackPointerMove"],on:{POINTER_MOVE:{actions:["addPoint","invokeOnDraw"]},POINTER_UP:{target:"idle",actions:["endStroke","invokeOnDrawEnd"]}}}},implementations:{effects:{trackPointerMove({scope:e,send:t}){let n=e.getDoc();return hn(n,{onPointerMove({event:i,point:r}){let s=Va(e);if(!s)return;let{offset:a}=to(r,s);t({type:"POINTER_MOVE",point:a,pressure:i.pressure})},onPointerUp(){t({type:"POINTER_UP"})}})}},actions:{addPoint({context:e,event:t,prop:n}){let i=[...e.get("currentPoints"),t.point];e.set("currentPoints",i);let r=uw(i,n("drawing"));e.set("currentPath",mw(r))},endStroke({context:e}){let t=[...e.get("paths"),e.get("currentPath")];e.set("paths",t),e.set("currentPoints",[]),e.set("currentPath",null)},clearPoints({context:e}){e.set("currentPoints",[]),e.set("paths",[]),e.set("currentPath",null)},focusCanvasEl({scope:e}){queueMicrotask(()=>{var t;(t=e.getActiveElement())==null||t.focus({preventScroll:!0})})},invokeOnDraw({context:e,prop:t}){var n;(n=t("onDraw"))==null||n({paths:[...e.get("paths"),e.get("currentPath")]})},invokeOnDrawEnd({context:e,prop:t,scope:n,computed:i}){var r;(r=t("onDrawEnd"))==null||r({paths:[...e.get("paths")],getDataUrl(s,a=.92){return i("isEmpty")?Promise.resolve(""):Wp(n,{type:s,quality:a})}})}}}},yw=_()(["defaultPaths","dir","disabled","drawing","getRootNode","id","ids","name","onDraw","onDrawEnd","paths","readOnly","required","translations"]),jA=B(yw),bw=class extends K{constructor(){super(...arguments);z(this,"imageURL","");z(this,"paths",[]);z(this,"name");z(this,"syncPaths",()=>{let t=this.el.querySelector('[data-scope="signature-pad"][data-part="segment"]');if(!t)return;if(this.api.paths.length+(this.api.currentPath?1:0)===0){t.innerHTML="",this.imageURL="",this.paths=[];let i=this.el.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');i&&(i.value="");return}if(t.innerHTML="",this.api.paths.forEach(i=>{let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("data-scope","signature-pad"),r.setAttribute("data-part","path"),this.spreadProps(r,this.api.getSegmentPathProps({path:i})),t.appendChild(r)}),this.api.currentPath){let i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("data-scope","signature-pad"),i.setAttribute("data-part","current-path"),this.spreadProps(i,this.api.getSegmentPathProps({path:this.api.currentPath})),t.appendChild(i)}})}initMachine(t){return this.name=t.name,new W(vw,t)}setName(t){this.name=t}setPaths(t){this.paths=t}initApi(){return fw(this.machine.service,q)}render(){let t=this.el.querySelector('[data-scope="signature-pad"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps());let n=t.querySelector('[data-scope="signature-pad"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=t.querySelector('[data-scope="signature-pad"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps());let r=t.querySelector('[data-scope="signature-pad"][data-part="segment"]');r&&this.spreadProps(r,this.api.getSegmentProps());let s=t.querySelector('[data-scope="signature-pad"][data-part="guide"]');s&&this.spreadProps(s,this.api.getGuideProps());let a=t.querySelector('[data-scope="signature-pad"][data-part="clear-trigger"]');if(a){this.spreadProps(a,this.api.getClearTriggerProps());let l=this.api.paths.length>0||!!this.api.currentPath;a.hidden=!l}let o=t.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');if(o){let l=this.paths.length>0?this.paths:this.api.paths;this.paths.length===0&&this.api.paths.length>0&&(this.paths=[...this.api.paths]);let c=l.length>0?JSON.stringify(l):"";this.spreadProps(o,this.api.getHiddenInputProps({value:c})),this.name&&(o.name=this.name),o.value=c}this.syncPaths()}};Ew={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=C(e,"controlled"),i=wa(e,"paths"),r=wa(e,"defaultPaths"),s=new bw(e,y(g(g({id:e.id,name:O(e,"name")},n&&i.length>0?{paths:i}:void 0),!n&&r.length>0?{defaultPaths:r}:void 0),{drawing:Hp(e),onDrawEnd:o=>{s.setPaths(o.paths);let l=e.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');l&&(l.value=JSON.stringify(o.paths)),o.getDataUrl("image/png").then(c=>{s.imageURL=c;let u=O(e,"onDrawEnd");u&&this.liveSocket.main.isConnected()&&t(u,{id:e.id,paths:o.paths,url:c});let h=O(e,"onDrawEndClient");h&&e.dispatchEvent(new CustomEvent(h,{bubbles:!0,detail:{id:e.id,paths:o.paths,url:c}}))})}}));if(s.init(),this.signaturePad=s,(n?i:r).length>0){let o=e.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');o&&(o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0})))}this.onClear=o=>{let{id:l}=o.detail;if(l&&l!==e.id)return;s.api.clear(),s.imageURL="",s.setPaths([]);let c=e.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');c&&(c.value="")},e.addEventListener("phx:signature-pad:clear",this.onClear),this.handlers=[],this.handlers.push(this.handleEvent("signature_pad_clear",o=>{let l=o.signature_pad_id;if(l&&l!==e.id)return;s.api.clear(),s.imageURL="",s.setPaths([]);let c=e.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');c&&(c.value="")}))},updated(){var r,s;let e=C(this.el,"controlled"),t=wa(this.el,"paths"),n=wa(this.el,"defaultPaths"),i=O(this.el,"name");i&&((r=this.signaturePad)==null||r.setName(i)),(s=this.signaturePad)==null||s.updateProps(y(g(g({id:this.el.id,name:i},e&&t.length>0?{paths:t}:{}),!e&&n.length>0?{defaultPaths:n}:{}),{drawing:Hp(this.el)}))},destroyed(){var e;if(this.onClear&&this.el.removeEventListener("phx:signature-pad:clear",this.onClear),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.signaturePad)==null||e.destroy()}}});var Zp={};he(Zp,{Switch:()=>xw});function Tw(e,t){let{context:n,send:i,prop:r,scope:s}=e,a=!!r("disabled"),o=!!r("readOnly"),l=!!r("required"),c=!!n.get("checked"),u=!a&&n.get("focused"),h=!a&&n.get("focusVisible"),m=!a&&n.get("active"),d={"data-active":E(m),"data-focus":E(u),"data-focus-visible":E(h),"data-readonly":E(o),"data-hover":E(n.get("hovered")),"data-disabled":E(a),"data-state":c?"checked":"unchecked","data-invalid":E(r("invalid")),"data-required":E(l)};return{checked:c,disabled:a,focused:u,setChecked(p){i({type:"CHECKED.SET",checked:p,isTrusted:!1})},toggleChecked(){i({type:"CHECKED.TOGGLE",checked:c,isTrusted:!1})},getRootProps(){return t.label(y(g(g({},xa.root.attrs),d),{dir:r("dir"),id:Xp(s),htmlFor:Xl(s),onPointerMove(){a||i({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){a||i({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(p){var I;if(a)return;j(p)===zi(s)&&p.stopPropagation(),Xe()&&((I=zi(s))==null||I.focus())}}))},getLabelProps(){return t.element(y(g(g({},xa.label.attrs),d),{dir:r("dir"),id:Yp(s)}))},getThumbProps(){return t.element(y(g(g({},xa.thumb.attrs),d),{dir:r("dir"),id:Pw(s),"aria-hidden":!0}))},getControlProps(){return t.element(y(g(g({},xa.control.attrs),d),{dir:r("dir"),id:Cw(s),"aria-hidden":!0}))},getHiddenInputProps(){return t.input({id:Xl(s),type:"checkbox",required:r("required"),defaultChecked:c,disabled:a,"aria-labelledby":Yp(s),"aria-invalid":r("invalid"),name:r("name"),form:r("form"),value:r("value"),style:Vt,onFocus(){let p=En();i({type:"CONTEXT.SET",context:{focused:!0,focusVisible:p}})},onBlur(){i({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(p){if(o){p.preventDefault();return}let v=p.currentTarget.checked;i({type:"CHECKED.SET",checked:v,isTrusted:!0})}})}}}var Iw,xa,Xp,Yp,Pw,Cw,Xl,Sw,zi,jp,Ow,ww,ek,Vw,xw,Jp=re(()=>{"use strict";pr();se();Iw=U("switch").parts("root","label","control","thumb"),xa=Iw.build(),Xp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`switch:${e.id}`},Yp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`switch:${e.id}:label`},Pw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.thumb)!=null?n:`switch:${e.id}:thumb`},Cw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`switch:${e.id}:control`},Xl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`switch:${e.id}:input`},Sw=e=>e.getById(Xp(e)),zi=e=>e.getById(Xl(e));({not:jp}=Ee()),Ow={props({props:e}){return g({defaultChecked:!1,label:"switch",value:"on"},e)},initialState(){return"ready"},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e("defaultChecked"),value:e("checked"),onChange(n){var i;(i=e("onCheckedChange"))==null||i({checked:n})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:e,prop:t})=>t("disabled")||e.get("fieldsetDisabled")},watch({track:e,prop:t,context:n,action:i}){e([()=>t("disabled")],()=>{i(["removeFocusIfNeeded"])}),e([()=>n.get("checked")],()=>{i(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:jp("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:jp("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({computed:e,scope:t,context:n}){if(!e("isDisabled"))return ps({pointerNode:Sw(t),keyboardNode:zi(t),isValidKey:i=>i.key===" ",onPress:()=>n.set("active",!1),onPressStart:()=>n.set("active",!0),onPressEnd:()=>n.set("active",!1)})},trackFocusVisible({computed:e,scope:t}){if(!e("isDisabled"))return Pn({root:t.getRootNode()})},trackFormControlState({context:e,send:t,scope:n}){return wt(zi(n),{onFieldsetDisabledChange(i){e.set("fieldsetDisabled",i)},onFormReset(){let i=e.initial("checked");t({type:"CHECKED.SET",checked:!!i,src:"form-reset"})}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,scope:t}){let n=zi(t);n&&sr(n,!!e.get("checked"))},removeFocusIfNeeded({context:e,prop:t}){t("disabled")&&e.set("focused",!1)},setChecked({context:e,event:t}){e.set("checked",t.checked)},toggleChecked({context:e}){e.set("checked",!e.get("checked"))},dispatchChangeEvent({context:e,scope:t}){queueMicrotask(()=>{let n=zi(t);pi(n,{checked:e.get("checked")})})}}}},ww=_()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]),ek=B(ww),Vw=class extends K{initMachine(e){return new W(Ow,e)}initApi(){return Tw(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="switch"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="switch"][data-part="hidden-input"]');t&&this.spreadProps(t,this.api.getHiddenInputProps());let n=this.el.querySelector('[data-scope="switch"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=this.el.querySelector('[data-scope="switch"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps());let r=this.el.querySelector('[data-scope="switch"][data-part="thumb"]');r&&this.spreadProps(r,this.api.getThumbProps())}},xw={mounted(){let e=this.el,t=this.pushEvent.bind(this);this.wasFocused=!1;let n=new Vw(e,y(g({id:e.id},C(e,"controlled")?{checked:C(e,"checked")}:{defaultChecked:C(e,"defaultChecked")}),{disabled:C(e,"disabled"),name:O(e,"name"),form:O(e,"form"),value:O(e,"value"),dir:O(e,"dir",["ltr","rtl"]),invalid:C(e,"invalid"),required:C(e,"required"),readOnly:C(e,"readOnly"),label:O(e,"label"),onCheckedChange:i=>{let r=O(e,"onCheckedChange");r&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(r,{checked:i.checked,id:e.id});let s=O(e,"onCheckedChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{value:i,id:e.id}}))}}));n.init(),this.zagSwitch=n,this.onSetChecked=i=>{let{value:r}=i.detail;n.api.setChecked(r)},e.addEventListener("phx:switch:set-checked",this.onSetChecked),this.handlers=[],this.handlers.push(this.handleEvent("switch_set_checked",i=>{let r=i.id;r&&r!==e.id||n.api.setChecked(i.value)})),this.handlers.push(this.handleEvent("switch_toggle_checked",i=>{let r=i.id;r&&r!==e.id||n.api.toggleChecked()})),this.handlers.push(this.handleEvent("switch_checked",()=>{this.pushEvent("switch_checked_response",{value:n.api.checked})})),this.handlers.push(this.handleEvent("switch_focused",()=>{this.pushEvent("switch_focused_response",{value:n.api.focused})})),this.handlers.push(this.handleEvent("switch_disabled",()=>{this.pushEvent("switch_disabled_response",{value:n.api.disabled})}))},beforeUpdate(){var e,t;this.wasFocused=(t=(e=this.zagSwitch)==null?void 0:e.api.focused)!=null?t:!1},updated(){var e;if((e=this.zagSwitch)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{checked:C(this.el,"checked")}:{defaultChecked:C(this.el,"defaultChecked")}),{disabled:C(this.el,"disabled"),name:O(this.el,"name"),form:O(this.el,"form"),value:O(this.el,"value"),dir:O(this.el,"dir",["ltr","rtl"]),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly"),label:O(this.el,"label")})),C(this.el,"controlled")&&this.wasFocused){let t=this.el.querySelector('[data-part="hidden-input"]');t==null||t.focus()}},destroyed(){var e;if(this.onSetChecked&&this.el.removeEventListener("phx:switch:set-checked",this.onSetChecked),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.zagSwitch)==null||e.destroy()}}});var nf={};he(nf,{Tabs:()=>Kw});function Hw(e,t){let{state:n,send:i,context:r,prop:s,scope:a}=e,o=s("translations"),l=n.matches("focused"),c=s("orientation")==="vertical",u=s("orientation")==="horizontal",h=s("composite");function m(d){return{selected:r.get("value")===d.value,focused:r.get("focusedValue")===d.value,disabled:!!d.disabled}}return{value:r.get("value"),focusedValue:r.get("focusedValue"),setValue(d){i({type:"SET_VALUE",value:d})},clearValue(){i({type:"CLEAR_VALUE"})},setIndicatorRect(d){let p=ai(a,d);i({type:"SET_INDICATOR_RECT",id:p})},syncTabIndex(){i({type:"SYNC_TAB_INDEX"})},selectNext(d){i({type:"TAB_FOCUS",value:d,src:"selectNext"}),i({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(d){i({type:"TAB_FOCUS",value:d,src:"selectPrev"}),i({type:"ARROW_PREV",src:"selectPrev"})},focus(){var p;let d=r.get("value");d&&((p=Aa(a,d))==null||p.focus())},getRootProps(){return t.element(y(g({},_r.root.attrs),{id:kw(a),"data-orientation":s("orientation"),"data-focus":E(l),dir:s("dir")}))},getListProps(){return t.element(y(g({},_r.list.attrs),{id:Gr(a),role:"tablist",dir:s("dir"),"data-focus":E(l),"aria-orientation":s("orientation"),"data-orientation":s("orientation"),"aria-label":o==null?void 0:o.listLabel,onKeyDown(d){if(d.defaultPrevented||Re(d)||!ce(d.currentTarget,j(d)))return;let p={ArrowDown(){u||i({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){u||i({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){c||i({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){c||i({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){i({type:"HOME"})},End(){i({type:"END"})}},v=ge(d,{dir:s("dir"),orientation:s("orientation")}),I=p[v];if(I){d.preventDefault(),I(d);return}}}))},getTriggerState:m,getTriggerProps(d){let{value:p,disabled:v}=d,I=m(d);return t.button(y(g({},_r.trigger.attrs),{role:"tab",type:"button",disabled:v,dir:s("dir"),"data-orientation":s("orientation"),"data-disabled":E(v),"aria-disabled":v,"data-value":p,"aria-selected":I.selected,"data-selected":E(I.selected),"data-focus":E(I.focused),"aria-controls":I.selected?Zl(a,p):void 0,"data-ownedby":Gr(a),"data-ssr":E(r.get("ssr")),id:ai(a,p),tabIndex:I.selected&&h?0:-1,onFocus(){i({type:"TAB_FOCUS",value:p})},onBlur(T){let w=T.relatedTarget;(w==null?void 0:w.getAttribute("role"))!=="tab"&&i({type:"TAB_BLUR"})},onClick(T){T.defaultPrevented||Fn(T)||v||(Xe()&&T.currentTarget.focus(),i({type:"TAB_CLICK",value:p}))}}))},getContentProps(d){let{value:p}=d,v=r.get("value")===p;return t.element(y(g({},_r.content.attrs),{dir:s("dir"),id:Zl(a,p),tabIndex:h?0:-1,"aria-labelledby":ai(a,p),role:"tabpanel","data-ownedby":Gr(a),"data-selected":E(v),"data-orientation":s("orientation"),hidden:!v}))},getIndicatorProps(){let d=r.get("indicatorRect"),p=d==null||d.width===0&&d.height===0&&d.x===0&&d.y===0;return t.element(y(g({id:ef(a)},_r.indicator.attrs),{dir:s("dir"),"data-orientation":s("orientation"),hidden:p,style:{"--transition-property":"left, right, top, bottom, width, height","--left":ye(d==null?void 0:d.x),"--top":ye(d==null?void 0:d.y),"--width":ye(d==null?void 0:d.width),"--height":ye(d==null?void 0:d.height),position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:"var(--transition-duration, 150ms)",transitionTimingFunction:"var(--transition-timing-function)",[u?"left":"top"]:u?"var(--left)":"var(--top)"}}))}}}var Aw,_r,kw,Gr,Zl,ai,ef,Nw,Rw,Aa,Qp,Yi,Dw,Lw,Mw,Fw,tf,$w,Bw,_w,Gw,rk,Uw,sk,qw,ak,Ww,Kw,rf=re(()=>{"use strict";se();Aw=U("tabs").parts("root","list","trigger","content","indicator"),_r=Aw.build(),kw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tabs:${e.id}`},Gr=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.list)!=null?n:`tabs:${e.id}:list`},Zl=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.content)==null?void 0:i.call(n,t))!=null?r:`tabs:${e.id}:content-${t}`},ai=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.trigger)==null?void 0:i.call(n,t))!=null?r:`tabs:${e.id}:trigger-${t}`},ef=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicator)!=null?n:`tabs:${e.id}:indicator`},Nw=e=>e.getById(Gr(e)),Rw=(e,t)=>e.getById(Zl(e,t)),Aa=(e,t)=>t!=null?e.getById(ai(e,t)):null,Qp=e=>e.getById(ef(e)),Yi=e=>{let n=`[role=tab][data-ownedby='${CSS.escape(Gr(e))}']:not([disabled])`;return Fe(Nw(e),n)},Dw=e=>lt(Yi(e)),Lw=e=>mt(Yi(e)),Mw=(e,t)=>yi(Yi(e),ai(e,t.value),t.loopFocus),Fw=(e,t)=>bi(Yi(e),ai(e,t.value),t.loopFocus),tf=e=>{var t,n,i,r;return{x:(t=e==null?void 0:e.offsetLeft)!=null?t:0,y:(n=e==null?void 0:e.offsetTop)!=null?n:0,width:(i=e==null?void 0:e.offsetWidth)!=null?i:0,height:(r=e==null?void 0:e.offsetHeight)!=null?r:0}},$w=(e,t)=>{let n=so(Yi(e),ai(e,t));return tf(n)};({createMachine:Bw}=ut()),_w=Bw({props({props:e}){return g({dir:"ltr",orientation:"horizontal",activationMode:"automatic",loopFocus:!0,composite:!0,navigate(t){mi(t.node)},defaultValue:null},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}})),focusedValue:t(()=>({defaultValue:e("value")||e("defaultValue"),sync:!0,onChange(n){var i;(i=e("onFocusChange"))==null||i({focusedValue:n})}})),ssr:t(()=>({defaultValue:!0})),indicatorRect:t(()=>({defaultValue:null}))}},watch({context:e,prop:t,track:n,action:i}){n([()=>e.get("value")],()=>{i(["syncIndicatorRect","syncTabIndex","navigateIfNeeded"])}),n([()=>t("dir"),()=>t("orientation")],()=>{i(["syncIndicatorRect"])})},on:{SET_VALUE:{actions:["setValue"]},CLEAR_VALUE:{actions:["clearValue"]},SET_INDICATOR_RECT:{actions:["setIndicatorRect"]},SYNC_TAB_INDEX:{actions:["syncTabIndex"]}},entry:["syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:["setFocusedValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:["focusPrevTab"]}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:["focusNextTab"]}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:["focusFirstTab"]}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:["focusLastTab"]}],TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{selectOnFocus:({prop:e})=>e("activationMode")==="automatic"},actions:{selectFocusedTab({context:e,prop:t}){H(()=>{let n=e.get("focusedValue");if(!n)return;let r=t("deselectable")&&e.get("value")===n?null:n;e.set("value",r)})},setFocusedValue({context:e,event:t,flush:n}){t.value!=null&&n(()=>{e.set("focusedValue",t.value)})},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t,prop:n}){let i=n("deselectable")&&e.get("value")===e.get("focusedValue");e.set("value",i?null:t.value)},clearValue({context:e}){e.set("value",null)},focusFirstTab({scope:e}){H(()=>{var t;(t=Dw(e))==null||t.focus()})},focusLastTab({scope:e}){H(()=>{var t;(t=Lw(e))==null||t.focus()})},focusNextTab({context:e,prop:t,scope:n,event:i}){var a;let r=(a=i.value)!=null?a:e.get("focusedValue");if(!r)return;let s=Mw(n,{value:r,loopFocus:t("loopFocus")});H(()=>{t("composite")?s==null||s.focus():(s==null?void 0:s.dataset.value)!=null&&e.set("focusedValue",s.dataset.value)})},focusPrevTab({context:e,prop:t,scope:n,event:i}){var a;let r=(a=i.value)!=null?a:e.get("focusedValue");if(!r)return;let s=Fw(n,{value:r,loopFocus:t("loopFocus")});H(()=>{t("composite")?s==null||s.focus():(s==null?void 0:s.dataset.value)!=null&&e.set("focusedValue",s.dataset.value)})},syncTabIndex({context:e,scope:t}){H(()=>{let n=e.get("value");if(!n)return;let i=Rw(t,n);if(!i)return;ar(i).length>0?i.removeAttribute("tabindex"):i.setAttribute("tabindex","0")})},cleanupObserver({refs:e}){let t=e.get("indicatorCleanup");t&&t()},setIndicatorRect({context:e,event:t,scope:n}){var a;let i=(a=t.id)!=null?a:e.get("value");!Qp(n)||!i||!Aa(n,i)||e.set("indicatorRect",$w(n,i))},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,refs:t,scope:n}){let i=t.get("indicatorCleanup");if(i&&i(),!Qp(n))return;let s=()=>{let l=Aa(n,e.get("value"));if(!l)return;let c=tf(l);e.set("indicatorRect",u=>fe(u,c)?u:c)};s();let a=Yi(n),o=At(...a.map(l=>gn.observe(l,s)));t.set("indicatorCleanup",o)},navigateIfNeeded({context:e,prop:t,scope:n}){var s;let i=e.get("value");if(!i)return;let r=Aa(n,i);st(r)&&((s=t("navigate"))==null||s({value:i,node:r,href:r.href}))}}}}),Gw=_()(["activationMode","composite","deselectable","dir","getRootNode","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value","defaultValue"]),rk=B(Gw),Uw=_()(["disabled","value"]),sk=B(Uw),qw=_()(["value"]),ak=B(qw),Ww=class extends K{initMachine(e){return new W(_w,e)}initApi(){return Hw(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="tabs"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector('[data-scope="tabs"][data-part="list"]');if(!t)return;this.spreadProps(t,this.api.getListProps());let n=this.el.getAttribute("data-items"),i=n?JSON.parse(n):[],r=t.querySelectorAll('[data-scope="tabs"][data-part="trigger"]');for(let a=0;a{var a,o;let r=O(e,"onValueChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,value:(a=i.value)!=null?a:null});let s=O(e,"onValueChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,value:(o=i.value)!=null?o:null}}))},onFocusChange:i=>{var a,o;let r=O(e,"onFocusChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,value:(a=i.focusedValue)!=null?a:null});let s=O(e,"onFocusChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,value:(o=i.focusedValue)!=null?o:null}}))}}));n.init(),this.tabs=n,this.onSetValue=i=>{let{value:r}=i.detail;n.api.setValue(r)},e.addEventListener("phx:tabs:set-value",this.onSetValue),this.handlers=[],this.handlers.push(this.handleEvent("tabs_set_value",i=>{let r=i.tabs_id;r&&r!==e.id||n.api.setValue(i.value)})),this.handlers.push(this.handleEvent("tabs_value",()=>{this.pushEvent("tabs_value_response",{value:n.api.value})})),this.handlers.push(this.handleEvent("tabs_focused_value",()=>{this.pushEvent("tabs_focused_value_response",{value:n.api.focusedValue})}))},updated(){var e;(e=this.tabs)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{value:O(this.el,"value")}:{defaultValue:O(this.el,"defaultValue")}),{orientation:O(this.el,"orientation",["horizontal","vertical"]),dir:O(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:tabs:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.tabs)==null||e.destroy()}}});var of={};he(of,{Timer:()=>rV});function Xw(e,t){let{state:n,send:i,computed:r,scope:s}=e,a=n.matches("running"),o=n.matches("paused"),l=r("time"),c=r("formattedTime"),u=r("progressPercent");return{running:a,paused:o,time:l,formattedTime:c,progressPercent:u,start(){i({type:"START"})},pause(){i({type:"PAUSE"})},resume(){i({type:"RESUME"})},reset(){i({type:"RESET"})},restart(){i({type:"RESTART"})},getRootProps(){return t.element(g({id:Yw(s)},Rn.root.attrs))},getAreaProps(){return t.element(g({role:"timer",id:jw(s),"aria-label":`${l.days} days ${c.hours}:${c.minutes}:${c.seconds}`,"aria-atomic":!0},Rn.area.attrs))},getControlProps(){return t.element(g({},Rn.control.attrs))},getItemProps(h){let m=l[h.type];return t.element(y(g({},Rn.item.attrs),{"data-type":h.type,style:{"--value":m}}))},getItemLabelProps(h){return t.element(y(g({},Rn.itemLabel.attrs),{"data-type":h.type}))},getItemValueProps(h){return t.element(y(g({},Rn.itemValue.attrs),{"data-type":h.type}))},getSeparatorProps(){return t.element(g({"aria-hidden":!0},Rn.separator.attrs))},getActionTriggerProps(h){if(!sf.has(h.action))throw new Error(`[zag-js] Invalid action: ${h.action}. Must be one of: ${Array.from(sf).join(", ")}`);return t.button(y(g({},Rn.actionTrigger.attrs),{hidden:Ce(h.action,{start:()=>a||o,pause:()=>!a,reset:()=>!a&&!o,resume:()=>!o,restart:()=>!1}),type:"button",onClick(m){m.defaultPrevented||i({type:h.action.toUpperCase()})}}))}}}function Jw(e){let t=Math.max(0,e),n=t%1e3,i=Math.floor(t/1e3)%60,r=Math.floor(t/(1e3*60))%60,s=Math.floor(t/(1e3*60*60))%24;return{days:Math.floor(t/(1e3*60*60*24)),hours:s,minutes:r,seconds:i,milliseconds:n}}function af(e,t,n){let i=n-t;return i===0?0:(e-t)/i}function Ur(e,t=2){return e.toString().padStart(t,"0")}function Qw(e,t){return Math.floor(e/t)*t}function eV(e){let{days:t,hours:n,minutes:i,seconds:r}=e;return{days:Ur(t),hours:Ur(n),minutes:Ur(i),seconds:Ur(r),milliseconds:Ur(e.milliseconds,3)}}function tV(e){let{startMs:t,targetMs:n,countdown:i,interval:r}=e;if(r!=null&&(typeof r!="number"||r<=0))throw new Error(`[timer] Invalid interval: ${r}. Must be a positive number.`);if(t!=null&&(typeof t!="number"||t<0))throw new Error(`[timer] Invalid startMs: ${t}. Must be a non-negative number.`);if(n!=null&&(typeof n!="number"||n<0))throw new Error(`[timer] Invalid targetMs: ${n}. Must be a non-negative number.`);if(i&&t!=null&&n!=null&&t<=n)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than targetMs (${n}).`);if(!i&&t!=null&&n!=null&&t>=n)throw new Error(`[timer] Invalid stopwatch configuration: startMs (${t}) must be less than targetMs (${n}).`);if(i&&n==null&&t!=null&&t<=0)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than 0 when no targetMs is provided.`)}var zw,Rn,Yw,jw,sf,Zw,nV,uk,iV,rV,lf=re(()=>{"use strict";se();zw=U("timer").parts("root","area","control","item","itemValue","itemLabel","actionTrigger","separator"),Rn=zw.build(),Yw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`timer:${e.id}:root`},jw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`timer:${e.id}:area`},sf=new Set(["start","pause","resume","reset","restart"]);Zw={props({props:e}){return tV(e),g({interval:1e3,startMs:0},e)},initialState({prop:e}){return e("autoStart")?"running":"idle"},context({prop:e,bindable:t}){return{currentMs:t(()=>({defaultValue:e("startMs")}))}},watch({track:e,send:t,prop:n}){e([()=>n("startMs")],()=>{t({type:"RESTART"})})},on:{RESTART:{target:"running:temp",actions:["resetTime"]}},computed:{time:({context:e})=>Jw(e.get("currentMs")),formattedTime:({computed:e})=>eV(e("time")),progressPercent:Bn(({context:e,prop:t})=>[e.get("currentMs"),t("targetMs"),t("startMs"),t("countdown")],([e,t=0,n,i])=>{let r=i?af(e,t,n):af(e,n,t);return He(r,0,1)})},states:{idle:{on:{START:{target:"running"},RESET:{actions:["resetTime"]}}},"running:temp":{effects:["waitForNextTick"],on:{CONTINUE:{target:"running"}}},running:{effects:["keepTicking"],on:{PAUSE:{target:"paused"},TICK:[{target:"idle",guard:"hasReachedTarget",actions:["invokeOnComplete"]},{actions:["updateTime","invokeOnTick"]}],RESET:{actions:["resetTime"]}}},paused:{on:{RESUME:{target:"running"},RESET:{target:"idle",actions:["resetTime"]}}}},implementations:{effects:{keepTicking({prop:e,send:t}){return su(({deltaMs:n})=>{t({type:"TICK",deltaMs:n})},e("interval"))},waitForNextTick({send:e}){return mn(()=>{e({type:"CONTINUE"})},0)}},actions:{updateTime({context:e,prop:t,event:n}){let i=t("countdown")?-1:1,r=Qw(n.deltaMs,t("interval"));e.set("currentMs",s=>{let a=s+i*r,o=t("targetMs");return o==null&&t("countdown")&&(o=0),t("countdown")&&o!=null?Math.max(a,o):!t("countdown")&&o!=null?Math.min(a,o):a})},resetTime({context:e,prop:t}){var i;let n=t("targetMs");n==null&&t("countdown")&&(n=0),e.set("currentMs",(i=t("startMs"))!=null?i:0)},invokeOnTick({context:e,prop:t,computed:n}){var i;(i=t("onTick"))==null||i({value:e.get("currentMs"),time:n("time"),formattedTime:n("formattedTime")})},invokeOnComplete({prop:e}){var t;(t=e("onComplete"))==null||t()}},guards:{hasReachedTarget:({context:e,prop:t})=>{let n=t("targetMs");if(n==null&&t("countdown")&&(n=0),n==null)return!1;let i=e.get("currentMs");return t("countdown")?i<=n:i>=n}}}};nV=_()(["autoStart","countdown","getRootNode","id","ids","interval","onComplete","onTick","startMs","targetMs"]),uk=B(nV),iV=class extends K{constructor(){super(...arguments);z(this,"init",()=>{this.machine.subscribe(()=>{this.api=this.initApi(),this.render()}),this.machine.start(),this.api=this.initApi(),this.render()})}initMachine(t){return new W(Zw,t)}initApi(){return Xw(this.machine.service,q)}render(){var a;let t=(a=this.el.querySelector('[data-scope="timer"][data-part="root"]'))!=null?a:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="timer"][data-part="area"]');n&&this.spreadProps(n,this.api.getAreaProps());let i=this.el.querySelector('[data-scope="timer"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps()),["days","hours","minutes","seconds"].forEach(o=>{let l=this.el.querySelector(`[data-scope="timer"][data-part="item"][data-type="${o}"]`);l&&this.spreadProps(l,this.api.getItemProps({type:o}))}),this.el.querySelectorAll('[data-scope="timer"][data-part="separator"]').forEach(o=>{this.spreadProps(o,this.api.getSeparatorProps())}),["start","pause","resume","reset"].forEach(o=>{let l=this.el.querySelector(`[data-scope="timer"][data-part="action-trigger"][data-action="${o}"]`);l&&this.spreadProps(l,this.api.getActionTriggerProps({action:o}))})}},rV={mounted(){var n;let e=this.el,t=new iV(e,{id:e.id,countdown:C(e,"countdown"),startMs:Y(e,"startMs"),targetMs:Y(e,"targetMs"),autoStart:C(e,"autoStart"),interval:(n=Y(e,"interval"))!=null?n:1e3,onTick:i=>{let r=O(e,"onTick");r&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(r,{value:i.value,time:i.time,formattedTime:i.formattedTime,id:e.id})},onComplete:()=>{let i=O(e,"onComplete");i&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(i,{id:e.id})}});t.init(),this.timer=t,this.handlers=[]},updated(){var e,t;(t=this.timer)==null||t.updateProps({id:this.el.id,countdown:C(this.el,"countdown"),startMs:Y(this.el,"startMs"),targetMs:Y(this.el,"targetMs"),autoStart:C(this.el,"autoStart"),interval:(e=Y(this.el,"interval"))!=null?e:1e3})},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.timer)==null||e.destroy()}}});var vf={};he(vf,{Toast:()=>VV});function Jl(e,t){var n;return(n=e!=null?e:gf[t])!=null?n:gf.DEFAULT}function cV(e,t){var v;let{prop:n,computed:i,context:r}=e,{offsets:s,gap:a}=n("store").attrs,o=r.get("heights"),l=lV(s),c=n("dir")==="rtl",u=t.replace("-start",c?"-right":"-left").replace("-end",c?"-left":"-right"),h=u.includes("right"),m=u.includes("left"),d={position:"fixed",pointerEvents:i("count")>0?void 0:"none",display:"flex",flexDirection:"column","--gap":`${a}px`,"--first-height":`${((v=o[0])==null?void 0:v.height)||0}px`,"--viewport-offset-left":l.left,"--viewport-offset-right":l.right,"--viewport-offset-top":l.top,"--viewport-offset-bottom":l.bottom,zIndex:ss},p="center";if(h&&(p="flex-end"),m&&(p="flex-start"),d.alignItems=p,u.includes("top")){let I=l.top;d.top=`max(env(safe-area-inset-top, 0px), ${I})`}if(u.includes("bottom")){let I=l.bottom;d.bottom=`max(env(safe-area-inset-bottom, 0px), ${I})`}if(!u.includes("left")){let I=l.right;d.insetInlineEnd=`calc(env(safe-area-inset-right, 0px) + ${I})`}if(!u.includes("right")){let I=l.left;d.insetInlineStart=`calc(env(safe-area-inset-left, 0px) + ${I})`}return d}function uV(e,t){let{prop:n,context:i,computed:r}=e,s=n("parent"),a=s.computed("placement"),{gap:o}=s.prop("store").attrs,[l]=a.split("-"),c=i.get("mounted"),u=i.get("remainingTime"),h=r("height"),m=r("frontmost"),d=!m,p=!n("stacked"),v=n("stacked"),T=n("type")==="loading"?Number.MAX_SAFE_INTEGER:u,w=r("heightIndex")*o+r("heightBefore"),b={position:"absolute",pointerEvents:"auto","--opacity":"0","--remove-delay":`${n("removeDelay")}ms`,"--duration":`${T}ms`,"--initial-height":`${h}px`,"--offset":`${w}px`,"--index":n("index"),"--z-index":r("zIndex"),"--lift-amount":"calc(var(--lift) * var(--gap))","--y":"100%","--x":"0"},f=S=>Object.assign(b,S);return l==="top"?f({top:"0","--sign":"-1","--y":"-100%","--lift":"1"}):l==="bottom"&&f({bottom:"0","--sign":"1","--y":"100%","--lift":"-1"}),c&&(f({"--y":"0","--opacity":"1"}),v&&f({"--y":"calc(var(--lift) * var(--offset))","--height":"var(--initial-height)"})),t||f({"--opacity":"0",pointerEvents:"none"}),d&&p&&(f({"--base-scale":"var(--index) * 0.05 + 1","--y":"calc(var(--lift-amount) * var(--index))","--scale":"calc(-1 * var(--base-scale))","--height":"var(--first-height)"}),t||f({"--y":"calc(var(--sign) * 40%)"})),d&&v&&!t&&f({"--y":"calc(var(--lift) * var(--offset) + var(--lift) * -100%)"}),m&&!t&&f({"--y":"calc(var(--lift) * -100%)"}),b}function dV(e,t){let{computed:n}=e,i={position:"absolute",inset:"0",scale:"1 2",pointerEvents:t?"none":"auto"},r=s=>Object.assign(i,s);return n("frontmost")&&!t&&r({height:"calc(var(--initial-height) + 80%)"}),i}function hV(){return{position:"absolute",left:"0",height:"calc(var(--gap) + 2px)",bottom:"100%",width:"100%"}}function gV(e,t){let{context:n,prop:i,send:r,refs:s,computed:a}=e;return{getCount(){return n.get("toasts").length},getToasts(){return n.get("toasts")},getGroupProps(o={}){let{label:l="Notifications"}=o,{hotkey:c}=i("store").attrs,u=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),h=a("placement"),[m,d="center"]=h.split("-");return t.element(y(g({},ji.group.attrs),{dir:i("dir"),tabIndex:-1,"aria-label":`${h} ${l} ${u}`,id:aV(h),"data-placement":h,"data-side":m,"data-align":d,"aria-live":"polite",role:"region",style:cV(e,h),onMouseEnter(){s.get("ignoreMouseTimer").isActive()||r({type:"REGION.POINTER_ENTER",placement:h})},onMouseMove(){s.get("ignoreMouseTimer").isActive()||r({type:"REGION.POINTER_ENTER",placement:h})},onMouseLeave(){s.get("ignoreMouseTimer").isActive()||r({type:"REGION.POINTER_LEAVE",placement:h})},onFocus(p){r({type:"REGION.FOCUS",target:p.relatedTarget})},onBlur(p){s.get("isFocusWithin")&&!ce(p.currentTarget,p.relatedTarget)&&queueMicrotask(()=>r({type:"REGION.BLUR"}))}}))},subscribe(o){return i("store").subscribe(()=>o(n.get("toasts")))}}}function yV(e,t){let{state:n,send:i,prop:r,scope:s,context:a,computed:o}=e,l=n.hasTag("visible"),c=n.hasTag("paused"),u=a.get("mounted"),h=o("frontmost"),m=r("parent").computed("placement"),d=r("type"),p=r("stacked"),v=r("title"),I=r("description"),T=r("action"),[w,b="center"]=m.split("-");return{type:d,title:v,description:I,placement:m,visible:l,paused:c,closable:!!r("closable"),pause(){i({type:"PAUSE"})},resume(){i({type:"RESUME"})},dismiss(){i({type:"DISMISS",src:"programmatic"})},getRootProps(){return t.element(y(g({},ji.root.attrs),{dir:r("dir"),id:mf(s),"data-state":l?"open":"closed","data-type":d,"data-placement":m,"data-align":b,"data-side":w,"data-mounted":E(u),"data-paused":E(c),"data-first":E(h),"data-sibling":E(!h),"data-stack":E(p),"data-overlap":E(!p),role:"status","aria-atomic":"true","aria-describedby":I?hf(s):void 0,"aria-labelledby":v?df(s):void 0,tabIndex:0,style:uV(e,l),onKeyDown(f){f.defaultPrevented||f.key=="Escape"&&(i({type:"DISMISS",src:"keyboard"}),f.preventDefault())}}))},getGhostBeforeProps(){return t.element({"data-ghost":"before",style:dV(e,l)})},getGhostAfterProps(){return t.element({"data-ghost":"after",style:hV()})},getTitleProps(){return t.element(y(g({},ji.title.attrs),{id:df(s)}))},getDescriptionProps(){return t.element(y(g({},ji.description.attrs),{id:hf(s)}))},getActionTriggerProps(){return t.button(y(g({},ji.actionTrigger.attrs),{type:"button",onClick(f){var S;f.defaultPrevented||((S=T==null?void 0:T.onClick)==null||S.call(T),i({type:"DISMISS",src:"user"}))}}))},getCloseTriggerProps(){return t.button(y(g({id:oV(s)},ji.closeTrigger.attrs),{type:"button","aria-label":"Dismiss notification",onClick(f){f.defaultPrevented||i({type:"DISMISS",src:"user"})}}))}}}function pf(e,t){let{id:n,height:i}=t;e.context.set("heights",r=>r.find(a=>a.id===n)?r.map(a=>a.id===n?y(g({},a),{height:i}):a):[{id:n,height:i},...r])}function PV(e={}){let t=IV(e,{placement:"bottom",overlap:!1,max:24,gap:16,offsets:"1rem",hotkey:["altKey","KeyT"],removeDelay:200,pauseOnPageIdle:!0}),n=[],i=[],r=new Set,s=[],a=D=>(n.push(D),()=>{let $=n.indexOf(D);n.splice($,1)}),o=D=>(n.forEach($=>$(D)),D),l=D=>{if(i.length>=t.max){s.push(D);return}o(D),i.unshift(D)},c=()=>{for(;s.length>0&&i.length{var J;let $=(J=D.id)!=null?J:`toast:${ur()}`,te=i.find(ie=>ie.id===$);return r.has($)&&r.delete($),te?i=i.map(ie=>ie.id===$?o(y(g(g({},ie),D),{id:$})):ie):l(y(g({id:$,duration:t.duration,removeDelay:t.removeDelay,type:"info"},D),{stacked:!t.overlap,gap:t.gap})),$},h=D=>(r.add(D),D?(n.forEach($=>$({id:D,dismiss:!0})),i=i.filter($=>$.id!==D),c()):(i.forEach($=>{n.forEach(te=>te({id:$.id,dismiss:!0}))}),i=[],s=[]),D);return{attrs:t,subscribe:a,create:u,update:(D,$)=>u(g({id:D},$)),remove:h,dismiss:D=>{D!=null?i=i.map($=>$.id===D?o(y(g({},$),{message:"DISMISS"})):$):i=i.map($=>o(y(g({},$),{message:"DISMISS"})))},error:D=>u(y(g({},D),{type:"error"})),success:D=>u(y(g({},D),{type:"success"})),info:D=>u(y(g({},D),{type:"info"})),warning:D=>u(y(g({},D),{type:"warning"})),loading:D=>u(y(g({},D),{type:"loading"})),getVisibleToasts:()=>i.filter(D=>!r.has(D.id)),getCount:()=>i.length,promise:(D,$,te={})=>{if(!$||!$.loading){zt("[zag-js > toast] toaster.promise() requires at least a 'loading' option to be specified");return}let J=u(y(g(g({},te),$.loading),{promise:D,type:"loading"})),ie=!0,Q,Se=Kt(D).then(ne=>Ve(null,null,function*(){if(Q=["resolve",ne],CV(ne)&&!ne.ok){ie=!1;let Ie=Kt($.error,`HTTP Error! status: ${ne.status}`);u(y(g(g({},te),Ie),{id:J,type:"error"}))}else if($.success!==void 0){ie=!1;let Ie=Kt($.success,ne);u(y(g(g({},te),Ie),{id:J,type:"success"}))}})).catch(ne=>Ve(null,null,function*(){if(Q=["reject",ne],$.error!==void 0){ie=!1;let Ie=Kt($.error,ne);u(y(g(g({},te),Ie),{id:J,type:"error"}))}})).finally(()=>{var ne;ie&&h(J),(ne=$.finally)==null||ne.call($)});return{id:J,unwrap:()=>new Promise((ne,Ie)=>Se.then(()=>Q[0]==="reject"?Ie(Q[1]):ne(Q[1])).catch(Ie))}},pause:D=>{D!=null?i=i.map($=>$.id===D?o(y(g({},$),{message:"PAUSE"})):$):i=i.map($=>o(y(g({},$),{message:"PAUSE"})))},resume:D=>{D!=null?i=i.map($=>$.id===D?o(y(g({},$),{message:"RESUME"})):$):i=i.map($=>o(y(g({},$),{message:"RESUME"})))},isVisible:D=>!r.has(D)&&!!i.find($=>$.id===D),isDismissed:D=>r.has(D),expand:()=>{i=i.map(D=>o(y(g({},D),{stacked:!0})))},collapse:()=>{i=i.map(D=>o(y(g({},D),{stacked:!1})))}}}function wV(e,t){var s,a,o;let n=(s=t==null?void 0:t.id)!=null?s:Mn(e,"toast"),i=(o=t==null?void 0:t.store)!=null?o:PV({placement:(a=t==null?void 0:t.placement)!=null?a:"bottom",overlap:t==null?void 0:t.overlap,max:t==null?void 0:t.max,gap:t==null?void 0:t.gap,offsets:t==null?void 0:t.offsets,pauseOnPageIdle:t==null?void 0:t.pauseOnPageIdle}),r=new OV(e,{id:n,store:i});return r.init(),SV.set(n,r),Ql.set(n,i),e.dataset.toastGroup="true",e.dataset.toastGroupId=n,{group:r,store:i}}function qr(e){if(e)return Ql.get(e);let t=document.querySelector("[data-toast-group]");if(!t)return;let n=t.dataset.toastGroupId||t.id;return n?Ql.get(n):void 0}var sV,ji,aV,cf,mf,uf,df,hf,oV,gf,lV,pV,fV,mV,vV,bV,EV,IV,CV,ff,SV,Ql,TV,OV,VV,yf=re(()=>{"use strict";Wn();tn();se();sV=U("toast").parts("group","root","title","description","actionTrigger","closeTrigger"),ji=sV.build(),aV=e=>`toast-group:${e}`,cf=(e,t)=>e.getById(`toast-group:${t}`),mf=e=>`toast:${e.id}`,uf=e=>e.getById(mf(e)),df=e=>`toast:${e.id}:title`,hf=e=>`toast:${e.id}:description`,oV=e=>`toast${e.id}:close`,gf={info:5e3,error:5e3,success:2e3,loading:1/0,DEFAULT:5e3};lV=e=>typeof e=="string"?{left:e,right:e,bottom:e,top:e}:e;({guards:pV,createMachine:fV}=ut()),{and:mV}=pV,vV=fV({props({props:e}){return y(g({dir:"ltr",id:ur()},e),{store:e.store})},initialState({prop:e}){return e("store").attrs.overlap?"overlap":"stack"},refs(){return{lastFocusedEl:null,isFocusWithin:!1,isPointerWithin:!1,ignoreMouseTimer:eo.create(),dismissableCleanup:void 0}},context({bindable:e}){return{toasts:e(()=>({defaultValue:[],sync:!0,hash:t=>t.map(n=>n.id).join(",")})),heights:e(()=>({defaultValue:[],sync:!0}))}},computed:{count:({context:e})=>e.get("toasts").length,overlap:({prop:e})=>e("store").attrs.overlap,placement:({prop:e})=>e("store").attrs.placement},effects:["subscribeToStore","trackDocumentVisibility","trackHotKeyPress"],watch({track:e,context:t,action:n}){e([()=>t.hash("toasts")],()=>{queueMicrotask(()=>{n(["collapsedIfEmpty","setDismissableBranch"])})})},exit:["clearDismissableBranch","clearLastFocusedEl","clearMouseEventTimer"],on:{"DOC.HOTKEY":{actions:["focusRegionEl"]},"REGION.BLUR":[{guard:mV("isOverlapping","isPointerOut"),target:"overlap",actions:["collapseToasts","resumeToasts","restoreFocusIfPointerOut"]},{guard:"isPointerOut",target:"stack",actions:["resumeToasts","restoreFocusIfPointerOut"]},{actions:["clearFocusWithin"]}],"TOAST.REMOVE":{actions:["removeToast","removeHeight","ignoreMouseEventsTemporarily"]},"TOAST.PAUSE":{actions:["pauseToasts"]}},states:{stack:{on:{"REGION.POINTER_LEAVE":[{guard:"isOverlapping",target:"overlap",actions:["clearPointerWithin","resumeToasts","collapseToasts"]},{actions:["clearPointerWithin","resumeToasts"]}],"REGION.OVERLAP":{target:"overlap",actions:["collapseToasts"]},"REGION.FOCUS":{actions:["setLastFocusedEl","pauseToasts"]},"REGION.POINTER_ENTER":{actions:["setPointerWithin","pauseToasts"]}}},overlap:{on:{"REGION.STACK":{target:"stack",actions:["expandToasts"]},"REGION.POINTER_ENTER":{target:"stack",actions:["setPointerWithin","pauseToasts","expandToasts"]},"REGION.FOCUS":{target:"stack",actions:["setLastFocusedEl","pauseToasts","expandToasts"]}}}},implementations:{guards:{isOverlapping:({computed:e})=>e("overlap"),isPointerOut:({refs:e})=>!e.get("isPointerWithin")},effects:{subscribeToStore({context:e,prop:t}){let n=t("store");return e.set("toasts",n.getVisibleToasts()),n.subscribe(i=>{if(i.dismiss){e.set("toasts",r=>r.filter(s=>s.id!==i.id));return}e.set("toasts",r=>{let s=r.findIndex(a=>a.id===i.id);return s!==-1?[...r.slice(0,s),g(g({},r[s]),i),...r.slice(s+1)]:[i,...r]})})},trackHotKeyPress({prop:e,send:t}){return ee(document,"keydown",i=>{let{hotkey:r}=e("store").attrs;r.every(a=>i[a]||i.code===a)&&t({type:"DOC.HOTKEY"})},{capture:!0})},trackDocumentVisibility({prop:e,send:t,scope:n}){let{pauseOnPageIdle:i}=e("store").attrs;if(!i)return;let r=n.getDoc();return ee(r,"visibilitychange",()=>{let s=r.visibilityState==="hidden";t({type:s?"PAUSE_ALL":"RESUME_ALL"})})}},actions:{setDismissableBranch({refs:e,context:t,computed:n,scope:i}){var c;let r=t.get("toasts"),s=n("placement"),a=r.length>0;if(!a){(c=e.get("dismissableCleanup"))==null||c();return}if(a&&e.get("dismissableCleanup"))return;let l=Wd(()=>cf(i,s),{defer:!0});e.set("dismissableCleanup",l)},clearDismissableBranch({refs:e}){var t;(t=e.get("dismissableCleanup"))==null||t()},focusRegionEl({scope:e,computed:t}){queueMicrotask(()=>{var n;(n=cf(e,t("placement")))==null||n.focus()})},pauseToasts({prop:e}){e("store").pause()},resumeToasts({prop:e}){e("store").resume()},expandToasts({prop:e}){e("store").expand()},collapseToasts({prop:e}){e("store").collapse()},removeToast({prop:e,event:t}){e("store").remove(t.id)},removeHeight({event:e,context:t}){(e==null?void 0:e.id)!=null&&queueMicrotask(()=>{t.set("heights",n=>n.filter(i=>i.id!==e.id))})},collapsedIfEmpty({send:e,computed:t}){!t("overlap")||t("count")>1||e({type:"REGION.OVERLAP"})},setLastFocusedEl({refs:e,event:t}){e.get("isFocusWithin")||!t.target||(e.set("isFocusWithin",!0),e.set("lastFocusedEl",t.target))},restoreFocusIfPointerOut({refs:e}){var t;!e.get("lastFocusedEl")||e.get("isPointerWithin")||((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null),e.set("isFocusWithin",!1))},setPointerWithin({refs:e}){e.set("isPointerWithin",!0)},clearPointerWithin({refs:e}){var t;e.set("isPointerWithin",!1),e.get("lastFocusedEl")&&!e.get("isFocusWithin")&&((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null))},clearFocusWithin({refs:e}){e.set("isFocusWithin",!1)},clearLastFocusedEl({refs:e}){var t;e.get("lastFocusedEl")&&((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null),e.set("isFocusWithin",!1))},ignoreMouseEventsTemporarily({refs:e}){e.get("ignoreMouseTimer").request()},clearMouseEventTimer({refs:e}){e.get("ignoreMouseTimer").cancel()}}}});({not:bV}=Ee()),EV={props({props:e}){return yn(e,["id","type","parent","removeDelay"],"toast"),y(g({closable:!0},e),{duration:Jl(e.duration,e.type)})},initialState({prop:e}){return e("type")==="loading"||e("duration")===1/0?"visible:persist":"visible"},context({prop:e,bindable:t}){return{remainingTime:t(()=>({defaultValue:Jl(e("duration"),e("type"))})),createdAt:t(()=>({defaultValue:Date.now()})),mounted:t(()=>({defaultValue:!1})),initialHeight:t(()=>({defaultValue:0}))}},refs(){return{closeTimerStartTime:Date.now(),lastCloseStartTimerStartTime:0}},computed:{zIndex:({prop:e})=>{let t=e("parent").context.get("toasts"),n=t.findIndex(i=>i.id===e("id"));return t.length-n},height:({prop:e})=>{var i;let n=e("parent").context.get("heights").find(r=>r.id===e("id"));return(i=n==null?void 0:n.height)!=null?i:0},heightIndex:({prop:e})=>e("parent").context.get("heights").findIndex(n=>n.id===e("id")),frontmost:({prop:e})=>e("index")===0,heightBefore:({prop:e})=>{let t=e("parent").context.get("heights"),n=t.findIndex(i=>i.id===e("id"));return t.reduce((i,r,s)=>s>=n?i:i+r.height,0)},shouldPersist:({prop:e})=>e("type")==="loading"||e("duration")===1/0},watch({track:e,prop:t,send:n}){e([()=>t("message")],()=>{let i=t("message");i&&n({type:i,src:"programmatic"})}),e([()=>t("type"),()=>t("duration")],()=>{n({type:"UPDATE"})})},on:{UPDATE:[{guard:"shouldPersist",target:"visible:persist",actions:["resetCloseTimer"]},{target:"visible:updating",actions:["resetCloseTimer"]}],MEASURE:{actions:["measureHeight"]}},entry:["setMounted","measureHeight","invokeOnVisible"],effects:["trackHeight"],states:{"visible:updating":{tags:["visible","updating"],effects:["waitForNextTick"],on:{SHOW:{target:"visible"}}},"visible:persist":{tags:["visible","paused"],on:{RESUME:{guard:bV("isLoadingType"),target:"visible",actions:["setCloseTimer"]},DISMISS:{target:"dismissing"}}},visible:{tags:["visible"],effects:["waitForDuration"],on:{DISMISS:{target:"dismissing"},PAUSE:{target:"visible:persist",actions:["syncRemainingTime"]}}},dismissing:{entry:["invokeOnDismiss"],effects:["waitForRemoveDelay"],on:{REMOVE:{target:"unmounted",actions:["notifyParentToRemove"]}}},unmounted:{entry:["invokeOnUnmount"]}},implementations:{effects:{waitForRemoveDelay({prop:e,send:t}){return mn(()=>{t({type:"REMOVE",src:"timer"})},e("removeDelay"))},waitForDuration({send:e,context:t,computed:n}){if(!n("shouldPersist"))return mn(()=>{e({type:"DISMISS",src:"timer"})},t.get("remainingTime"))},waitForNextTick({send:e}){return mn(()=>{e({type:"SHOW",src:"timer"})},0)},trackHeight({scope:e,prop:t}){let n;return H(()=>{let i=uf(e);if(!i)return;let r=()=>{let o=i.style.height;i.style.height="auto";let l=i.getBoundingClientRect().height;i.style.height=o;let c={id:t("id"),height:l};pf(t("parent"),c)},s=e.getWin(),a=new s.MutationObserver(r);a.observe(i,{childList:!0,subtree:!0,characterData:!0}),n=()=>a.disconnect()}),()=>n==null?void 0:n()}},guards:{isLoadingType:({prop:e})=>e("type")==="loading",shouldPersist:({computed:e})=>e("shouldPersist")},actions:{setMounted({context:e}){H(()=>{e.set("mounted",!0)})},measureHeight({scope:e,prop:t,context:n}){queueMicrotask(()=>{let i=uf(e);if(!i)return;let r=i.style.height;i.style.height="auto";let s=i.getBoundingClientRect().height;i.style.height=r,n.set("initialHeight",s);let a={id:t("id"),height:s};pf(t("parent"),a)})},setCloseTimer({refs:e}){e.set("closeTimerStartTime",Date.now())},resetCloseTimer({context:e,refs:t,prop:n}){t.set("closeTimerStartTime",Date.now()),e.set("remainingTime",Jl(n("duration"),n("type")))},syncRemainingTime({context:e,refs:t}){e.set("remainingTime",n=>{let i=t.get("closeTimerStartTime"),r=Date.now()-i;return t.set("lastCloseStartTimerStartTime",Date.now()),n-r})},notifyParentToRemove({prop:e}){e("parent").send({type:"TOAST.REMOVE",id:e("id")})},invokeOnDismiss({prop:e,event:t}){var n;(n=e("onStatusChange"))==null||n({status:"dismissing",src:t.src})},invokeOnUnmount({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"unmounted"})},invokeOnVisible({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"visible"})}}}};IV=(e,t)=>g(g({},t),Si(e));CV=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",ff={connect:gV,machine:vV},SV=new Map,Ql=new Map,TV=class extends K{constructor(t,n){super(t,n);z(this,"parts");z(this,"duration");z(this,"destroy",()=>{this.machine.stop(),this.el.remove()});this.duration=n.duration,this.el.setAttribute("data-scope","toast"),this.el.setAttribute("data-part","root"),this.el.innerHTML=` + `,n.body.appendChild(i)};$T=(e,t={})=>new Intl.NumberFormat(e,t),HT=(e,t={})=>new Qg(e,t),Nl=(e,t)=>{let{prop:n,computed:i}=t;return n("formatOptions")?e===""?Number.NaN:i("parser").parse(e):parseFloat(e)},ti=(e,t)=>{let{prop:n,computed:i}=t;return Number.isNaN(e)?"":n("formatOptions")?i("formatter").format(e):e.toString()},BT=(e,t)=>{let n=e!==void 0&&!Number.isNaN(e)?e:1;return(t==null?void 0:t.style)==="percent"&&(e===void 0||Number.isNaN(e))&&(n=.01),n},{choose:_T,guards:GT,createMachine:UT}=ut(),{not:Xg,and:Zg}=GT,qT=UT({props({props:e}){let t=BT(e.step,e.formatOptions);return y(g({dir:"ltr",locale:"en-US",focusInputOnChange:!0,clampValueOnBlur:!e.allowOverflow,allowOverflow:!1,inputMode:"decimal",pattern:"-?[0-9]*(.[0-9]+)?",defaultValue:"",step:t,min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,spinOnPress:!0},e),{translations:g({incrementLabel:"increment value",decrementLabel:"decrease value"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t,getComputed:n}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(i){var a;let r=n(),s=Nl(i,{computed:r,prop:e});(a=e("onValueChange"))==null||a({value:i,valueAsNumber:s})}})),hint:t(()=>({defaultValue:null})),scrubberCursorPoint:t(()=>({defaultValue:null,hash(i){return i?`x:${i.x}, y:${i.y}`:""}})),fieldsetDisabled:t(()=>({defaultValue:!1}))}},computed:{isRtl:({prop:e})=>e("dir")==="rtl",valueAsNumber:({context:e,computed:t,prop:n})=>Nl(e.get("value"),{computed:t,prop:n}),formattedValue:({computed:e,prop:t})=>ti(e("valueAsNumber"),{computed:e,prop:t}),isAtMin:({computed:e,prop:t})=>Qc(e("valueAsNumber"),t("min")),isAtMax:({computed:e,prop:t})=>Jc(e("valueAsNumber"),t("max")),isOutOfRange:({computed:e,prop:t})=>!Pi(e("valueAsNumber"),t("min"),t("max")),isValueEmpty:({context:e})=>e.get("value")==="",isDisabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled"),canIncrement:({prop:e,computed:t})=>e("allowOverflow")||!t("isAtMax"),canDecrement:({prop:e,computed:t})=>e("allowOverflow")||!t("isAtMin"),valueText:({prop:e,context:t})=>{var n,i;return(i=(n=e("translations")).valueText)==null?void 0:i.call(n,t.get("value"))},formatter:Bn(({prop:e})=>[e("locale"),e("formatOptions")],([e,t])=>$T(e,t)),parser:Bn(({prop:e})=>[e("locale"),e("formatOptions")],([e,t])=>HT(e,t))},watch({track:e,action:t,context:n,computed:i,prop:r}){e([()=>n.get("value"),()=>r("locale"),()=>JSON.stringify(r("formatOptions"))],()=>{t(["syncInputElement"])}),e([()=>i("isOutOfRange")],()=>{t(["invokeOnInvalid"])}),e([()=>n.hash("scrubberCursorPoint")],()=>{t(["setVirtualCursorPosition"])})},effects:["trackFormControl"],on:{"VALUE.SET":{actions:["setRawValue"]},"VALUE.CLEAR":{actions:["clearValue"]},"VALUE.INCREMENT":{actions:["increment"]},"VALUE.DECREMENT":{actions:["decrement"]}},states:{idle:{on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","invokeOnFocus","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","invokeOnFocus","setHint","setCursorPoint"]},"INPUT.FOCUS":{target:"focused",actions:["focusInput","invokeOnFocus"]}}},focused:{tags:["focus"],effects:["attachWheelListener"],on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","setHint","setCursorPoint"]},"INPUT.ARROW_UP":{actions:["increment"]},"INPUT.ARROW_DOWN":{actions:["decrement"]},"INPUT.HOME":{actions:["decrementToMin"]},"INPUT.END":{actions:["incrementToMax"]},"INPUT.CHANGE":{actions:["setValue","setHint"]},"INPUT.BLUR":[{guard:Zg("clampValueOnBlur",Xg("isInRange")),target:"idle",actions:["setClampedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]},{guard:Xg("isInRange"),target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnInvalid","invokeOnValueCommit"]},{target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]}],"INPUT.ENTER":{actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnValueCommit"]}}},"before:spin":{tags:["focus"],effects:["trackButtonDisabled","waitForChangeDelay"],entry:_T([{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}]),on:{CHANGE_DELAY:{target:"spinning",guard:Zg("isInRange","spinOnPress")},"TRIGGER.PRESS_UP":[{guard:"isTouchPointer",target:"focused",actions:["clearHint"]},{target:"focused",actions:["focusInput","clearHint"]}]}},spinning:{tags:["focus"],effects:["trackButtonDisabled","spinValue"],on:{SPIN:[{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}],"TRIGGER.PRESS_UP":{target:"focused",actions:["focusInput","clearHint"]}}},scrubbing:{tags:["focus"],effects:["activatePointerLock","trackMousemove","setupVirtualCursor","preventTextSelection"],on:{"SCRUBBER.POINTER_UP":{target:"focused",actions:["focusInput","clearCursorPoint"]},"SCRUBBER.POINTER_MOVE":[{guard:"isIncrementHint",actions:["increment","setCursorPoint"]},{guard:"isDecrementHint",actions:["decrement","setCursorPoint"]}]}}},implementations:{guards:{clampValueOnBlur:({prop:e})=>e("clampValueOnBlur"),spinOnPress:({prop:e})=>!!e("spinOnPress"),isInRange:({computed:e})=>!e("isOutOfRange"),isDecrementHint:({context:e,event:t})=>{var n;return((n=t.hint)!=null?n:e.get("hint"))==="decrement"},isIncrementHint:({context:e,event:t})=>{var n;return((n=t.hint)!=null?n:e.get("hint"))==="increment"},isTouchPointer:({event:e})=>e.pointerType==="touch"},effects:{waitForChangeDelay({send:e}){let t=setTimeout(()=>{e({type:"CHANGE_DELAY"})},300);return()=>clearTimeout(t)},spinValue({send:e}){let t=setInterval(()=>{e({type:"SPIN"})},50);return()=>clearInterval(t)},trackFormControl({context:e,scope:t}){let n=ni(t);return wt(n,{onFieldsetDisabledChange(i){e.set("fieldsetDisabled",i)},onFormReset(){e.set("value",e.initial("value"))}})},setupVirtualCursor({context:e,scope:t}){let n=e.get("scrubberCursorPoint");return RT(t,n)},preventTextSelection({scope:e}){return DT(e)},trackButtonDisabled({context:e,scope:t,send:n}){let i=e.get("hint"),r=NT(t,i);return ot(r,{attributes:["disabled"],callback(){n({type:"TRIGGER.PRESS_UP",src:"attr"})}})},attachWheelListener({scope:e,send:t,prop:n}){let i=ni(e);if(!i||!e.isActiveElement(i)||!n("allowMouseWheel"))return;function r(s){s.preventDefault();let a=Math.sign(s.deltaY)*-1;a===1?t({type:"VALUE.INCREMENT"}):a===-1&&t({type:"VALUE.DECREMENT"})}return ee(i,"wheel",r,{passive:!1})},activatePointerLock({scope:e}){if(!Xe())return Mc(e.getDoc())},trackMousemove({scope:e,send:t,context:n,computed:i}){let r=e.getDoc();function s(o){let l=n.get("scrubberCursorPoint"),c=i("isRtl"),u=LT(e,{point:l,isRtl:c,event:o});u.hint&&t({type:"SCRUBBER.POINTER_MOVE",hint:u.hint,point:u.point})}function a(){t({type:"SCRUBBER.POINTER_UP"})}return At(ee(r,"mousemove",s,!1),ee(r,"mouseup",a,!1))}},actions:{focusInput({scope:e,prop:t}){if(!t("focusInputOnChange"))return;let n=ni(e);e.isActiveElement(n)||H(()=>n==null?void 0:n.focus({preventScroll:!0}))},increment({context:e,event:t,prop:n,computed:i}){var s;let r=nu(i("valueAsNumber"),(s=t.step)!=null?s:n("step"));n("allowOverflow")||(r=He(r,n("min"),n("max"))),e.set("value",ti(r,{computed:i,prop:n}))},decrement({context:e,event:t,prop:n,computed:i}){var s;let r=iu(i("valueAsNumber"),(s=t.step)!=null?s:n("step"));n("allowOverflow")||(r=He(r,n("min"),n("max"))),e.set("value",ti(r,{computed:i,prop:n}))},setClampedValue({context:e,prop:t,computed:n}){let i=He(n("valueAsNumber"),t("min"),t("max"));e.set("value",ti(i,{computed:n,prop:t}))},setRawValue({context:e,event:t,prop:n,computed:i}){let r=Nl(t.value,{computed:i,prop:n});n("allowOverflow")||(r=He(r,n("min"),n("max"))),e.set("value",ti(r,{computed:i,prop:n}))},setValue({context:e,event:t}){var i,r;let n=(r=(i=t.target)==null?void 0:i.value)!=null?r:t.value;e.set("value",n)},clearValue({context:e}){e.set("value","")},incrementToMax({context:e,prop:t,computed:n}){let i=ti(t("max"),{computed:n,prop:t});e.set("value",i)},decrementToMin({context:e,prop:t,computed:n}){let i=ti(t("min"),{computed:n,prop:t});e.set("value",i)},setHint({context:e,event:t}){e.set("hint",t.hint)},clearHint({context:e}){e.set("hint",null)},invokeOnFocus({computed:e,prop:t}){var n;(n=t("onFocusChange"))==null||n({focused:!0,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnBlur({computed:e,prop:t}){var n;(n=t("onFocusChange"))==null||n({focused:!1,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnInvalid({computed:e,prop:t,event:n}){var r;if(n.type==="INPUT.CHANGE")return;let i=e("valueAsNumber")>t("max")?"rangeOverflow":"rangeUnderflow";(r=t("onValueInvalid"))==null||r({reason:i,value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},invokeOnValueCommit({computed:e,prop:t}){var n;(n=t("onValueCommit"))==null||n({value:e("formattedValue"),valueAsNumber:e("valueAsNumber")})},syncInputElement({context:e,event:t,computed:n,scope:i}){var o;let r=t.type.endsWith("CHANGE")?e.get("value"):n("formattedValue"),s=ni(i),a=(o=t.selection)!=null?o:Dl(s,i);H(()=>{Me(s,r),OT(s,a,i)})},setFormattedValue({context:e,computed:t,action:n}){e.set("value",t("formattedValue")),n(["syncInputElement"])},setCursorPoint({context:e,event:t}){e.set("scrubberCursorPoint",t.point)},clearCursorPoint({context:e}){e.set("scrubberCursorPoint",null)},setVirtualCursorPosition({context:e,scope:t}){let n=ip(t),i=e.get("scrubberCursorPoint");!n||!i||(n.style.transform=`translate3d(${i.x}px, ${i.y}px, 0px)`)}}}}),WT=_()(["allowMouseWheel","allowOverflow","clampValueOnBlur","dir","disabled","focusInputOnChange","form","formatOptions","getRootNode","id","ids","inputMode","invalid","locale","max","min","name","onFocusChange","onValueChange","onValueCommit","onValueInvalid","pattern","required","readOnly","spinOnPress","step","translations","value","defaultValue"]),vA=B(WT),KT=class extends K{initMachine(e){return new W(qT,e)}initApi(){return FT(this.machine.service,q)}render(){var l;let e=(l=this.el.querySelector('[data-scope="number-input"][data-part="root"]'))!=null?l:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="number-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="number-input"][data-part="control"]');n&&this.spreadProps(n,this.api.getControlProps());let i=this.el.querySelector('[data-scope="number-input"][data-part="value-text"]');i&&this.spreadProps(i,this.api.getValueTextProps());let r=this.el.querySelector('[data-scope="number-input"][data-part="input"]');r&&this.spreadProps(r,this.api.getInputProps());let s=this.el.querySelector('[data-scope="number-input"][data-part="decrement-trigger"]');s&&this.spreadProps(s,this.api.getDecrementTriggerProps());let a=this.el.querySelector('[data-scope="number-input"][data-part="increment-trigger"]');a&&this.spreadProps(a,this.api.getIncrementTriggerProps());let o=this.el.querySelector('[data-scope="number-input"][data-part="scrubber"]');o&&(this.spreadProps(o,this.api.getScrubberProps()),o.setAttribute("aria-label","Scrub to adjust value"),o.removeAttribute("role"))}},zT={mounted(){let e=this.el,t=w(e,"value"),n=w(e,"defaultValue"),i=C(e,"controlled"),r=new KT(e,y(g({id:e.id},i&&t!==void 0?{value:t}:{defaultValue:n}),{min:Y(e,"min"),max:Y(e,"max"),step:Y(e,"step"),disabled:C(e,"disabled"),readOnly:C(e,"readOnly"),invalid:C(e,"invalid"),required:C(e,"required"),allowMouseWheel:C(e,"allowMouseWheel"),name:w(e,"name"),form:w(e,"form"),onValueChange:s=>{let a=e.querySelector('[data-scope="number-input"][data-part="input"]');a&&(a.value=s.value,a.dispatchEvent(new Event("input",{bubbles:!0})),a.dispatchEvent(new Event("change",{bubbles:!0})));let o=w(e,"onValueChange");o&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(o,{value:s.value,valueAsNumber:s.valueAsNumber,id:e.id});let l=w(e,"onValueChangeClient");l&&e.dispatchEvent(new CustomEvent(l,{bubbles:!0,detail:{value:s,id:e.id}}))}}));r.init(),this.numberInput=r,this.handlers=[]},updated(){var n;let e=w(this.el,"value"),t=C(this.el,"controlled");(n=this.numberInput)==null||n.updateProps(y(g({id:this.el.id},t&&e!==void 0?{value:e}:{}),{min:Y(this.el,"min"),max:Y(this.el,"max"),step:Y(this.el,"step"),disabled:C(this.el,"disabled"),readOnly:C(this.el,"readOnly"),invalid:C(this.el,"invalid"),required:C(this.el,"required"),name:w(this.el,"name"),form:w(this.el,"form")}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.numberInput)==null||e.destroy()}}});var ap={};he(ap,{PasswordInput:()=>eO});function jT(e,t){let{scope:n,prop:i,context:r}=e,s=r.get("visible"),a=!!i("disabled"),o=!!i("invalid"),l=!!i("readOnly"),c=!!i("required"),u=!(l||a),h=i("translations");return{visible:s,disabled:a,invalid:o,focus(){var m;(m=Ll(n))==null||m.focus()},setVisible(m){e.send({type:"VISIBILITY.SET",value:m})},toggleVisible(){e.send({type:"VISIBILITY.SET",value:!s})},getRootProps(){return t.element(y(g({},qi.root.attrs),{dir:i("dir"),"data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l)}))},getLabelProps(){return t.label(y(g({},qi.label.attrs),{htmlFor:ba(n),"data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l),"data-required":E(c)}))},getInputProps(){return t.input(g(y(g({},qi.input.attrs),{id:ba(n),autoCapitalize:"off",name:i("name"),required:i("required"),autoComplete:i("autoComplete"),spellCheck:!1,readOnly:l,disabled:a,type:s?"text":"password","data-state":s?"visible":"hidden","aria-invalid":X(o),"data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l)}),i("ignorePasswordManagers")?XT:{}))},getVisibilityTriggerProps(){var m;return t.button(y(g({},qi.visibilityTrigger.attrs),{type:"button",tabIndex:-1,"aria-controls":ba(n),"aria-expanded":s,"data-readonly":E(l),disabled:a,"data-disabled":E(a),"data-state":s?"visible":"hidden","aria-label":(m=h==null?void 0:h.visibilityTrigger)==null?void 0:m.call(h,s),onPointerDown(d){pe(d)&&u&&(d.preventDefault(),e.send({type:"TRIGGER.CLICK"}))}}))},getIndicatorProps(){return t.element(y(g({},qi.indicator.attrs),{"aria-hidden":!0,"data-state":s?"visible":"hidden","data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l)}))},getControlProps(){return t.element(y(g({},qi.control.attrs),{"data-disabled":E(a),"data-invalid":E(o),"data-readonly":E(l)}))}}}var YT,qi,ba,Ll,XT,ZT,JT,SA,QT,eO,op=re(()=>{"use strict";se();YT=U("password-input").parts("root","input","label","control","indicator","visibilityTrigger"),qi=YT.build(),ba=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.input)!=null?n:`p-input-${e.id}-input`},Ll=e=>e.getById(ba(e));XT={"data-1p-ignore":"","data-lpignore":"true","data-bwignore":"true","data-form-type":"other","data-protonpass-ignore":"true"},ZT={props({props:e}){return y(g({id:ur(),defaultVisible:!1,autoComplete:"current-password",ignorePasswordManagers:!1},e),{translations:g({visibilityTrigger(t){return t?"Hide password":"Show password"}},e.translations)})},context({prop:e,bindable:t}){return{visible:t(()=>({value:e("visible"),defaultValue:e("defaultVisible"),onChange(n){var i;(i=e("onVisibilityChange"))==null||i({visible:n})}}))}},initialState(){return"idle"},effects:["trackFormEvents"],states:{idle:{on:{"VISIBILITY.SET":{actions:["setVisibility"]},"TRIGGER.CLICK":{actions:["toggleVisibility","focusInputEl"]}}}},implementations:{actions:{setVisibility({context:e,event:t}){e.set("visible",t.value)},toggleVisibility({context:e}){e.set("visible",t=>!t)},focusInputEl({scope:e}){let t=Ll(e);t==null||t.focus()}},effects:{trackFormEvents({scope:e,send:t}){let n=Ll(e),i=n==null?void 0:n.form;if(!i)return;let r=e.getWin(),s=new r.AbortController;return i.addEventListener("reset",a=>{a.defaultPrevented||t({type:"VISIBILITY.SET",value:!1})},{signal:s.signal}),i.addEventListener("submit",()=>{t({type:"VISIBILITY.SET",value:!1})},{signal:s.signal}),()=>s.abort()}}}},JT=_()(["defaultVisible","dir","id","onVisibilityChange","visible","ids","getRootNode","disabled","invalid","required","readOnly","translations","ignorePasswordManagers","autoComplete","name"]),SA=B(JT),QT=class extends K{initMachine(e){return new W(ZT,e)}initApi(){return jT(this.machine.service,q)}render(){var a;let e=(a=this.el.querySelector('[data-scope="password-input"][data-part="root"]'))!=null?a:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="password-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="password-input"][data-part="control"]');n&&this.spreadProps(n,this.api.getControlProps());let i=this.el.querySelector('[data-scope="password-input"][data-part="input"]');i&&this.spreadProps(i,this.api.getInputProps());let r=this.el.querySelector('[data-scope="password-input"][data-part="visibility-trigger"]');r&&this.spreadProps(r,this.api.getVisibilityTriggerProps());let s=this.el.querySelector('[data-scope="password-input"][data-part="indicator"]');s&&this.spreadProps(s,this.api.getIndicatorProps())}},eO={mounted(){let e=this.el,t=new QT(e,y(g({id:e.id},C(e,"controlledVisible")?{visible:C(e,"visible")}:{defaultVisible:C(e,"defaultVisible")}),{disabled:C(e,"disabled"),invalid:C(e,"invalid"),readOnly:C(e,"readOnly"),required:C(e,"required"),ignorePasswordManagers:C(e,"ignorePasswordManagers"),name:w(e,"name"),dir:Oe(e),autoComplete:w(e,"autoComplete",["current-password","new-password"]),onVisibilityChange:n=>{let i=w(e,"onVisibilityChange");i&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(i,{visible:n.visible,id:e.id});let r=w(e,"onVisibilityChangeClient");r&&e.dispatchEvent(new CustomEvent(r,{bubbles:!0,detail:{value:n,id:e.id}}))}}));t.init(),this.passwordInput=t,this.handlers=[]},updated(){var e;(e=this.passwordInput)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlledVisible")?{visible:C(this.el,"visible")}:{}),{disabled:C(this.el,"disabled"),invalid:C(this.el,"invalid"),readOnly:C(this.el,"readOnly"),required:C(this.el,"required"),name:w(this.el,"name"),form:w(this.el,"form"),dir:Oe(this.el)}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.passwordInput)==null||e.destroy()}}});var dp={};he(dp,{PinInput:()=>fO});function lO(e,t){var n;return e?!!((n=oO[e])!=null&&n.test(t)):!0}function cp(e,t,n){return n?new RegExp(n,"g").test(e):lO(t,e)}function cO(e,t){let{send:n,context:i,computed:r,prop:s,scope:a}=e,o=r("isValueComplete"),l=!!s("disabled"),c=!!s("readOnly"),u=!!s("invalid"),h=!!s("required"),m=s("translations"),d=i.get("focusedIndex");function p(){var v;(v=aO(a))==null||v.focus()}return{focus:p,count:i.get("count"),items:Array.from({length:i.get("count")}).map((v,I)=>I),value:i.get("value"),valueAsString:r("valueAsString"),complete:o,setValue(v){Array.isArray(v)||vs("[pin-input/setValue] value must be an array"),n({type:"VALUE.SET",value:v})},clearValue(){n({type:"VALUE.CLEAR"})},setValueAtIndex(v,I){n({type:"VALUE.SET",value:I,index:v})},getRootProps(){return t.element(y(g({dir:s("dir")},Ea.root.attrs),{id:Fr(a),"data-invalid":E(u),"data-disabled":E(l),"data-complete":E(o),"data-readonly":E(c)}))},getLabelProps(){return t.label(y(g({},Ea.label.attrs),{dir:s("dir"),htmlFor:Fl(a),id:iO(a),"data-invalid":E(u),"data-disabled":E(l),"data-complete":E(o),"data-required":E(h),"data-readonly":E(c),onClick(v){v.preventDefault(),p()}}))},getHiddenInputProps(){return t.input({"aria-hidden":!0,type:"text",tabIndex:-1,id:Fl(a),readOnly:c,disabled:l,required:h,name:s("name"),form:s("form"),style:Vt,maxLength:r("valueLength"),defaultValue:r("valueAsString")})},getControlProps(){return t.element(y(g({},Ea.control.attrs),{dir:s("dir"),id:rO(a)}))},getInputProps(v){var O;let{index:I}=v,T=s("type")==="numeric"?"tel":"text";return t.input(y(g({},Ea.input.attrs),{dir:s("dir"),disabled:l,"data-disabled":E(l),"data-complete":E(o),id:nO(a,I.toString()),"data-index":I,"data-ownedby":Fr(a),"aria-label":(O=m==null?void 0:m.inputLabel)==null?void 0:O.call(m,I,r("valueLength")),inputMode:s("otp")||s("type")==="numeric"?"numeric":"text","aria-invalid":X(u),"data-invalid":E(u),type:s("mask")?"password":T,defaultValue:i.get("value")[I]||"",readOnly:c,autoCapitalize:"none",autoComplete:s("otp")?"one-time-code":"off",placeholder:d===I?"":s("placeholder"),onPaste(b){var P;let f=(P=b.clipboardData)==null?void 0:P.getData("text/plain");if(!f)return;if(!cp(f,s("type"),s("pattern"))){n({type:"VALUE.INVALID",value:f}),b.preventDefault();return}b.preventDefault(),n({type:"INPUT.PASTE",value:f})},onBeforeInput(b){try{let f=Oc(b);cp(f,s("type"),s("pattern"))||(n({type:"VALUE.INVALID",value:f}),b.preventDefault()),f.length>1&&b.currentTarget.setSelectionRange(0,1,"forward")}catch(f){}},onChange(b){let f=Yt(b),{value:S}=b.currentTarget;if(f.inputType==="insertFromPaste"){b.currentTarget.value=S[0]||"";return}if(S.length>2){n({type:"INPUT.PASTE",value:S}),b.currentTarget.value=S[0],b.preventDefault();return}if(f.inputType==="deleteContentBackward"){n({type:"INPUT.BACKSPACE"});return}n({type:"INPUT.CHANGE",value:S,index:I})},onKeyDown(b){if(b.defaultPrevented||Re(b)||xe(b))return;let S={Backspace(){n({type:"INPUT.BACKSPACE"})},Delete(){n({type:"INPUT.DELETE"})},ArrowLeft(){n({type:"INPUT.ARROW_LEFT"})},ArrowRight(){n({type:"INPUT.ARROW_RIGHT"})},Enter(){n({type:"INPUT.ENTER"})}}[ge(b,{dir:s("dir"),orientation:"horizontal"})];S&&(S(b),b.preventDefault())},onFocus(){n({type:"INPUT.FOCUS",index:I})},onBlur(b){let f=b.relatedTarget;le(f)&&f.dataset.ownedby===Fr(a)||n({type:"INPUT.BLUR",index:I})}}))}}}function up(e,t){let n=t;e[0]===t[0]?n=t[1]:e[0]===t[1]&&(n=t[0]);let i=n.split("");return n=i[i.length-1],n!=null?n:""}function Ia(e,t){return Array.from({length:t}).fill("").map((n,i)=>e[i]||n)}var tO,Ea,Fr,nO,Fl,iO,rO,sO,Pa,Mr,aO,lp,Ml,oO,uO,dO,hO,gO,VA,pO,fO,hp=re(()=>{"use strict";se();tO=U("pinInput").parts("root","label","input","control"),Ea=tO.build(),Fr=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`pin-input:${e.id}`},nO=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.input)==null?void 0:i.call(n,t))!=null?r:`pin-input:${e.id}:${t}`},Fl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`pin-input:${e.id}:hidden`},iO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`pin-input:${e.id}:label`},rO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`pin-input:${e.id}:control`},sO=e=>e.getById(Fr(e)),Pa=e=>{let n=`input[data-ownedby=${CSS.escape(Fr(e))}]`;return Fe(sO(e),n)},Mr=(e,t)=>Pa(e)[t],aO=e=>Pa(e)[0],lp=e=>e.getById(Fl(e)),Ml=(e,t)=>{e.value=t,e.setAttribute("value",t)},oO={numeric:/^[0-9]+$/,alphabetic:/^[A-Za-z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/i};({choose:uO,createMachine:dO}=ut()),hO=dO({props({props:e}){return y(g({placeholder:"\u25CB",otp:!1,type:"numeric",defaultValue:e.count?Ia([],e.count):[]},e),{translations:g({inputLabel:(t,n)=>`pin code ${t+1} of ${n}`},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({value:e("value"),defaultValue:e("defaultValue"),isEqual:fe,onChange(n){var i;(i=e("onValueChange"))==null||i({value:n,valueAsString:n.join("")})}})),focusedIndex:t(()=>({sync:!0,defaultValue:-1})),count:t(()=>({defaultValue:e("count")}))}},computed:{_value:({context:e})=>Ia(e.get("value"),e.get("count")),valueLength:({computed:e})=>e("_value").length,filledValueLength:({computed:e})=>e("_value").filter(t=>(t==null?void 0:t.trim())!=="").length,isValueComplete:({computed:e})=>e("valueLength")===e("filledValueLength"),valueAsString:({computed:e})=>e("_value").join(""),focusedValue:({computed:e,context:t})=>e("_value")[t.get("focusedIndex")]||""},entry:uO([{guard:"autoFocus",actions:["setInputCount","setFocusIndexToFirst"]},{actions:["setInputCount"]}]),watch({action:e,track:t,context:n,computed:i}){t([()=>n.get("focusedIndex")],()=>{e(["focusInput","selectInputIfNeeded"])}),t([()=>n.get("value").join(",")],()=>{e(["syncInputElements","dispatchInputEvent"])}),t([()=>i("isValueComplete")],()=>{e(["invokeOnComplete","blurFocusedInputIfNeeded"])})},on:{"VALUE.SET":[{guard:"hasIndex",actions:["setValueAtIndex"]},{actions:["setValue"]}],"VALUE.CLEAR":{actions:["clearValue","setFocusIndexToFirst"]}},states:{idle:{on:{"INPUT.FOCUS":{target:"focused",actions:["setFocusedIndex"]}}},focused:{on:{"INPUT.CHANGE":{actions:["setFocusedValue","syncInputValue","setNextFocusedIndex"]},"INPUT.PASTE":{actions:["setPastedValue","setLastValueFocusIndex"]},"INPUT.FOCUS":{actions:["setFocusedIndex"]},"INPUT.BLUR":{target:"idle",actions:["clearFocusedIndex"]},"INPUT.DELETE":{guard:"hasValue",actions:["clearFocusedValue"]},"INPUT.ARROW_LEFT":{actions:["setPrevFocusedIndex"]},"INPUT.ARROW_RIGHT":{actions:["setNextFocusedIndex"]},"INPUT.BACKSPACE":[{guard:"hasValue",actions:["clearFocusedValue"]},{actions:["setPrevFocusedIndex","clearFocusedValue"]}],"INPUT.ENTER":{guard:"isValueComplete",actions:["requestFormSubmit"]},"VALUE.INVALID":{actions:["invokeOnInvalid"]}}}},implementations:{guards:{autoFocus:({prop:e})=>!!e("autoFocus"),hasValue:({context:e})=>e.get("value")[e.get("focusedIndex")]!=="",isValueComplete:({computed:e})=>e("isValueComplete"),hasIndex:({event:e})=>e.index!==void 0},actions:{dispatchInputEvent({computed:e,scope:t}){let n=lp(t);Ac(n,{value:e("valueAsString")})},setInputCount({scope:e,context:t,prop:n}){if(n("count"))return;let i=Pa(e);t.set("count",i.length)},focusInput({context:e,scope:t}){var i;let n=e.get("focusedIndex");n!==-1&&((i=Mr(t,n))==null||i.focus({preventScroll:!0}))},selectInputIfNeeded({context:e,prop:t,scope:n}){let i=e.get("focusedIndex");!t("selectOnFocus")||i===-1||H(()=>{var r;(r=Mr(n,i))==null||r.select()})},invokeOnComplete({computed:e,prop:t}){var n;e("isValueComplete")&&((n=t("onValueComplete"))==null||n({value:e("_value"),valueAsString:e("valueAsString")}))},invokeOnInvalid({context:e,event:t,prop:n}){var i;(i=n("onValueInvalid"))==null||i({value:t.value,index:e.get("focusedIndex")})},clearFocusedIndex({context:e}){e.set("focusedIndex",-1)},setFocusedIndex({context:e,event:t}){e.set("focusedIndex",t.index)},setValue({context:e,event:t}){let n=Ia(t.value,e.get("count"));e.set("value",n)},setFocusedValue({context:e,event:t,computed:n,flush:i}){let r=n("focusedValue"),s=e.get("focusedIndex"),a=up(r,t.value);i(()=>{e.set("value",ms(n("_value"),s,a))})},revertInputValue({context:e,computed:t,scope:n}){let i=Mr(n,e.get("focusedIndex"));Ml(i,t("focusedValue"))},syncInputValue({context:e,event:t,scope:n}){let i=e.get("value"),r=Mr(n,t.index);Ml(r,i[t.index])},syncInputElements({context:e,scope:t}){let n=Pa(t),i=e.get("value");n.forEach((r,s)=>{Ml(r,i[s])})},setPastedValue({context:e,event:t,computed:n,flush:i}){H(()=>{let r=n("valueAsString"),s=e.get("focusedIndex"),a=n("valueLength"),o=n("filledValueLength"),l=Math.min(s,o),c=l>0?r.substring(0,s):"",u=t.value.substring(0,a-l),h=Ia(`${c}${u}`.split(""),a);i(()=>{e.set("value",h)})})},setValueAtIndex({context:e,event:t,computed:n}){let i=up(n("focusedValue"),t.value);e.set("value",ms(n("_value"),t.index,i))},clearValue({context:e}){let t=Array.from({length:e.get("count")}).fill("");queueMicrotask(()=>{e.set("value",t)})},clearFocusedValue({context:e,computed:t}){let n=e.get("focusedIndex");n!==-1&&e.set("value",ms(t("_value"),n,""))},setFocusIndexToFirst({context:e}){e.set("focusedIndex",0)},setNextFocusedIndex({context:e,computed:t}){e.set("focusedIndex",Math.min(e.get("focusedIndex")+1,t("valueLength")-1))},setPrevFocusedIndex({context:e}){e.set("focusedIndex",Math.max(e.get("focusedIndex")-1,0))},setLastValueFocusIndex({context:e,computed:t}){H(()=>{e.set("focusedIndex",Math.min(t("filledValueLength"),t("valueLength")-1))})},blurFocusedInputIfNeeded({context:e,prop:t,scope:n}){t("blurOnComplete")&&H(()=>{var i;(i=Mr(n,e.get("focusedIndex")))==null||i.blur()})},requestFormSubmit({computed:e,prop:t,scope:n}){var r;if(!t("name")||!e("isValueComplete"))return;let i=lp(n);(r=i==null?void 0:i.form)==null||r.requestSubmit()}}}});gO=_()(["autoFocus","blurOnComplete","count","defaultValue","dir","disabled","form","getRootNode","id","ids","invalid","mask","name","onValueChange","onValueComplete","onValueInvalid","otp","pattern","placeholder","readOnly","required","selectOnFocus","translations","type","value"]),VA=B(gO),pO=class extends K{initMachine(e){return new W(hO,e)}initApi(){return cO(this.machine.service,q)}render(){var r;let e=(r=this.el.querySelector('[data-scope="pin-input"][data-part="root"]'))!=null?r:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="pin-input"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="pin-input"][data-part="hidden-input"]');n&&this.spreadProps(n,this.api.getHiddenInputProps());let i=this.el.querySelector('[data-scope="pin-input"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps()),this.api.items.forEach(s=>{let a=this.el.querySelector(`[data-scope="pin-input"][data-part="input"][data-index="${s}"]`);a&&this.spreadProps(a,this.api.getInputProps({index:s}))})}},fO={mounted(){var s;let e=this.el,t=Q(e,"value"),n=Q(e,"defaultValue"),i=C(e,"controlled"),r=new pO(e,y(g({id:e.id,count:(s=Y(e,"count"))!=null?s:4},i&&t?{value:t}:{defaultValue:n!=null?n:[]}),{disabled:C(e,"disabled"),invalid:C(e,"invalid"),required:C(e,"required"),readOnly:C(e,"readOnly"),mask:C(e,"mask"),otp:C(e,"otp"),blurOnComplete:C(e,"blurOnComplete"),selectOnFocus:C(e,"selectOnFocus"),name:w(e,"name"),form:w(e,"form"),dir:w(e,"dir",["ltr","rtl"]),type:w(e,"type",["alphanumeric","numeric","alphabetic"]),placeholder:w(e,"placeholder"),onValueChange:a=>{let o=e.querySelector('[data-scope="pin-input"][data-part="hidden-input"]');o&&(o.value=a.valueAsString,o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0})));let l=w(e,"onValueChange");l&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(l,{value:a.value,valueAsString:a.valueAsString,id:e.id});let c=w(e,"onValueChangeClient");c&&e.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:{value:a,id:e.id}}))},onValueComplete:a=>{let o=w(e,"onValueComplete");o&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(o,{value:a.value,valueAsString:a.valueAsString,id:e.id})}}));r.init(),this.pinInput=r,this.handlers=[]},updated(){var n,i,r,s;let e=Q(this.el,"value"),t=C(this.el,"controlled");(s=this.pinInput)==null||s.updateProps(y(g({id:this.el.id,count:(r=(i=Y(this.el,"count"))!=null?i:(n=this.pinInput)==null?void 0:n.api.count)!=null?r:4},t&&e?{value:e}:{}),{disabled:C(this.el,"disabled"),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly"),name:w(this.el,"name"),form:w(this.el,"form")}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.pinInput)==null||e.destroy()}}});var vp={};he(vp,{RadioGroup:()=>kO});function TO(e,t){let{context:n,send:i,computed:r,prop:s,scope:a}=e,o=r("isDisabled"),l=s("invalid"),c=s("readOnly");function u(d){return{value:d.value,invalid:!!d.invalid||!!l,disabled:!!d.disabled||o,checked:n.get("value")===d.value,focused:n.get("focusedValue")===d.value,focusVisible:n.get("focusVisibleValue")===d.value,hovered:n.get("hoveredValue")===d.value,active:n.get("activeValue")===d.value}}function h(d){let p=u(d);return{"data-focus":E(p.focused),"data-focus-visible":E(p.focusVisible),"data-disabled":E(p.disabled),"data-readonly":E(c),"data-state":p.checked?"checked":"unchecked","data-hover":E(p.hovered),"data-invalid":E(p.invalid),"data-orientation":s("orientation"),"data-ssr":E(n.get("ssr"))}}let m=()=>{var p;let d=(p=PO(a))!=null?p:IO(a);d==null||d.focus()};return{focus:m,value:n.get("value"),setValue(d){i({type:"SET_VALUE",value:d,isTrusted:!1})},clearValue(){i({type:"SET_VALUE",value:null,isTrusted:!1})},getRootProps(){return t.element(y(g({},Wi.root.attrs),{role:"radiogroup",id:Ca(a),"aria-labelledby":gp(a),"aria-required":s("required")||void 0,"aria-disabled":o||void 0,"aria-readonly":c||void 0,"data-orientation":s("orientation"),"data-disabled":E(o),"data-invalid":E(l),"data-required":E(s("required")),"aria-orientation":s("orientation"),dir:s("dir"),style:{position:"relative"}}))},getLabelProps(){return t.element(y(g({},Wi.label.attrs),{dir:s("dir"),"data-orientation":s("orientation"),"data-disabled":E(o),"data-invalid":E(l),"data-required":E(s("required")),id:gp(a),onClick:m}))},getItemState:u,getItemProps(d){let p=u(d);return t.label(y(g(y(g({},Wi.item.attrs),{dir:s("dir"),id:fp(a,d.value),htmlFor:$l(a,d.value)}),h(d)),{onPointerMove(){p.disabled||p.hovered||i({type:"SET_HOVERED",value:d.value,hovered:!0})},onPointerLeave(){p.disabled||i({type:"SET_HOVERED",value:null})},onPointerDown(v){p.disabled||pe(v)&&(p.focused&&v.pointerType==="mouse"&&v.preventDefault(),i({type:"SET_ACTIVE",value:d.value,active:!0}))},onPointerUp(){p.disabled||i({type:"SET_ACTIVE",value:null})},onClick(){var v;!p.disabled&&Xe()&&((v=bO(a,d.value))==null||v.focus())}}))},getItemTextProps(d){return t.element(g(y(g({},Wi.itemText.attrs),{dir:s("dir"),id:yO(a,d.value)}),h(d)))},getItemControlProps(d){let p=u(d);return t.element(g(y(g({},Wi.itemControl.attrs),{dir:s("dir"),id:vO(a,d.value),"data-active":E(p.active),"aria-hidden":!0}),h(d)))},getItemHiddenInputProps(d){let p=u(d);return t.input({"data-ownedby":Ca(a),id:$l(a,d.value),type:"radio",name:s("name")||s("id"),form:s("form"),value:d.value,required:s("required"),"aria-invalid":p.invalid||void 0,onClick(v){if(c){v.preventDefault();return}v.currentTarget.checked&&i({type:"SET_VALUE",value:d.value,isTrusted:!0})},onBlur(){i({type:"SET_FOCUSED",value:null,focused:!1,focusVisible:!1})},onFocus(){let v=En();i({type:"SET_FOCUSED",value:d.value,focused:!0,focusVisible:v})},onKeyDown(v){v.defaultPrevented||v.key===" "&&i({type:"SET_ACTIVE",value:d.value,active:!0})},onKeyUp(v){v.defaultPrevented||v.key===" "&&i({type:"SET_ACTIVE",value:null})},disabled:p.disabled||c,defaultChecked:p.checked,style:Vt})},getIndicatorProps(){let d=n.get("indicatorRect"),p=d==null||d.width===0&&d.height===0&&d.x===0&&d.y===0;return t.element(y(g({id:mp(a)},Wi.indicator.attrs),{dir:s("dir"),hidden:n.get("value")==null||p,"data-disabled":E(o),"data-orientation":s("orientation"),style:{"--transition-property":"left, top, width, height","--left":ye(d==null?void 0:d.x),"--top":ye(d==null?void 0:d.y),"--width":ye(d==null?void 0:d.width),"--height":ye(d==null?void 0:d.height),position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:"var(--transition-duration, 150ms)",transitionTimingFunction:"var(--transition-timing-function)",[s("orientation")==="horizontal"?"left":"top"]:s("orientation")==="horizontal"?"var(--left)":"var(--top)"}}))}}}var mO,Wi,Ca,gp,fp,$l,vO,yO,mp,Sa,bO,EO,IO,PO,pp,CO,SO,OO,wO,VO,RA,xO,DA,AO,kO,yp=re(()=>{"use strict";pr();se();mO=U("radio-group").parts("root","label","item","itemText","itemControl","indicator"),Wi=mO.build(),Ca=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`radio-group:${e.id}`},gp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`radio-group:${e.id}:label`},fp=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`radio-group:${e.id}:radio:${t}`},$l=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemHiddenInput)==null?void 0:i.call(n,t))!=null?r:`radio-group:${e.id}:radio:input:${t}`},vO=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemControl)==null?void 0:i.call(n,t))!=null?r:`radio-group:${e.id}:radio:control:${t}`},yO=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemLabel)==null?void 0:i.call(n,t))!=null?r:`radio-group:${e.id}:radio:label:${t}`},mp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicator)!=null?n:`radio-group:${e.id}:indicator`},Sa=e=>e.getById(Ca(e)),bO=(e,t)=>e.getById($l(e,t)),EO=e=>e.getById(mp(e)),IO=e=>{var t;return(t=Sa(e))==null?void 0:t.querySelector("input:not(:disabled)")},PO=e=>{var t;return(t=Sa(e))==null?void 0:t.querySelector("input:not(:disabled):checked")},pp=e=>{let n=`input[type=radio][data-ownedby='${CSS.escape(Ca(e))}']:not([disabled])`;return Fe(Sa(e),n)},CO=(e,t)=>{if(t)return e.getById(fp(e,t))},SO=e=>{var t,n,i,r;return{x:(t=e==null?void 0:e.offsetLeft)!=null?t:0,y:(n=e==null?void 0:e.offsetTop)!=null?n:0,width:(i=e==null?void 0:e.offsetWidth)!=null?i:0,height:(r=e==null?void 0:e.offsetHeight)!=null?r:0}};({not:OO}=Ee()),wO={props({props:e}){return g({orientation:"vertical"},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}})),activeValue:t(()=>({defaultValue:null})),focusedValue:t(()=>({defaultValue:null})),focusVisibleValue:t(()=>({defaultValue:null})),hoveredValue:t(()=>({defaultValue:null})),indicatorRect:t(()=>({defaultValue:null})),fieldsetDisabled:t(()=>({defaultValue:!1})),ssr:t(()=>({defaultValue:!0}))}},refs(){return{indicatorCleanup:null,focusVisibleValue:null}},computed:{isDisabled:({prop:e,context:t})=>!!e("disabled")||t.get("fieldsetDisabled")},entry:["syncIndicatorRect","syncSsr"],exit:["cleanupObserver"],effects:["trackFormControlState","trackFocusVisible"],watch({track:e,action:t,context:n}){e([()=>n.get("value")],()=>{t(["syncIndicatorRect","syncInputElements"])})},on:{SET_VALUE:[{guard:OO("isTrusted"),actions:["setValue","dispatchChangeEvent"]},{actions:["setValue"]}],SET_HOVERED:{actions:["setHovered"]},SET_ACTIVE:{actions:["setActive"]},SET_FOCUSED:{actions:["setFocused"]}},states:{idle:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackFormControlState({context:e,scope:t}){return wt(Sa(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){e.set("value",e.initial("value"))}})},trackFocusVisible({scope:e}){var t;return Pn({root:(t=e.getRootNode)==null?void 0:t.call(e)})}},actions:{setValue({context:e,event:t}){e.set("value",t.value)},setHovered({context:e,event:t}){e.set("hoveredValue",t.value)},setActive({context:e,event:t}){e.set("activeValue",t.value)},setFocused({context:e,event:t}){e.set("focusedValue",t.value);let n=t.value!=null&&t.focusVisible?t.value:null;e.set("focusVisibleValue",n)},syncInputElements({context:e,scope:t}){pp(t).forEach(i=>{i.checked=i.value===e.get("value")})},cleanupObserver({refs:e}){var t;(t=e.get("indicatorCleanup"))==null||t()},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,scope:t,refs:n}){var o;if((o=n.get("indicatorCleanup"))==null||o(),!EO(t))return;let i=e.get("value"),r=CO(t,i);if(i==null||!r){e.set("indicatorRect",null);return}let s=()=>{e.set("indicatorRect",SO(r))};s();let a=gn.observe(r,s);n.set("indicatorCleanup",a)},dispatchChangeEvent({context:e,scope:t}){pp(t).forEach(i=>{let r=i.value===e.get("value");r!==i.checked&&pi(i,{checked:r})})}}}},VO=_()(["dir","disabled","form","getRootNode","id","ids","invalid","name","onValueChange","orientation","readOnly","required","value","defaultValue"]),RA=B(VO),xO=_()(["value","disabled","invalid"]),DA=B(xO),AO=class extends K{initMachine(e){return new W(wO,e)}initApi(){return TO(this.machine.service,q)}render(){var i;let e=(i=this.el.querySelector('[data-scope="radio-group"][data-part="root"]'))!=null?i:this.el;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="radio-group"][data-part="label"]');t&&this.spreadProps(t,this.api.getLabelProps());let n=this.el.querySelector('[data-scope="radio-group"][data-part="indicator"]');n&&this.spreadProps(n,this.api.getIndicatorProps()),this.el.querySelectorAll('[data-scope="radio-group"][data-part="item"]').forEach(r=>{let s=r.dataset.value;if(s==null)return;let a=r.dataset.disabled==="true",o=r.dataset.invalid==="true";this.spreadProps(r,this.api.getItemProps({value:s,disabled:a,invalid:o}));let l=r.querySelector('[data-scope="radio-group"][data-part="item-text"]');l&&this.spreadProps(l,this.api.getItemTextProps({value:s,disabled:a,invalid:o}));let c=r.querySelector('[data-scope="radio-group"][data-part="item-control"]');c&&this.spreadProps(c,this.api.getItemControlProps({value:s,disabled:a,invalid:o}));let u=r.querySelector('[data-scope="radio-group"][data-part="item-hidden-input"]');u&&this.spreadProps(u,this.api.getItemHiddenInputProps({value:s,disabled:a,invalid:o}))})}},kO={mounted(){let e=this.el,t=w(e,"value"),n=w(e,"defaultValue"),i=C(e,"controlled"),r=new AO(e,y(g({id:e.id},i&&t!==void 0?{value:t!=null?t:null}:{defaultValue:n!=null?n:null}),{name:w(e,"name"),form:w(e,"form"),disabled:C(e,"disabled"),invalid:C(e,"invalid"),required:C(e,"required"),readOnly:C(e,"readOnly"),dir:w(e,"dir",["ltr","rtl"]),orientation:w(e,"orientation",["horizontal","vertical"]),onValueChange:s=>{let a=w(e,"onValueChange");a&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(a,{value:s.value,id:e.id});let o=w(e,"onValueChangeClient");o&&e.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:{value:s,id:e.id}}))}}));r.init(),this.radioGroup=r,this.handlers=[]},updated(){var n;let e=w(this.el,"value"),t=C(this.el,"controlled");(n=this.radioGroup)==null||n.updateProps(y(g({id:this.el.id},t&&e!==void 0?{value:e!=null?e:null}:{}),{name:w(this.el,"name"),form:w(this.el,"form"),disabled:C(this.el,"disabled"),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly"),orientation:w(this.el,"orientation",["horizontal","vertical"])}))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.radioGroup)==null||e.destroy()}}});var Tp={};he(Tp,{Select:()=>zO});function FO(e,t){let{context:n,prop:i,scope:r,state:s,computed:a,send:o}=e,l=i("disabled")||n.get("fieldsetDisabled"),c=!!i("invalid"),u=!!i("required"),h=!!i("readOnly"),m=i("composite"),d=i("collection"),p=s.hasTag("open"),v=s.matches("focused"),I=n.get("highlightedValue"),T=n.get("highlightedItem"),O=n.get("selectedItems"),b=n.get("currentPlacement"),f=a("isTypingAhead"),S=a("isInteractive"),P=I?Ul(r,I):void 0;function V(x){let k=d.getItemDisabled(x.item),N=d.getItemValue(x.item);return vn(N,()=>`[zag-js] No value found for item ${JSON.stringify(x.item)}`),{value:N,disabled:!!(l||k),highlighted:I===N,selected:n.get("value").includes(N)}}let A=On(y(g({},i("positioning")),{placement:b}));return{open:p,focused:v,empty:n.get("value").length===0,highlightedItem:T,highlightedValue:I,selectedItems:O,hasSelectedItems:a("hasSelectedItems"),value:n.get("value"),valueAsString:a("valueAsString"),collection:d,multiple:!!i("multiple"),disabled:!!l,reposition(x={}){o({type:"POSITIONING.SET",options:x})},focus(){var x;(x=ri(r))==null||x.focus({preventScroll:!0})},setOpen(x){s.hasTag("open")!==x&&o({type:x?"OPEN":"CLOSE"})},selectValue(x){o({type:"ITEM.SELECT",value:x})},setValue(x){o({type:"VALUE.SET",value:x})},selectAll(){o({type:"VALUE.SET",value:d.getValues()})},setHighlightValue(x){o({type:"HIGHLIGHTED_VALUE.SET",value:x})},clearHighlightValue(){o({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(x){o(x?{type:"ITEM.CLEAR",value:x}:{type:"VALUE.CLEAR"})},getItemState:V,getRootProps(){return t.element(y(g({},_e.root.attrs),{dir:i("dir"),id:RO(r),"data-invalid":E(c),"data-readonly":E(h)}))},getLabelProps(){return t.label(y(g({dir:i("dir"),id:Ta(r)},_e.label.attrs),{"data-disabled":E(l),"data-invalid":E(c),"data-readonly":E(h),"data-required":E(u),htmlFor:ql(r),onClick(x){var k;x.defaultPrevented||l||(k=ri(r))==null||k.focus({preventScroll:!0})}}))},getControlProps(){return t.element(y(g({},_e.control.attrs),{dir:i("dir"),id:DO(r),"data-state":p?"open":"closed","data-focus":E(v),"data-disabled":E(l),"data-invalid":E(c)}))},getValueTextProps(){return t.element(y(g({},_e.valueText.attrs),{dir:i("dir"),"data-disabled":E(l),"data-invalid":E(c),"data-focus":E(v)}))},getTriggerProps(){return t.button(y(g({id:Gl(r),disabled:l,dir:i("dir"),type:"button",role:"combobox","aria-controls":_l(r),"aria-expanded":p,"aria-haspopup":"listbox","data-state":p?"open":"closed","aria-invalid":c,"aria-required":u,"aria-labelledby":Ta(r)},_e.trigger.attrs),{"data-disabled":E(l),"data-invalid":E(c),"data-readonly":E(h),"data-placement":b,"data-placeholder-shown":E(!a("hasSelectedItems")),onClick(x){S&&(x.defaultPrevented||o({type:"TRIGGER.CLICK"}))},onFocus(){o({type:"TRIGGER.FOCUS"})},onBlur(){o({type:"TRIGGER.BLUR"})},onKeyDown(x){if(x.defaultPrevented||!S)return;let N={ArrowUp(){o({type:"TRIGGER.ARROW_UP"})},ArrowDown(D){o({type:D.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){o({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){o({type:"TRIGGER.ARROW_RIGHT"})},Home(){o({type:"TRIGGER.HOME"})},End(){o({type:"TRIGGER.END"})},Enter(){o({type:"TRIGGER.ENTER"})},Space(D){o(f?{type:"TRIGGER.TYPEAHEAD",key:D.key}:{type:"TRIGGER.ENTER"})}}[ge(x,{dir:i("dir"),orientation:"vertical"})];if(N){N(x),x.preventDefault();return}Ue.isValidEvent(x)&&(o({type:"TRIGGER.TYPEAHEAD",key:x.key}),x.preventDefault())}}))},getIndicatorProps(){return t.element(y(g({},_e.indicator.attrs),{dir:i("dir"),"aria-hidden":!0,"data-state":p?"open":"closed","data-disabled":E(l),"data-invalid":E(c),"data-readonly":E(h)}))},getItemProps(x){let k=V(x);return t.element(y(g({id:Ul(r,k.value),role:"option"},_e.item.attrs),{dir:i("dir"),"data-value":k.value,"aria-selected":k.selected,"data-state":k.selected?"checked":"unchecked","data-highlighted":E(k.highlighted),"data-disabled":E(k.disabled),"aria-disabled":X(k.disabled),onPointerMove(N){k.disabled||N.pointerType!=="mouse"||k.value!==I&&o({type:"ITEM.POINTER_MOVE",value:k.value})},onClick(N){N.defaultPrevented||k.disabled||o({type:"ITEM.CLICK",src:"pointerup",value:k.value})},onPointerLeave(N){var $;k.disabled||x.persistFocus||N.pointerType!=="mouse"||!(($=e.event.previous())!=null&&$.type.includes("POINTER"))||o({type:"ITEM.POINTER_LEAVE"})}}))},getItemTextProps(x){let k=V(x);return t.element(y(g({},_e.itemText.attrs),{"data-state":k.selected?"checked":"unchecked","data-disabled":E(k.disabled),"data-highlighted":E(k.highlighted)}))},getItemIndicatorProps(x){let k=V(x);return t.element(y(g({"aria-hidden":!0},_e.itemIndicator.attrs),{"data-state":k.selected?"checked":"unchecked",hidden:!k.selected}))},getItemGroupLabelProps(x){let{htmlFor:k}=x;return t.element(y(g({},_e.itemGroupLabel.attrs),{id:bp(r,k),dir:i("dir"),role:"presentation"}))},getItemGroupProps(x){let{id:k}=x;return t.element(y(g({},_e.itemGroup.attrs),{"data-disabled":E(l),id:LO(r,k),"aria-labelledby":bp(r,k),role:"group",dir:i("dir")}))},getClearTriggerProps(){return t.button(y(g({},_e.clearTrigger.attrs),{id:Cp(r),type:"button","aria-label":"Clear value","data-invalid":E(c),disabled:l,hidden:!a("hasSelectedItems"),dir:i("dir"),onClick(x){x.defaultPrevented||o({type:"CLEAR.CLICK"})}}))},getHiddenSelectProps(){let x=n.get("value"),k=i("multiple")?x:x==null?void 0:x[0];return t.select({name:i("name"),form:i("form"),disabled:l,multiple:i("multiple"),required:i("required"),"aria-hidden":!0,id:ql(r),defaultValue:k,style:Vt,tabIndex:-1,onFocus(){var N;(N=ri(r))==null||N.focus({preventScroll:!0})},"aria-labelledby":Ta(r)})},getPositionerProps(){return t.element(y(g({},_e.positioner.attrs),{dir:i("dir"),id:Sp(r),style:A.floating}))},getContentProps(){return t.element(y(g({hidden:!p,dir:i("dir"),id:_l(r),role:m?"listbox":"dialog"},_e.content.attrs),{"data-state":p?"open":"closed","data-placement":b,"data-activedescendant":P,"aria-activedescendant":m?P:void 0,"aria-multiselectable":i("multiple")&&m?!0:void 0,"aria-labelledby":Ta(r),tabIndex:0,onKeyDown(x){if(!S||!ce(x.currentTarget,j(x)))return;if(x.key==="Tab"&&!ds(x)){x.preventDefault();return}let k={ArrowUp(){o({type:"CONTENT.ARROW_UP"})},ArrowDown(){o({type:"CONTENT.ARROW_DOWN"})},Home(){o({type:"CONTENT.HOME"})},End(){o({type:"CONTENT.END"})},Enter(){o({type:"ITEM.CLICK",src:"keydown.enter"})},Space($){var te;f?o({type:"CONTENT.TYPEAHEAD",key:$.key}):(te=k.Enter)==null||te.call(k,$)}},N=k[ge(x)];if(N){N(x),x.preventDefault();return}let D=j(x);Ot(D)||Ue.isValidEvent(x)&&(o({type:"CONTENT.TYPEAHEAD",key:x.key}),x.preventDefault())}}))},getListProps(){return t.element(y(g({},_e.list.attrs),{tabIndex:0,role:m?void 0:"listbox","aria-labelledby":Gl(r),"aria-activedescendant":m?void 0:P,"aria-multiselectable":!m&&i("multiple")?!0:void 0}))}}}function Ip(e){var n,i;let t=(i=e.restoreFocus)!=null?i:(n=e.previousEvent)==null?void 0:n.restoreFocus;return t==null||!!t}function Pp(e,t){return Ki(t?{items:e,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var i;return(i=n.group)!=null?i:""}}:{items:e,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled})}function WO(e){return e.replace(/_([a-z])/g,(t,n)=>n.toUpperCase())}function KO(e){let t={};for(let[n,i]of Object.entries(e)){let r=WO(n);t[r]=i}return t}var NO,_e,Ki,RO,_l,Gl,Cp,Ta,DO,Ul,ql,Sp,LO,bp,Hl,$r,ri,MO,Ep,Bl,Hr,ii,$O,HO,BO,GA,_O,UA,GO,qA,UO,WA,qO,zO,Op=re(()=>{"use strict";yr();Pr();Wn();tn();se();NO=U("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),_e=NO.build(),Ki=e=>new Nt(e);Ki.empty=()=>new Nt({items:[]});RO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`select:${e.id}`},_l=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`select:${e.id}:content`},Gl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`select:${e.id}:trigger`},Cp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.clearTrigger)!=null?n:`select:${e.id}:clear-trigger`},Ta=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`select:${e.id}:label`},DO=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`select:${e.id}:control`},Ul=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:option:${t}`},ql=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenSelect)!=null?n:`select:${e.id}:select`},Sp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.positioner)!=null?n:`select:${e.id}:positioner`},LO=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroup)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:optgroup:${t}`},bp=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.itemGroupLabel)==null?void 0:i.call(n,t))!=null?r:`select:${e.id}:optgroup-label:${t}`},Hl=e=>e.getById(ql(e)),$r=e=>e.getById(_l(e)),ri=e=>e.getById(Gl(e)),MO=e=>e.getById(Cp(e)),Ep=e=>e.getById(Sp(e)),Bl=(e,t)=>t==null?null:e.getById(Ul(e,t));({and:Hr,not:ii,or:$O}=Ee()),HO={props({props:e}){var t;return y(g({loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[]},e),{collection:(t=e.collection)!=null?t:Ki.empty(),positioning:g({placement:"bottom-start",gutter:8},e.positioning)})},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:fe,onChange(n){var r;let i=e("collection").findMany(n);return(r=e("onValueChange"))==null?void 0:r({value:n,items:i})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(n){var i;(i=e("onHighlightChange"))==null||i({highlightedValue:n,highlightedItem:e("collection").find(n),highlightedIndex:e("collection").indexOf(n)})}})),currentPlacement:t(()=>({defaultValue:void 0})),fieldsetDisabled:t(()=>({defaultValue:!1})),highlightedItem:t(()=>({defaultValue:null})),selectedItems:t(()=>{var r,s;let n=(s=(r=e("value"))!=null?r:e("defaultValue"))!=null?s:[];return{defaultValue:e("collection").findMany(n)}})}},refs(){return{typeahead:g({},Ue.defaultOptions)}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isDisabled:({prop:e,context:t})=>!!e("disabled")||!!t.get("fieldsetDisabled"),isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),valueAsString:({context:e,prop:t})=>t("collection").stringifyItems(e.get("selectedItems"))},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},entry:["syncSelectElement"],watch({context:e,prop:t,track:n,action:i}){n([()=>e.get("value").toString()],()=>{i(["syncSelectedItems","syncSelectElement","dispatchChangeEvent"])}),n([()=>t("open")],()=>{i(["toggleVisibility"])}),n([()=>e.get("highlightedValue")],()=>{i(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{i(["syncCollection"])})},on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"CLEAR.CLICK":{actions:["clearSelectedItems","focusTriggerEl"]}},effects:["trackFormControlState"],states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{target:"open",actions:["setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus","highlightFirstSelectedItem"]}],"TRIGGER.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{guard:"isTriggerArrowUpEvent",target:"open",actions:["setInitialFocus","highlightComputedLastItem"]},{guard:$O("isTriggerArrowDownEvent","isTriggerEnterEvent"),target:"open",actions:["setInitialFocus","highlightComputedFirstItem"]},{target:"open",actions:["setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}],"TRIGGER.BLUR":{target:"idle"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightFirstSelectedItem"]}],"TRIGGER.ENTER":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_UP":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedLastItem"]}],"TRIGGER.ARROW_DOWN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_LEFT":[{guard:Hr(ii("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:ii("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:Hr(ii("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:ii("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:ii("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:ii("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:ii("multiple"),actions:["selectMatchingItem"]}}},open:{tags:["open"],exit:["scrollContentToTop"],effects:["trackDismissableElement","computePlacement","scrollToHighlightedItem"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["clearHighlightedItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"restoreFocus",target:"focused",actions:["invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["invokeOnClose","clearHighlightedItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","clearHighlightedItem"]}],"ITEM.CLICK":[{guard:Hr("closeOnSelect","isOpenControlled"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{actions:["selectHighlightedItem"]}],"CONTENT.HOME":{actions:["highlightFirstItem"]},"CONTENT.END":{actions:["highlightLastItem"]},"CONTENT.ARROW_DOWN":[{guard:Hr("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:Hr("hasHighlightedItem","loop","isFirstItemHighlighted"),actions:["highlightLastItem"]},{guard:"hasHighlightedItem",actions:["highlightPreviousItem"]},{actions:["highlightLastItem"]}],"CONTENT.TYPEAHEAD":{actions:["highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{loop:({prop:e})=>!!e("loopFocus"),multiple:({prop:e})=>!!e("multiple"),hasSelectedItems:({computed:e})=>!!e("hasSelectedItems"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,isFirstItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").firstValue,isLastItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").lastValue,closeOnSelect:({prop:e,event:t})=>{var n;return!!((n=t.closeOnSelect)!=null?n:e("closeOnSelect"))},restoreFocus:({event:e})=>Ip(e),isOpenControlled:({prop:e})=>e("open")!==void 0,isTriggerClickEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.CLICK"},isTriggerEnterEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ENTER"},isTriggerArrowUpEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ARROW_UP"},isTriggerArrowDownEvent:({event:e})=>{var t;return((t=e.previousEvent)==null?void 0:t.type)==="TRIGGER.ARROW_DOWN"}},effects:{trackFormControlState({context:e,scope:t}){return wt(Hl(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){let n=e.initial("value");e.set("value",n)}})},trackDismissableElement({scope:e,send:t,prop:n}){let i=()=>$r(e),r=!0;return Ft(i,{type:"listbox",defer:!0,exclude:[ri(e),MO(e)],onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(s){var a;(a=n("onInteractOutside"))==null||a(s),r=!(s.detail.focusable||s.detail.contextmenu)},onDismiss(){t({type:"CLOSE",src:"interact-outside",restoreFocus:r})}})},computePlacement({context:e,prop:t,scope:n}){let i=t("positioning");return e.set("currentPlacement",i.placement),It(()=>ri(n),()=>Ep(n),y(g({defer:!0},i),{onComplete(a){e.set("currentPlacement",a.placement)}}))},scrollToHighlightedItem({context:e,prop:t,scope:n,event:i}){let r=a=>{let o=e.get("highlightedValue");if(o==null||i.current().type.includes("POINTER"))return;let l=$r(n),c=t("scrollToIndexFn");if(c){let h=t("collection").indexOf(o);c==null||c({index:h,immediate:a,getElement:()=>Bl(n,o)});return}let u=Bl(n,o);Xt(u,{rootEl:l,block:"nearest"})};return H(()=>r(!0)),ot(()=>$r(n),{defer:!0,attributes:["data-activedescendant"],callback(){r(!1)}})}},actions:{reposition({context:e,prop:t,scope:n,event:i}){let r=()=>Ep(n);It(ri(n),r,y(g(g({},t("positioning")),i.options),{defer:!0,listeners:!1,onComplete(s){e.set("currentPlacement",s.placement)}}))},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})},highlightPreviousItem({context:e,prop:t}){let n=e.get("highlightedValue");if(n==null)return;let i=t("collection").getPreviousValue(n,1,t("loopFocus"));i!=null&&e.set("highlightedValue",i)},highlightNextItem({context:e,prop:t}){let n=e.get("highlightedValue");if(n==null)return;let i=t("collection").getNextValue(n,1,t("loopFocus"));i!=null&&e.set("highlightedValue",i)},highlightFirstItem({context:e,prop:t}){let n=t("collection").firstValue;e.set("highlightedValue",n)},highlightLastItem({context:e,prop:t}){let n=t("collection").lastValue;e.set("highlightedValue",n)},setInitialFocus({scope:e}){H(()=>{let t=us({root:$r(e)});t==null||t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){Ip(e)&&H(()=>{let n=ri(t);n==null||n.focus({preventScroll:!0})})},selectHighlightedItem({context:e,prop:t,event:n}){var s,a;let i=(s=n.value)!=null?s:e.get("highlightedValue");if(i==null||!t("collection").has(i))return;(a=t("onSelect"))==null||a({value:i}),i=t("deselectable")&&!t("multiple")&&e.get("value").includes(i)?null:i,e.set("value",o=>i==null?[]:t("multiple")?yt(o,i):[i])},highlightComputedFirstItem({context:e,prop:t,computed:n}){let i=t("collection"),r=n("hasSelectedItems")?i.sort(e.get("value"))[0]:i.firstValue;e.set("highlightedValue",r)},highlightComputedLastItem({context:e,prop:t,computed:n}){let i=t("collection"),r=n("hasSelectedItems")?i.sort(e.get("value"))[0]:i.lastValue;e.set("highlightedValue",r)},highlightFirstSelectedItem({context:e,prop:t,computed:n}){if(!n("hasSelectedItems"))return;let i=t("collection").sort(e.get("value"))[0];e.set("highlightedValue",i)},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:i}){let r=t("collection").search(n.key,{state:i.get("typeahead"),currentValue:e.get("highlightedValue")});r!=null&&e.set("highlightedValue",r)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n}){var s;(s=t("onSelect"))==null||s({value:n.value});let r=t("deselectable")&&!t("multiple")&&e.get("value").includes(n.value)?null:n.value;e.set("value",a=>r==null?[]:t("multiple")?yt(a,r):[r])},clearItem({context:e,event:t}){e.set("value",n=>n.filter(i=>i!==t.value))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},selectPreviousItem({context:e,prop:t}){let[n]=e.get("value"),i=t("collection").getPreviousValue(n);i&&e.set("value",[i])},selectNextItem({context:e,prop:t}){let[n]=e.get("value"),i=t("collection").getNextValue(n);i&&e.set("value",[i])},selectFirstItem({context:e,prop:t}){let n=t("collection").firstValue;n&&e.set("value",[n])},selectLastItem({context:e,prop:t}){let n=t("collection").lastValue;n&&e.set("value",[n])},selectMatchingItem({context:e,prop:t,event:n,refs:i}){let r=t("collection").search(n.key,{state:i.get("typeahead"),currentValue:e.get("value")[0]});r!=null&&e.set("value",[r])},scrollContentToTop({prop:e,scope:t}){var n,i;if(e("scrollToIndexFn")){let r=e("collection").firstValue;(n=e("scrollToIndexFn"))==null||n({index:0,immediate:!0,getElement:()=>Bl(t,r)})}else(i=$r(t))==null||i.scrollTo(0,0)},invokeOnOpen({prop:e,context:t}){var n;(n=e("onOpenChange"))==null||n({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){var n;(n=e("onOpenChange"))==null||n({open:!1,value:t.get("value")})},syncSelectElement({context:e,prop:t,scope:n}){let i=Hl(n);if(i){if(e.get("value").length===0&&!t("multiple")){i.selectedIndex=-1;return}for(let r of i.options)r.selected=e.get("value").includes(r.value)}},syncCollection({context:e,prop:t}){let n=t("collection"),i=n.find(e.get("highlightedValue"));i&&e.set("highlightedItem",i);let r=n.findMany(e.get("value"));e.set("selectedItems",r)},syncSelectedItems({context:e,prop:t}){let n=t("collection"),i=e.get("selectedItems"),s=e.get("value").map(a=>i.find(l=>n.getItemValue(l)===a)||n.find(a));e.set("selectedItems",s)},syncHighlightedItem({context:e,prop:t}){let n=t("collection"),i=e.get("highlightedValue"),r=i?n.find(i):null;e.set("highlightedItem",r)},dispatchChangeEvent({scope:e}){queueMicrotask(()=>{let t=Hl(e);if(!t)return;let n=e.getWin(),i=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(i)})}}}};BO=_()(["closeOnSelect","collection","composite","defaultHighlightedValue","defaultOpen","defaultValue","deselectable","dir","disabled","form","getRootNode","highlightedValue","id","ids","invalid","loopFocus","multiple","name","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onSelect","onValueChange","open","positioning","readOnly","required","scrollToIndexFn","value"]),GA=B(BO),_O=_()(["item","persistFocus"]),UA=B(_O),GO=_()(["id"]),qA=B(GO),UO=_()(["htmlFor"]),WA=B(UO),qO=class extends K{constructor(t,n){var r;super(t,n);z(this,"_options",[]);z(this,"hasGroups",!1);z(this,"placeholder","");z(this,"init",()=>{this.machine.start(),this.render(),this.machine.subscribe(()=>{this.api=this.initApi(),this.render()})});let i=n.collection;this._options=(r=i==null?void 0:i.items)!=null?r:[],this.placeholder=w(this.el,"placeholder")||""}get options(){return Array.isArray(this._options)?this._options:[]}setOptions(t){this._options=Array.isArray(t)?t:[]}getCollection(){let t=this.options;return this.hasGroups?Ki({items:t,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled,groupBy:n=>{var i;return(i=n.group)!=null?i:""}}):Ki({items:t,itemToValue:n=>{var i,r;return(r=(i=n.id)!=null?i:n.value)!=null?r:""},itemToString:n=>n.label,isItemDisabled:n=>!!n.disabled})}initMachine(t){let n=this.getCollection.bind(this),i=t.collection;return new W(HO,y(g({},t),{get collection(){return i!=null?i:n()}}))}initApi(){return FO(this.machine.service,q)}applyItemProps(){let t=this.el.querySelector('[data-scope="select"][data-part="content"]');t&&(t.querySelectorAll('[data-scope="select"][data-part="item-group"]').forEach(n=>{var s;let i=(s=n.dataset.id)!=null?s:"";this.spreadProps(n,this.api.getItemGroupProps({id:i}));let r=n.querySelector('[data-scope="select"][data-part="item-group-label"]');r&&this.spreadProps(r,this.api.getItemGroupLabelProps({htmlFor:i}))}),t.querySelectorAll('[data-scope="select"][data-part="item"]').forEach(n=>{var o;let i=(o=n.dataset.value)!=null?o:"",r=this.options.find(l=>{var c,u;return String((u=(c=l.id)!=null?c:l.value)!=null?u:"")===String(i)});if(!r)return;this.spreadProps(n,this.api.getItemProps({item:r}));let s=n.querySelector('[data-scope="select"][data-part="item-text"]');s&&this.spreadProps(s,this.api.getItemTextProps({item:r}));let a=n.querySelector('[data-scope="select"][data-part="item-indicator"]');a&&this.spreadProps(a,this.api.getItemIndicatorProps({item:r}))}))}render(){var a;let t=(a=this.el.querySelector('[data-scope="select"][data-part="root"]'))!=null?a:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="select"][data-part="hidden-select"]'),i=this.el.querySelector('[data-scope="select"][data-part="value-input"]');i&&(!this.api.value||this.api.value.length===0?i.value="":this.api.value.length===1?i.value=String(this.api.value[0]):i.value=this.api.value.map(String).join(",")),n&&this.spreadProps(n,this.api.getHiddenSelectProps()),["label","control","trigger","indicator","clear-trigger","positioner"].forEach(o=>{let l=this.el.querySelector(`[data-scope="select"][data-part="${o}"]`);if(!l)return;let c="get"+o.split("-").map(u=>u[0].toUpperCase()+u.slice(1)).join("")+"Props";this.spreadProps(l,this.api[c]())});let r=this.el.querySelector('[data-scope="select"][data-part="item-text"]');if(r){let o=this.api.valueAsString;if(this.api.value&&this.api.value.length>0&&!o){let l=this.api.value[0],c=this.options.find(u=>{var m,d;let h=(d=(m=u.id)!=null?m:u.value)!=null?d:"";return String(h)===String(l)});c?r.textContent=c.label:r.textContent=this.placeholder||""}else r.textContent=o||this.placeholder||""}let s=this.el.querySelector('[data-scope="select"][data-part="content"]');s&&(this.spreadProps(s,this.api.getContentProps()),this.applyItemProps())}};zO={mounted(){let e=this.el,t=JSON.parse(e.dataset.collection||"[]"),n=t.some(s=>s.group!==void 0),i=Pp(t,n),r=new qO(e,y(g({id:e.id,collection:i},C(e,"controlled")?{value:Q(e,"value")}:{defaultValue:Q(e,"defaultValue")}),{disabled:C(e,"disabled"),closeOnSelect:C(e,"closeOnSelect"),dir:w(e,"dir",["ltr","rtl"]),loopFocus:C(e,"loopFocus"),multiple:C(e,"multiple"),invalid:C(e,"invalid"),name:w(e,"name"),form:w(e,"form"),readOnly:C(e,"readOnly"),required:C(e,"required"),positioning:(()=>{let s=e.dataset.positioning;if(s)try{let a=JSON.parse(s);return KO(a)}catch(a){return}})(),onValueChange:s=>{var T;let a=C(e,"redirect"),o=s.value.length>0?String(s.value[0]):null,l=(T=s.items)!=null&&T.length?s.items[0]:null,c=l&&typeof l=="object"&&l!==null&&"redirect"in l?l.redirect:void 0,u=l&&typeof l=="object"&&l!==null&&"new_tab"in l?l.new_tab:void 0;a&&o&&this.liveSocket.main.isDead&&c!==!1&&(u===!0?window.open(o,"_blank","noopener,noreferrer"):window.location.href=o);let d=e.querySelector('[data-scope="select"][data-part="value-input"]');d&&(d.value=s.value.length===0?"":s.value.length===1?String(s.value[0]):s.value.map(String).join(","),d.dispatchEvent(new Event("input",{bubbles:!0})),d.dispatchEvent(new Event("change",{bubbles:!0})));let p={value:s.value,items:s.items,id:e.id},v=w(e,"onValueChangeClient");v&&e.dispatchEvent(new CustomEvent(v,{bubbles:!0,detail:p}));let I=w(e,"onValueChange");I&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(I,p)}}));r.hasGroups=n,r.setOptions(t),r.init(),this.select=r,this.handlers=[]},updated(){let e=JSON.parse(this.el.dataset.collection||"[]"),t=e.some(n=>n.group!==void 0);this.select&&(this.select.hasGroups=t,this.select.setOptions(e),this.select.updateProps(y(g({collection:Pp(e,t),id:this.el.id},C(this.el,"controlled")?{value:Q(this.el,"value")}:{defaultValue:Q(this.el,"defaultValue")}),{name:w(this.el,"name"),form:w(this.el,"form"),disabled:C(this.el,"disabled"),multiple:C(this.el,"multiple"),dir:w(this.el,"dir",["ltr","rtl"]),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly")})))},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.select)==null||e.destroy()}}});var Kp={};he(Kp,{SignaturePad:()=>Ew});function xp(e,t,n,i=r=>r){return e*i(.5-t*(.5-n))}function Bp(e,t,n){let i=Wl(1,t/n);return Wl(1,e+(Wl(1,1-i)-e)*(i*.275))}function jO(e){return[-e[0],-e[1]]}function Bt(e,t){return[e[0]+t[0],e[1]+t[1]]}function Ap(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function Nn(e,t){return[e[0]-t[0],e[1]-t[1]]}function Yl(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function kn(e,t){return[e[0]*t,e[1]*t]}function Kl(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function XO(e,t){return[e[0]/t,e[1]/t]}function _p(e){return[e[1],-e[0]]}function zl(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function kp(e,t){return e[0]*t[0]+e[1]*t[1]}function ZO(e,t){return e[0]===t[0]&&e[1]===t[1]}function JO(e){return Math.hypot(e[0],e[1])}function Np(e,t){let n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i}function Gp(e){return XO(e,JO(e))}function QO(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function jl(e,t,n){let i=Math.sin(n),r=Math.cos(n),s=e[0]-t[0],a=e[1]-t[1],o=s*r-a*i,l=s*i+a*r;return[o+t[0],l+t[1]]}function Rp(e,t,n,i){let r=Math.sin(i),s=Math.cos(i),a=t[0]-n[0],o=t[1]-n[1],l=a*s-o*r,c=a*r+o*s;return e[0]=l+n[0],e[1]=c+n[1],e}function Dp(e,t,n){return Bt(e,kn(Nn(t,e),n))}function ew(e,t,n,i){let r=n[0]-t[0],s=n[1]-t[1];return e[0]=t[0]+r*i,e[1]=t[1]+s*i,e}function Up(e,t,n){return Bt(e,kn(t,n))}function tw(e,t){let n=Up(e,Gp(_p(Nn(e,Bt(e,[1,1])))),-t),i=[],r=1/13;for(let s=r;s<=1;s+=r)i.push(jl(n,e,Br*2*s));return i}function nw(e,t,n){let i=[],r=1/n;for(let s=r;s<=1;s+=r)i.push(jl(t,e,Br*s));return i}function iw(e,t,n){let i=Nn(t,n),r=kn(i,.5),s=kn(i,.51);return[Nn(e,r),Nn(e,s),Bt(e,s),Bt(e,r)]}function rw(e,t,n,i){let r=[],s=Up(e,t,n),a=1/i;for(let o=a;o<1;o+=a)r.push(jl(s,e,Br*3*o));return r}function sw(e,t,n){return[Bt(e,kn(t,n)),Bt(e,kn(t,n*.99)),Nn(e,kn(t,n*.99)),Nn(e,kn(t,n))]}function Lp(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function aw(e,t,n){return e.slice(0,10).reduce((i,r)=>{let s=r.pressure;return t&&(s=Bp(i,r.distance,n)),(i+s)/2},e[0].pressure)}function ow(e,t={}){let{size:n=16,smoothing:i=.5,thinning:r=.5,simulatePressure:s=!0,easing:a=J=>J,start:o={},end:l={},last:c=!1}=t,{cap:u=!0,easing:h=J=>J*(2-J)}=o,{cap:m=!0,easing:d=J=>--J*J*J+1}=l;if(e.length===0||n<=0)return[];let p=e[e.length-1].runningLength,v=Lp(o.taper,n,p),I=Lp(l.taper,n,p),T=(n*i)**2,O=[],b=[],f=aw(e,s,n),S=xp(n,r,e[e.length-1].pressure,a),P,V=e[0].vector,A=e[0].point,x=A,k=A,N=x,D=!1;for(let J=0;JT)&&(O.push(k),A=k),Ap(An,Pe,De),N=[An[0],An[1]],(J<=1||Np(x,N)>T)&&(b.push(N),x=N),f=Se,V=ne}let $=[e[0].point[0],e[0].point[1]],te=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:Bt(e[0].point,[1,1]),Z=[],ie=[];if(e.length===1){if(!(v||I)||c)return tw($,P||S)}else{v||I&&e.length===1||(u?Z.push(...nw($,b[0],13)):Z.push(...iw($,O[0],b[0])));let J=_p(jO(e[e.length-1].vector));I||v&&e.length===1?ie.push(te):m?ie.push(...rw(te,J,S,29)):ie.push(...sw(te,J,S))}return O.concat(ie,b.reverse(),Z)}function Fp(e){return e!=null&&e>=0}function lw(e,t={}){var m;let{streamline:n=.5,size:i=16,last:r=!1}=t;if(e.length===0)return[];let s=.15+(1-n)*.85,a=Array.isArray(e[0])?e:e.map(({x:d,y:p,pressure:v=wp})=>[d,p,v]);if(a.length===2){let d=a[1];a=a.slice(0,-1);for(let p=1;p<5;p++)a.push(Dp(a[0],d,p/4))}a.length===1&&(a=[...a,[...Bt(a[0],Vp),...a[0].slice(2)]]);let o=[{point:[a[0][0],a[0][1]],pressure:Fp(a[0][2])?a[0][2]:.25,vector:[...Vp],distance:0,runningLength:0}],l=!1,c=0,u=o[0],h=a.length-1;for(let d=1;d{"use strict";se();({PI:YO}=Math),Br=YO+1e-4,wp=.5,Vp=[1,1];({min:Wl}=Math);De=[0,0],xn=[0,0],An=[0,0];Mp=[0,0];uw=cw,dw=U("signature-pad").parts("root","control","segment","segmentPath","guide","clearTrigger","label"),si=dw.build(),hw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`signature-${e.id}`},qp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`signature-control-${e.id}`},gw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`signature-label-${e.id}`},$p=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`signature-input-${e.id}`},Va=e=>e.getById(qp(e)),pw=e=>vi(Va(e),"[data-part=segment]"),Wp=(e,t)=>Sc(pw(e),t);Oa=(e,t)=>(e+t)/2;vw={props({props:e}){return y(g({defaultPaths:[]},e),{drawing:g({size:2,simulatePressure:!1,thinning:.7,smoothing:.4,streamline:.6},e.drawing),translations:g({control:"signature pad",clearTrigger:"clear signature"},e.translations)})},initialState(){return"idle"},context({prop:e,bindable:t}){return{paths:t(()=>({defaultValue:e("defaultPaths"),value:e("paths"),sync:!0,onChange(n){var i;(i=e("onDraw"))==null||i({paths:n})}})),currentPoints:t(()=>({defaultValue:[]})),currentPath:t(()=>({defaultValue:null}))}},computed:{isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),isEmpty:({context:e})=>e.get("paths").length===0},on:{CLEAR:{actions:["clearPoints","invokeOnDrawEnd","focusCanvasEl"]}},states:{idle:{on:{POINTER_DOWN:{target:"drawing",actions:["addPoint"]}}},drawing:{effects:["trackPointerMove"],on:{POINTER_MOVE:{actions:["addPoint","invokeOnDraw"]},POINTER_UP:{target:"idle",actions:["endStroke","invokeOnDrawEnd"]}}}},implementations:{effects:{trackPointerMove({scope:e,send:t}){let n=e.getDoc();return hn(n,{onPointerMove({event:i,point:r}){let s=Va(e);if(!s)return;let{offset:a}=to(r,s);t({type:"POINTER_MOVE",point:a,pressure:i.pressure})},onPointerUp(){t({type:"POINTER_UP"})}})}},actions:{addPoint({context:e,event:t,prop:n}){let i=[...e.get("currentPoints"),t.point];e.set("currentPoints",i);let r=uw(i,n("drawing"));e.set("currentPath",mw(r))},endStroke({context:e}){let t=[...e.get("paths"),e.get("currentPath")];e.set("paths",t),e.set("currentPoints",[]),e.set("currentPath",null)},clearPoints({context:e}){e.set("currentPoints",[]),e.set("paths",[]),e.set("currentPath",null)},focusCanvasEl({scope:e}){queueMicrotask(()=>{var t;(t=e.getActiveElement())==null||t.focus({preventScroll:!0})})},invokeOnDraw({context:e,prop:t}){var n;(n=t("onDraw"))==null||n({paths:[...e.get("paths"),e.get("currentPath")]})},invokeOnDrawEnd({context:e,prop:t,scope:n,computed:i}){var r;(r=t("onDrawEnd"))==null||r({paths:[...e.get("paths")],getDataUrl(s,a=.92){return i("isEmpty")?Promise.resolve(""):Wp(n,{type:s,quality:a})}})}}}},yw=_()(["defaultPaths","dir","disabled","drawing","getRootNode","id","ids","name","onDraw","onDrawEnd","paths","readOnly","required","translations"]),jA=B(yw),bw=class extends K{constructor(){super(...arguments);z(this,"imageURL","");z(this,"paths",[]);z(this,"name");z(this,"syncPaths",()=>{let t=this.el.querySelector('[data-scope="signature-pad"][data-part="segment"]');if(!t)return;if(this.api.paths.length+(this.api.currentPath?1:0)===0){t.innerHTML="",this.imageURL="",this.paths=[];let i=this.el.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');i&&(i.value="");return}if(t.innerHTML="",this.api.paths.forEach(i=>{let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("data-scope","signature-pad"),r.setAttribute("data-part","path"),this.spreadProps(r,this.api.getSegmentPathProps({path:i})),t.appendChild(r)}),this.api.currentPath){let i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("data-scope","signature-pad"),i.setAttribute("data-part","current-path"),this.spreadProps(i,this.api.getSegmentPathProps({path:this.api.currentPath})),t.appendChild(i)}})}initMachine(t){return this.name=t.name,new W(vw,t)}setName(t){this.name=t}setPaths(t){this.paths=t}initApi(){return fw(this.machine.service,q)}render(){let t=this.el.querySelector('[data-scope="signature-pad"][data-part="root"]');if(!t)return;this.spreadProps(t,this.api.getRootProps());let n=t.querySelector('[data-scope="signature-pad"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=t.querySelector('[data-scope="signature-pad"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps());let r=t.querySelector('[data-scope="signature-pad"][data-part="segment"]');r&&this.spreadProps(r,this.api.getSegmentProps());let s=t.querySelector('[data-scope="signature-pad"][data-part="guide"]');s&&this.spreadProps(s,this.api.getGuideProps());let a=t.querySelector('[data-scope="signature-pad"][data-part="clear-trigger"]');a&&this.spreadProps(a,this.api.getClearTriggerProps());let o=t.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');o&&this.spreadProps(o,this.api.getHiddenInputProps({value:this.api.paths.length>0?JSON.stringify(this.api.paths):""})),this.syncPaths()}};Ew={mounted(){let e=this.el,t=this.pushEvent.bind(this),n=C(e,"controlled"),i=wa(e,"paths"),r=wa(e,"defaultPaths"),s=new bw(e,y(g(g({id:e.id,name:w(e,"name")},n&&i.length>0?{paths:i}:void 0),!n&&r.length>0?{defaultPaths:r}:void 0),{drawing:Hp(e),onDrawEnd:a=>{s.setPaths(a.paths);let o=e.querySelector('[data-scope="signature-pad"][data-part="hidden-input"]');o&&(o.value=a.paths.length>0?JSON.stringify(a.paths):"",o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0}))),a.getDataUrl("image/png").then(l=>{s.imageURL=l;let c=w(e,"onDrawEnd");c&&this.liveSocket.main.isConnected()&&t(c,{id:e.id,paths:a.paths,url:l});let u=w(e,"onDrawEndClient");u&&e.dispatchEvent(new CustomEvent(u,{bubbles:!0,detail:{id:e.id,paths:a.paths,url:l}}))})}}));s.init(),this.signaturePad=s,this.onClear=a=>{let{id:o}=a.detail;o&&o!==e.id||s.api.clear()},e.addEventListener("phx:signature-pad:clear",this.onClear),this.handlers=[],this.handlers.push(this.handleEvent("signature_pad_clear",a=>{let o=a.signature_pad_id;o&&o!==e.id||s.api.clear()}))},updated(){var r,s;let e=C(this.el,"controlled"),t=wa(this.el,"paths"),n=wa(this.el,"defaultPaths"),i=w(this.el,"name");i&&((r=this.signaturePad)==null||r.setName(i)),(s=this.signaturePad)==null||s.updateProps(y(g(g({id:this.el.id,name:i},e&&t.length>0?{paths:t}:{}),!e&&n.length>0?{defaultPaths:n}:{}),{drawing:Hp(this.el)}))},destroyed(){var e;if(this.onClear&&this.el.removeEventListener("phx:signature-pad:clear",this.onClear),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.signaturePad)==null||e.destroy()}}});var Zp={};he(Zp,{Switch:()=>xw});function Tw(e,t){let{context:n,send:i,prop:r,scope:s}=e,a=!!r("disabled"),o=!!r("readOnly"),l=!!r("required"),c=!!n.get("checked"),u=!a&&n.get("focused"),h=!a&&n.get("focusVisible"),m=!a&&n.get("active"),d={"data-active":E(m),"data-focus":E(u),"data-focus-visible":E(h),"data-readonly":E(o),"data-hover":E(n.get("hovered")),"data-disabled":E(a),"data-state":c?"checked":"unchecked","data-invalid":E(r("invalid")),"data-required":E(l)};return{checked:c,disabled:a,focused:u,setChecked(p){i({type:"CHECKED.SET",checked:p,isTrusted:!1})},toggleChecked(){i({type:"CHECKED.TOGGLE",checked:c,isTrusted:!1})},getRootProps(){return t.label(y(g(g({},xa.root.attrs),d),{dir:r("dir"),id:Xp(s),htmlFor:Xl(s),onPointerMove(){a||i({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){a||i({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(p){var I;if(a)return;j(p)===zi(s)&&p.stopPropagation(),Xe()&&((I=zi(s))==null||I.focus())}}))},getLabelProps(){return t.element(y(g(g({},xa.label.attrs),d),{dir:r("dir"),id:Yp(s)}))},getThumbProps(){return t.element(y(g(g({},xa.thumb.attrs),d),{dir:r("dir"),id:Pw(s),"aria-hidden":!0}))},getControlProps(){return t.element(y(g(g({},xa.control.attrs),d),{dir:r("dir"),id:Cw(s),"aria-hidden":!0}))},getHiddenInputProps(){return t.input({id:Xl(s),type:"checkbox",required:r("required"),defaultChecked:c,disabled:a,"aria-labelledby":Yp(s),"aria-invalid":r("invalid"),name:r("name"),form:r("form"),value:r("value"),style:Vt,onFocus(){let p=En();i({type:"CONTEXT.SET",context:{focused:!0,focusVisible:p}})},onBlur(){i({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(p){if(o){p.preventDefault();return}let v=p.currentTarget.checked;i({type:"CHECKED.SET",checked:v,isTrusted:!0})}})}}}var Iw,xa,Xp,Yp,Pw,Cw,Xl,Sw,zi,jp,Ow,ww,ek,Vw,xw,Jp=re(()=>{"use strict";pr();se();Iw=U("switch").parts("root","label","control","thumb"),xa=Iw.build(),Xp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`switch:${e.id}`},Yp=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`switch:${e.id}:label`},Pw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.thumb)!=null?n:`switch:${e.id}:thumb`},Cw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.control)!=null?n:`switch:${e.id}:control`},Xl=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.hiddenInput)!=null?n:`switch:${e.id}:input`},Sw=e=>e.getById(Xp(e)),zi=e=>e.getById(Xl(e));({not:jp}=Ee()),Ow={props({props:e}){return g({defaultChecked:!1,label:"switch",value:"on"},e)},initialState(){return"ready"},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e("defaultChecked"),value:e("checked"),onChange(n){var i;(i=e("onCheckedChange"))==null||i({checked:n})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:e,prop:t})=>t("disabled")||e.get("fieldsetDisabled")},watch({track:e,prop:t,context:n,action:i}){e([()=>t("disabled")],()=>{i(["removeFocusIfNeeded"])}),e([()=>n.get("checked")],()=>{i(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:jp("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:jp("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({computed:e,scope:t,context:n}){if(!e("isDisabled"))return ps({pointerNode:Sw(t),keyboardNode:zi(t),isValidKey:i=>i.key===" ",onPress:()=>n.set("active",!1),onPressStart:()=>n.set("active",!0),onPressEnd:()=>n.set("active",!1)})},trackFocusVisible({computed:e,scope:t}){if(!e("isDisabled"))return Pn({root:t.getRootNode()})},trackFormControlState({context:e,send:t,scope:n}){return wt(zi(n),{onFieldsetDisabledChange(i){e.set("fieldsetDisabled",i)},onFormReset(){let i=e.initial("checked");t({type:"CHECKED.SET",checked:!!i,src:"form-reset"})}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,scope:t}){let n=zi(t);n&&sr(n,!!e.get("checked"))},removeFocusIfNeeded({context:e,prop:t}){t("disabled")&&e.set("focused",!1)},setChecked({context:e,event:t}){e.set("checked",t.checked)},toggleChecked({context:e}){e.set("checked",!e.get("checked"))},dispatchChangeEvent({context:e,scope:t}){queueMicrotask(()=>{let n=zi(t);pi(n,{checked:e.get("checked")})})}}}},ww=_()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]),ek=B(ww),Vw=class extends K{initMachine(e){return new W(Ow,e)}initApi(){return Tw(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="switch"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelector('[data-scope="switch"][data-part="hidden-input"]');t&&this.spreadProps(t,this.api.getHiddenInputProps());let n=this.el.querySelector('[data-scope="switch"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps());let i=this.el.querySelector('[data-scope="switch"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps());let r=this.el.querySelector('[data-scope="switch"][data-part="thumb"]');r&&this.spreadProps(r,this.api.getThumbProps())}},xw={mounted(){let e=this.el,t=this.pushEvent.bind(this);this.wasFocused=!1;let n=new Vw(e,y(g({id:e.id},C(e,"controlled")?{checked:C(e,"checked")}:{defaultChecked:C(e,"defaultChecked")}),{disabled:C(e,"disabled"),name:w(e,"name"),form:w(e,"form"),value:w(e,"value"),dir:w(e,"dir",["ltr","rtl"]),invalid:C(e,"invalid"),required:C(e,"required"),readOnly:C(e,"readOnly"),label:w(e,"label"),onCheckedChange:i=>{let r=w(e,"onCheckedChange");r&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(r,{checked:i.checked,id:e.id});let s=w(e,"onCheckedChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{value:i,id:e.id}}))}}));n.init(),this.zagSwitch=n,this.onSetChecked=i=>{let{value:r}=i.detail;n.api.setChecked(r)},e.addEventListener("phx:switch:set-checked",this.onSetChecked),this.handlers=[],this.handlers.push(this.handleEvent("switch_set_checked",i=>{let r=i.id;r&&r!==e.id||n.api.setChecked(i.value)})),this.handlers.push(this.handleEvent("switch_toggle_checked",i=>{let r=i.id;r&&r!==e.id||n.api.toggleChecked()})),this.handlers.push(this.handleEvent("switch_checked",()=>{this.pushEvent("switch_checked_response",{value:n.api.checked})})),this.handlers.push(this.handleEvent("switch_focused",()=>{this.pushEvent("switch_focused_response",{value:n.api.focused})})),this.handlers.push(this.handleEvent("switch_disabled",()=>{this.pushEvent("switch_disabled_response",{value:n.api.disabled})}))},beforeUpdate(){var e,t;this.wasFocused=(t=(e=this.zagSwitch)==null?void 0:e.api.focused)!=null?t:!1},updated(){var e;if((e=this.zagSwitch)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{checked:C(this.el,"checked")}:{defaultChecked:C(this.el,"defaultChecked")}),{disabled:C(this.el,"disabled"),name:w(this.el,"name"),form:w(this.el,"form"),value:w(this.el,"value"),dir:w(this.el,"dir",["ltr","rtl"]),invalid:C(this.el,"invalid"),required:C(this.el,"required"),readOnly:C(this.el,"readOnly"),label:w(this.el,"label")})),C(this.el,"controlled")&&this.wasFocused){let t=this.el.querySelector('[data-part="hidden-input"]');t==null||t.focus()}},destroyed(){var e;if(this.onSetChecked&&this.el.removeEventListener("phx:switch:set-checked",this.onSetChecked),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.zagSwitch)==null||e.destroy()}}});var nf={};he(nf,{Tabs:()=>Kw});function Hw(e,t){let{state:n,send:i,context:r,prop:s,scope:a}=e,o=s("translations"),l=n.matches("focused"),c=s("orientation")==="vertical",u=s("orientation")==="horizontal",h=s("composite");function m(d){return{selected:r.get("value")===d.value,focused:r.get("focusedValue")===d.value,disabled:!!d.disabled}}return{value:r.get("value"),focusedValue:r.get("focusedValue"),setValue(d){i({type:"SET_VALUE",value:d})},clearValue(){i({type:"CLEAR_VALUE"})},setIndicatorRect(d){let p=ai(a,d);i({type:"SET_INDICATOR_RECT",id:p})},syncTabIndex(){i({type:"SYNC_TAB_INDEX"})},selectNext(d){i({type:"TAB_FOCUS",value:d,src:"selectNext"}),i({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(d){i({type:"TAB_FOCUS",value:d,src:"selectPrev"}),i({type:"ARROW_PREV",src:"selectPrev"})},focus(){var p;let d=r.get("value");d&&((p=Aa(a,d))==null||p.focus())},getRootProps(){return t.element(y(g({},_r.root.attrs),{id:kw(a),"data-orientation":s("orientation"),"data-focus":E(l),dir:s("dir")}))},getListProps(){return t.element(y(g({},_r.list.attrs),{id:Gr(a),role:"tablist",dir:s("dir"),"data-focus":E(l),"aria-orientation":s("orientation"),"data-orientation":s("orientation"),"aria-label":o==null?void 0:o.listLabel,onKeyDown(d){if(d.defaultPrevented||Re(d)||!ce(d.currentTarget,j(d)))return;let p={ArrowDown(){u||i({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){u||i({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){c||i({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){c||i({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){i({type:"HOME"})},End(){i({type:"END"})}},v=ge(d,{dir:s("dir"),orientation:s("orientation")}),I=p[v];if(I){d.preventDefault(),I(d);return}}}))},getTriggerState:m,getTriggerProps(d){let{value:p,disabled:v}=d,I=m(d);return t.button(y(g({},_r.trigger.attrs),{role:"tab",type:"button",disabled:v,dir:s("dir"),"data-orientation":s("orientation"),"data-disabled":E(v),"aria-disabled":v,"data-value":p,"aria-selected":I.selected,"data-selected":E(I.selected),"data-focus":E(I.focused),"aria-controls":I.selected?Zl(a,p):void 0,"data-ownedby":Gr(a),"data-ssr":E(r.get("ssr")),id:ai(a,p),tabIndex:I.selected&&h?0:-1,onFocus(){i({type:"TAB_FOCUS",value:p})},onBlur(T){let O=T.relatedTarget;(O==null?void 0:O.getAttribute("role"))!=="tab"&&i({type:"TAB_BLUR"})},onClick(T){T.defaultPrevented||Fn(T)||v||(Xe()&&T.currentTarget.focus(),i({type:"TAB_CLICK",value:p}))}}))},getContentProps(d){let{value:p}=d,v=r.get("value")===p;return t.element(y(g({},_r.content.attrs),{dir:s("dir"),id:Zl(a,p),tabIndex:h?0:-1,"aria-labelledby":ai(a,p),role:"tabpanel","data-ownedby":Gr(a),"data-selected":E(v),"data-orientation":s("orientation"),hidden:!v}))},getIndicatorProps(){let d=r.get("indicatorRect"),p=d==null||d.width===0&&d.height===0&&d.x===0&&d.y===0;return t.element(y(g({id:ef(a)},_r.indicator.attrs),{dir:s("dir"),"data-orientation":s("orientation"),hidden:p,style:{"--transition-property":"left, right, top, bottom, width, height","--left":ye(d==null?void 0:d.x),"--top":ye(d==null?void 0:d.y),"--width":ye(d==null?void 0:d.width),"--height":ye(d==null?void 0:d.height),position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:"var(--transition-duration, 150ms)",transitionTimingFunction:"var(--transition-timing-function)",[u?"left":"top"]:u?"var(--left)":"var(--top)"}}))}}}var Aw,_r,kw,Gr,Zl,ai,ef,Nw,Rw,Aa,Qp,Yi,Dw,Lw,Mw,Fw,tf,$w,Bw,_w,Gw,rk,Uw,sk,qw,ak,Ww,Kw,rf=re(()=>{"use strict";se();Aw=U("tabs").parts("root","list","trigger","content","indicator"),_r=Aw.build(),kw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tabs:${e.id}`},Gr=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.list)!=null?n:`tabs:${e.id}:list`},Zl=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.content)==null?void 0:i.call(n,t))!=null?r:`tabs:${e.id}:content-${t}`},ai=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.trigger)==null?void 0:i.call(n,t))!=null?r:`tabs:${e.id}:trigger-${t}`},ef=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.indicator)!=null?n:`tabs:${e.id}:indicator`},Nw=e=>e.getById(Gr(e)),Rw=(e,t)=>e.getById(Zl(e,t)),Aa=(e,t)=>t!=null?e.getById(ai(e,t)):null,Qp=e=>e.getById(ef(e)),Yi=e=>{let n=`[role=tab][data-ownedby='${CSS.escape(Gr(e))}']:not([disabled])`;return Fe(Nw(e),n)},Dw=e=>lt(Yi(e)),Lw=e=>mt(Yi(e)),Mw=(e,t)=>yi(Yi(e),ai(e,t.value),t.loopFocus),Fw=(e,t)=>bi(Yi(e),ai(e,t.value),t.loopFocus),tf=e=>{var t,n,i,r;return{x:(t=e==null?void 0:e.offsetLeft)!=null?t:0,y:(n=e==null?void 0:e.offsetTop)!=null?n:0,width:(i=e==null?void 0:e.offsetWidth)!=null?i:0,height:(r=e==null?void 0:e.offsetHeight)!=null?r:0}},$w=(e,t)=>{let n=so(Yi(e),ai(e,t));return tf(n)};({createMachine:Bw}=ut()),_w=Bw({props({props:e}){return g({dir:"ltr",orientation:"horizontal",activationMode:"automatic",loopFocus:!0,composite:!0,navigate(t){mi(t.node)},defaultValue:null},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}})),focusedValue:t(()=>({defaultValue:e("value")||e("defaultValue"),sync:!0,onChange(n){var i;(i=e("onFocusChange"))==null||i({focusedValue:n})}})),ssr:t(()=>({defaultValue:!0})),indicatorRect:t(()=>({defaultValue:null}))}},watch({context:e,prop:t,track:n,action:i}){n([()=>e.get("value")],()=>{i(["syncIndicatorRect","syncTabIndex","navigateIfNeeded"])}),n([()=>t("dir"),()=>t("orientation")],()=>{i(["syncIndicatorRect"])})},on:{SET_VALUE:{actions:["setValue"]},CLEAR_VALUE:{actions:["clearValue"]},SET_INDICATOR_RECT:{actions:["setIndicatorRect"]},SYNC_TAB_INDEX:{actions:["syncTabIndex"]}},entry:["syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:["setFocusedValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:["focusPrevTab"]}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:["focusNextTab"]}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:["focusFirstTab"]}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:["focusLastTab"]}],TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{selectOnFocus:({prop:e})=>e("activationMode")==="automatic"},actions:{selectFocusedTab({context:e,prop:t}){H(()=>{let n=e.get("focusedValue");if(!n)return;let r=t("deselectable")&&e.get("value")===n?null:n;e.set("value",r)})},setFocusedValue({context:e,event:t,flush:n}){t.value!=null&&n(()=>{e.set("focusedValue",t.value)})},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t,prop:n}){let i=n("deselectable")&&e.get("value")===e.get("focusedValue");e.set("value",i?null:t.value)},clearValue({context:e}){e.set("value",null)},focusFirstTab({scope:e}){H(()=>{var t;(t=Dw(e))==null||t.focus()})},focusLastTab({scope:e}){H(()=>{var t;(t=Lw(e))==null||t.focus()})},focusNextTab({context:e,prop:t,scope:n,event:i}){var a;let r=(a=i.value)!=null?a:e.get("focusedValue");if(!r)return;let s=Mw(n,{value:r,loopFocus:t("loopFocus")});H(()=>{t("composite")?s==null||s.focus():(s==null?void 0:s.dataset.value)!=null&&e.set("focusedValue",s.dataset.value)})},focusPrevTab({context:e,prop:t,scope:n,event:i}){var a;let r=(a=i.value)!=null?a:e.get("focusedValue");if(!r)return;let s=Fw(n,{value:r,loopFocus:t("loopFocus")});H(()=>{t("composite")?s==null||s.focus():(s==null?void 0:s.dataset.value)!=null&&e.set("focusedValue",s.dataset.value)})},syncTabIndex({context:e,scope:t}){H(()=>{let n=e.get("value");if(!n)return;let i=Rw(t,n);if(!i)return;ar(i).length>0?i.removeAttribute("tabindex"):i.setAttribute("tabindex","0")})},cleanupObserver({refs:e}){let t=e.get("indicatorCleanup");t&&t()},setIndicatorRect({context:e,event:t,scope:n}){var a;let i=(a=t.id)!=null?a:e.get("value");!Qp(n)||!i||!Aa(n,i)||e.set("indicatorRect",$w(n,i))},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,refs:t,scope:n}){let i=t.get("indicatorCleanup");if(i&&i(),!Qp(n))return;let s=()=>{let l=Aa(n,e.get("value"));if(!l)return;let c=tf(l);e.set("indicatorRect",u=>fe(u,c)?u:c)};s();let a=Yi(n),o=At(...a.map(l=>gn.observe(l,s)));t.set("indicatorCleanup",o)},navigateIfNeeded({context:e,prop:t,scope:n}){var s;let i=e.get("value");if(!i)return;let r=Aa(n,i);st(r)&&((s=t("navigate"))==null||s({value:i,node:r,href:r.href}))}}}}),Gw=_()(["activationMode","composite","deselectable","dir","getRootNode","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value","defaultValue"]),rk=B(Gw),Uw=_()(["disabled","value"]),sk=B(Uw),qw=_()(["value"]),ak=B(qw),Ww=class extends K{initMachine(e){return new W(_w,e)}initApi(){return Hw(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="tabs"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=e.querySelector('[data-scope="tabs"][data-part="list"]');if(!t)return;this.spreadProps(t,this.api.getListProps());let n=this.el.getAttribute("data-items"),i=n?JSON.parse(n):[],r=t.querySelectorAll('[data-scope="tabs"][data-part="trigger"]');for(let a=0;a{var a,o;let r=w(e,"onValueChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,value:(a=i.value)!=null?a:null});let s=w(e,"onValueChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,value:(o=i.value)!=null?o:null}}))},onFocusChange:i=>{var a,o;let r=w(e,"onFocusChange");r&&this.liveSocket.main.isConnected()&&t(r,{id:e.id,value:(a=i.focusedValue)!=null?a:null});let s=w(e,"onFocusChangeClient");s&&e.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:{id:e.id,value:(o=i.focusedValue)!=null?o:null}}))}}));n.init(),this.tabs=n,this.onSetValue=i=>{let{value:r}=i.detail;n.api.setValue(r)},e.addEventListener("phx:tabs:set-value",this.onSetValue),this.handlers=[],this.handlers.push(this.handleEvent("tabs_set_value",i=>{let r=i.tabs_id;r&&r!==e.id||n.api.setValue(i.value)})),this.handlers.push(this.handleEvent("tabs_value",()=>{this.pushEvent("tabs_value_response",{value:n.api.value})})),this.handlers.push(this.handleEvent("tabs_focused_value",()=>{this.pushEvent("tabs_focused_value_response",{value:n.api.focusedValue})}))},updated(){var e;(e=this.tabs)==null||e.updateProps(y(g({id:this.el.id},C(this.el,"controlled")?{value:w(this.el,"value")}:{defaultValue:w(this.el,"defaultValue")}),{orientation:w(this.el,"orientation",["horizontal","vertical"]),dir:w(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:tabs:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.tabs)==null||e.destroy()}}});var of={};he(of,{Timer:()=>rV});function Xw(e,t){let{state:n,send:i,computed:r,scope:s}=e,a=n.matches("running"),o=n.matches("paused"),l=r("time"),c=r("formattedTime"),u=r("progressPercent");return{running:a,paused:o,time:l,formattedTime:c,progressPercent:u,start(){i({type:"START"})},pause(){i({type:"PAUSE"})},resume(){i({type:"RESUME"})},reset(){i({type:"RESET"})},restart(){i({type:"RESTART"})},getRootProps(){return t.element(g({id:Yw(s)},Rn.root.attrs))},getAreaProps(){return t.element(g({role:"timer",id:jw(s),"aria-label":`${l.days} days ${c.hours}:${c.minutes}:${c.seconds}`,"aria-atomic":!0},Rn.area.attrs))},getControlProps(){return t.element(g({},Rn.control.attrs))},getItemProps(h){let m=l[h.type];return t.element(y(g({},Rn.item.attrs),{"data-type":h.type,style:{"--value":m}}))},getItemLabelProps(h){return t.element(y(g({},Rn.itemLabel.attrs),{"data-type":h.type}))},getItemValueProps(h){return t.element(y(g({},Rn.itemValue.attrs),{"data-type":h.type}))},getSeparatorProps(){return t.element(g({"aria-hidden":!0},Rn.separator.attrs))},getActionTriggerProps(h){if(!sf.has(h.action))throw new Error(`[zag-js] Invalid action: ${h.action}. Must be one of: ${Array.from(sf).join(", ")}`);return t.button(y(g({},Rn.actionTrigger.attrs),{hidden:Ce(h.action,{start:()=>a||o,pause:()=>!a,reset:()=>!a&&!o,resume:()=>!o,restart:()=>!1}),type:"button",onClick(m){m.defaultPrevented||i({type:h.action.toUpperCase()})}}))}}}function Jw(e){let t=Math.max(0,e),n=t%1e3,i=Math.floor(t/1e3)%60,r=Math.floor(t/(1e3*60))%60,s=Math.floor(t/(1e3*60*60))%24;return{days:Math.floor(t/(1e3*60*60*24)),hours:s,minutes:r,seconds:i,milliseconds:n}}function af(e,t,n){let i=n-t;return i===0?0:(e-t)/i}function Ur(e,t=2){return e.toString().padStart(t,"0")}function Qw(e,t){return Math.floor(e/t)*t}function eV(e){let{days:t,hours:n,minutes:i,seconds:r}=e;return{days:Ur(t),hours:Ur(n),minutes:Ur(i),seconds:Ur(r),milliseconds:Ur(e.milliseconds,3)}}function tV(e){let{startMs:t,targetMs:n,countdown:i,interval:r}=e;if(r!=null&&(typeof r!="number"||r<=0))throw new Error(`[timer] Invalid interval: ${r}. Must be a positive number.`);if(t!=null&&(typeof t!="number"||t<0))throw new Error(`[timer] Invalid startMs: ${t}. Must be a non-negative number.`);if(n!=null&&(typeof n!="number"||n<0))throw new Error(`[timer] Invalid targetMs: ${n}. Must be a non-negative number.`);if(i&&t!=null&&n!=null&&t<=n)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than targetMs (${n}).`);if(!i&&t!=null&&n!=null&&t>=n)throw new Error(`[timer] Invalid stopwatch configuration: startMs (${t}) must be less than targetMs (${n}).`);if(i&&n==null&&t!=null&&t<=0)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than 0 when no targetMs is provided.`)}var zw,Rn,Yw,jw,sf,Zw,nV,uk,iV,rV,lf=re(()=>{"use strict";se();zw=U("timer").parts("root","area","control","item","itemValue","itemLabel","actionTrigger","separator"),Rn=zw.build(),Yw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`timer:${e.id}:root`},jw=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.area)!=null?n:`timer:${e.id}:area`},sf=new Set(["start","pause","resume","reset","restart"]);Zw={props({props:e}){return tV(e),g({interval:1e3,startMs:0},e)},initialState({prop:e}){return e("autoStart")?"running":"idle"},context({prop:e,bindable:t}){return{currentMs:t(()=>({defaultValue:e("startMs")}))}},watch({track:e,send:t,prop:n}){e([()=>n("startMs")],()=>{t({type:"RESTART"})})},on:{RESTART:{target:"running:temp",actions:["resetTime"]}},computed:{time:({context:e})=>Jw(e.get("currentMs")),formattedTime:({computed:e})=>eV(e("time")),progressPercent:Bn(({context:e,prop:t})=>[e.get("currentMs"),t("targetMs"),t("startMs"),t("countdown")],([e,t=0,n,i])=>{let r=i?af(e,t,n):af(e,n,t);return He(r,0,1)})},states:{idle:{on:{START:{target:"running"},RESET:{actions:["resetTime"]}}},"running:temp":{effects:["waitForNextTick"],on:{CONTINUE:{target:"running"}}},running:{effects:["keepTicking"],on:{PAUSE:{target:"paused"},TICK:[{target:"idle",guard:"hasReachedTarget",actions:["invokeOnComplete"]},{actions:["updateTime","invokeOnTick"]}],RESET:{actions:["resetTime"]}}},paused:{on:{RESUME:{target:"running"},RESET:{target:"idle",actions:["resetTime"]}}}},implementations:{effects:{keepTicking({prop:e,send:t}){return su(({deltaMs:n})=>{t({type:"TICK",deltaMs:n})},e("interval"))},waitForNextTick({send:e}){return mn(()=>{e({type:"CONTINUE"})},0)}},actions:{updateTime({context:e,prop:t,event:n}){let i=t("countdown")?-1:1,r=Qw(n.deltaMs,t("interval"));e.set("currentMs",s=>{let a=s+i*r,o=t("targetMs");return o==null&&t("countdown")&&(o=0),t("countdown")&&o!=null?Math.max(a,o):!t("countdown")&&o!=null?Math.min(a,o):a})},resetTime({context:e,prop:t}){var i;let n=t("targetMs");n==null&&t("countdown")&&(n=0),e.set("currentMs",(i=t("startMs"))!=null?i:0)},invokeOnTick({context:e,prop:t,computed:n}){var i;(i=t("onTick"))==null||i({value:e.get("currentMs"),time:n("time"),formattedTime:n("formattedTime")})},invokeOnComplete({prop:e}){var t;(t=e("onComplete"))==null||t()}},guards:{hasReachedTarget:({context:e,prop:t})=>{let n=t("targetMs");if(n==null&&t("countdown")&&(n=0),n==null)return!1;let i=e.get("currentMs");return t("countdown")?i<=n:i>=n}}}};nV=_()(["autoStart","countdown","getRootNode","id","ids","interval","onComplete","onTick","startMs","targetMs"]),uk=B(nV),iV=class extends K{constructor(){super(...arguments);z(this,"init",()=>{this.machine.subscribe(()=>{this.api=this.initApi(),this.render()}),this.machine.start(),this.api=this.initApi(),this.render()})}initMachine(t){return new W(Zw,t)}initApi(){return Xw(this.machine.service,q)}render(){var a;let t=(a=this.el.querySelector('[data-scope="timer"][data-part="root"]'))!=null?a:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="timer"][data-part="area"]');n&&this.spreadProps(n,this.api.getAreaProps());let i=this.el.querySelector('[data-scope="timer"][data-part="control"]');i&&this.spreadProps(i,this.api.getControlProps()),["days","hours","minutes","seconds"].forEach(o=>{let l=this.el.querySelector(`[data-scope="timer"][data-part="item"][data-type="${o}"]`);l&&this.spreadProps(l,this.api.getItemProps({type:o}))}),this.el.querySelectorAll('[data-scope="timer"][data-part="separator"]').forEach(o=>{this.spreadProps(o,this.api.getSeparatorProps())}),["start","pause","resume","reset"].forEach(o=>{let l=this.el.querySelector(`[data-scope="timer"][data-part="action-trigger"][data-action="${o}"]`);l&&this.spreadProps(l,this.api.getActionTriggerProps({action:o}))})}},rV={mounted(){var n;let e=this.el,t=new iV(e,{id:e.id,countdown:C(e,"countdown"),startMs:Y(e,"startMs"),targetMs:Y(e,"targetMs"),autoStart:C(e,"autoStart"),interval:(n=Y(e,"interval"))!=null?n:1e3,onTick:i=>{let r=w(e,"onTick");r&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(r,{value:i.value,time:i.time,formattedTime:i.formattedTime,id:e.id})},onComplete:()=>{let i=w(e,"onComplete");i&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&this.pushEvent(i,{id:e.id})}});t.init(),this.timer=t,this.handlers=[]},updated(){var e,t;(t=this.timer)==null||t.updateProps({id:this.el.id,countdown:C(this.el,"countdown"),startMs:Y(this.el,"startMs"),targetMs:Y(this.el,"targetMs"),autoStart:C(this.el,"autoStart"),interval:(e=Y(this.el,"interval"))!=null?e:1e3})},destroyed(){var e;if(this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.timer)==null||e.destroy()}}});var vf={};he(vf,{Toast:()=>VV});function Jl(e,t){var n;return(n=e!=null?e:gf[t])!=null?n:gf.DEFAULT}function cV(e,t){var v;let{prop:n,computed:i,context:r}=e,{offsets:s,gap:a}=n("store").attrs,o=r.get("heights"),l=lV(s),c=n("dir")==="rtl",u=t.replace("-start",c?"-right":"-left").replace("-end",c?"-left":"-right"),h=u.includes("right"),m=u.includes("left"),d={position:"fixed",pointerEvents:i("count")>0?void 0:"none",display:"flex",flexDirection:"column","--gap":`${a}px`,"--first-height":`${((v=o[0])==null?void 0:v.height)||0}px`,"--viewport-offset-left":l.left,"--viewport-offset-right":l.right,"--viewport-offset-top":l.top,"--viewport-offset-bottom":l.bottom,zIndex:ss},p="center";if(h&&(p="flex-end"),m&&(p="flex-start"),d.alignItems=p,u.includes("top")){let I=l.top;d.top=`max(env(safe-area-inset-top, 0px), ${I})`}if(u.includes("bottom")){let I=l.bottom;d.bottom=`max(env(safe-area-inset-bottom, 0px), ${I})`}if(!u.includes("left")){let I=l.right;d.insetInlineEnd=`calc(env(safe-area-inset-right, 0px) + ${I})`}if(!u.includes("right")){let I=l.left;d.insetInlineStart=`calc(env(safe-area-inset-left, 0px) + ${I})`}return d}function uV(e,t){let{prop:n,context:i,computed:r}=e,s=n("parent"),a=s.computed("placement"),{gap:o}=s.prop("store").attrs,[l]=a.split("-"),c=i.get("mounted"),u=i.get("remainingTime"),h=r("height"),m=r("frontmost"),d=!m,p=!n("stacked"),v=n("stacked"),T=n("type")==="loading"?Number.MAX_SAFE_INTEGER:u,O=r("heightIndex")*o+r("heightBefore"),b={position:"absolute",pointerEvents:"auto","--opacity":"0","--remove-delay":`${n("removeDelay")}ms`,"--duration":`${T}ms`,"--initial-height":`${h}px`,"--offset":`${O}px`,"--index":n("index"),"--z-index":r("zIndex"),"--lift-amount":"calc(var(--lift) * var(--gap))","--y":"100%","--x":"0"},f=S=>Object.assign(b,S);return l==="top"?f({top:"0","--sign":"-1","--y":"-100%","--lift":"1"}):l==="bottom"&&f({bottom:"0","--sign":"1","--y":"100%","--lift":"-1"}),c&&(f({"--y":"0","--opacity":"1"}),v&&f({"--y":"calc(var(--lift) * var(--offset))","--height":"var(--initial-height)"})),t||f({"--opacity":"0",pointerEvents:"none"}),d&&p&&(f({"--base-scale":"var(--index) * 0.05 + 1","--y":"calc(var(--lift-amount) * var(--index))","--scale":"calc(-1 * var(--base-scale))","--height":"var(--first-height)"}),t||f({"--y":"calc(var(--sign) * 40%)"})),d&&v&&!t&&f({"--y":"calc(var(--lift) * var(--offset) + var(--lift) * -100%)"}),m&&!t&&f({"--y":"calc(var(--lift) * -100%)"}),b}function dV(e,t){let{computed:n}=e,i={position:"absolute",inset:"0",scale:"1 2",pointerEvents:t?"none":"auto"},r=s=>Object.assign(i,s);return n("frontmost")&&!t&&r({height:"calc(var(--initial-height) + 80%)"}),i}function hV(){return{position:"absolute",left:"0",height:"calc(var(--gap) + 2px)",bottom:"100%",width:"100%"}}function gV(e,t){let{context:n,prop:i,send:r,refs:s,computed:a}=e;return{getCount(){return n.get("toasts").length},getToasts(){return n.get("toasts")},getGroupProps(o={}){let{label:l="Notifications"}=o,{hotkey:c}=i("store").attrs,u=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),h=a("placement"),[m,d="center"]=h.split("-");return t.element(y(g({},ji.group.attrs),{dir:i("dir"),tabIndex:-1,"aria-label":`${h} ${l} ${u}`,id:aV(h),"data-placement":h,"data-side":m,"data-align":d,"aria-live":"polite",role:"region",style:cV(e,h),onMouseEnter(){s.get("ignoreMouseTimer").isActive()||r({type:"REGION.POINTER_ENTER",placement:h})},onMouseMove(){s.get("ignoreMouseTimer").isActive()||r({type:"REGION.POINTER_ENTER",placement:h})},onMouseLeave(){s.get("ignoreMouseTimer").isActive()||r({type:"REGION.POINTER_LEAVE",placement:h})},onFocus(p){r({type:"REGION.FOCUS",target:p.relatedTarget})},onBlur(p){s.get("isFocusWithin")&&!ce(p.currentTarget,p.relatedTarget)&&queueMicrotask(()=>r({type:"REGION.BLUR"}))}}))},subscribe(o){return i("store").subscribe(()=>o(n.get("toasts")))}}}function yV(e,t){let{state:n,send:i,prop:r,scope:s,context:a,computed:o}=e,l=n.hasTag("visible"),c=n.hasTag("paused"),u=a.get("mounted"),h=o("frontmost"),m=r("parent").computed("placement"),d=r("type"),p=r("stacked"),v=r("title"),I=r("description"),T=r("action"),[O,b="center"]=m.split("-");return{type:d,title:v,description:I,placement:m,visible:l,paused:c,closable:!!r("closable"),pause(){i({type:"PAUSE"})},resume(){i({type:"RESUME"})},dismiss(){i({type:"DISMISS",src:"programmatic"})},getRootProps(){return t.element(y(g({},ji.root.attrs),{dir:r("dir"),id:mf(s),"data-state":l?"open":"closed","data-type":d,"data-placement":m,"data-align":b,"data-side":O,"data-mounted":E(u),"data-paused":E(c),"data-first":E(h),"data-sibling":E(!h),"data-stack":E(p),"data-overlap":E(!p),role:"status","aria-atomic":"true","aria-describedby":I?hf(s):void 0,"aria-labelledby":v?df(s):void 0,tabIndex:0,style:uV(e,l),onKeyDown(f){f.defaultPrevented||f.key=="Escape"&&(i({type:"DISMISS",src:"keyboard"}),f.preventDefault())}}))},getGhostBeforeProps(){return t.element({"data-ghost":"before",style:dV(e,l)})},getGhostAfterProps(){return t.element({"data-ghost":"after",style:hV()})},getTitleProps(){return t.element(y(g({},ji.title.attrs),{id:df(s)}))},getDescriptionProps(){return t.element(y(g({},ji.description.attrs),{id:hf(s)}))},getActionTriggerProps(){return t.button(y(g({},ji.actionTrigger.attrs),{type:"button",onClick(f){var S;f.defaultPrevented||((S=T==null?void 0:T.onClick)==null||S.call(T),i({type:"DISMISS",src:"user"}))}}))},getCloseTriggerProps(){return t.button(y(g({id:oV(s)},ji.closeTrigger.attrs),{type:"button","aria-label":"Dismiss notification",onClick(f){f.defaultPrevented||i({type:"DISMISS",src:"user"})}}))}}}function pf(e,t){let{id:n,height:i}=t;e.context.set("heights",r=>r.find(a=>a.id===n)?r.map(a=>a.id===n?y(g({},a),{height:i}):a):[{id:n,height:i},...r])}function PV(e={}){let t=IV(e,{placement:"bottom",overlap:!1,max:24,gap:16,offsets:"1rem",hotkey:["altKey","KeyT"],removeDelay:200,pauseOnPageIdle:!0}),n=[],i=[],r=new Set,s=[],a=D=>(n.push(D),()=>{let $=n.indexOf(D);n.splice($,1)}),o=D=>(n.forEach($=>$(D)),D),l=D=>{if(i.length>=t.max){s.push(D);return}o(D),i.unshift(D)},c=()=>{for(;s.length>0&&i.length{var Z;let $=(Z=D.id)!=null?Z:`toast:${ur()}`,te=i.find(ie=>ie.id===$);return r.has($)&&r.delete($),te?i=i.map(ie=>ie.id===$?o(y(g(g({},ie),D),{id:$})):ie):l(y(g({id:$,duration:t.duration,removeDelay:t.removeDelay,type:"info"},D),{stacked:!t.overlap,gap:t.gap})),$},h=D=>(r.add(D),D?(n.forEach($=>$({id:D,dismiss:!0})),i=i.filter($=>$.id!==D),c()):(i.forEach($=>{n.forEach(te=>te({id:$.id,dismiss:!0}))}),i=[],s=[]),D);return{attrs:t,subscribe:a,create:u,update:(D,$)=>u(g({id:D},$)),remove:h,dismiss:D=>{D!=null?i=i.map($=>$.id===D?o(y(g({},$),{message:"DISMISS"})):$):i=i.map($=>o(y(g({},$),{message:"DISMISS"})))},error:D=>u(y(g({},D),{type:"error"})),success:D=>u(y(g({},D),{type:"success"})),info:D=>u(y(g({},D),{type:"info"})),warning:D=>u(y(g({},D),{type:"warning"})),loading:D=>u(y(g({},D),{type:"loading"})),getVisibleToasts:()=>i.filter(D=>!r.has(D.id)),getCount:()=>i.length,promise:(D,$,te={})=>{if(!$||!$.loading){zt("[zag-js > toast] toaster.promise() requires at least a 'loading' option to be specified");return}let Z=u(y(g(g({},te),$.loading),{promise:D,type:"loading"})),ie=!0,J,Se=Kt(D).then(ne=>Ve(null,null,function*(){if(J=["resolve",ne],CV(ne)&&!ne.ok){ie=!1;let Ie=Kt($.error,`HTTP Error! status: ${ne.status}`);u(y(g(g({},te),Ie),{id:Z,type:"error"}))}else if($.success!==void 0){ie=!1;let Ie=Kt($.success,ne);u(y(g(g({},te),Ie),{id:Z,type:"success"}))}})).catch(ne=>Ve(null,null,function*(){if(J=["reject",ne],$.error!==void 0){ie=!1;let Ie=Kt($.error,ne);u(y(g(g({},te),Ie),{id:Z,type:"error"}))}})).finally(()=>{var ne;ie&&h(Z),(ne=$.finally)==null||ne.call($)});return{id:Z,unwrap:()=>new Promise((ne,Ie)=>Se.then(()=>J[0]==="reject"?Ie(J[1]):ne(J[1])).catch(Ie))}},pause:D=>{D!=null?i=i.map($=>$.id===D?o(y(g({},$),{message:"PAUSE"})):$):i=i.map($=>o(y(g({},$),{message:"PAUSE"})))},resume:D=>{D!=null?i=i.map($=>$.id===D?o(y(g({},$),{message:"RESUME"})):$):i=i.map($=>o(y(g({},$),{message:"RESUME"})))},isVisible:D=>!r.has(D)&&!!i.find($=>$.id===D),isDismissed:D=>r.has(D),expand:()=>{i=i.map(D=>o(y(g({},D),{stacked:!0})))},collapse:()=>{i=i.map(D=>o(y(g({},D),{stacked:!1})))}}}function wV(e,t){var s,a,o;let n=(s=t==null?void 0:t.id)!=null?s:Mn(e,"toast"),i=(o=t==null?void 0:t.store)!=null?o:PV({placement:(a=t==null?void 0:t.placement)!=null?a:"bottom",overlap:t==null?void 0:t.overlap,max:t==null?void 0:t.max,gap:t==null?void 0:t.gap,offsets:t==null?void 0:t.offsets,pauseOnPageIdle:t==null?void 0:t.pauseOnPageIdle}),r=new OV(e,{id:n,store:i});return r.init(),SV.set(n,r),Ql.set(n,i),e.dataset.toastGroup="true",e.dataset.toastGroupId=n,{group:r,store:i}}function qr(e){if(e)return Ql.get(e);let t=document.querySelector("[data-toast-group]");if(!t)return;let n=t.dataset.toastGroupId||t.id;return n?Ql.get(n):void 0}var sV,ji,aV,cf,mf,uf,df,hf,oV,gf,lV,pV,fV,mV,vV,bV,EV,IV,CV,ff,SV,Ql,TV,OV,VV,yf=re(()=>{"use strict";Wn();tn();se();sV=U("toast").parts("group","root","title","description","actionTrigger","closeTrigger"),ji=sV.build(),aV=e=>`toast-group:${e}`,cf=(e,t)=>e.getById(`toast-group:${t}`),mf=e=>`toast:${e.id}`,uf=e=>e.getById(mf(e)),df=e=>`toast:${e.id}:title`,hf=e=>`toast:${e.id}:description`,oV=e=>`toast${e.id}:close`,gf={info:5e3,error:5e3,success:2e3,loading:1/0,DEFAULT:5e3};lV=e=>typeof e=="string"?{left:e,right:e,bottom:e,top:e}:e;({guards:pV,createMachine:fV}=ut()),{and:mV}=pV,vV=fV({props({props:e}){return y(g({dir:"ltr",id:ur()},e),{store:e.store})},initialState({prop:e}){return e("store").attrs.overlap?"overlap":"stack"},refs(){return{lastFocusedEl:null,isFocusWithin:!1,isPointerWithin:!1,ignoreMouseTimer:eo.create(),dismissableCleanup:void 0}},context({bindable:e}){return{toasts:e(()=>({defaultValue:[],sync:!0,hash:t=>t.map(n=>n.id).join(",")})),heights:e(()=>({defaultValue:[],sync:!0}))}},computed:{count:({context:e})=>e.get("toasts").length,overlap:({prop:e})=>e("store").attrs.overlap,placement:({prop:e})=>e("store").attrs.placement},effects:["subscribeToStore","trackDocumentVisibility","trackHotKeyPress"],watch({track:e,context:t,action:n}){e([()=>t.hash("toasts")],()=>{queueMicrotask(()=>{n(["collapsedIfEmpty","setDismissableBranch"])})})},exit:["clearDismissableBranch","clearLastFocusedEl","clearMouseEventTimer"],on:{"DOC.HOTKEY":{actions:["focusRegionEl"]},"REGION.BLUR":[{guard:mV("isOverlapping","isPointerOut"),target:"overlap",actions:["collapseToasts","resumeToasts","restoreFocusIfPointerOut"]},{guard:"isPointerOut",target:"stack",actions:["resumeToasts","restoreFocusIfPointerOut"]},{actions:["clearFocusWithin"]}],"TOAST.REMOVE":{actions:["removeToast","removeHeight","ignoreMouseEventsTemporarily"]},"TOAST.PAUSE":{actions:["pauseToasts"]}},states:{stack:{on:{"REGION.POINTER_LEAVE":[{guard:"isOverlapping",target:"overlap",actions:["clearPointerWithin","resumeToasts","collapseToasts"]},{actions:["clearPointerWithin","resumeToasts"]}],"REGION.OVERLAP":{target:"overlap",actions:["collapseToasts"]},"REGION.FOCUS":{actions:["setLastFocusedEl","pauseToasts"]},"REGION.POINTER_ENTER":{actions:["setPointerWithin","pauseToasts"]}}},overlap:{on:{"REGION.STACK":{target:"stack",actions:["expandToasts"]},"REGION.POINTER_ENTER":{target:"stack",actions:["setPointerWithin","pauseToasts","expandToasts"]},"REGION.FOCUS":{target:"stack",actions:["setLastFocusedEl","pauseToasts","expandToasts"]}}}},implementations:{guards:{isOverlapping:({computed:e})=>e("overlap"),isPointerOut:({refs:e})=>!e.get("isPointerWithin")},effects:{subscribeToStore({context:e,prop:t}){let n=t("store");return e.set("toasts",n.getVisibleToasts()),n.subscribe(i=>{if(i.dismiss){e.set("toasts",r=>r.filter(s=>s.id!==i.id));return}e.set("toasts",r=>{let s=r.findIndex(a=>a.id===i.id);return s!==-1?[...r.slice(0,s),g(g({},r[s]),i),...r.slice(s+1)]:[i,...r]})})},trackHotKeyPress({prop:e,send:t}){return ee(document,"keydown",i=>{let{hotkey:r}=e("store").attrs;r.every(a=>i[a]||i.code===a)&&t({type:"DOC.HOTKEY"})},{capture:!0})},trackDocumentVisibility({prop:e,send:t,scope:n}){let{pauseOnPageIdle:i}=e("store").attrs;if(!i)return;let r=n.getDoc();return ee(r,"visibilitychange",()=>{let s=r.visibilityState==="hidden";t({type:s?"PAUSE_ALL":"RESUME_ALL"})})}},actions:{setDismissableBranch({refs:e,context:t,computed:n,scope:i}){var c;let r=t.get("toasts"),s=n("placement"),a=r.length>0;if(!a){(c=e.get("dismissableCleanup"))==null||c();return}if(a&&e.get("dismissableCleanup"))return;let l=Wd(()=>cf(i,s),{defer:!0});e.set("dismissableCleanup",l)},clearDismissableBranch({refs:e}){var t;(t=e.get("dismissableCleanup"))==null||t()},focusRegionEl({scope:e,computed:t}){queueMicrotask(()=>{var n;(n=cf(e,t("placement")))==null||n.focus()})},pauseToasts({prop:e}){e("store").pause()},resumeToasts({prop:e}){e("store").resume()},expandToasts({prop:e}){e("store").expand()},collapseToasts({prop:e}){e("store").collapse()},removeToast({prop:e,event:t}){e("store").remove(t.id)},removeHeight({event:e,context:t}){(e==null?void 0:e.id)!=null&&queueMicrotask(()=>{t.set("heights",n=>n.filter(i=>i.id!==e.id))})},collapsedIfEmpty({send:e,computed:t}){!t("overlap")||t("count")>1||e({type:"REGION.OVERLAP"})},setLastFocusedEl({refs:e,event:t}){e.get("isFocusWithin")||!t.target||(e.set("isFocusWithin",!0),e.set("lastFocusedEl",t.target))},restoreFocusIfPointerOut({refs:e}){var t;!e.get("lastFocusedEl")||e.get("isPointerWithin")||((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null),e.set("isFocusWithin",!1))},setPointerWithin({refs:e}){e.set("isPointerWithin",!0)},clearPointerWithin({refs:e}){var t;e.set("isPointerWithin",!1),e.get("lastFocusedEl")&&!e.get("isFocusWithin")&&((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null))},clearFocusWithin({refs:e}){e.set("isFocusWithin",!1)},clearLastFocusedEl({refs:e}){var t;e.get("lastFocusedEl")&&((t=e.get("lastFocusedEl"))==null||t.focus({preventScroll:!0}),e.set("lastFocusedEl",null),e.set("isFocusWithin",!1))},ignoreMouseEventsTemporarily({refs:e}){e.get("ignoreMouseTimer").request()},clearMouseEventTimer({refs:e}){e.get("ignoreMouseTimer").cancel()}}}});({not:bV}=Ee()),EV={props({props:e}){return yn(e,["id","type","parent","removeDelay"],"toast"),y(g({closable:!0},e),{duration:Jl(e.duration,e.type)})},initialState({prop:e}){return e("type")==="loading"||e("duration")===1/0?"visible:persist":"visible"},context({prop:e,bindable:t}){return{remainingTime:t(()=>({defaultValue:Jl(e("duration"),e("type"))})),createdAt:t(()=>({defaultValue:Date.now()})),mounted:t(()=>({defaultValue:!1})),initialHeight:t(()=>({defaultValue:0}))}},refs(){return{closeTimerStartTime:Date.now(),lastCloseStartTimerStartTime:0}},computed:{zIndex:({prop:e})=>{let t=e("parent").context.get("toasts"),n=t.findIndex(i=>i.id===e("id"));return t.length-n},height:({prop:e})=>{var i;let n=e("parent").context.get("heights").find(r=>r.id===e("id"));return(i=n==null?void 0:n.height)!=null?i:0},heightIndex:({prop:e})=>e("parent").context.get("heights").findIndex(n=>n.id===e("id")),frontmost:({prop:e})=>e("index")===0,heightBefore:({prop:e})=>{let t=e("parent").context.get("heights"),n=t.findIndex(i=>i.id===e("id"));return t.reduce((i,r,s)=>s>=n?i:i+r.height,0)},shouldPersist:({prop:e})=>e("type")==="loading"||e("duration")===1/0},watch({track:e,prop:t,send:n}){e([()=>t("message")],()=>{let i=t("message");i&&n({type:i,src:"programmatic"})}),e([()=>t("type"),()=>t("duration")],()=>{n({type:"UPDATE"})})},on:{UPDATE:[{guard:"shouldPersist",target:"visible:persist",actions:["resetCloseTimer"]},{target:"visible:updating",actions:["resetCloseTimer"]}],MEASURE:{actions:["measureHeight"]}},entry:["setMounted","measureHeight","invokeOnVisible"],effects:["trackHeight"],states:{"visible:updating":{tags:["visible","updating"],effects:["waitForNextTick"],on:{SHOW:{target:"visible"}}},"visible:persist":{tags:["visible","paused"],on:{RESUME:{guard:bV("isLoadingType"),target:"visible",actions:["setCloseTimer"]},DISMISS:{target:"dismissing"}}},visible:{tags:["visible"],effects:["waitForDuration"],on:{DISMISS:{target:"dismissing"},PAUSE:{target:"visible:persist",actions:["syncRemainingTime"]}}},dismissing:{entry:["invokeOnDismiss"],effects:["waitForRemoveDelay"],on:{REMOVE:{target:"unmounted",actions:["notifyParentToRemove"]}}},unmounted:{entry:["invokeOnUnmount"]}},implementations:{effects:{waitForRemoveDelay({prop:e,send:t}){return mn(()=>{t({type:"REMOVE",src:"timer"})},e("removeDelay"))},waitForDuration({send:e,context:t,computed:n}){if(!n("shouldPersist"))return mn(()=>{e({type:"DISMISS",src:"timer"})},t.get("remainingTime"))},waitForNextTick({send:e}){return mn(()=>{e({type:"SHOW",src:"timer"})},0)},trackHeight({scope:e,prop:t}){let n;return H(()=>{let i=uf(e);if(!i)return;let r=()=>{let o=i.style.height;i.style.height="auto";let l=i.getBoundingClientRect().height;i.style.height=o;let c={id:t("id"),height:l};pf(t("parent"),c)},s=e.getWin(),a=new s.MutationObserver(r);a.observe(i,{childList:!0,subtree:!0,characterData:!0}),n=()=>a.disconnect()}),()=>n==null?void 0:n()}},guards:{isLoadingType:({prop:e})=>e("type")==="loading",shouldPersist:({computed:e})=>e("shouldPersist")},actions:{setMounted({context:e}){H(()=>{e.set("mounted",!0)})},measureHeight({scope:e,prop:t,context:n}){queueMicrotask(()=>{let i=uf(e);if(!i)return;let r=i.style.height;i.style.height="auto";let s=i.getBoundingClientRect().height;i.style.height=r,n.set("initialHeight",s);let a={id:t("id"),height:s};pf(t("parent"),a)})},setCloseTimer({refs:e}){e.set("closeTimerStartTime",Date.now())},resetCloseTimer({context:e,refs:t,prop:n}){t.set("closeTimerStartTime",Date.now()),e.set("remainingTime",Jl(n("duration"),n("type")))},syncRemainingTime({context:e,refs:t}){e.set("remainingTime",n=>{let i=t.get("closeTimerStartTime"),r=Date.now()-i;return t.set("lastCloseStartTimerStartTime",Date.now()),n-r})},notifyParentToRemove({prop:e}){e("parent").send({type:"TOAST.REMOVE",id:e("id")})},invokeOnDismiss({prop:e,event:t}){var n;(n=e("onStatusChange"))==null||n({status:"dismissing",src:t.src})},invokeOnUnmount({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"unmounted"})},invokeOnVisible({prop:e}){var t;(t=e("onStatusChange"))==null||t({status:"visible"})}}}};IV=(e,t)=>g(g({},t),Si(e));CV=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",ff={connect:gV,machine:vV},SV=new Map,Ql=new Map,TV=class extends K{constructor(t,n){super(t,n);z(this,"parts");z(this,"duration");z(this,"destroy",()=>{this.machine.stop(),this.el.remove()});this.duration=n.duration,this.el.setAttribute("data-scope","toast"),this.el.setAttribute("data-part","root"),this.el.innerHTML=`
@@ -22,4 +22,4 @@ - `,this.parts={title:this.el.querySelector('[data-scope="toast"][data-part="title"]'),description:this.el.querySelector('[data-scope="toast"][data-part="description"]'),close:this.el.querySelector('[data-scope="toast"][data-part="close-trigger"]'),ghostBefore:this.el.querySelector('[data-scope="toast"][data-part="ghost-before"]'),ghostAfter:this.el.querySelector('[data-scope="toast"][data-part="ghost-after"]'),progressbar:this.el.querySelector('[data-scope="toast"][data-part="progressbar"]'),loadingSpinner:this.el.querySelector('[data-scope="toast"][data-part="loading-spinner"]')}}initMachine(t){return new W(EV,t)}initApi(){return yV(this.machine.service,q)}render(){var a,o;this.spreadProps(this.el,this.api.getRootProps()),this.spreadProps(this.parts.close,this.api.getCloseTriggerProps()),this.spreadProps(this.parts.ghostBefore,this.api.getGhostBeforeProps()),this.spreadProps(this.parts.ghostAfter,this.api.getGhostAfterProps()),this.parts.title.textContent!==this.api.title&&(this.parts.title.textContent=(a=this.api.title)!=null?a:""),this.parts.description.textContent!==this.api.description&&(this.parts.description.textContent=(o=this.api.description)!=null?o:""),this.spreadProps(this.parts.title,this.api.getTitleProps()),this.spreadProps(this.parts.description,this.api.getDescriptionProps());let t=this.duration,n=t==="Infinity"||t===1/0||t===Number.POSITIVE_INFINITY,i=this.el.closest('[phx-hook="Toast"]'),r=i==null?void 0:i.querySelector("[data-loading-icon-template]"),s=r==null?void 0:r.innerHTML;n?(this.parts.progressbar.style.display="none",this.parts.loadingSpinner.style.display="flex",this.el.setAttribute("data-duration-infinity","true"),s&&this.parts.loadingSpinner.innerHTML!==s&&(this.parts.loadingSpinner.innerHTML=s)):(this.parts.progressbar.style.display="block",this.parts.loadingSpinner.style.display="none",this.el.removeAttribute("data-duration-infinity"))}},OV=class extends K{constructor(t,n){var i;super(t,n);z(this,"toastComponents",new Map);z(this,"groupEl");z(this,"store");z(this,"destroy",()=>{for(let t of this.toastComponents.values())t.destroy();this.toastComponents.clear(),this.machine.stop()});this.store=n.store,this.groupEl=(i=t.querySelector('[data-part="group"]'))!=null?i:(()=>{let r=document.createElement("div");return r.setAttribute("data-scope","toast"),r.setAttribute("data-part","group"),t.appendChild(r),r})()}initMachine(t){return new W(ff.machine,t)}initApi(){return ff.connect(this.machine.service,q)}render(){this.spreadProps(this.groupEl,this.api.getGroupProps());let t=this.api.getToasts().filter(i=>typeof i.id=="string"),n=new Set(t.map(i=>i.id));t.forEach((i,r)=>{let s=this.toastComponents.get(i.id);if(s)s.duration=i.duration,s.updateProps(y(g({},i),{parent:this.machine.service,index:r}));else{let a=document.createElement("div");a.setAttribute("data-scope","toast"),a.setAttribute("data-part","root"),this.groupEl.appendChild(a),s=new TV(a,y(g({},i),{parent:this.machine.service,index:r})),s.init(),this.toastComponents.set(i.id,s)}});for(let[i,r]of this.toastComponents)n.has(i)||(r.destroy(),this.toastComponents.delete(i))}};VV={mounted(){var h;let e=this.el;e.id||(e.id=Mn(e,"toast")),this.groupId=e.id;let t=m=>{if(m)try{return m.includes("{")?JSON.parse(m):m}catch(d){return m}},n=m=>m==="Infinity"||m===1/0?1/0:typeof m=="string"?parseInt(m,10)||void 0:m,i=(h=O(e,"placement",["top-start","top","top-end","bottom-start","bottom","bottom-end"]))!=null?h:"bottom-end";wV(e,{id:this.groupId,placement:i,overlap:C(e,"overlap"),max:Y(e,"max"),gap:Y(e,"gap"),offsets:t(O(e,"offset")),pauseOnPageIdle:C(e,"pauseOnPageIdle")});let r=qr(this.groupId),s=e.getAttribute("data-flash-info"),a=e.getAttribute("data-flash-info-title"),o=e.getAttribute("data-flash-error"),l=e.getAttribute("data-flash-error-title"),c=e.getAttribute("data-flash-info-duration"),u=e.getAttribute("data-flash-error-duration");if(r&&s)try{r.create({title:a||"Success",description:s,type:"info",id:Mn(void 0,"toast"),duration:n(c!=null?c:void 0)})}catch(m){console.error("Failed to create flash info toast:",m)}if(r&&o)try{r.create({title:l||"Error",description:o,type:"error",id:Mn(void 0,"toast"),duration:n(u!=null?u:void 0)})}catch(m){console.error("Failed to create flash error toast:",m)}this.handlers=[],this.handlers.push(this.handleEvent("toast-create",m=>{let d=qr(m.groupId||this.groupId);if(d)try{d.create({title:m.title,description:m.description,type:m.type||"info",id:m.id||Mn(void 0,"toast"),duration:n(m.duration)})}catch(p){console.error("Failed to create toast:",p)}})),this.handlers.push(this.handleEvent("toast-update",m=>{let d=qr(m.groupId||this.groupId);if(d)try{d.update(m.id,{title:m.title,description:m.description,type:m.type})}catch(p){console.error("Failed to update toast:",p)}})),this.handlers.push(this.handleEvent("toast-dismiss",m=>{let d=qr(m.groupId||this.groupId);if(d)try{d.dismiss(m.id)}catch(p){console.error("Failed to dismiss toast:",p)}})),e.addEventListener("toast:create",m=>{let{detail:d}=m,p=qr(d.groupId||this.groupId);if(p)try{p.create({title:d.title,description:d.description,type:d.type||"info",id:d.id||Mn(void 0,"toast"),duration:n(d.duration)})}catch(v){console.error("Failed to create toast:",v)}})},destroyed(){if(this.handlers)for(let e of this.handlers)this.removeHandleEvent(e)}}});var Cf={};he(Cf,{ToggleGroup:()=>BV});function DV(e,t){let{context:n,send:i,prop:r,scope:s}=e,a=n.get("value"),o=r("disabled"),l=!r("multiple"),c=r("rovingFocus"),u=r("orientation")==="horizontal";function h(m){let d=AV(s,m.value);return{id:d,disabled:!!(m.disabled||o),pressed:!!a.includes(m.value),focused:n.get("focusedId")===d}}return{value:a,setValue(m){i({type:"VALUE.SET",value:m})},getRootProps(){return t.element(y(g({},bf.root.attrs),{id:ka(s),dir:r("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":E(o),"data-orientation":r("orientation"),"data-focus":E(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){o||i({type:"ROOT.MOUSE_DOWN"})},onFocus(m){o||m.currentTarget===j(m)&&(n.get("isClickFocus")||n.get("isTabbingBackward")||i({type:"ROOT.FOCUS"}))},onBlur(m){let d=m.relatedTarget;ce(m.currentTarget,d)||o||i({type:"ROOT.BLUR"})}}))},getItemState:h,getItemProps(m){let d=h(m),p=d.focused?0:-1;return t.button(y(g({},bf.item.attrs),{id:d.id,type:"button","data-ownedby":ka(s),"data-focus":E(d.focused),disabled:d.disabled,tabIndex:c?p:void 0,role:l?"radio":void 0,"aria-checked":l?d.pressed:void 0,"aria-pressed":l?void 0:d.pressed,"data-disabled":E(d.disabled),"data-orientation":r("orientation"),dir:r("dir"),"data-state":d.pressed?"on":"off",onFocus(){d.disabled||i({type:"TOGGLE.FOCUS",id:d.id})},onClick(v){d.disabled||(i({type:"TOGGLE.CLICK",id:d.id,value:m.value}),Xe()&&v.currentTarget.focus({preventScroll:!0}))},onKeyDown(v){if(v.defaultPrevented||!ce(v.currentTarget,j(v))||d.disabled)return;let T={Tab(w){let b=w.shiftKey;i({type:"TOGGLE.SHIFT_TAB",isShiftTab:b})},ArrowLeft(){!c||!u||i({type:"TOGGLE.FOCUS_PREV"})},ArrowRight(){!c||!u||i({type:"TOGGLE.FOCUS_NEXT"})},ArrowUp(){!c||u||i({type:"TOGGLE.FOCUS_PREV"})},ArrowDown(){!c||u||i({type:"TOGGLE.FOCUS_NEXT"})},Home(){c&&i({type:"TOGGLE.FOCUS_FIRST"})},End(){c&&i({type:"TOGGLE.FOCUS_LAST"})}}[ge(v)];T&&(T(v),v.key!=="Tab"&&v.preventDefault())}}))}}}var xV,bf,ka,AV,Pf,Na,Ef,kV,NV,RV,If,LV,MV,FV,Ek,$V,Ik,HV,BV,Sf=re(()=>{"use strict";se();xV=U("toggle-group").parts("root","item"),bf=xV.build(),ka=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`toggle-group:${e.id}`},AV=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`toggle-group:${e.id}:${t}`},Pf=e=>e.getById(ka(e)),Na=e=>{let n=`[data-ownedby='${CSS.escape(ka(e))}']:not([data-disabled])`;return Fe(Pf(e),n)},Ef=e=>lt(Na(e)),kV=e=>mt(Na(e)),NV=(e,t,n)=>yi(Na(e),t,n),RV=(e,t,n)=>bi(Na(e),t,n);({not:If,and:LV}=Ee()),MV={props({props:e}){return g({defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,deselectable:!0},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}})),focusedId:t(()=>({defaultValue:null})),isTabbingBackward:t(()=>({defaultValue:!1})),isClickFocus:t(()=>({defaultValue:!1})),isWithinToolbar:t(()=>({defaultValue:!1}))}},computed:{currentLoopFocus:({context:e,prop:t})=>t("loopFocus")&&!e.get("isWithinToolbar")},entry:["checkIfWithinToolbar"],on:{"VALUE.SET":{actions:["setValue"]},"TOGGLE.CLICK":{actions:["setValue"]},"ROOT.MOUSE_DOWN":{actions:["setClickFocus"]}},states:{idle:{on:{"ROOT.FOCUS":{target:"focused",guard:If(LV("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId","clearClickFocus"]},"TOGGLE.FOCUS":{actions:["setFocusedId"]},"TOGGLE.FOCUS_NEXT":{actions:["focusNextToggle"]},"TOGGLE.FOCUS_PREV":{actions:["focusPrevToggle"]},"TOGGLE.FOCUS_FIRST":{actions:["focusFirstToggle"]},"TOGGLE.FOCUS_LAST":{actions:["focusLastToggle"]},"TOGGLE.SHIFT_TAB":[{guard:If("isFirstToggleFocused"),target:"idle",actions:["setIsTabbingBackward"]},{actions:["setIsTabbingBackward"]}]}}},implementations:{guards:{isClickFocus:({context:e})=>e.get("isClickFocus"),isTabbingBackward:({context:e})=>e.get("isTabbingBackward"),isFirstToggleFocused:({context:e,scope:t})=>{var n;return e.get("focusedId")===((n=Ef(t))==null?void 0:n.id)}},actions:{setIsTabbingBackward({context:e}){e.set("isTabbingBackward",!0)},clearIsTabbingBackward({context:e}){e.set("isTabbingBackward",!1)},setClickFocus({context:e}){e.set("isClickFocus",!0)},clearClickFocus({context:e}){e.set("isClickFocus",!1)},checkIfWithinToolbar({context:e,scope:t}){var i;let n=(i=Pf(t))==null?void 0:i.closest("[role=toolbar]");e.set("isWithinToolbar",!!n)},setFocusedId({context:e,event:t}){e.set("focusedId",t.id)},clearFocusedId({context:e}){e.set("focusedId",null)},setValue({context:e,event:t,prop:n}){yn(t,["value"]);let i=e.get("value");pn(t.value)?i=t.value:n("multiple")?i=yt(i,t.value):i=fe(i,[t.value])&&n("deselectable")?[]:[t.value],e.set("value",i)},focusNextToggle({context:e,scope:t,prop:n}){H(()=>{var r;let i=e.get("focusedId");i&&((r=NV(t,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusPrevToggle({context:e,scope:t,prop:n}){H(()=>{var r;let i=e.get("focusedId");i&&((r=RV(t,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusFirstToggle({scope:e}){H(()=>{var t;(t=Ef(e))==null||t.focus({preventScroll:!0})})},focusLastToggle({scope:e}){H(()=>{var t;(t=kV(e))==null||t.focus({preventScroll:!0})})}}}},FV=_()(["dir","disabled","getRootNode","id","ids","loopFocus","multiple","onValueChange","orientation","rovingFocus","value","defaultValue","deselectable"]),Ek=B(FV),$V=_()(["value","disabled"]),Ik=B($V),HV=class extends K{initMachine(e){return new W(MV,e)}initApi(){return DV(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="toggle-group"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelectorAll('[data-scope="toggle-group"][data-part="item"]');for(let n=0;n{let s=O(e,"onValueChange");s&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(s,{value:r.value,id:e.id});let a=O(e,"onValueChangeClient");a&&e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:{value:r.value,id:e.id}}))}}),i=new HV(e,n);i.init(),this.toggleGroup=i,this.onSetValue=r=>{let{value:s}=r.detail;i.api.setValue(s)},e.addEventListener("phx:toggle-group:set-value",this.onSetValue),this.handlers=[],this.handlers.push(this.handleEvent("toggle-group_set_value",r=>{let s=r.id;s&&s!==e.id||i.api.setValue(r.value)})),this.handlers.push(this.handleEvent("toggle-group:value",()=>{this.pushEvent("toggle-group:value_response",{value:i.api.value})}))},updated(){var e;(e=this.toggleGroup)==null||e.updateProps(y(g({},C(this.el,"controlled")?{value:Z(this.el,"value")}:{defaultValue:Z(this.el,"defaultValue")}),{deselectable:C(this.el,"deselectable"),loopFocus:C(this.el,"loopFocus"),rovingFocus:C(this.el,"rovingFocus"),disabled:C(this.el,"disabled"),multiple:C(this.el,"multiple"),orientation:O(this.el,"orientation",["horizontal","vertical"]),dir:O(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:toggle-group:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.toggleGroup)==null||e.destroy()}}});var xf={};he(xf,{TreeView:()=>ZV});function Vf(e,t,n){let i=e.getNodeValue(t);if(!e.isBranchNode(t))return n.includes(i);let r=e.getDescendantValues(i),s=r.every(o=>n.includes(o)),a=r.some(o=>n.includes(o));return s?!0:a?"indeterminate":!1}function UV(e,t,n){let i=e.getDescendantValues(t),r=i.every(s=>n.includes(s));return vt(r?ct(n,...i):Ze(n,...i))}function qV(e,t){let n=new Map;return e.visit({onEnter:i=>{let r=e.getNodeValue(i),s=e.isBranchNode(i),a=Vf(e,i,t);n.set(r,{type:s?"branch":"leaf",checked:a})}}),n}function WV(e,t){let{context:n,scope:i,computed:r,prop:s,send:a}=e,o=s("collection"),l=Array.from(n.get("expandedValue")),c=Array.from(n.get("selectedValue")),u=Array.from(n.get("checkedValue")),h=r("isTypingAhead"),m=n.get("focusedValue"),d=n.get("loadingStatus"),p=n.get("renamingValue"),v=({indexPath:b})=>o.getValuePath(b).slice(0,-1).some(S=>!l.includes(S)),I=o.getFirstNode(void 0,{skip:v}),T=I?o.getNodeValue(I):null;function w(b){let{node:f,indexPath:S}=b,P=o.getNodeValue(f);return{id:nc(i,P),value:P,indexPath:S,valuePath:o.getValuePath(S),disabled:!!f.disabled,focused:m==null?T===P:m===P,selected:c.includes(P),expanded:l.includes(P),loading:d[P]==="loading",depth:S.length,isBranch:o.isBranchNode(f),renaming:p===P,get checked(){return Vf(o,f,u)}}}return{collection:o,expandedValue:l,selectedValue:c,checkedValue:u,toggleChecked(b,f){a({type:"CHECKED.TOGGLE",value:b,isBranch:f})},setChecked(b){a({type:"CHECKED.SET",value:b})},clearChecked(){a({type:"CHECKED.CLEAR"})},getCheckedMap(){return qV(o,u)},expand(b){a({type:b?"BRANCH.EXPAND":"EXPANDED.ALL",value:b})},collapse(b){a({type:b?"BRANCH.COLLAPSE":"EXPANDED.CLEAR",value:b})},deselect(b){a({type:b?"NODE.DESELECT":"SELECTED.CLEAR",value:b})},select(b){a({type:b?"NODE.SELECT":"SELECTED.ALL",value:b,isTrusted:!1})},getVisibleNodes(){return r("visibleNodes")},focus(b){ke(i,b)},selectParent(b){let f=o.getParentNode(b);if(!f)return;let S=Ze(c,o.getNodeValue(f));a({type:"SELECTED.SET",value:S,src:"select.parent"})},expandParent(b){let f=o.getParentNode(b);if(!f)return;let S=Ze(l,o.getNodeValue(f));a({type:"EXPANDED.SET",value:S,src:"expand.parent"})},setExpandedValue(b){let f=vt(b);a({type:"EXPANDED.SET",value:f})},setSelectedValue(b){let f=vt(b);a({type:"SELECTED.SET",value:f})},startRenaming(b){a({type:"NODE.RENAME",value:b})},submitRenaming(b,f){a({type:"RENAME.SUBMIT",value:b,label:f})},cancelRenaming(){a({type:"RENAME.CANCEL"})},getRootProps(){return t.element(y(g({},Ge.root.attrs),{id:GV(i),dir:s("dir")}))},getLabelProps(){return t.element(y(g({},Ge.label.attrs),{id:Tf(i),dir:s("dir")}))},getTreeProps(){return t.element(y(g({},Ge.tree.attrs),{id:ec(i),dir:s("dir"),role:"tree","aria-label":"Tree View","aria-labelledby":Tf(i),"aria-multiselectable":s("selectionMode")==="multiple"||void 0,tabIndex:-1,onKeyDown(b){if(b.defaultPrevented||Re(b))return;let f=j(b);if(Ot(f))return;let S=f==null?void 0:f.closest("[data-part=branch-control], [data-part=item]");if(!S)return;let P=S.dataset.value;if(P==null){console.warn("[zag-js/tree-view] Node id not found for node",S);return}let V=S.matches("[data-part=branch-control]"),A={ArrowDown(N){xe(N)||(N.preventDefault(),a({type:"NODE.ARROW_DOWN",id:P,shiftKey:N.shiftKey}))},ArrowUp(N){xe(N)||(N.preventDefault(),a({type:"NODE.ARROW_UP",id:P,shiftKey:N.shiftKey}))},ArrowLeft(N){xe(N)||S.dataset.disabled||(N.preventDefault(),a({type:V?"BRANCH_NODE.ARROW_LEFT":"NODE.ARROW_LEFT",id:P}))},ArrowRight(N){!V||S.dataset.disabled||(N.preventDefault(),a({type:"BRANCH_NODE.ARROW_RIGHT",id:P}))},Home(N){xe(N)||(N.preventDefault(),a({type:"NODE.HOME",id:P,shiftKey:N.shiftKey}))},End(N){xe(N)||(N.preventDefault(),a({type:"NODE.END",id:P,shiftKey:N.shiftKey}))},Space(N){var D;S.dataset.disabled||(h?a({type:"TREE.TYPEAHEAD",key:N.key}):(D=A.Enter)==null||D.call(A,N))},Enter(N){S.dataset.disabled||st(f)&&xe(N)||(a({type:V?"BRANCH_NODE.CLICK":"NODE.CLICK",id:P,src:"keyboard"}),st(f)||N.preventDefault())},"*"(N){S.dataset.disabled||(N.preventDefault(),a({type:"SIBLINGS.EXPAND",id:P}))},a(N){!N.metaKey||S.dataset.disabled||(N.preventDefault(),a({type:"SELECTED.ALL",moveFocus:!0}))},F2(N){if(S.dataset.disabled)return;let D=s("canRename");if(!D)return;let $=o.getIndexPath(P);if($){let te=o.at($);if(te&&!D(te,$))return}N.preventDefault(),a({type:"NODE.RENAME",value:P})}},x=ge(b,{dir:s("dir")}),k=A[x];if(k){k(b);return}Ue.isValidEvent(b)&&(a({type:"TREE.TYPEAHEAD",key:b.key,id:P}),b.preventDefault())}}))},getNodeState:w,getItemProps(b){let f=w(b);return t.element(y(g({},Ge.item.attrs),{id:f.id,dir:s("dir"),"data-ownedby":ec(i),"data-path":b.indexPath.join("/"),"data-value":f.value,tabIndex:f.focused?0:-1,"data-focus":E(f.focused),role:"treeitem","aria-current":f.selected?"true":void 0,"aria-selected":f.disabled?void 0:f.selected,"data-selected":E(f.selected),"aria-disabled":X(f.disabled),"data-disabled":E(f.disabled),"data-renaming":E(f.renaming),"aria-level":f.depth,"data-depth":f.depth,style:{"--depth":f.depth},onFocus(S){S.stopPropagation(),a({type:"NODE.FOCUS",id:f.value})},onClick(S){if(f.disabled||!pe(S)||st(S.currentTarget)&&xe(S))return;let P=S.metaKey||S.ctrlKey;a({type:"NODE.CLICK",id:f.value,shiftKey:S.shiftKey,ctrlKey:P}),S.stopPropagation(),st(S.currentTarget)||S.preventDefault()}}))},getItemTextProps(b){let f=w(b);return t.element(y(g({},Ge.itemText.attrs),{"data-disabled":E(f.disabled),"data-selected":E(f.selected),"data-focus":E(f.focused)}))},getItemIndicatorProps(b){let f=w(b);return t.element(y(g({},Ge.itemIndicator.attrs),{"aria-hidden":!0,"data-disabled":E(f.disabled),"data-selected":E(f.selected),"data-focus":E(f.focused),hidden:!f.selected}))},getBranchProps(b){let f=w(b);return t.element(y(g({},Ge.branch.attrs),{"data-depth":f.depth,dir:s("dir"),"data-branch":f.value,role:"treeitem","data-ownedby":ec(i),"data-value":f.value,"aria-level":f.depth,"aria-selected":f.disabled?void 0:f.selected,"data-path":b.indexPath.join("/"),"data-selected":E(f.selected),"aria-expanded":f.expanded,"data-state":f.expanded?"open":"closed","aria-disabled":X(f.disabled),"data-disabled":E(f.disabled),"data-loading":E(f.loading),"aria-busy":X(f.loading),style:{"--depth":f.depth}}))},getBranchIndicatorProps(b){let f=w(b);return t.element(y(g({},Ge.branchIndicator.attrs),{"aria-hidden":!0,"data-state":f.expanded?"open":"closed","data-disabled":E(f.disabled),"data-selected":E(f.selected),"data-focus":E(f.focused),"data-loading":E(f.loading)}))},getBranchTriggerProps(b){let f=w(b);return t.element(y(g({},Ge.branchTrigger.attrs),{role:"button",dir:s("dir"),"data-disabled":E(f.disabled),"data-state":f.expanded?"open":"closed","data-value":f.value,"data-loading":E(f.loading),disabled:f.loading,onClick(S){f.disabled||f.loading||(a({type:"BRANCH_TOGGLE.CLICK",id:f.value}),S.stopPropagation())}}))},getBranchControlProps(b){let f=w(b);return t.element(y(g({},Ge.branchControl.attrs),{role:"button",id:f.id,dir:s("dir"),tabIndex:f.focused?0:-1,"data-path":b.indexPath.join("/"),"data-state":f.expanded?"open":"closed","data-disabled":E(f.disabled),"data-selected":E(f.selected),"data-focus":E(f.focused),"data-renaming":E(f.renaming),"data-value":f.value,"data-depth":f.depth,"data-loading":E(f.loading),"aria-busy":X(f.loading),onFocus(S){a({type:"NODE.FOCUS",id:f.value}),S.stopPropagation()},onClick(S){if(f.disabled||f.loading||!pe(S)||st(S.currentTarget)&&xe(S))return;let P=S.metaKey||S.ctrlKey;a({type:"BRANCH_NODE.CLICK",id:f.value,shiftKey:S.shiftKey,ctrlKey:P}),S.stopPropagation()}}))},getBranchTextProps(b){let f=w(b);return t.element(y(g({},Ge.branchText.attrs),{dir:s("dir"),"data-disabled":E(f.disabled),"data-state":f.expanded?"open":"closed","data-loading":E(f.loading)}))},getBranchContentProps(b){let f=w(b);return t.element(y(g({},Ge.branchContent.attrs),{role:"group",dir:s("dir"),"data-state":f.expanded?"open":"closed","data-depth":f.depth,"data-path":b.indexPath.join("/"),"data-value":f.value,hidden:!f.expanded}))},getBranchIndentGuideProps(b){let f=w(b);return t.element(y(g({},Ge.branchIndentGuide.attrs),{"data-depth":f.depth}))},getNodeCheckboxProps(b){let f=w(b),S=f.checked;return t.element(y(g({},Ge.nodeCheckbox.attrs),{tabIndex:-1,role:"checkbox","data-state":S===!0?"checked":S===!1?"unchecked":"indeterminate","aria-checked":S===!0?"true":S===!1?"false":"mixed","data-disabled":E(f.disabled),onClick(P){if(P.defaultPrevented||f.disabled||!pe(P))return;a({type:"CHECKED.TOGGLE",value:f.value,isBranch:f.isBranch}),P.stopPropagation();let V=P.currentTarget.closest("[role=treeitem]");V==null||V.focus({preventScroll:!0})}}))},getNodeRenameInputProps(b){let f=w(b);return t.input(y(g({},Ge.nodeRenameInput.attrs),{id:wf(i,f.value),type:"text","aria-label":"Rename tree item",hidden:!f.renaming,onKeyDown(S){Re(S)||(S.key==="Escape"&&(a({type:"RENAME.CANCEL"}),S.preventDefault()),S.key==="Enter"&&(a({type:"RENAME.SUBMIT",label:S.currentTarget.value}),S.preventDefault()),S.stopPropagation())},onBlur(S){a({type:"RENAME.SUBMIT",label:S.currentTarget.value})}}))}}}function Ra(e,t){let{context:n,prop:i,refs:r}=e;if(!i("loadChildren")){n.set("expandedValue",v=>vt(Ze(v,...t)));return}let s=n.get("loadingStatus"),[a,o]=oo(t,v=>s[v]==="loaded");if(a.length>0&&n.set("expandedValue",v=>vt(Ze(v,...a))),o.length===0)return;let l=i("collection"),[c,u]=oo(o,v=>{let I=l.findNode(v);return l.getNodeChildren(I).length>0});if(c.length>0&&n.set("expandedValue",v=>vt(Ze(v,...c))),u.length===0)return;n.set("loadingStatus",v=>g(g({},v),u.reduce((I,T)=>y(g({},I),{[T]:"loading"}),{})));let h=u.map(v=>{let I=l.getIndexPath(v),T=l.getValuePath(I),w=l.findNode(v);return{id:v,indexPath:I,valuePath:T,node:w}}),m=r.get("pendingAborts"),d=i("loadChildren");vn(d,()=>"[zag-js/tree-view] `loadChildren` is required for async expansion");let p=h.map(({id:v,indexPath:I,valuePath:T,node:w})=>{let b=m.get(v);b&&(b.abort(),m.delete(v));let f=new AbortController;return m.set(v,f),d({valuePath:T,indexPath:I,node:w,signal:f.signal})});Promise.allSettled(p).then(v=>{var f,S;let I=[],T=[],w=n.get("loadingStatus"),b=i("collection");v.forEach((P,V)=>{let{id:A,indexPath:x,node:k,valuePath:N}=h[V];P.status==="fulfilled"?(w[A]="loaded",I.push(A),b=b.replace(x,y(g({},k),{children:P.value}))):(m.delete(A),Reflect.deleteProperty(w,A),T.push({node:k,error:P.reason,indexPath:x,valuePath:N}))}),n.set("loadingStatus",w),I.length&&(n.set("expandedValue",P=>vt(Ze(P,...I))),(f=i("onLoadChildrenComplete"))==null||f({collection:b})),T.length&&((S=i("onLoadChildrenError"))==null||S({nodes:T}))})}function _t(e){let{prop:t,context:n}=e;return function({indexPath:r}){return t("collection").getValuePath(r).slice(0,-1).some(a=>!n.get("expandedValue").includes(a))}}function oi(e,t){let{prop:n,scope:i,computed:r}=e,s=n("scrollToIndexFn");if(!s)return!1;let a=n("collection"),o=r("visibleNodes");for(let l=0;li.getById(nc(i,t))}),!0}return!1}function jV(e){var s;let n=e.querySelectorAll('[data-scope="tree-view"][data-part="branch"], [data-scope="tree-view"][data-part="item"]'),i=[];for(let a of n){let o=a.getAttribute("data-path"),l=a.getAttribute("data-value");if(o==null||l==null)continue;let c=o.split("/").map(m=>parseInt(m,10));if(c.some(Number.isNaN))continue;let u=(s=a.getAttribute("data-name"))!=null?s:l,h=a.getAttribute("data-part")==="branch";i.push({pathArr:c,id:l,name:u,isBranch:h})}i.sort((a,o)=>{let l=Math.min(a.pathArr.length,o.pathArr.length);for(let c=0;c{"use strict";yr();se();_V=U("tree-view").parts("branch","branchContent","branchControl","branchIndentGuide","branchIndicator","branchText","branchTrigger","item","itemIndicator","itemText","label","nodeCheckbox","nodeRenameInput","root","tree"),Ge=_V.build(),tc=e=>new Ao(e);tc.empty=()=>new Ao({rootNode:{children:[]}});GV=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tree:${e.id}:root`},Tf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`tree:${e.id}:label`},nc=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.node)==null?void 0:i.call(n,t))!=null?r:`tree:${e.id}:node:${t}`},ec=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.tree)!=null?n:`tree:${e.id}:tree`},ke=(e,t)=>{var n;t!=null&&((n=e.getById(nc(e,t)))==null||n.focus())},wf=(e,t)=>`tree:${e.id}:rename-input:${t}`,Of=(e,t)=>e.getById(wf(e,t));({and:Gt}=Ee()),KV={props({props:e}){return g({selectionMode:"single",collection:tc.empty(),typeahead:!0,expandOnClick:!0,defaultExpandedValue:[],defaultSelectedValue:[]},e)},initialState(){return"idle"},context({prop:e,bindable:t,getContext:n}){return{expandedValue:t(()=>({defaultValue:e("defaultExpandedValue"),value:e("expandedValue"),isEqual:fe,onChange(i){var a;let s=n().get("focusedValue");(a=e("onExpandedChange"))==null||a({expandedValue:i,focusedValue:s,get expandedNodes(){return e("collection").findNodes(i)}})}})),selectedValue:t(()=>({defaultValue:e("defaultSelectedValue"),value:e("selectedValue"),isEqual:fe,onChange(i){var a;let s=n().get("focusedValue");(a=e("onSelectionChange"))==null||a({selectedValue:i,focusedValue:s,get selectedNodes(){return e("collection").findNodes(i)}})}})),focusedValue:t(()=>({defaultValue:e("defaultFocusedValue")||null,value:e("focusedValue"),onChange(i){var r;(r=e("onFocusChange"))==null||r({focusedValue:i,get focusedNode(){return i?e("collection").findNode(i):null}})}})),loadingStatus:t(()=>({defaultValue:{}})),checkedValue:t(()=>({defaultValue:e("defaultCheckedValue")||[],value:e("checkedValue"),isEqual:fe,onChange(i){var r;(r=e("onCheckedChange"))==null||r({checkedValue:i})}})),renamingValue:t(()=>({sync:!0,defaultValue:null}))}},refs(){return{typeaheadState:g({},Ue.defaultOptions),pendingAborts:new Map}},computed:{isMultipleSelection:({prop:e})=>e("selectionMode")==="multiple",isTypingAhead:({refs:e})=>e.get("typeaheadState").keysSoFar.length>0,visibleNodes:({prop:e,context:t})=>{let n=[];return e("collection").visit({skip:_t({prop:e,context:t}),onEnter:(i,r)=>{n.push({node:i,indexPath:r})}}),n}},on:{"EXPANDED.SET":{actions:["setExpanded"]},"EXPANDED.CLEAR":{actions:["clearExpanded"]},"EXPANDED.ALL":{actions:["expandAllBranches"]},"BRANCH.EXPAND":{actions:["expandBranches"]},"BRANCH.COLLAPSE":{actions:["collapseBranches"]},"SELECTED.SET":{actions:["setSelected"]},"SELECTED.ALL":[{guard:Gt("isMultipleSelection","moveFocus"),actions:["selectAllNodes","focusTreeLastNode"]},{guard:"isMultipleSelection",actions:["selectAllNodes"]}],"SELECTED.CLEAR":{actions:["clearSelected"]},"NODE.SELECT":{actions:["selectNode"]},"NODE.DESELECT":{actions:["deselectNode"]},"CHECKED.TOGGLE":{actions:["toggleChecked"]},"CHECKED.SET":{actions:["setChecked"]},"CHECKED.CLEAR":{actions:["clearChecked"]},"NODE.FOCUS":{actions:["setFocusedNode"]},"NODE.ARROW_DOWN":[{guard:Gt("isShiftKey","isMultipleSelection"),actions:["focusTreeNextNode","extendSelectionToNextNode"]},{actions:["focusTreeNextNode"]}],"NODE.ARROW_UP":[{guard:Gt("isShiftKey","isMultipleSelection"),actions:["focusTreePrevNode","extendSelectionToPrevNode"]},{actions:["focusTreePrevNode"]}],"NODE.ARROW_LEFT":{actions:["focusBranchNode"]},"BRANCH_NODE.ARROW_LEFT":[{guard:"isBranchExpanded",actions:["collapseBranch"]},{actions:["focusBranchNode"]}],"BRANCH_NODE.ARROW_RIGHT":[{guard:Gt("isBranchFocused","isBranchExpanded"),actions:["focusBranchFirstNode"]},{actions:["expandBranch"]}],"SIBLINGS.EXPAND":{actions:["expandSiblingBranches"]},"NODE.HOME":[{guard:Gt("isShiftKey","isMultipleSelection"),actions:["extendSelectionToFirstNode","focusTreeFirstNode"]},{actions:["focusTreeFirstNode"]}],"NODE.END":[{guard:Gt("isShiftKey","isMultipleSelection"),actions:["extendSelectionToLastNode","focusTreeLastNode"]},{actions:["focusTreeLastNode"]}],"NODE.CLICK":[{guard:Gt("isCtrlKey","isMultipleSelection"),actions:["toggleNodeSelection"]},{guard:Gt("isShiftKey","isMultipleSelection"),actions:["extendSelectionToNode"]},{actions:["selectNode"]}],"BRANCH_NODE.CLICK":[{guard:Gt("isCtrlKey","isMultipleSelection"),actions:["toggleNodeSelection"]},{guard:Gt("isShiftKey","isMultipleSelection"),actions:["extendSelectionToNode"]},{guard:"expandOnClick",actions:["selectNode","toggleBranchNode"]},{actions:["selectNode"]}],"BRANCH_TOGGLE.CLICK":{actions:["toggleBranchNode"]},"TREE.TYPEAHEAD":{actions:["focusMatchedNode"]}},exit:["clearPendingAborts"],states:{idle:{on:{"NODE.RENAME":{target:"renaming",actions:["setRenamingValue"]}}},renaming:{entry:["syncRenameInput","focusRenameInput"],on:{"RENAME.SUBMIT":{guard:"isRenameLabelValid",target:"idle",actions:["submitRenaming"]},"RENAME.CANCEL":{target:"idle",actions:["cancelRenaming"]}}}},implementations:{guards:{isBranchFocused:({context:e,event:t})=>e.get("focusedValue")===t.id,isBranchExpanded:({context:e,event:t})=>e.get("expandedValue").includes(t.id),isShiftKey:({event:e})=>e.shiftKey,isCtrlKey:({event:e})=>e.ctrlKey,hasSelectedItems:({context:e})=>e.get("selectedValue").length>0,isMultipleSelection:({prop:e})=>e("selectionMode")==="multiple",moveFocus:({event:e})=>!!e.moveFocus,expandOnClick:({prop:e})=>!!e("expandOnClick"),isRenameLabelValid:({event:e})=>e.label.trim()!==""},actions:{selectNode({context:e,event:t}){let n=t.id||t.value;e.set("selectedValue",i=>n==null?i:!t.isTrusted&&pn(n)?i.concat(...n):[pn(n)?mt(n):n].filter(Boolean))},deselectNode({context:e,event:t}){let n=or(t.id||t.value);e.set("selectedValue",i=>ct(i,...n))},setFocusedNode({context:e,event:t}){e.set("focusedValue",t.id)},clearFocusedNode({context:e}){e.set("focusedValue",null)},clearSelectedItem({context:e}){e.set("selectedValue",[])},toggleBranchNode({context:e,event:t,action:n}){let i=e.get("expandedValue").includes(t.id);n(i?["collapseBranch"]:["expandBranch"])},expandBranch(e){let{event:t}=e;Ra(e,[t.id])},expandBranches(e){let{context:t,event:n}=e,i=or(n.value);Ra(e,fs(i,t.get("expandedValue")))},collapseBranch({context:e,event:t}){e.set("expandedValue",n=>ct(n,t.id))},collapseBranches(e){let{context:t,event:n}=e,i=or(n.value);t.set("expandedValue",r=>ct(r,...i))},setExpanded({context:e,event:t}){pn(t.value)&&e.set("expandedValue",t.value)},clearExpanded({context:e}){e.set("expandedValue",[])},setSelected({context:e,event:t}){pn(t.value)&&e.set("selectedValue",t.value)},clearSelected({context:e}){e.set("selectedValue",[])},focusTreeFirstNode(e){let{prop:t,scope:n}=e,i=t("collection"),r=i.getFirstNode(void 0,{skip:_t(e)});if(!r)return;let s=i.getNodeValue(r);oi(e,s)?H(()=>ke(n,s)):ke(n,s)},focusTreeLastNode(e){let{prop:t,scope:n}=e,i=t("collection"),r=i.getLastNode(void 0,{skip:_t(e)}),s=i.getNodeValue(r);oi(e,s)?H(()=>ke(n,s)):ke(n,s)},focusBranchFirstNode(e){let{event:t,prop:n,scope:i}=e,r=n("collection"),s=r.findNode(t.id),a=r.getFirstNode(s,{skip:_t(e)});if(!a)return;let o=r.getNodeValue(a);oi(e,o)?H(()=>ke(i,o)):ke(i,o)},focusTreeNextNode(e){let{event:t,prop:n,scope:i}=e,r=n("collection"),s=r.getNextNode(t.id,{skip:_t(e)});if(!s)return;let a=r.getNodeValue(s);oi(e,a)?H(()=>ke(i,a)):ke(i,a)},focusTreePrevNode(e){let{event:t,prop:n,scope:i}=e,r=n("collection"),s=r.getPreviousNode(t.id,{skip:_t(e)});if(!s)return;let a=r.getNodeValue(s);oi(e,a)?H(()=>ke(i,a)):ke(i,a)},focusBranchNode(e){let{event:t,prop:n,scope:i}=e,r=n("collection"),s=r.getParentNode(t.id),a=s?r.getNodeValue(s):void 0;if(!a)return;oi(e,a)?H(()=>ke(i,a)):ke(i,a)},selectAllNodes({context:e,prop:t}){e.set("selectedValue",t("collection").getValues())},focusMatchedNode(e){let{context:t,prop:n,refs:i,event:r,scope:s,computed:a}=e,l=a("visibleNodes").map(({node:h})=>({textContent:n("collection").stringifyNode(h),id:n("collection").getNodeValue(h)})),c=Ue(l,{state:i.get("typeaheadState"),activeId:t.get("focusedValue"),key:r.key});if(!(c!=null&&c.id))return;oi(e,c.id)?H(()=>ke(s,c.id)):ke(s,c.id)},toggleNodeSelection({context:e,event:t}){let n=yt(e.get("selectedValue"),t.id);e.set("selectedValue",n)},expandAllBranches(e){let{context:t,prop:n}=e,i=n("collection").getBranchValues(),r=fs(i,t.get("expandedValue"));Ra(e,r)},expandSiblingBranches(e){let{context:t,event:n,prop:i}=e,r=i("collection"),s=r.getIndexPath(n.id);if(!s)return;let o=r.getSiblingNodes(s).map(c=>r.getNodeValue(c)),l=fs(o,t.get("expandedValue"));Ra(e,l)},extendSelectionToNode(e){let{context:t,event:n,prop:i,computed:r}=e,s=i("collection"),a=lt(t.get("selectedValue"))||s.getNodeValue(s.getFirstNode()),o=n.id,l=[a,o],c=0;r("visibleNodes").forEach(({node:h})=>{let m=s.getNodeValue(h);c===1&&l.push(m),(m===a||m===o)&&c++}),t.set("selectedValue",vt(l))},extendSelectionToNextNode(e){let{context:t,event:n,prop:i}=e,r=i("collection"),s=r.getNextNode(n.id,{skip:_t(e)});if(!s)return;let a=new Set(t.get("selectedValue")),o=r.getNodeValue(s);o!=null&&(a.has(n.id)&&a.has(o)?a.delete(n.id):a.has(o)||a.add(o),t.set("selectedValue",Array.from(a)))},extendSelectionToPrevNode(e){let{context:t,event:n,prop:i}=e,r=i("collection"),s=r.getPreviousNode(n.id,{skip:_t(e)});if(!s)return;let a=new Set(t.get("selectedValue")),o=r.getNodeValue(s);o!=null&&(a.has(n.id)&&a.has(o)?a.delete(n.id):a.has(o)||a.add(o),t.set("selectedValue",Array.from(a)))},extendSelectionToFirstNode(e){let{context:t,prop:n}=e,i=n("collection"),r=lt(t.get("selectedValue")),s=[];i.visit({skip:_t(e),onEnter:a=>{let o=i.getNodeValue(a);if(s.push(o),o===r)return"stop"}}),t.set("selectedValue",s)},extendSelectionToLastNode(e){let{context:t,prop:n}=e,i=n("collection"),r=lt(t.get("selectedValue")),s=[],a=!1;i.visit({skip:_t(e),onEnter:o=>{let l=i.getNodeValue(o);l===r&&(a=!0),a&&s.push(l)}}),t.set("selectedValue",s)},clearPendingAborts({refs:e}){let t=e.get("pendingAborts");t.forEach(n=>n.abort()),t.clear()},toggleChecked({context:e,event:t,prop:n}){let i=n("collection");e.set("checkedValue",r=>t.isBranch?UV(i,t.value,r):yt(r,t.value))},setChecked({context:e,event:t}){e.set("checkedValue",t.value)},clearChecked({context:e}){e.set("checkedValue",[])},setRenamingValue({context:e,event:t,prop:n}){e.set("renamingValue",t.value);let i=n("onRenameStart");if(i){let r=n("collection"),s=r.getIndexPath(t.value);if(s){let a=r.at(s);a&&i({value:t.value,node:a,indexPath:s})}}},submitRenaming({context:e,event:t,prop:n,scope:i}){var c;let r=e.get("renamingValue");if(!r)return;let a=n("collection").getIndexPath(r);if(!a)return;let o=t.label.trim(),l=n("onBeforeRename");if(l&&!l({value:r,label:o,indexPath:a})){e.set("renamingValue",null),ke(i,r);return}(c=n("onRenameComplete"))==null||c({value:r,label:o,indexPath:a}),e.set("renamingValue",null),ke(i,r)},cancelRenaming({context:e,scope:t}){let n=e.get("renamingValue");e.set("renamingValue",null),n&&ke(t,n)},syncRenameInput({context:e,scope:t,prop:n}){let i=e.get("renamingValue");if(!i)return;let r=n("collection"),s=r.findNode(i);if(!s)return;let a=r.stringifyNode(s),o=Of(t,i);Me(o,a)},focusRenameInput({context:e,scope:t}){let n=e.get("renamingValue");if(!n)return;let i=Of(t,n);i&&(i.focus(),i.select())}}}};zV=_()(["ids","collection","dir","expandedValue","expandOnClick","defaultFocusedValue","focusedValue","getRootNode","id","onExpandedChange","onFocusChange","onSelectionChange","checkedValue","selectedValue","selectionMode","typeahead","defaultExpandedValue","defaultSelectedValue","defaultCheckedValue","onCheckedChange","onLoadChildrenComplete","onLoadChildrenError","loadChildren","canRename","onRenameStart","onBeforeRename","onRenameComplete","scrollToIndexFn"]),Ok=B(zV),YV=_()(["node","indexPath"]),wk=B(YV);XV=class extends K{constructor(t,n){var s;let i=(s=n.treeData)!=null?s:jV(t),r=tc({nodeToValue:a=>a.id,nodeToString:a=>a.name,rootNode:i});super(t,y(g({},n),{collection:r}));z(this,"treeCollection");z(this,"syncTree",()=>{let t=this.el.querySelector('[data-scope="tree-view"][data-part="tree"]');t&&(this.spreadProps(t,this.api.getTreeProps()),this.updateExistingTree(t))});this.treeCollection=r}initMachine(t){return new W(KV,g({},t))}initApi(){return WV(this.machine.service,q)}getNodeAt(t){var i;if(t.length===0)return;let n=this.treeCollection.rootNode;for(let r of t)if(n=(i=n==null?void 0:n.children)==null?void 0:i[r],!n)return;return n}updateExistingTree(t){this.spreadProps(t,this.api.getTreeProps());let n=t.querySelectorAll('[data-scope="tree-view"][data-part="branch"]');for(let r of n){let s=r.getAttribute("data-path");if(s==null)continue;let a=s.split("/").map(p=>parseInt(p,10)),o=this.getNodeAt(a);if(!o)continue;let l={indexPath:a,node:o};this.spreadProps(r,this.api.getBranchProps(l));let c=r.querySelector('[data-scope="tree-view"][data-part="branch-control"]');c&&this.spreadProps(c,this.api.getBranchControlProps(l));let u=r.querySelector('[data-scope="tree-view"][data-part="branch-text"]');u&&this.spreadProps(u,this.api.getBranchTextProps(l));let h=r.querySelector('[data-scope="tree-view"][data-part="branch-indicator"]');h&&this.spreadProps(h,this.api.getBranchIndicatorProps(l));let m=r.querySelector('[data-scope="tree-view"][data-part="branch-content"]');m&&this.spreadProps(m,this.api.getBranchContentProps(l));let d=r.querySelector('[data-scope="tree-view"][data-part="branch-indent-guide"]');d&&this.spreadProps(d,this.api.getBranchIndentGuideProps(l))}let i=t.querySelectorAll('[data-scope="tree-view"][data-part="item"]');for(let r of i){let s=r.getAttribute("data-path");if(s==null)continue;let a=s.split("/").map(c=>parseInt(c,10)),o=this.getNodeAt(a);if(!o)continue;let l={indexPath:a,node:o};this.spreadProps(r,this.api.getItemProps(l))}}render(){var i;let t=(i=this.el.querySelector('[data-scope="tree-view"][data-part="root"]'))!=null?i:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="tree-view"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps()),this.syncTree()}},ZV={mounted(){var i;let e=this.el,t=this.pushEvent.bind(this),n=new XV(e,y(g({id:e.id},C(e,"controlled")?{expandedValue:Z(e,"expandedValue"),selectedValue:Z(e,"selectedValue")}:{defaultExpandedValue:Z(e,"defaultExpandedValue"),defaultSelectedValue:Z(e,"defaultSelectedValue")}),{selectionMode:(i=O(e,"selectionMode",["single","multiple"]))!=null?i:"single",dir:Oe(e),onSelectionChange:r=>{var d;let s=C(e,"redirect"),a=(d=r.selectedValue)!=null&&d.length?r.selectedValue[0]:void 0,o=[...e.querySelectorAll('[data-scope="tree-view"][data-part="item"], [data-scope="tree-view"][data-part="branch"]')].find(p=>p.getAttribute("data-value")===a),l=(o==null?void 0:o.getAttribute("data-part"))==="item",c=o==null?void 0:o.getAttribute("data-redirect"),u=o==null?void 0:o.hasAttribute("data-new-tab");s&&a&&l&&this.liveSocket.main.isDead&&c!=="false"&&(u?window.open(a,"_blank","noopener,noreferrer"):window.location.href=a);let m=O(e,"onSelectionChange");m&&this.liveSocket.main.isConnected()&&t(m,{id:e.id,value:y(g({},r),{isItem:l!=null?l:!1})})},onExpandedChange:r=>{let s=O(e,"onExpandedChange");s&&this.liveSocket.main.isConnected()&&t(s,{id:e.id,value:r})}}));n.init(),this.treeView=n,this.onSetExpandedValue=r=>{let{value:s}=r.detail;n.api.setExpandedValue(s)},e.addEventListener("phx:tree-view:set-expanded-value",this.onSetExpandedValue),this.onSetSelectedValue=r=>{let{value:s}=r.detail;n.api.setSelectedValue(s)},e.addEventListener("phx:tree-view:set-selected-value",this.onSetSelectedValue),this.handlers=[],this.handlers.push(this.handleEvent("tree_view_set_expanded_value",r=>{let s=r.tree_view_id;s&&e.id!==s&&e.id!==`tree-view:${s}`||n.api.setExpandedValue(r.value)})),this.handlers.push(this.handleEvent("tree_view_set_selected_value",r=>{let s=r.tree_view_id;s&&e.id!==s&&e.id!==`tree-view:${s}`||n.api.setSelectedValue(r.value)})),this.handlers.push(this.handleEvent("tree_view_expanded_value",()=>{t("tree_view_expanded_value_response",{value:n.api.expandedValue})})),this.handlers.push(this.handleEvent("tree_view_selected_value",()=>{t("tree_view_selected_value_response",{value:n.api.selectedValue})}))},updated(){var e;C(this.el,"controlled")&&((e=this.treeView)==null||e.updateProps({expandedValue:Z(this.el,"expandedValue"),selectedValue:Z(this.el,"selectedValue")}))},destroyed(){var e;if(this.onSetExpandedValue&&this.el.removeEventListener("phx:tree-view:set-expanded-value",this.onSetExpandedValue),this.onSetSelectedValue&&this.el.removeEventListener("phx:tree-view:set-selected-value",this.onSetSelectedValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.treeView)==null||e.destroy()}}});var e0={};he(e0,{Hooks:()=>Da,default:()=>QV,hooks:()=>JV});function me(e,t){return{mounted(){return Ve(this,null,function*(){let r=(yield e())[t];if(this._realHook=r,r!=null&&r.mounted)return r.mounted.call(this)})},updated(){var i,r;(r=(i=this._realHook)==null?void 0:i.updated)==null||r.call(this)},destroyed(){var i,r;(r=(i=this._realHook)==null?void 0:i.destroyed)==null||r.call(this)},disconnected(){var i,r;(r=(i=this._realHook)==null?void 0:i.disconnected)==null||r.call(this)},reconnected(){var i,r;(r=(i=this._realHook)==null?void 0:i.reconnected)==null||r.call(this)},beforeUpdate(){var i,r;(r=(i=this._realHook)==null?void 0:i.beforeUpdate)==null||r.call(this)}}}var Da={Accordion:me(()=>Promise.resolve().then(()=>(uu(),cu)),"Accordion"),AngleSlider:me(()=>Promise.resolve().then(()=>(Ru(),Nu)),"AngleSlider"),Avatar:me(()=>Promise.resolve().then(()=>(Fu(),Mu)),"Avatar"),Carousel:me(()=>Promise.resolve().then(()=>(Wu(),qu)),"Carousel"),Checkbox:me(()=>Promise.resolve().then(()=>(ed(),Qu)),"Checkbox"),Clipboard:me(()=>Promise.resolve().then(()=>(nd(),td)),"Clipboard"),Collapsible:me(()=>Promise.resolve().then(()=>(rd(),id)),"Collapsible"),Combobox:me(()=>Promise.resolve().then(()=>(ih(),nh)),"Combobox"),DatePicker:me(()=>Promise.resolve().then(()=>(tg(),eg)),"DatePicker"),Dialog:me(()=>Promise.resolve().then(()=>(dg(),ug)),"Dialog"),Editable:me(()=>Promise.resolve().then(()=>(vg(),mg)),"Editable"),FloatingPanel:me(()=>Promise.resolve().then(()=>(xg(),Vg)),"FloatingPanel"),Listbox:me(()=>Promise.resolve().then(()=>(Lg(),Dg)),"Listbox"),Menu:me(()=>Promise.resolve().then(()=>(qg(),Ug)),"Menu"),NumberInput:me(()=>Promise.resolve().then(()=>(sp(),rp)),"NumberInput"),PasswordInput:me(()=>Promise.resolve().then(()=>(op(),ap)),"PasswordInput"),PinInput:me(()=>Promise.resolve().then(()=>(hp(),dp)),"PinInput"),RadioGroup:me(()=>Promise.resolve().then(()=>(yp(),vp)),"RadioGroup"),Select:me(()=>Promise.resolve().then(()=>(Op(),Tp)),"Select"),SignaturePad:me(()=>Promise.resolve().then(()=>(zp(),Kp)),"SignaturePad"),Switch:me(()=>Promise.resolve().then(()=>(Jp(),Zp)),"Switch"),Tabs:me(()=>Promise.resolve().then(()=>(rf(),nf)),"Tabs"),Timer:me(()=>Promise.resolve().then(()=>(lf(),of)),"Timer"),Toast:me(()=>Promise.resolve().then(()=>(yf(),vf)),"Toast"),ToggleGroup:me(()=>Promise.resolve().then(()=>(Sf(),Cf)),"ToggleGroup"),TreeView:me(()=>Promise.resolve().then(()=>(Af(),xf)),"TreeView")};function JV(e){return Object.fromEntries(e.filter(t=>t in Da).map(t=>[t,Da[t]]))}var QV=Da;return Uf(e0);})(); + `,this.parts={title:this.el.querySelector('[data-scope="toast"][data-part="title"]'),description:this.el.querySelector('[data-scope="toast"][data-part="description"]'),close:this.el.querySelector('[data-scope="toast"][data-part="close-trigger"]'),ghostBefore:this.el.querySelector('[data-scope="toast"][data-part="ghost-before"]'),ghostAfter:this.el.querySelector('[data-scope="toast"][data-part="ghost-after"]'),progressbar:this.el.querySelector('[data-scope="toast"][data-part="progressbar"]'),loadingSpinner:this.el.querySelector('[data-scope="toast"][data-part="loading-spinner"]')}}initMachine(t){return new W(EV,t)}initApi(){return yV(this.machine.service,q)}render(){var a,o;this.spreadProps(this.el,this.api.getRootProps()),this.spreadProps(this.parts.close,this.api.getCloseTriggerProps()),this.spreadProps(this.parts.ghostBefore,this.api.getGhostBeforeProps()),this.spreadProps(this.parts.ghostAfter,this.api.getGhostAfterProps()),this.parts.title.textContent!==this.api.title&&(this.parts.title.textContent=(a=this.api.title)!=null?a:""),this.parts.description.textContent!==this.api.description&&(this.parts.description.textContent=(o=this.api.description)!=null?o:""),this.spreadProps(this.parts.title,this.api.getTitleProps()),this.spreadProps(this.parts.description,this.api.getDescriptionProps());let t=this.duration,n=t==="Infinity"||t===1/0||t===Number.POSITIVE_INFINITY,i=this.el.closest('[phx-hook="Toast"]'),r=i==null?void 0:i.querySelector("[data-loading-icon-template]"),s=r==null?void 0:r.innerHTML;n?(this.parts.progressbar.style.display="none",this.parts.loadingSpinner.style.display="flex",this.el.setAttribute("data-duration-infinity","true"),s&&this.parts.loadingSpinner.innerHTML!==s&&(this.parts.loadingSpinner.innerHTML=s)):(this.parts.progressbar.style.display="block",this.parts.loadingSpinner.style.display="none",this.el.removeAttribute("data-duration-infinity"))}},OV=class extends K{constructor(t,n){var i;super(t,n);z(this,"toastComponents",new Map);z(this,"groupEl");z(this,"store");z(this,"destroy",()=>{for(let t of this.toastComponents.values())t.destroy();this.toastComponents.clear(),this.machine.stop()});this.store=n.store,this.groupEl=(i=t.querySelector('[data-part="group"]'))!=null?i:(()=>{let r=document.createElement("div");return r.setAttribute("data-scope","toast"),r.setAttribute("data-part","group"),t.appendChild(r),r})()}initMachine(t){return new W(ff.machine,t)}initApi(){return ff.connect(this.machine.service,q)}render(){this.spreadProps(this.groupEl,this.api.getGroupProps());let t=this.api.getToasts().filter(i=>typeof i.id=="string"),n=new Set(t.map(i=>i.id));t.forEach((i,r)=>{let s=this.toastComponents.get(i.id);if(s)s.duration=i.duration,s.updateProps(y(g({},i),{parent:this.machine.service,index:r}));else{let a=document.createElement("div");a.setAttribute("data-scope","toast"),a.setAttribute("data-part","root"),this.groupEl.appendChild(a),s=new TV(a,y(g({},i),{parent:this.machine.service,index:r})),s.init(),this.toastComponents.set(i.id,s)}});for(let[i,r]of this.toastComponents)n.has(i)||(r.destroy(),this.toastComponents.delete(i))}};VV={mounted(){var h;let e=this.el;e.id||(e.id=Mn(e,"toast")),this.groupId=e.id;let t=m=>{if(m)try{return m.includes("{")?JSON.parse(m):m}catch(d){return m}},n=m=>m==="Infinity"||m===1/0?1/0:typeof m=="string"?parseInt(m,10)||void 0:m,i=(h=w(e,"placement",["top-start","top","top-end","bottom-start","bottom","bottom-end"]))!=null?h:"bottom-end";wV(e,{id:this.groupId,placement:i,overlap:C(e,"overlap"),max:Y(e,"max"),gap:Y(e,"gap"),offsets:t(w(e,"offset")),pauseOnPageIdle:C(e,"pauseOnPageIdle")});let r=qr(this.groupId),s=e.getAttribute("data-flash-info"),a=e.getAttribute("data-flash-info-title"),o=e.getAttribute("data-flash-error"),l=e.getAttribute("data-flash-error-title"),c=e.getAttribute("data-flash-info-duration"),u=e.getAttribute("data-flash-error-duration");if(r&&s)try{r.create({title:a||"Success",description:s,type:"info",id:Mn(void 0,"toast"),duration:n(c!=null?c:void 0)})}catch(m){console.error("Failed to create flash info toast:",m)}if(r&&o)try{r.create({title:l||"Error",description:o,type:"error",id:Mn(void 0,"toast"),duration:n(u!=null?u:void 0)})}catch(m){console.error("Failed to create flash error toast:",m)}this.handlers=[],this.handlers.push(this.handleEvent("toast-create",m=>{let d=qr(m.groupId||this.groupId);if(d)try{d.create({title:m.title,description:m.description,type:m.type||"info",id:m.id||Mn(void 0,"toast"),duration:n(m.duration)})}catch(p){console.error("Failed to create toast:",p)}})),this.handlers.push(this.handleEvent("toast-update",m=>{let d=qr(m.groupId||this.groupId);if(d)try{d.update(m.id,{title:m.title,description:m.description,type:m.type})}catch(p){console.error("Failed to update toast:",p)}})),this.handlers.push(this.handleEvent("toast-dismiss",m=>{let d=qr(m.groupId||this.groupId);if(d)try{d.dismiss(m.id)}catch(p){console.error("Failed to dismiss toast:",p)}})),e.addEventListener("toast:create",m=>{let{detail:d}=m,p=qr(d.groupId||this.groupId);if(p)try{p.create({title:d.title,description:d.description,type:d.type||"info",id:d.id||Mn(void 0,"toast"),duration:n(d.duration)})}catch(v){console.error("Failed to create toast:",v)}})},destroyed(){if(this.handlers)for(let e of this.handlers)this.removeHandleEvent(e)}}});var Cf={};he(Cf,{ToggleGroup:()=>BV});function DV(e,t){let{context:n,send:i,prop:r,scope:s}=e,a=n.get("value"),o=r("disabled"),l=!r("multiple"),c=r("rovingFocus"),u=r("orientation")==="horizontal";function h(m){let d=AV(s,m.value);return{id:d,disabled:!!(m.disabled||o),pressed:!!a.includes(m.value),focused:n.get("focusedId")===d}}return{value:a,setValue(m){i({type:"VALUE.SET",value:m})},getRootProps(){return t.element(y(g({},bf.root.attrs),{id:ka(s),dir:r("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":E(o),"data-orientation":r("orientation"),"data-focus":E(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){o||i({type:"ROOT.MOUSE_DOWN"})},onFocus(m){o||m.currentTarget===j(m)&&(n.get("isClickFocus")||n.get("isTabbingBackward")||i({type:"ROOT.FOCUS"}))},onBlur(m){let d=m.relatedTarget;ce(m.currentTarget,d)||o||i({type:"ROOT.BLUR"})}}))},getItemState:h,getItemProps(m){let d=h(m),p=d.focused?0:-1;return t.button(y(g({},bf.item.attrs),{id:d.id,type:"button","data-ownedby":ka(s),"data-focus":E(d.focused),disabled:d.disabled,tabIndex:c?p:void 0,role:l?"radio":void 0,"aria-checked":l?d.pressed:void 0,"aria-pressed":l?void 0:d.pressed,"data-disabled":E(d.disabled),"data-orientation":r("orientation"),dir:r("dir"),"data-state":d.pressed?"on":"off",onFocus(){d.disabled||i({type:"TOGGLE.FOCUS",id:d.id})},onClick(v){d.disabled||(i({type:"TOGGLE.CLICK",id:d.id,value:m.value}),Xe()&&v.currentTarget.focus({preventScroll:!0}))},onKeyDown(v){if(v.defaultPrevented||!ce(v.currentTarget,j(v))||d.disabled)return;let T={Tab(O){let b=O.shiftKey;i({type:"TOGGLE.SHIFT_TAB",isShiftTab:b})},ArrowLeft(){!c||!u||i({type:"TOGGLE.FOCUS_PREV"})},ArrowRight(){!c||!u||i({type:"TOGGLE.FOCUS_NEXT"})},ArrowUp(){!c||u||i({type:"TOGGLE.FOCUS_PREV"})},ArrowDown(){!c||u||i({type:"TOGGLE.FOCUS_NEXT"})},Home(){c&&i({type:"TOGGLE.FOCUS_FIRST"})},End(){c&&i({type:"TOGGLE.FOCUS_LAST"})}}[ge(v)];T&&(T(v),v.key!=="Tab"&&v.preventDefault())}}))}}}var xV,bf,ka,AV,Pf,Na,Ef,kV,NV,RV,If,LV,MV,FV,Ek,$V,Ik,HV,BV,Sf=re(()=>{"use strict";se();xV=U("toggle-group").parts("root","item"),bf=xV.build(),ka=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`toggle-group:${e.id}`},AV=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.item)==null?void 0:i.call(n,t))!=null?r:`toggle-group:${e.id}:${t}`},Pf=e=>e.getById(ka(e)),Na=e=>{let n=`[data-ownedby='${CSS.escape(ka(e))}']:not([data-disabled])`;return Fe(Pf(e),n)},Ef=e=>lt(Na(e)),kV=e=>mt(Na(e)),NV=(e,t,n)=>yi(Na(e),t,n),RV=(e,t,n)=>bi(Na(e),t,n);({not:If,and:LV}=Ee()),MV={props({props:e}){return g({defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,deselectable:!0},e)},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(n){var i;(i=e("onValueChange"))==null||i({value:n})}})),focusedId:t(()=>({defaultValue:null})),isTabbingBackward:t(()=>({defaultValue:!1})),isClickFocus:t(()=>({defaultValue:!1})),isWithinToolbar:t(()=>({defaultValue:!1}))}},computed:{currentLoopFocus:({context:e,prop:t})=>t("loopFocus")&&!e.get("isWithinToolbar")},entry:["checkIfWithinToolbar"],on:{"VALUE.SET":{actions:["setValue"]},"TOGGLE.CLICK":{actions:["setValue"]},"ROOT.MOUSE_DOWN":{actions:["setClickFocus"]}},states:{idle:{on:{"ROOT.FOCUS":{target:"focused",guard:If(LV("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId","clearClickFocus"]},"TOGGLE.FOCUS":{actions:["setFocusedId"]},"TOGGLE.FOCUS_NEXT":{actions:["focusNextToggle"]},"TOGGLE.FOCUS_PREV":{actions:["focusPrevToggle"]},"TOGGLE.FOCUS_FIRST":{actions:["focusFirstToggle"]},"TOGGLE.FOCUS_LAST":{actions:["focusLastToggle"]},"TOGGLE.SHIFT_TAB":[{guard:If("isFirstToggleFocused"),target:"idle",actions:["setIsTabbingBackward"]},{actions:["setIsTabbingBackward"]}]}}},implementations:{guards:{isClickFocus:({context:e})=>e.get("isClickFocus"),isTabbingBackward:({context:e})=>e.get("isTabbingBackward"),isFirstToggleFocused:({context:e,scope:t})=>{var n;return e.get("focusedId")===((n=Ef(t))==null?void 0:n.id)}},actions:{setIsTabbingBackward({context:e}){e.set("isTabbingBackward",!0)},clearIsTabbingBackward({context:e}){e.set("isTabbingBackward",!1)},setClickFocus({context:e}){e.set("isClickFocus",!0)},clearClickFocus({context:e}){e.set("isClickFocus",!1)},checkIfWithinToolbar({context:e,scope:t}){var i;let n=(i=Pf(t))==null?void 0:i.closest("[role=toolbar]");e.set("isWithinToolbar",!!n)},setFocusedId({context:e,event:t}){e.set("focusedId",t.id)},clearFocusedId({context:e}){e.set("focusedId",null)},setValue({context:e,event:t,prop:n}){yn(t,["value"]);let i=e.get("value");pn(t.value)?i=t.value:n("multiple")?i=yt(i,t.value):i=fe(i,[t.value])&&n("deselectable")?[]:[t.value],e.set("value",i)},focusNextToggle({context:e,scope:t,prop:n}){H(()=>{var r;let i=e.get("focusedId");i&&((r=NV(t,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusPrevToggle({context:e,scope:t,prop:n}){H(()=>{var r;let i=e.get("focusedId");i&&((r=RV(t,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusFirstToggle({scope:e}){H(()=>{var t;(t=Ef(e))==null||t.focus({preventScroll:!0})})},focusLastToggle({scope:e}){H(()=>{var t;(t=kV(e))==null||t.focus({preventScroll:!0})})}}}},FV=_()(["dir","disabled","getRootNode","id","ids","loopFocus","multiple","onValueChange","orientation","rovingFocus","value","defaultValue","deselectable"]),Ek=B(FV),$V=_()(["value","disabled"]),Ik=B($V),HV=class extends K{initMachine(e){return new W(MV,e)}initApi(){return DV(this.machine.service,q)}render(){let e=this.el.querySelector('[data-scope="toggle-group"][data-part="root"]');if(!e)return;this.spreadProps(e,this.api.getRootProps());let t=this.el.querySelectorAll('[data-scope="toggle-group"][data-part="item"]');for(let n=0;n{let s=w(e,"onValueChange");s&&!this.liveSocket.main.isDead&&this.liveSocket.main.isConnected()&&t(s,{value:r.value,id:e.id});let a=w(e,"onValueChangeClient");a&&e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:{value:r.value,id:e.id}}))}}),i=new HV(e,n);i.init(),this.toggleGroup=i,this.onSetValue=r=>{let{value:s}=r.detail;i.api.setValue(s)},e.addEventListener("phx:toggle-group:set-value",this.onSetValue),this.handlers=[],this.handlers.push(this.handleEvent("toggle-group_set_value",r=>{let s=r.id;s&&s!==e.id||i.api.setValue(r.value)})),this.handlers.push(this.handleEvent("toggle-group:value",()=>{this.pushEvent("toggle-group:value_response",{value:i.api.value})}))},updated(){var e;(e=this.toggleGroup)==null||e.updateProps(y(g({},C(this.el,"controlled")?{value:Q(this.el,"value")}:{defaultValue:Q(this.el,"defaultValue")}),{deselectable:C(this.el,"deselectable"),loopFocus:C(this.el,"loopFocus"),rovingFocus:C(this.el,"rovingFocus"),disabled:C(this.el,"disabled"),multiple:C(this.el,"multiple"),orientation:w(this.el,"orientation",["horizontal","vertical"]),dir:w(this.el,"dir",["ltr","rtl"])}))},destroyed(){var e;if(this.onSetValue&&this.el.removeEventListener("phx:toggle-group:set-value",this.onSetValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.toggleGroup)==null||e.destroy()}}});var xf={};he(xf,{TreeView:()=>ZV});function Vf(e,t,n){let i=e.getNodeValue(t);if(!e.isBranchNode(t))return n.includes(i);let r=e.getDescendantValues(i),s=r.every(o=>n.includes(o)),a=r.some(o=>n.includes(o));return s?!0:a?"indeterminate":!1}function UV(e,t,n){let i=e.getDescendantValues(t),r=i.every(s=>n.includes(s));return vt(r?ct(n,...i):Ze(n,...i))}function qV(e,t){let n=new Map;return e.visit({onEnter:i=>{let r=e.getNodeValue(i),s=e.isBranchNode(i),a=Vf(e,i,t);n.set(r,{type:s?"branch":"leaf",checked:a})}}),n}function WV(e,t){let{context:n,scope:i,computed:r,prop:s,send:a}=e,o=s("collection"),l=Array.from(n.get("expandedValue")),c=Array.from(n.get("selectedValue")),u=Array.from(n.get("checkedValue")),h=r("isTypingAhead"),m=n.get("focusedValue"),d=n.get("loadingStatus"),p=n.get("renamingValue"),v=({indexPath:b})=>o.getValuePath(b).slice(0,-1).some(S=>!l.includes(S)),I=o.getFirstNode(void 0,{skip:v}),T=I?o.getNodeValue(I):null;function O(b){let{node:f,indexPath:S}=b,P=o.getNodeValue(f);return{id:nc(i,P),value:P,indexPath:S,valuePath:o.getValuePath(S),disabled:!!f.disabled,focused:m==null?T===P:m===P,selected:c.includes(P),expanded:l.includes(P),loading:d[P]==="loading",depth:S.length,isBranch:o.isBranchNode(f),renaming:p===P,get checked(){return Vf(o,f,u)}}}return{collection:o,expandedValue:l,selectedValue:c,checkedValue:u,toggleChecked(b,f){a({type:"CHECKED.TOGGLE",value:b,isBranch:f})},setChecked(b){a({type:"CHECKED.SET",value:b})},clearChecked(){a({type:"CHECKED.CLEAR"})},getCheckedMap(){return qV(o,u)},expand(b){a({type:b?"BRANCH.EXPAND":"EXPANDED.ALL",value:b})},collapse(b){a({type:b?"BRANCH.COLLAPSE":"EXPANDED.CLEAR",value:b})},deselect(b){a({type:b?"NODE.DESELECT":"SELECTED.CLEAR",value:b})},select(b){a({type:b?"NODE.SELECT":"SELECTED.ALL",value:b,isTrusted:!1})},getVisibleNodes(){return r("visibleNodes")},focus(b){ke(i,b)},selectParent(b){let f=o.getParentNode(b);if(!f)return;let S=Ze(c,o.getNodeValue(f));a({type:"SELECTED.SET",value:S,src:"select.parent"})},expandParent(b){let f=o.getParentNode(b);if(!f)return;let S=Ze(l,o.getNodeValue(f));a({type:"EXPANDED.SET",value:S,src:"expand.parent"})},setExpandedValue(b){let f=vt(b);a({type:"EXPANDED.SET",value:f})},setSelectedValue(b){let f=vt(b);a({type:"SELECTED.SET",value:f})},startRenaming(b){a({type:"NODE.RENAME",value:b})},submitRenaming(b,f){a({type:"RENAME.SUBMIT",value:b,label:f})},cancelRenaming(){a({type:"RENAME.CANCEL"})},getRootProps(){return t.element(y(g({},Ge.root.attrs),{id:GV(i),dir:s("dir")}))},getLabelProps(){return t.element(y(g({},Ge.label.attrs),{id:Tf(i),dir:s("dir")}))},getTreeProps(){return t.element(y(g({},Ge.tree.attrs),{id:ec(i),dir:s("dir"),role:"tree","aria-label":"Tree View","aria-labelledby":Tf(i),"aria-multiselectable":s("selectionMode")==="multiple"||void 0,tabIndex:-1,onKeyDown(b){if(b.defaultPrevented||Re(b))return;let f=j(b);if(Ot(f))return;let S=f==null?void 0:f.closest("[data-part=branch-control], [data-part=item]");if(!S)return;let P=S.dataset.value;if(P==null){console.warn("[zag-js/tree-view] Node id not found for node",S);return}let V=S.matches("[data-part=branch-control]"),A={ArrowDown(N){xe(N)||(N.preventDefault(),a({type:"NODE.ARROW_DOWN",id:P,shiftKey:N.shiftKey}))},ArrowUp(N){xe(N)||(N.preventDefault(),a({type:"NODE.ARROW_UP",id:P,shiftKey:N.shiftKey}))},ArrowLeft(N){xe(N)||S.dataset.disabled||(N.preventDefault(),a({type:V?"BRANCH_NODE.ARROW_LEFT":"NODE.ARROW_LEFT",id:P}))},ArrowRight(N){!V||S.dataset.disabled||(N.preventDefault(),a({type:"BRANCH_NODE.ARROW_RIGHT",id:P}))},Home(N){xe(N)||(N.preventDefault(),a({type:"NODE.HOME",id:P,shiftKey:N.shiftKey}))},End(N){xe(N)||(N.preventDefault(),a({type:"NODE.END",id:P,shiftKey:N.shiftKey}))},Space(N){var D;S.dataset.disabled||(h?a({type:"TREE.TYPEAHEAD",key:N.key}):(D=A.Enter)==null||D.call(A,N))},Enter(N){S.dataset.disabled||st(f)&&xe(N)||(a({type:V?"BRANCH_NODE.CLICK":"NODE.CLICK",id:P,src:"keyboard"}),st(f)||N.preventDefault())},"*"(N){S.dataset.disabled||(N.preventDefault(),a({type:"SIBLINGS.EXPAND",id:P}))},a(N){!N.metaKey||S.dataset.disabled||(N.preventDefault(),a({type:"SELECTED.ALL",moveFocus:!0}))},F2(N){if(S.dataset.disabled)return;let D=s("canRename");if(!D)return;let $=o.getIndexPath(P);if($){let te=o.at($);if(te&&!D(te,$))return}N.preventDefault(),a({type:"NODE.RENAME",value:P})}},x=ge(b,{dir:s("dir")}),k=A[x];if(k){k(b);return}Ue.isValidEvent(b)&&(a({type:"TREE.TYPEAHEAD",key:b.key,id:P}),b.preventDefault())}}))},getNodeState:O,getItemProps(b){let f=O(b);return t.element(y(g({},Ge.item.attrs),{id:f.id,dir:s("dir"),"data-ownedby":ec(i),"data-path":b.indexPath.join("/"),"data-value":f.value,tabIndex:f.focused?0:-1,"data-focus":E(f.focused),role:"treeitem","aria-current":f.selected?"true":void 0,"aria-selected":f.disabled?void 0:f.selected,"data-selected":E(f.selected),"aria-disabled":X(f.disabled),"data-disabled":E(f.disabled),"data-renaming":E(f.renaming),"aria-level":f.depth,"data-depth":f.depth,style:{"--depth":f.depth},onFocus(S){S.stopPropagation(),a({type:"NODE.FOCUS",id:f.value})},onClick(S){if(f.disabled||!pe(S)||st(S.currentTarget)&&xe(S))return;let P=S.metaKey||S.ctrlKey;a({type:"NODE.CLICK",id:f.value,shiftKey:S.shiftKey,ctrlKey:P}),S.stopPropagation(),st(S.currentTarget)||S.preventDefault()}}))},getItemTextProps(b){let f=O(b);return t.element(y(g({},Ge.itemText.attrs),{"data-disabled":E(f.disabled),"data-selected":E(f.selected),"data-focus":E(f.focused)}))},getItemIndicatorProps(b){let f=O(b);return t.element(y(g({},Ge.itemIndicator.attrs),{"aria-hidden":!0,"data-disabled":E(f.disabled),"data-selected":E(f.selected),"data-focus":E(f.focused),hidden:!f.selected}))},getBranchProps(b){let f=O(b);return t.element(y(g({},Ge.branch.attrs),{"data-depth":f.depth,dir:s("dir"),"data-branch":f.value,role:"treeitem","data-ownedby":ec(i),"data-value":f.value,"aria-level":f.depth,"aria-selected":f.disabled?void 0:f.selected,"data-path":b.indexPath.join("/"),"data-selected":E(f.selected),"aria-expanded":f.expanded,"data-state":f.expanded?"open":"closed","aria-disabled":X(f.disabled),"data-disabled":E(f.disabled),"data-loading":E(f.loading),"aria-busy":X(f.loading),style:{"--depth":f.depth}}))},getBranchIndicatorProps(b){let f=O(b);return t.element(y(g({},Ge.branchIndicator.attrs),{"aria-hidden":!0,"data-state":f.expanded?"open":"closed","data-disabled":E(f.disabled),"data-selected":E(f.selected),"data-focus":E(f.focused),"data-loading":E(f.loading)}))},getBranchTriggerProps(b){let f=O(b);return t.element(y(g({},Ge.branchTrigger.attrs),{role:"button",dir:s("dir"),"data-disabled":E(f.disabled),"data-state":f.expanded?"open":"closed","data-value":f.value,"data-loading":E(f.loading),disabled:f.loading,onClick(S){f.disabled||f.loading||(a({type:"BRANCH_TOGGLE.CLICK",id:f.value}),S.stopPropagation())}}))},getBranchControlProps(b){let f=O(b);return t.element(y(g({},Ge.branchControl.attrs),{role:"button",id:f.id,dir:s("dir"),tabIndex:f.focused?0:-1,"data-path":b.indexPath.join("/"),"data-state":f.expanded?"open":"closed","data-disabled":E(f.disabled),"data-selected":E(f.selected),"data-focus":E(f.focused),"data-renaming":E(f.renaming),"data-value":f.value,"data-depth":f.depth,"data-loading":E(f.loading),"aria-busy":X(f.loading),onFocus(S){a({type:"NODE.FOCUS",id:f.value}),S.stopPropagation()},onClick(S){if(f.disabled||f.loading||!pe(S)||st(S.currentTarget)&&xe(S))return;let P=S.metaKey||S.ctrlKey;a({type:"BRANCH_NODE.CLICK",id:f.value,shiftKey:S.shiftKey,ctrlKey:P}),S.stopPropagation()}}))},getBranchTextProps(b){let f=O(b);return t.element(y(g({},Ge.branchText.attrs),{dir:s("dir"),"data-disabled":E(f.disabled),"data-state":f.expanded?"open":"closed","data-loading":E(f.loading)}))},getBranchContentProps(b){let f=O(b);return t.element(y(g({},Ge.branchContent.attrs),{role:"group",dir:s("dir"),"data-state":f.expanded?"open":"closed","data-depth":f.depth,"data-path":b.indexPath.join("/"),"data-value":f.value,hidden:!f.expanded}))},getBranchIndentGuideProps(b){let f=O(b);return t.element(y(g({},Ge.branchIndentGuide.attrs),{"data-depth":f.depth}))},getNodeCheckboxProps(b){let f=O(b),S=f.checked;return t.element(y(g({},Ge.nodeCheckbox.attrs),{tabIndex:-1,role:"checkbox","data-state":S===!0?"checked":S===!1?"unchecked":"indeterminate","aria-checked":S===!0?"true":S===!1?"false":"mixed","data-disabled":E(f.disabled),onClick(P){if(P.defaultPrevented||f.disabled||!pe(P))return;a({type:"CHECKED.TOGGLE",value:f.value,isBranch:f.isBranch}),P.stopPropagation();let V=P.currentTarget.closest("[role=treeitem]");V==null||V.focus({preventScroll:!0})}}))},getNodeRenameInputProps(b){let f=O(b);return t.input(y(g({},Ge.nodeRenameInput.attrs),{id:wf(i,f.value),type:"text","aria-label":"Rename tree item",hidden:!f.renaming,onKeyDown(S){Re(S)||(S.key==="Escape"&&(a({type:"RENAME.CANCEL"}),S.preventDefault()),S.key==="Enter"&&(a({type:"RENAME.SUBMIT",label:S.currentTarget.value}),S.preventDefault()),S.stopPropagation())},onBlur(S){a({type:"RENAME.SUBMIT",label:S.currentTarget.value})}}))}}}function Ra(e,t){let{context:n,prop:i,refs:r}=e;if(!i("loadChildren")){n.set("expandedValue",v=>vt(Ze(v,...t)));return}let s=n.get("loadingStatus"),[a,o]=oo(t,v=>s[v]==="loaded");if(a.length>0&&n.set("expandedValue",v=>vt(Ze(v,...a))),o.length===0)return;let l=i("collection"),[c,u]=oo(o,v=>{let I=l.findNode(v);return l.getNodeChildren(I).length>0});if(c.length>0&&n.set("expandedValue",v=>vt(Ze(v,...c))),u.length===0)return;n.set("loadingStatus",v=>g(g({},v),u.reduce((I,T)=>y(g({},I),{[T]:"loading"}),{})));let h=u.map(v=>{let I=l.getIndexPath(v),T=l.getValuePath(I),O=l.findNode(v);return{id:v,indexPath:I,valuePath:T,node:O}}),m=r.get("pendingAborts"),d=i("loadChildren");vn(d,()=>"[zag-js/tree-view] `loadChildren` is required for async expansion");let p=h.map(({id:v,indexPath:I,valuePath:T,node:O})=>{let b=m.get(v);b&&(b.abort(),m.delete(v));let f=new AbortController;return m.set(v,f),d({valuePath:T,indexPath:I,node:O,signal:f.signal})});Promise.allSettled(p).then(v=>{var f,S;let I=[],T=[],O=n.get("loadingStatus"),b=i("collection");v.forEach((P,V)=>{let{id:A,indexPath:x,node:k,valuePath:N}=h[V];P.status==="fulfilled"?(O[A]="loaded",I.push(A),b=b.replace(x,y(g({},k),{children:P.value}))):(m.delete(A),Reflect.deleteProperty(O,A),T.push({node:k,error:P.reason,indexPath:x,valuePath:N}))}),n.set("loadingStatus",O),I.length&&(n.set("expandedValue",P=>vt(Ze(P,...I))),(f=i("onLoadChildrenComplete"))==null||f({collection:b})),T.length&&((S=i("onLoadChildrenError"))==null||S({nodes:T}))})}function _t(e){let{prop:t,context:n}=e;return function({indexPath:r}){return t("collection").getValuePath(r).slice(0,-1).some(a=>!n.get("expandedValue").includes(a))}}function oi(e,t){let{prop:n,scope:i,computed:r}=e,s=n("scrollToIndexFn");if(!s)return!1;let a=n("collection"),o=r("visibleNodes");for(let l=0;li.getById(nc(i,t))}),!0}return!1}function jV(e){var s;let n=e.querySelectorAll('[data-scope="tree-view"][data-part="branch"], [data-scope="tree-view"][data-part="item"]'),i=[];for(let a of n){let o=a.getAttribute("data-path"),l=a.getAttribute("data-value");if(o==null||l==null)continue;let c=o.split("/").map(m=>parseInt(m,10));if(c.some(Number.isNaN))continue;let u=(s=a.getAttribute("data-name"))!=null?s:l,h=a.getAttribute("data-part")==="branch";i.push({pathArr:c,id:l,name:u,isBranch:h})}i.sort((a,o)=>{let l=Math.min(a.pathArr.length,o.pathArr.length);for(let c=0;c{"use strict";yr();se();_V=U("tree-view").parts("branch","branchContent","branchControl","branchIndentGuide","branchIndicator","branchText","branchTrigger","item","itemIndicator","itemText","label","nodeCheckbox","nodeRenameInput","root","tree"),Ge=_V.build(),tc=e=>new Ao(e);tc.empty=()=>new Ao({rootNode:{children:[]}});GV=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.root)!=null?n:`tree:${e.id}:root`},Tf=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.label)!=null?n:`tree:${e.id}:label`},nc=(e,t)=>{var n,i,r;return(r=(i=(n=e.ids)==null?void 0:n.node)==null?void 0:i.call(n,t))!=null?r:`tree:${e.id}:node:${t}`},ec=e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.tree)!=null?n:`tree:${e.id}:tree`},ke=(e,t)=>{var n;t!=null&&((n=e.getById(nc(e,t)))==null||n.focus())},wf=(e,t)=>`tree:${e.id}:rename-input:${t}`,Of=(e,t)=>e.getById(wf(e,t));({and:Gt}=Ee()),KV={props({props:e}){return g({selectionMode:"single",collection:tc.empty(),typeahead:!0,expandOnClick:!0,defaultExpandedValue:[],defaultSelectedValue:[]},e)},initialState(){return"idle"},context({prop:e,bindable:t,getContext:n}){return{expandedValue:t(()=>({defaultValue:e("defaultExpandedValue"),value:e("expandedValue"),isEqual:fe,onChange(i){var a;let s=n().get("focusedValue");(a=e("onExpandedChange"))==null||a({expandedValue:i,focusedValue:s,get expandedNodes(){return e("collection").findNodes(i)}})}})),selectedValue:t(()=>({defaultValue:e("defaultSelectedValue"),value:e("selectedValue"),isEqual:fe,onChange(i){var a;let s=n().get("focusedValue");(a=e("onSelectionChange"))==null||a({selectedValue:i,focusedValue:s,get selectedNodes(){return e("collection").findNodes(i)}})}})),focusedValue:t(()=>({defaultValue:e("defaultFocusedValue")||null,value:e("focusedValue"),onChange(i){var r;(r=e("onFocusChange"))==null||r({focusedValue:i,get focusedNode(){return i?e("collection").findNode(i):null}})}})),loadingStatus:t(()=>({defaultValue:{}})),checkedValue:t(()=>({defaultValue:e("defaultCheckedValue")||[],value:e("checkedValue"),isEqual:fe,onChange(i){var r;(r=e("onCheckedChange"))==null||r({checkedValue:i})}})),renamingValue:t(()=>({sync:!0,defaultValue:null}))}},refs(){return{typeaheadState:g({},Ue.defaultOptions),pendingAborts:new Map}},computed:{isMultipleSelection:({prop:e})=>e("selectionMode")==="multiple",isTypingAhead:({refs:e})=>e.get("typeaheadState").keysSoFar.length>0,visibleNodes:({prop:e,context:t})=>{let n=[];return e("collection").visit({skip:_t({prop:e,context:t}),onEnter:(i,r)=>{n.push({node:i,indexPath:r})}}),n}},on:{"EXPANDED.SET":{actions:["setExpanded"]},"EXPANDED.CLEAR":{actions:["clearExpanded"]},"EXPANDED.ALL":{actions:["expandAllBranches"]},"BRANCH.EXPAND":{actions:["expandBranches"]},"BRANCH.COLLAPSE":{actions:["collapseBranches"]},"SELECTED.SET":{actions:["setSelected"]},"SELECTED.ALL":[{guard:Gt("isMultipleSelection","moveFocus"),actions:["selectAllNodes","focusTreeLastNode"]},{guard:"isMultipleSelection",actions:["selectAllNodes"]}],"SELECTED.CLEAR":{actions:["clearSelected"]},"NODE.SELECT":{actions:["selectNode"]},"NODE.DESELECT":{actions:["deselectNode"]},"CHECKED.TOGGLE":{actions:["toggleChecked"]},"CHECKED.SET":{actions:["setChecked"]},"CHECKED.CLEAR":{actions:["clearChecked"]},"NODE.FOCUS":{actions:["setFocusedNode"]},"NODE.ARROW_DOWN":[{guard:Gt("isShiftKey","isMultipleSelection"),actions:["focusTreeNextNode","extendSelectionToNextNode"]},{actions:["focusTreeNextNode"]}],"NODE.ARROW_UP":[{guard:Gt("isShiftKey","isMultipleSelection"),actions:["focusTreePrevNode","extendSelectionToPrevNode"]},{actions:["focusTreePrevNode"]}],"NODE.ARROW_LEFT":{actions:["focusBranchNode"]},"BRANCH_NODE.ARROW_LEFT":[{guard:"isBranchExpanded",actions:["collapseBranch"]},{actions:["focusBranchNode"]}],"BRANCH_NODE.ARROW_RIGHT":[{guard:Gt("isBranchFocused","isBranchExpanded"),actions:["focusBranchFirstNode"]},{actions:["expandBranch"]}],"SIBLINGS.EXPAND":{actions:["expandSiblingBranches"]},"NODE.HOME":[{guard:Gt("isShiftKey","isMultipleSelection"),actions:["extendSelectionToFirstNode","focusTreeFirstNode"]},{actions:["focusTreeFirstNode"]}],"NODE.END":[{guard:Gt("isShiftKey","isMultipleSelection"),actions:["extendSelectionToLastNode","focusTreeLastNode"]},{actions:["focusTreeLastNode"]}],"NODE.CLICK":[{guard:Gt("isCtrlKey","isMultipleSelection"),actions:["toggleNodeSelection"]},{guard:Gt("isShiftKey","isMultipleSelection"),actions:["extendSelectionToNode"]},{actions:["selectNode"]}],"BRANCH_NODE.CLICK":[{guard:Gt("isCtrlKey","isMultipleSelection"),actions:["toggleNodeSelection"]},{guard:Gt("isShiftKey","isMultipleSelection"),actions:["extendSelectionToNode"]},{guard:"expandOnClick",actions:["selectNode","toggleBranchNode"]},{actions:["selectNode"]}],"BRANCH_TOGGLE.CLICK":{actions:["toggleBranchNode"]},"TREE.TYPEAHEAD":{actions:["focusMatchedNode"]}},exit:["clearPendingAborts"],states:{idle:{on:{"NODE.RENAME":{target:"renaming",actions:["setRenamingValue"]}}},renaming:{entry:["syncRenameInput","focusRenameInput"],on:{"RENAME.SUBMIT":{guard:"isRenameLabelValid",target:"idle",actions:["submitRenaming"]},"RENAME.CANCEL":{target:"idle",actions:["cancelRenaming"]}}}},implementations:{guards:{isBranchFocused:({context:e,event:t})=>e.get("focusedValue")===t.id,isBranchExpanded:({context:e,event:t})=>e.get("expandedValue").includes(t.id),isShiftKey:({event:e})=>e.shiftKey,isCtrlKey:({event:e})=>e.ctrlKey,hasSelectedItems:({context:e})=>e.get("selectedValue").length>0,isMultipleSelection:({prop:e})=>e("selectionMode")==="multiple",moveFocus:({event:e})=>!!e.moveFocus,expandOnClick:({prop:e})=>!!e("expandOnClick"),isRenameLabelValid:({event:e})=>e.label.trim()!==""},actions:{selectNode({context:e,event:t}){let n=t.id||t.value;e.set("selectedValue",i=>n==null?i:!t.isTrusted&&pn(n)?i.concat(...n):[pn(n)?mt(n):n].filter(Boolean))},deselectNode({context:e,event:t}){let n=or(t.id||t.value);e.set("selectedValue",i=>ct(i,...n))},setFocusedNode({context:e,event:t}){e.set("focusedValue",t.id)},clearFocusedNode({context:e}){e.set("focusedValue",null)},clearSelectedItem({context:e}){e.set("selectedValue",[])},toggleBranchNode({context:e,event:t,action:n}){let i=e.get("expandedValue").includes(t.id);n(i?["collapseBranch"]:["expandBranch"])},expandBranch(e){let{event:t}=e;Ra(e,[t.id])},expandBranches(e){let{context:t,event:n}=e,i=or(n.value);Ra(e,fs(i,t.get("expandedValue")))},collapseBranch({context:e,event:t}){e.set("expandedValue",n=>ct(n,t.id))},collapseBranches(e){let{context:t,event:n}=e,i=or(n.value);t.set("expandedValue",r=>ct(r,...i))},setExpanded({context:e,event:t}){pn(t.value)&&e.set("expandedValue",t.value)},clearExpanded({context:e}){e.set("expandedValue",[])},setSelected({context:e,event:t}){pn(t.value)&&e.set("selectedValue",t.value)},clearSelected({context:e}){e.set("selectedValue",[])},focusTreeFirstNode(e){let{prop:t,scope:n}=e,i=t("collection"),r=i.getFirstNode(void 0,{skip:_t(e)});if(!r)return;let s=i.getNodeValue(r);oi(e,s)?H(()=>ke(n,s)):ke(n,s)},focusTreeLastNode(e){let{prop:t,scope:n}=e,i=t("collection"),r=i.getLastNode(void 0,{skip:_t(e)}),s=i.getNodeValue(r);oi(e,s)?H(()=>ke(n,s)):ke(n,s)},focusBranchFirstNode(e){let{event:t,prop:n,scope:i}=e,r=n("collection"),s=r.findNode(t.id),a=r.getFirstNode(s,{skip:_t(e)});if(!a)return;let o=r.getNodeValue(a);oi(e,o)?H(()=>ke(i,o)):ke(i,o)},focusTreeNextNode(e){let{event:t,prop:n,scope:i}=e,r=n("collection"),s=r.getNextNode(t.id,{skip:_t(e)});if(!s)return;let a=r.getNodeValue(s);oi(e,a)?H(()=>ke(i,a)):ke(i,a)},focusTreePrevNode(e){let{event:t,prop:n,scope:i}=e,r=n("collection"),s=r.getPreviousNode(t.id,{skip:_t(e)});if(!s)return;let a=r.getNodeValue(s);oi(e,a)?H(()=>ke(i,a)):ke(i,a)},focusBranchNode(e){let{event:t,prop:n,scope:i}=e,r=n("collection"),s=r.getParentNode(t.id),a=s?r.getNodeValue(s):void 0;if(!a)return;oi(e,a)?H(()=>ke(i,a)):ke(i,a)},selectAllNodes({context:e,prop:t}){e.set("selectedValue",t("collection").getValues())},focusMatchedNode(e){let{context:t,prop:n,refs:i,event:r,scope:s,computed:a}=e,l=a("visibleNodes").map(({node:h})=>({textContent:n("collection").stringifyNode(h),id:n("collection").getNodeValue(h)})),c=Ue(l,{state:i.get("typeaheadState"),activeId:t.get("focusedValue"),key:r.key});if(!(c!=null&&c.id))return;oi(e,c.id)?H(()=>ke(s,c.id)):ke(s,c.id)},toggleNodeSelection({context:e,event:t}){let n=yt(e.get("selectedValue"),t.id);e.set("selectedValue",n)},expandAllBranches(e){let{context:t,prop:n}=e,i=n("collection").getBranchValues(),r=fs(i,t.get("expandedValue"));Ra(e,r)},expandSiblingBranches(e){let{context:t,event:n,prop:i}=e,r=i("collection"),s=r.getIndexPath(n.id);if(!s)return;let o=r.getSiblingNodes(s).map(c=>r.getNodeValue(c)),l=fs(o,t.get("expandedValue"));Ra(e,l)},extendSelectionToNode(e){let{context:t,event:n,prop:i,computed:r}=e,s=i("collection"),a=lt(t.get("selectedValue"))||s.getNodeValue(s.getFirstNode()),o=n.id,l=[a,o],c=0;r("visibleNodes").forEach(({node:h})=>{let m=s.getNodeValue(h);c===1&&l.push(m),(m===a||m===o)&&c++}),t.set("selectedValue",vt(l))},extendSelectionToNextNode(e){let{context:t,event:n,prop:i}=e,r=i("collection"),s=r.getNextNode(n.id,{skip:_t(e)});if(!s)return;let a=new Set(t.get("selectedValue")),o=r.getNodeValue(s);o!=null&&(a.has(n.id)&&a.has(o)?a.delete(n.id):a.has(o)||a.add(o),t.set("selectedValue",Array.from(a)))},extendSelectionToPrevNode(e){let{context:t,event:n,prop:i}=e,r=i("collection"),s=r.getPreviousNode(n.id,{skip:_t(e)});if(!s)return;let a=new Set(t.get("selectedValue")),o=r.getNodeValue(s);o!=null&&(a.has(n.id)&&a.has(o)?a.delete(n.id):a.has(o)||a.add(o),t.set("selectedValue",Array.from(a)))},extendSelectionToFirstNode(e){let{context:t,prop:n}=e,i=n("collection"),r=lt(t.get("selectedValue")),s=[];i.visit({skip:_t(e),onEnter:a=>{let o=i.getNodeValue(a);if(s.push(o),o===r)return"stop"}}),t.set("selectedValue",s)},extendSelectionToLastNode(e){let{context:t,prop:n}=e,i=n("collection"),r=lt(t.get("selectedValue")),s=[],a=!1;i.visit({skip:_t(e),onEnter:o=>{let l=i.getNodeValue(o);l===r&&(a=!0),a&&s.push(l)}}),t.set("selectedValue",s)},clearPendingAborts({refs:e}){let t=e.get("pendingAborts");t.forEach(n=>n.abort()),t.clear()},toggleChecked({context:e,event:t,prop:n}){let i=n("collection");e.set("checkedValue",r=>t.isBranch?UV(i,t.value,r):yt(r,t.value))},setChecked({context:e,event:t}){e.set("checkedValue",t.value)},clearChecked({context:e}){e.set("checkedValue",[])},setRenamingValue({context:e,event:t,prop:n}){e.set("renamingValue",t.value);let i=n("onRenameStart");if(i){let r=n("collection"),s=r.getIndexPath(t.value);if(s){let a=r.at(s);a&&i({value:t.value,node:a,indexPath:s})}}},submitRenaming({context:e,event:t,prop:n,scope:i}){var c;let r=e.get("renamingValue");if(!r)return;let a=n("collection").getIndexPath(r);if(!a)return;let o=t.label.trim(),l=n("onBeforeRename");if(l&&!l({value:r,label:o,indexPath:a})){e.set("renamingValue",null),ke(i,r);return}(c=n("onRenameComplete"))==null||c({value:r,label:o,indexPath:a}),e.set("renamingValue",null),ke(i,r)},cancelRenaming({context:e,scope:t}){let n=e.get("renamingValue");e.set("renamingValue",null),n&&ke(t,n)},syncRenameInput({context:e,scope:t,prop:n}){let i=e.get("renamingValue");if(!i)return;let r=n("collection"),s=r.findNode(i);if(!s)return;let a=r.stringifyNode(s),o=Of(t,i);Me(o,a)},focusRenameInput({context:e,scope:t}){let n=e.get("renamingValue");if(!n)return;let i=Of(t,n);i&&(i.focus(),i.select())}}}};zV=_()(["ids","collection","dir","expandedValue","expandOnClick","defaultFocusedValue","focusedValue","getRootNode","id","onExpandedChange","onFocusChange","onSelectionChange","checkedValue","selectedValue","selectionMode","typeahead","defaultExpandedValue","defaultSelectedValue","defaultCheckedValue","onCheckedChange","onLoadChildrenComplete","onLoadChildrenError","loadChildren","canRename","onRenameStart","onBeforeRename","onRenameComplete","scrollToIndexFn"]),Ok=B(zV),YV=_()(["node","indexPath"]),wk=B(YV);XV=class extends K{constructor(t,n){var s;let i=(s=n.treeData)!=null?s:jV(t),r=tc({nodeToValue:a=>a.id,nodeToString:a=>a.name,rootNode:i});super(t,y(g({},n),{collection:r}));z(this,"treeCollection");z(this,"syncTree",()=>{let t=this.el.querySelector('[data-scope="tree-view"][data-part="tree"]');t&&(this.spreadProps(t,this.api.getTreeProps()),this.updateExistingTree(t))});this.treeCollection=r}initMachine(t){return new W(KV,g({},t))}initApi(){return WV(this.machine.service,q)}getNodeAt(t){var i;if(t.length===0)return;let n=this.treeCollection.rootNode;for(let r of t)if(n=(i=n==null?void 0:n.children)==null?void 0:i[r],!n)return;return n}updateExistingTree(t){this.spreadProps(t,this.api.getTreeProps());let n=t.querySelectorAll('[data-scope="tree-view"][data-part="branch"]');for(let r of n){let s=r.getAttribute("data-path");if(s==null)continue;let a=s.split("/").map(p=>parseInt(p,10)),o=this.getNodeAt(a);if(!o)continue;let l={indexPath:a,node:o};this.spreadProps(r,this.api.getBranchProps(l));let c=r.querySelector('[data-scope="tree-view"][data-part="branch-control"]');c&&this.spreadProps(c,this.api.getBranchControlProps(l));let u=r.querySelector('[data-scope="tree-view"][data-part="branch-text"]');u&&this.spreadProps(u,this.api.getBranchTextProps(l));let h=r.querySelector('[data-scope="tree-view"][data-part="branch-indicator"]');h&&this.spreadProps(h,this.api.getBranchIndicatorProps(l));let m=r.querySelector('[data-scope="tree-view"][data-part="branch-content"]');m&&this.spreadProps(m,this.api.getBranchContentProps(l));let d=r.querySelector('[data-scope="tree-view"][data-part="branch-indent-guide"]');d&&this.spreadProps(d,this.api.getBranchIndentGuideProps(l))}let i=t.querySelectorAll('[data-scope="tree-view"][data-part="item"]');for(let r of i){let s=r.getAttribute("data-path");if(s==null)continue;let a=s.split("/").map(c=>parseInt(c,10)),o=this.getNodeAt(a);if(!o)continue;let l={indexPath:a,node:o};this.spreadProps(r,this.api.getItemProps(l))}}render(){var i;let t=(i=this.el.querySelector('[data-scope="tree-view"][data-part="root"]'))!=null?i:this.el;this.spreadProps(t,this.api.getRootProps());let n=this.el.querySelector('[data-scope="tree-view"][data-part="label"]');n&&this.spreadProps(n,this.api.getLabelProps()),this.syncTree()}},ZV={mounted(){var i;let e=this.el,t=this.pushEvent.bind(this),n=new XV(e,y(g({id:e.id},C(e,"controlled")?{expandedValue:Q(e,"expandedValue"),selectedValue:Q(e,"selectedValue")}:{defaultExpandedValue:Q(e,"defaultExpandedValue"),defaultSelectedValue:Q(e,"defaultSelectedValue")}),{selectionMode:(i=w(e,"selectionMode",["single","multiple"]))!=null?i:"single",dir:Oe(e),onSelectionChange:r=>{var d;let s=C(e,"redirect"),a=(d=r.selectedValue)!=null&&d.length?r.selectedValue[0]:void 0,o=[...e.querySelectorAll('[data-scope="tree-view"][data-part="item"], [data-scope="tree-view"][data-part="branch"]')].find(p=>p.getAttribute("data-value")===a),l=(o==null?void 0:o.getAttribute("data-part"))==="item",c=o==null?void 0:o.getAttribute("data-redirect"),u=o==null?void 0:o.hasAttribute("data-new-tab");s&&a&&l&&this.liveSocket.main.isDead&&c!=="false"&&(u?window.open(a,"_blank","noopener,noreferrer"):window.location.href=a);let m=w(e,"onSelectionChange");m&&this.liveSocket.main.isConnected()&&t(m,{id:e.id,value:y(g({},r),{isItem:l!=null?l:!1})})},onExpandedChange:r=>{let s=w(e,"onExpandedChange");s&&this.liveSocket.main.isConnected()&&t(s,{id:e.id,value:r})}}));n.init(),this.treeView=n,this.onSetExpandedValue=r=>{let{value:s}=r.detail;n.api.setExpandedValue(s)},e.addEventListener("phx:tree-view:set-expanded-value",this.onSetExpandedValue),this.onSetSelectedValue=r=>{let{value:s}=r.detail;n.api.setSelectedValue(s)},e.addEventListener("phx:tree-view:set-selected-value",this.onSetSelectedValue),this.handlers=[],this.handlers.push(this.handleEvent("tree_view_set_expanded_value",r=>{let s=r.tree_view_id;s&&e.id!==s&&e.id!==`tree-view:${s}`||n.api.setExpandedValue(r.value)})),this.handlers.push(this.handleEvent("tree_view_set_selected_value",r=>{let s=r.tree_view_id;s&&e.id!==s&&e.id!==`tree-view:${s}`||n.api.setSelectedValue(r.value)})),this.handlers.push(this.handleEvent("tree_view_expanded_value",()=>{t("tree_view_expanded_value_response",{value:n.api.expandedValue})})),this.handlers.push(this.handleEvent("tree_view_selected_value",()=>{t("tree_view_selected_value_response",{value:n.api.selectedValue})}))},updated(){},destroyed(){var e;if(this.onSetExpandedValue&&this.el.removeEventListener("phx:tree-view:set-expanded-value",this.onSetExpandedValue),this.onSetSelectedValue&&this.el.removeEventListener("phx:tree-view:set-selected-value",this.onSetSelectedValue),this.handlers)for(let t of this.handlers)this.removeHandleEvent(t);(e=this.treeView)==null||e.destroy()}}});var e0={};he(e0,{Hooks:()=>Da,default:()=>QV,hooks:()=>JV});function me(e,t){return{mounted(){return Ve(this,null,function*(){let r=(yield e())[t];if(this._realHook=r,r!=null&&r.mounted)return r.mounted.call(this)})},updated(){var i,r;(r=(i=this._realHook)==null?void 0:i.updated)==null||r.call(this)},destroyed(){var i,r;(r=(i=this._realHook)==null?void 0:i.destroyed)==null||r.call(this)},disconnected(){var i,r;(r=(i=this._realHook)==null?void 0:i.disconnected)==null||r.call(this)},reconnected(){var i,r;(r=(i=this._realHook)==null?void 0:i.reconnected)==null||r.call(this)},beforeUpdate(){var i,r;(r=(i=this._realHook)==null?void 0:i.beforeUpdate)==null||r.call(this)}}}var Da={Accordion:me(()=>Promise.resolve().then(()=>(uu(),cu)),"Accordion"),AngleSlider:me(()=>Promise.resolve().then(()=>(Ru(),Nu)),"AngleSlider"),Avatar:me(()=>Promise.resolve().then(()=>(Fu(),Mu)),"Avatar"),Carousel:me(()=>Promise.resolve().then(()=>(Wu(),qu)),"Carousel"),Checkbox:me(()=>Promise.resolve().then(()=>(ed(),Qu)),"Checkbox"),Clipboard:me(()=>Promise.resolve().then(()=>(nd(),td)),"Clipboard"),Collapsible:me(()=>Promise.resolve().then(()=>(rd(),id)),"Collapsible"),Combobox:me(()=>Promise.resolve().then(()=>(ih(),nh)),"Combobox"),DatePicker:me(()=>Promise.resolve().then(()=>(tg(),eg)),"DatePicker"),Dialog:me(()=>Promise.resolve().then(()=>(dg(),ug)),"Dialog"),Editable:me(()=>Promise.resolve().then(()=>(vg(),mg)),"Editable"),FloatingPanel:me(()=>Promise.resolve().then(()=>(xg(),Vg)),"FloatingPanel"),Listbox:me(()=>Promise.resolve().then(()=>(Lg(),Dg)),"Listbox"),Menu:me(()=>Promise.resolve().then(()=>(qg(),Ug)),"Menu"),NumberInput:me(()=>Promise.resolve().then(()=>(sp(),rp)),"NumberInput"),PasswordInput:me(()=>Promise.resolve().then(()=>(op(),ap)),"PasswordInput"),PinInput:me(()=>Promise.resolve().then(()=>(hp(),dp)),"PinInput"),RadioGroup:me(()=>Promise.resolve().then(()=>(yp(),vp)),"RadioGroup"),Select:me(()=>Promise.resolve().then(()=>(Op(),Tp)),"Select"),SignaturePad:me(()=>Promise.resolve().then(()=>(zp(),Kp)),"SignaturePad"),Switch:me(()=>Promise.resolve().then(()=>(Jp(),Zp)),"Switch"),Tabs:me(()=>Promise.resolve().then(()=>(rf(),nf)),"Tabs"),Timer:me(()=>Promise.resolve().then(()=>(lf(),of)),"Timer"),Toast:me(()=>Promise.resolve().then(()=>(yf(),vf)),"Toast"),ToggleGroup:me(()=>Promise.resolve().then(()=>(Sf(),Cf)),"ToggleGroup"),TreeView:me(()=>Promise.resolve().then(()=>(Af(),xf)),"TreeView")};function JV(e){return Object.fromEntries(e.filter(t=>t in Da).map(t=>[t,Da[t]]))}var QV=Da;return Uf(e0);})(); diff --git a/priv/static/signature-pad.mjs b/priv/static/signature-pad.mjs index 95ff7de..53d7b3b 100644 --- a/priv/static/signature-pad.mjs +++ b/priv/static/signature-pad.mjs @@ -598,23 +598,17 @@ var SignaturePad = class extends Component { ); if (clearBtn) { this.spreadProps(clearBtn, this.api.getClearTriggerProps()); - const hasPaths = this.api.paths.length > 0 || !!this.api.currentPath; - clearBtn.hidden = !hasPaths; } const hiddenInput = rootEl.querySelector( '[data-scope="signature-pad"][data-part="hidden-input"]' ); if (hiddenInput) { - const pathsForValue = this.paths.length > 0 ? this.paths : this.api.paths; - if (this.paths.length === 0 && this.api.paths.length > 0) { - this.paths = [...this.api.paths]; - } - const pathsValue = pathsForValue.length > 0 ? JSON.stringify(pathsForValue) : ""; - this.spreadProps(hiddenInput, this.api.getHiddenInputProps({ value: pathsValue })); - if (this.name) { - hiddenInput.name = this.name; - } - hiddenInput.value = pathsValue; + this.spreadProps( + hiddenInput, + this.api.getHiddenInputProps({ + value: this.api.paths.length > 0 ? JSON.stringify(this.api.paths) : "" + }) + ); } this.syncPaths(); } @@ -659,7 +653,9 @@ var SignaturePadHook = { '[data-scope="signature-pad"][data-part="hidden-input"]' ); if (hiddenInput) { - hiddenInput.value = JSON.stringify(details.paths); + hiddenInput.value = details.paths.length > 0 ? JSON.stringify(details.paths) : ""; + hiddenInput.dispatchEvent(new Event("input", { bubbles: true })); + hiddenInput.dispatchEvent(new Event("change", { bubbles: true })); } details.getDataUrl("image/png").then((url) => { signaturePad.imageURL = url; @@ -689,28 +685,10 @@ var SignaturePadHook = { }); signaturePad.init(); this.signaturePad = signaturePad; - const initialPaths = controlled ? paths : defaultPaths; - if (initialPaths.length > 0) { - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.dispatchEvent(new Event("input", { bubbles: true })); - hiddenInput.dispatchEvent(new Event("change", { bubbles: true })); - } - } this.onClear = (event) => { const { id: targetId } = event.detail; if (targetId && targetId !== el.id) return; signaturePad.api.clear(); - signaturePad.imageURL = ""; - signaturePad.setPaths([]); - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.value = ""; - } }; el.addEventListener("phx:signature-pad:clear", this.onClear); this.handlers = []; @@ -719,14 +697,6 @@ var SignaturePadHook = { const targetId = payload.signature_pad_id; if (targetId && targetId !== el.id) return; signaturePad.api.clear(); - signaturePad.imageURL = ""; - signaturePad.setPaths([]); - const hiddenInput = el.querySelector( - '[data-scope="signature-pad"][data-part="hidden-input"]' - ); - if (hiddenInput) { - hiddenInput.value = ""; - } }) ); },