@coreui/coreui-pro
Version:
The most popular front-end framework for developing responsive, mobile-first projects on the web rewritten by the CoreUI Team
6 lines • 244 kB
JavaScript
/*!
* CoreUI v5.23.0 (https://coreui.io)
* Copyright 2025 The CoreUI Team (https://github.com/orgs/coreui/people)
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
*/
import*as Popper from"@popperjs/core";const elementMap=new Map,Data={set(e,t,i){elementMap.has(e)||elementMap.set(e,new Map);const n=elementMap.get(e);n.has(t)||0===n.size?n.set(t,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(e,t)=>elementMap.has(e)&&elementMap.get(e).get(t)||null,remove(e,t){if(!elementMap.has(e))return;const i=elementMap.get(e);i.delete(t),0===i.size&&elementMap.delete(e)}},MAX_UID=1e6,MILLISECONDS_MULTIPLIER=1e3,TRANSITION_END="transitionend",parseSelector=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,(e,t)=>`#${CSS.escape(t)}`)),e),toType=e=>null==e?`${e}`:Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(),getUID=e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e},getTransitionDurationFromElement=e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:i}=window.getComputedStyle(e);const n=Number.parseFloat(t),s=Number.parseFloat(i);return n||s?(t=t.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(i))):0},triggerTransitionEnd=e=>{e.dispatchEvent(new Event(TRANSITION_END))},isElement=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),getElement=e=>isElement(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(parseSelector(e)):null,isVisible=e=>{if(!isElement(e)||0===e.getClientRects().length)return!1;const t="visible"===getComputedStyle(e).getPropertyValue("visibility"),i=e.closest("details:not([open])");if(!i)return t;if(i!==e){const t=e.closest("summary");if(t&&t.parentNode!==i)return!1;if(null===t)return!1}return t},isDisabled=e=>!e||e.nodeType!==Node.ELEMENT_NODE||!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled")),findShadowRoot=e=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?findShadowRoot(e.parentNode):null},noop=()=>{},reflow=e=>{e.offsetHeight},getjQuery=()=>window.jQuery&&!document.body.hasAttribute("data-coreui-no-jquery")?window.jQuery:null,DOMContentLoadedCallbacks=[],onDOMContentLoaded=e=>{"loading"===document.readyState?(DOMContentLoadedCallbacks.length||document.addEventListener("DOMContentLoaded",()=>{for(const e of DOMContentLoadedCallbacks)e()}),DOMContentLoadedCallbacks.push(e)):e()},isRTL=()=>"rtl"===document.documentElement.dir,defineJQueryPlugin=e=>{onDOMContentLoaded(()=>{const t=getjQuery();if(t){const i=e.NAME,n=t.fn[i];t.fn[i]=e.jQueryInterface,t.fn[i].Constructor=e,t.fn[i].noConflict=()=>(t.fn[i]=n,e.jQueryInterface)}})},execute=(e,t=[],i=e)=>"function"==typeof e?e.call(...t):i,executeAfterTransition=(e,t,i=!0)=>{if(!i)return void execute(e);const n=getTransitionDurationFromElement(t)+5;let s=!1;const a=({target:i})=>{i===t&&(s=!0,t.removeEventListener(TRANSITION_END,a),execute(e))};t.addEventListener(TRANSITION_END,a),setTimeout(()=>{s||triggerTransitionEnd(t)},n)},getNextActiveElement=(e,t,i,n)=>{const s=e.length;let a=e.indexOf(t);return-1===a?!i&&n?e[s-1]:e[0]:(a+=i?1:-1,n&&(a=(a+s)%s),e[Math.max(0,Math.min(a,s-1))])},namespaceRegex=/[^.]*(?=\..*)\.|.*/,stripNameRegex=/\..*/,stripUidRegex=/::\d+$/,eventRegistry={};let uidEvent=1;const customEvents={mouseenter:"mouseover",mouseleave:"mouseout"},nativeEvents=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","input","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function makeEventUid(e,t){return t&&`${t}::${uidEvent++}`||e.uidEvent||uidEvent++}function getElementEvents(e){const t=makeEventUid(e);return e.uidEvent=t,eventRegistry[t]=eventRegistry[t]||{},eventRegistry[t]}function bootstrapHandler(e,t){return function i(n){return hydrateObj(n,{delegateTarget:e}),i.oneOff&&EventHandler.off(e,n.type,t),t.apply(e,[n])}}function bootstrapDelegationHandler(e,t,i){return function n(s){const a=e.querySelectorAll(t);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(const o of a)if(o===r)return hydrateObj(s,{delegateTarget:r}),n.oneOff&&EventHandler.off(e,s.type,t,i),i.apply(r,[s])}}function findHandler(e,t,i=null){return Object.values(e).find(e=>e.callable===t&&e.delegationSelector===i)}function normalizeParameters(e,t,i){const n="string"==typeof t,s=n?i:t||i;let a=getTypeEvent(e);return nativeEvents.has(a)||(a=e),[n,s,a]}function addHandler(e,t,i,n,s){if("string"!=typeof t||!e)return;let[a,r,o]=normalizeParameters(t,i,n);if(t in customEvents){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};r=e(r)}const l=getElementEvents(e),c=l[o]||(l[o]={}),_=findHandler(c,r,a?i:null);if(_)return void(_.oneOff=_.oneOff&&s);const d=makeEventUid(r,t.replace(namespaceRegex,"")),h=a?bootstrapDelegationHandler(e,i,r):bootstrapHandler(e,r);h.delegationSelector=a?i:null,h.callable=r,h.oneOff=s,h.uidEvent=d,c[d]=h,e.addEventListener(o,h,a)}function removeHandler(e,t,i,n,s){const a=findHandler(t[i],n,s);a&&(e.removeEventListener(i,a,Boolean(s)),delete t[i][a.uidEvent])}function removeNamespacedHandlers(e,t,i,n){const s=t[i]||{};for(const[a,r]of Object.entries(s))a.includes(n)&&removeHandler(e,t,i,r.callable,r.delegationSelector)}function getTypeEvent(e){return e=e.replace(stripNameRegex,""),customEvents[e]||e}const EventHandler={on(e,t,i,n){addHandler(e,t,i,n,!1)},one(e,t,i,n){addHandler(e,t,i,n,!0)},off(e,t,i,n){if("string"!=typeof t||!e)return;const[s,a,r]=normalizeParameters(t,i,n),o=r!==t,l=getElementEvents(e),c=l[r]||{},_=t.startsWith(".");if(void 0===a){if(_)for(const i of Object.keys(l))removeNamespacedHandlers(e,l,i,t.slice(1));for(const[i,n]of Object.entries(c)){const s=i.replace(stripUidRegex,"");o&&!t.includes(s)||removeHandler(e,l,r,n.callable,n.delegationSelector)}}else{if(!Object.keys(c).length)return;removeHandler(e,l,r,a,s?i:null)}},trigger(e,t,i){if("string"!=typeof t||!e)return null;const n=getjQuery();let s=null,a=!0,r=!0,o=!1;t!==getTypeEvent(t)&&n&&(s=n.Event(t,i),n(e).trigger(s),a=!s.isPropagationStopped(),r=!s.isImmediatePropagationStopped(),o=s.isDefaultPrevented());const l=hydrateObj(new Event(t,{bubbles:a,cancelable:!0}),i);return o&&l.preventDefault(),r&&e.dispatchEvent(l),l.defaultPrevented&&s&&s.preventDefault(),l}};function hydrateObj(e,t={}){for(const[i,n]of Object.entries(t))try{e[i]=n}catch(t){Object.defineProperty(e,i,{configurable:!0,get:()=>n})}return e}function normalizeData(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch(t){return e}}function normalizeDataKey(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}const Manipulator={setDataAttribute(e,t,i){e.setAttribute(`data-coreui-${normalizeDataKey(t)}`,i)},removeDataAttribute(e,t){e.removeAttribute(`data-coreui-${normalizeDataKey(t)}`)},getDataAttributes(e){if(!e)return{};const t={},i=Object.keys(e.dataset).filter(e=>e.startsWith("coreui")&&!e.startsWith("coreuiConfig"));for(const n of i){let i=n.replace(/^coreui/,"");i=i.charAt(0).toLowerCase()+i.slice(1),t[i]=normalizeData(e.dataset[n])}return t},getDataAttribute:(e,t)=>normalizeData(e.getAttribute(`data-coreui-${normalizeDataKey(t)}`))};class Config{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const i=isElement(t)?Manipulator.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof i?i:{},...isElement(t)?Manipulator.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e,t=this.constructor.DefaultType){for(const[i,n]of Object.entries(t)){const t=e[i],s=isElement(t)?"element":toType(t);if(!new RegExp(n).test(s))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${i}" provided type "${s}" but expected type "${n}".`)}}}const VERSION="5.23.0";class BaseComponent extends Config{constructor(e,t){super(),(e=getElement(e))&&(this._element=e,this._config=this._getConfig(t),Data.set(this._element,this.constructor.DATA_KEY,this))}dispose(){Data.remove(this._element,this.constructor.DATA_KEY),EventHandler.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t,i=!0){executeAfterTransition(e,t,i)}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return Data.get(getElement(e),this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return VERSION}static get DATA_KEY(){return`coreui.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const getSelector=e=>{let t=e.getAttribute("data-coreui-target");if(!t||"#"===t){let i=e.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),t=i&&"#"!==i?i.trim():null}return t?t.split(",").map(e=>parseSelector(e)).join(","):null},SelectorEngine={find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter(e=>e.matches(t)),parents(e,t){const i=[];let n=e.parentNode.closest(t);for(;n;)i.push(n),n=n.parentNode.closest(t);return i},prev(e,t){let i=e.previousElementSibling;for(;i;){if(i.matches(t))return[i];i=i.previousElementSibling}return[]},next(e,t){let i=e.nextElementSibling;for(;i;){if(i.matches(t))return[i];i=i.nextElementSibling}return[]},focusableChildren(e){const t=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(e=>`${e}:not([tabindex^="-"])`).join(",");return this.find(t,e).filter(e=>!isDisabled(e)&&isVisible(e))},getSelectorFromElement(e){const t=getSelector(e);return t&&SelectorEngine.findOne(t)?t:null},getElementFromSelector(e){const t=getSelector(e);return t?SelectorEngine.findOne(t):null},getMultipleElementsFromSelector(e){const t=getSelector(e);return t?SelectorEngine.find(t):[]}},enableDismissTrigger=(e,t="hide")=>{const i=`click.dismiss${e.EVENT_KEY}`,n=e.NAME;EventHandler.on(document,i,`[data-coreui-dismiss="${n}"]`,function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),isDisabled(this))return;const s=SelectorEngine.getElementFromSelector(this)||this.closest(`.${n}`);e.getOrCreateInstance(s)[t]()})},NAME$t="alert",DATA_KEY$o="coreui.alert",EVENT_KEY$p=`.${DATA_KEY$o}`,EVENT_CLOSE=`close${EVENT_KEY$p}`,EVENT_CLOSED=`closed${EVENT_KEY$p}`,CLASS_NAME_FADE$5="fade",CLASS_NAME_SHOW$g="show";class Alert extends BaseComponent{static get NAME(){return NAME$t}close(){if(EventHandler.trigger(this._element,EVENT_CLOSE).defaultPrevented)return;this._element.classList.remove("show");const e=this._element.classList.contains("fade");this._queueCallback(()=>this._destroyElement(),this._element,e)}_destroyElement(){this._element.remove(),EventHandler.trigger(this._element,EVENT_CLOSED),this.dispose()}static jQueryInterface(e){return this.each(function(){const t=Alert.getOrCreateInstance(this);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}})}}enableDismissTrigger(Alert,"close"),defineJQueryPlugin(Alert);const ARIA_ATTRIBUTE_PATTERN=/^aria-[\w-]*$/i,DefaultAllowlist={"*":["class","dir","id","lang","role",ARIA_ATTRIBUTE_PATTERN],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],dd:[],div:[],dl:[],dt:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},uriAttributes=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),SAFE_URL_PATTERN=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,allowedAttribute=(e,t)=>{const i=e.nodeName.toLowerCase();return t.includes(i)?!uriAttributes.has(i)||Boolean(SAFE_URL_PATTERN.test(e.nodeValue)):t.filter(e=>e instanceof RegExp).some(e=>e.test(i))};function sanitizeHtml(e,t,i){if(!e.length)return e;if(i&&"function"==typeof i)return i(e);const n=(new window.DOMParser).parseFromString(e,"text/html"),s=[].concat(...n.body.querySelectorAll("*"));for(const e of s){const i=e.nodeName.toLowerCase();if(!Object.keys(t).includes(i)){e.remove();continue}const n=[].concat(...e.attributes),s=[].concat(t["*"]||[],t[i]||[]);for(const t of n)allowedAttribute(t,s)||e.removeAttribute(t.nodeName)}return n.body.innerHTML}const NAME$s="autocomplete",DATA_KEY$n="coreui.autocomplete",EVENT_KEY$o=`.${DATA_KEY$n}`,DATA_API_KEY$j=".data-api",ARROW_UP_KEY$6="ArrowUp",ARROW_DOWN_KEY$6="ArrowDown",BACKSPACE_KEY$2="Backspace",DELETE_KEY$1="Delete",ENTER_KEY$4="Enter",ESCAPE_KEY$6="Escape",TAB_KEY$6="Tab",RIGHT_MOUSE_BUTTON$5=2,EVENT_BLUR$1=`blur${EVENT_KEY$o}`,EVENT_CHANGED$1=`changed${EVENT_KEY$o}`,EVENT_CLICK$6=`click${EVENT_KEY$o}`,EVENT_HIDE$c=`hide${EVENT_KEY$o}`,EVENT_HIDDEN$c=`hidden${EVENT_KEY$o}`,EVENT_INPUT$4=`input${EVENT_KEY$o}`,EVENT_KEYDOWN$8=`keydown${EVENT_KEY$o}`,EVENT_KEYUP$1=`keyup${EVENT_KEY$o}`,EVENT_SHOW$c=`show${EVENT_KEY$o}`,EVENT_SHOWN$c=`shown${EVENT_KEY$o}`,EVENT_CLICK_DATA_API$h=`click${EVENT_KEY$o}.data-api`,EVENT_KEYUP_DATA_API$5=`keyup${EVENT_KEY$o}.data-api`,EVENT_LOAD_DATA_API$f=`load${EVENT_KEY$o}.data-api`,CLASS_NAME_AUTOCOMPLETE="autocomplete",CLASS_NAME_BUTTONS="autocomplete-buttons",CLASS_NAME_CLEANER$3="autocomplete-cleaner",CLASS_NAME_DISABLED$5="disabled",CLASS_NAME_DROPDOWN$2="autocomplete-dropdown",CLASS_NAME_INDICATOR$2="autocomplete-indicator",CLASS_NAME_INPUT$2="autocomplete-input",CLASS_NAME_INPUT_HINT="autocomplete-input-hint",CLASS_NAME_INPUT_GROUP$3="autocomplete-input-group",CLASS_NAME_LABEL$1="label",CLASS_NAME_OPTGROUP$1="autocomplete-optgroup",CLASS_NAME_OPTGROUP_LABEL$1="autocomplete-optgroup-label",CLASS_NAME_OPTION$1="autocomplete-option",CLASS_NAME_OPTIONS$1="autocomplete-options",CLASS_NAME_OPTIONS_EMPTY$1="autocomplete-options-empty",CLASS_NAME_SELECTED$2="selected",CLASS_NAME_SHOW$f="show",SELECTOR_DATA_TOGGLE$h='[data-coreui-toggle="autocomplete"]:not(.disabled)',SELECTOR_DATA_TOGGLE_SHOWN$4=".autocomplete:not(.disabled).show",SELECTOR_INDICATOR=".autocomplete-indicator",SELECTOR_OPTGROUP$1=".autocomplete-optgroup",SELECTOR_OPTION$1=".autocomplete-option",SELECTOR_OPTIONS$1=".autocomplete-options",SELECTOR_OPTIONS_EMPTY$1=".autocomplete-options-empty",SELECTOR_VISIBLE_ITEMS$2=".autocomplete-options .autocomplete-option:not(.disabled):not(:disabled)",Default$p={allowList:DefaultAllowlist,allowOnlyDefinedOptions:!1,ariaCleanerLabel:"Clear selection",ariaIndicatorLabel:"Toggle visibility of options menu",cleaner:!1,clearSearchOnSelect:!0,container:!1,disabled:!1,highlightOptionsOnSearch:!1,id:null,indicator:!1,invalid:!1,name:null,options:!1,optionsGroupsTemplate:null,optionsMaxHeight:"auto",optionsTemplate:null,placeholder:null,required:!1,sanitize:!0,sanitizeFn:null,search:null,searchNoResultsLabel:!1,showHints:!1,valid:!1,value:null},DefaultType$p={allowList:"object",allowOnlyDefinedOptions:"boolean",ariaCleanerLabel:"string",ariaIndicatorLabel:"string",cleaner:"boolean",clearSearchOnSelect:"boolean",container:"(string|element|boolean)",disabled:"boolean",highlightOptionsOnSearch:"boolean",id:"(string|null)",indicator:"boolean",invalid:"boolean",name:"(string|null)",options:"(array|null)",optionsGroupsTemplate:"(function|null)",optionsMaxHeight:"(number|string)",optionsTemplate:"(function|null)",placeholder:"(string|null)",required:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",search:"(array|string|null)",searchNoResultsLabel:"boolean|string",showHints:"boolean",valid:"boolean",value:"(number|string|null)"};class Autocomplete extends BaseComponent{constructor(e,t){var i;super(e,t),this._uniqueId=null!=(i=this._config.id)?i:getUID(`${this.constructor.NAME}`),this._indicatorElement=null,this._inputElement=null,this._inputHintElement=null,this._togglerElement=null,this._optionsElement=null,this._menu=null,this._selected=[],this._options=this._getOptionsFromConfig(),this._popper=null,this._search="",this._createAutocomplete(),this._addEventListeners(),Data.set(this._element,DATA_KEY$n,this)}static get Default(){return Default$p}static get DefaultType(){return DefaultType$p}static get NAME(){return NAME$s}toggle(){return this._isShown()?this.hide():this.show()}show(){this._config.disabled||this._isShown()||(this._config.searchNoResultsLabel||0!==this._flattenOptions().filter(e=>e.label.toLowerCase().includes(this._search.toLowerCase())).length)&&(EventHandler.trigger(this._element,EVENT_SHOW$c),this._element.classList.add("show"),this._inputElement.setAttribute("aria-expanded","true"),this._config.container&&(this._menu.style.minWidth=`${this._element.offsetWidth}px`,this._menu.classList.add("show")),EventHandler.trigger(this._element,EVENT_SHOWN$c),this._createPopper())}hide(){EventHandler.trigger(this._element,EVENT_HIDE$c),this._popper&&this._popper.destroy(),this._element.classList.remove("show"),this._inputElement.setAttribute("aria-expanded","false"),this._config.container&&this._menu.classList.remove("show"),this._inputHintElement&&(this._inputHintElement.value=""),EventHandler.trigger(this._element,EVENT_HIDDEN$c)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}clear(){this.deselectAll(),this.search(""),this._filterOptionsList(),this._inputElement.value="",EventHandler.trigger(this._element,EVENT_CHANGED$1,{value:this._selected})}search(e){this._search=e.length>0?e.toLowerCase():"",this._isExternalSearch()||this._filterOptionsList(),EventHandler.trigger(this._element,EVENT_INPUT$4,{value:e})}update(e){e.value&&this.deselectAll(),this._config={...this._config,...this._configAfterMerge(e)},this._options=this._getOptionsFromConfig(),this._optionsElement.innerHTML="",this._createOptions(this._optionsElement,this._options)}deselectAll(e=this._selected){if(0!==this._selected.length)for(const t of e)t.disabled||(Array.isArray(t.options)?this.deselectAll(t.options):(this._deselectOption(t.value),this._updateCleaner()))}_flattenOptions(e=this._options,t=[]){for(const i of e)i&&Array.isArray(i.options)?this._flattenOptions(i.options,t):t.push(i);return t}_getClassNames(){return this._element.classList.value.split(" ")}_highlightOption(e){const t=new RegExp(this._search,"gi");return e.replace(t,e=>`<strong>${e}</strong>`)}_isExternalSearch(){return Array.isArray(this._config.search)&&this._config.search.includes("external")}_isGlobalSearch(){return Array.isArray(this._config.search)&&this._config.search.includes("global")}_isVisible(e){return"none"!==window.getComputedStyle(e).display}_isShown(){return this._element.classList.contains("show")}_addEventListeners(){EventHandler.on(this._element,EVENT_CLICK$6,e=>{this._config.disabled||e.target.closest(SELECTOR_INDICATOR)||this.show()}),EventHandler.on(this._element,EVENT_KEYDOWN$8,e=>{if("Escape"===e.key)return this.hide(),void(this._config.allowOnlyDefinedOptions&&0===this._selected.length&&(this.search(""),this._inputElement.value=""));!this._isGlobalSearch()||1!==e.key.length&&"Backspace"!==e.key&&"Delete"!==e.key||this._inputElement.focus()}),EventHandler.on(this._menu,EVENT_KEYDOWN$8,e=>{!this._isGlobalSearch()||1!==e.key.length&&"Backspace"!==e.key&&"Delete"!==e.key||this._inputElement.focus()}),EventHandler.on(this._togglerElement,EVENT_KEYDOWN$8,e=>{if(!this._isShown()&&("Enter"===e.key||e.key===ARROW_DOWN_KEY$6))return e.preventDefault(),void this.show();this._isShown()&&e.key===ARROW_DOWN_KEY$6&&(e.preventDefault(),this._selectMenuItem(e))}),EventHandler.on(this._indicatorElement,EVENT_CLICK$6,e=>{e.preventDefault(),this.toggle()}),EventHandler.on(this._inputElement,EVENT_BLUR$1,()=>{const e=this._flattenOptions().filter(e=>e.label.toLowerCase().startsWith(this._inputElement.value.toLowerCase()));this._config.allowOnlyDefinedOptions&&0===this._selected.length&&0===e.length&&this.clear()}),EventHandler.on(this._inputElement,EVENT_KEYDOWN$8,e=>{if(this._isShown()||"Tab"===e.key||this.show(),e.key!==ARROW_DOWN_KEY$6||this._inputElement.value.length!==this._inputElement.selectionStart){if("Tab"===e.key&&this._config.showHints&&this._inputElement.value.length>0){this._inputHintElement.value&&(e.preventDefault(),e.stopPropagation());const t=this._flattenOptions().filter(e=>e.label.toLowerCase().startsWith(this._inputElement.value.toLowerCase()));t.length>0&&this._selectOption(t[0])}if("Enter"===e.key){if(e.preventDefault(),e.stopPropagation(),0===this._inputElement.value.length)return;const t=this._flattenOptions().filter(e=>e.label.toLowerCase()===this._inputElement.value.toLowerCase());t.length>0&&this._selectOption(t[0]),0!==t.length||this._config.allowOnlyDefinedOptions||(EventHandler.trigger(this._element,EVENT_CHANGED$1,{value:this._inputElement.value}),this.hide(),this._config.clearSearchOnSelect&&this.search(""))}}else this._selectMenuItem(e)}),EventHandler.on(this._inputElement,EVENT_KEYUP$1,e=>{if(1===e.key.length||"Backspace"===e.key||"Delete"===e.key){const{value:t}=e.target;if(this.search(t),this._config.showHints){const e=t?this._flattenOptions().filter(e=>e.label.toLowerCase().startsWith(t.toLowerCase())):[];this._inputHintElement.value=e.length>0?`${t}${e[0].label.slice(t.length)}`:""}this._selected.length>0&&(this.deselectAll(),EventHandler.trigger(this._element,EVENT_CHANGED$1,{value:this._selected}))}}),EventHandler.on(this._optionsElement,EVENT_CLICK$6,e=>{e.preventDefault(),e.stopPropagation(),this._onOptionsClick(e.target)}),EventHandler.on(this._cleanerElement,EVENT_CLICK$6,e=>{this._config.disabled||(e.preventDefault(),e.stopPropagation(),this.clear())}),EventHandler.on(this._cleanerElement,EVENT_KEYDOWN$8,e=>{this._config.disabled||"Enter"!==e.key||(e.preventDefault(),e.stopPropagation(),this.clear())}),EventHandler.on(this._optionsElement,EVENT_KEYDOWN$8,e=>{"Enter"===e.key&&this._onOptionsClick(e.target),[ARROW_UP_KEY$6,ARROW_DOWN_KEY$6].includes(e.key)&&(e.preventDefault(),this._selectMenuItem(e))})}_getOptionsFromConfig(e=this._config.options){if(!e||!Array.isArray(e))return[];const t=[];for(const n of e){var i;if(n.options&&Array.isArray(n.options)){const e={...n};delete e.label,delete e.options,t.push({...e,label:n.label,options:this._getOptionsFromConfig(n.options)});continue}const e="string"==typeof n?n:n.label,s=null!=(i=n.value)?i:"string"==typeof n?n:n.label,a=n.selected||this._config.value&&this._config.value===s,r="object"==typeof n?{...n}:{};delete r.label,delete r.value,delete r.selected,delete r.disabled,t.push({...r,label:e,value:String(s),...a&&{selected:!0},...n.disabled&&{disabled:!0}}),a&&this._selected.push({label:n.label,value:String(s)})}return t}_createAutocomplete(){this._element.classList.add("autocomplete"),this._element.classList.toggle("is-invalid",this._config.invalid),this._element.classList.toggle("is-valid",this._config.valid),this._config.disabled&&this._element.classList.add("disabled");for(const e of this._getClassNames())this._element.classList.add(e);this._createInputGroup(),this._createButtons(),this._createOptionsContainer(),this._updateOptionsList()}_createInputGroup(){var e;const t=document.createElement("div");if(t.classList.add(CLASS_NAME_INPUT_GROUP$3),this._togglerElement=t,this._config.search||this._config.disabled||(t.tabIndex=-1),!this._config.disabled&&this._config.showHints){const e=document.createElement("input");e.classList.add(CLASS_NAME_INPUT$2,CLASS_NAME_INPUT_HINT),e.setAttribute("name",(this._config.name||`${this._uniqueId}-hint`).toString()),e.autocomplete="off",e.readOnly=!0,e.tabIndex=-1,e.setAttribute("aria-hidden",!0),t.append(e),this._inputHintElement=e}const i=document.createElement("input");i.classList.add(CLASS_NAME_INPUT$2),i.id=this._uniqueId,i.setAttribute("name",(this._config.name||this._uniqueId).toString()),i.autocomplete="off",i.placeholder=null!=(e=this._config.placeholder)?e:"",i.role="combobox",i.setAttribute("aria-autocomplete","list"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-haspopup","listbox"),this._config.disabled&&(i.setAttribute("disabled",!0),i.tabIndex=-1),this._config.required&&i.setAttribute("required",!0),t.append(i),this._inputElement=i,this._element.append(t)}_createButtons(){if(!this._config.cleaner&&!this._config.indicator)return;const e=document.createElement("div");if(e.classList.add(CLASS_NAME_BUTTONS),!this._config.disabled&&this._config.cleaner){const t=document.createElement("button");t.type="button",t.classList.add(CLASS_NAME_CLEANER$3),t.style.display="none",t.setAttribute("aria-label",this._config.ariaCleanerLabel),e.append(t),this._cleanerElement=t}if(this._config.indicator){const t=document.createElement("button");t.type="button",t.classList.add(CLASS_NAME_INDICATOR$2),t.setAttribute("aria-label",this._config.ariaIndicatorLabel),this._config.disabled&&(t.tabIndex=-1),e.append(t),this._indicatorElement=t,this._indicatorElement=t}this._togglerElement.append(e),this._updateCleaner()}_createPopper(){if(void 0===Popper)throw new TypeError("CoreUI's Auto Complete component require Popper (https://popper.js.org)");const e={modifiers:[{name:"preventOverflow",options:{boundary:"clippingParents"}},{name:"offset",options:{offset:[0,2]}}],placement:isRTL()?"bottom-end":"bottom-start"};this._popper=Popper.createPopper(this._togglerElement,this._menu,e)}_createOptionsContainer(){const e=document.createElement("div");e.classList.add(CLASS_NAME_DROPDOWN$2),e.role="listbox",e.setAttribute("aria-labelledby",this._uniqueId),e.setAttribute("id",`${this._uniqueId}-listbox`);const t=document.createElement("div");t.classList.add(CLASS_NAME_OPTIONS$1),"auto"!==this._config.optionsMaxHeight&&(t.style.maxHeight=`${this._config.optionsMaxHeight}px`,t.style.overflow="auto"),e.append(t);const{container:i}=this._config;i?(this._inputElement.setAttribute("aria-owns",`${this._uniqueId}-listbox`),e.id=`${this._uniqueId}-listbox`,i.append(e)):this._element.append(e),this._createOptions(t,this._options),this._optionsElement=t,this._menu=e}_createOptions(e,t){for(const i of t){if(Array.isArray(i.options)){const t=document.createElement("div");t.classList.add(CLASS_NAME_OPTGROUP$1),t.setAttribute("role","group");const n=document.createElement("div");this._config.optionsGroupsTemplate&&"function"==typeof this._config.optionsGroupsTemplate?n.innerHTML=this._config.sanitize?sanitizeHtml(this._config.optionsGroupsTemplate(i),this._config.allowList,this._config.sanitizeFn):this._config.optionsGroupsTemplate(i):n.textContent=i.label,n.classList.add(CLASS_NAME_OPTGROUP_LABEL$1),t.append(n),this._createOptions(t,i.options),e.append(t);continue}const t=document.createElement("div");t.classList.add(CLASS_NAME_OPTION$1),i.disabled&&(t.classList.add("disabled"),t.setAttribute("aria-disabled","true")),t.dataset.value=i.value,t.tabIndex=0,this._isExternalSearch()&&this._config.highlightOptionsOnSearch&&this._search?t.innerHTML=this._highlightOption(i.label):this._config.optionsTemplate&&"function"==typeof this._config.optionsTemplate?t.innerHTML=this._config.sanitize?sanitizeHtml(this._config.optionsTemplate(i),this._config.allowList,this._config.sanitizeFn):this._config.optionsTemplate(i):t.textContent=i.label,e.append(t)}}_onOptionsClick(e){if(e.classList.contains("label"))return;if(!e.classList.contains(CLASS_NAME_OPTION$1)&&!(e=e.closest(SELECTOR_OPTION$1)))return;const{value:t}=e.dataset,i=this._findOptionByValue(t);i&&(this._selectOption(i),this._inputElement.focus())}_findOptionByValue(e,t=this._options){for(const i of t){if(i.value===e)return i;if(i.options&&Array.isArray(i.options)){const t=this._findOptionByValue(e,i.options);if(t)return t}}return null}_selectOption(e){this.deselectAll(),0===this._selected.filter(t=>t.value===e.value).length&&this._selected.push(e);const t=SelectorEngine.findOne(`[data-value="${e.value}"]`,this._optionsElement);t&&(t.classList.add("selected"),t.setAttribute("aria-selected",!0)),EventHandler.trigger(this._element,EVENT_CHANGED$1,{value:e}),this._inputElement.value=e.label,this._config.showHints&&(this._inputHintElement.value=""),this.hide(),this._config.clearSearchOnSelect&&this.search(""),this._updateCleaner()}_deselectOption(e){this._selected=this._selected.filter(t=>t.value!==e);const t=SelectorEngine.findOne(`[data-value="${e}"]`,this._optionsElement);t&&(t.classList.remove("selected"),t.setAttribute("aria-selected",!1))}_updateCleaner(){this._config.cleaner&&null!==this._cleanerElement&&(this._selected.length>0?this._cleanerElement.style.removeProperty("display"):this._cleanerElement.style.display="none")}_updateOptionsList(e=this._options){for(const t of e)Array.isArray(t.options)?this._updateOptionsList(t.options):t.selected&&this._selectOption(t)}_filterOptionsList(){const e=SelectorEngine.find(SELECTOR_OPTION$1,this._menu);let t=0;for(const i of e){-1===i.textContent.toLowerCase().indexOf(this._search)?i.style.display="none":(this._config.highlightOptionsOnSearch&&!this._config.optionsTemplate&&(i.innerHTML=this._highlightOption(i.textContent)),i.style.removeProperty("display"),t++);const e=i.closest(SELECTOR_OPTGROUP$1);e&&(SelectorEngine.children(e,SELECTOR_OPTION$1).filter(e=>this._isVisible(e)).length>0?e.style.removeProperty("display"):e.style.display="none")}if(t>0)SelectorEngine.findOne(SELECTOR_OPTIONS_EMPTY$1,this._menu)&&SelectorEngine.findOne(SELECTOR_OPTIONS_EMPTY$1,this._menu).remove();else if(0===t){if(this._config.searchNoResultsLabel){const e=document.createElement("div");return e.classList.add(CLASS_NAME_OPTIONS_EMPTY$1),e.innerHTML=this._config.searchNoResultsLabel,void(SelectorEngine.findOne(SELECTOR_OPTIONS_EMPTY$1,this._menu)||SelectorEngine.findOne(SELECTOR_OPTIONS$1,this._menu).append(e))}this.hide()}}_selectMenuItem({key:e,target:t}){const i=SelectorEngine.find(SELECTOR_VISIBLE_ITEMS$2,this._menu).filter(e=>isVisible(e));i.length&&getNextActiveElement(i,t,e===ARROW_DOWN_KEY$6,!i.includes(t)).focus()}_configAfterMerge(e){return!0===e.container&&(e.container=document.body),"object"!=typeof e.container&&"string"!=typeof e.container||(e.container=getElement(e.container)),"string"==typeof e.options&&(e.options=e.options.split(/,\s*/).map(String)),"string"==typeof e.search&&(e.search=e.search.split(/,\s*/).map(String)),e}static autocompleteInterface(e,t){const i=Autocomplete.getOrCreateInstance(e,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}static jQueryInterface(e){return this.each(function(){Autocomplete.autocompleteInterface(this,e)})}static clearMenus(e){if(2===e.button||"keyup"===e.type&&"Tab"!==e.key)return;const t=SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN$4);for(const i of t){const t=Autocomplete.getInstance(i);t&&(e.composedPath().includes(t._element)||(t._element,e.type,t.hide(),t.search(""),t._config.allowOnlyDefinedOptions&&0===t._selected.length&&(t._inputElement.value="")))}}}EventHandler.on(window,EVENT_LOAD_DATA_API$f,()=>{for(const e of SelectorEngine.find(SELECTOR_DATA_TOGGLE$h))Autocomplete.autocompleteInterface(e)}),EventHandler.on(document,EVENT_CLICK_DATA_API$h,Autocomplete.clearMenus),EventHandler.on(document,EVENT_KEYUP_DATA_API$5,Autocomplete.clearMenus),defineJQueryPlugin(Autocomplete);const NAME$r="button",DATA_KEY$m="coreui.button",EVENT_KEY$n=`.${DATA_KEY$m}`,DATA_API_KEY$i=".data-api",CLASS_NAME_ACTIVE$6="active",SELECTOR_DATA_TOGGLE$g='[data-coreui-toggle="button"]',EVENT_CLICK_DATA_API$g=`click${EVENT_KEY$n}.data-api`;class Button extends BaseComponent{static get NAME(){return NAME$r}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(e){return this.each(function(){const t=Button.getOrCreateInstance(this);"toggle"===e&&t[e]()})}}EventHandler.on(document,EVENT_CLICK_DATA_API$g,SELECTOR_DATA_TOGGLE$g,e=>{e.preventDefault();const t=e.target.closest(SELECTOR_DATA_TOGGLE$g);Button.getOrCreateInstance(t).toggle()}),defineJQueryPlugin(Button);let _t,_t2,_t3,_t4,_t5,_t6,_t7,_2=e=>e;const getMondayOfISOWeek1=e=>{const t=new Date(e,0,4),i=t.getDay(),n=0===i?6:i-1,s=new Date(t);return s.setDate(t.getDate()-n),s},getMondayOfISOWeek=(e,t)=>{const i=getMondayOfISOWeek1(e),n=new Date(i);return n.setDate(i.getDate()+7*(t-1)),n},dateToMonthNumber=e=>12*e.getFullYear()+e.getMonth(),isOutsideRange=(e,t,i)=>null!==t&&e<t||null!==i&&e>i,convertIsoWeekToDate=e=>{const[t,i]=e.split(/[Ww]/),n=parseYearSmart(t),s=Number.parseInt(i,10);return getMondayOfISOWeek(n,s)},parseWeekString=e=>{const t=[/^(\d{4})-W(\d{1,2})$/,/^(\d{4})W(\d{1,2})$/,/^(\d{4})\s+W(\d{1,2})$/];for(const i of t){const t=e.trim().match(i);if(t){const e=parseYearSmart(t[1]),i=Number.parseInt(t[2],10);return getMondayOfISOWeek(e,i)}}return convertIsoWeekToDate(e)},parseMonthString=e=>{const t=[/^(\d{2,4})[-/.\s](\d{1,2})$/,/^(\d{1,2})[-/.\s](\d{2,4})$/];for(const i of t){const t=e.trim().match(i);if(t){const e=t[1],i=t[2],n=Number.parseInt(e,10),s=Number.parseInt(i,10);let a,r;if(e.length>=3||n>=100?(a=parseYearSmart(e),r=s-1):i.length>=3||s>=100?(a=parseYearSmart(i),r=n-1):s>=1&&s<=12&&(n>12||n<1)?(a=parseYearSmart(e),r=s-1):(a=parseYearSmart(i),r=n-1),r>=0&&r<=11)return new Date(a,r,1)}}return null},parseYearString=e=>{const t=String(e),i=t.trim().match(/^(\d{2,4})$/);if(i){const e={year:i[1]};return createDateFromYear(e)}return parseLocalDateString(t)},generateDatePatterns=(e,t)=>{const i=new Date(2013,11,31,17,19,22),n=[];try{const s=t?i.toLocaleString(e):i.toLocaleDateString(e);n.push(s)}catch(e){const s=t?i.toLocaleString("en-US"):i.toLocaleDateString("en-US");n.push(s)}const s=["/","-","."," "],a=n[0];let r="/";a.includes("/")?r="/":a.includes("-")?r="-":a.includes(".")&&(r=".");for(const e of s)if(e!==r){const t=r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw(_t||(_t=_2`\$&`))),i=a.replaceAll(new RegExp(t,"g"),e);n.push(i)}return n},buildDateRegexPattern=(e,t)=>{let i=e.replaceAll(/[.*+?^${}()|[\\]\\]/g,"\\$&");return i=i.replace("2013",String.raw(_t2||(_t2=_2`(?<year>\d{2,4})`))).replace("12",String.raw(_t3||(_t3=_2`(?<month>\d{1,2})`))).replace("31",String.raw(_t4||(_t4=_2`(?<day>\d{1,2})`))),t&&(i=i.replaceAll(/17|5/g,String.raw(_t5||(_t5=_2`(?<hour>\d{1,2})`))).replace("19",String.raw(_t6||(_t6=_2`(?<minute>\d{1,2})`))).replace("22",String.raw(_t7||(_t7=_2`(?<second>\d{1,2})`))).replaceAll(/AM|PM/gi,"(?<ampm>[APap][Mm])")),i},tryParseWithPatterns=(e,t,i)=>{for(const n of t){const t=buildDateRegexPattern(n,i),s=new RegExp(`^${t}$`),a=e.trim().match(s);if(null!=a&&a.groups)return a.groups}return null},convertTo24Hour=(e,t)=>{const i=Number.parseInt(e,10);if(!t)return i;const n="pm"===t.toLowerCase();return n&&12!==i?i+12:n||12!==i?i:0},validateTimeComponents=(e,t,i)=>e>=0&&e<=23&&t>=0&&t<=59&&i>=0&&i<=59,validateDateComponents=(e,t)=>{const i=Number.parseInt(e,10)-1,n=Number.parseInt(t,10);return i>=0&&i<=11&&n>=1&&n<=31},createDateWithTime=e=>{const{year:t,month:i,day:n,hour:s,minute:a,second:r,ampm:o}=e,l=parseYearSmart(t),c=Number.parseInt(i,10)-1,_=Number.parseInt(n,10),d=convertTo24Hour(s,o),h=Number.parseInt(null!=a?a:"0",10)||0,E=Number.parseInt(null!=r?r:"0",10)||0;return validateTimeComponents(d,h,E)?new Date(l,c,_,d,h,E):null},createDateOnly=e=>{const{year:t,month:i,day:n}=e;if(!validateDateComponents(i,n))return null;const s=parseYearSmart(t),a=Number.parseInt(i,10)-1,r=Number.parseInt(n,10);return new Date(s,a,r)},getExpectedPartsCount=e=>0===e.length?3:e[0].split(/[-/.\s:]+/).filter(e=>e.length>0).length,parseDayString=(e,t,i)=>{const n=generateDatePatterns(t,i),s=tryParseWithPatterns(e,n,i);if(!s){const t=e.trim(),i=/[-/.:]/.test(t),s=t.split(/[-/.\s:]+/).filter(e=>e.length>0),a=getExpectedPartsCount(n),r=s.length>=a;return i&&r?parseLocalDateString(e):null}if(!("year"in s&&"month"in s&&"day"in s))return null;{const{month:e,day:t,year:i}=s;if(!validateDateComponents(e,t))return null}return i?createDateWithTime(s):createDateOnly(s)},parseLocalDateString=e=>{const t=new Date(Date.parse(e));return Number.isNaN(t.getTime())?null:t},convertToDateObject=(e,t,i="en-US",n=!1)=>{if(null===e)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;const s=e;switch(t){case"week":return parseWeekString(s);case"month":return parseMonthString(s);case"year":return parseYearString(s);default:return parseDayString(s,i,n)}},getLocalDateFromString=(e,t="en-US",i=!1,n="day")=>e&&"string"==typeof e?convertToDateObject(e,n,t,i):null,createGroupsInArray=(e,t)=>{const i=Math.ceil(e.length/t);return Array.from({length:t}).fill("").map((t,n)=>e.slice(n*i,(n+1)*i))},getCalendarDate=(e,t,i)=>0!==t&&"days"===i?new Date(e.getFullYear(),e.getMonth()+t,1):0!==t&&"months"===i?new Date(e.getFullYear()+t,e.getMonth(),1):0!==t&&"years"===i?new Date(e.getFullYear()+12*t,e.getMonth(),1):e,getDateBySelectionType=(e,t)=>{if(null===e)return null;if("week"===t){const{year:t,weekNumber:i}=getISOWeekNumberAndYear(e);return`${t}W${i.toString().padStart(2,"0")}`}if("month"===t){const t=`0${e.getMonth()+1}`.slice(-2);return`${e.getFullYear()}-${t}`}return"year"===t?`${e.getFullYear()}`:e},getMonthsNames=(e,t="short")=>Array.from({length:12},(i,n)=>new Date(2e3,n,1).toLocaleString(e,{month:t})),getYears=(e,t=6)=>Array.from({length:2*t},(i,n)=>e-t+n),getLeadingDays=(e,t,i)=>{const n=[],s=new Date(e,t),a=s.getFullYear(),r=s.getMonth();let o=6-(6-new Date(a,r,1).getDay())-i;i&&(o=o<0?7+o:o);for(let e=-1*o;e<0;e++)n.push({date:new Date(a,r,e+1),month:"previous"});return n},getMonthDays=(e,t)=>{const i=[],n=new Date(e,t+1,0).getDate();for(let s=1;s<=n;s++)i.push({date:new Date(e,t,s),month:"current"});return i},getTrailingDays=(e,t,i,n)=>{const s=[],a=42-(i.length+n.length);for(let i=1;i<=a;i++)s.push({date:new Date(e,t+1,i),month:"next"});return s},getISOWeekNumberAndYear=e=>{const t=new Date(e);t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);const i=new Date(t.getFullYear(),0,4);return{weekNumber:1+Math.round((t.getTime()-i.getTime())/6048e5),year:t.getFullYear()}},getMonthDetails=(e,t,i)=>{const n=getLeadingDays(e,t,i),s=getMonthDays(e,t),a=getTrailingDays(e,t,n,s),r=[...n,...s,...a],o=[];for(const[e,t]of r.entries()){if(e%7!=0&&0!==o.length||o.push({week:{number:0,year:0},days:[]}),(e+1)%7==0){const{weekNumber:e,year:i}=getISOWeekNumberAndYear(t.date),n=o.at(-1);n&&(n.week={number:e,year:i})}const i=o.at(-1);i&&i.days.push(t)}return o},isDateDisabled=(e,t,i,n)=>{if(t&&e<t)return!0;if(i&&e>i)return!0;if(void 0===n)return!1;if("function"==typeof n)return n(e);if(n instanceof Date&&isSameDateAs(e,n))return!0;if(Array.isArray(n)&&n)for(const t of n){if("function"==typeof t&&t(e))return!0;if(Array.isArray(t)&&isDateInRange(e,t[0],t[1]))return!0;if(t instanceof Date&&isSameDateAs(e,t))return!0}return!1},isDateInRange=(e,t,i)=>{const n=removeTimeFromDate(e),s=t?removeTimeFromDate(t):null,a=i?removeTimeFromDate(i):null;return Boolean(s&&a&&s<=n&&n<=a)},isDateSelected=(e,t,i)=>!(null===t||!isSameDateAs(t,e))||!(null===i||!isSameDateAs(i,e)),isDisableDateInRange=(e,t,i)=>{if(e&&t){const n=new Date(e);let s=!1;for(;n<t;)if(n.setDate(n.getDate()+1),isDateDisabled(n,null,null,i)){s=!0;break}return s}return!1},isMonthDisabled=(e,t,i,n)=>{const s=dateToMonthNumber(e),a=t?dateToMonthNumber(t):null,r=i?dateToMonthNumber(i):null;if(isOutsideRange(s,a,r))return!0;if(void 0===n)return!1;const o=t?Math.max(e.getTime(),t.getTime()):e.getTime(),l=i?Math.min(e.getTime(),i.getTime()):new Date((new Date).getFullYear(),11,31).getTime();for(const e=new Date(o);e.getTime()<=l;e.setDate(e.getDate()+1))if(!isDateDisabled(e,t,i,n))return!1;return!1},isMonthSelected=(e,t,i)=>{const n=e.getFullYear(),s=e.getMonth();return null!==t&&n===t.getFullYear()&&s===t.getMonth()||null!==i&&n===i.getFullYear()&&s===i.getMonth()},isMonthInRange=(e,t,i)=>{const n=t?dateToMonthNumber(t):null,s=i?dateToMonthNumber(i):null,a=dateToMonthNumber(e);return Boolean(n&&s&&n<=a&&a<=s)},isSameDateAs=(e,t)=>e instanceof Date&&t instanceof Date?e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear():null===e&&null===t,isToday=e=>{const t=new Date;return isSameDateAs(e,t)},isYearDisabled=(e,t,i,n)=>{const s=e.getFullYear(),a=t?t.getFullYear():null,r=i?i.getFullYear():null;if(isOutsideRange(s,a,r))return!0;if(void 0===n)return!1;const o=t?Math.max(e.getTime(),t.getTime()):e.getTime(),l=i?Math.min(e.getTime(),i.getTime()):new Date((new Date).getFullYear(),11,31).getTime();for(const e=new Date(o);e.getTime()<=l;e.setDate(e.getDate()+1))if(!isDateDisabled(e,t,i,n))return!1;return!1},isYearSelected=(e,t,i)=>{const n=e.getFullYear();return null!==t&&n===t.getFullYear()||null!==i&&n===i.getFullYear()},isYearInRange=(e,t,i)=>{const n=e.getFullYear(),s=t?t.getFullYear():null,a=i?i.getFullYear():null;return Boolean(s&&a&&s<=n&&n<=a)},removeTimeFromDate=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},setTimeFromDate=(e,t)=>{if(null===e)return null;if(!(t instanceof Date))return e;const i=new Date(e);return i.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),i},parseYearSmart=e=>{let t=Number.parseInt(e,10);if(t<100){const e=(new Date).getFullYear();t=100*Math.floor(e/100)+t,t>e+50&&(t-=100)}return t},createDateFromYear=e=>{const{year:t}=e,i=parseYearSmart(t);return new Date(i,0,1)},NAME$q="calendar",DATA_KEY$l="coreui.calendar",EVENT_KEY$m=`.${DATA_KEY$l}`,DATA_API_KEY$h=".data-api",ARROW_UP_KEY$5="ArrowUp",ARROW_RIGHT_KEY$5="ArrowRight",ARROW_DOWN_KEY$5="ArrowDown",ARROW_LEFT_KEY$5="ArrowLeft",ENTER_KEY$3="Enter",SPACE_KEY$1="Space",EVENT_BLUR=`blur${EVENT_KEY$m}`,EVENT_CALENDAR_DATE_CHANGE=`calendarDateChange${EVENT_KEY$m}`,EVENT_CALENDAR_MOUSE_LEAVE=`calendarMouseleave${EVENT_KEY$m}`,EVENT_CELL_HOVER=`cellHover${EVENT_KEY$m}`,EVENT_END_DATE_CHANGE$1=`endDateChange${EVENT_KEY$m}`,EVENT_FOCUS$1=`focus${EVENT_KEY$m}`,EVENT_KEYDOWN$7=`keydown${EVENT_KEY$m}`,EVENT_SELECT_END_CHANGE=`selectEndChange${EVENT_KEY$m}`,EVENT_START_DATE_CHANGE$1=`startDateChange${EVENT_KEY$m}`,EVENT_MOUSEENTER$3=`mouseenter${EVENT_KEY$m}`,EVENT_MOUSELEAVE$3=`mouseleave${EVENT_KEY$m}`,EVENT_LOAD_DATA_API$e=`load${EVENT_KEY$m}.data-api`,EVENT_CLICK_DATA_API$f=`click${EVENT_KEY$m}.data-api`,CLASS_NAME_CALENDAR_CELL="calendar-cell",CLASS_NAME_CALENDAR_CELL_INNER="calendar-cell-inner",CLASS_NAME_CALENDAR_ROW="calendar-row",CLASS_NAME_CALENDARS$1="calendars",CLASS_NAME_SHOW_WEEK_NUMBERS="show-week-numbers",SELECTOR_BTN_DOUBLE_NEXT=".btn-double-next",SELECTOR_BTN_DOUBLE_PREV=".btn-double-prev",SELECTOR_BTN_MONTH=".btn-month",SELECTOR_BTN_NEXT=".btn-next",SELECTOR_BTN_PREV=".btn-prev",SELECTOR_BTN_YEAR=".btn-year",SELECTOR_CALENDAR$1=".calendar",SELECTOR_CALENDAR_CELL=".calendar-cell",SELECTOR_CALENDAR_CELL_CLICKABLE='.calendar-cell[tabindex="0"]',SELECTOR_CALENDAR_ROW=".calendar-row",SELECTOR_CALENDAR_ROW_CLICKABLE='.calendar-row[tabindex="0"]',SELECTOR_DATA_TOGGLE$f='[data-coreui-toggle="calendar"]',Default$o={ariaNavNextMonthLabel:"Next month",ariaNavNextYearLabel:"Next year",ariaNavPrevMonthLabel:"Previous month",ariaNavPrevYearLabel:"Previous year",calendarDate:null,calendars:1,disabledDates:null,endDate:null,firstDayOfWeek:1,locale:"default",maxDate:null,minDate:null,range:!1,selectAdjacementDays:!1,selectEndDate:!1,selectionType:"day",showAdjacementDays:!0,showWeekNumber:!1,startDate:null,weekdayFormat:2,weekNumbersLabel:null},DefaultType$o={ariaNavNextMonthLabel:"string",ariaNavNextYearLabel:"string",ariaNavPrevMonthLabel:"string",ariaNavPrevYearLabel:"string",calendarDate:"(date|number|string|null)",calendars:"number",disabledDates:"(array|date|function|null)",endDate:"(date|number|string|null)",firstDayOfWeek:"number",locale:"string",maxDate:"(date|number|string|null)",minDate:"(date|number|string|null)",range:"boolean",selectAdjacementDays:"boolean",selectEndDate:"boolean",selectionType:"string",showAdjacementDays:"boolean",showWeekNumber:"boolean",startDate:"(date|number|string|null)",weekdayFormat:"(number|string)",weekNumbersLabel:"(string|null)"};class Calendar extends BaseComponent{constructor(e,t){super(e),this._config=this._getConfig(t),this._initializeDates(),this._initializeView(),this._createCalendar(),this._addEventListeners()}static get Default(){return Default$o}static get DefaultType(){return DefaultType$o}static get NAME(){return NAME$q}update(e){this._config=this._getConfig(e),this._initializeDates(),this._initializeView(),this._element.innerHTML="",this._createCalendar()}_focusOnFirstAvailableCell(){const e=SelectorEngine.findOne('.calendar-cell[tabindex="0"]',this._element);e&&e.focus()}_getDate(e){if("week"===this._config.selectionType){const t=SelectorEngine.findOne(".calendar-cell",e.closest(".calendar-row"));return new Date(Manipulator.getDataAttribute(t,"date"))}return new Date(Manipulator.getDataAttribute(e,"date"))}_handleCalendarClick(e){const t=e.target.classList.contains("calendar-cell-inner")?e.target.parentElement:e.target,i=this._getDate(t),n=new Date(i),s=Manipulator.getDataAttribute(t.closest(".calendar"),"calendar-index");return"days"===this._view&&this._setCalendarDate(s?new Date(n.setMonth(n.getMonth()-s)):i),"months"===this._view&&"month"!==this._config.selectionType?(this._setCalendarDate(s?new Date(n.setMonth(n.getMonth()-s)):i),this._view="days",void this._updateCalendar(this._focusOnFirstAvailableCell.bind(this))):"years"===this._view&&"year"!==this._config.selectionType?(this._setCalendarDate(s?new Date(n.setFullYear(n.getFullYear()-s)):i),this._view="months",void this._updateCalendar(this._focusOnFirstAvailableCell.bind(this))):void(isDateDisabled(i,this._minDate,this._maxDate,this._config.disabledDates)||(this._hoverDate=null,this._selectDate(i),this._updateClassNamesAndAriaLabels()))}_handleCalendarKeydown(e){const t=this._getDate(e.target);if("Space"!==e.code&&"Enter"!==e.key||(e.preventDefault(),this._handleCalendarClick(e)),"ArrowRight"===e.key||"ArrowLeft"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key){if(e.preventDefault(),this._maxDate&&t>=convertToDateObject(this._maxDate,this._config.selectionType)&&("ArrowRight"===e.key||"ArrowDown"===e.key))return;if(this._minDate&&t<=convertToDateObject(this._minDate,this._config.selectionType)&&("ArrowLeft"===e.key||"ArrowUp"===e.key))return;let i=e.target;"week"===this._config.selectionType&&-1===i.tabIndex&&(i=i.closest('.calendar-row[tabindex="0"]'));const n=SelectorEngine.find("week"===this._config.selectionType?'.calendar-row[tabindex="0"]':'.calendar-cell[tabindex="0"]',this._element),s=n.indexOf(i),a=0===s,r=s===n.length-1,o={start:s,end:n.length-(s+1)},l={ArrowRight:1,ArrowLeft:-1,ArrowUp:"week"===this._config.selectionType&&"days"===this._view?-1:"days"===this._view?-7:-3,ArrowDown:"week"===this._config.selectionType&&"days"===this._view?1:"days"===this._view?7:3};if("ArrowRight"===e.key&&r||"ArrowDown"===e.key&&o.end<l.ArrowDown||"ArrowLeft"===e.key&&a||"ArrowUp"===e.key&&o.start<Math.abs(l.ArrowUp)){const t=e=>{const t=SelectorEngine.find('.calendar-cell[tabindex="0"], .calendar-row[tabindex="0"]',this._element);t.length&&"ArrowRight"===e&&t[0].focus(),t.length&&"ArrowLeft"===e&&t[t.length-1].focus(),t.length&&"ArrowDown"===e&&t[l.ArrowDown-(n.length-s)].focus(),t.length&&"ArrowUp"===e&&t[t.length-(Math.abs(l.ArrowUp)+1-(s+1))].focus()};return"days"===this._view&&this._modifyCalendarDate(0,"ArrowRight"===e.key||"ArrowDown"===e.key?1:-1,t.bind(this,e.key)),"months"===this._view&&this._modifyCalendarDate("ArrowRight"===e.key||"ArrowDown"===e.key?1:-1,0,t.bind(this,e.key)),void("years"===this._view&&this._modifyCalendarDate("ArrowRight"===e.key||"ArrowDown"===e.key?10:-10,0,t.bind(this,e.key)))}if(0===n[s+l[e.key]].tabIndex)return void n[s+l[e.key]].focus();for(let t=s;t<n.length;"ArrowRight"===e.key||"ArrowDown"===e.key?t++:t--)if(0===n[t+l[e.key]].tabIndex){n[t+l[e.key]].focus();break}}}_handleCalendarMouseEnter(e){const t=e.target.classList.contains("calendar-cell-inner")?e.target.parentElement:e.target,i=this._getDate(t);isDateDisabled(i,this._minDate,this._maxDate,this._config.disabledDates)||(this._hoverDate=setTimeFromDate(i,this._selectEndDate?this._endDate:this._startDate),EventHandler.trigger(this._element,EVENT_CELL_HOVER,{date:getDateBySelectionType(this._hoverDate,this._config.selectionType)}),this._updateClassNamesAndAriaLabels())}_handleCalendarMouseLeave(){this._hoverDate=null,EventHandler.trigger(this._element,EVENT_CELL_HOVER,{date:null}),this._updateClassNamesAndAriaLabels()}_addEventListeners(){EventHandler.on(this._element,EVENT_CLICK_DATA_API$f,'.calendar-cell[tabindex="0"]',e=>{this._handleCalendarClick(e)}),EventHandler.on(this._element,EVENT_KEYDOWN$7,'.calendar-cell[tabindex="0"]',e=>{this._handleCalendarKeydown(e)}),EventHandler.on(this._element,EVENT_MOUSEENTER$3,'.calendar-cell[tabindex="0"]',e=>{this._handleCalendarMouseEnter(e)}),EventHandler.on(this._element,EVENT_MOUSELEAVE$3,'.calendar-cell[tabindex="0"]',()=>{this._handleCalend