mirror of
https://github.com/itflow-org/itflow
synced 2026-08-25 17:05:15 +00:00
7 lines
27 KiB
JavaScript
7 lines
27 KiB
JavaScript
/*!
|
|
* AdminLTE v4.3.1 (https://adminlte.io)
|
|
* Copyright 2014-2026 Colorlib <https://colorlib.com>
|
|
* Licensed under MIT (https://github.com/ColorlibHQ/AdminLTE/blob/master/LICENSE)
|
|
*/
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).adminlte={})}(this,function(e){"use strict";const t=[],n={controller:new AbortController,hasInitialized:!1,isReplaying:!1},s=()=>n.controller.signal,i=()=>{if(!n.hasInitialized){n.hasInitialized=!0,n.isReplaying=!0;try{for(const e of t)e()}finally{n.isReplaying=!1}}},a=e=>{t.push(e),n.hasInitialized&&e()},o=()=>{n.controller.abort(),n.controller=new AbortController,n.hasInitialized=!1},r=()=>{n.isReplaying||(o(),i())};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r,{once:!0}):i(),document.addEventListener("turbo:before-render",o),document.addEventListener("turbo:load",i);const c=new WeakMap,l=e=>{const t=c.get(e)??[];for(const e of t)globalThis.clearTimeout(e);c.delete(e)},d=e=>{for(const t of["height","padding-top","padding-bottom","margin-top","margin-bottom","overflow","transition-duration","transition-property"])e.style.removeProperty(t)},u=(e,t=500)=>{if(l(e),t<=1)return e.style.display="none",void d(e);e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=`${t}ms`,e.style.boxSizing="border-box",e.style.height=`${e.offsetHeight}px`,e.style.overflow="hidden";const n=globalThis.setTimeout(()=>{e.style.height="0",e.style.paddingTop="0",e.style.paddingBottom="0",e.style.marginTop="0",e.style.marginBottom="0"},1),s=globalThis.setTimeout(()=>{e.style.display="none",d(e),c.delete(e)},t);c.set(e,[n,s])},h=(e,t=500)=>{l(e),d(e),e.style.removeProperty("display");let{display:n}=globalThis.getComputedStyle(e);if("none"===n&&(n="block"),e.style.display=n,t<=1)return;const s=e.offsetHeight;e.style.overflow="hidden",e.style.height="0",e.style.paddingTop="0",e.style.paddingBottom="0",e.style.marginTop="0",e.style.marginBottom="0";const i=globalThis.setTimeout(()=>{e.style.boxSizing="border-box",e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=`${t}ms`,e.style.height=`${s}px`,e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom")},1),a=globalThis.setTimeout(()=>{d(e),c.delete(e)},t);c.set(e,[i,a])},m="hold-transition";class p{_element;_holdTransitionTimer;constructor(e){this._element=e,this._holdTransitionTimer=void 0}holdTransition(e=100){this._holdTransitionTimer&&clearTimeout(this._holdTransitionTimer),document.body.classList.add(m),this._holdTransitionTimer=setTimeout(()=>{document.body.classList.remove(m)},e)}}a(()=>{const e=new p(document.body);window.addEventListener("resize",()=>e.holdTransition(200),{signal:s()}),setTimeout(()=>{document.body.classList.add("app-loaded")},400)});const g=new WeakMap;class f{static get NAME(){throw new Error("Component subclasses must override the static NAME getter.")}static get DATA_KEY(){return`lte.${this.NAME}`}static _getInstance(e){return e?g.get(e)?.get(this.DATA_KEY)??null:null}_element;constructor(e){this._element=e;const t=g.get(e)??new Map;g.set(e,t),t.set(this.constructor.DATA_KEY,this)}dispose(){const e=g.get(this._element);e?.delete(this.constructor.DATA_KEY),0===e?.size&&g.delete(this._element)}}const b=(e,t,n={})=>{const s=new CustomEvent(t,{bubbles:!0,cancelable:n.cancelable??!1,detail:n.detail});return e.dispatchEvent(s),s},y="card-widget",v=`.lte.${y}`,_=`collapse${v}`,S=`expand${v}`,E=`remove${v}`,L=`collapsed${v}`,A=`expanded${v}`,T=`removed${v}`,k=`maximized${v}`,w=`minimized${v}`,x="card",q="collapsed-card",M="collapsing-card",$="expanding-card",I="was-collapsed",C="maximized-card",N='[data-lte-toggle="card-remove"]',P='[data-lte-toggle="card-collapse"]',R='[data-lte-toggle="card-maximize"]',z=`.${x}`,B=".card-body",D=".card-footer",O={animationSpeed:500,collapseTrigger:P,removeTrigger:N,maximizeTrigger:R};class F extends f{static get NAME(){return y}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e,t={}){return this.getInstance(e)??new this(e,t)}_parent;_config;constructor(e,t={}){super(e),this._parent=e.closest(z),e.classList.contains(x)&&(this._parent=e),this._config={...O,...t}}collapse(){this._parent&&(b(this._parent,_,{cancelable:!0}).defaultPrevented||(this._parent.classList.add(M),this._parent.classList.remove($),this._parent.querySelectorAll(`:scope > ${B}, :scope > ${D}`).forEach(e=>{e instanceof HTMLElement&&u(e,this._config.animationSpeed)}),setTimeout(()=>{this._parent?.classList.contains(M)&&(this._parent.classList.add(q),this._parent.classList.remove(M),b(this._parent,L))},this._config.animationSpeed)))}expand(){this._parent&&(b(this._parent,S,{cancelable:!0}).defaultPrevented||(this._parent.classList.add($),this._parent.classList.remove(M,q),this._parent.querySelectorAll(`:scope > ${B}, :scope > ${D}`).forEach(e=>{e instanceof HTMLElement&&h(e,this._config.animationSpeed)}),setTimeout(()=>{this._parent?.classList.contains($)&&(this._parent.classList.remove($),b(this._parent,A))},this._config.animationSpeed)))}remove(){if(!this._parent)return;if(b(this._parent,E,{cancelable:!0}).defaultPrevented)return;const e=this._parent;u(e,this._config.animationSpeed),setTimeout(()=>{b(e,T),e.remove(),this.dispose()},this._config.animationSpeed)}toggle(){this._parent?.classList.contains(q)||this._parent?.classList.contains(M)?this.expand():this.collapse()}maximize(){this._parent&&(this._parent.style.height=`${this._parent.offsetHeight}px`,this._parent.style.width=`${this._parent.offsetWidth}px`,this._parent.style.transition="all .15s",setTimeout(()=>{const e=document.querySelector("html");e&&e.classList.add(C),this._parent&&(this._parent.classList.add(C),this._parent.classList.contains(q)&&this._parent.classList.add(I),b(this._parent,k))},150))}minimize(){this._parent&&(this._parent.style.height="auto",this._parent.style.width="auto",this._parent.style.transition="all .15s",setTimeout(()=>{const e=document.querySelector("html");e&&e.classList.remove(C),this._parent&&(this._parent.classList.remove(C),this._parent?.classList.contains(I)&&this._parent.classList.remove(I),b(this._parent,w),setTimeout(()=>{this._parent?.style.removeProperty("height"),this._parent?.style.removeProperty("width"),this._parent?.style.removeProperty("transition")},150))},10))}toggleMaximize(){this._parent?.classList.contains(C)?this.minimize():this.maximize()}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest(P),s=t.closest(N),i=t.closest(R),a=n??s??i;if(!a)return;e.preventDefault();const o=a.closest(z);if(!o)return;const r=F.getOrCreateInstance(o);n?r.toggle():s?r.remove():r.toggleMaximize()});const H="treeview",K=`.lte.${H}`,W=`expand${K}`,Y=`collapse${K}`,j=`expanded${K}`,U=`collapsed${K}`,V=`load${K}`,G="menu-open",J=".nav-item",Q=".nav-link",X=".nav-treeview",Z='[data-lte-toggle="treeview"]',ee={animationSpeed:300,accordion:!0},te=(e,t)=>{const n=e.querySelector(`:scope > ${Q}`);n?.setAttribute("aria-expanded",String(t))};class ne extends f{static get NAME(){return H}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e,t={}){return this.getInstance(e)??new this(e,t)}_config;constructor(e,t={}){super(e),this._config={...ee,...t}}open(){if(b(this._element,W,{cancelable:!0}).defaultPrevented)return;if(this._config.accordion){const e=this._element.parentElement?.querySelectorAll(`${J}.${G}`);e?.forEach(e=>{if(!this._element.contains(e)){e.classList.remove(G),te(e,!1);const t=e?.querySelector(X);t&&u(t,this._config.animationSpeed)}})}this._element.classList.add(G),te(this._element,!0);const e=this._element.querySelector(X);e&&h(e,this._config.animationSpeed),setTimeout(()=>{this._element.classList.contains(G)&&b(this._element,j)},this._config.animationSpeed)}close(){if(b(this._element,Y,{cancelable:!0}).defaultPrevented)return;this._element.classList.remove(G),te(this._element,!1);const e=this._element.querySelector(X);e&&u(e,this._config.animationSpeed),setTimeout(()=>{this._element.classList.contains(G)||b(this._element,U)},this._config.animationSpeed)}toggle(){this._element.classList.contains(G)?this.close():this.open()}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest(Z);if(!n)return;const s=t.closest(J),i=t.closest(Q);if(!s?.querySelector(X))return;"#"!==t.getAttribute("href")&&"#"!==i?.getAttribute("href")||e.preventDefault();const a=n.dataset.accordion,o=n.dataset.animationSpeed,r={accordion:void 0===a?ee.accordion:"true"===a,animationSpeed:void 0===o?ee.animationSpeed:Number(o)};ne.getOrCreateInstance(s,r).toggle()}),a(()=>{document.querySelectorAll(`${J}.${G}`).forEach(e=>{const t=e.querySelector(X);if(t){h(t,0);const n=new Event(V);e.dispatchEvent(n)}}),document.querySelectorAll(Z).forEach(e=>{e.querySelectorAll(J).forEach(e=>{e.querySelector(`:scope > ${X}`)&&te(e,e.classList.contains(G))})})});const se="direct-chat",ie=`.lte.${se}`,ae=`expanded${ie}`,oe=`collapsed${ie}`,re="direct-chat-contacts-open";class ce extends f{static get NAME(){return se}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e){return this.getInstance(e)??new this(e)}toggle(){this._element.classList.contains(re)?(this._element.classList.remove(re),b(this._element,oe)):(this._element.classList.add(re),b(this._element,ae))}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest('[data-lte-toggle="chat-pane"]');if(!n)return;e.preventDefault();const s=n.closest(".direct-chat");s&&ce.getOrCreateInstance(s).toggle()});const le="fullscreen",de=`.lte.${le}`,ue=`maximized${de}`,he=`minimized${de}`,me='[data-lte-toggle="fullscreen"]';function pe(){const e=document.querySelector('[data-lte-icon="maximize"]'),t=document.querySelector('[data-lte-icon="minimize"]'),n=Boolean(document.fullscreenElement);e?.classList.toggle("d-none",n),t?.classList.toggle("d-none",!n);const s=n?ue:he;document.querySelectorAll(me).forEach(e=>{b(e,s)})}class ge extends f{static get NAME(){return le}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e){return this.getInstance(e)??new this(e)}inFullScreen(){document.documentElement.requestFullscreen().catch(()=>{})}outFullscreen(){document.exitFullscreen().catch(()=>{})}toggleFullScreen(){document.fullscreenEnabled&&(document.fullscreenElement?this.outFullscreen():this.inFullScreen())}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest(me);n&&(e.preventDefault(),ge.getOrCreateInstance(n).toggleFullScreen())}),a(()=>{document.addEventListener("fullscreenchange",pe,{signal:s()})});const fe="push-menu",be=`.lte.${fe}`,ye=`open${be}`,ve=`collapse${be}`,_e=`opened${be}`,Se=`collapsed${be}`,Ee="sidebar-overlay",Le="sidebar-collapse",Ae="sidebar-open",Te=".app-sidebar",ke="lte.sidebar.state",we={sidebarBreakpoint:991.98,enablePersistence:!1};class xe extends f{static get NAME(){return fe}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e,t={}){return this.getInstance(e)??new this(e,t)}_config;constructor(e,t={}){super(e),this._config={...we,...t}}isCollapsed(){return document.body.classList.contains(Le)}isExplicitlyOpen(){return document.body.classList.contains(Ae)}isMiniMode(){return document.body.classList.contains("sidebar-mini")}isMobileSize(){return globalThis.innerWidth<=this._config.sidebarBreakpoint}expand(){b(this._element,ye,{cancelable:!0}).defaultPrevented||(document.body.classList.remove(Le),this.isMobileSize()&&document.body.classList.add(Ae),b(this._element,_e))}collapse(){b(this._element,ve,{cancelable:!0}).defaultPrevented||(document.body.classList.remove(Ae),document.body.classList.add(Le),b(this._element,Se))}toggle(){const e=this.isCollapsed();e?this.expand():this.collapse(),this._config.enablePersistence&&this.saveSidebarState(e?Ae:Le)}setupSidebarBreakPoint(){const e=document.querySelector('[class*="sidebar-expand"]');if(!e)return;const t=globalThis.getComputedStyle(e,"::before").getPropertyValue("content");if(!t||"none"===t)return;const n=Number(t.replace(/[^\d.-]/g,""));Number.isNaN(n)||(this._config={...this._config,sidebarBreakpoint:n})}updateStateByResponsiveLogic(){this.isMobileSize()?this.isExplicitlyOpen()||this.collapse():this.isMiniMode()&&this.isCollapsed()||this.expand()}saveSidebarState(e){if(void 0!==globalThis.localStorage)try{localStorage.setItem(ke,e)}catch{}}loadSidebarState(){if(void 0!==globalThis.localStorage)try{const e=localStorage.getItem(ke);e===Le?this.collapse():e===Ae?this.expand():this.updateStateByResponsiveLogic()}catch{this.updateStateByResponsiveLogic()}}clearSidebarState(){if(void 0!==globalThis.localStorage)try{localStorage.removeItem(ke)}catch{}}init(){this.setupSidebarBreakPoint(),this._config.enablePersistence||this.clearSidebarState(),this._config.enablePersistence&&!this.isMobileSize()?this.loadSidebarState():this.isCollapsed()||this.updateStateByResponsiveLogic()}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;if(!t.closest('[data-lte-toggle="sidebar"]'))return;e.preventDefault();const n=document.querySelector(Te);n&&xe.getOrCreateInstance(n).toggle()}),a(()=>{const e=document.querySelector(Te);if(!e)return;const t=e.dataset.sidebarBreakpoint,n=e.dataset.enablePersistence,i={sidebarBreakpoint:void 0===t?we.sidebarBreakpoint:Number(t),enablePersistence:void 0===n?we.enablePersistence:"true"===n},a=xe.getOrCreateInstance(e,i);a.init(),globalThis.matchMedia(`(max-width: ${a._config.sidebarBreakpoint}px)`).addEventListener("change",()=>{a.updateStateByResponsiveLogic()},{signal:s()});const o=document.querySelector(".app-wrapper");let r=o?.querySelector(`:scope > .${Ee}`);r||(r=document.createElement("div"),r.className=Ee,o?.append(r));const c=s();let l=!1;r.addEventListener("touchstart",()=>{l=!1},{passive:!0,signal:c}),r.addEventListener("touchmove",()=>{l=!0},{passive:!0,signal:c}),r.addEventListener("touchend",e=>{l||(e.preventDefault(),a.collapse()),l=!1},{passive:!1,signal:c}),r.addEventListener("click",e=>{e.preventDefault(),a.collapse()},{signal:c})});const qe="lte-theme",Me="data-bs-theme",$e="data-bs-theme-value",Ie=`[${$e}]`,Ce=new Set(["light","dark","auto"]),Ne=e=>Ce.has(e),Pe=()=>"off"===document.documentElement.getAttribute("data-lte-color-mode"),Re=(()=>{const{documentElement:e}=document;if(e.hasAttribute("data-lte-theme-resolved"))return null;const t=e.getAttribute(Me);return t&&Ne(t)?t:null})();class ze{getStoredTheme(){try{const e=localStorage.getItem(qe);return e&&Ne(e)?e:null}catch{return null}}getMarkupTheme(){return Re}getPreferredTheme(){return(this.getStoredTheme()??this.getMarkupTheme())||(this._prefersDark()?"dark":"light")}resolveTheme(e){return"auto"===e?this._prefersDark()?"dark":"light":e}setTheme(e){try{localStorage.setItem(qe,e)}catch{}this._applyTheme(e),this._showActiveTheme(e),document.dispatchEvent(new CustomEvent("changed.lte.color-mode",{detail:{theme:e,resolved:this.resolveTheme(e)}}))}_applyTheme(e){const t=this.resolveTheme(e);document.documentElement.setAttribute(Me,t),document.documentElement.style.colorScheme=t}_prefersDark(){return globalThis.matchMedia("(prefers-color-scheme: dark)").matches}_showActiveTheme(e){document.querySelectorAll(Ie).forEach(t=>{const n=t.getAttribute($e)===e;t.classList.toggle("active",n),t.setAttribute("aria-pressed",String(n)),t.querySelector(".bi-check-lg")?.classList.toggle("d-none",!n)}),document.querySelectorAll("[data-lte-theme-icon]").forEach(t=>{t.classList.toggle("d-none",t.dataset.lteThemeIcon!==e)})}init(){if(Pe())return;const e=this.getPreferredTheme();this._applyTheme(e),this._showActiveTheme(e)}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element)||Pe())return;const n=t.closest(Ie),s=n?.getAttribute($e);s&&Ne(s)&&(new ze).setTheme(s)}),a(()=>{const e=new ze;e.init(),globalThis.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{if(Pe())return;const t=e.getStoredTheme()??e.getMarkupTheme();t&&"auto"!==t||(e._applyTheme("auto"),e._showActiveTheme(t??"auto"))},{signal:s()})});const Be="sidebar-search",De=`filtered.lte.${Be}`,Oe="menu-open",Fe='[data-lte-toggle="sidebar-search"]',He=".nav-item",Ke=".nav-header",We=":scope > .nav-link",Ye=e=>e.querySelector(":scope > .nav-treeview"),je=(e,t,n,s)=>{e.classList.toggle(Oe,n),e.querySelector(We)?.setAttribute("aria-expanded",String(n)),t.style.display=s};class Ue extends f{static get NAME(){return Be}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e){return this.getInstance(e)??new this(e)}_menu;_emptyState;_snapshot=null;constructor(e){super(e);const t=e.dataset.lteTarget,n=e.closest(".app-sidebar")??document;this._menu=t?document.querySelector(t):n.querySelector(".sidebar-menu"),this._emptyState=n.querySelector("[data-lte-search-empty]")}search(e){const t=this._menu;if(!t)return;const n=e.trim().toLowerCase();if(!n)return void this.clear();this._snapshot??=this._takeSnapshot(t);const s=[...t.querySelectorAll(He)],i=new Set;for(const e of s){const t=e.querySelector(We)?.textContent?.replace(/\s+/g," ").trim().toLowerCase();t?.includes(n)&&i.add(e)}for(let e=s.length-1;e>=0;e--){const t=s[e];t.hidden=!(i.has(t)||t.querySelector(`${He}:not([hidden])`))}for(const e of i)for(const t of e.querySelectorAll(He))t.hidden=!1;let a=0;for(const e of s){e.hidden||a++;const t=Ye(e);if(t){const n=!e.hidden&&Boolean(e.querySelector(`${He}:not([hidden])`));je(e,t,n,n?"block":"none")}}for(const e of t.querySelectorAll(Ke))e.hidden=!0;this._emptyState&&(this._emptyState.hidden=a>0),b(this._element,De,{detail:{query:n,matches:a}})}clear(){const e=this._menu;if(e){for(const t of e.querySelectorAll(`${He}, ${Ke}`))t.hidden=!1;if(this._snapshot){for(const[e,t]of this._snapshot){const n=Ye(e);n&&je(e,n,t.open,t.display)}this._snapshot=null}this._emptyState&&(this._emptyState.hidden=!0),b(this._element,De,{detail:{query:"",matches:-1}})}}dispose(){this.clear(),super.dispose()}_takeSnapshot(e){const t=new Map;for(const n of e.querySelectorAll(He)){const e=Ye(n);e&&t.set(n,{open:n.classList.contains(Oe),display:e.style.display})}return t}}document.addEventListener("input",e=>{const t=e.target;t instanceof HTMLInputElement&&t.matches(Fe)&&Ue.getOrCreateInstance(t).search(t.value)}),document.addEventListener("keydown",e=>{const t=e.target;"Escape"===e.key&&t instanceof HTMLInputElement&&t.matches(Fe)&&(t.value="",Ue.getOrCreateInstance(t).clear())}),a(()=>{document.querySelectorAll(Fe).forEach(e=>{e.value&&Ue.getOrCreateInstance(e).search(e.value)})});class Ve{config;liveRegion=null;focusHistory=[];signal=s();constructor(e={}){this.config={announcements:!0,skipLinks:!0,focusManagement:!0,keyboardNavigation:!0,reducedMotion:!0,...e},this.init()}init(){this.config.announcements&&this.createLiveRegion(),this.config.skipLinks&&this.addSkipLinks(),this.config.focusManagement&&this.initFocusManagement(),this.config.keyboardNavigation&&this.initKeyboardNavigation(),this.config.reducedMotion&&this.respectReducedMotion(),this.initErrorAnnouncements(),this.initTableAccessibility(),this.initFormAccessibility()}createLiveRegion(){if(this.liveRegion)return;const e=document.getElementById("live-region");e?this.liveRegion=e:(this.liveRegion=document.createElement("div"),this.liveRegion.id="live-region",this.liveRegion.className="live-region",this.liveRegion.setAttribute("aria-live","polite"),this.liveRegion.setAttribute("aria-atomic","true"),this.liveRegion.setAttribute("role","status"),document.body.append(this.liveRegion))}addSkipLinks(){if(document.querySelector(".skip-links"))return void this.ensureSkipTargets();const e=document.createElement("div");e.className="skip-links";const t=document.createElement("a");t.href="#main",t.className="skip-link",t.textContent="Skip to main content";const n=document.createElement("a");n.href="#navigation",n.className="skip-link",n.textContent="Skip to navigation",e.append(t),e.append(n),document.body.insertBefore(e,document.body.firstChild),this.ensureSkipTargets()}ensureSkipTargets(){const e=[["main",'main, [role="main"]'],["navigation",'nav, [role="navigation"]']];for(const[t,n]of e){const e=document.getElementById(t)??document.querySelector(n);e&&(e.id||(e.id=t),e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"))}}initFocusManagement(){document.addEventListener("keydown",e=>{"Escape"===e.key&&this.handleEscapeKey(e)},{signal:this.signal}),this.initModalFocusManagement(),this.initDropdownFocusManagement()}handleEscapeKey(e){if(!document.querySelector(".modal.show")&&document.querySelector(".dropdown-menu.show")){const t=document.querySelector('[data-bs-toggle="dropdown"][aria-expanded="true"]');t?.click(),e.preventDefault()}}initKeyboardNavigation(){document.addEventListener("keydown",e=>{const t=e.target;t.matches("input, textarea, select, [contenteditable], [contenteditable] *")||(t.closest(".nav, .navbar-nav, .dropdown-menu")&&this.handleMenuNavigation(e),"Enter"!==e.key&&" "!==e.key||!t.hasAttribute("role")||"button"!==t.getAttribute("role")||t.matches('button, input[type="button"], input[type="submit"]')||(e.preventDefault(),t.click()))},{signal:this.signal})}handleMenuNavigation(e){if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"].includes(e.key))return;const t=e.target,n=Array.from(t.closest(".nav, .navbar-nav, .dropdown-menu")?.querySelectorAll("a, button")||[]).filter(e=>null!==e.offsetParent),s=n.indexOf(t);if(-1===s)return;let i;switch(e.key){case"ArrowDown":case"ArrowRight":i=s<n.length-1?s+1:0;break;case"ArrowUp":case"ArrowLeft":i=s>0?s-1:n.length-1;break;case"Home":i=0;break;case"End":i=n.length-1;break;default:return}e.preventDefault(),n[i]?.focus()}respectReducedMotion(){if(globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches&&(document.body.classList.add("reduce-motion"),document.documentElement.style.scrollBehavior="auto",!document.getElementById("adminlte-reduce-motion"))){const e=document.createElement("style");e.id="adminlte-reduce-motion",e.textContent="\n *, *::before, *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n ",document.head.append(e)}}initErrorAnnouncements(){const e=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;t.matches(".alert-danger, .invalid-feedback, .error")&&this.announce(t.textContent||"Error occurred","assertive"),t.matches(".alert-success, .success")&&this.announce(t.textContent||"Success","polite")}})})});e.observe(document.body,{childList:!0,subtree:!0}),this.signal.addEventListener("abort",()=>{e.disconnect()},{once:!0})}initTableAccessibility(){document.querySelectorAll("table").forEach(e=>{if(e.hasAttribute("role")||e.setAttribute("role","table"),e.querySelectorAll("th").forEach(e=>{if(!e.hasAttribute("scope")){const t=e.closest("thead"),n=0===e.cellIndex;t?e.setAttribute("scope","col"):n&&e.setAttribute("scope","row")}}),!e.querySelector("caption")&&e.hasAttribute("title")){const t=document.createElement("caption");t.textContent=e.getAttribute("title")||"",e.insertBefore(t,e.firstChild)}})}initFormAccessibility(){document.querySelectorAll("input, select, textarea").forEach(e=>{const t=e;if(!t.labels?.length&&!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")){const e=t.getAttribute("placeholder");e&&t.setAttribute("aria-label",e)}if(t.hasAttribute("required")){const e=t.labels?.[0];if(e&&!e.querySelector(".required-indicator")){const t=document.createElement("span");t.className="required-indicator sr-only",t.textContent=" (required)",e.append(t)}}t.classList.contains("disable-adminlte-validations")||t.addEventListener("invalid",()=>{this.handleFormError(t)},{signal:this.signal})})}handleFormError(e){e.id||e.name||(e.id=Qe.generateId("field"));const t=`${e.id||e.name}-error`;let n=document.getElementById(t);n||(n=document.createElement("div"),n.id=t,n.className="invalid-feedback",n.setAttribute("role","alert"),e.parentNode?.append(n)),n.textContent=e.validationMessage;const s=(e.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);s.includes(t)||s.push(t),e.setAttribute("aria-describedby",s.join(" ")),e.classList.add("is-invalid"),this.announce(`Error in ${e.labels?.[0]?.textContent||e.name}: ${e.validationMessage}`,"assertive")}initModalFocusManagement(){document.addEventListener("show.bs.modal",()=>{this.focusHistory.push(document.activeElement)},{signal:this.signal}),document.addEventListener("shown.bs.modal",e=>{const t=e.target,n=t.querySelector("[autofocus]")||t.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');n?.focus()},{signal:this.signal}),document.addEventListener("hidden.bs.modal",()=>{const e=this.focusHistory.pop();e?.isConnected&&e.focus()},{signal:this.signal})}initDropdownFocusManagement(){document.addEventListener("shown.bs.dropdown",e=>{const t=e.target.querySelector(".dropdown-menu"),n=t?.querySelector("a, button");n&&n.focus()},{signal:this.signal})}announce(e,t="polite"){this.liveRegion||this.createLiveRegion(),this.liveRegion&&(this.liveRegion.setAttribute("aria-live",t),this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion&&(this.liveRegion.textContent="")},1e3))}focusElement(e){const t=document.querySelector(e);t&&(t.focus(),t.scrollIntoView({behavior:"smooth",block:"center"}))}trapFocus(e){const t=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=Array.from(t),s=n[0],i=n.at(-1);e.addEventListener("keydown",e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===s&&(i?.focus(),e.preventDefault()):document.activeElement===i&&(s.focus(),e.preventDefault()))},{signal:this.signal})}addLandmarks(){if(!document.querySelector("main")){const e=document.querySelector(".app-main");e&&(e.setAttribute("role","main"),e.id||(e.id="main"))}document.querySelectorAll(".navbar-nav, .nav").forEach((e,t)=>{"UL"!==e.tagName&&"OL"!==e.tagName&&(e.hasAttribute("role")||e.setAttribute("role","navigation"),e.hasAttribute("aria-label")||e.setAttribute("aria-label",`Navigation ${t+1}`))});const e=document.querySelector('form[role="search"], .navbar-search');e&&!e.hasAttribute("role")&&e.setAttribute("role","search")}}const Ge=e=>new Ve(e),Je=e=>{const[t,n,s]=(e=>{const t=/^#([\da-f]{3}|[\da-f]{6})$/i.exec(e.trim());if(t){let e=t[1];return 3===e.length&&(e=[...e].map(e=>e+e).join("")),[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16)]}return e.match(/\d+/g)?.map(Number)||[0,0,0]})(e).map(e=>(e/=255)<=.03928?e/12.92:(e+.055)**2.4/1.055**2.4);return.2126*t+.7152*n+.0722*s},Qe={checkColorContrast:(e,t)=>{const n=Je(e),s=Je(t),i=(Math.max(n,s)+.05)/(Math.min(n,s)+.05);return{ratio:Math.round(100*i)/100,passes:i>=4.5}},generateId:(e="a11y")=>`${e}-${Math.random().toString(36).slice(2,11)}`,isFocusable:e=>["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].some(t=>e.matches(t))};a(()=>{Ge({announcements:!0,skipLinks:!0,focusManagement:!0,keyboardNavigation:!0,reducedMotion:!0}).addLandmarks()}),e.CardWidget=F,e.ColorMode=ze,e.DirectChat=ce,e.FullScreen=ge,e.Layout=p,e.PushMenu=xe,e.SidebarSearch=Ue,e.Treeview=ne,e.initAccessibility=Ge,e.initialize=r,e.teardown=o});
|
|
//# sourceMappingURL=adminlte.min.js.map
|