import{P as O,c as P}from"./popper.min.js?5.3.0";import{b as u,E as r,d as S,B as L,S as a,f as E,n as g,M as T,h as A,c as D,j as M,i as R,g as I}from"./dom.min.js?5.3.0";const N="dropdown",v="bs.dropdown",p=`.${v}`,h=".data-api",B="Escape",y="Tab",H="ArrowUp",b="ArrowDown",$=2,V=`hide${p}`,k=`hidden${p}`,K=`show${p}`,x=`shown${p}`,C=`click${p}${h}`,w=`keydown${p}${h}`,j=`keyup${p}${h}`,_="show",U="dropup",W="dropend",Y="dropstart",G="dropup-center",J="dropdown-center",d='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',q=`${d}.${_}`,f=".dropdown-menu",Q=".navbar",F=".navbar-nav",z=".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",X=u()?"top-end":"top-start",Z=u()?"top-start":"top-end",tt=u()?"bottom-end":"bottom-start",et=u()?"bottom-start":"bottom-end",nt=u()?"left-start":"right-start",ot=u()?"right-start":"left-start",st="top",rt="bottom",it={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},at={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class s extends L{constructor(t,e){super(t,e),this._popper=null,this._parent=this._element.parentNode,this._menu=a.next(this._element,f)[0]||a.prev(this._element,f)[0]||a.findOne(f,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return it}static get DefaultType(){return at}static get NAME(){return N}toggle(){return this._isShown()?this.hide():this.show()}show(){if(E(this._element)||this._isShown())return;const t={relatedTarget:this._element};if(!r.trigger(this._element,K,t).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(F))for(const o of[].concat(...document.body.children))r.on(o,"mouseover",g);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(_),this._element.classList.add(_),r.trigger(this._element,x,t)}}hide(){if(E(this._element)||!this._isShown())return;const t={relatedTarget:this._element};this._completeHide(t)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(t){if(!r.trigger(this._element,V,t).defaultPrevented){if("ontouchstart"in document.documentElement)for(const o of[].concat(...document.body.children))r.off(o,"mouseover",g);this._popper&&this._popper.destroy(),this._menu.classList.remove(_),this._element.classList.remove(_),this._element.setAttribute("aria-expanded","false"),T.removeDataAttribute(this._menu,"popper"),r.trigger(this._element,k,t)}}_getConfig(t){if(t=super._getConfig(t),typeof t.reference=="object"&&!A(t.reference)&&typeof t.reference.getBoundingClientRect!="function")throw new TypeError(`${N.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return t}_createPopper(){if(typeof O>"u")throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let t=this._element;this._config.reference==="parent"?t=this._parent:A(this._config.reference)?t=D(this._config.reference):typeof this._config.reference=="object"&&(t=this._config.reference);const e=this._getPopperConfig();this._popper=P(t,this._menu,e)}_isShown(){return this._menu.classList.contains(_)}_getPlacement(){const t=this._parent;if(t.classList.contains(W))return nt;if(t.classList.contains(Y))return ot;if(t.classList.contains(G))return st;if(t.classList.contains(J))return rt;const e=getComputedStyle(this._menu).getPropertyValue("--bs-position").trim()==="end";return t.classList.contains(U)?e?Z:X:e?et:tt}_detectNavbar(){return this._element.closest(Q)!==null}_getOffset(){const{offset:t}=this._config;return typeof t=="string"?t.split(",").map(e=>Number.parseInt(e,10)):typeof t=="function"?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||this._config.display==="static")&&(T.setDataAttribute(this._menu,"popper","static"),t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,...M(this._config.popperConfig,[t])}}_selectMenuItem(t){let{key:e,target:o}=t;const n=a.find(z,this._menu).filter(i=>R(i));n.length&&I(n,o,e===b,!n.includes(o)).focus()}static jQueryInterface(t){return this.each(function(){const e=s.getOrCreateInstance(this,t);if(typeof t=="string"){if(typeof e[t]>"u")throw new TypeError(`No method named "${t}"`);e[t]()}})}static clearMenus(t){if(t.button===$||t.type==="keyup"&&t.key!==y)return;const e=a.find(q);for(const o of e){const n=s.getInstance(o);if(!n||n._config.autoClose===!1)continue;const i=t.composedPath(),c=i.includes(n._menu);if(i.includes(n._element)||n._config.autoClose==="inside"&&!c||n._config.autoClose==="outside"&&c||n._menu.contains(t.target)&&(t.type==="keyup"&&t.key===y||/input|select|option|textarea|form/i.test(t.target.tagName)))continue;const m={relatedTarget:n._element};t.type==="click"&&(m.clickEvent=t),n._completeHide(m)}}static dataApiKeydownHandler(t){const e=/input|textarea/i.test(t.target.tagName),o=t.key===B,n=[H,b].includes(t.key);if(!n&&!o||e&&!o)return;t.preventDefault();const i=this.matches(d)?this:a.prev(this,d)[0]||a.next(this,d)[0]||a.findOne(d,t.delegateTarget.parentNode),c=s.getOrCreateInstance(i);if(n){t.stopPropagation(),c.show(),c._selectMenuItem(t);return}c._isShown()&&(t.stopPropagation(),c.hide(),i.focus())}}if(r.on(document,w,d,s.dataApiKeydownHandler),r.on(document,w,f,s.dataApiKeydownHandler),r.on(document,C,s.clearMenus),r.on(document,j,s.clearMenus),r.on(document,C,d,function(l){l.preventDefault(),s.getOrCreateInstance(this).toggle()}),S(s),window.bootstrap=window.bootstrap||{},window.bootstrap.Dropdown=s,Joomla&&Joomla.getOptions){const l=Joomla.getOptions("bootstrap.dropdown");typeof l=="object"&&l!==null&&Object.keys(l).forEach(t=>{const e=l[t],o={interval:e.interval?e.interval:5e3,pause:e.pause?e.pause:"hover"},n=Array.from(document.querySelectorAll(t));n.length&&n.map(i=>new window.bootstrap.Dropdown(i,o))})}export{s as D};