import{C as e,D as t,G as n,J as r,M as i,P as a,Q as ee,V as o,W as s,Y as c,_ as l,a as u,b as d,et as f,ft as p,it as m,j as h,k as te,l as g,n as _,ot as v,q as y,st as b,t as x,v as S,w as C}from"../../client.js";import{t as w}from"../../custom-element-forward-events.js";import{w as T}from"../../components.js";import E from"../iconbutton/IconButton.js";var D=a(`<h3 class="mc-listbox__title svelte-cf5eub"> </h3>`),O=a(`<div><!></div>`),k=a(`<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),ne={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 A(a,x){let w=e(x);b(x,!0),d(a,ne);let A=_(x,`open`,15),j=_(x,`title`,7),M=_(x,`position`,7,`bottom`),N=_(x,`onclose`,7),P=crypto.randomUUID(),F,I,L=f(null);function R(){N()?.();let e=new CustomEvent(`close`,{bubbles:!0,composed:!0});F.dispatchEvent(e),A(!1)}function z(){let e=I?.querySelector(`slot[name="item"]`);return e?e.assignedElements().filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`disabled`)!==`true`):[]}function B(e){let t=z();if(!t.length)return;let n=0;if(!e){let e=t.findIndex(e=>e===document.activeElement);n=e===-1?0:(e+1)%t.length}t[n]?.focus()}function V(){!I||!o(L)||(A()?(I.showPopover({source:o(L)}),B(!0)):I.hidePopover({source:o(L)}))}function H(e){if(!A())return;let t=e.composedPath?e.composedPath():[];!t.includes(F)&&!t.includes(o(L))&&A(!1)}function U(e){e.preventDefault(),e.key===`Tab`&&B(),e.key===`Escape`&&(A(!1),(o(L)?.querySelector(`slot[name="activator"]`)).assignedElements()[0].focus())}n(V),te(()=>(document.addEventListener(`mousedown`,H),()=>{document.removeEventListener(`mousedown`,H)}));var W={get open(){return A()},set open(e){A(e),m()},get title(){return j()},set title(e){j(e),m()},get position(){return M()},set position(e=`bottom`){M(e),m()},get onclose(){return N()},set onclose(e){N(e),m()}},G=k(),K=r(G),q=y(K);g(q,()=>({class:`mc-listbox__content`,...w.activator?{id:P,popover:`manual`,role:`dialog`,tabindex:0,onkeydown:U}:{}}),void 0,void 0,void 0,`svelte-cf5eub`);var J=y(q),Y=y(J),X=e=>{var t=D(),n=y(t,!0);p(t),s(()=>h(n,j())),i(e,t)};t(Y,e=>{j()&&e(X)});var Z=c(Y,2);E(y(Z),{ghost:!0,"aria-label":`Close`,onclick:R,$$slots:{icon:(e,t)=>{T(e,{slot:`icon`})}}}),p(Z),p(J);var Q=c(J,2),$=y(Q);C(y($),x,`item`,{},null),p($),p(Q),p(q),u(q,e=>I=e,()=>I),p(K),u(K,e=>F=e,()=>F);var re=c(K,2),ie=e=>{var t=O();C(y(t),x,`activator`,{},null),p(t),u(t,e=>ee(L,e),()=>o(L)),i(e,t)};return t(re,e=>{w.activator&&e(ie)}),s(()=>l(K,1,S({"mc-listbox":!0,[`mc-listbox--${M()}`]:!0}),`svelte-cf5eub`)),i(a,G),v(W)}customElements.define(`m-action-listbox`,x(A,{open:{attribute:`open`,reflect:!0,type:`Boolean`},title:{},position:{},onclose:{}},[`item`,`activator`],[],{mode:`open`},w));
//# sourceMappingURL=ActionListbox.js.map