import{c as V,e as W,a as X,p as f,B as Y,x as Z,s as g,t as A,j as $,n as ee,b as w,d as te,f as k,i as a,h as s,m as p,v as oe,r as n,k as ie,q as se}from"../../custom-element.js";import{o as ne}from"../../index-client.js";import{i as D}from"../../if.js";import{a as re,s as S}from"../../slot.js";import{a as le}from"../../attributes.js";import{b as y}from"../../this.js";import{I as ce}from"../iconbutton/IconButton.js";import{q as ae}from"../../Condition20.js";import{c as be}from"../../custom-element-forward-events.js";import"../../branches.js";import"../loader/Loader.js";var me=k('<h3 class="mc-listbox__title svelte-cf5eub"> </h3>'),ve=k("<div><!></div>"),ue=k('<div><div><div class="mc-listbox__header svelte-cf5eub"><!> <span class="mc-listbox__close svelte-cf5eub"><!></span></div> <div class="mc-listbox__body svelte-cf5eub"><ul class="mc-action-list svelte-cf5eub" role="menu"><!></ul></div></div></div> <!>',1);const de={hash:"svelte-cf5eub",code:`/**
 * Do not edit directly, this file was auto-generated.
 */.mc-listbox.svelte-cf5eub:has(.mc-listbox__content:where(.svelte-cf5eub):not([popover])), .mc-listbox.svelte-cf5eub:has(.mc-listbox__content:where(.svelte-cf5eub):popover-open) {position:fixed;inset:0;display:flex;align-items:flex-end;justify-content:center;z-index:1;padding:0.5rem;background-color:var(--overlay-color-background, rgba(0, 0, 0, 0.5));inset:0;opacity:0;position:fixed;pointer-events:none;transition:opacity 0.4s ease, visibility 0ms 0.4s;z-index:var(--overlay-z-index, 4);}.mc-listbox:has(.mc-listbox__content:where(.svelte-cf5eub):not([popover])).is-visible.svelte-cf5eub, .mc-listbox:has(.mc-listbox__content:where(.svelte-cf5eub):popover-open).is-visible.svelte-cf5eub {opacity:1;pointer-events:all;transition:opacity 0.4s ease, visibility 0ms;visibility:visible;}.mc-listbox.svelte-cf5eub:has(.mc-listbox__content:where(.svelte-cf5eub):not([popover])), .mc-listbox.svelte-cf5eub:has(.mc-listbox__content:where(.svelte-cf5eub):popover-open) {opacity:1;}
@media (width >= 680px) {.mc-listbox.svelte-cf5eub:has(.mc-listbox__content:where(.svelte-cf5eub):not([popover])), .mc-listbox.svelte-cf5eub:has(.mc-listbox__content:where(.svelte-cf5eub):popover-open) {position:relative;display:block;padding:0;background-color:transparent;}
}.mc-listbox__content.svelte-cf5eub {border:var(--border-width-s, 0.0625rem) solid var(--color-border-primary, #cccccc);border-radius:var(--border-radius-m, 0.5rem);width:100%;z-index:10;background-color:var(--color-background-primary, #ffffff);pointer-events:all;}
@media (width >= 680px) {.mc-listbox__content.svelte-cf5eub {width:18.75rem;}
}.mc-listbox__header.svelte-cf5eub {display:flex;align-items:center;justify-content:center;position:relative;height:4rem;}
@media (width >= 680px) {.mc-listbox__header.svelte-cf5eub {display:none;}
}.mc-listbox__title.svelte-cf5eub {line-height:var(--line-height-s, 1.3);font-weight:var(--font-weight-semi-bold, 600);font-size:var(--font-size-100, 0.875rem);color:var(--color-text-tertiary, #666666);text-align:center;margin:0;}.mc-listbox__close.svelte-cf5eub {position:absolute;right:1.25rem;width:1.5rem;height:1.5rem;}.mc-listbox__body.svelte-cf5eub {overflow:hidden;}
@media (width >= 680px) {.mc-listbox--top.svelte-cf5eub .mc-listbox__content:where(.svelte-cf5eub) {margin:0 0 8px;inset:auto;position-area:span-right top;}.mc-listbox--bottom.svelte-cf5eub .mc-listbox__content:where(.svelte-cf5eub) {margin:8px 0 0;inset:auto;position-area:span-right bottom;}.mc-listbox--left.svelte-cf5eub .mc-listbox__content:where(.svelte-cf5eub) {margin:0 8px 0 0;inset:auto;position-area:span-bottom left;}.mc-listbox--right.svelte-cf5eub .mc-listbox__content:where(.svelte-cf5eub) {margin:0 0 0 8px;inset:auto;position-area:span-bottom right;}
}.mc-action-list.svelte-cf5eub {padding:0.5rem 0.5rem;margin:0;}.mc-action-list__element.svelte-cf5eub {height:2.5rem;cursor:pointer;border-radius:var(--border-radius-s, 0.25rem);flex-grow:1;}.mc-action-list__element.svelte-cf5eub:hover {background-color:var(--action-listbox-color-background-hover, rgba(0, 0, 0, 0.05));}.mc-action-list__element--danger.svelte-cf5eub .mc-action-list__text:where(.svelte-cf5eub) {color:var(--action-listbox-color-text-danger, #c61112);}.mc-action-list__element--danger.svelte-cf5eub .mc-action-list__icon:where(.svelte-cf5eub) {fill:var(--action-listbox-color-text-danger, #c61112);}.mc-action-list__element--danger.svelte-cf5eub:hover {background-color:var(--action-listbox-color-background-danger-hover, rgba(198, 17, 18, 0.1));}.mc-action-list__element--disabled.svelte-cf5eub .mc-action-list__text:where(.svelte-cf5eub) {color:var(--action-listbox-color-text-disabled, #b3b3b3);}.mc-action-list__element--disabled.svelte-cf5eub .mc-action-list__icon:where(.svelte-cf5eub) {fill:var(--action-listbox-color-text-disabled, #b3b3b3);}.mc-action-list__element--disabled.svelte-cf5eub:hover {background-color:transparent;}.mc-action-list__button.svelte-cf5eub {background-color:transparent;color:var(--action-listbox-color-text-default, #000000);border:none;display:flex;align-items:center;gap:0.25rem;padding:0;padding:0 0.25rem;cursor:pointer;width:100%;height:100%;}.mc-action-list__button.svelte-cf5eub:focus-visible {box-shadow:0 0 0 0.125rem var(--focus-color-mid, var(--focus-color-outline-mid, #ffffff)), 0 0 0 0.25rem var(--focus-color-outer, var(--focus-color-outline-outer, #000000));outline:0.125rem solid transparent;outline-offset:0.125rem;}.mc-action-list__text.svelte-cf5eub {font-size:var(--font-size-150, 1rem);font-weight:var(--font-weight-regular, 400);line-height:var(--line-height-s, 1.3);text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0;}.mc-action-list__icon.svelte-cf5eub {width:1.25rem;height:1.25rem;}.mc-action-list__divider.svelte-cf5eub {margin:0.5rem 0;}.mc-listbox__close.svelte-cf5eub {display:flex;align-items:center;justify-content:center;}`};function fe(E,i){const z=re(i);W(i,!0),X(E,de);let r=f(i,"open",15),m=f(i,"title",7),_=f(i,"position",7,"bottom"),h=f(i,"onclose",7);const F=crypto.randomUUID();let v,c,l=oe(null);function U(){h()?.();const e=new CustomEvent("close",{bubbles:!0,composed:!0});v.dispatchEvent(e),r(!1)}function K(){const e=c?.querySelector('slot[name="item"]');return e?e.assignedElements().filter(o=>!o.hasAttribute("disabled")&&o.getAttribute("disabled")!=="true"):[]}function I(e){const t=K();if(!t.length)return;let o=0;if(!e){const d=t.findIndex(R=>R===document.activeElement);o=d===-1?0:(d+1)%t.length}t[o]?.focus()}function M(){!c||!a(l)||(r()?(c.showPopover({source:a(l)}),I(!0)):c.hidePopover({source:a(l)}))}function B(e){if(!r())return;const t=e.composedPath?e.composedPath():[];!t.includes(v)&&!t.includes(a(l))&&r(!1)}function O(e){e.preventDefault(),e.key==="Tab"&&I(),e.key==="Escape"&&(r(!1),(a(l)?.querySelector('slot[name="activator"]')).assignedElements()[0].focus())}Y(M),ne(()=>(document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}));var T={get open(){return r()},set open(e){r(e),p()},get title(){return m()},set title(e){m(e),p()},get position(){return _()},set position(e="bottom"){_(e),p()},get onclose(){return h()},set onclose(e){h(e),p()}},C=ue(),b=Z(C),u=s(b);le(u,()=>({class:"mc-listbox__content",...z.activator?{id:F,popover:"manual",role:"dialog",tabindex:0,onkeydown:O}:{}}),void 0,void 0,void 0,"svelte-cf5eub");var x=s(u),L=s(x);{var G=e=>{var t=me(),o=s(t,!0);n(t),A(()=>ie(o,m())),w(e,t)};D(L,e=>{m()&&e(G)})}var P=g(L,2),H=s(P);ce(H,{ghost:!0,"aria-label":"Close",onclick:U,$$slots:{icon:(e,t)=>{ae(e,{slot:"icon"})}}}),n(P),n(x);var j=g(x,2),q=s(j),J=s(q);S(J,i,"item",{},null),n(q),n(j),n(u),y(u,e=>c=e,()=>c),n(b),y(b,e=>v=e,()=>v);var N=g(b,2);{var Q=e=>{var t=ve(),o=s(t);S(o,i,"activator",{},null),n(t),y(t,d=>se(l,d),()=>a(l)),w(e,t)};D(N,e=>{z.activator&&e(Q)})}return A(()=>$(b,1,ee({"mc-listbox":!0,[`mc-listbox--${_()}`]:!0}),"svelte-cf5eub")),w(E,C),te(T)}customElements.define("m-action-listbox",V(fe,{open:{attribute:"open",reflect:!0,type:"Boolean"},title:{},position:{},onclose:{}},["item","activator"],[],{mode:"open"},be));
//# sourceMappingURL=ActionListbox.js.map
