import './async-Djx13DAD.js';
import { d as attr_class, a as attr, c as bind_props, g as attr_style, e as ensure_array_like } from './index-B7gr0Dsc.js';
import { c } from './BlockTitle-CMSrY_fB.js';
import './MarkdownCode.svelte_svelte_type_style_lang-DJRtJayx.js';
import './2-CeYbpaU1.js';
import { y } from './IconButtonWrapper-DlgTGGi-.js';
import { e as escape_html } from './escaping-CBnpiEl5.js';

function C(n){n.push('<svg class="dropdown-arrow svelte-loyhyk" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 18 18"><path d="M5 8l4 4 4-4z"></path></svg>');}function F(n,p){n.component(t=>{let{choices:c,filtered_indices:d,show_options:m=false,disabled:l=false,selected_indices:o=[],active_index:u=null,remember_scroll:w=false,offset_from_top:A=0,from_top:x=false,onchange:I,onload:r}=p,h=0,O=null,b=null,g=0;if(t.push('<div class="reference"></div> '),m&&!l){t.push("<!--[-->"),t.push(`<ul class="options svelte-1ou0lab" role="listbox"${attr_style("",{top:O,bottom:b,"max-height":`calc(${g}px - var(--window-padding))`,width:h+"px"})}><!--[-->`);const y=ensure_array_like(d);for(let _=0,N=y.length;_<N;_++){let s$1=y[_];t.push(`<li${attr_class("item svelte-1ou0lab",void 0,{selected:o.includes(s$1),active:s$1===u,"bg-gray-100":s$1===u,"dark:bg-gray-600":s$1===u})}${attr("data-index",s$1)}${attr("aria-label",c[s$1][0])} data-testid="dropdown-option" role="option"${attr("aria-selected",o.includes(s$1))}${attr_style("",{width:h+"px"})}><span${attr_class("inner-item svelte-1ou0lab",void 0,{hide:!o.includes(s$1)})}>✓</span> ${escape_html(c[s$1][0])}</li>`);}t.push("<!--]--></ul>");}else t.push("<!--[!-->");t.push("<!--]-->");});}function S(n,p){n.component(t=>{const c$1=typeof window<"u";let{label:d="Dropdown",info:m=void 0,value:l=void 0,choices:o=[],interactive:u=true,show_label:w=true,container:A=true,allow_custom_value:x=false,filterable:I=true,buttons:r=null,oncustom_button_click:h=null,on_change:O,on_input:b,on_select:g,on_focus:y$1,on_blur:_,on_key_up:N}=p,s$1,v=c$1&&s$1===document.activeElement,z=o.map(a=>a[0]),f=o.map(a=>a[1]),[k,i]=l==null||Array.isArray(l)&&l.length===0?["",null]:f.includes(l)?[z[f.indexOf(l)],f.indexOf(l)]:x?[l,null]:["",null],D=!u,M=o.map((a,B)=>B),E=null;function T(a){if(i=parseInt(a),isNaN(i)){i=null;return}let[B,W]=o[i];k=B,l=W,g?.({index:i,value:f[i],selected:true}),v=false,E=null,b?.(),s$1.blur();}t.push(`<div${attr_class("svelte-1xfsv4t",void 0,{container:A})}>`),w&&r&&r.length>0?(t.push("<!--[-->"),y(t,{buttons:r,on_custom_button_click:h})):t.push("<!--[!-->"),t.push("<!--]--> "),c(t,{show_label:w,info:m,children:a=>{a.push(`<!---->${escape_html(d)}`);},$$slots:{default:true}}),t.push(`<!----> <div class="wrap svelte-1xfsv4t"><div${attr_class("wrap-inner svelte-1xfsv4t",void 0,{show_options:v})}><div class="secondary-wrap svelte-1xfsv4t"><input role="listbox" aria-controls="dropdown-options"${attr("aria-expanded",v)}${attr("aria-label",d)}${attr_class("border-none svelte-1xfsv4t",void 0,{subdued:!z.includes(k)&&!x})} autocomplete="off"${attr("disabled",D,true)}${attr("value",k)}${attr("readonly",!I,true)}/> `),D?t.push("<!--[!-->"):(t.push("<!--[-->"),t.push('<div class="icon-wrap svelte-1xfsv4t">'),C(t),t.push("<!----></div>")),t.push("<!--]--></div></div> "),F(t,{show_options:v,choices:o,filtered_indices:M,disabled:D,selected_indices:i===null?[]:[i],active_index:E,onchange:T,onload:()=>true}),t.push("<!----></div></div>"),bind_props(p,{value:l});});}

export { C, F, S };
//# sourceMappingURL=Dropdown-DGqyxorx.js.map
