import{a as e,l as t}from"./preact.module-CNakwbc9.js";import{i as n,l as r,s as i,t as a}from"./hooks.module-BrXTvcfS.js";import{R as o}from"./content_renderer-DOj8g78V.js";import{t as s}from"./bootstrap.esm-DbsKxb7T.js";import{F as c,S as l,k as u}from"./i18n-BaLR3UdQ.js";import{p as d}from"./compat.module-C8KToj4y.js";import{t as f}from"./jsxRuntime.module-Cao1NCKs.js";import{G as p,U as m}from"./hooks-ClTXKdUl.js";import{t as h}from"./FormToggle-wwys3uI5.js";import{t as g}from"./Icon-BEnt7704.js";d(),t();function _({children:e,onSelect:t,style:i,fullHeight:c,wrapperClassName:l}){let u=a(null),d=a(null);r(()=>{if(!d.current||!u.current)return;let e=$(u.current),t=s.getOrCreateInstance(d.current);return e.on(`hide.bs.dropdown`,e=>e.preventDefault()),()=>{e.off(`hide.bs.dropdown`),t.dispose()}},[d,u]);let p=n(()=>{let e={};return c&&(e.height=`100%`,e.overflow=`auto`),e},[c]);return f(`div`,{className:o(`dropdownWrapper`,l),ref:u,style:p,children:f(`div`,{className:`dropdown`,style:p,children:[f(`button`,{ref:d,type:`button`,style:`display: none;`,"data-bs-toggle":`dropdown`,"data-bs-display":`static`}),f(`div`,{class:`dropdown-menu static show`,style:{...i??{},...p,position:`relative`},onClick:e=>{let n=e.target.closest(`.dropdown-item`)?.dataset?.value;n&&t&&t(n)},onKeyDown:v,children:e})]})})}function v(e){if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target,n=t.closest(`.dropdown-item`);if(!n||n.classList.contains(`disabled`))return;let r=t.closest(`input, textarea, select, button, a, [tabindex]`);r&&r!==n||(e.preventDefault(),n.click())}var y={placement:l(`right`),fallbackPlacements:[l(`right`)],animation:!1};function b({className:e,icon:t,value:n,title:r,active:i,disabled:a,checked:o,container:s,onClick:c,selected:l,rtl:u,triggerCommand:d,description:h,itemRef:_,...v}){let b=p(_,null);return o&&(t=`bx bx-check`),m(b,y),f(`li`,{ref:b,class:`dropdown-item ${i?`active`:``} ${a?`disabled`:``} ${l?`selected`:``} ${s?`dropdown-container-item`:``} ${e??``}`,"data-value":n,title:r,tabIndex:s?-1:0,onClick:c,"data-trigger-command":d,dir:u?`rtl`:void 0,children:[f(g,{icon:t}),`\xA0`,h?f(`div`,{children:f(S,{description:h,disabled:a,...v})}):f(S,{description:h,disabled:a,...v})]})}function x({title:t,currentValue:n,onChange:r,disabled:i,helpPage:o,...s}){let l=a(!1);return f(b,{...s,disabled:i,onClick:async e=>{e.target?.classList.contains(`contextual-help`)||(e.stopPropagation(),!i&&!l.current&&(l.current=!0,await r(!n),l.current=!1))},children:f(h,{switchOnName:t,switchOffName:t,currentValue:n,onChange:()=>{},afterName:f(e,{children:[o&&f(`span`,{class:`bx bx-help-circle contextual-help`,onClick:()=>c(o)}),f(`span`,{class:`switch-spacer`})]})})})}function S({children:t,badges:n,description:r,disabled:i,disabledTooltip:a}){return f(e,{children:[t,n&&n.map(({className:e,text:t})=>f(`span`,{className:`badge ${e??``}`,children:t})),i&&a&&f(`span`,{class:`bx bx-info-circle contextual-help`,title:a}),r&&f(`div`,{className:`description`,children:r})]})}function C({text:e,action:t}){return f(`li`,{children:f(`h6`,{className:`dropdown-header ${t?`dropdown-header-with-action`:``}`,children:[f(`span`,{children:e}),t]})})}function w(){return f(`div`,{className:`dropdown-divider`,onClick:e=>e.stopPropagation()})}function T({icon:e,title:t,children:n,dropStart:r,onDropdownToggleClicked:a}){let[s,c]=i(!1);return f(`li`,{className:o(`dropdown-item dropdown-submenu`,{"submenu-open":s,dropstart:r}),children:[f(`span`,{className:`dropdown-toggle`,onClick:e=>{e.stopPropagation(),u()?c(!s):a&&a()},children:[f(g,{icon:e}),`\xA0`,t]}),f(`ul`,{className:`dropdown-menu ${s?`show`:``}`,children:n})]})}export{b as a,C as i,T as n,x as o,_ as r,w as t};