@expressivecss/expressive 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +162 -7
- package/README.md +1 -1
- package/dist/css/expressive.css +230 -99
- package/dist/css/expressive.css.map +1 -1
- package/dist/css/expressive.min.css +1 -1
- package/dist/css/expressive.min.css.map +1 -1
- package/dist/js/chunks/{chunk-IMUPRRI6.mjs → chunk-3VOK6J7U.mjs} +3 -3
- package/dist/js/chunks/{chunk-XDB3G6RL.mjs → chunk-6N2XAEFK.mjs} +15 -4
- package/dist/js/chunks/{chunk-XDB3G6RL.mjs.map → chunk-6N2XAEFK.mjs.map} +2 -2
- package/dist/js/chunks/{chunk-MISGHDUU.mjs → chunk-6OMRGML6.mjs} +9 -7
- package/dist/js/chunks/{chunk-MISGHDUU.mjs.map → chunk-6OMRGML6.mjs.map} +2 -2
- package/dist/js/chunks/{chunk-A3BJA7V4.mjs → chunk-6WLSDZ4O.mjs} +2 -2
- package/dist/js/chunks/{chunk-JODJAGFS.mjs → chunk-CKQP6P76.mjs} +31 -8
- package/dist/js/chunks/chunk-CKQP6P76.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KR44BSYQ.mjs → chunk-DLWYKFEI.mjs} +3 -3
- package/dist/js/chunks/{chunk-SLFNPY5M.mjs → chunk-EC63CHXU.mjs} +2 -2
- package/dist/js/chunks/chunk-G3I5H2U3.mjs +7 -0
- package/dist/js/chunks/{chunk-PMBPAFAS.mjs.map → chunk-G3I5H2U3.mjs.map} +1 -1
- package/dist/js/chunks/{chunk-LZVBJ33S.mjs → chunk-GZWPXXY6.mjs} +15 -8
- package/dist/js/chunks/chunk-GZWPXXY6.mjs.map +7 -0
- package/dist/js/chunks/{chunk-74N6U5JJ.mjs → chunk-H2WA4XHH.mjs} +36 -35
- package/dist/js/chunks/chunk-H2WA4XHH.mjs.map +7 -0
- package/dist/js/chunks/{chunk-XFJ452AZ.mjs → chunk-HB6IW7QQ.mjs} +5 -6
- package/dist/js/chunks/{chunk-XFJ452AZ.mjs.map → chunk-HB6IW7QQ.mjs.map} +2 -2
- package/dist/js/chunks/{chunk-AYYYWUJ4.mjs → chunk-HLDXZ7XB.mjs} +17 -11
- package/dist/js/chunks/chunk-HLDXZ7XB.mjs.map +7 -0
- package/dist/js/chunks/{chunk-7GKXUG4B.mjs → chunk-HNFSMIBY.mjs} +18 -18
- package/dist/js/chunks/{chunk-D4UZ4HFN.mjs → chunk-IFXVDDDH.mjs} +23 -11
- package/dist/js/chunks/chunk-IFXVDDDH.mjs.map +7 -0
- package/dist/js/chunks/{chunk-QSQ24FYT.mjs → chunk-LTWPGFBR.mjs} +2 -2
- package/dist/js/chunks/{chunk-QSQ24FYT.mjs.map → chunk-LTWPGFBR.mjs.map} +2 -2
- package/dist/js/chunks/{chunk-I5KR22BY.mjs → chunk-LWBQIX5J.mjs} +15 -15
- package/dist/js/chunks/chunk-LWBQIX5J.mjs.map +7 -0
- package/dist/js/chunks/{chunk-GY2Z5CJ2.mjs → chunk-NNYP33NB.mjs} +67 -32
- package/dist/js/chunks/chunk-NNYP33NB.mjs.map +7 -0
- package/dist/js/chunks/{chunk-VAS6JQ6P.mjs → chunk-PIJ2TAR3.mjs} +3 -3
- package/dist/js/chunks/{chunk-JR24UB4X.mjs → chunk-PSSHQWCX.mjs} +2 -2
- package/dist/js/chunks/{chunk-PIIAEYAJ.mjs → chunk-QDAL4IYN.mjs} +2 -2
- package/dist/js/chunks/{chunk-FRB7TOCS.mjs → chunk-QV2JAWIZ.mjs} +2 -2
- package/dist/js/chunks/{chunk-N3UHGN3N.mjs → chunk-QVVEWBOF.mjs} +3 -3
- package/dist/js/chunks/{chunk-CDW6WIRT.mjs → chunk-RFZZCYVU.mjs} +18 -11
- package/dist/js/chunks/chunk-RFZZCYVU.mjs.map +7 -0
- package/dist/js/chunks/{chunk-TYM6U5DY.mjs → chunk-UAEAQBRC.mjs} +2 -2
- package/dist/js/chunks/{chunk-7UXHSYIA.mjs → chunk-UBLRRJ7N.mjs} +3 -3
- package/dist/js/chunks/{chunk-EP3CVKB5.mjs → chunk-UEZUJQ66.mjs} +8 -5
- package/dist/js/chunks/chunk-UEZUJQ66.mjs.map +7 -0
- package/dist/js/chunks/{chunk-JNPIWFJT.mjs → chunk-UNEMYWEW.mjs} +3 -3
- package/dist/js/chunks/{chunk-JKNPQQWY.mjs → chunk-WJXDBPXQ.mjs} +28 -12
- package/dist/js/chunks/chunk-WJXDBPXQ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-XO5WX3TK.mjs → chunk-YDCS5S3J.mjs} +2 -2
- package/dist/js/chunks/{chunk-TK6PX2GC.mjs → chunk-YSBCHYXP.mjs} +16 -8
- package/dist/js/chunks/chunk-YSBCHYXP.mjs.map +7 -0
- package/dist/js/expressive.cjs +263 -133
- package/dist/js/expressive.cjs.map +2 -2
- package/dist/js/expressive.js +263 -133
- package/dist/js/expressive.js.map +2 -2
- package/dist/js/expressive.min.js +9 -9
- package/dist/js/expressive.min.js.map +3 -3
- package/dist/js/expressive.mjs +30 -30
- package/dist/js/internal/behaviors/bottomSheets.mjs +3 -3
- package/dist/js/internal/behaviors/dialogs.mjs +2 -2
- package/dist/js/internal/behaviors/forms.mjs +2 -2
- package/dist/js/internal/behaviors/sheetDrag.mjs +2 -2
- package/dist/js/internal/behaviors/sideSheets.mjs +3 -3
- package/dist/js/internal/components/appBar.mjs +2 -2
- package/dist/js/internal/components/autocomplete.mjs +4 -4
- package/dist/js/internal/components/buttonGroup.mjs +2 -2
- package/dist/js/internal/components/buttons.mjs +3 -3
- package/dist/js/internal/components/cards.mjs +3 -3
- package/dist/js/internal/components/carousel.mjs +3 -3
- package/dist/js/internal/components/characterCounter.mjs +2 -2
- package/dist/js/internal/components/chips.mjs +5 -5
- package/dist/js/internal/components/datepicker.mjs +6 -6
- package/dist/js/internal/components/expandingCard.mjs +3 -3
- package/dist/js/internal/components/index.mjs +23 -23
- package/dist/js/internal/components/lightbox.mjs +3 -3
- package/dist/js/internal/components/menu.mjs +3 -3
- package/dist/js/internal/components/navigationRail.mjs +2 -2
- package/dist/js/internal/components/registry.mjs +24 -24
- package/dist/js/internal/components/scrollspy.mjs +2 -2
- package/dist/js/internal/components/select.mjs +4 -4
- package/dist/js/internal/components/slider.mjs +3 -3
- package/dist/js/internal/components/snackbar.mjs +2 -2
- package/dist/js/internal/components/tabs.mjs +4 -4
- package/dist/js/internal/components/timepicker.mjs +4 -4
- package/dist/js/internal/components/tooltip.mjs +3 -3
- package/dist/js/internal/core/component.mjs +1 -1
- package/dist/js/internal/core/utils.mjs +1 -1
- package/dist/js/internal/plugins/dockedDisplayPlugin.mjs +2 -2
- package/dist/js/modular.mjs +30 -30
- package/dist/types/components/appBar.d.ts +1 -1
- package/dist/types/components/datepicker.d.ts +5 -2
- package/dist/types/components/menu.d.ts +1 -0
- package/dist/types/components/slider.d.ts +1 -0
- package/dist/types/components/snackbar.d.ts +6 -0
- package/dist/types/components/timepicker.d.ts +4 -1
- package/dist/types/components/tooltip.d.ts +2 -1
- package/dist/types/modular.d.ts +1 -1
- package/package.json +1 -1
- package/src/sass/components/_carousel.scss +9 -7
- package/src/sass/components/_navbar.scss +11 -6
- package/src/sass/components/_page-footer.scss +0 -11
- package/src/sass/components/_progress.scss +25 -6
- package/src/sass/components/_snackbar.scss +1 -1
- package/src/sass/components/_timepicker.scss +2 -2
- package/src/sass/components/_toolbar.scss +1 -1
- package/src/sass/components/forms/_checkboxes.scss +2 -2
- package/src/sass/components/forms/_input-fields.scss +35 -15
- package/src/sass/components/forms/_radio-buttons.scss +2 -2
- package/src/sass/components/forms/_slider.scss +51 -29
- package/src/sass/components/forms/_switches.scss +3 -3
- package/src/sass/utilities/_helpers.scss +14 -0
- package/src/sass/utilities/_spacing.scss +29 -23
- package/src/sass/utilities/_visibility.scss +3 -2
- package/dist/js/chunks/chunk-74N6U5JJ.mjs.map +0 -7
- package/dist/js/chunks/chunk-AYYYWUJ4.mjs.map +0 -7
- package/dist/js/chunks/chunk-CDW6WIRT.mjs.map +0 -7
- package/dist/js/chunks/chunk-D4UZ4HFN.mjs.map +0 -7
- package/dist/js/chunks/chunk-EP3CVKB5.mjs.map +0 -7
- package/dist/js/chunks/chunk-GY2Z5CJ2.mjs.map +0 -7
- package/dist/js/chunks/chunk-I5KR22BY.mjs.map +0 -7
- package/dist/js/chunks/chunk-JKNPQQWY.mjs.map +0 -7
- package/dist/js/chunks/chunk-JODJAGFS.mjs.map +0 -7
- package/dist/js/chunks/chunk-LZVBJ33S.mjs.map +0 -7
- package/dist/js/chunks/chunk-PMBPAFAS.mjs +0 -7
- package/dist/js/chunks/chunk-TK6PX2GC.mjs.map +0 -7
- /package/dist/js/chunks/{chunk-IMUPRRI6.mjs.map → chunk-3VOK6J7U.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-A3BJA7V4.mjs.map → chunk-6WLSDZ4O.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-KR44BSYQ.mjs.map → chunk-DLWYKFEI.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-SLFNPY5M.mjs.map → chunk-EC63CHXU.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-7GKXUG4B.mjs.map → chunk-HNFSMIBY.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-VAS6JQ6P.mjs.map → chunk-PIJ2TAR3.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-JR24UB4X.mjs.map → chunk-PSSHQWCX.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-PIIAEYAJ.mjs.map → chunk-QDAL4IYN.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-FRB7TOCS.mjs.map → chunk-QV2JAWIZ.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-N3UHGN3N.mjs.map → chunk-QVVEWBOF.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-TYM6U5DY.mjs.map → chunk-UAEAQBRC.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-7UXHSYIA.mjs.map → chunk-UBLRRJ7N.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-JNPIWFJT.mjs.map → chunk-UNEMYWEW.mjs.map} +0 -0
- /package/dist/js/chunks/{chunk-XO5WX3TK.mjs.map → chunk-YDCS5S3J.mjs.map} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var Expressive=(()=>{var dt=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var Vt=Object.prototype.hasOwnProperty;var qt=(d,o)=>{for(var t in o)dt(d,t,{get:o[t],enumerable:!0})},$t=(d,o,t,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Ft(o))!Vt.call(d,i)&&i!==t&&dt(d,i,{get:()=>o[i],enumerable:!(e=Wt(o,i))||e.enumerable});return d};var Kt=d=>$t(dt({},"__esModule",{value:!0}),d);var be={};qt(be,{AppBar:()=>Y,AutoInit:()=>wt,Autocomplete:()=>B,BottomSheets:()=>K,ButtonGroup:()=>X,Cards:()=>R,Carousel:()=>W,CharacterCounter:()=>rt,Chips:()=>N,Datepicker:()=>Z,Dialogs:()=>$,ExpandingCard:()=>P,FloatingActionButton:()=>G,FormSelect:()=>k,Forms:()=>U,Lightbox:()=>Q,Menu:()=>O,NavigationRail:()=>tt,Range:()=>V,ScrollSpy:()=>J,SideSheets:()=>z,Slider:()=>V,Snackbar:()=>lt,Tabs:()=>et,Timepicker:()=>it,Tooltip:()=>st,version:()=>ye});var S=class S{static onDocumentReady(o){typeof document>"u"||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",o,{once:!0}):o())}static guid(){return globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}static portalRoot(o){let t=o.getRootNode();return t.host?t:document.body}static getElementById(o,t){let e=o.getRootNode();return e.getElementById?e.getElementById(t):document.getElementById(t)}static checkWithinContainer(o,t,e){let i={top:!1,right:!1,bottom:!1,left:!1},s=o.getBoundingClientRect(),n=o===document.body?Math.max(s.bottom,window.innerHeight):s.bottom,a=o.scrollLeft,c=o.scrollTop,h=t.left-a,l=t.top-c;return(h<s.left+e||h<e)&&(i.left=!0),(h+t.width>s.right-e||h+t.width>window.innerWidth-e)&&(i.right=!0),(l<s.top+e||l<e)&&(i.top=!0),(l+t.height>n-e||l+t.height>window.innerHeight-e)&&(i.bottom=!0),i}static checkPossibleAlignments(o,t,e,i){let s={top:!0,right:!0,bottom:!0,left:!0,spaceOnTop:null,spaceOnRight:null,spaceOnBottom:null,spaceOnLeft:null},n=getComputedStyle(t).overflow==="visible",a=t.getBoundingClientRect(),c=Math.min(a.height,window.innerHeight),h=Math.min(a.width,window.innerWidth),l=o.getBoundingClientRect(),r=t.scrollLeft,m=t.scrollTop,p=e.left-r,v=e.top-m,E=e.top+l.height-m;return s.spaceOnRight=n?window.innerWidth-(l.left+e.width):h-(p+e.width),s.spaceOnRight<0&&(s.left=!1),s.spaceOnLeft=n?l.right-e.width:p-e.width+l.width,s.spaceOnLeft<0&&(s.right=!1),s.spaceOnBottom=n?window.innerHeight-(l.top+e.height+i):c-(v+e.height+i),s.spaceOnBottom<0&&(s.top=!1),s.spaceOnTop=n?l.bottom-(e.height+i):E-(e.height-i),s.spaceOnTop<0&&(s.bottom=!1),s}static getIdFromTrigger(o){let t=o.dataset.target;return t||(t=o.getAttribute("href"),t?t.slice(1):"")}static getDocumentScrollTop(){return window.scrollY}static getDocumentScrollLeft(){return window.scrollX}static throttle(o,t){let e=null,i=null,s=0;return(...n)=>{let a=Date.now(),c=t-(a-s);c<=0?(clearTimeout(e),e=null,s=a,i=null,o(...n)):e?i=n:(i=n,e=setTimeout(()=>{s=Date.now(),e=null,o(...i??[]),i=null},c))}}static createConfirmationContainer(o,t,e,i,s){let n=document.createElement("div");n.classList.add("confirmation-btns"),o.append(n),this.createButton(n,e,["btn-cancel"],!0,s),this.createButton(n,t,["btn-confirm"],!0,i)}static createButton(o,t,e=[],i=!0,s=null){e=e.concat(["text"]);let n=document.createElement("button");n.className=e.join(" "),n.style.visibility=i?"visible":"hidden",n.type="button",n.tabIndex=i?0:-1,n.innerText=t,typeof s=="function"&&(n.addEventListener("click",s),n.addEventListener("keypress",a=>{a.key===S.keys.ENTER&&s(a)})),o.append(n)}static _setAbsolutePosition(o,t,e,i,s,n="center"){let a=o.offsetHeight,c=o.offsetWidth,h=t.offsetHeight,l=t.offsetWidth,r=o.getBoundingClientRect(),m=0,p=0,v=r.top+S.getDocumentScrollTop(),E=r.left+S.getDocumentScrollLeft();e==="top"?(v+=-h-i,n==="center"&&(E+=c/2-l/2),p=-s):e==="right"?(v+=a/2-h/2,E=c+i,m=s):e==="left"?(v+=a/2-h/2,E=-l-i,m=-s):(v+=a+i,n==="center"&&(E+=c/2-l/2),p=s),n==="right"&&(E+=c-l-i);let b=S._repositionWithinScreen(E,v,l,h,i,s,n);return t.style.top=b.y+"px",t.style.left=b.x+"px",{x:m,y:p}}static _repositionWithinScreen(o,t,e,i,s,n,a){let c=S.getDocumentScrollLeft(),h=S.getDocumentScrollTop(),l=o-c,r=t-h,m={left:l,top:r,width:e,height:i},p;a==="left"||a=="center"?p=s+n:a==="right"&&(p=s-n);let v=S.checkWithinContainer(document.body,m,p);return v.left?l=p:v.right&&(l-=l+e-window.innerWidth),v.top?r=p:v.bottom&&(r-=r+i-window.innerHeight),{x:l+c,y:r+h}}};S.keys={TAB:"Tab",ENTER:"Enter",ESC:"Escape",BACKSPACE:"Backspace",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",DELETE:"Delete"};var u=S;var _=class{constructor(o,t,e){o instanceof HTMLElement||console.error(Error(o+" is not an HTML Element"));let i=e.getInstance(o);i&&i.destroy(),this.el=o}static init(o,t,e){let i=null;if(o instanceof Element)i=new e(o,t);else if(o&&o.length){i=[];for(let s=0;s<o.length;s++)i.push(new e(o[s],t))}return i}static get defaults(){return{}}static getInstance(o){throw new Error("This method must be implemented.")}destroy(){throw new Error("This method must be implemented.")}};var zt={onOpen:null,onClose:null},pt='article:has(> aside[id]:not([id=""])):not(:has(> aside ~ aside)):has(> button.card-reveal-trigger[type="button"], > :not(aside) button.card-reveal-trigger[type="button"])',ut="card-reveal-initialized";function Ut(d){if(d.getAttribute("aria-label")?.trim())return!0;let t=d.getAttribute("aria-labelledby");if(t&&t.trim().split(/\s+/).map(s=>d.ownerDocument.getElementById(s)?.textContent??"").join(" ").trim())return!0;let e=d.cloneNode(!0);return e.querySelectorAll('[aria-hidden="true"]').forEach(i=>i.remove()),!!e.textContent?.trim()}function _t(d,o,t){return d.closest("article")===o&&!t.contains(d)&&!d.disabled&&d.getAttribute("aria-disabled")!=="true"&&Ut(d)}function mt(d){if(d.tagName!=="ARTICLE")return!1;let o=d.querySelectorAll(":scope > aside");return o.length!==1||!o[0].id?!1:Array.from(d.querySelectorAll('button.card-reveal-trigger[type="button"]')).some(t=>_t(t,d,o[0]))}var R=class d extends _{constructor(t,e={}){super(t,e,d);this.isOpen=!1;this._ownsRevealInitializedClass=!1;this._initialAriaControls=new Map;this._lastActivator=null;this._setupEventHandlers=()=>{this._activators.forEach(t=>{t.addEventListener("click",this._handleClickInteraction)}),this.el.addEventListener("keydown",this._handleKeydownEvent)};this._removeEventHandlers=()=>{this._activators.forEach(t=>{t.removeEventListener("click",this._handleClickInteraction)}),this.el.removeEventListener("keydown",this._handleKeydownEvent)};this._handleClickInteraction=t=>{this._lastActivator=t.currentTarget,this._handleRevealEvent()};this._handleKeydownEvent=t=>{(t.target instanceof Element?t.target.closest("article"):null)!==this.el||t.key!=="Escape"||!this.isOpen||(t.preventDefault(),this.close())};this._handleRevealEvent=()=>{this.isOpen?this.close():this.open()};this.open=()=>{this.isOpen||!this.cardReveal||(this.isOpen=!0,this.cardReveal.classList.add("open"),this.cardReveal.inert=!1,this._activators.forEach(t=>t.ariaExpanded="true"),typeof this.options.onOpen=="function"&&this.options.onOpen.call(this,this.el))};this.close=()=>{if(!this.isOpen||!this.cardReveal)return;let t=this.cardReveal.contains(document.activeElement);this.isOpen=!1,this.cardReveal.classList.remove("open"),this.cardReveal.inert=!0,this._activators.forEach(e=>e.ariaExpanded="false"),typeof this.options.onClose=="function"&&this.options.onClose.call(this,this.el),t&&(this._lastActivator??this._activators[0])?.focus()};this.el.Expressive_Cards=this,this.options={...d.defaults,...e};let i=this.el.querySelectorAll(":scope > aside"),s=i.length===1?i[0]:null,n=s?Array.from(this.el.querySelectorAll('button.card-reveal-trigger[type="button"]')).filter(a=>_t(a,this.el,s)):[];this.cardReveal=s?.id&&n.length>0?s:null,this._activators=this.cardReveal?n:[],this.cardReveal&&(this._ownsRevealInitializedClass=!this.el.classList.contains(ut),this.el.classList.add(ut),this._activators.forEach(a=>{this._initialAriaControls.set(a,a.getAttribute("aria-controls")),a.ariaExpanded="false",a.setAttribute("aria-controls",this.cardReveal.id)}),this.cardReveal.classList.remove("open"),this.cardReveal.inert=!0,this._setupEventHandlers())}static get defaults(){return zt}static init(t,e){return super.init(t,e,d)}static getInstance(t){return t.Expressive_Cards}destroy(){this._removeEventHandlers(),this.cardReveal&&(this.cardReveal.classList.remove("open"),this.cardReveal.inert=!1,this._ownsRevealInitializedClass&&this.el.classList.remove(ut)),this._activators.forEach(t=>{t.removeAttribute("aria-expanded");let e=this._initialAriaControls.get(t);e===null?t.removeAttribute("aria-controls"):e!==void 0&&t.setAttribute("aria-controls",e)}),this.isOpen=!1,this._activators=[],this._initialAriaControls.clear(),this._lastActivator=null,this.el.Expressive_Cards=void 0}static Init(){u.onDocumentReady(()=>{Array.from(document.querySelectorAll(pt)).filter(mt).forEach(e=>{e&&e.Expressive_Cards==null&&this.init(e)})})}};var Yt={onOpen:null,onClose:null},ft="article.expanding-card:has(> dialog.expanding-card-dialog)",P=class d extends _{constructor(t,e){super(t,e,d);this.isOpen=!1;this.closeGeneration=0;this._setupEventHandlers=()=>{this.trigger?.addEventListener("click",this.open),this.trigger?.addEventListener("keypress",this._handleTriggerKeypress),this.closeButton?.addEventListener("click",this.close),this.dialog?.addEventListener("cancel",this._handleCancel),this.dialog?.addEventListener("close",this._handleNativeClose)};this._removeEventHandlers=()=>{this.trigger?.removeEventListener("click",this.open),this.trigger?.removeEventListener("keypress",this._handleTriggerKeypress),this.closeButton?.removeEventListener("click",this.close),this.dialog?.removeEventListener("cancel",this._handleCancel),this.dialog?.removeEventListener("close",this._handleNativeClose)};this._handleTriggerKeypress=t=>{(t.key===u.keys.ENTER||t.key===" ")&&(t.preventDefault(),this.open())};this._handleCancel=t=>{t.preventDefault(),this.close()};this._handleNativeClose=()=>{this.dialog.open||(this.closeGeneration++,this.isOpen=!1,this.trigger.ariaExpanded="false",this.dialog.ariaExpanded="false",this.dialog.classList.remove("expanded"))};this._setTransitionOrigin=()=>{if(!this.dialog)return;let t=this.el.getBoundingClientRect(),i=this.el.querySelector(":scope > figure, :scope > img")?.getBoundingClientRect();this.dialog.style.setProperty("--md-comp-expanding-card-from-top",`${Math.max(0,t.top)}px`),this.dialog.style.setProperty("--md-comp-expanding-card-from-right",`${Math.max(0,window.innerWidth-t.right)}px`),this.dialog.style.setProperty("--md-comp-expanding-card-from-bottom",`${Math.max(0,window.innerHeight-t.bottom)}px`),this.dialog.style.setProperty("--md-comp-expanding-card-from-left",`${Math.max(0,t.left)}px`),this.dialog.style.setProperty("--md-comp-expanding-card-from-media-height",`${Math.max(0,i?.height??0)}px`)};this.open=()=>{this.isOpen||!this.dialog||!this.trigger||(this.closeGeneration++,this._setTransitionOrigin(),this.isOpen=!0,this.trigger.ariaExpanded="true",this.dialog.ariaExpanded="true",this.dialog.showModal(),this.dialog.offsetWidth,this.dialog.classList.add("expanded"),this.closeButton?.focus(),typeof this.options.onOpen=="function"&&this.options.onOpen.call(this,this.el))};this.close=()=>{if(!this.isOpen||!this.dialog||!this.trigger)return;let t=++this.closeGeneration;this._setTransitionOrigin(),this.isOpen=!1,this.trigger.ariaExpanded="false",this.dialog.ariaExpanded="false",this.dialog.classList.remove("expanded"),typeof this.options.onClose=="function"&&this.options.onClose.call(this,this.el);let e=()=>{t!==this.closeGeneration||this.isOpen||!this.dialog.open||(this.dialog.close(),this.dialog.isConnected&&this.trigger.isConnected&&this.trigger.focus())},s=window.matchMedia("(prefers-reduced-motion: reduce)").matches?[]:(this.dialog.getAnimations?.()??[]).filter(n=>n.transitionProperty==="clip-path");s.length===0?e():Promise.allSettled(s.map(n=>n.finished)).then(e)};this.el.Expressive_ExpandingCard=this,this.options={...d.defaults,...e},this.dialog=this.el.querySelector(":scope > dialog.expanding-card-dialog"),this.trigger=this.el.querySelector(":scope > .expanding-card-trigger, :scope > figure > .expanding-card-trigger"),this.closeButton=this.dialog?.querySelector(".expanding-card-close")??null,this.trigger&&this.dialog&&(this.trigger.ariaExpanded="false",this.dialog.id&&this.trigger.setAttribute("aria-controls",this.dialog.id),this.trigger.matches("a[href], button, input, select, textarea")||(this.trigger.tabIndex=0,this.trigger.setAttribute("role","button")),this.dialog.ariaExpanded="false",this._setupEventHandlers())}static get defaults(){return Yt}static init(t,e){return super.init(t,e,d)}static getInstance(t){return t.Expressive_ExpandingCard}destroy(){this._removeEventHandlers(),this.closeGeneration++,this.isOpen=!1,this.trigger&&(this.trigger.ariaExpanded="false"),this.dialog&&(this.dialog.ariaExpanded="false"),this.dialog?.classList.remove("expanded"),this.dialog?.open&&this.dialog.close(),this.el.Expressive_ExpandingCard=void 0}static Init(){u.onDocumentReady(()=>{document.querySelectorAll(ft).forEach(t=>{t&&t.Expressive_ExpandingCard==null&&this.init(t)})})}};var Et=112,Gt=280,Xt={alignment:"left",autoFocus:!0,constrainWidth:!0,container:null,coverTrigger:!1,closeOnClick:!0,hover:!1,inDuration:150,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,onItemClick:null},vt=" ",H=class H extends _{constructor(t,e){super(t,e,H);this._pendingTimers=new Set;this._transition=0;this._handleClick=t=>{t.preventDefault(),this.isOpen?this.close():this.open()};this._handleMouseEnter=()=>{this.open()};this._handleMouseLeave=t=>{let e=t.relatedTarget;if(!e){this.close();return}let i=!!(this.menuEl&&e&&this.menuEl.contains(e)),s=!1,n=e.closest(".menu-trigger");n&&n.Expressive_Menu&&n.Expressive_Menu.isOpen&&(s=!0),!s&&!i&&this.close()};this._handleDocumentClick=t=>{let e=t.target;this._isSubmenuTriggerClick(e)||(this.options.closeOnClick&&this.menuEl?.contains(e)&&!this.isTouchMoving?this.close():this.menuEl?.contains(e)||this._schedule(()=>{this.isOpen&&this.close()},0),this.isTouchMoving=!1)};this._handleTriggerKeydown=t=>{(t.key===vt||t.key===u.keys.ENTER||t.key===u.keys.ARROW_DOWN||t.key===u.keys.ARROW_UP)&&!this.isOpen&&(t.preventDefault(),this.open())};this._handleDocumentTouchmove=t=>{let e=t.target;this.menuEl?.contains(e)&&(this.isTouchMoving=!0)};this._handleMenuClick=t=>{let e=t.target,i=e.closest("li");if(i?.matches('.disabled, [aria-disabled="true"]')){t.preventDefault(),t.stopPropagation();return}if(i&&this._isSubmenuTriggerClick(e)){t.preventDefault(),t.stopPropagation(),this._toggleSubmenu(i);return}i&&typeof this.options.onItemClick=="function"&&this.options.onItemClick.call(this,i)};this._handleSubmenuAlign=t=>{let e=t.target;if(!(e instanceof Element))return;let i=e.closest("li");i?.querySelector(":scope > menu")&&this.menuEl?.contains(i)&&this._alignSubmenu(i)};this._handleMenuKeydown=t=>{if(!this.isOpen||t.ctrlKey||t.metaKey||t.altKey||t.isComposing)return;let e=this._containingSubmenu(t)??this.menuEl,i=getComputedStyle(e).direction==="rtl",s=i?u.keys.ARROW_LEFT:u.keys.ARROW_RIGHT,n=i?u.keys.ARROW_RIGHT:u.keys.ARROW_LEFT;[s,n,u.keys.ARROW_UP,u.keys.ARROW_DOWN,u.keys.ESC,u.keys.TAB].includes(t.key)&&(clearTimeout(this.filterTimeout),this._resetFilterQuery());let a=t.key===u.keys.ARROW_DOWN||t.key===u.keys.ARROW_UP;if(t.key===u.keys.TAB)t.preventDefault(),this.close();else if(t.key===s){let h=this._focusedRow(t);if(h?.querySelector(":scope > menu")&&!h.matches('.disabled, [aria-disabled="true"]')){t.preventDefault(),h.classList.add("open"),this._alignSubmenu(h),this._syncSubmenuAria(h,!0);let l=Array.from(h.querySelector(":scope > menu").children).find(r=>r instanceof HTMLElement&&r.tabIndex!==-1);l&&this._focusRow(l)}}else if(t.key===n){let h=this._containingSubmenu(t);if(h){t.preventDefault();let l=h.parentElement;l.classList.remove("open","submenu-start"),this._syncSubmenuAria(l,!1),this._focusRow(l)}}else if(a&&this.isOpen){t.preventDefault();let h=t.key===u.keys.ARROW_DOWN?1:-1,l=this._focusedRow(t),r=l?Array.from(e.children).indexOf(l):this.focusedIndex,m=!1;do if(r=r+h,e.children[r]&&e.children[r].tabIndex!==-1){m=!0;break}while(r<e.children.length&&r>=0);if(m){this.focusedIndex>=0&&e.children[this.focusedIndex]?.classList.remove("active");let p=e.children[r];p.classList.add("active"),this._focusRow(p)}}else if((t.key===u.keys.ENTER||t.key===vt)&&this.isOpen){let h=this._focusedRow(t);if(t.preventDefault(),h?.matches('.disabled, [aria-disabled="true"]'))return;if(h?.querySelector(":scope > menu")){this._toggleSubmenu(h);return}let l=h??this.menuEl.children[this.focusedIndex],r=l?.querySelector(":scope > a, :scope > button");r?r.click():l instanceof HTMLElement&&l.click()}else if(t.key===u.keys.ESC&&this.isOpen){t.preventDefault();let h=this._containingSubmenu(t)?.parentElement??Array.from(this.menuEl.querySelectorAll("li.open")).reverse()[0];h?(h.classList.remove("open","submenu-start"),this._syncSubmenuAria(h,!1),this._focusRow(h)):this.close()}let c=t.key.toLowerCase();if(t.key.length===1&&t.key!==vt&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.isComposing){this.filterQuery.push(c);let h=this.filterQuery.join(""),l=Array.from(e.querySelectorAll(":scope > li")).find(r=>r.tabIndex!==-1&&!r.matches('.disabled, [aria-disabled="true"]')&&Array.from(r.childNodes).filter(m=>!(m instanceof Element&&m.matches("menu"))).map(m=>m.textContent).join("").trim().toLowerCase().startsWith(h));l&&this._focusRow(l),clearTimeout(this.filterTimeout),this.filterTimeout=setTimeout(this._resetFilterQuery,1e3)}};this._handleWindowResize=()=>{this.el.offsetParent&&this.recalculateDimensions()};this._resetFilterQuery=()=>{this.filterQuery=[]};this.open=()=>{if(this.isOpen||this.el.Expressive_Menu!==this)return;let t=this._clearPendingTimers();this.isOpen=!0,typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),t===this._transition&&(this._resetMenuStyles(),this.menuEl.style.display="block",this._restoreInert(),this._placeMenu(),this._schedule(()=>this._setupTemporaryEventHandlers(),0),this._animateIn(),this.el.ariaExpanded="true")};this.close=()=>{if(!this.isOpen)return;let t=this._clearPendingTimers(),e=this.menuEl.getRootNode(),i=e.activeElement;this.isOpen=!1,this.menuEl.setAttribute("inert",""),clearTimeout(this.filterTimeout),this._resetFilterQuery(),this.focusedIndex=-1,this._closeSubmenus(),typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),t===this._transition&&(this._animateOut(),this._removeTemporaryEventHandlers(),this.el.ariaExpanded="false",this.options.autoFocus&&(e.activeElement===i||!e.activeElement||e.activeElement===document.body)&&this.el.focus())};this.recalculateDimensions=()=>{this.isOpen&&(this._resetMenuPositioningStyles(),this._placeMenu())};this.el.Expressive_Menu=this,H._menus.push(this),this.id=u.getIdFromTrigger(t),this.menuEl=u.getElementById(t,this.id),this._originalInert=this.menuEl?.getAttribute("inert")??null,this.options={...H.defaults,...e},this.isOpen=!1,this.isScrollable=!1,this.isTouchMoving=!1,this.focusedIndex=-1,this.filterQuery=[],this.el.ariaExpanded="false",this.el.hasAttribute("aria-haspopup")||this.el.setAttribute("aria-haspopup","menu"),this.id&&!this.el.hasAttribute("aria-controls")&&this.el.setAttribute("aria-controls",this.id),this._moveMenuToElement(),this._setupAccessibility(),this._makeMenuFocusable(),this._setupSubmenus(),this._setupEventHandlers()}static get defaults(){return Xt}static init(t,e={}){return super.init(t,e,H)}static getInstance(t){return t.Expressive_Menu}destroy(){this._clearPendingTimers(),this.isOpen=!1,this.el.ariaExpanded="false",clearTimeout(this.filterTimeout),this._resetMenuStyles(),this._restoreInert(),this._removeEventHandlers(),this._removeTemporaryEventHandlers();let t=H._menus.indexOf(this);t>=0&&H._menus.splice(t,1),this.el.Expressive_Menu=void 0}_setupEventHandlers(){this.el.addEventListener("keydown",this._handleTriggerKeydown),this.menuEl?.addEventListener("click",this._handleMenuClick),this.menuEl?.querySelector(":scope > li > menu")&&this.menuEl.addEventListener("mouseover",this._handleSubmenuAlign),this.options.hover?(this.el.addEventListener("mouseenter",this._handleMouseEnter),this.el.addEventListener("mouseleave",this._handleMouseLeave),this.menuEl.addEventListener("mouseleave",this._handleMouseLeave)):this.el.addEventListener("click",this._handleClick)}_removeEventHandlers(){this.el.removeEventListener("keydown",this._handleTriggerKeydown),this.menuEl?.removeEventListener("click",this._handleMenuClick),this.menuEl?.removeEventListener("mouseover",this._handleSubmenuAlign),this.options.hover?(this.el.removeEventListener("mouseenter",this._handleMouseEnter),this.el.removeEventListener("mouseleave",this._handleMouseLeave),this.menuEl?.removeEventListener("mouseleave",this._handleMouseLeave)):this.el.removeEventListener("click",this._handleClick)}_setupTemporaryEventHandlers(){document.body.addEventListener("click",this._handleDocumentClick),document.body.addEventListener("touchmove",this._handleDocumentTouchmove,{passive:!0}),this.menuEl?.addEventListener("keydown",this._handleMenuKeydown),window.addEventListener("resize",this._handleWindowResize)}_removeTemporaryEventHandlers(){document.body.removeEventListener("click",this._handleDocumentClick),document.body.removeEventListener("touchmove",this._handleDocumentTouchmove),this.menuEl?.removeEventListener("keydown",this._handleMenuKeydown),window.removeEventListener("resize",this._handleWindowResize)}_setupAccessibility(){if(!this.menuEl)return;this.menuEl.hasAttribute("role")||this.menuEl.setAttribute("role","menu"),[this.menuEl,...this.menuEl.querySelectorAll("menu")].forEach(e=>{e.hasAttribute("role")||e.setAttribute("role","menu"),e.getAttribute("role")==="menu"&&e.querySelectorAll(":scope > li").forEach(i=>{if(i.classList.contains("divider")){i.hasAttribute("role")||i.setAttribute("role","separator");return}if(i.classList.contains("gap")){i.setAttribute("aria-hidden","true");return}if(i.classList.contains("label")||i.classList.contains("optgroup")){i.hasAttribute("role")||i.setAttribute("role","presentation");return}i.hasAttribute("role")||i.setAttribute("role","menuitem"),i.classList.contains("disabled")&&!i.hasAttribute("aria-disabled")&&i.setAttribute("aria-disabled","true")})})}_isSubmenuTriggerClick(t){if(!this.menuEl)return!1;let e=t.closest("li");if(!e||!this.menuEl.contains(e))return!1;let i=e.querySelector(":scope > menu");return i?!i.contains(t):!1}_setupSubmenus(){this.menuEl?.querySelectorAll("li").forEach(t=>{if(!t.querySelector(":scope > menu"))return;let e=t.querySelector(":scope > a, :scope > button, :scope > span")??t;e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false")})}_toggleSubmenu(t){let e=!t.classList.contains("open");t.parentElement?.querySelectorAll(":scope > li.open").forEach(i=>{i!==t&&(i.classList.remove("open","submenu-start"),this._syncSubmenuAria(i,!1))}),t.classList.toggle("open",e),e&&this._alignSubmenu(t),this._syncSubmenuAria(t,e)}_syncSubmenuAria(t,e){(t.querySelector(":scope > a, :scope > button, :scope > span")??t).setAttribute("aria-expanded",e?"true":"false")}_alignSubmenu(t){let e=t.querySelector(":scope > menu");if(!e)return;t.classList.remove("submenu-start");let i=e.getBoundingClientRect();(i.left<8||i.right>window.innerWidth-8)&&t.classList.add("submenu-start")}_closeSubmenus(){this.menuEl?.querySelectorAll("li.open").forEach(t=>{t.classList.remove("open","submenu-start"),this._syncSubmenuAria(t,!1)})}_containingSubmenu(t){let e=t.target;if(!(e instanceof Element))return null;let i=e.closest("li > menu");return i instanceof HTMLElement&&this.menuEl?.contains(i)?i:null}_focusedRow(t){let e=t.target;if(!(e instanceof Element))return null;let i=e.closest("li");return i instanceof HTMLElement&&this.menuEl?.contains(i)?i:null}_restoreInert(){this._originalInert===null?this.menuEl?.removeAttribute("inert"):this.menuEl?.setAttribute("inert",this._originalInert)}_focusRow(t){this.focusedIndex=Array.from(t.parentElement.children).indexOf(t),t.focus({preventScroll:!0}),t.scrollIntoView({block:"nearest",inline:"nearest"})}_resetMenuStyles(){this.menuEl.style.display="",this._resetMenuPositioningStyles(),this.menuEl.style.transform="",this.menuEl.style.opacity=""}_resetMenuPositioningStyles(){this.menuEl.style.width="",this.menuEl.style.height="",this.menuEl.style.left="",this.menuEl.style.top="",this.menuEl.style.transformOrigin=""}_moveMenuToElement(t=null){if(this.options.container){this.options.container.append(this.menuEl);return}if(t){t.contains(this.menuEl)||t.append(this.menuEl);return}this.el.after(this.menuEl)}_makeMenuFocusable(){this.menuEl&&(this.menuEl.popover="",this.menuEl.tabIndex=-1,this.menuEl.querySelectorAll(":scope li, :scope > hr").forEach(t=>{if(t instanceof HTMLHRElement||t.classList.contains("divider")||t.classList.contains("gap")||t.classList.contains("label")||t.classList.contains("optgroup")){t.setAttribute("tabindex","-1");return}t.getAttribute("tabindex")||t.setAttribute("tabindex","0")}))}_focusInitialItem(){if(!this.menuEl||!this.options.autoFocus)return;let t=Array.from(this.menuEl.children).find(e=>e instanceof HTMLElement&&e.tabIndex!==-1);t&&(this.focusedIndex=Array.from(this.menuEl.children).indexOf(t),t.focus({preventScroll:!0}))}_focusFocusedItem(){this.focusedIndex>=0&&this.focusedIndex<this.menuEl.children.length&&this.options.autoFocus&&(this.menuEl.children[this.focusedIndex].focus({preventScroll:!0}),this.menuEl.children[this.focusedIndex].scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}))}_getMenuPosition(t){let e=this.el.getBoundingClientRect(),i=this.menuEl.getBoundingClientRect(),s=i.height,n=i.width,a=e.left-i.left,c=e.top-i.top,h={left:a,top:c,height:s,width:n},l=u.checkPossibleAlignments(this.el,t,h,this.options.coverTrigger?0:e.height),r="top",m=this.options.alignment;if(c+=this.options.coverTrigger?0:e.height,this.isScrollable=!1,l.top||(l.bottom?(r="bottom",this.options.coverTrigger||(c-=e.height)):(this.isScrollable=!0,s-=20,l.spaceOnTop>l.spaceOnBottom?(r="bottom",s+=l.spaceOnTop,c-=this.options.coverTrigger?l.spaceOnTop-20:l.spaceOnTop-20+e.height):s+=l.spaceOnBottom)),!l[m]){let p=m==="left"?"right":"left";l[p]?m=p:l.spaceOnLeft>l.spaceOnRight?(m="right",n+=l.spaceOnLeft,a-=l.spaceOnLeft):(m="left",n+=l.spaceOnRight)}return r==="bottom"&&(c=c-i.height+(this.options.coverTrigger?e.height:0)),m==="right"&&(a=a-i.width+e.width),{x:a,y:c,verticalAlignment:r,horizontalAlignment:m,height:s,width:n}}_schedule(t,e){let i=setTimeout(()=>{this._pendingTimers.delete(i),t()},e);this._pendingTimers.add(i)}_clearPendingTimers(){for(let t of this._pendingTimers)clearTimeout(t);return this._pendingTimers.clear(),++this._transition}_animateIn(){let t=this._transition,e=this.options.inDuration;this.menuEl.style.transition="none",this.menuEl.style.opacity="0",this.menuEl.style.transform="scale(0.85)",this._schedule(()=>{this.menuEl.style.transition=`opacity ${e}ms ease, transform ${e}ms ease`,this.menuEl.style.opacity="1",this.menuEl.style.transform="scale(1)"},1),this._schedule(()=>{this._focusInitialItem(),t===this._transition&&typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,this.el)},e)}_animateOut(){let t=this.options.outDuration;this.menuEl.style.transition=`opacity ${t}ms ease, transform ${t}ms ease`,this.menuEl.style.opacity="0",this.menuEl.style.transform="scale(0.85)",this._schedule(()=>{this._resetMenuStyles(),typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,this.el)},t)}_getClosestAncestor(t,e){let i=t.parentNode;for(;i!=null&&i!==document;){if(i.nodeType===Node.ELEMENT_NODE&&e(i))return i;i=i.parentNode??i.host}return null}_placeMenu(){let t=this._getClosestAncestor(this.menuEl,a=>!["HTML","BODY"].includes(a.tagName)&&getComputedStyle(a).overflow!=="visible");if(!t){let a=this.menuEl.offsetParent?this.menuEl.offsetParent:this.menuEl.parentNode;t=a.host??a}getComputedStyle(t).position==="static"&&(t.style.position="relative");let e=this.menuEl.getBoundingClientRect().width,i=this.el.getBoundingClientRect().width,s=this.options.constrainWidth&&i>=Et?i:Math.min(Gt,Math.max(Et,e));this.menuEl.style.width=s+"px";let n=this._getMenuPosition(t);this.menuEl.style.left=n.x+"px",this.menuEl.style.top=n.y+"px",this.menuEl.style.height=n.height+"px",this.menuEl.style.width=n.width+"px",this.menuEl.style.transformOrigin=`${n.horizontalAlignment==="left"?"0":"100%"} ${n.verticalAlignment==="top"?"0":"100%"}`}};H._menus=[];var O=H;var jt={i18n:{loading:"Loading results.",noResults:"No results.",results:d=>`${d} ${d===1?"result":"results"} available.`,selected:d=>`${d} ${d===1?"item":"items"} selected.`},data:[],onAutocomplete:null,menuOptions:{autoFocus:!1,closeOnClick:!1,coverTrigger:!1},minLength:1,isMultiSelect:!1,onSearch:(d,o)=>{let t=d.toLocaleLowerCase(),e=o.options.data;o.setMenuItems(e.filter(i=>i.id.toString().toLocaleLowerCase().includes(t)||i.text?.toLocaleLowerCase().includes(t))),o.options.data=e},maxMenuHeight:"300px",allowUnsafeHTML:!1,selected:[]},I=class I extends _{constructor(t,e){super(t,e,I);this._handleInputBlur=()=>{this._pointerDown||(this.close(),this._resetAutocomplete())};this._handleInputKeyup=()=>{I._keydown=!1};this._handleInput=()=>{this.count=0;let t=this.el.value.toLocaleLowerCase();this.oldVal!==t&&this.el.matches(":focus-visible")&&this.open(),this._inputChangeDetection(t)};this._handleInputFocus=()=>{this.count=0;let t=this.el.value.toLocaleLowerCase();this._inputChangeDetection(t)};this._inputChangeDetection=t=>{!this.options.isMultiSelect&&this.selectedValues.length&&this.el.value!==(this.selectedValues[0].text||String(this.selectedValues[0].id))&&(this.selectedValues=[]),this.oldVal!==t&&(this._setStatusLoading(),this.options.onSearch(this.el.value,this)),!this.options.isMultiSelect&&this.el.value.length===0&&(this.selectedValues=[],this._triggerChanged()),this.oldVal=t};this._handleInputKeydown=t=>{if(I._keydown=!0,t.key===u.keys.ESC||t.key==="Tab"){this.close(),this._resetCurrentElementPosition();return}let e=this.container.querySelectorAll("li").length;if(t.key===u.keys.ENTER&&this.activeIndex>=0){let i=this.container.querySelectorAll("li")[this.activeIndex];i&&(this.selectOption(i.getAttribute("data-id")),t.preventDefault());return}(t.key===u.keys.ARROW_UP||t.key===u.keys.ARROW_DOWN)&&(t.preventDefault(),t.key===u.keys.ARROW_UP&&this.activeIndex>0&&this.activeIndex--,t.key===u.keys.ARROW_DOWN&&this.activeIndex<e-1&&this.activeIndex++,this._setActive(null),this.activeIndex>=0&&(this._setActive(this.container.querySelectorAll("li")[this.activeIndex]),this.container.children[this.activeIndex].scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})))};this._handleInputClick=()=>{this.open()};this._handleContainerPointerDown=t=>{t.isPrimary&&(t.pointerType==="mouse"&&t.button!==0||(this._pointerDown=!0))};this._handleContainerPointerUp=()=>{this._pointerDown=!1};this.open=()=>{let t=this.el.value.toLocaleLowerCase();this._resetAutocomplete(),t.length>=this.options.minLength&&(this.isOpen=!0,this._renderMenu(),this._announce(this.menuItems.length?this.options.i18n.results(this.menuItems.length):this.options.i18n.noResults)),this.menu.isOpen?this.menu.recalculateDimensions():(this._openTimer!==void 0&&clearTimeout(this._openTimer),this._openTimer=setTimeout(()=>{this._openTimer=void 0,this.menu.open()},0))};this.close=()=>{this._announcer&&(this._announcer.textContent=""),this._openTimer!==void 0&&(clearTimeout(this._openTimer),this._openTimer=void 0),this.isOpen=!1,this.menu.close()};this.el.Expressive_Autocomplete=this,this.options={...I.defaults,...e,i18n:{...I.defaults.i18n,...e?.i18n}},this.isOpen=!1,this.count=0,this.activeIndex=-1,this.oldVal="",this.selectedValues=this.options.selected.map(i=>this.options.data.find(s=>s.id===i)??{id:i}),this.menuItems=this.options.data||[],this.$active=null,this._pointerDown=!1,this._setupMenu(),this._setupEventHandlers()}_setActive(t){this.$active?.classList.remove("active"),this.$active=t,t?(t.classList.add("active"),this.el.setAttribute("aria-activedescendant",t.id)):this.el.removeAttribute("aria-activedescendant")}static get defaults(){return jt}static init(t,e={}){return super.init(t,e,I)}static getInstance(t){return t.Expressive_Autocomplete}static _loadingIndicator(){if(!I._loadingTemplate){let t=document.createElement("template");t.innerHTML=`<div style="height:100%;width:50px;"><svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
|
|
1
|
+
var Expressive=(()=>{var ut=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var qt=Object.prototype.hasOwnProperty;var $t=(d,o)=>{for(var t in o)ut(d,t,{get:o[t],enumerable:!0})},Kt=(d,o,t,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of Vt(o))!qt.call(d,i)&&i!==t&&ut(d,i,{get:()=>o[i],enumerable:!(e=Ft(o,i))||e.enumerable});return d};var zt=d=>Kt(ut({},"__esModule",{value:!0}),d);var Te={};$t(Te,{AppBar:()=>Y,AutoInit:()=>It,Autocomplete:()=>P,BottomSheets:()=>K,ButtonGroup:()=>j,Cards:()=>B,Carousel:()=>F,CharacterCounter:()=>lt,Chips:()=>W,Datepicker:()=>Z,Dialogs:()=>$,ExpandingCard:()=>N,FloatingActionButton:()=>G,FormSelect:()=>k,Forms:()=>U,Lightbox:()=>Q,Menu:()=>H,NavigationRail:()=>tt,Range:()=>V,ScrollSpy:()=>J,SideSheets:()=>z,Slider:()=>V,Snackbar:()=>ht,Tabs:()=>et,Timepicker:()=>it,Tooltip:()=>st,version:()=>Le});var S=class S{static onDocumentReady(o){typeof document>"u"||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",o,{once:!0}):o())}static guid(){return globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}static portalRoot(o){let t=o.getRootNode();return t.host?t:document.body}static getElementById(o,t){let e=o.getRootNode();return e.getElementById?e.getElementById(t):document.getElementById(t)}static checkWithinContainer(o,t,e){let i={top:!1,right:!1,bottom:!1,left:!1},s=o.getBoundingClientRect(),n=o===document.body?Math.max(s.bottom,window.innerHeight):s.bottom,a=o.scrollLeft,h=o.scrollTop,c=t.left-a,l=t.top-h;return(c<s.left+e||c<e)&&(i.left=!0),(c+t.width>s.right-e||c+t.width>window.innerWidth-e)&&(i.right=!0),(l<s.top+e||l<e)&&(i.top=!0),(l+t.height>n-e||l+t.height>window.innerHeight-e)&&(i.bottom=!0),i}static checkPossibleAlignments(o,t,e,i){let s={top:!0,right:!0,bottom:!0,left:!0,spaceOnTop:null,spaceOnRight:null,spaceOnBottom:null,spaceOnLeft:null},n=getComputedStyle(t).overflow==="visible",a=t.getBoundingClientRect(),h=Math.min(a.height,window.innerHeight),c=Math.min(a.width,window.innerWidth),l=o.getBoundingClientRect(),r=t.scrollLeft,p=t.scrollTop,m=e.left-r,v=e.top-p,E=e.top+l.height-p;return s.spaceOnRight=n?window.innerWidth-(l.left+e.width):c-(m+e.width),s.spaceOnRight<0&&(s.left=!1),s.spaceOnLeft=n?l.right-e.width:m-e.width+l.width,s.spaceOnLeft<0&&(s.right=!1),s.spaceOnBottom=n?window.innerHeight-(l.top+e.height+i):h-(v+e.height+i),s.spaceOnBottom<0&&(s.top=!1),s.spaceOnTop=n?l.bottom-(e.height+i):E-(e.height-i),s.spaceOnTop<0&&(s.bottom=!1),s}static getIdFromTrigger(o){let t=o.dataset.target;return t||(t=o.getAttribute("href"),t?t.slice(1):"")}static getDocumentScrollTop(){return window.scrollY}static getDocumentScrollLeft(){return window.scrollX}static throttle(o,t){let e=null,i=null,s=0;return(...n)=>{let a=Date.now(),h=t-(a-s);h<=0?(clearTimeout(e),e=null,s=a,i=null,o(...n)):e?i=n:(i=n,e=setTimeout(()=>{s=Date.now(),e=null,o(...i??[]),i=null},h))}}static createConfirmationContainer(o,t,e,i,s){let n=document.createElement("div");n.classList.add("confirmation-btns"),o.append(n),this.createButton(n,e,["btn-cancel"],!0,s),this.createButton(n,t,["btn-confirm"],!0,i)}static createButton(o,t,e=[],i=!0,s=null){e=e.concat(["text"]);let n=document.createElement("button");n.className=e.join(" "),n.style.visibility=i?"visible":"hidden",n.type="button",n.tabIndex=i?0:-1,n.innerText=t,typeof s=="function"&&n.addEventListener("click",s),o.append(n)}static _setAbsolutePosition(o,t,e,i,s,n="center"){let a=o.offsetHeight,h=o.offsetWidth,c=t.offsetHeight,l=t.offsetWidth,r=o.getBoundingClientRect(),p=0,m=0,v=r.top+S.getDocumentScrollTop(),E=r.left+S.getDocumentScrollLeft();e==="top"?(v+=-c-i,n==="center"&&(E+=h/2-l/2),m=-s):e==="right"?(v+=a/2-c/2,E=h+i,p=s):e==="left"?(v+=a/2-c/2,E=-l-i,p=-s):(v+=a+i,n==="center"&&(E+=h/2-l/2),m=s),n==="right"&&(E+=h-l-i);let b=S._repositionWithinScreen(E,v,l,c,i,s,n),y=t.offsetParent;if(y&&(y!==document.body||getComputedStyle(y).position!=="static")){let I=y.getBoundingClientRect(),A=y===document.scrollingElement;b.x-=I.left+S.getDocumentScrollLeft()+y.clientLeft-(A?0:y.scrollLeft),b.y-=I.top+S.getDocumentScrollTop()+y.clientTop-(A?0:y.scrollTop)}return t.style.top=b.y+"px",t.style.left=b.x+"px",{x:p,y:m}}static _repositionWithinScreen(o,t,e,i,s,n,a){let h=S.getDocumentScrollLeft(),c=S.getDocumentScrollTop(),l=o-h,r=t-c,p={left:l,top:r,width:e,height:i},m;a==="left"||a=="center"?m=s+n:a==="right"&&(m=s-n);let v=S.checkWithinContainer(document.body,p,m);return v.left?l=m:v.right&&(l-=l+e-window.innerWidth),v.top?r=m:v.bottom&&(r-=r+i-window.innerHeight),{x:l+h,y:r+c}}};S.keys={TAB:"Tab",ENTER:"Enter",ESC:"Escape",BACKSPACE:"Backspace",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",DELETE:"Delete"};var u=S;var _=class{constructor(o,t,e){o instanceof HTMLElement||console.error(Error(o+" is not an HTML Element"));let i=e.getInstance(o);i&&i.destroy(),this.el=o}static init(o,t,e){let i=null;if(o instanceof Element)i=new e(o,t);else if(o){i=[];for(let s=0;s<o.length;s++)i.push(new e(o[s],t))}return i}static get defaults(){return{}}static getInstance(o){throw new Error("This method must be implemented.")}destroy(){throw new Error("This method must be implemented.")}};var Ut={onOpen:null,onClose:null},mt='article:has(> aside[id]:not([id=""])):not(:has(> aside ~ aside)):has(> button.card-reveal-trigger[type="button"], > :not(aside) button.card-reveal-trigger[type="button"])',pt="card-reveal-initialized";function Yt(d){if(d.getAttribute("aria-label")?.trim())return!0;let t=d.getAttribute("aria-labelledby");if(t&&t.trim().split(/\s+/).map(s=>d.ownerDocument.getElementById(s)?.textContent??"").join(" ").trim())return!0;let e=d.cloneNode(!0);return e.querySelectorAll('[aria-hidden="true"]').forEach(i=>i.remove()),!!e.textContent?.trim()}function Et(d,o,t){return d.closest("article")===o&&!t.contains(d)&&!d.disabled&&d.getAttribute("aria-disabled")!=="true"&&Yt(d)}function ft(d){if(d.tagName!=="ARTICLE")return!1;let o=d.querySelectorAll(":scope > aside");return o.length!==1||!o[0].id?!1:Array.from(d.querySelectorAll('button.card-reveal-trigger[type="button"]')).some(t=>Et(t,d,o[0]))}var B=class d extends _{constructor(t,e={}){super(t,e,d);this.isOpen=!1;this._ownsRevealInitializedClass=!1;this._initialAriaControls=new Map;this._lastActivator=null;this._setupEventHandlers=()=>{this._activators.forEach(t=>{t.addEventListener("click",this._handleClickInteraction)}),this.el.addEventListener("keydown",this._handleKeydownEvent)};this._removeEventHandlers=()=>{this._activators.forEach(t=>{t.removeEventListener("click",this._handleClickInteraction)}),this.el.removeEventListener("keydown",this._handleKeydownEvent)};this._handleClickInteraction=t=>{this._lastActivator=t.currentTarget,this._handleRevealEvent()};this._handleKeydownEvent=t=>{(t.target instanceof Element?t.target.closest("article"):null)!==this.el||t.key!=="Escape"||!this.isOpen||(t.preventDefault(),this.close())};this._handleRevealEvent=()=>{this.isOpen?this.close():this.open()};this.open=()=>{this.isOpen||!this.cardReveal||(this.isOpen=!0,this.cardReveal.classList.add("open"),this.cardReveal.inert=!1,this._activators.forEach(t=>t.ariaExpanded="true"),typeof this.options.onOpen=="function"&&this.options.onOpen.call(this,this.el))};this.close=()=>{if(!this.isOpen||!this.cardReveal)return;let t=this.cardReveal.contains(document.activeElement);this.isOpen=!1,this.cardReveal.classList.remove("open"),this.cardReveal.inert=!0,this._activators.forEach(e=>e.ariaExpanded="false"),typeof this.options.onClose=="function"&&this.options.onClose.call(this,this.el),t&&(this._lastActivator??this._activators[0])?.focus()};this.el.Expressive_Cards=this,this.options={...d.defaults,...e};let i=this.el.querySelectorAll(":scope > aside"),s=i.length===1?i[0]:null,n=s?Array.from(this.el.querySelectorAll('button.card-reveal-trigger[type="button"]')).filter(a=>Et(a,this.el,s)):[];this.cardReveal=s?.id&&n.length>0?s:null,this._activators=this.cardReveal?n:[],this.cardReveal&&(this._ownsRevealInitializedClass=!this.el.classList.contains(pt),this.el.classList.add(pt),this._activators.forEach(a=>{this._initialAriaControls.set(a,a.getAttribute("aria-controls")),a.ariaExpanded="false",a.setAttribute("aria-controls",this.cardReveal.id)}),this.cardReveal.classList.remove("open"),this.cardReveal.inert=!0,this._setupEventHandlers())}static get defaults(){return Ut}static init(t,e){return super.init(t,e,d)}static getInstance(t){return t.Expressive_Cards}destroy(){this._removeEventHandlers(),this.cardReveal&&(this.cardReveal.classList.remove("open"),this.cardReveal.inert=!1,this._ownsRevealInitializedClass&&this.el.classList.remove(pt)),this._activators.forEach(t=>{t.removeAttribute("aria-expanded");let e=this._initialAriaControls.get(t);e===null?t.removeAttribute("aria-controls"):e!==void 0&&t.setAttribute("aria-controls",e)}),this.isOpen=!1,this._activators=[],this._initialAriaControls.clear(),this._lastActivator=null,this.el.Expressive_Cards=void 0}static Init(){u.onDocumentReady(()=>{Array.from(document.querySelectorAll(mt)).filter(ft).forEach(e=>{e&&e.Expressive_Cards==null&&this.init(e)})})}};var Gt={onOpen:null,onClose:null},vt="article.expanding-card:has(> dialog.expanding-card-dialog)",N=class d extends _{constructor(t,e){super(t,e,d);this.isOpen=!1;this.closeGeneration=0;this._setupEventHandlers=()=>{this.trigger?.addEventListener("click",this.open),this.trigger?.addEventListener("keypress",this._handleTriggerKeypress),this.closeButton?.addEventListener("click",this.close),this.dialog?.addEventListener("cancel",this._handleCancel),this.dialog?.addEventListener("close",this._handleNativeClose)};this._removeEventHandlers=()=>{this.trigger?.removeEventListener("click",this.open),this.trigger?.removeEventListener("keypress",this._handleTriggerKeypress),this.closeButton?.removeEventListener("click",this.close),this.dialog?.removeEventListener("cancel",this._handleCancel),this.dialog?.removeEventListener("close",this._handleNativeClose)};this._handleTriggerKeypress=t=>{(t.key===u.keys.ENTER||t.key===" ")&&(t.preventDefault(),this.open())};this._handleCancel=t=>{t.preventDefault(),this.close()};this._handleNativeClose=()=>{this.dialog.open||(this.closeGeneration++,this.isOpen=!1,this.trigger.ariaExpanded="false",this.dialog.ariaExpanded="false",this.dialog.classList.remove("expanded"))};this._setTransitionOrigin=()=>{if(!this.dialog)return;let t=this.el.getBoundingClientRect(),i=this.el.querySelector(":scope > figure, :scope > img")?.getBoundingClientRect();this.dialog.style.setProperty("--md-comp-expanding-card-from-top",`${Math.max(0,t.top)}px`),this.dialog.style.setProperty("--md-comp-expanding-card-from-right",`${Math.max(0,window.innerWidth-t.right)}px`),this.dialog.style.setProperty("--md-comp-expanding-card-from-bottom",`${Math.max(0,window.innerHeight-t.bottom)}px`),this.dialog.style.setProperty("--md-comp-expanding-card-from-left",`${Math.max(0,t.left)}px`),this.dialog.style.setProperty("--md-comp-expanding-card-from-media-height",`${Math.max(0,i?.height??0)}px`)};this.open=()=>{this.isOpen||!this.dialog||!this.trigger||(this.closeGeneration++,this._setTransitionOrigin(),this.isOpen=!0,this.trigger.ariaExpanded="true",this.dialog.ariaExpanded="true",this.dialog.showModal(),this.dialog.offsetWidth,this.dialog.classList.add("expanded"),this.closeButton?.focus(),typeof this.options.onOpen=="function"&&this.options.onOpen.call(this,this.el))};this.close=()=>{if(!this.isOpen||!this.dialog||!this.trigger)return;let t=++this.closeGeneration;this._setTransitionOrigin(),this.isOpen=!1,this.trigger.ariaExpanded="false",this.dialog.ariaExpanded="false",this.dialog.classList.remove("expanded"),typeof this.options.onClose=="function"&&this.options.onClose.call(this,this.el);let e=()=>{t!==this.closeGeneration||this.isOpen||!this.dialog.open||(this.dialog.close(),this.dialog.isConnected&&this.trigger.isConnected&&this.trigger.focus())},s=window.matchMedia("(prefers-reduced-motion: reduce)").matches?[]:(this.dialog.getAnimations?.()??[]).filter(n=>n.transitionProperty==="clip-path");s.length===0?e():Promise.allSettled(s.map(n=>n.finished)).then(e)};this.el.Expressive_ExpandingCard=this,this.options={...d.defaults,...e},this.dialog=this.el.querySelector(":scope > dialog.expanding-card-dialog"),this.trigger=this.el.querySelector(":scope > .expanding-card-trigger, :scope > figure > .expanding-card-trigger"),this.closeButton=this.dialog?.querySelector(".expanding-card-close")??null,this.trigger&&this.dialog&&(this.trigger.ariaExpanded="false",this.dialog.id&&this.trigger.setAttribute("aria-controls",this.dialog.id),this.trigger.matches("a[href], button, input, select, textarea")||(this.trigger.tabIndex=0,this.trigger.setAttribute("role","button")),this.dialog.ariaExpanded="false",this._setupEventHandlers())}static get defaults(){return Gt}static init(t,e){return super.init(t,e,d)}static getInstance(t){return t.Expressive_ExpandingCard}destroy(){this._removeEventHandlers(),this.closeGeneration++,this.isOpen=!1,this.trigger&&(this.trigger.ariaExpanded="false"),this.dialog&&(this.dialog.ariaExpanded="false"),this.dialog?.classList.remove("expanded"),this.dialog?.open&&this.dialog.close(),this.el.Expressive_ExpandingCard=void 0}static Init(){u.onDocumentReady(()=>{document.querySelectorAll(vt).forEach(t=>{t&&t.Expressive_ExpandingCard==null&&this.init(t)})})}};var yt=112,jt=280,Xt={alignment:"left",autoFocus:!0,constrainWidth:!0,container:null,coverTrigger:!1,closeOnClick:!0,hover:!1,inDuration:150,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,onItemClick:null},gt=" ",R=class R extends _{constructor(t,e){super(t,e,R);this._pendingTimers=new Set;this._transition=0;this._menuClickTargets=new WeakMap;this._handleClick=t=>{t.preventDefault(),this.isOpen?this.close():this.open()};this._handleMouseEnter=()=>{this.open()};this._handleMouseLeave=t=>{let e=t.relatedTarget;if(!e){this.close();return}let i=!!(this.menuEl&&e&&this.menuEl.contains(e)),s=!1,n=e.closest(".menu-trigger");n&&n.Expressive_Menu&&n.Expressive_Menu.isOpen&&(s=!0),!s&&!i&&this.close()};this._handleDocumentClick=t=>{let e=t.composedPath(),i=this._menuClickTargets.get(t);this._menuClickTargets.delete(t);let s=i??(e[0]||t.target),n=!!i||e.includes(this.menuEl)||this.menuEl?.contains(s);this._isSubmenuTriggerClick(s)||(this.options.closeOnClick&&n&&!this.isTouchMoving?this.close():n||this._schedule(()=>{this.isOpen&&this.close()},0),this.isTouchMoving=!1)};this._handleTriggerKeydown=t=>{(t.key===gt||t.key===u.keys.ENTER||t.key===u.keys.ARROW_DOWN||t.key===u.keys.ARROW_UP)&&!this.isOpen&&(t.preventDefault(),this.open())};this._handleDocumentTouchmove=t=>{let e=t.target;(t.composedPath().includes(this.menuEl)||this.menuEl?.contains(e))&&(this.isTouchMoving=!0)};this._handleMenuClick=t=>{let e=t.target;this._menuClickTargets.set(t,e);let i=e.closest("li");if(i?.matches('.disabled, [aria-disabled="true"]')){t.preventDefault(),t.stopPropagation();return}if(i&&this._isSubmenuTriggerClick(e)){t.preventDefault(),t.stopPropagation(),this._toggleSubmenu(i);return}i&&typeof this.options.onItemClick=="function"&&this.options.onItemClick.call(this,i)};this._handleSubmenuAlign=t=>{let e=t.target;if(!(e instanceof Element))return;let i=e.closest("li");i?.querySelector(":scope > menu")&&this.menuEl?.contains(i)&&this._alignSubmenu(i)};this._handleMenuKeydown=t=>{if(!this.isOpen||t.ctrlKey||t.metaKey||t.altKey||t.isComposing)return;let e=this._containingSubmenu(t)??this.menuEl,i=getComputedStyle(e).direction==="rtl",s=i?u.keys.ARROW_LEFT:u.keys.ARROW_RIGHT,n=i?u.keys.ARROW_RIGHT:u.keys.ARROW_LEFT;[s,n,u.keys.ARROW_UP,u.keys.ARROW_DOWN,u.keys.ESC,u.keys.TAB].includes(t.key)&&(clearTimeout(this.filterTimeout),this._resetFilterQuery());let a=t.key===u.keys.ARROW_DOWN||t.key===u.keys.ARROW_UP;if(t.key===u.keys.TAB)t.preventDefault(),this.close();else if(t.key===s){let c=this._focusedRow(t);if(c?.querySelector(":scope > menu")&&!c.matches('.disabled, [aria-disabled="true"]')){t.preventDefault(),c.classList.add("open"),this._alignSubmenu(c),this._syncSubmenuAria(c,!0);let l=Array.from(c.querySelector(":scope > menu").children).find(r=>r instanceof HTMLElement&&r.tabIndex!==-1);l&&this._focusRow(l)}}else if(t.key===n){let c=this._containingSubmenu(t);if(c){t.preventDefault();let l=c.parentElement;l.classList.remove("open","submenu-start"),this._syncSubmenuAria(l,!1),this._focusRow(l)}}else if(a&&this.isOpen){t.preventDefault();let c=t.key===u.keys.ARROW_DOWN?1:-1,l=this._focusedRow(t),r=l?Array.from(e.children).indexOf(l):this.focusedIndex,p=!1;do if(r=r+c,e.children[r]&&e.children[r].tabIndex!==-1){p=!0;break}while(r<e.children.length&&r>=0);if(p){this.focusedIndex>=0&&e.children[this.focusedIndex]?.classList.remove("active");let m=e.children[r];m.classList.add("active"),this._focusRow(m)}}else if((t.key===u.keys.ENTER||t.key===gt)&&this.isOpen){let c=this._focusedRow(t);if(t.preventDefault(),c?.matches('.disabled, [aria-disabled="true"]'))return;if(c?.querySelector(":scope > menu")){this._toggleSubmenu(c);return}let l=c??this.menuEl.children[this.focusedIndex],r=l?.querySelector(":scope > a, :scope > button");r?r.click():l instanceof HTMLElement&&l.click()}else if(t.key===u.keys.ESC&&this.isOpen){t.preventDefault();let c=this._containingSubmenu(t)?.parentElement??Array.from(this.menuEl.querySelectorAll("li.open")).reverse()[0];c?(c.classList.remove("open","submenu-start"),this._syncSubmenuAria(c,!1),this._focusRow(c)):this.close()}let h=t.key.toLowerCase();if(t.key.length===1&&t.key!==gt&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.isComposing){this.filterQuery.push(h);let c=this.filterQuery.join(""),l=Array.from(e.querySelectorAll(":scope > li")).find(r=>r.tabIndex!==-1&&!r.matches('.disabled, [aria-disabled="true"]')&&Array.from(r.childNodes).filter(p=>!(p instanceof Element&&p.matches("menu"))).map(p=>p.textContent).join("").trim().toLowerCase().startsWith(c));l&&this._focusRow(l),clearTimeout(this.filterTimeout),this.filterTimeout=setTimeout(this._resetFilterQuery,1e3)}};this._handleWindowResize=()=>{this.el.offsetParent&&this.recalculateDimensions()};this._resetFilterQuery=()=>{this.filterQuery=[]};this.open=()=>{if(this.isOpen||this.el.Expressive_Menu!==this)return;let t=this._clearPendingTimers();this.isOpen=!0,typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),t===this._transition&&(this._resetMenuStyles(),this.menuEl.style.display="block",this._restoreInert(),this._placeMenu(),this._schedule(()=>this._setupTemporaryEventHandlers(),0),this._animateIn(),this.el.ariaExpanded="true")};this.close=()=>{if(!this.isOpen)return;let t=this._clearPendingTimers(),e=this.menuEl.getRootNode(),i=e.activeElement;this.isOpen=!1,this.menuEl.setAttribute("inert",""),clearTimeout(this.filterTimeout),this._resetFilterQuery(),this.focusedIndex=-1,this._closeSubmenus(),typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),t===this._transition&&(this._animateOut(),this._removeTemporaryEventHandlers(),this.el.ariaExpanded="false",this.options.autoFocus&&this.menuEl.contains(i)&&(e.activeElement===i||this.el.ownerDocument.activeElement===this.el.ownerDocument.body)&&this.el.focus())};this.recalculateDimensions=()=>{this.isOpen&&(this._resetMenuPositioningStyles(),this._placeMenu())};this.el.Expressive_Menu=this,R._menus.push(this),this.id=u.getIdFromTrigger(t),this.menuEl=u.getElementById(t,this.id),this._originalInert=this.menuEl?.getAttribute("inert")??null,this.options={...R.defaults,...e},this.isOpen=!1,this.isScrollable=!1,this.isTouchMoving=!1,this.focusedIndex=-1,this.filterQuery=[],this.el.ariaExpanded="false",this.el.hasAttribute("aria-haspopup")||this.el.setAttribute("aria-haspopup","menu"),this.id&&!this.el.hasAttribute("aria-controls")&&this.el.setAttribute("aria-controls",this.id),this._moveMenuToElement(),this._setupAccessibility(),this._makeMenuFocusable(),this._setupSubmenus(),this._setupEventHandlers()}static get defaults(){return Xt}static init(t,e={}){return super.init(t,e,R)}static getInstance(t){return t.Expressive_Menu}destroy(){this._clearPendingTimers(),this.isOpen=!1,this.el.ariaExpanded="false",clearTimeout(this.filterTimeout),this._resetMenuStyles(),this._restoreInert(),this._removeEventHandlers(),this._removeTemporaryEventHandlers();let t=R._menus.indexOf(this);t>=0&&R._menus.splice(t,1),this.el.Expressive_Menu=void 0}_setupEventHandlers(){this.el.addEventListener("keydown",this._handleTriggerKeydown),this.menuEl?.addEventListener("click",this._handleMenuClick),this.menuEl?.querySelector(":scope > li > menu")&&this.menuEl.addEventListener("mouseover",this._handleSubmenuAlign),this.options.hover?(this.el.addEventListener("mouseenter",this._handleMouseEnter),this.el.addEventListener("mouseleave",this._handleMouseLeave),this.menuEl.addEventListener("mouseleave",this._handleMouseLeave)):this.el.addEventListener("click",this._handleClick)}_removeEventHandlers(){this.el.removeEventListener("keydown",this._handleTriggerKeydown),this.menuEl?.removeEventListener("click",this._handleMenuClick),this.menuEl?.removeEventListener("mouseover",this._handleSubmenuAlign),this.options.hover?(this.el.removeEventListener("mouseenter",this._handleMouseEnter),this.el.removeEventListener("mouseleave",this._handleMouseLeave),this.menuEl?.removeEventListener("mouseleave",this._handleMouseLeave)):this.el.removeEventListener("click",this._handleClick)}_setupTemporaryEventHandlers(){document.body.addEventListener("click",this._handleDocumentClick),this.menuEl?.addEventListener("touchmove",this._handleDocumentTouchmove,{passive:!0}),document.body.addEventListener("touchmove",this._handleDocumentTouchmove,{passive:!0}),this.menuEl?.addEventListener("keydown",this._handleMenuKeydown),window.addEventListener("resize",this._handleWindowResize)}_removeTemporaryEventHandlers(){document.body.removeEventListener("click",this._handleDocumentClick),this.menuEl?.removeEventListener("touchmove",this._handleDocumentTouchmove),document.body.removeEventListener("touchmove",this._handleDocumentTouchmove),this.menuEl?.removeEventListener("keydown",this._handleMenuKeydown),window.removeEventListener("resize",this._handleWindowResize)}_setupAccessibility(){if(!this.menuEl)return;this.menuEl.hasAttribute("role")||this.menuEl.setAttribute("role","menu"),[this.menuEl,...this.menuEl.querySelectorAll("menu")].forEach(e=>{e.hasAttribute("role")||e.setAttribute("role","menu"),e.getAttribute("role")==="menu"&&e.querySelectorAll(":scope > li").forEach(i=>{if(i.classList.contains("divider")){i.hasAttribute("role")||i.setAttribute("role","separator");return}if(i.classList.contains("gap")){i.setAttribute("aria-hidden","true");return}if(i.classList.contains("label")||i.classList.contains("optgroup")){i.hasAttribute("role")||i.setAttribute("role","presentation");return}i.hasAttribute("role")||i.setAttribute("role","menuitem"),i.classList.contains("disabled")&&!i.hasAttribute("aria-disabled")&&i.setAttribute("aria-disabled","true")})})}_isSubmenuTriggerClick(t){if(!this.menuEl)return!1;let e=t.closest("li");if(!e||!this.menuEl.contains(e))return!1;let i=e.querySelector(":scope > menu");return i?!i.contains(t):!1}_setupSubmenus(){this.menuEl?.querySelectorAll("li").forEach(t=>{if(!t.querySelector(":scope > menu"))return;let e=t.querySelector(":scope > a, :scope > button, :scope > span")??t;e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false")})}_toggleSubmenu(t){let e=!t.classList.contains("open");t.parentElement?.querySelectorAll(":scope > li.open").forEach(i=>{i!==t&&(i.classList.remove("open","submenu-start"),this._syncSubmenuAria(i,!1))}),t.classList.toggle("open",e),e&&this._alignSubmenu(t),this._syncSubmenuAria(t,e)}_syncSubmenuAria(t,e){(t.querySelector(":scope > a, :scope > button, :scope > span")??t).setAttribute("aria-expanded",e?"true":"false")}_alignSubmenu(t){let e=t.querySelector(":scope > menu");if(!e)return;t.classList.remove("submenu-start");let i=e.getBoundingClientRect();(i.left<8||i.right>window.innerWidth-8)&&t.classList.add("submenu-start")}_closeSubmenus(){this.menuEl?.querySelectorAll("li.open").forEach(t=>{t.classList.remove("open","submenu-start"),this._syncSubmenuAria(t,!1)})}_containingSubmenu(t){let e=t.target;if(!(e instanceof Element))return null;let i=e.closest("li > menu");return i instanceof HTMLElement&&this.menuEl?.contains(i)?i:null}_focusedRow(t){let e=t.target;if(!(e instanceof Element))return null;let i=e.closest("li");return i instanceof HTMLElement&&this.menuEl?.contains(i)?i:null}_restoreInert(){this._originalInert===null?this.menuEl?.removeAttribute("inert"):this.menuEl?.setAttribute("inert",this._originalInert)}_focusRow(t){this.focusedIndex=Array.from(t.parentElement.children).indexOf(t),t.focus({preventScroll:!0}),t.scrollIntoView({block:"nearest",inline:"nearest"})}_resetMenuStyles(){this.menuEl.style.display="",this._resetMenuPositioningStyles(),this.menuEl.style.transform="",this.menuEl.style.opacity=""}_resetMenuPositioningStyles(){this.menuEl.style.width="",this.menuEl.style.height="",this.menuEl.style.left="",this.menuEl.style.top="",this.menuEl.style.transformOrigin=""}_moveMenuToElement(t=null){if(this.options.container){this.options.container.append(this.menuEl);return}if(t){t.contains(this.menuEl)||t.append(this.menuEl);return}this.el.after(this.menuEl)}_makeMenuFocusable(){this.menuEl&&(this.menuEl.popover="",this.menuEl.tabIndex=-1,this.menuEl.querySelectorAll(":scope li, :scope > hr").forEach(t=>{if(t instanceof HTMLHRElement||t.classList.contains("divider")||t.classList.contains("gap")||t.classList.contains("label")||t.classList.contains("optgroup")){t.setAttribute("tabindex","-1");return}t.getAttribute("tabindex")||t.setAttribute("tabindex","0")}))}_focusInitialItem(){if(!this.menuEl||!this.options.autoFocus)return;let t=Array.from(this.menuEl.children).find(e=>e instanceof HTMLElement&&e.tabIndex!==-1);t&&(this.focusedIndex=Array.from(this.menuEl.children).indexOf(t),t.focus({preventScroll:!0}))}_focusFocusedItem(){this.focusedIndex>=0&&this.focusedIndex<this.menuEl.children.length&&this.options.autoFocus&&(this.menuEl.children[this.focusedIndex].focus({preventScroll:!0}),this.menuEl.children[this.focusedIndex].scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}))}_getMenuPosition(t){let e=this.el.getBoundingClientRect(),i=this.menuEl.getBoundingClientRect(),s=i.height,n=i.width,a=e.left-i.left,h=e.top-i.top,c={left:a,top:h,height:s,width:n},l=u.checkPossibleAlignments(this.el,t,c,this.options.coverTrigger?0:e.height),r="top",p=this.options.alignment;if(h+=this.options.coverTrigger?0:e.height,this.isScrollable=!1,l.top||(l.bottom?(r="bottom",this.options.coverTrigger||(h-=e.height)):(this.isScrollable=!0,s-=20,l.spaceOnTop>l.spaceOnBottom?(r="bottom",s+=l.spaceOnTop,h-=this.options.coverTrigger?l.spaceOnTop-20:l.spaceOnTop-20+e.height):s+=l.spaceOnBottom)),!l[p]){let m=p==="left"?"right":"left";l[m]?p=m:l.spaceOnLeft>l.spaceOnRight?(p="right",n+=l.spaceOnLeft,a-=l.spaceOnLeft):(p="left",n+=l.spaceOnRight)}return r==="bottom"&&(h=h-i.height+(this.options.coverTrigger?e.height:0)),p==="right"&&(a=a-i.width+e.width),{x:a,y:h,verticalAlignment:r,horizontalAlignment:p,height:s,width:n}}_schedule(t,e){let i=setTimeout(()=>{this._pendingTimers.delete(i),t()},e);this._pendingTimers.add(i)}_clearPendingTimers(){for(let t of this._pendingTimers)clearTimeout(t);return this._pendingTimers.clear(),++this._transition}_animateIn(){let t=this._transition,e=this.options.inDuration;this.menuEl.style.transition="none",this.menuEl.style.opacity="0",this.menuEl.style.transform="scale(0.85)",this._schedule(()=>{this.menuEl.style.transition=`opacity ${e}ms ease, transform ${e}ms ease`,this.menuEl.style.opacity="1",this.menuEl.style.transform="scale(1)"},1),this._schedule(()=>{this._focusInitialItem(),t===this._transition&&typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,this.el)},e)}_animateOut(){let t=this.options.outDuration;this.menuEl.style.transition=`opacity ${t}ms ease, transform ${t}ms ease`,this.menuEl.style.opacity="0",this.menuEl.style.transform="scale(0.85)",this._schedule(()=>{this._resetMenuStyles(),typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,this.el)},t)}_getClosestAncestor(t,e){let i=t.parentNode;for(;i!=null&&i!==document;){if(i.nodeType===Node.ELEMENT_NODE&&e(i))return i;i=i.parentNode??i.host}return null}_placeMenu(){let t=this._getClosestAncestor(this.menuEl,a=>!["HTML","BODY"].includes(a.tagName)&&getComputedStyle(a).overflow!=="visible");if(!t){let a=this.menuEl.offsetParent?this.menuEl.offsetParent:this.menuEl.parentNode;t=a.host??a}getComputedStyle(t).position==="static"&&(t.style.position="relative");let e=this.menuEl.getBoundingClientRect().width,i=this.el.getBoundingClientRect().width,s=this.options.constrainWidth&&i>=yt?i:Math.min(jt,Math.max(yt,e));this.menuEl.style.width=s+"px";let n=this._getMenuPosition(t);this.menuEl.style.left=n.x+"px",this.menuEl.style.top=n.y+"px",this.menuEl.style.height=n.height+"px",this.menuEl.style.width=n.width+"px",this.menuEl.style.transformOrigin=`${n.horizontalAlignment==="left"?"0":"100%"} ${n.verticalAlignment==="top"?"0":"100%"}`}};R._menus=[];var H=R;var Zt={i18n:{loading:"Loading results.",noResults:"No results.",results:d=>`${d} ${d===1?"result":"results"} available.`,selected:d=>`${d} ${d===1?"item":"items"} selected.`},data:[],onAutocomplete:null,menuOptions:{autoFocus:!1,closeOnClick:!1,coverTrigger:!1},minLength:1,isMultiSelect:!1,onSearch:(d,o)=>{let t=d.toLocaleLowerCase(),e=o.options.data;o.setMenuItems(e.filter(i=>i.id.toString().toLocaleLowerCase().includes(t)||i.text?.toLocaleLowerCase().includes(t))),o.options.data=e},maxMenuHeight:"300px",allowUnsafeHTML:!1,selected:[]},D=class D extends _{constructor(t,e){super(t,e,D);this._handleInputBlur=()=>{this._pointerDown||(this.close(),this._resetAutocomplete())};this._handleInputKeyup=()=>{D._keydown=!1};this._handleInput=()=>{this.count=0;let t=this.el.value.toLocaleLowerCase();this.oldVal!==t&&this.el.matches(":focus-visible")&&this.open(),this._inputChangeDetection(t)};this._handleInputFocus=()=>{this.count=0;let t=this.el.value.toLocaleLowerCase();this._inputChangeDetection(t)};this._inputChangeDetection=t=>{!this.options.isMultiSelect&&this.selectedValues.length&&this.el.value!==(this.selectedValues[0].text||String(this.selectedValues[0].id))&&(this.selectedValues=[]),this.oldVal!==t&&(this._setStatusLoading(),this.options.onSearch(this.el.value,this)),!this.options.isMultiSelect&&this.el.value.length===0&&(this.selectedValues=[],this._triggerChanged()),this.oldVal=t};this._handleInputKeydown=t=>{if(D._keydown=!0,t.key===u.keys.ESC||t.key==="Tab"){this.close(),this._resetCurrentElementPosition();return}let e=this.container.querySelectorAll("li").length;if(t.key===u.keys.ENTER&&this.activeIndex>=0){let i=this.container.querySelectorAll("li")[this.activeIndex];i&&(this.selectOption(i.getAttribute("data-id")),t.preventDefault());return}(t.key===u.keys.ARROW_UP||t.key===u.keys.ARROW_DOWN)&&(t.preventDefault(),t.key===u.keys.ARROW_UP&&this.activeIndex>0&&this.activeIndex--,t.key===u.keys.ARROW_DOWN&&this.activeIndex<e-1&&this.activeIndex++,this._setActive(null),this.activeIndex>=0&&(this._setActive(this.container.querySelectorAll("li")[this.activeIndex]),this.container.children[this.activeIndex].scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})))};this._handleInputClick=()=>{this.open()};this._handleContainerPointerDown=t=>{t.isPrimary&&(t.pointerType==="mouse"&&t.button!==0||(this._pointerDown=!0))};this._handleContainerPointerUp=()=>{this._pointerDown=!1};this.open=()=>{let t=this.el.value.toLocaleLowerCase();this._resetAutocomplete(),t.length>=this.options.minLength&&(this._renderMenu(),this._announce(this.menuItems.length?this.options.i18n.results(this.menuItems.length):this.options.i18n.noResults)),this.menu.isOpen?this.menu.recalculateDimensions():(this._openTimer!==void 0&&clearTimeout(this._openTimer),this._openTimer=setTimeout(()=>{this._openTimer=void 0,this.menu.open()},0))};this.close=()=>{this._announcer&&(this._announcer.textContent=""),this._openTimer!==void 0&&(clearTimeout(this._openTimer),this._openTimer=void 0),this.isOpen=!1,this.menu.close()};this.el.Expressive_Autocomplete=this,this.options={...D.defaults,...e,i18n:{...D.defaults.i18n,...e?.i18n}},this.isOpen=!1,this.count=0,this.activeIndex=-1,this.oldVal="",this.selectedValues=this.options.selected.map(i=>this.options.data.find(s=>s.id===i)??{id:i}),this.menuItems=this.options.data||[],this.$active=null,this._pointerDown=!1,this._setupMenu(),this._setupEventHandlers()}_setActive(t){this.$active?.classList.remove("active"),this.$active=t,t?(t.classList.add("active"),this.el.setAttribute("aria-activedescendant",t.id)):this.el.removeAttribute("aria-activedescendant")}static get defaults(){return Zt}static init(t,e={}){return super.init(t,e,D)}static getInstance(t){return t.Expressive_Autocomplete}static _loadingIndicator(){if(!D._loadingTemplate){let t=document.createElement("template");t.innerHTML=`<div style="height:100%;width:50px;"><svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
|
|
2
2
|
<circle fill="#888c" stroke="none" cx="6" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"/></circle>
|
|
3
3
|
<circle fill="#888c" stroke="none" cx="26" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"/></circle>
|
|
4
4
|
<circle fill="#888c" stroke="none" cx="46" cy="50" r="6"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"/></circle>
|
|
5
|
-
</svg></div>`,I._loadingTemplate=t.content.firstElementChild}return I._loadingTemplate.cloneNode(!0)}destroy(){this._openTimer!==void 0&&(clearTimeout(this._openTimer),this._openTimer=void 0),this._removeEventHandlers(),this.menu.destroy(),this._removeMenu(),this._statusInfo.remove(),this._announcer.remove(),this.el.Expressive_Autocomplete=void 0}_setupEventHandlers(){this.el.addEventListener("blur",this._handleInputBlur),this.el.addEventListener("input",this._handleInput),this.el.addEventListener("keyup",this._handleInputKeyup),this.el.addEventListener("focus",this._handleInputFocus),this.el.addEventListener("keydown",this._handleInputKeydown),this.el.addEventListener("click",this._handleInputClick),this.container.addEventListener("pointerdown",this._handleContainerPointerDown),this.container.addEventListener("pointerup",this._handleContainerPointerUp),this.container.addEventListener("pointercancel",this._handleContainerPointerUp)}_removeEventHandlers(){this.el.removeEventListener("blur",this._handleInputBlur),this.el.removeEventListener("input",this._handleInput),this.el.removeEventListener("keyup",this._handleInputKeyup),this.el.removeEventListener("focus",this._handleInputFocus),this.el.removeEventListener("keydown",this._handleInputKeydown),this.el.removeEventListener("click",this._handleInputClick),this.container.removeEventListener("pointerdown",this._handleContainerPointerDown),this.container.removeEventListener("pointerup",this._handleContainerPointerUp),this.container.removeEventListener("pointercancel",this._handleContainerPointerUp)}_setupMenu(){this.container=document.createElement("menu"),this.container.style.maxHeight=this.options.maxMenuHeight,this.container.id=`autocomplete-options-${u.guid()}`,this.container.classList.add("autocomplete-content"),this.container.ariaExpanded="true",this.container.setAttribute("role","listbox"),this.el.setAttribute("role","combobox"),this.el.setAttribute("aria-autocomplete","list"),this.el.setAttribute("aria-controls",this.container.id),this.el.setAttribute("data-target",this.container.id),this.menuItems.forEach(n=>{let a=this._createMenuItem(n);this.container.append(a)}),this.el.parentElement.appendChild(this.container);let t={...I.defaults.menuOptions,...this.options.menuOptions},e=t.onItemClick;t.onItemClick=n=>{if(!n)return;let a=n.getAttribute("data-id");this.selectOption(a),typeof e=="function"&&e.call(this.menu,n)},this.menu=O.init(this.el,t),this.el.setAttribute("aria-haspopup","listbox");let i=this.el.parentElement.querySelector("label");if(i&&this.el.after(i),this.el.removeEventListener("click",this.menu._handleClick),!this.options.isMultiSelect&&this.options.selected.length!==0){let n=this.menuItems.filter(a=>a.id===this.selectedValues[0].id);this.el.value=n[0].text}this.el.value&&this.selectOption(this.el.value);let s=document.createElement("div");s.classList.add("status-info"),s.setAttribute("aria-hidden","true"),s.setAttribute("style","position: absolute;right:0;top:0;"),this.el.parentElement.appendChild(s),this._statusInfo=s,this._announcer=document.createElement("div"),this._announcer.classList.add("autocomplete-status"),this._announcer.setAttribute("role","status"),this._announcer.setAttribute("aria-live","polite"),this._announcer.setAttribute("aria-atomic","true"),this.el.parentElement.appendChild(this._announcer),this._updateSelectedInfo()}_removeMenu(){this.container.ariaExpanded="false",this.container.parentNode.removeChild(this.container)}_resetCurrentElementPosition(){this.activeIndex=-1,this._setActive(null)}_resetAutocomplete(){this.container.replaceChildren(),this._resetCurrentElementPosition(),this.oldVal=null,this.isOpen=!1,this._pointerDown=!1}_highlightPartialText(t,e){let i=e.toLocaleLowerCase().indexOf(""+t.toLocaleLowerCase()),s=i+t.length-1;return i==-1||s==-1?[e,"",""]:[e.slice(0,i),e.slice(i,s+1),e.slice(s+1)]}_createMenuItem(t){let e=document.createElement("li");e.id=`autocomplete-option-${u.guid()}`,e.setAttribute("role","option");let i=this.selectedValues.some(l=>l.id===t.id);if(e.setAttribute("aria-selected",i?"true":"false"),e.setAttribute("data-id",t.id),e.setAttribute("style","display:grid; grid-auto-flow: column; user-select: none; align-items: center;"),e.tabIndex=-1,this.options.isMultiSelect){let l=document.createElement("div");l.classList.add("item-selection"),l.style.textAlign="center";let r=document.createElement("input");r.type="checkbox",r.tabIndex=-1,r.checked=i;let m=document.createElement("span");m.style.paddingLeft="21px",l.append(r,m),e.appendChild(l)}if(t.image){let l=document.createElement("img");l.classList.add("circle"),l.src=t.image,e.appendChild(l)}let s=this.el.value.toLocaleLowerCase(),n=this._highlightPartialText(s,(t.text||t.id).toString()),a=document.createElement("div");if(a.setAttribute("style","line-height:1.2;font-weight:500;"),this.options.allowUnsafeHTML)a.innerHTML=n[0]+'<span class="highlight">'+n[1]+"</span>"+n[2];else if(a.appendChild(document.createTextNode(n[0])),n[1]){let l=document.createElement("span");l.textContent=n[1],l.classList.add("highlight"),a.appendChild(l),a.appendChild(document.createTextNode(n[2]))}let c=document.createElement("div");if(c.classList.add("item-text"),c.setAttribute("style","padding:5px;overflow:hidden;"),e.appendChild(c),e.querySelector(".item-text").appendChild(a),typeof t.description=="string"||typeof t.description=="number"&&!isNaN(t.description)){let l=document.createElement("small");l.setAttribute("style","line-height:1.3;color:grey;white-space:nowrap;text-overflow:ellipsis;display:block;width:90%;overflow:hidden;"),l.innerText=t.description,e.querySelector(".item-text").appendChild(l)}let h=()=>this.options.isMultiSelect?t.image?"40px min-content auto":"40px auto":t.image?"min-content auto":"auto";return e.style.gridTemplateColumns=h(),e}_renderMenu(){this._resetAutocomplete(),this.menuItems.length===0&&(this.menuItems=this.selectedValues);for(let t=0;t<this.menuItems.length;t++){let e=this._createMenuItem(this.menuItems[t]);this.container.append(e)}}_setStatusLoading(){let t=this._statusInfo;t&&t.replaceChildren(I._loadingIndicator()),this._announce(this.options.i18n.loading)}_announce(t){if(!this._announcer)return;let e=this.el.matches(":focus")&&this.el.value.length>=this.options.minLength?t:"";this._announcer.textContent!==e&&(this._announcer.textContent=e)}_updateSelectedInfo(){let t=this._statusInfo;t&&(this.options.isMultiSelect?t.textContent=this.selectedValues.length.toString():t.replaceChildren())}_refreshInputText(){if(this.selectedValues.length===1){let t=this.selectedValues[0];this.el.value=t.text||t.id}}_triggerChanged(){this.el.dispatchEvent(new Event("change")),typeof this.options.onAutocomplete=="function"&&this.options.onAutocomplete.call(this,this.selectedValues)}setMenuItems(t,e=null,i=!0){if(this.el.Expressive_Autocomplete!==this)return;let s=t.length;this.menuItems=t,this.options.data=t,e&&(this.selectedValues=this.menuItems.filter(n=>e.indexOf(n.id)!==-1)),this.options.isMultiSelect?this._renderMenu():this._refreshInputText(),i&&this.open(),this._updateSelectedInfo(),this._announce(i?s?this.options.i18n.results(s):this.options.i18n.noResults:""),this._triggerChanged()}selectOption(t){let e=this.menuItems.find(i=>i.id==t);e&&(this.options.isMultiSelect?(this.selectedValues.filter(i=>i.id===e.id).length>=1?this.selectedValues=this.selectedValues.filter(i=>i.id!==e.id):this.selectedValues.push(e),this._renderMenu(),this.el.focus()):(this.selectedValues=[e],this._refreshInputText(),this._resetAutocomplete(),this.close()),this._updateSelectedInfo(),this.options.isMultiSelect&&this._announce(this.options.i18n.selected(this.selectedValues.length)),this._triggerChanged())}};I._loadingTemplate=null;var B=I;var Zt={data:[],placeholder:"",secondaryPlaceholder:"",closeIconClass:"material-symbols",autocompleteOptions:{},autocompleteOnly:!1,limit:1/0,allowUserInput:!1,i18n:{remove:"Remove"},onChipAdd:null,onChipSelect:null,onChipDelete:null},C=class C extends _{constructor(t,e){super(t,e,C);this._handleChipClick=t=>{let e=t.target.closest(".chip"),i=!!t.target.closest(".close");if(e){let s=this._chips.indexOf(e);if(s<0)return;i?this._deleteChip(s,"input"):this.selectChip(s)}else this._input.focus()};this._handleInputFocus=()=>{this.el.classList.add("focus")};this._handleInputBlur=()=>{this.el.classList.remove("focus")};this._handleInputKeydown=t=>{if(C._keydown=!0,t.key===u.keys.ENTER){if(this.hasAutocomplete&&this.autocomplete&&this.autocomplete.isOpen)return;t.preventDefault(),(!this.hasAutocomplete||this.hasAutocomplete&&!this.options.autocompleteOnly)&&this.addChip({id:this._input.value}),this._input.value=""}else(t.key===u.keys.BACKSPACE||t.key===u.keys.ARROW_LEFT)&&this._input.value===""&&this.chipsData.length&&(t.preventDefault(),this.selectChip(this.chipsData.length-1))};this.el.Expressive_Chips=this,this.options={...C.defaults,...e},e?.i18n&&(this.options.i18n={...C.defaults.i18n,...e.i18n}),this.el.classList.add("chips"),this.chipsData=[],this._chips=[],this.options.data.length&&(this.chipsData=this.options.data,this._renderChips()),this.options.allowUserInput&&(this.el.classList.add("field"),this._setupInput(),this._setupEventHandlers(),this.el.append(this._input)),this._setupLabel()}_setSelected(t){this._selectedChip?.classList.remove("selected"),this._selectedChip=t,t?.classList.add("selected")}static get defaults(){return Zt}static init(t,e={}){return super.init(t,e,C)}static getInstance(t){return t.Expressive_Chips}getData(){return this.chipsData}destroy(){this.options.allowUserInput&&this._removeEventHandlers(),this._chips.forEach(t=>t.remove()),this._chips=[],this.el.Expressive_Chips=void 0}_setupEventHandlers(){this.el.addEventListener("click",this._handleChipClick),this.el.addEventListener("keydown",C._handleChipsKeydown),this.el.addEventListener("keyup",C._handleChipsKeyup),this.el.addEventListener("blur",C._handleChipsBlur,!0),this._input.addEventListener("focus",this._handleInputFocus),this._input.addEventListener("blur",this._handleInputBlur),this._input.addEventListener("keydown",this._handleInputKeydown)}_removeEventHandlers(){this.el.removeEventListener("click",this._handleChipClick),this.el.removeEventListener("keydown",C._handleChipsKeydown),this.el.removeEventListener("keyup",C._handleChipsKeyup),this.el.removeEventListener("blur",C._handleChipsBlur,!0),this._input.removeEventListener("focus",this._handleInputFocus),this._input.removeEventListener("blur",this._handleInputBlur),this._input.removeEventListener("keydown",this._handleInputKeydown)}static _handleChipsKeydown(t){C._keydown=!0;let e=t.target.closest(".chips"),i=t.target&&e,s=t.target.tagName;if(s==="INPUT"||s==="TEXTAREA"||!i)return;let n=e.Expressive_Chips;if(n){if(t.key===u.keys.BACKSPACE||t.key===u.keys.DELETE){let a=n._chips.indexOf(t.target.closest(".chip"));if(a<0)return;t.preventDefault(),n._deleteChip(a,"previous")}else if(t.key===u.keys.ARROW_LEFT){if(n._selectedChip){let a=n._chips.indexOf(n._selectedChip)-1;if(a<0)return;n.selectChip(a)}}else if(t.key===u.keys.ARROW_RIGHT&&n._selectedChip){let a=n._chips.indexOf(n._selectedChip)+1;a>=n.chipsData.length?(n._setSelected(null),n._input.focus()):n.selectChip(a)}}}static _handleChipsKeyup(){C._keydown=!1}static _handleChipsBlur(t){if(!C._keydown&&document.hidden){let i=t.target.closest(".chips")?.Expressive_Chips;i&&i._setSelected(null)}}_renderChip(t){if(!t.id)return;let e=t.text||t.id,i=document.createElement("span");if(i.classList.add("chip"),i.innerText=e,t.image){let s=document.createElement("img");s.setAttribute("src",t.image),i.insertBefore(s,i.firstChild)}if(this.options.allowUserInput){let s=document.createElement("button");s.type="button",s.classList.add("close"),s.setAttribute("aria-label",`${this.options.i18n.remove} ${e}`);let n=document.createElement("span");n.classList.add(this.options.closeIconClass),n.setAttribute("aria-hidden","true"),n.innerText="close",s.appendChild(n),i.appendChild(s)}return i}_renderChips(){this._chips=[];for(let t=0;t<this.chipsData.length;t++){let e=this._renderChip(this.chipsData[t]);this.el.appendChild(e),this._chips.push(e)}}_setupAutocomplete(){this.options.autocompleteOptions.onAutocomplete=t=>{t.length>0&&this.addChip({id:t[0].id,text:t[0].text,image:t[0].image}),this._input.value="",this._input.focus()},this.autocomplete=B.init(this._input,this.options.autocompleteOptions)}_setupInput(){this._input=this.el.querySelector("input"),this._input||(this._input=document.createElement("input"),this.el.append(this._input)),this._input.classList.add("input"),this.hasAutocomplete=Object.keys(this.options.autocompleteOptions).length>0,this.hasAutocomplete&&this._setupAutocomplete(),this._setPlaceholder(),this._input.getAttribute("id")||this._input.setAttribute("id",u.guid())}_setupLabel(){this._label=this.el.querySelector("label"),this._label&&this._input&&this._label.setAttribute("for",this._input.getAttribute("id"))}_setPlaceholder(){this.chipsData!==void 0&&!this.chipsData.length&&this.options.placeholder?this._input.placeholder=this.options.placeholder:(this.chipsData===void 0||this.chipsData.length)&&this.options.secondaryPlaceholder&&(this._input.placeholder=this.options.secondaryPlaceholder)}_isValidAndNotExist(t){let e=!!t.id,i=!this.chipsData.some(s=>s.id==t.id);return e&&i}addChip(t){if(!this._isValidAndNotExist(t)||this.chipsData.length>=this.options.limit)return;let e=this._renderChip(t);this._chips.push(e),this.chipsData.push(t),this._input.before(e),this._setPlaceholder(),typeof this.options.onChipAdd=="function"&&this.options.onChipAdd(this.el,e)}deleteChip(t){let e=this.el.getRootNode();this._deleteChip(t,this._chips[t]?.contains(e.activeElement)?"input":null)}_deleteChip(t,e){let i=this._chips[t];if(!i)return;this._selectedChip===i&&this._setSelected(null),i.remove(),this._chips.splice(t,1),this.chipsData.splice(t,1),this._setPlaceholder();let s=[],n=this.el.getRootNode();for(;n;)s.push({root:n,element:n.activeElement}),n="host"in n?n.host.getRootNode():null;typeof this.options.onChipDelete=="function"&&this.options.onChipDelete(this.el,i),!(!e||s.some(({root:a,element:c})=>a.activeElement!==c)||this.el.Expressive_Chips!==this)&&(e==="previous"&&this._chips.length?this.selectChip(Math.max(t-1,0)):(this._setSelected(null),this._input?.focus()))}selectChip(t){let e=this._chips[t];e&&(this._setSelected(e),e.querySelector(".close")?.focus(),typeof this.options.onChipSelect=="function"&&this.options.onChipSelect(this.el,e))}static Init(){u.onDocumentReady(()=>{document.querySelectorAll(".chips").forEach(e=>{e.addEventListener("click",i=>{if(!e.Expressive_Chips&&i.target.closest(".close")){let s=i.target.closest(".chip");s&&s.remove()}})})})}};C._keydown=!1;var N=C;var Qt={},V=class d extends _{constructor(t,e){super(t,e,d);this._resizeObserver=null;this._handleRangeChange=()=>{this._clampDual(),this._sync(),this.thumb.classList.add("active")};this._handleRangePointerDown=t=>{t.isPrimary&&(t.pointerType==="mouse"&&t.button!==0||(this._pointerDown=!0,this.el.classList.add("active"),this._clampDual(),this._sync(),this.thumb.classList.add("active")))};this._handleRangeInputOrMove=t=>{(t.type==="input"||this._pointerDown)&&(this._clampDual(),this._sync(),this.thumb.classList.add("active"))};this._handleRangePointerUp=t=>{t.isPrimary&&(this._pointerDown=!1,this.el.classList.remove("active"))};this._handleRangeRelease=()=>{this._pointerDown||this.thumb.classList.remove("active")};this.el.Expressive_Slider=this,this.options={...d.defaults,...e},this._pointerDown=!1,this._setupThumb(),this._sync(),this._setupEventHandlers(),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._sync()),this._resizeObserver.observe(this.el))}static get defaults(){return Qt}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_Slider}destroy(){this._resizeObserver?.disconnect(),this._removeEventHandlers(),this._removeThumb(),this.el.Expressive_Slider=void 0}_setupEventHandlers(){this.el.addEventListener("change",this._handleRangeChange),this.el.addEventListener("pointerdown",this._handleRangePointerDown),this.el.addEventListener("input",this._handleRangeInputOrMove),this.el.addEventListener("pointermove",this._handleRangeInputOrMove,{passive:!0}),this.el.addEventListener("pointerup",this._handleRangePointerUp),this.el.addEventListener("pointercancel",this._handleRangePointerUp),this.el.addEventListener("blur",this._handleRangeRelease),this.el.addEventListener("mouseout",this._handleRangeRelease)}_removeEventHandlers(){this.el.removeEventListener("change",this._handleRangeChange),this.el.removeEventListener("pointerdown",this._handleRangePointerDown),this.el.removeEventListener("input",this._handleRangeInputOrMove),this.el.removeEventListener("pointermove",this._handleRangeInputOrMove),this.el.removeEventListener("pointerup",this._handleRangePointerUp),this.el.removeEventListener("pointercancel",this._handleRangePointerUp),this.el.removeEventListener("blur",this._handleRangeRelease),this.el.removeEventListener("mouseout",this._handleRangeRelease)}_setupThumb(){this.thumb=document.createElement("span"),this.value=document.createElement("span"),this.thumb.classList.add("thumb"),this.value.classList.add("value"),this.thumb.append(this.value),this.el.after(this.thumb)}_removeThumb(){this.thumb.remove()}_isVertical(){return!!this.el.closest(".vertical")}_host(){return this.el.closest(".slider, .range, .range-field, label")}_clampDual(){let e=this._host()?.querySelectorAll('input[type="range"]');if(!e||e.length!==2)return;let i=e[0],s=e[1];this.el===i&&+i.value>+s.value&&(i.value=s.value),this.el===s&&+s.value<+i.value&&(s.value=i.value)}_fraction(t){let e=parseFloat(t.max),i=Number.isNaN(e)?100:e,s=parseFloat(t.min)||0,n=parseFloat(t.value)||0;return i===s?0:(n-s)/(i-s)}_sync(){let t=this._fraction(this.el),e=`${t*100}%`,i=this.el.offsetLeft,s=this.el.offsetTop,n=this.el.offsetWidth,a=this.el.offsetHeight,c=getComputedStyle(this.el),h=c.direction==="rtl",l=this._isVertical(),r=parseFloat(c.getPropertyValue("--md-comp-slider-handle-width"))||4,m=l?a:n,p=r/2+t*(m-r);this.el.style.setProperty("--md-comp-slider-active-fraction",e),this.el.style.setProperty("--md-comp-slider-active-position",`${p}px`);let v=this._host(),E=v?.querySelectorAll('input[type="range"]');if(v&&E&&E.length===2){let b=Array.from(E).map(w=>this._fraction(w));v.style.setProperty("--md-comp-slider-start-fraction",`${Math.min(...b)*100}%`),v.style.setProperty("--md-comp-slider-end-fraction",`${Math.max(...b)*100}%`),v.style.setProperty("--md-comp-slider-start-position",`${r/2+Math.min(...b)*(m-r)}px`),v.style.setProperty("--md-comp-slider-end-position",`${r/2+Math.max(...b)*(m-r)}px`)}if(v?.classList.contains("stops")){let b=parseFloat(this.el.max),w=Number.isNaN(b)?100:b,D=parseFloat(this.el.min)||0,F=parseFloat(this.el.step);if(F>0&&Number.isFinite(F)){let M=Math.round((w-D)/F)+1;v.style.setProperty("--md-comp-slider-stop-count",String(Math.max(2,M)))}}this.value.textContent=this.el.value,l?(this.thumb.style.left=`${i+n/2}px`,this.thumb.style.top=`${s+a-p}px`):(this.thumb.style.left=`${i+(h?n-p:p)}px`,this.thumb.style.top=`${s}px`)}static Init(){u.onDocumentReady(()=>{d.init(document.querySelectorAll("input[type=range]"),{})})}};var T=class T{static Init(){u.onDocumentReady(()=>{document.addEventListener("pointerdown",T._onPointerDown,{passive:!0}),document.addEventListener("pointerup",T._onPointerUp,{passive:!0}),document.addEventListener("pointercancel",T._onPointerCancel,{passive:!0})})}static _onPointerDown(o){if(!T._isPrimaryPress(o)){T._down=null;return}let t=T._backdropDialog(o);if(!t||!T._lightDismissible(t)||!T._outside(o,t)){T._down=null;return}T._down={dialog:t,pointerId:o.pointerId}}static _onPointerUp(o){let t=T._down;T._down=null,!(!t||t.pointerId!==o.pointerId)&&o.isPrimary&&(!t.dialog.isConnected||!t.dialog.open||T._lightDismissible(t.dialog)&&T._backdropDialog(o)===t.dialog&&T._outside(o,t.dialog)&&t.dialog.close())}static _onPointerCancel(){T._down=null}static _backdropDialog(o){let t=o.target;return!(t instanceof HTMLDialogElement)||!t.open?null:t}static _outside(o,t){let e=t.getBoundingClientRect();return o.clientX<e.left||o.clientX>e.right||o.clientY<e.top||o.clientY>e.bottom}static _isPrimaryPress(o){return o.isPrimary?o.pointerType!=="mouse"||o.button===0:!1}static _lightDismissible(o){let t=T._closedBy(o);return!(t==="none"||t==="closerequest"||t==="any"&&"closedBy"in HTMLDialogElement.prototype)}static _closedBy(o){let t=o.getAttribute("closedby");return t==="any"||t==="closerequest"||t==="none"?t:null}};T._down=null;var $=T;var yt=96,bt=.5,Jt=4;function at(d){let o=l=>d.axis==="x"?l.clientX:l.clientY,t,e=null,i=l=>{if(!(l instanceof Element))return null;let r=l.closest(d.selector);return r instanceof HTMLDialogElement?r:null},s=l=>{l.style.transition="",l.style.setProperty(d.property,"0px")},n=l=>{if(!l.isPrimary||l.pointerType==="mouse"&&l.button!==0)return;h(),d.onPress?.();let r=i(l.target);if(!r?.open){e=null;return}if(!d.inHandle(l,r)){e=null;return}r.style.transition="none",e={dialog:r,pointerId:l.pointerId,direction:d.direction(r),start:o(l),last:o(l),lastT:Date.now(),shift:0},t.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open"],attributeOldValue:!0})},a=l=>{if(!e||e.pointerId!==l.pointerId)return;if(!e.dialog.open||!e.dialog.isConnected){h();return}let r=o(l)-e.start;e.shift=e.direction===1?Math.max(0,r):Math.min(0,r),e.last=o(l),e.lastT=Date.now(),e.dialog.style.setProperty(d.property,`${e.shift}px`)},c=l=>{let r=e;if(!r||r.pointerId!==l.pointerId)return;if(!r.dialog.open||!r.dialog.isConnected){h();return}e=null,t.disconnect(),r.dialog.style.transition="";let m=Math.max(1,Date.now()-r.lastT),p=(o(l)-r.last)/m;d.onRelease?.(Math.abs(r.shift)>Jt),(r.direction===1?r.shift>yt||p>bt:r.shift<-yt||p<-bt)&&r.dialog.open&&r.dialog.close(),r.dialog.style.setProperty(d.property,"0px")},h=l=>{if(l&&e?.pointerId!==l.pointerId)return;t.disconnect(),d.onRelease?.(!1);let r=e;e=null,r&&s(r.dialog)};u.onDocumentReady(()=>{t=new MutationObserver(l=>{let r=e?.dialog;r&&(!r.open||!r.isConnected||l.some(m=>m.type==="attributes"&&m.target===r&&m.oldValue===null||[...m.removedNodes].some(p=>p.contains(r))))&&h()}),document.addEventListener("pointerdown",n,{passive:!0}),document.addEventListener("pointermove",a,{passive:!0}),document.addEventListener("pointerup",c,{passive:!0}),document.addEventListener("pointercancel",h,{passive:!0})})}var Lt="dialog.bottom-sheet, dialog.bottom",q=class q{static Init(){at({selector:Lt,axis:"y",property:"--md-comp-bottom-sheet-shift",direction:()=>1,inHandle:(o,t)=>{let e=o.target;if(e instanceof Element&&e.closest(".handle"))return!0;let i=t.getBoundingClientRect();return o.clientY>=i.top&&o.clientY<=i.top+48},onPress:()=>{q._dragged=!1},onRelease:o=>{q._dragged=o}}),u.onDocumentReady(()=>{document.addEventListener("click",q._onClick)})}static _onClick(o){let t=o.target;if(!(t instanceof Element))return;let e=t.closest(".handle, .drag-handle");if(!(e instanceof HTMLButtonElement)||o.detail!==0&&q._dragged)return;let i=e.closest(Lt);i instanceof HTMLDialogElement&&i.open&&i.close()}};q._dragged=!1;var K=q;var te=d=>d.classList.contains("left")||d.classList.contains("left-sheet")||d.classList.contains("start"),Tt=d=>te(d)!==(getComputedStyle(d).direction==="rtl"),z=class{static Init(){at({selector:"dialog.side-sheet, dialog.right, dialog.right-sheet, dialog.left, dialog.left-sheet",axis:"x",property:"--md-comp-side-sheet-shift",direction:o=>Tt(o)?-1:1,inHandle:(o,t)=>{let e=o.target;if(e instanceof Element&&e.closest("header"))return!0;let i=t.getBoundingClientRect();return Tt(t)?o.clientX>=i.right-24&&o.clientX<=i.right:o.clientX>=i.left&&o.clientX<=i.left+24}})}};var U=class d{static validateField(o){if(!o){console.error("No text field element found");return}let t=o.getAttribute("data-length")!==null,e=parseInt(o.getAttribute("data-length")),i=o.value.length;i===0&&o.validity.badInput===!1&&!o.required&&o.classList.contains("validate")?o.classList.remove("invalid"):o.classList.contains("validate")&&(o.validity.valid&&t&&i<=e||o.validity.valid&&!t?o.classList.remove("invalid"):o.classList.add("invalid"))}static textareaAutoResize(o){let t=o;if(!t)return;t.hasAttribute("original-height")||t.setAttribute("original-height",t.getBoundingClientRect().height.toString());let e=parseInt(t.getAttribute("original-height"));if(isNaN(e))return;t.style.height="auto";let i=t.offsetHeight-t.clientHeight,s=t.scrollHeight+i;t.style.height=Math.max(e,s)+"px"}static Init(){u.onDocumentReady(()=>{document.addEventListener("change",o=>{let t=o.target;t instanceof HTMLInputElement&&d.validateField(t)}),document.addEventListener("keyup",o=>{let t=o.target;t instanceof HTMLInputElement&&["radio","checkbox"].includes(t.type)&&o.key===u.keys.TAB&&(t.classList.add("tabbed"),t.addEventListener("blur",()=>t.classList.remove("tabbed"),{once:!0}))}),document.querySelectorAll(".expressive-textarea").forEach(o=>{d.InitTextarea(o)}),document.querySelectorAll('.file-field input[type="file"]').forEach(o=>{d.InitFileInputPath(o)})})}static InitTextarea(o){o.setAttribute("original-height",o.getBoundingClientRect().height.toString()),d.textareaAutoResize(o),o.addEventListener("input",t=>d.textareaAutoResize(t.target))}static InitFileInputPath(o){o.addEventListener("change",()=>{let e=o.closest(".file-field").querySelector("input.file-path"),i=o.files,s=[];for(let n=0;n<i.length;n++)s.push(i[n].name);e.value=s.join(", "),e.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))})}};var ee={},Y=class d extends _{constructor(t,e){super(t,e,d);this._observer=null;this._sentinel=null;this._input=null;this._view=null;this._searchOpen=!1;this._onIntersect=t=>{let e=t[0];e&&this.el.classList.toggle("collapsed",!e.isIntersecting)};this._onSearchViewClose=()=>{this._searchOpen=this._view.open};this._onSearchFocus=()=>{if(!(!this._view||this._searchOpen)){if(this._view instanceof HTMLDialogElement){this._searchOpen=!0,this._view.open||this._view.showModal();return}this._view.hidden=!1,this._input?.setAttribute("aria-expanded","true")}};this.el.Expressive_AppBar=this,this.options={...d.defaults,...e},this._setupCollapse(),this._setupSearch()}static get defaults(){return ee}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_AppBar}destroy(){this._observer?.disconnect(),this._observer=null,this._sentinel?.remove(),this._sentinel=null,this._input?.removeEventListener("focus",this._onSearchFocus),this._input?.removeEventListener("click",this._onSearchFocus),this._view?.removeEventListener("close",this._onSearchViewClose),this.el.classList.remove("collapsed"),this.el.Expressive_AppBar=void 0}_setupCollapse(){!this.el.classList.contains("medium")&&!this.el.classList.contains("large")||typeof IntersectionObserver>"u"||(this._sentinel=document.createElement("span"),this._sentinel.setAttribute("aria-hidden","true"),this._sentinel.style.cssText="display:block;width:100%;height:1px;margin-top:-1px;pointer-events:none;visibility:hidden",this.el.insertAdjacentElement("beforebegin",this._sentinel),this._observer=new IntersectionObserver(this._onIntersect),this._observer.observe(this._sentinel))}_setupSearch(){if(this._input=this.el.querySelector('input[type="search"]'),!this._input)return;let t=this._input.getAttribute("aria-controls");t&&(this._view=document.getElementById(t)),this._view||(this._view=this.el.querySelector(".search-view")),this._view&&(this._input.addEventListener("focus",this._onSearchFocus),this._input.addEventListener("click",this._onSearchFocus),this._view instanceof HTMLDialogElement&&this._view.addEventListener("close",this._onSearchViewClose))}};var ie={},G=class d extends _{constructor(t,e){super(t,e,d);this.open=()=>{this.isOpen||(this.isOpen=!0,this._list&&(this._list.inert=!1),this.el.classList.add("active"),this._anchor?.setAttribute("aria-expanded","true"),document.addEventListener("click",this._handleDocumentClick),document.addEventListener("keydown",this._handleDocumentKeydown))};this.close=()=>{if(!this.isOpen)return;let t=this.el.getRootNode().activeElement;t&&this._list?.contains(t)&&this._anchor?.focus(),this._list&&(this._list.inert=!0),this.isOpen=!1,this.el.classList.remove("active"),this._anchor?.setAttribute("aria-expanded","false"),document.removeEventListener("click",this._handleDocumentClick),document.removeEventListener("keydown",this._handleDocumentKeydown)};this._handleFABClick=t=>{let e=t.target;if(!(e instanceof Element))return;let i=e.closest("a, button");!i||i.matches(':disabled, [aria-disabled="true"]')||(i===this._anchor?this._toggle():this._list?.contains(i)&&this.close())};this._handleAnchorKeydown=t=>{(t.key===u.keys.ENTER||t.key===" ")&&(t.preventDefault(),this._toggle())};this._handleDocumentKeydown=t=>{t.key===u.keys.ESC&&!t.defaultPrevented&&this.close()};this._handleDocumentClick=t=>{t.composedPath().includes(this.el)||this.close()};this.el.Expressive_FloatingActionButton=this,this.options={...d.defaults,...e},this.isOpen=!1,this._anchor=this.el.querySelector(":scope > a, :scope > button"),this._list=this.el.querySelector(":scope > ul, :scope > menu"),this._listWasInert=this._list?.inert??!1,this.el.classList.remove("active"),this._list&&(this._list.inert=!0),this._anchor?.setAttribute("aria-expanded","false"),this._anchor instanceof HTMLAnchorElement&&!this._anchor.hasAttribute("href")&&(this._anchor.tabIndex<0&&(this._anchor.tabIndex=0),this._anchor.addEventListener("keydown",this._handleAnchorKeydown)),this.el.addEventListener("click",this._handleFABClick)}static get defaults(){return ie}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_FloatingActionButton}destroy(){this.close(),this._list&&(this._list.inert=this._listWasInert),this.el.removeEventListener("click",this._handleFABClick),this._anchor?.removeEventListener("keydown",this._handleAnchorKeydown),this.el.Expressive_FloatingActionButton=void 0}_toggle(){this.isOpen?this.close():this.open()}};var se={},ne=new Set(["single","multiple"]),Mt="button-group-pressed",oe=.15,X=class d extends _{constructor(t,e={}){super(t,e,d);this._pressedStyles=new Map;this._releaseStyles=new Map;this._releaseTimer=null;this._originalPressed=new Map;this._activeItem=null;this._handleClick=t=>{if(!this._selectionMode)return;let e=this._itemFromEvent(t);if(!(e instanceof HTMLButtonElement)||this._isDisabled(e))return;this._rememberPressed(e);let i=e.getAttribute("aria-pressed")!=="true",s=this._toggleItems.filter(n=>n.getAttribute("aria-pressed")==="true").length;!i&&this.el.hasAttribute("data-selection-required")&&s===1||(this._selectionMode==="single"&&i&&this._toggleItems.forEach(n=>{this._rememberPressed(n),n.setAttribute("aria-pressed","false")}),e.setAttribute("aria-pressed",i?"true":"false"))};this._handlePointerDown=t=>{if(t.button!==0)return;let e=this._itemFromEvent(t);e&&!this._isDisabled(e)&&this._startPress(e)};this._handleKeyDown=t=>{if(t.repeat||t.key!==" "&&t.key!=="Enter")return;let e=this._itemFromEvent(t);e&&!this._isDisabled(e)&&this._startPress(e)};this._handleKeyUp=t=>{(t.key===" "||t.key==="Enter")&&this._resetPress()};this._handleFocusOut=t=>{t.target===this._activeItem&&this._resetPress()};this._resetPress=()=>{if(this._activeItem?.classList.remove(Mt),this._activeItem=null,!!this._pressedStyles.size){this._finishRelease(),this._releaseStyles=new Map(this._pressedStyles);for(let[t,e]of this._releaseStyles)t.style.width=`${e.baseWidth}px`;this._pressedStyles.clear(),this._releaseTimer=window.setTimeout(this._finishRelease,200)}};this._finishRelease=()=>{this._releaseTimer!==null&&window.clearTimeout(this._releaseTimer),this._releaseTimer=null;for(let[t,e]of this._releaseStyles)t.style.width=e.width;this._releaseStyles.clear()};this.el.Expressive_ButtonGroup=this,this.options={...d.defaults,...e},this._selectionMode&&(this._normalizeSelection(),this.el.addEventListener("click",this._handleClick,!0)),this.el.addEventListener("pointerdown",this._handlePointerDown),this.el.addEventListener("keydown",this._handleKeyDown),this.el.addEventListener("focusout",this._handleFocusOut),document.addEventListener("pointerup",this._resetPress),document.addEventListener("pointercancel",this._resetPress),document.addEventListener("keyup",this._handleKeyUp),window.addEventListener("blur",this._resetPress)}static get defaults(){return se}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_ButtonGroup}destroy(){this._resetPress(),this._finishRelease(),this.el.removeEventListener("click",this._handleClick,!0),this.el.removeEventListener("pointerdown",this._handlePointerDown),this.el.removeEventListener("keydown",this._handleKeyDown),this.el.removeEventListener("focusout",this._handleFocusOut),document.removeEventListener("pointerup",this._resetPress),document.removeEventListener("pointercancel",this._resetPress),document.removeEventListener("keyup",this._handleKeyUp),window.removeEventListener("blur",this._resetPress);for(let[t,e]of this._originalPressed)e===null?t.removeAttribute("aria-pressed"):t.setAttribute("aria-pressed",e);this._originalPressed.clear(),this.el.Expressive_ButtonGroup=void 0}get _selectionMode(){let t=this.el.dataset.selection;return ne.has(t)?t:null}get _items(){return Array.from(this.el.children).filter(t=>t instanceof HTMLButtonElement||t instanceof HTMLAnchorElement&&t.classList.contains("button"))}get _toggleItems(){return this._items.filter(t=>t instanceof HTMLButtonElement)}_normalizeSelection(){let t=this._toggleItems;t.forEach(e=>{this._rememberPressed(e),["true","false"].includes(e.getAttribute("aria-pressed")||"")||e.setAttribute("aria-pressed","false")}),this._selectionMode==="single"&&t.filter(i=>i.getAttribute("aria-pressed")==="true").slice(1).forEach(i=>i.setAttribute("aria-pressed","false")),this.el.hasAttribute("data-selection-required")&&!t.some(e=>e.getAttribute("aria-pressed")==="true")&&t.find(e=>!this._isDisabled(e))?.setAttribute("aria-pressed","true")}_itemFromEvent(t){if(!(t.target instanceof Element))return null;let e=t.target.closest("button, a.button");return e instanceof HTMLElement&&e.parentElement===this.el?e:null}_isDisabled(t){return t instanceof HTMLButtonElement&&t.disabled||t.getAttribute("aria-disabled")==="true"||t.classList.contains("disabled")}_rememberPressed(t){this._originalPressed.has(t)||this._originalPressed.set(t,t.getAttribute("aria-pressed"))}_startPress(t){if(this._activeItem)return;this._finishRelease();let e=this._items,i=e.indexOf(t);if(i<0||(this._activeItem=t,t.classList.add(Mt),this.el.classList.contains("connected")||e.length<2))return;let s=e.map(p=>p.getBoundingClientRect()),n=s[i].width;if(n<=0)return;let a=Number.parseFloat(getComputedStyle(this.el).getPropertyValue("--md-comp-button-group-pressed-item-width-multiplier")),c=Number.isFinite(a)?a:.15,h=n*c,l=[i-1,i+1].filter(p=>p>=0&&p<e.length),r=new Map;if(l.length===1){let p=l[0];r.set(p,Math.min(h,this._compressionCapacity(e[p],s[p])))}else{let p=h/2;for(let E of l)r.set(E,Math.min(p,this._compressionCapacity(e[E],s[E])));let v=h-[...r.values()].reduce((E,b)=>E+b,0);for(let E of l){if(v<=0)break;let b=this._compressionCapacity(e[E],s[E])-r.get(E),w=Math.min(v,b);r.set(E,r.get(E)+w),v-=w}}let m=[...r.values()].reduce((p,v)=>p+v,0);m<=0||(e.forEach((p,v)=>{this._pressedStyles.set(p,{width:p.style.width,baseWidth:s[v].width}),p.style.width=`${s[v].width}px`}),this.el.offsetWidth,e.forEach((p,v)=>{let E=v===i?m:-(r.get(v)||0);p.style.width=`${s[v].width+E}px`}))}_compressionCapacity(t,e){let i=t.classList.contains("icon-button")?e.width*(1-oe):e.height;return Math.max(0,e.width-i)}};var ae={duration:200,fullWidth:!1,indicators:!1,noWrap:!1,interval:0,height:null,onCycleTo:null,i18n:{carousel:"Carousel",item:"Item",of:"of",indicators:"Slides",slide:"Slide"}},x=class x extends _{constructor(t,e){super(t,e,x);this.center=0;this._ownIndicators=!1;this._trackEl=null;this._ignoreScroll=!1;this._alignAfterResize=!1;this._trackRaf=null;this._started=!1;this._vertical=!1;this._resizeObserver=null;this._resizeTimeout=null;this._usesWindowResize=!1;this._dragPointerId=null;this._dragStartX=0;this._dragStartY=0;this._dragStartScroll=0;this._suppressClick=!1;this._suppressClickTimeout=null;this._generatedContainerRole=!1;this._generatedContainerLabel=!1;this._generatedContainerDescription=!1;this._generatedWideLayout=!1;this._generatedFixedHeight=!1;this._authoredInlineHeight=null;this._autoAdvanceTimer=null;this._autoAdvances=!1;this._autoPaused=!1;this._hovered=!1;this._focused=!1;this._motion=window.matchMedia("(prefers-reduced-motion: reduce)");this._generatedItemTabIndexes=new Set;this._generatedItemLabels=new Set;this._generatedItemDescriptions=new Set;this._generatedItemSizes=new Set;this._authoredItemSizes=new Set;this._itemA11yOriginal=new Map;this._handleThrottledResize=()=>{!this._started||this._resizeTimeout!==null||(this._handleResize(),this._resizeTimeout=setTimeout(()=>{this._resizeTimeout=null,this._handleResize()},200))};this._handleAutoAdvanceState=t=>{t.type==="mouseenter"?this._hovered=!0:t.type==="mouseleave"?this._hovered=!1:t.type==="focusin"?this._focused=!0:t.type==="focusout"&&(this._focused=this.el.contains(t.relatedTarget)),this._syncAutoAdvance()};this._handleMotionChange=()=>{this._syncAutoAdvance(),this._motion.matches&&this._scrollToIndex(this.center,!1),this._updateParallax()};this._tick=()=>{this._autoAdvanceTimer=null,this._advance(),this._syncAutoAdvance()};this._advance=()=>{let t=this.center+1;if(t<this.count){this.set(t);return}if(this.options.noWrap){this._autoAdvances=!1,this._syncAutoAdvance();return}this.set(0)};this._handleNativeScroll=()=>{this._alignAfterResize=!1,this._finishScroll()};this._handleTrackPointerDown=t=>{if(this._handleNativeScroll(),!(t.pointerType!=="mouse"||t.button!==0)){this.pressed=!0,this.dragged=!1,this._suppressClick=!1,this._dragPointerId=t.pointerId,this._dragStartX=t.clientX,this._dragStartY=t.clientY,this._dragStartScroll=this._vertical?this._scroller.scrollTop:this._scroller.scrollLeft;try{this._scroller.setPointerCapture(t.pointerId)}catch{}}};this._handleTrackPointerMove=t=>{if(!this.pressed||t.pointerId!==this._dragPointerId)return;let e=t.clientX-this._dragStartX,i=t.clientY-this._dragStartY,s=this._vertical?i:e,n=this._vertical?e:i;if(!this.dragged){if(Math.abs(s)<6||Math.abs(s)<=Math.abs(n))return;this.dragged=!0,this.el.classList.add("dragging")}this._vertical?this._scroller.scrollTop=this._dragStartScroll-i:this._scroller.scrollLeft=this._dragStartScroll-e,t.preventDefault()};this._handleTrackPointerUp=t=>{if(!(!this.pressed||t.pointerId!==this._dragPointerId)){this.pressed=!1,this._dragPointerId=null,this.el.classList.remove("dragging");try{this._scroller.releasePointerCapture(t.pointerId)}catch{}this.dragged&&(this._suppressClick=!0,window.clearTimeout(this._suppressClickTimeout),this._suppressClickTimeout=setTimeout(()=>{this._suppressClick=!1},0),this._syncActive(this._nearestIndex(),!0))}};this._handleTrackClick=t=>{this._suppressClick&&(this._suppressClick=!1,t.preventDefault(),t.stopImmediatePropagation())};this._handleTrackDragStart=t=>{t.target.closest("img, picture, video")&&t.preventDefault()};this._handleItemResize=t=>{this._alignAfterResize&&!this.pressed&&t.propertyName==="flex-basis"&&this.images.includes(t.target)&&this._scrollToIndex(this.center,!1)};this._handleIndicatorClick=t=>{t.stopPropagation();let e=t.target.closest(".indicator-item");if(!e||!this._indicators.contains(e))return;let i=[...this._indicators.children].indexOf(e);i<0||this._cycleTo(i)};this._handleKeydown=t=>{let e=t.target;if(e.isContentEditable||e.closest("input, textarea, select"))return;let i=getComputedStyle(this._scroller).direction==="rtl",s=this._vertical?t.key==="ArrowDown":t.key===(i?u.keys.ARROW_LEFT:u.keys.ARROW_RIGHT),n=this._vertical?t.key==="ArrowUp":t.key===(i?u.keys.ARROW_RIGHT:u.keys.ARROW_LEFT);t.key==="Home"?(t.preventDefault(),this.set(0),this._focusItem(0)):t.key==="End"?(t.preventDefault(),this.set(this.count-1),this._focusItem(this.count-1)):s?(t.preventDefault(),this.next(),this._focusItem(this.center)):n&&(t.preventDefault(),this.prev(),this._focusItem(this.center))};this._handleTrackScroll=()=>{this.el.classList.contains("scrolling")||this.el.classList.add("scrolling"),window.clearTimeout(this.scrollingTimeout),this.scrollingTimeout=setTimeout(()=>this.el.classList.remove("scrolling"),120),this._trackRaf===null&&(this._trackRaf=requestAnimationFrame(()=>{if(this._trackRaf=null,this._updateParallax(),this._ignoreScroll)return;let t=this._nearestIndex();t!==this.center&&this._syncActive(t,this.dragged)}))};this._handleResize=()=>{!this._started||!this.images.length||(this._syncAdaptiveMode(),this._syncLayoutRoles(this.center),this._scrollToIndex(this.center,!1),this._updateParallax())};this._finishScroll=()=>{this._ignoreScroll=!1,clearTimeout(this._scrollEndTimeout),this._scroller.removeEventListener("scrollend",this._handleScrollEnd)};this._handleScrollEnd=()=>{this._nearestIndex()===this.center&&!this.images.some(t=>t.getAnimations().some(e=>e.playState==="running"))&&this._finishScroll()};if(this.el.Expressive_Carousel=this,this.options={...x.defaults,...e},e?.i18n&&(this.options.i18n={...x.defaults.i18n,...e.i18n}),(this.options.fullWidth||this.el.classList.contains("flat"))&&(this.el.classList.add("flat"),this.options.fullWidth=!0),this._vertical=this.el.classList.contains("full-screen"),this.pressed=!1,this.dragged=!1,this.images=this._collectItems(),!this.images.length){console.error("Carousel: no .carousel-item elements to show");return}this.images.forEach(s=>{this._itemA11yOriginal.set(s,{ariaHidden:s.getAttribute("aria-hidden"),tabIndex:s.getAttribute("tabindex")}),s.hasAttribute("data-carousel-size")&&this._authoredItemSizes.add(s)}),this.hasMultipleSlides=this.images.length>1,this.showIndicators=this.options.indicators&&this.hasMultipleSlides,this.count=this.images.length,this._autoAdvances=this.options.interval>0&&this.hasMultipleSlides,this.images.forEach(s=>s.classList.add("carousel-item")),this.options.height!==null&&(this._generatedFixedHeight=!this.el.classList.contains("fixed-height"),this._authoredInlineHeight=this.el.style.getPropertyValue("--carousel-height")||null,this.el.classList.add("fixed-height"),this.el.style.setProperty("--carousel-height",`${this.options.height}px`)),this._wrapTrack(),this._syncAdaptiveMode(),this.showIndicators&&this._setupIndicators(),this._setupAccessibility(),this._setupEventHandlers(),this._started=!0;let i=Math.max(0,this.images.findIndex(s=>s.classList.contains("active")));this.center=i,this._syncActive(i,!1),this._updateParallax(),this._scrollToIndex(i,!1),this._syncAutoAdvance()}get _scroller(){return this._trackEl??this.el}static get defaults(){return ae}static init(t,e={}){return super.init(t,e,x)}static getInstance(t){return t.Expressive_Carousel}destroy(){this._started&&this._teardown(),this.el.Expressive_Carousel=void 0}_collectItems(){let t=Array.from(this.el.children).filter(e=>e instanceof HTMLElement&&e.classList.contains("carousel-item"));return t.length?t:Array.from(this.el.children).filter(e=>!(e instanceof HTMLElement)||e.classList.contains("indicators")||e.classList.contains("carousel-fixed-item")?!1:e.tagName!=="NAV")}_setupAccessibility(){this.el.hasAttribute("role")||(this.el.setAttribute("role","region"),this._generatedContainerRole=!0),!this.el.hasAttribute("aria-label")&&!this.el.hasAttribute("aria-labelledby")&&(this.el.setAttribute("aria-label",this.options.i18n.carousel),this._generatedContainerLabel=!0),this.el.hasAttribute("aria-roledescription")||(this.el.setAttribute("aria-roledescription","carousel"),this._generatedContainerDescription=!0);let t='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';this.images.forEach((e,i)=>{if(e.hasAttribute("aria-roledescription")||(e.setAttribute("aria-roledescription","slide"),this._generatedItemDescriptions.add(e)),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")){let s=e.querySelector("img[alt]")?.getAttribute("alt")?.trim(),n=e.textContent?.replace(/\s+/g," ").trim(),a=s||n,c=`${this.options.i18n.item} ${i+1} ${this.options.i18n.of} ${this.count}`;e.setAttribute("aria-label",a?`${a}, ${c}`:c),this._generatedItemLabels.add(e)}!e.matches(t)&&!e.querySelector(t)&&(e.tabIndex=0,this._generatedItemTabIndexes.add(e))})}_setupIndicators(){let t=Array.from(this.el.children).find(e=>e instanceof HTMLElement&&e.classList.contains("indicators"));this._indicators=t??document.createElement("nav"),this._ownIndicators=!t,this._indicators.classList.add("indicators"),this._indicators.setAttribute("aria-label",this.options.i18n.indicators),this._indicators.replaceChildren(),this.images.forEach((e,i)=>{let s=document.createElement("button");s.type="button",s.classList.add("indicator-item"),i===0&&(s.classList.add("active"),s.setAttribute("aria-current","true")),s.setAttribute("aria-label",`${this.options.i18n.slide} ${i+1}`),this._indicators.appendChild(s)}),this._ownIndicators&&this.el.appendChild(this._indicators),this.el.querySelector(".carousel-fixed-item")?.classList.add("with-indicators")}_setupEventHandlers(){this.el.addEventListener("keydown",this._handleKeydown),this._motion.addEventListener("change",this._handleMotionChange),this._autoAdvances&&(this.el.addEventListener("mouseenter",this._handleAutoAdvanceState),this.el.addEventListener("mouseleave",this._handleAutoAdvanceState),this.el.addEventListener("focusin",this._handleAutoAdvanceState),this.el.addEventListener("focusout",this._handleAutoAdvanceState),document.addEventListener("visibilitychange",this._handleAutoAdvanceState)),this.showIndicators&&this._indicators&&this._indicators.addEventListener("click",this._handleIndicatorClick),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._handleThrottledResize()),this._resizeObserver.observe(this.el)),this._usesWindowResize=!this._resizeObserver||this.el.classList.contains("full-screen"),this._usesWindowResize&&(x._live.add(this),x._resizeListening||(window.addEventListener("resize",x._onResize,{passive:!0}),x._resizeListening=!0)),this._scroller.addEventListener("scroll",this._handleTrackScroll,{passive:!0}),this._scroller.addEventListener("pointerdown",this._handleTrackPointerDown),this._scroller.addEventListener("wheel",this._handleNativeScroll,{passive:!0}),this._scroller.addEventListener("pointermove",this._handleTrackPointerMove),this._scroller.addEventListener("pointerup",this._handleTrackPointerUp),this._scroller.addEventListener("pointercancel",this._handleTrackPointerUp),this._scroller.addEventListener("click",this._handleTrackClick,!0),this._scroller.addEventListener("dragstart",this._handleTrackDragStart),this._scroller.addEventListener("transitionend",this._handleItemResize)}_removeEventHandlers(){this.el.removeEventListener("keydown",this._handleKeydown),this._motion.removeEventListener("change",this._handleMotionChange),this.el.removeEventListener("mouseenter",this._handleAutoAdvanceState),this.el.removeEventListener("mouseleave",this._handleAutoAdvanceState),this.el.removeEventListener("focusin",this._handleAutoAdvanceState),this.el.removeEventListener("focusout",this._handleAutoAdvanceState),document.removeEventListener("visibilitychange",this._handleAutoAdvanceState),this._indicators&&this._indicators.removeEventListener("click",this._handleIndicatorClick),this._scroller.removeEventListener("scroll",this._handleTrackScroll),this._scroller.removeEventListener("pointerdown",this._handleTrackPointerDown),this._scroller.removeEventListener("wheel",this._handleNativeScroll),this._scroller.removeEventListener("pointermove",this._handleTrackPointerMove),this._scroller.removeEventListener("pointerup",this._handleTrackPointerUp),this._scroller.removeEventListener("pointercancel",this._handleTrackPointerUp),this._scroller.removeEventListener("click",this._handleTrackClick,!0),this._scroller.removeEventListener("dragstart",this._handleTrackDragStart),this._scroller.removeEventListener("transitionend",this._handleItemResize),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._usesWindowResize&&(x._live.delete(this),x._live.size===0&&x._resizeListening&&(window.removeEventListener("resize",x._onResize),x._resizeListening=!1))}_teardown(){this._started=!1,this._removeEventHandlers(),this._finishScroll(),this._autoAdvances=!1,this._syncAutoAdvance(),this._trackRaf!==null&&cancelAnimationFrame(this._trackRaf),window.clearTimeout(this.scrollingTimeout),window.clearTimeout(this._suppressClickTimeout),clearTimeout(this._resizeTimeout),this._ownIndicators&&this._indicators?.remove(),this._unwrapTrack(),this.images.forEach(t=>{t.style.removeProperty("--md-comp-carousel-item-parallax"),this._generatedItemLabels.has(t)&&t.removeAttribute("aria-label"),this._generatedItemDescriptions.has(t)&&t.removeAttribute("aria-roledescription"),this._generatedItemSizes.has(t)&&t.removeAttribute("data-carousel-size");let e=this._itemA11yOriginal.get(t);e?.ariaHidden===null?t.removeAttribute("aria-hidden"):e&&t.setAttribute("aria-hidden",e.ariaHidden),e?.tabIndex===null?t.removeAttribute("tabindex"):e&&t.setAttribute("tabindex",e.tabIndex)}),this._generatedContainerRole&&this.el.removeAttribute("role"),this._generatedContainerLabel&&this.el.removeAttribute("aria-label"),this._generatedContainerDescription&&this.el.removeAttribute("aria-roledescription"),this._generatedFixedHeight&&this.el.classList.remove("fixed-height"),this.options.height!==null&&(this._authoredInlineHeight===null?this.el.style.removeProperty("--carousel-height"):this.el.style.setProperty("--carousel-height",this._authoredInlineHeight)),this._generatedWideLayout&&this.el.classList.remove("multi-wide","multi-large","multi-extra-large","full-screen-horizontal")}_syncAutoAdvance(){let t=this._autoAdvances&&!this._autoPaused&&!this._hovered&&!this._focused&&!this._motion.matches&&!document.hidden;t&&this._autoAdvanceTimer===null?this._autoAdvanceTimer=setTimeout(this._tick,this.options.duration+this.options.interval):!t&&this._autoAdvanceTimer!==null&&(clearTimeout(this._autoAdvanceTimer),this._autoAdvanceTimer=null)}_paintIndicators(t){if(!this.showIndicators||!this._indicators)return;let e=(t%this.count+this.count)%this.count;this._indicators.querySelectorAll(".indicator-item").forEach((i,s)=>{let n=s===e;i.classList.toggle("active",n),n?i.setAttribute("aria-current","true"):i.removeAttribute("aria-current")})}_syncActive(t,e){let i=this.center;this.center=t,this.images.forEach((n,a)=>n.classList.toggle("active",a===t)),this._paintIndicators(t),this._syncLayoutRoles(t);let s=this.images[t];i!==t&&typeof this.options.onCycleTo=="function"&&this.options.onCycleTo.call(this,s,e),typeof this.oneTimeCallback=="function"&&(this.oneTimeCallback.call(this,s,e),this.oneTimeCallback=null)}_syncLayoutRoles(t){let e=(h,l)=>{this._authoredItemSizes.has(h)||(h.setAttribute("data-carousel-size",l),this._generatedItemSizes.add(h))};if(this.images.forEach(h=>e(h,"large")),this.el.classList.contains("flat")||this.el.classList.contains("uncontained")||this.el.classList.contains("full-screen")&&this._vertical)return;if(this.el.classList.contains("hero")||this.el.classList.contains("full-screen-horizontal")){let h=this.images[t+1];if(h&&e(h,"small"),this.el.classList.contains("center-aligned")){let l=this.images[t-1];l&&e(l,"small")}return}let i=this.el.clientWidth,s=i>=1600?4:i>=1200?3:i>=600?2:1,n=Math.min(s,Math.max(1,this.count-2));this.el.classList.remove("multi-wide","multi-large","multi-extra-large"),n===2?this.el.classList.add("multi-wide"):n===3?this.el.classList.add("multi-large"):n>=4&&this.el.classList.add("multi-extra-large"),this._generatedWideLayout=this._generatedWideLayout||n>1;for(let h=1;h<n;h+=1){let l=this.images[t+h];l&&e(l,"large")}let a=this.images[t+n],c=this.images[t+n+1];a&&e(a,"medium"),c&&e(c,"small")}_syncAdaptiveMode(){if(!this.el.classList.contains("full-screen"))return;let t=window.matchMedia("(orientation: landscape)").matches,e=this.el.clientWidth>=840||t,i=this._vertical;this._vertical=!e,this.el.classList.toggle("full-screen-horizontal",e),this._generatedWideLayout=this._generatedWideLayout||e,this._started&&i!==this._vertical&&this._scroller.scrollTo({left:0,top:0,behavior:"auto"})}_focusItem(t){let e=this.images[t];if(!e)return;((e.matches('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?e:e.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))??e).focus({preventScroll:!0})}_updateParallax(){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){this.images.forEach(s=>s.style.setProperty("--md-comp-carousel-item-parallax","0px"));return}let t=this._scroller.getBoundingClientRect(),e=this._vertical?t.top+t.height/2:t.left+t.width/2,i=Math.max(1,this._vertical?t.height:t.width);this.images.forEach(s=>{let n=s.getBoundingClientRect(),a=this._vertical?n.top+n.height/2:n.left+n.width/2,c=Math.max(-1,Math.min(1,(a-e)/i));s.style.setProperty("--md-comp-carousel-item-parallax",`${c*-24}px`)})}_wrapTrack(){let t=document.createElement("div");t.className="carousel-track",this.images[0].before(t),this.images.forEach(e=>t.appendChild(e)),this._trackEl=t}_unwrapTrack(){this._trackEl&&(this.images.forEach(t=>this.el.insertBefore(t,this._trackEl)),this._trackEl.remove(),this._trackEl=null)}_nearestIndex(){let t=this.el.classList.contains("center-aligned"),e=getComputedStyle(this._scroller),i=!this._vertical&&e.direction==="rtl",s=this._vertical?this._scroller.scrollTop:this._scroller.scrollLeft,n=this._vertical?this._scroller.clientHeight:this._scroller.clientWidth,a=(this._vertical?this._scroller.scrollHeight:this._scroller.scrollWidth)-n,c=parseFloat(this._vertical?e.paddingBlockStart:e.paddingInlineStart)||0,h=this.center,l=1/0;return this.images.forEach((r,m)=>{let p=this._vertical?r.offsetTop:r.offsetLeft,v=this._vertical?r.offsetHeight:r.offsetWidth,E=t?p-(n-v)/2:p+(i?v-n+c:-c),b=Math.max(i?-a:0,Math.min(i?0:a,E)),w=Math.abs(b-s);(w<l||w===l&&m===this.center)&&(l=w,h=m)}),h}_scrollToIndex(t,e=!0){let i=this.images[t];if(!i)return;this._finishScroll();let s=this.el.classList.contains("center-aligned"),n=getComputedStyle(this._scroller),a=Number.parseFloat(n.paddingInlineStart)||0,c=Number.parseFloat(n.paddingBlockStart)||0,h=s?i.offsetLeft-(this._scroller.clientWidth-i.offsetWidth)/2:n.direction==="rtl"?i.offsetLeft+i.offsetWidth-this._scroller.clientWidth+a:i.offsetLeft-a,l=i.offsetTop-c;this._ignoreScroll=!0,this._scroller.scrollTo({left:this._vertical?0:h,top:this._vertical?l:0,behavior:e&&!this._motion.matches?"smooth":"instant"}),this._scroller.addEventListener("scrollend",this._handleScrollEnd),this._scrollEndTimeout=setTimeout(this._finishScroll,this.options.duration+350)}_cycleTo(t,e=null){this._alignAfterResize=!0,typeof e=="function"&&(this.oneTimeCallback=e),this._syncActive(t,!1),this._scrollToIndex(t)}pause(){this._autoPaused=!0,this._syncAutoAdvance()}start(){this._autoPaused=!1,this._syncAutoAdvance()}next(t=1){(t===void 0||isNaN(t))&&(t=1);let e=this.center+t;e>=this.count||e<0||this._cycleTo(e)}prev(t=1){(t===void 0||isNaN(t))&&(t=1);let e=this.center-t;e>=this.count||e<0||this._cycleTo(e)}set(t,e){(t===void 0||isNaN(t))&&(t=0),!(t>=this.count||t<0)&&this._cycleTo(t,e)}};x._live=new Set,x._resizeListening=!1,x._onResize=u.throttle(()=>{x._live.forEach(t=>t._handleResize())},200);var W=x;var re=Object.freeze({}),rt=class d extends _{constructor(t,e){super(t,{},d);this.updateCounter=()=>{let t=parseInt(this.el.getAttribute("maxlength")),e=this.el.value.length;this.isValidLength=e<=t;let i=e.toString();t&&(i+="/"+t,this._validateInput()),this.counterEl.textContent=i};this.el.Expressive_CharacterCounter=this,this.options={...d.defaults,...e},this.isInvalid=!1,this.isValidLength=!1,this._setupCounter(),this._setupEventHandlers()}static get defaults(){return re}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_CharacterCounter}destroy(){this._removeEventHandlers(),this.el.Expressive_CharacterCounter=void 0,this._removeCounter()}_setupEventHandlers(){this.el.addEventListener("focus",this.updateCounter,!0),this.el.addEventListener("input",this.updateCounter,!0)}_removeEventHandlers(){this.el.removeEventListener("focus",this.updateCounter,!0),this.el.removeEventListener("input",this.updateCounter,!0)}_setupCounter(){this.counterEl=document.createElement("span"),this.counterEl.classList.add("character-counter"),this.counterEl.setAttribute("aria-live","polite"),this.counterEl.setAttribute("aria-atomic","true"),this.counterEl.style.float="right",this.counterEl.style.fontSize="12px",this.counterEl.style.height="1",this.el.parentElement.appendChild(this.counterEl)}_removeCounter(){this.counterEl.remove()}_validateInput(){this.isValidLength&&this.isInvalid?(this.isInvalid=!1,this.el.classList.remove("invalid")):!this.isValidLength&&!this.isInvalid&&(this.isInvalid=!0,this.el.classList.remove("valid"),this.el.classList.add("invalid"))}};var le={classes:"",menuOptions:{}},k=class d extends _{constructor(t,e){super(t,e,d);this._originalLabels=new Map;this._validationMessage=null;this._handleSelectChange=()=>{this._setValueToInput(),this._setSelectedStates(),this._syncValidationError()};this._handleInvalid=t=>{t.defaultPrevented||(this._validationMessage||(this._validationMessage=document.createElement("small"),this._validationMessage.id=this.input.id+"-error",this._validationMessage.className="supporting-text",this._validationMessage.style.color="var(--md-sys-color-error)",this.wrapper.append(this._validationMessage),this.input.setAttribute("aria-describedby",[this.input.getAttribute("aria-describedby"),this._validationMessage.id].filter(Boolean).join(" "))),this.input.ariaInvalid="true",this._syncValidationError())};this._handleNativeFocus=()=>queueMicrotask(()=>{d.getInstance(this.el)===this&&this.el.matches(":focus")&&this.input.focus()});this._handleReset=t=>{clearTimeout(this._resetTimer),this._resetTimer=setTimeout(()=>{t.defaultPrevented||(this._handleSelectChange(),this._clearValidationError())},0)};this._handleOptionKeydown=t=>{(t.key===" "||t.key==="Enter")&&this._handleOptionClick(t)};this._handleOptionClick=t=>{t.preventDefault();let e=t.target.closest("li");this._selectOptionElement(e),t.stopPropagation()};this._handleOptionFocus=t=>{let e=t.target;if(!(e instanceof Element))return;let i=e.closest('li[role="option"]');i?.id&&this.input.setAttribute("aria-activedescendant",i.id)};this._handleInputClick=()=>{this.menu&&this.menu.isOpen&&(this._setValueToInput(),this._setSelectedStates())};!this.el.classList.contains("browser-default")&&(this.el.Expressive_FormSelect=this,this.options={...d.defaults,...e},this.isMultiple=this.el.multiple,this.nativeTabIndex=this.el.tabIndex??-1,this.el.tabIndex=-1,this._values=[],this._createdWrapper=!1,this._setupMenu(),this._setupEventHandlers())}static get defaults(){return le}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_FormSelect}destroy(){this._removeEventHandlers(),this._clearValidationError(),this.menu?.destroy(),this._removeMenu(),this.el.tabIndex=this.nativeTabIndex,this.el.Expressive_FormSelect=void 0}refresh(){if(!this.menuEl)return;this._bindForm();let t=this.menuEl.getRootNode(),e=this._values.find(i=>i.optionEl.contains(t.activeElement))?.el;this.input.disabled=this.el.matches(":disabled"),this.wrapper.classList.toggle("disabled",this.input.disabled),this.input.disabled?this.menu?.close():this.menu||this._initMenu(),this.input.removeAttribute("aria-activedescendant"),this._rebuildOptions(),this._handleSelectChange(),this.menu&&(this.menu.focusedIndex=-1),this.menu?.isOpen&&(this.menu.recalculateDimensions(),e&&(this._values.find(i=>i.el===e)?.optionEl??this.input).focus())}_setupEventHandlers(){this._setupOptionHandlers(),this.el.addEventListener("change",this._handleSelectChange),this.el.addEventListener("invalid",this._handleInvalid),this.el.addEventListener("focus",this._handleNativeFocus),this.input.addEventListener("click",this._handleInputClick),this.menuEl.addEventListener("focusin",this._handleOptionFocus),this._bindForm()}_bindForm(){this._form?.removeEventListener("reset",this._handleReset),this._form=this.el.form,this._form?.addEventListener("reset",this._handleReset)}_removeEventHandlers(){this._removeOptionHandlers(),this.el.removeEventListener("change",this._handleSelectChange),this.el.removeEventListener("invalid",this._handleInvalid),this.el.removeEventListener("focus",this._handleNativeFocus),this.input?.removeEventListener("click",this._handleInputClick),this.menuEl?.removeEventListener("focusin",this._handleOptionFocus),this._form?.removeEventListener("reset",this._handleReset),clearTimeout(this._resetTimer)}_setupOptionHandlers(){this.menuEl.querySelectorAll("li:not(.optgroup)").forEach(t=>{t.addEventListener("click",this._handleOptionClick),t.addEventListener("keydown",this._handleOptionKeydown)})}_removeOptionHandlers(){this.menuEl?.querySelectorAll("li:not(.optgroup)").forEach(t=>{t.removeEventListener("click",this._handleOptionClick),t.removeEventListener("keydown",this._handleOptionKeydown)})}_syncValidationError(){this._validationMessage&&(this.el.willValidate&&!this.el.validity.valid?this._validationMessage.textContent=this.el.validationMessage:this._clearValidationError())}_clearValidationError(){if(!this._validationMessage)return;let t=this.input.getAttribute("aria-describedby")?.split(/\s+/).filter(e=>e!==this._validationMessage.id).join(" ");t?this.input.setAttribute("aria-describedby",t):this.input.removeAttribute("aria-describedby"),this.input.ariaInvalid=this.el.ariaInvalid,this._validationMessage.remove(),this._validationMessage=null}_arraysEqual(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}_selectOptionElement(t){if(!this.el.matches(":disabled")){if(!t.classList.contains("disabled")&&!t.classList.contains("optgroup")){let e=this._values.find(a=>a.optionEl===t);if(!e||e.el.matches(":disabled"))return;let i=this.getSelectedValues();this.isMultiple?this._toggleEntryFromArray(e):(this._deselectAll(),this._selectValue(e)),this._handleSelectChange();let s=this.getSelectedValues();!this._arraysEqual(i,s)&&this.el.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))}this.isMultiple||this.menu?.close()}}_setupMenu(){this.labelEl=this.el.labels?.[0]??null,Array.from(this.el.labels??[]).forEach(t=>{this._originalLabels.set(t,{for:t.getAttribute("for"),id:t.getAttribute("id")})}),this.labelEl&&!this.el.closest("label")&&(this._labelPlaceholder=document.createComment(""),this.labelEl.before(this._labelPlaceholder)),this._setupWrapper(),this._hideNativeSelect(),this.el.matches(":disabled")&&this.wrapper.classList.add("disabled"),this.menuEl=document.createElement("menu"),this.menuEl.id=`select-options-${u.guid()}`,this.menuEl.setAttribute("popover","auto"),this.menuEl.setAttribute("role","listbox"),this.menuEl.ariaMultiSelectable=this.isMultiple.toString(),this.isMultiple&&this.menuEl.classList.add("multiple-select-menu"),this._buildOptions(),this.wrapper.append(this.menuEl),this._buildInput(),this._buildCaret(),this._initMenu(),this._setSelectedStates(),this._labelPlaceholder&&this.input.after(this.labelEl)}_setupWrapper(){let t=this.el.parentElement;t&&t.matches(".field")&&!t.querySelector(":scope > .hide-select")&&!t.querySelector(":scope > input, :scope > textarea")?(this.wrapper=t,this._createdWrapper=!1):(this.wrapper=document.createElement("div"),this.wrapper.classList.add("field"),this._createdWrapper=!0,this.el.before(this.wrapper)),this.options.classes.length>0&&this.wrapper.classList.add(...this.options.classes.split(" ").filter(Boolean))}_hideNativeSelect(){let t=document.createElement("div");t.classList.add("hide-select"),t.ariaHidden="true",this.el.before(t),t.appendChild(this.el),this._createdWrapper&&this.wrapper.append(t)}_buildInput(){this.input=document.createElement("input"),this.input.id="select-input-"+u.guid(),this.input.classList.add("menu-trigger","no-autoinit"),this.input.type="text",this.input.readOnly=!0,this.input.setAttribute("data-target",this.menuEl.id),this.input.ariaReadOnly="true",this.input.ariaRequired=this.el.hasAttribute("required").toString(),this.input.disabled=this.el.matches(":disabled"),this.input.setAttribute("tabindex",this.nativeTabIndex.toString());let t=this.el.attributes;for(let e=0;e<t.length;++e){let i=t[e];i.name.startsWith("aria-")&&this.input.setAttribute(i.name,i.value)}this.input.setAttribute("role","combobox"),this.input.setAttribute("aria-haspopup","listbox"),this.input.ariaExpanded="false",this.input.setAttribute("aria-controls",this.menuEl.id),this.input.placeholder=" ",this._originalLabels.forEach((e,i)=>{i.htmlFor=this.input.id}),this._labelPlaceholder&&this._originalLabels.size>1&&!this.input.getAttribute("aria-label")&&!this.input.getAttribute("aria-labelledby")&&this.input.setAttribute("aria-labelledby",Array.from(this._originalLabels.keys(),(e,i)=>(e.id||(e.id=`${this.input.id}-label-${i}`),e.id)).join(" ")),this.wrapper.prepend(this.input),this._setValueToInput()}_buildCaret(){let t=document.createElement("span");t.classList.add("caret"),t.setAttribute("aria-hidden","true"),this.wrapper.prepend(t)}_initMenu(){if(this.el.matches(":disabled"))return;let t={...this.options.menuOptions};t.coverTrigger=!1;let e=t.onOpenEnd,i=t.onCloseEnd;t.onOpenEnd=()=>{let s=this.menuEl.querySelector(".selected");if(s){if(this.menu.focusedIndex=[...s.parentNode.children].indexOf(s),this.menu._focusFocusedItem(),this.menu.isScrollable){let n=s.getBoundingClientRect().top-this.menuEl.getBoundingClientRect().top;n-=this.menuEl.clientHeight/2,this.menuEl.scrollTop=n}s.id&&this.input.setAttribute("aria-activedescendant",s.id)}this.input.ariaExpanded="true",e&&typeof e=="function"&&e.call(this.menu,this.el)},t.onCloseEnd=()=>{this.input.ariaExpanded="false",this.input.removeAttribute("aria-activedescendant"),i&&typeof i=="function"&&i.call(this.menu,this.el)},t.closeOnClick=!1,this.menu=O.init(this.input,t)}_nativeOptions(){return Array.from(this.el.children).filter(t=>["OPTION","OPTGROUP"].includes(t.tagName))}_buildOptions(){this.selectOptions=this._nativeOptions(),this._values=[],this.selectOptions.forEach(t=>{if(t.tagName==="OPTION"){let e=this._createAndAppendOptionWithIcon(t,this.isMultiple?"multiple":void 0);this._addOptionToValues(t,e)}else if(t.tagName==="OPTGROUP"){let e="opt-group-"+u.guid(),i=document.createElement("li");i.classList.add("optgroup"),i.tabIndex=-1,i.setAttribute("role","group"),i.setAttribute("aria-labelledby",e);let s=document.createElement("span");s.id=e,s.setAttribute("role","presentation"),s.textContent=t.getAttribute("label")??"",i.replaceChildren(s),this.menuEl.append(i);let n=[];Array.from(t.children).filter(c=>c.tagName==="OPTION").forEach(c=>{let h=this._createAndAppendOptionWithIcon(c,"optgroup-option");n.push(h.id),this._addOptionToValues(c,h)}),i.setAttribute("aria-owns",n.join(" "))}})}_rebuildOptions(){this._removeOptionHandlers(),this.menuEl.replaceChildren(),this._buildOptions(),this._setupOptionHandlers(),this.menu?._makeMenuFocusable()}_addOptionToValues(t,e){this._values.push({el:t,optionEl:e})}_removeMenu(){this.wrapper?.querySelector(":scope > .caret")?.remove(),this.input?.remove(),this.menuEl?.remove();let t=this.el.parentElement;t?.classList.contains("hide-select")&&t.replaceWith(this.el),this._originalLabels.forEach((e,i)=>{for(let s of["for","id"])e[s]===null?i.removeAttribute(s):i.setAttribute(s,e[s])}),this._labelPlaceholder?.replaceWith(this.labelEl),this.wrapper&&(this._createdWrapper?this.wrapper.replaceWith(this.el):(this.wrapper.classList.remove("disabled"),this.options.classes.length>0&&this.wrapper.classList.remove(...this.options.classes.split(" ").filter(Boolean))))}_createAndAppendOptionWithIcon(t,e){let i=document.createElement("li");i.id="select-option-"+u.guid(),i.setAttribute("role","option"),i.tabIndex=0;let s=this.el.matches(":disabled")||t.matches(":disabled");s&&(i.classList.add("disabled"),i.ariaDisabled="true",i.tabIndex=-1),e==="optgroup-option"&&i.classList.add(e);let n=t.textContent,a=document.createElement("span");if(this.isMultiple&&!s){let r=document.createElement("label"),m=document.createElement("input");m.type="checkbox",m.tabIndex=-1;let p=document.createElement("span");p.textContent=n,r.append(m,p),a.appendChild(r)}else a.textContent=n;i.appendChild(a);let c=t.getAttribute("data-icon"),h;if(c)try{let r=new URL(c,this.el.ownerDocument.baseURI);(["http:","https:","blob:"].includes(r.protocol)||/^data:image\/(?:avif|bmp|gif|jpeg|png|svg\+xml|webp|x-icon)(?:;|,)/i.test(r.href))&&(h=r)}catch{}let l=t.getAttribute("class")?.split(" ").filter(Boolean);if(h){let r=document.createElement("img");l?.length&&r.classList.add(...l),r.src=h.href,r.ariaHidden="true",i.prepend(r)}return this.menuEl.append(i),i}_selectValue(t){t.el.selected=!0,t.optionEl.classList.add("selected"),t.optionEl.ariaSelected="true";let e=t.optionEl.querySelector('input[type="checkbox"]');e&&(e.checked=!0)}_deselectValue(t){t.el.selected=!1,t.optionEl.classList.remove("selected"),t.optionEl.ariaSelected="false";let e=t.optionEl.querySelector('input[type="checkbox"]');e&&(e.checked=!1)}_deselectAll(){this._values.forEach(t=>this._deselectValue(t))}_isValueSelected(t){return this.getSelectedValues().some(i=>i===t.el.value)}_toggleEntryFromArray(t){this._isValueSelected(t)?this._deselectValue(t):this._selectValue(t)}_getSelectedOptions(){return Array.prototype.filter.call(this.el.selectedOptions,t=>t)}_setValueToInput(){this.input.value=this._getSelectedOptions().map(t=>t.textContent.trim()).join(", ")}_setSelectedStates(){this._values.forEach(t=>{let e=t.el.selected,i=t.optionEl.querySelector('input[type="checkbox"]');i&&(i.checked=e),e?this._activateOption(this.menuEl,t.optionEl):(t.optionEl.classList.remove("selected"),t.optionEl.ariaSelected="false")})}_activateOption(t,e){e&&(this.isMultiple||t.querySelectorAll("li.selected").forEach(i=>i.classList.remove("selected")),e.classList.add("selected"),e.ariaSelected="true")}getSelectedValues(){return this._getSelectedOptions().map(t=>t.value)}};var he={margin:5,transition:10,duration:250,align:"left"},j=class d{constructor(o,t,e){this._handleDocumentClick=o=>{this.visible&&!o.composedPath().includes(this.el)&&!o.composedPath().includes(this.container)&&this.hide()};this.destroy=()=>{document.removeEventListener("click",this._handleDocumentClick),this.container.remove()};this.show=()=>{if(this.visible)return;this.visible=!0;let o=u._setAbsolutePosition(this.el,this.container,"bottom",this.options.margin,this.options.transition,this.options.align);this.container.style.visibility="visible",this.container.style.transition=`
|
|
5
|
+
</svg></div>`,D._loadingTemplate=t.content.firstElementChild}return D._loadingTemplate.cloneNode(!0)}destroy(){this._openTimer!==void 0&&(clearTimeout(this._openTimer),this._openTimer=void 0),this._removeEventHandlers(),this.menu.destroy(),this.isOpen=!1,this._removeMenu(),this._statusInfo.remove(),this._announcer.remove(),this.el.Expressive_Autocomplete=void 0}_setupEventHandlers(){this.el.addEventListener("blur",this._handleInputBlur),this.el.addEventListener("input",this._handleInput),this.el.addEventListener("keyup",this._handleInputKeyup),this.el.addEventListener("focus",this._handleInputFocus),this.el.addEventListener("keydown",this._handleInputKeydown),this.el.addEventListener("click",this._handleInputClick),this.container.addEventListener("pointerdown",this._handleContainerPointerDown),this.container.addEventListener("pointerup",this._handleContainerPointerUp),this.container.addEventListener("pointercancel",this._handleContainerPointerUp)}_removeEventHandlers(){this.el.removeEventListener("blur",this._handleInputBlur),this.el.removeEventListener("input",this._handleInput),this.el.removeEventListener("keyup",this._handleInputKeyup),this.el.removeEventListener("focus",this._handleInputFocus),this.el.removeEventListener("keydown",this._handleInputKeydown),this.el.removeEventListener("click",this._handleInputClick),this.container.removeEventListener("pointerdown",this._handleContainerPointerDown),this.container.removeEventListener("pointerup",this._handleContainerPointerUp),this.container.removeEventListener("pointercancel",this._handleContainerPointerUp)}_setupMenu(){this.container=document.createElement("menu"),this.container.style.maxHeight=this.options.maxMenuHeight,this.container.id=`autocomplete-options-${u.guid()}`,this.container.classList.add("autocomplete-content"),this.container.ariaExpanded="true",this.container.setAttribute("role","listbox"),this.el.setAttribute("role","combobox"),this.el.setAttribute("aria-autocomplete","list"),this.el.setAttribute("aria-controls",this.container.id),this.el.setAttribute("data-target",this.container.id),this.menuItems.forEach(h=>{let c=this._createMenuItem(h);this.container.append(c)}),this.el.parentElement.appendChild(this.container);let t={...D.defaults.menuOptions,...this.options.menuOptions},e=t.onOpenStart,i=t.onCloseStart;t.onOpenStart=h=>{this.isOpen=!0,typeof e=="function"&&e.call(this.menu,h)},t.onCloseStart=h=>{this.isOpen=!1,typeof i=="function"&&i.call(this.menu,h)};let s=t.onItemClick;t.onItemClick=h=>{if(!h)return;let c=h.getAttribute("data-id");this.selectOption(c),typeof s=="function"&&s.call(this.menu,h)},this.menu=H.init(this.el,t),this.el.setAttribute("aria-haspopup","listbox");let n=this.el.parentElement.querySelector("label");n&&this.el.after(n),this.el.removeEventListener("click",this.menu._handleClick),this.options.isMultiSelect||this._refreshInputText(),this.el.value&&this.selectOption(this.el.value);let a=document.createElement("div");a.classList.add("status-info"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute;right:0;top:0;"),this.el.parentElement.appendChild(a),this._statusInfo=a,this._announcer=document.createElement("div"),this._announcer.classList.add("autocomplete-status"),this._announcer.setAttribute("role","status"),this._announcer.setAttribute("aria-live","polite"),this._announcer.setAttribute("aria-atomic","true"),this.el.parentElement.appendChild(this._announcer),this._updateSelectedInfo()}_removeMenu(){this.container.ariaExpanded="false",this.container.parentNode.removeChild(this.container)}_resetCurrentElementPosition(){this.activeIndex=-1,this._setActive(null)}_resetAutocomplete(){this.container.replaceChildren(),this._resetCurrentElementPosition(),this.oldVal=null,this._pointerDown=!1}_highlightPartialText(t,e){let i=e.toLocaleLowerCase().indexOf(""+t.toLocaleLowerCase()),s=i+t.length-1;return i==-1||s==-1?[e,"",""]:[e.slice(0,i),e.slice(i,s+1),e.slice(s+1)]}_createMenuItem(t){let e=document.createElement("li");e.id=`autocomplete-option-${u.guid()}`,e.setAttribute("role","option");let i=this.selectedValues.some(l=>l.id===t.id);if(e.setAttribute("aria-selected",i?"true":"false"),e.setAttribute("data-id",t.id),e.setAttribute("style","display:grid; grid-auto-flow: column; user-select: none; align-items: center;"),e.tabIndex=-1,this.options.isMultiSelect){let l=document.createElement("div");l.classList.add("item-selection"),l.style.textAlign="center";let r=document.createElement("input");r.type="checkbox",r.tabIndex=-1,r.checked=i;let p=document.createElement("span");p.style.paddingLeft="21px",l.append(r,p),e.appendChild(l)}if(t.image){let l=document.createElement("img");l.classList.add("circle"),l.src=t.image,e.appendChild(l)}let s=this.el.value.toLocaleLowerCase(),n=this._highlightPartialText(s,(t.text||t.id).toString()),a=document.createElement("div");if(a.setAttribute("style","line-height:1.2;font-weight:500;"),this.options.allowUnsafeHTML)a.innerHTML=n[0]+'<span class="highlight">'+n[1]+"</span>"+n[2];else if(a.appendChild(document.createTextNode(n[0])),n[1]){let l=document.createElement("span");l.textContent=n[1],l.classList.add("highlight"),a.appendChild(l),a.appendChild(document.createTextNode(n[2]))}let h=document.createElement("div");if(h.classList.add("item-text"),h.setAttribute("style","padding:5px;overflow:hidden;"),e.appendChild(h),e.querySelector(".item-text").appendChild(a),typeof t.description=="string"||typeof t.description=="number"&&!isNaN(t.description)){let l=document.createElement("small");l.setAttribute("style","line-height:1.3;color:grey;white-space:nowrap;text-overflow:ellipsis;display:block;width:90%;overflow:hidden;"),l.innerText=t.description,e.querySelector(".item-text").appendChild(l)}let c=()=>this.options.isMultiSelect?t.image?"40px min-content auto":"40px auto":t.image?"min-content auto":"auto";return e.style.gridTemplateColumns=c(),e}_renderMenu(){this._resetAutocomplete(),this.menuItems.length===0&&(this.menuItems=this.selectedValues);for(let t=0;t<this.menuItems.length;t++){let e=this._createMenuItem(this.menuItems[t]);this.container.append(e)}}_setStatusLoading(){let t=this._statusInfo;t&&t.replaceChildren(D._loadingIndicator()),this._announce(this.options.i18n.loading)}_announce(t){if(!this._announcer)return;let e=this.el.matches(":focus")&&this.el.value.length>=this.options.minLength?t:"";this._announcer.textContent!==e&&(this._announcer.textContent=e)}_updateSelectedInfo(){let t=this._statusInfo;t&&(this.options.isMultiSelect?t.textContent=this.selectedValues.length.toString():t.replaceChildren())}_refreshInputText(){if(this.selectedValues.length===1){let t=this.selectedValues[0];this.el.value=t.text||t.id}}_triggerChanged(){this.el.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0})),typeof this.options.onAutocomplete=="function"&&this.options.onAutocomplete.call(this,this.selectedValues)}setMenuItems(t,e=null,i=!0){if(this.el.Expressive_Autocomplete!==this)return;let s=t.length;this.menuItems=t,this.options.data=t,e&&(this.selectedValues=this.menuItems.filter(n=>e.indexOf(n.id)!==-1)),this.options.isMultiSelect?this._renderMenu():this._refreshInputText(),i&&this.open(),this._updateSelectedInfo(),this._announce(i?s?this.options.i18n.results(s):this.options.i18n.noResults:""),this._triggerChanged()}selectOption(t){let e=this.menuItems.find(i=>i.id==t);e&&(this.options.isMultiSelect?(this.selectedValues.filter(i=>i.id===e.id).length>=1?this.selectedValues=this.selectedValues.filter(i=>i.id!==e.id):this.selectedValues.push(e),this._renderMenu(),this.el.focus()):(this.selectedValues=[e],this._refreshInputText(),this._resetAutocomplete(),this.close()),this._updateSelectedInfo(),this.options.isMultiSelect&&this._announce(this.options.i18n.selected(this.selectedValues.length)),this._triggerChanged())}};D._loadingTemplate=null;var P=D;var Qt={data:[],placeholder:"",secondaryPlaceholder:"",closeIconClass:"material-symbols",autocompleteOptions:{},autocompleteOnly:!1,limit:1/0,allowUserInput:!1,i18n:{remove:"Remove"},onChipAdd:null,onChipSelect:null,onChipDelete:null},w=class w extends _{constructor(t,e){super(t,e,w);this._handleChipClick=t=>{let e=t.target.closest(".chip"),i=!!t.target.closest(".close");if(e){let s=this._chips.indexOf(e);if(s<0)return;i?this._deleteChip(s,"input"):this.selectChip(s)}else this._input.focus()};this._handleInputFocus=()=>{this.el.classList.add("focus")};this._handleInputBlur=()=>{this.el.classList.remove("focus")};this._handleInputKeydown=t=>{if(w._keydown=!0,t.key===u.keys.ENTER){if(this.hasAutocomplete&&this.autocomplete?.isOpen&&this.autocomplete.container.querySelector('[role="option"]'))return;t.preventDefault(),(!this.hasAutocomplete||this.hasAutocomplete&&!this.options.autocompleteOnly)&&this.addChip({id:this._input.value}),this._input.value=""}else(t.key===u.keys.BACKSPACE||t.key===u.keys.ARROW_LEFT)&&this._input.value===""&&this.chipsData.length&&(t.preventDefault(),this.selectChip(this.chipsData.length-1))};this.el.Expressive_Chips=this,this.options={...w.defaults,...e},e?.i18n&&(this.options.i18n={...w.defaults.i18n,...e.i18n}),this.el.classList.add("chips"),this.chipsData=[],this._chips=[],this.options.data.length&&(this.chipsData=this.options.data,this._renderChips()),this.options.allowUserInput&&(this.el.classList.add("field"),this._setupInput(),this._setupEventHandlers(),this.el.append(this._input)),this._setupLabel()}_setSelected(t){this._selectedChip?.classList.remove("selected"),this._selectedChip=t,t?.classList.add("selected")}static get defaults(){return Qt}static init(t,e={}){return super.init(t,e,w)}static getInstance(t){return t.Expressive_Chips}getData(){return this.chipsData}destroy(){this.autocomplete&&P.getInstance(this._input)===this.autocomplete&&this.autocomplete.destroy(),this.options.allowUserInput&&this._removeEventHandlers(),this._chips.forEach(t=>t.remove()),this._chips=[],this.el.Expressive_Chips=void 0}_setupEventHandlers(){this.el.addEventListener("click",this._handleChipClick),this.el.addEventListener("keydown",w._handleChipsKeydown),this.el.addEventListener("keyup",w._handleChipsKeyup),this.el.addEventListener("blur",w._handleChipsBlur,!0),this._input.addEventListener("focus",this._handleInputFocus),this._input.addEventListener("blur",this._handleInputBlur),this._input.addEventListener("keydown",this._handleInputKeydown)}_removeEventHandlers(){this.el.removeEventListener("click",this._handleChipClick),this.el.removeEventListener("keydown",w._handleChipsKeydown),this.el.removeEventListener("keyup",w._handleChipsKeyup),this.el.removeEventListener("blur",w._handleChipsBlur,!0),this._input.removeEventListener("focus",this._handleInputFocus),this._input.removeEventListener("blur",this._handleInputBlur),this._input.removeEventListener("keydown",this._handleInputKeydown)}static _handleChipsKeydown(t){w._keydown=!0;let e=t.target.closest(".chips"),i=t.target&&e,s=t.target.tagName;if(s==="INPUT"||s==="TEXTAREA"||!i)return;let n=e.Expressive_Chips;if(n){if(t.key===u.keys.BACKSPACE||t.key===u.keys.DELETE){let a=n._chips.indexOf(t.target.closest(".chip"));if(a<0)return;t.preventDefault(),n._deleteChip(a,"previous")}else if(t.key===u.keys.ARROW_LEFT){if(n._selectedChip){let a=n._chips.indexOf(n._selectedChip)-1;if(a<0)return;n.selectChip(a)}}else if(t.key===u.keys.ARROW_RIGHT&&n._selectedChip){let a=n._chips.indexOf(n._selectedChip)+1;a>=n.chipsData.length?(n._setSelected(null),n._input.focus()):n.selectChip(a)}}}static _handleChipsKeyup(){w._keydown=!1}static _handleChipsBlur(t){if(!w._keydown&&document.hidden){let i=t.target.closest(".chips")?.Expressive_Chips;i&&i._setSelected(null)}}_renderChip(t){if(!t.id&&t.id!==0)return;let e=t.text||t.id,i=document.createElement("span");if(i.classList.add("chip"),i.innerText=e,t.image){let s=document.createElement("img");s.setAttribute("src",t.image),i.insertBefore(s,i.firstChild)}if(this.options.allowUserInput){let s=document.createElement("button");s.type="button",s.classList.add("close"),s.setAttribute("aria-label",`${this.options.i18n.remove} ${e}`);let n=document.createElement("span");n.classList.add(this.options.closeIconClass),n.setAttribute("aria-hidden","true"),n.innerText="close",s.appendChild(n),i.appendChild(s)}return i}_renderChips(){this._chips=[];for(let t=0;t<this.chipsData.length;t++){let e=this._renderChip(this.chipsData[t]);this.el.appendChild(e),this._chips.push(e)}}_setupAutocomplete(){this.options.autocompleteOptions.onAutocomplete=t=>{w.getInstance(this.el)===this&&t.length>0&&(this.addChip({id:t[0].id,text:t[0].text,image:t[0].image}),this._input.value="",this._input.focus())},this.autocomplete=P.init(this._input,this.options.autocompleteOptions)}_setupInput(){this._input=this.el.querySelector("input"),this._input||(this._input=document.createElement("input"),this.el.append(this._input)),this._input.classList.add("input"),this.hasAutocomplete=Object.keys(this.options.autocompleteOptions).length>0,this.hasAutocomplete&&this._setupAutocomplete(),this._setPlaceholder(),this._input.getAttribute("id")||this._input.setAttribute("id",u.guid())}_setupLabel(){this._label=this.el.querySelector("label"),this._label&&this._input&&this._label.setAttribute("for",this._input.getAttribute("id"))}_setPlaceholder(){this._input&&(this.chipsData!==void 0&&!this.chipsData.length&&this.options.placeholder?this._input.placeholder=this.options.placeholder:(this.chipsData===void 0||this.chipsData.length)&&this.options.secondaryPlaceholder&&(this._input.placeholder=this.options.secondaryPlaceholder))}_isValidAndNotExist(t){let e=!!t.id||t.id===0,i=!this.chipsData.some(s=>s.id==t.id);return e&&i}addChip(t){if(!this._isValidAndNotExist(t)||this.chipsData.length>=this.options.limit)return;let e=this._renderChip(t);this._chips.push(e),this.chipsData.push(t),this._input?this._input.before(e):this.el.append(e),this._setPlaceholder(),typeof this.options.onChipAdd=="function"&&this.options.onChipAdd(this.el,e)}deleteChip(t){let e=this.el.getRootNode();this._deleteChip(t,this._chips[t]?.contains(e.activeElement)?"input":null)}_deleteChip(t,e){let i=this._chips[t];if(!i)return;this._selectedChip===i&&this._setSelected(null),i.remove(),this._chips.splice(t,1),this.chipsData.splice(t,1),this._setPlaceholder();let s=[],n=this.el.getRootNode();for(;n;)s.push({root:n,element:n.activeElement}),n="host"in n?n.host.getRootNode():null;typeof this.options.onChipDelete=="function"&&this.options.onChipDelete(this.el,i),!(!e||s.some(({root:a,element:h})=>a.activeElement!==h)||this.el.Expressive_Chips!==this)&&(e==="previous"&&this._chips.length?this.selectChip(Math.max(t-1,0)):(this._setSelected(null),this._input?.focus()))}selectChip(t){let e=this._chips[t];e&&(this._setSelected(e),e.querySelector(".close")?.focus(),typeof this.options.onChipSelect=="function"&&this.options.onChipSelect(this.el,e))}static Init(){u.onDocumentReady(()=>{document.querySelectorAll(".chips").forEach(e=>{e.addEventListener("click",i=>{if(!e.Expressive_Chips&&i.target.closest(".close")){let s=i.target.closest(".chip");s&&s.remove()}})})})}};w._keydown=!1;var W=w;var Jt={},at=new WeakMap,V=class d extends _{constructor(t,e){super(t,e,d);this._resizeObserver=null;this._handleRangeChange=()=>{this._clampDual(),this._sync(),this.thumb.classList.add("active")};this._handleRangePointerDown=t=>{t.isPrimary&&(t.pointerType==="mouse"&&t.button!==0||(this._pointerDown=!0,this.el.classList.add("active"),this._clampDual(),this._sync(),this.thumb.classList.add("active")))};this._handleRangeInputOrMove=t=>{(t.type==="input"||this._pointerDown)&&(this._clampDual(),this._sync(),this.thumb.classList.add("active"))};this._handleRangePointerUp=t=>{t.isPrimary&&(this._pointerDown=!1,this.el.classList.remove("active"))};this._handleRangeRelease=()=>{this._pointerDown||this.thumb.classList.remove("active")};this.el.Expressive_Slider=this,this.options={...d.defaults,...e},this._pointerDown=!1,this._setupThumb(),this._sync(),this._setupEventHandlers(),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._sync()),this._resizeObserver.observe(this.el))}static get defaults(){return Jt}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_Slider}destroy(){this._resizeObserver?.disconnect(),this._removeEventHandlers(),this._removeThumb(),this.el.Expressive_Slider=void 0;let t=this._host();for(let e of[this.el,t]){for(let i in at.get(e))e.style.setProperty(i,at.get(e)[i]);at.delete(e)}t?.querySelectorAll('input[type="range"]').forEach(e=>e.Expressive_Slider?._sync())}_set(t,e,i){let s=at.get(t)??{};at.set(t,s),s[e]??(s[e]=t.style.getPropertyValue(e)),t.style.setProperty(e,i)}_setupEventHandlers(){this.el.addEventListener("change",this._handleRangeChange),this.el.addEventListener("pointerdown",this._handleRangePointerDown),this.el.addEventListener("input",this._handleRangeInputOrMove),this.el.addEventListener("pointermove",this._handleRangeInputOrMove,{passive:!0}),this.el.addEventListener("pointerup",this._handleRangePointerUp),this.el.addEventListener("pointercancel",this._handleRangePointerUp),this.el.addEventListener("blur",this._handleRangeRelease),this.el.addEventListener("mouseout",this._handleRangeRelease)}_removeEventHandlers(){this.el.removeEventListener("change",this._handleRangeChange),this.el.removeEventListener("pointerdown",this._handleRangePointerDown),this.el.removeEventListener("input",this._handleRangeInputOrMove),this.el.removeEventListener("pointermove",this._handleRangeInputOrMove),this.el.removeEventListener("pointerup",this._handleRangePointerUp),this.el.removeEventListener("pointercancel",this._handleRangePointerUp),this.el.removeEventListener("blur",this._handleRangeRelease),this.el.removeEventListener("mouseout",this._handleRangeRelease)}_setupThumb(){this.thumb=document.createElement("span"),this.value=document.createElement("span"),this.thumb.classList.add("thumb"),this.value.classList.add("value"),this.thumb.append(this.value),this.el.after(this.thumb)}_removeThumb(){this.thumb.remove()}_isVertical(){return!!this.el.closest(".vertical")}_host(){return this.el.closest(".slider, .range, .range-field, label")}_clampDual(){let e=this._host()?.querySelectorAll('input[type="range"]');if(!e||e.length!==2)return;let i=e[0],s=e[1];this.el===i&&+i.value>+s.value&&(i.value=s.value),this.el===s&&+s.value<+i.value&&(s.value=i.value)}_fraction(t){let e=parseFloat(t.max),i=Number.isNaN(e)?100:e,s=parseFloat(t.min)||0,n=parseFloat(t.value)||0;return i===s?0:(n-s)/(i-s)}_sync(){let t=this._fraction(this.el),e=`${t*100}%`,i=this.el.offsetLeft,s=this.el.offsetTop,n=this.el.offsetWidth,a=this.el.offsetHeight,h=getComputedStyle(this.el),c=h.direction==="rtl",l=this._isVertical(),r=parseFloat(h.getPropertyValue("--md-comp-slider-handle-width"))||4,p=l?a:n,m=r/2+t*(p-r);this._set(this.el,"--md-comp-slider-active-fraction",e),this._set(this.el,"--md-comp-slider-active-position",`${m}px`);let v=this._host(),E=v?.querySelectorAll('input[type="range"]');if(v&&E&&E.length===2){let b=Array.from(E).map(y=>this._fraction(y));this._set(v,"--md-comp-slider-start-fraction",`${Math.min(...b)*100}%`),this._set(v,"--md-comp-slider-end-fraction",`${Math.max(...b)*100}%`),this._set(v,"--md-comp-slider-start-position",`${r/2+Math.min(...b)*(p-r)}px`),this._set(v,"--md-comp-slider-end-position",`${r/2+Math.max(...b)*(p-r)}px`)}if(v?.classList.contains("stops")){let b=parseFloat(this.el.max),y=Number.isNaN(b)?100:b,I=parseFloat(this.el.min)||0,A=parseFloat(this.el.step),M=A>0&&Number.isFinite(A)&&y>I;this._set(v,"--md-comp-slider-stop-count",M?String(Math.floor((y-I)/A+1e-9)+1):""),this._set(v,"--md-comp-slider-stop-spacing",M?`${(p-r)*A/(y-I)}px`:""),E?.length===1&&(this._set(v,"--md-comp-slider-active-position",`${m}px`),this._set(v,"--md-comp-slider-track-center",`${s+a/2}px`))}this.value.textContent=this.el.value,l?(this.thumb.style.left=`${i+n/2}px`,this.thumb.style.top=`${s+a-m}px`):(this.thumb.style.left=`${i+(c?n-m:m)}px`,this.thumb.style.top=`${s}px`)}static Init(){u.onDocumentReady(()=>{d.init(document.querySelectorAll("input[type=range]"),{})})}};var C=class C{static Init(){u.onDocumentReady(()=>{document.addEventListener("pointerdown",C._onPointerDown,{passive:!0}),document.addEventListener("pointerup",C._onPointerUp,{passive:!0}),document.addEventListener("pointercancel",C._onPointerCancel,{passive:!0})})}static _onPointerDown(o){if(!C._isPrimaryPress(o)){C._down=null;return}let t=C._backdropDialog(o);if(!t||!C._lightDismissible(t)||!C._outside(o,t)){C._down=null;return}C._down={dialog:t,pointerId:o.pointerId}}static _onPointerUp(o){let t=C._down;C._down=null,!(!t||t.pointerId!==o.pointerId)&&o.isPrimary&&(!t.dialog.isConnected||!t.dialog.open||C._lightDismissible(t.dialog)&&C._backdropDialog(o)===t.dialog&&C._outside(o,t.dialog)&&t.dialog.close())}static _onPointerCancel(){C._down=null}static _backdropDialog(o){let t=o.target;return!(t instanceof HTMLDialogElement)||!t.open?null:t}static _outside(o,t){let e=t.getBoundingClientRect();return o.clientX<e.left||o.clientX>e.right||o.clientY<e.top||o.clientY>e.bottom}static _isPrimaryPress(o){return o.isPrimary?o.pointerType!=="mouse"||o.button===0:!1}static _lightDismissible(o){let t=C._closedBy(o);return!(t==="none"||t==="closerequest"||t==="any"&&"closedBy"in HTMLDialogElement.prototype)}static _closedBy(o){let t=o.getAttribute("closedby");return t==="any"||t==="closerequest"||t==="none"?t:null}};C._down=null;var $=C;var bt=96,Lt=.5,te=100,ee=4;function rt(d){let o=l=>d.axis==="x"?l.clientX:l.clientY,t,e=null,i=l=>{if(!(l instanceof Element))return null;let r=l.closest(d.selector);return r instanceof HTMLDialogElement?r:null},s=l=>{l.style.transition="",l.style.setProperty(d.property,"0px")},n=l=>{if(!l.isPrimary||l.pointerType==="mouse"&&l.button!==0)return;c(),d.onPress?.();let r=i(l.target);if(!r?.open){e=null;return}if(!d.inHandle(l,r)){e=null;return}r.style.transition="none",e={dialog:r,pointerId:l.pointerId,direction:d.direction(r),start:o(l),last:o(l),lastT:Date.now(),velocity:0,shift:0},t.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open"],attributeOldValue:!0})},a=l=>{if(!e||e.pointerId!==l.pointerId)return;if(!e.dialog.open||!e.dialog.isConnected){c();return}let r=o(l)-e.start;if(e.shift=e.direction===1?Math.max(0,r):Math.min(0,r),o(l)!==e.last){let p=Date.now();e.velocity=(o(l)-e.last)/Math.max(1,p-e.lastT),e.last=o(l),e.lastT=p}e.dialog.style.setProperty(d.property,`${e.shift}px`)},h=l=>{let r=e;if(!r||r.pointerId!==l.pointerId)return;if(!r.dialog.open||!r.dialog.isConnected){c();return}a(l),e=null,t.disconnect(),r.dialog.style.transition="";let p=Date.now()-r.lastT<te?r.velocity:0,m=Math.abs(r.shift)>ee;d.onRelease?.(m),m&&(r.direction===1?r.shift>bt||p>Lt:r.shift<-bt||p<-Lt)&&r.dialog.open&&r.dialog.close(),r.dialog.style.setProperty(d.property,"0px")},c=l=>{if(l&&e?.pointerId!==l.pointerId)return;t.disconnect(),d.onRelease?.(!1);let r=e;e=null,r&&s(r.dialog)};u.onDocumentReady(()=>{t=new MutationObserver(l=>{let r=e?.dialog;r&&(!r.open||!r.isConnected||l.some(p=>p.type==="attributes"&&p.target===r&&p.oldValue===null||[...p.removedNodes].some(m=>m.contains(r))))&&c()}),document.addEventListener("pointerdown",n,{passive:!0}),document.addEventListener("pointermove",a,{passive:!0}),document.addEventListener("pointerup",h,{passive:!0}),document.addEventListener("pointercancel",c,{passive:!0})})}var Tt="dialog.bottom-sheet, dialog.bottom",q=class q{static Init(){rt({selector:Tt,axis:"y",property:"--md-comp-bottom-sheet-shift",direction:()=>1,inHandle:(o,t)=>{let e=o.target;if(e instanceof Element&&e.closest(".handle"))return!0;let i=t.getBoundingClientRect();return o.clientY>=i.top&&o.clientY<=i.top+48},onPress:()=>{q._dragged=!1},onRelease:o=>{q._dragged=o}}),u.onDocumentReady(()=>{document.addEventListener("click",q._onClick)})}static _onClick(o){let t=o.target;if(!(t instanceof Element))return;let e=t.closest(".handle, .drag-handle");if(!(e instanceof HTMLButtonElement)||o.detail!==0&&q._dragged)return;let i=e.closest(Tt);i instanceof HTMLDialogElement&&i.open&&i.close()}};q._dragged=!1;var K=q;var ie=d=>d.classList.contains("left")||d.classList.contains("left-sheet")||d.classList.contains("start"),Mt=d=>ie(d)!==(getComputedStyle(d).direction==="rtl"),z=class{static Init(){rt({selector:"dialog.side-sheet, dialog.right, dialog.right-sheet, dialog.left, dialog.left-sheet",axis:"x",property:"--md-comp-side-sheet-shift",direction:o=>Mt(o)?-1:1,inHandle:(o,t)=>{let e=o.target;if(e instanceof Element&&e.closest("header"))return!0;let i=t.getBoundingClientRect();return Mt(t)?o.clientX>=i.right-24&&o.clientX<=i.right:o.clientX>=i.left&&o.clientX<=i.left+24}})}};var U=class d{static validateField(o){if(!o){console.error("No text field element found");return}let t=o.getAttribute("data-length")!==null,e=parseInt(o.getAttribute("data-length")),i=o.value.length;i===0&&o.validity.badInput===!1&&!o.required&&o.classList.contains("validate")?o.classList.remove("invalid"):o.classList.contains("validate")&&(o.validity.valid&&t&&i<=e||o.validity.valid&&!t?o.classList.remove("invalid"):o.classList.add("invalid"))}static textareaAutoResize(o){let t=o;if(!t)return;t.hasAttribute("original-height")||t.setAttribute("original-height",t.getBoundingClientRect().height.toString());let e=parseInt(t.getAttribute("original-height"));if(isNaN(e))return;t.style.height="auto";let i=t.offsetHeight-t.clientHeight,s=t.scrollHeight+i;t.style.height=Math.max(e,s)+"px"}static Init(){u.onDocumentReady(()=>{document.addEventListener("change",o=>{let t=o.target;t instanceof HTMLInputElement&&d.validateField(t)}),document.addEventListener("keyup",o=>{let t=o.target;t instanceof HTMLInputElement&&["radio","checkbox"].includes(t.type)&&o.key===u.keys.TAB&&(t.classList.add("tabbed"),t.addEventListener("blur",()=>t.classList.remove("tabbed"),{once:!0}))}),document.querySelectorAll(".expressive-textarea").forEach(o=>{d.InitTextarea(o)}),document.querySelectorAll('.file-field input[type="file"]').forEach(o=>{d.InitFileInputPath(o)})})}static InitTextarea(o){o.setAttribute("original-height",o.getBoundingClientRect().height.toString()),d.textareaAutoResize(o),o.addEventListener("input",t=>d.textareaAutoResize(t.target))}static InitFileInputPath(o){o.addEventListener("change",()=>{let e=o.closest(".file-field").querySelector("input.file-path"),i=o.files,s=[];for(let n=0;n<i.length;n++)s.push(i[n].name);e.value=s.join(", "),e.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))})}};var se={},Y=class d extends _{constructor(t,e){super(t,e,d);this._observer=null;this._sentinel=null;this._input=null;this._view=null;this._searchOpen=!1;this._onIntersect=t=>{let e=t[0];e&&this.el.classList.toggle("collapsed",!e.isIntersecting&&e.boundingClientRect.top<this.el.getBoundingClientRect().top)};this._onSearchViewClose=()=>{this._searchOpen=this._view.open};this._onSearchFocus=()=>{if(!(!this._view||this._searchOpen)){if(this._view instanceof HTMLDialogElement){this._searchOpen=!0,this._view.open||this._view.showModal();return}this._view.hidden=!1,this._input?.setAttribute("aria-expanded","true")}};this.el.Expressive_AppBar=this,this.options={...d.defaults,...e},this._setupCollapse(),this._setupSearch()}static get defaults(){return se}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_AppBar}destroy(){this._observer?.disconnect(),this._observer=null,this._sentinel?.remove(),this._sentinel=null,this._input?.removeEventListener("focus",this._onSearchFocus),this._input?.removeEventListener("click",this._onSearchFocus),this._view?.removeEventListener("close",this._onSearchViewClose),this.el.classList.remove("collapsed"),this.el.Expressive_AppBar=void 0}_setupCollapse(){!this.el.classList.contains("medium")&&!this.el.classList.contains("large")||typeof IntersectionObserver>"u"||(this._sentinel=document.createElement("span"),this._sentinel.setAttribute("aria-hidden","true"),this._sentinel.style.cssText="display:block;height:0;position:relative;top:-64px;pointer-events:none;visibility:hidden",this.el.insertAdjacentElement("afterend",this._sentinel),this._observer=new IntersectionObserver(this._onIntersect),this._observer.observe(this._sentinel))}_setupSearch(){if(this._input=this.el.querySelector('input[type="search"]'),!this._input)return;let t=this._input.getAttribute("aria-controls");t&&(this._view=document.getElementById(t)),this._view||(this._view=this.el.querySelector(".search-view")),this._view&&(this._input.addEventListener("focus",this._onSearchFocus),this._input.addEventListener("click",this._onSearchFocus),this._view instanceof HTMLDialogElement&&this._view.addEventListener("close",this._onSearchViewClose))}};var ne={},G=class d extends _{constructor(t,e){super(t,e,d);this.open=()=>{this.isOpen||(this.isOpen=!0,this._list&&(this._list.inert=!1),this.el.classList.add("active"),this._anchor?.setAttribute("aria-expanded","true"),document.addEventListener("click",this._handleDocumentClick),document.addEventListener("keydown",this._handleDocumentKeydown))};this.close=()=>{if(!this.isOpen)return;let t=this.el.getRootNode().activeElement;t&&this._list?.contains(t)&&this._anchor?.focus(),this._list&&(this._list.inert=!0),this.isOpen=!1,this.el.classList.remove("active"),this._anchor?.setAttribute("aria-expanded","false"),document.removeEventListener("click",this._handleDocumentClick),document.removeEventListener("keydown",this._handleDocumentKeydown)};this._handleFABClick=t=>{let e=t.target;if(!(e instanceof Element))return;let i=e.closest("a, button");!i||i.matches(':disabled, [aria-disabled="true"]')||(i===this._anchor?this._toggle():this._list?.contains(i)&&this.close())};this._handleAnchorKeydown=t=>{(t.key===u.keys.ENTER||t.key===" ")&&(t.preventDefault(),this._toggle())};this._handleDocumentKeydown=t=>{t.key===u.keys.ESC&&!t.defaultPrevented&&this.close()};this._handleDocumentClick=t=>{t.composedPath().includes(this.el)||this.close()};this.el.Expressive_FloatingActionButton=this,this.options={...d.defaults,...e},this.isOpen=!1,this._anchor=this.el.querySelector(":scope > a, :scope > button"),this._list=this.el.querySelector(":scope > ul, :scope > menu"),this._listWasInert=this._list?.inert??!1,this.el.classList.remove("active"),this._list&&(this._list.inert=!0),this._anchor?.setAttribute("aria-expanded","false"),this._anchor instanceof HTMLAnchorElement&&!this._anchor.hasAttribute("href")&&(this._anchor.tabIndex<0&&(this._anchor.tabIndex=0),this._anchor.addEventListener("keydown",this._handleAnchorKeydown)),this.el.addEventListener("click",this._handleFABClick)}static get defaults(){return ne}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_FloatingActionButton}destroy(){this.close(),this._list&&(this._list.inert=this._listWasInert),this.el.removeEventListener("click",this._handleFABClick),this._anchor?.removeEventListener("keydown",this._handleAnchorKeydown),this.el.Expressive_FloatingActionButton=void 0}_toggle(){this.isOpen?this.close():this.open()}};var oe={},ae=new Set(["single","multiple"]),Ct="button-group-pressed",re=.15,j=class d extends _{constructor(t,e={}){super(t,e,d);this._pressedStyles=new Map;this._releaseStyles=new Map;this._releaseTimer=null;this._originalPressed=new Map;this._activeItem=null;this._handleClick=t=>{if(!this._selectionMode)return;let e=this._itemFromEvent(t);if(!(e instanceof HTMLButtonElement)||this._isDisabled(e))return;this._rememberPressed(e);let i=e.getAttribute("aria-pressed")!=="true",s=this._toggleItems.filter(n=>n.getAttribute("aria-pressed")==="true").length;!i&&this.el.hasAttribute("data-selection-required")&&s===1||(this._selectionMode==="single"&&i&&this._toggleItems.forEach(n=>{this._rememberPressed(n),n.setAttribute("aria-pressed","false")}),e.setAttribute("aria-pressed",i?"true":"false"))};this._handlePointerDown=t=>{if(t.button!==0)return;let e=this._itemFromEvent(t);e&&!this._isDisabled(e)&&this._startPress(e)};this._handleKeyDown=t=>{if(t.repeat||t.key!==" "&&t.key!=="Enter")return;let e=this._itemFromEvent(t);e&&!this._isDisabled(e)&&this._startPress(e)};this._handleKeyUp=t=>{(t.key===" "||t.key==="Enter")&&this._resetPress()};this._handleFocusOut=t=>{t.target===this._activeItem&&this._resetPress()};this._resetPress=()=>{if(this._activeItem?.classList.remove(Ct),this._activeItem=null,!!this._pressedStyles.size){this._finishRelease(),this._releaseStyles=new Map(this._pressedStyles);for(let[t,e]of this._releaseStyles)t.style.width=`${e.baseWidth}px`;this._pressedStyles.clear(),this._releaseTimer=window.setTimeout(this._finishRelease,200)}};this._finishRelease=()=>{this._releaseTimer!==null&&window.clearTimeout(this._releaseTimer),this._releaseTimer=null;for(let[t,e]of this._releaseStyles)t.style.width=e.width;this._releaseStyles.clear()};this.el.Expressive_ButtonGroup=this,this.options={...d.defaults,...e},this._selectionMode&&(this._normalizeSelection(),this.el.addEventListener("click",this._handleClick,!0)),this.el.addEventListener("pointerdown",this._handlePointerDown),this.el.addEventListener("keydown",this._handleKeyDown),this.el.addEventListener("focusout",this._handleFocusOut),document.addEventListener("pointerup",this._resetPress),document.addEventListener("pointercancel",this._resetPress),document.addEventListener("keyup",this._handleKeyUp),window.addEventListener("blur",this._resetPress)}static get defaults(){return oe}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_ButtonGroup}destroy(){this._resetPress(),this._finishRelease(),this.el.removeEventListener("click",this._handleClick,!0),this.el.removeEventListener("pointerdown",this._handlePointerDown),this.el.removeEventListener("keydown",this._handleKeyDown),this.el.removeEventListener("focusout",this._handleFocusOut),document.removeEventListener("pointerup",this._resetPress),document.removeEventListener("pointercancel",this._resetPress),document.removeEventListener("keyup",this._handleKeyUp),window.removeEventListener("blur",this._resetPress);for(let[t,e]of this._originalPressed)e===null?t.removeAttribute("aria-pressed"):t.setAttribute("aria-pressed",e);this._originalPressed.clear(),this.el.Expressive_ButtonGroup=void 0}get _selectionMode(){let t=this.el.dataset.selection;return ae.has(t)?t:null}get _items(){return Array.from(this.el.children).filter(t=>t instanceof HTMLButtonElement||t instanceof HTMLAnchorElement&&t.classList.contains("button"))}get _toggleItems(){return this._items.filter(t=>t instanceof HTMLButtonElement)}_normalizeSelection(){let t=this._toggleItems;t.forEach(e=>{this._rememberPressed(e),["true","false"].includes(e.getAttribute("aria-pressed")||"")||e.setAttribute("aria-pressed","false")}),this._selectionMode==="single"&&t.filter(i=>i.getAttribute("aria-pressed")==="true").slice(1).forEach(i=>i.setAttribute("aria-pressed","false")),this.el.hasAttribute("data-selection-required")&&!t.some(e=>e.getAttribute("aria-pressed")==="true")&&t.find(e=>!this._isDisabled(e))?.setAttribute("aria-pressed","true")}_itemFromEvent(t){if(!(t.target instanceof Element))return null;let e=t.target.closest("button, a.button");return e instanceof HTMLElement&&e.parentElement===this.el?e:null}_isDisabled(t){return t instanceof HTMLButtonElement&&t.disabled||t.getAttribute("aria-disabled")==="true"||t.classList.contains("disabled")}_rememberPressed(t){this._originalPressed.has(t)||this._originalPressed.set(t,t.getAttribute("aria-pressed"))}_startPress(t){if(this._activeItem)return;this._finishRelease();let e=this._items,i=e.indexOf(t);if(i<0||(this._activeItem=t,t.classList.add(Ct),this.el.classList.contains("connected")||e.length<2))return;let s=e.map(m=>m.getBoundingClientRect()),n=s[i].width;if(n<=0)return;let a=Number.parseFloat(getComputedStyle(this.el).getPropertyValue("--md-comp-button-group-pressed-item-width-multiplier")),h=Number.isFinite(a)?a:.15,c=n*h,l=[i-1,i+1].filter(m=>m>=0&&m<e.length),r=new Map;if(l.length===1){let m=l[0];r.set(m,Math.min(c,this._compressionCapacity(e[m],s[m])))}else{let m=c/2;for(let E of l)r.set(E,Math.min(m,this._compressionCapacity(e[E],s[E])));let v=c-[...r.values()].reduce((E,b)=>E+b,0);for(let E of l){if(v<=0)break;let b=this._compressionCapacity(e[E],s[E])-r.get(E),y=Math.min(v,b);r.set(E,r.get(E)+y),v-=y}}let p=[...r.values()].reduce((m,v)=>m+v,0);p<=0||(e.forEach((m,v)=>{this._pressedStyles.set(m,{width:m.style.width,baseWidth:s[v].width}),m.style.width=`${s[v].width}px`}),this.el.offsetWidth,e.forEach((m,v)=>{let E=v===i?p:-(r.get(v)||0);m.style.width=`${s[v].width+E}px`}))}_compressionCapacity(t,e){let i=t.classList.contains("icon-button")?e.width*(1-re):e.height;return Math.max(0,e.width-i)}};var le={duration:200,fullWidth:!1,indicators:!1,noWrap:!1,interval:0,height:null,onCycleTo:null,i18n:{carousel:"Carousel",item:"Item",of:"of",indicators:"Slides",slide:"Slide"}},x=class x extends _{constructor(t,e){super(t,e,x);this.center=0;this._ownIndicators=!1;this._trackEl=null;this._ignoreScroll=!1;this._alignAfterResize=!1;this._trackRaf=null;this._started=!1;this._vertical=!1;this._resizeObserver=null;this._resizeTimeout=null;this._usesWindowResize=!1;this._dragPointerId=null;this._dragStartX=0;this._dragStartY=0;this._dragStartScroll=0;this._suppressClick=!1;this._suppressClickTimeout=null;this._generatedContainerRole=!1;this._generatedContainerLabel=!1;this._generatedContainerDescription=!1;this._generatedWideLayout=!1;this._generatedFixedHeight=!1;this._authoredInlineHeight=null;this._autoAdvanceTimer=null;this._autoAdvances=!1;this._autoPaused=!1;this._hovered=!1;this._focused=!1;this._motion=window.matchMedia("(prefers-reduced-motion: reduce)");this._generatedItemTabIndexes=new Set;this._generatedItemLabels=new Set;this._generatedItemDescriptions=new Set;this._generatedItemSizes=new Set;this._authoredItemSizes=new Set;this._itemA11yOriginal=new Map;this._handleThrottledResize=()=>{!this._started||this._resizeTimeout!==null||(this._handleResize(),this._resizeTimeout=setTimeout(()=>{this._resizeTimeout=null,this._handleResize()},200))};this._handleAutoAdvanceState=t=>{t.type==="mouseenter"?this._hovered=!0:t.type==="mouseleave"?this._hovered=!1:t.type==="focusin"?this._focused=!0:t.type==="focusout"&&(this._focused=this.el.contains(t.relatedTarget)),this._syncAutoAdvance()};this._handleMotionChange=()=>{this._syncAutoAdvance(),this._motion.matches&&this._scrollToIndex(this.center,!1),this._updateParallax()};this._tick=()=>{this._autoAdvanceTimer=null,this._advance(),this._syncAutoAdvance()};this._advance=()=>{let t=this.center+1;if(t<this.count){this.set(t);return}if(this.options.noWrap){this._autoAdvances=!1,this._syncAutoAdvance();return}this.set(0)};this._handleNativeScroll=()=>{this._alignAfterResize=!1,this._finishScroll()};this._handleTrackPointerDown=t=>{this._handleNativeScroll(),!(t.pointerType!=="mouse"||t.button!==0)&&(this.pressed=!0,this.dragged=!1,this._suppressClick=!1,this._dragPointerId=t.pointerId,this._dragStartX=t.clientX,this._dragStartY=t.clientY,this._dragStartScroll=this._vertical?this._scroller.scrollTop:this._scroller.scrollLeft)};this._handleTrackPointerMove=t=>{if(!this.pressed||t.pointerId!==this._dragPointerId)return;let e=t.clientX-this._dragStartX,i=t.clientY-this._dragStartY,s=this._vertical?i:e,n=this._vertical?e:i;if(!this.dragged){if(Math.abs(s)<6||Math.abs(s)<=Math.abs(n))return;this.dragged=!0,this.el.classList.add("dragging");try{this._scroller.setPointerCapture(t.pointerId)}catch{}}this._vertical?this._scroller.scrollTop=this._dragStartScroll-i:this._scroller.scrollLeft=this._dragStartScroll-e,t.preventDefault()};this._handleTrackPointerUp=t=>{if(!(!this.pressed||t.pointerId!==this._dragPointerId)){this.pressed=!1,this._dragPointerId=null,this.el.classList.remove("dragging");try{this._scroller.releasePointerCapture(t.pointerId)}catch{}this.dragged&&(this._suppressClick=!0,window.clearTimeout(this._suppressClickTimeout),this._suppressClickTimeout=setTimeout(()=>{this._suppressClick=!1},0),this._syncActive(this._nearestIndex(),!0))}};this._handleTrackClick=t=>{this._suppressClick&&(this._suppressClick=!1,t.preventDefault(),t.stopImmediatePropagation())};this._handleTrackDragStart=t=>{t.target.closest("a, img, picture, video")&&t.preventDefault()};this._handleItemResize=t=>{this._alignAfterResize&&!this.pressed&&t.propertyName==="flex-basis"&&this.images.includes(t.target)&&this._scrollToIndex(this.center,!1)};this._handleIndicatorClick=t=>{t.stopPropagation();let e=t.target.closest(".indicator-item");if(!e||!this._indicators.contains(e))return;let i=[...this._indicators.children].indexOf(e);i<0||this._cycleTo(i)};this._handleKeydown=t=>{let e=t.target;if(e.isContentEditable||e.closest("input, textarea, select"))return;let i=getComputedStyle(this._scroller).direction==="rtl",s=this._vertical?t.key==="ArrowDown":t.key===(i?u.keys.ARROW_LEFT:u.keys.ARROW_RIGHT),n=this._vertical?t.key==="ArrowUp":t.key===(i?u.keys.ARROW_RIGHT:u.keys.ARROW_LEFT);t.key==="Home"?(t.preventDefault(),this.set(0),this._focusItem(0)):t.key==="End"?(t.preventDefault(),this.set(this.count-1),this._focusItem(this.count-1)):s?(t.preventDefault(),this.next(),this._focusItem(this.center)):n&&(t.preventDefault(),this.prev(),this._focusItem(this.center))};this._handleTrackScroll=()=>{this.el.classList.contains("scrolling")||this.el.classList.add("scrolling"),window.clearTimeout(this.scrollingTimeout),this.scrollingTimeout=setTimeout(()=>this.el.classList.remove("scrolling"),120),this._trackRaf===null&&(this._trackRaf=requestAnimationFrame(()=>{if(this._trackRaf=null,this._updateParallax(),this._ignoreScroll)return;let t=this._nearestIndex();t!==this.center&&this._syncActive(t,this.dragged)}))};this._handleResize=()=>{!this._started||!this.images.length||(this._syncAdaptiveMode(),this._syncLayoutRoles(this.center),this.pressed||this._scrollToIndex(this.center,!1),this._updateParallax())};this._finishScroll=()=>{this._ignoreScroll=!1,clearTimeout(this._scrollEndTimeout),this._scroller.removeEventListener("scrollend",this._handleScrollEnd)};this._handleScrollEnd=()=>{this._nearestIndex()===this.center&&!this.images.some(t=>t.getAnimations().some(e=>e.playState==="running"))&&this._finishScroll()};if(this.el.Expressive_Carousel=this,this.options={...x.defaults,...e},e?.i18n&&(this.options.i18n={...x.defaults.i18n,...e.i18n}),(this.options.fullWidth||this.el.classList.contains("flat"))&&(this.el.classList.add("flat"),this.options.fullWidth=!0),this._vertical=this.el.classList.contains("full-screen"),this.pressed=!1,this.dragged=!1,this.images=this._collectItems(),!this.images.length){console.error("Carousel: no .carousel-item elements to show");return}this.images.forEach(s=>{this._itemA11yOriginal.set(s,{ariaHidden:s.getAttribute("aria-hidden"),tabIndex:s.getAttribute("tabindex")}),s.hasAttribute("data-carousel-size")&&this._authoredItemSizes.add(s)}),this.hasMultipleSlides=this.images.length>1,this.showIndicators=this.options.indicators&&this.hasMultipleSlides,this.count=this.images.length,this._autoAdvances=this.options.interval>0&&this.hasMultipleSlides,this.images.forEach(s=>s.classList.add("carousel-item")),this.options.height!==null&&(this._generatedFixedHeight=!this.el.classList.contains("fixed-height"),this._authoredInlineHeight=this.el.style.getPropertyValue("--carousel-height")||null,this.el.classList.add("fixed-height"),this.el.style.setProperty("--carousel-height",`${this.options.height}px`)),this._wrapTrack(),this._syncAdaptiveMode(),this.showIndicators&&this._setupIndicators(),this._setupAccessibility(),this._setupEventHandlers(),this._started=!0;let i=Math.max(0,this.images.findIndex(s=>s.classList.contains("active")));this.center=i,this._syncActive(i,!1),this._updateParallax(),this._scrollToIndex(i,!1),this._syncAutoAdvance()}get _scroller(){return this._trackEl??this.el}static get defaults(){return le}static init(t,e={}){return super.init(t,e,x)}static getInstance(t){return t.Expressive_Carousel}destroy(){this._started&&this._teardown(),this.el.Expressive_Carousel=void 0}_collectItems(){let t=Array.from(this.el.children).filter(e=>e instanceof HTMLElement&&e.classList.contains("carousel-item"));return t.length?t:Array.from(this.el.children).filter(e=>!(e instanceof HTMLElement)||e.classList.contains("indicators")||e.classList.contains("carousel-fixed-item")?!1:e.tagName!=="NAV")}_setupAccessibility(){this.el.hasAttribute("role")||(this.el.setAttribute("role","region"),this._generatedContainerRole=!0),!this.el.hasAttribute("aria-label")&&!this.el.hasAttribute("aria-labelledby")&&(this.el.setAttribute("aria-label",this.options.i18n.carousel),this._generatedContainerLabel=!0),this.el.hasAttribute("aria-roledescription")||(this.el.setAttribute("aria-roledescription","carousel"),this._generatedContainerDescription=!0);let t='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';this.images.forEach((e,i)=>{if(e.hasAttribute("aria-roledescription")||(e.setAttribute("aria-roledescription","slide"),this._generatedItemDescriptions.add(e)),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")){let s=e.querySelector("img[alt]")?.getAttribute("alt")?.trim(),n=e.textContent?.replace(/\s+/g," ").trim(),a=s||n,h=`${this.options.i18n.item} ${i+1} ${this.options.i18n.of} ${this.count}`;e.setAttribute("aria-label",a?`${a}, ${h}`:h),this._generatedItemLabels.add(e)}!e.matches(t)&&!e.querySelector(t)&&(e.tabIndex=0,this._generatedItemTabIndexes.add(e))})}_setupIndicators(){let t=Array.from(this.el.children).find(e=>e instanceof HTMLElement&&e.classList.contains("indicators"));this._indicators=t??document.createElement("nav"),this._ownIndicators=!t,this._indicators.classList.add("indicators"),this._indicators.setAttribute("aria-label",this.options.i18n.indicators),this._indicators.replaceChildren(),this.images.forEach((e,i)=>{let s=document.createElement("button");s.type="button",s.classList.add("indicator-item"),i===0&&(s.classList.add("active"),s.setAttribute("aria-current","true")),s.setAttribute("aria-label",`${this.options.i18n.slide} ${i+1}`),this._indicators.appendChild(s)}),this._ownIndicators&&this.el.appendChild(this._indicators),this.el.querySelector(".carousel-fixed-item")?.classList.add("with-indicators")}_setupEventHandlers(){this.el.addEventListener("keydown",this._handleKeydown),this._motion.addEventListener("change",this._handleMotionChange),this._autoAdvances&&(this.el.addEventListener("mouseenter",this._handleAutoAdvanceState),this.el.addEventListener("mouseleave",this._handleAutoAdvanceState),this.el.addEventListener("focusin",this._handleAutoAdvanceState),this.el.addEventListener("focusout",this._handleAutoAdvanceState),document.addEventListener("visibilitychange",this._handleAutoAdvanceState)),this.showIndicators&&this._indicators&&this._indicators.addEventListener("click",this._handleIndicatorClick),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._handleThrottledResize()),this._resizeObserver.observe(this.el)),this._usesWindowResize=!this._resizeObserver||this.el.classList.contains("full-screen"),this._usesWindowResize&&(x._live.add(this),x._resizeListening||(window.addEventListener("resize",x._onResize,{passive:!0}),x._resizeListening=!0)),this._scroller.addEventListener("scroll",this._handleTrackScroll,{passive:!0}),this._scroller.addEventListener("pointerdown",this._handleTrackPointerDown),this._scroller.addEventListener("wheel",this._handleNativeScroll,{passive:!0}),document.addEventListener("pointermove",this._handleTrackPointerMove),document.addEventListener("pointerup",this._handleTrackPointerUp),document.addEventListener("pointercancel",this._handleTrackPointerUp),this._scroller.addEventListener("click",this._handleTrackClick,!0),this._scroller.addEventListener("dragstart",this._handleTrackDragStart),this._scroller.addEventListener("transitionend",this._handleItemResize)}_removeEventHandlers(){this.el.removeEventListener("keydown",this._handleKeydown),this._motion.removeEventListener("change",this._handleMotionChange),this.el.removeEventListener("mouseenter",this._handleAutoAdvanceState),this.el.removeEventListener("mouseleave",this._handleAutoAdvanceState),this.el.removeEventListener("focusin",this._handleAutoAdvanceState),this.el.removeEventListener("focusout",this._handleAutoAdvanceState),document.removeEventListener("visibilitychange",this._handleAutoAdvanceState),this._indicators&&this._indicators.removeEventListener("click",this._handleIndicatorClick),this._scroller.removeEventListener("scroll",this._handleTrackScroll),this._scroller.removeEventListener("pointerdown",this._handleTrackPointerDown),this._scroller.removeEventListener("wheel",this._handleNativeScroll),document.removeEventListener("pointermove",this._handleTrackPointerMove),document.removeEventListener("pointerup",this._handleTrackPointerUp),document.removeEventListener("pointercancel",this._handleTrackPointerUp),this._scroller.removeEventListener("click",this._handleTrackClick,!0),this._scroller.removeEventListener("dragstart",this._handleTrackDragStart),this._scroller.removeEventListener("transitionend",this._handleItemResize),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._usesWindowResize&&(x._live.delete(this),x._live.size===0&&x._resizeListening&&(window.removeEventListener("resize",x._onResize),x._resizeListening=!1))}_teardown(){this._started=!1,this._removeEventHandlers(),this._finishScroll(),this._autoAdvances=!1,this._syncAutoAdvance(),this._trackRaf!==null&&cancelAnimationFrame(this._trackRaf),window.clearTimeout(this.scrollingTimeout),window.clearTimeout(this._suppressClickTimeout),clearTimeout(this._resizeTimeout),this._ownIndicators&&this._indicators?.remove(),this._unwrapTrack(),this.images.forEach(t=>{t.style.removeProperty("--md-comp-carousel-item-parallax"),this._generatedItemLabels.has(t)&&t.removeAttribute("aria-label"),this._generatedItemDescriptions.has(t)&&t.removeAttribute("aria-roledescription"),this._generatedItemSizes.has(t)&&t.removeAttribute("data-carousel-size");let e=this._itemA11yOriginal.get(t);e?.ariaHidden===null?t.removeAttribute("aria-hidden"):e&&t.setAttribute("aria-hidden",e.ariaHidden),e?.tabIndex===null?t.removeAttribute("tabindex"):e&&t.setAttribute("tabindex",e.tabIndex)}),this._generatedContainerRole&&this.el.removeAttribute("role"),this._generatedContainerLabel&&this.el.removeAttribute("aria-label"),this._generatedContainerDescription&&this.el.removeAttribute("aria-roledescription"),this._generatedFixedHeight&&this.el.classList.remove("fixed-height"),this.options.height!==null&&(this._authoredInlineHeight===null?this.el.style.removeProperty("--carousel-height"):this.el.style.setProperty("--carousel-height",this._authoredInlineHeight)),this._generatedWideLayout&&this.el.classList.remove("multi-wide","multi-large","multi-extra-large","full-screen-horizontal")}_syncAutoAdvance(){let t=this._autoAdvances&&!this._autoPaused&&!this._hovered&&!this._focused&&!this._motion.matches&&!document.hidden;t&&this._autoAdvanceTimer===null?this._autoAdvanceTimer=setTimeout(this._tick,this.options.duration+this.options.interval):!t&&this._autoAdvanceTimer!==null&&(clearTimeout(this._autoAdvanceTimer),this._autoAdvanceTimer=null)}_paintIndicators(t){if(!this.showIndicators||!this._indicators)return;let e=(t%this.count+this.count)%this.count;this._indicators.querySelectorAll(".indicator-item").forEach((i,s)=>{let n=s===e;i.classList.toggle("active",n),n?i.setAttribute("aria-current","true"):i.removeAttribute("aria-current")})}_syncActive(t,e){let i=this.center;this.center=t,this.images.forEach((n,a)=>n.classList.toggle("active",a===t)),this._paintIndicators(t),this._syncLayoutRoles(t);let s=this.images[t];i!==t&&typeof this.options.onCycleTo=="function"&&this.options.onCycleTo.call(this,s,e),typeof this.oneTimeCallback=="function"&&(this.oneTimeCallback.call(this,s,e),this.oneTimeCallback=null)}_syncLayoutRoles(t){let e=(c,l)=>{this._authoredItemSizes.has(c)||(c.setAttribute("data-carousel-size",l),this._generatedItemSizes.add(c))};if(this.images.forEach(c=>e(c,"large")),this.el.classList.contains("flat")||this.el.classList.contains("uncontained")||this.el.classList.contains("full-screen")&&this._vertical)return;if(this.el.classList.contains("hero")||this.el.classList.contains("full-screen-horizontal")){let c=this.images[t+1];if(c&&e(c,"small"),this.el.classList.contains("center-aligned")){let l=this.images[t-1];l&&e(l,"small")}return}let i=this.el.clientWidth,s=i>=1600?4:i>=1200?3:i>=600?2:1,n=Math.min(s,Math.max(1,this.count-2));this.el.classList.remove("multi-wide","multi-large","multi-extra-large"),n===2?this.el.classList.add("multi-wide"):n===3?this.el.classList.add("multi-large"):n>=4&&this.el.classList.add("multi-extra-large"),this._generatedWideLayout=this._generatedWideLayout||n>1;for(let c=1;c<n;c+=1){let l=this.images[t+c];l&&e(l,"large")}let a=this.images[t+n],h=this.images[t+n+1];a&&e(a,"medium"),h&&e(h,"small")}_syncAdaptiveMode(){if(!this.el.classList.contains("full-screen"))return;let t=window.matchMedia("(orientation: landscape)").matches,e=this.el.clientWidth>=840||t,i=this._vertical;this._vertical=!e,this.el.classList.toggle("full-screen-horizontal",e),this._generatedWideLayout=this._generatedWideLayout||e,this._started&&i!==this._vertical&&this._scroller.scrollTo({left:0,top:0,behavior:"auto"})}_focusItem(t){let e=this.images[t];if(!e)return;((e.matches('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?e:e.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))??e).focus({preventScroll:!0})}_updateParallax(){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){this.images.forEach(s=>s.style.setProperty("--md-comp-carousel-item-parallax","0px"));return}let t=this._scroller.getBoundingClientRect(),e=this._vertical?t.top+t.height/2:t.left+t.width/2,i=Math.max(1,this._vertical?t.height:t.width);this.images.forEach(s=>{let n=s.getBoundingClientRect(),a=this._vertical?n.top+n.height/2:n.left+n.width/2,h=Math.max(-1,Math.min(1,(a-e)/i));s.style.setProperty("--md-comp-carousel-item-parallax",`${h*-24}px`)})}_wrapTrack(){let t=document.createElement("div");t.className="carousel-track",this.images[0].before(t),this.images.forEach(e=>t.appendChild(e)),this._trackEl=t}_unwrapTrack(){this._trackEl&&(this.images.forEach(t=>this.el.insertBefore(t,this._trackEl)),this._trackEl.remove(),this._trackEl=null)}_nearestIndex(){let t=this.el.classList.contains("center-aligned"),e=getComputedStyle(this._scroller),i=!this._vertical&&e.direction==="rtl",s=this._vertical?this._scroller.scrollTop:this._scroller.scrollLeft,n=this._vertical?this._scroller.clientHeight:this._scroller.clientWidth,a=(this._vertical?this._scroller.scrollHeight:this._scroller.scrollWidth)-n,h=parseFloat(this._vertical?e.paddingBlockStart:e.paddingInlineStart)||0,c=this.center,l=1/0;return this.images.forEach((r,p)=>{let m=this._vertical?r.offsetTop:r.offsetLeft,v=this._vertical?r.offsetHeight:r.offsetWidth,E=t?m-(n-v)/2:m+(i?v-n+h:-h),b=Math.max(i?-a:0,Math.min(i?0:a,E)),y=Math.abs(b-s);(y<l||y===l&&p===this.center)&&(l=y,c=p)}),c}_scrollToIndex(t,e=!0){let i=this.images[t];if(!i)return;this._finishScroll();let s=this.el.classList.contains("center-aligned"),n=getComputedStyle(this._scroller),a=Number.parseFloat(n.paddingInlineStart)||0,h=Number.parseFloat(n.paddingBlockStart)||0,c=s?i.offsetLeft-(this._scroller.clientWidth-i.offsetWidth)/2:n.direction==="rtl"?i.offsetLeft+i.offsetWidth-this._scroller.clientWidth+a:i.offsetLeft-a,l=i.offsetTop-h;this._ignoreScroll=!0,this._scroller.scrollTo({left:this._vertical?0:c,top:this._vertical?l:0,behavior:e&&!this._motion.matches?"smooth":"instant"}),this._scroller.addEventListener("scrollend",this._handleScrollEnd),this._scrollEndTimeout=setTimeout(this._finishScroll,this.options.duration+350)}_cycleTo(t,e=null){this._alignAfterResize=!0,typeof e=="function"&&(this.oneTimeCallback=e),this._syncActive(t,!1),this._scrollToIndex(t)}pause(){this._autoPaused=!0,this._syncAutoAdvance()}start(){this._autoPaused=!1,this._syncAutoAdvance()}next(t=1){(t===void 0||isNaN(t))&&(t=1);let e=this.center+t;e>=this.count||e<0||this._cycleTo(e)}prev(t=1){(t===void 0||isNaN(t))&&(t=1);let e=this.center-t;e>=this.count||e<0||this._cycleTo(e)}set(t,e){(t===void 0||isNaN(t))&&(t=0),!(t>=this.count||t<0)&&this._cycleTo(t,e)}};x._live=new Set,x._resizeListening=!1,x._onResize=u.throttle(()=>{x._live.forEach(t=>t._handleResize())},200);var F=x;var he=Object.freeze({}),lt=class d extends _{constructor(t,e){super(t,{},d);this.updateCounter=()=>{let t=parseInt(this.el.getAttribute("maxlength")),e=this.el.value.length;this.isValidLength=e<=t;let i=e.toString();t&&(i+="/"+t,this._validateInput()),this.counterEl.textContent=i};this.el.Expressive_CharacterCounter=this,this.options={...d.defaults,...e},this.isInvalid=!1,this.isValidLength=!1,this._setupCounter(),this._setupEventHandlers()}static get defaults(){return he}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_CharacterCounter}destroy(){this._removeEventHandlers(),this.el.Expressive_CharacterCounter=void 0,this._removeCounter()}_setupEventHandlers(){this.el.addEventListener("focus",this.updateCounter,!0),this.el.addEventListener("input",this.updateCounter,!0)}_removeEventHandlers(){this.el.removeEventListener("focus",this.updateCounter,!0),this.el.removeEventListener("input",this.updateCounter,!0)}_setupCounter(){this.counterEl=document.createElement("span"),this.counterEl.classList.add("character-counter"),this.counterEl.setAttribute("aria-live","polite"),this.counterEl.setAttribute("aria-atomic","true"),this.counterEl.style.float="right",this.counterEl.style.fontSize="12px",this.counterEl.style.height="1",this.el.parentElement.appendChild(this.counterEl)}_removeCounter(){this.counterEl.remove()}_validateInput(){this.isValidLength&&this.isInvalid?(this.isInvalid=!1,this.el.classList.remove("invalid")):!this.isValidLength&&!this.isInvalid&&(this.isInvalid=!0,this.el.classList.remove("valid"),this.el.classList.add("invalid"))}};var ce={classes:"",menuOptions:{}},k=class d extends _{constructor(t,e){super(t,e,d);this._originalLabels=new Map;this._validationMessage=null;this._handleSelectChange=()=>{this._setValueToInput(),this._setSelectedStates(),this._syncValidationError()};this._handleInvalid=t=>{t.defaultPrevented||(this._validationMessage||(this._validationMessage=document.createElement("small"),this._validationMessage.id=this.input.id+"-error",this._validationMessage.className="supporting-text",this._validationMessage.style.color="var(--md-sys-color-error)",this.wrapper.append(this._validationMessage),this.input.setAttribute("aria-describedby",[this.input.getAttribute("aria-describedby"),this._validationMessage.id].filter(Boolean).join(" "))),this.input.ariaInvalid="true",this._syncValidationError())};this._handleNativeFocus=()=>queueMicrotask(()=>{d.getInstance(this.el)===this&&this.el.matches(":focus")&&this.input.focus()});this._handleReset=t=>{clearTimeout(this._resetTimer),this._resetTimer=setTimeout(()=>{t.defaultPrevented||(this._handleSelectChange(),this._clearValidationError())},0)};this._handleOptionKeydown=t=>{(t.key===" "||t.key==="Enter")&&this._handleOptionClick(t)};this._handleOptionClick=t=>{t.preventDefault();let e=t.target.closest("li");this._selectOptionElement(e),t.stopPropagation()};this._handleOptionFocus=t=>{let e=t.target;if(!(e instanceof Element))return;let i=e.closest('li[role="option"]');i?.id&&this.input.setAttribute("aria-activedescendant",i.id)};this._handleInputClick=()=>{this.menu&&this.menu.isOpen&&(this._setValueToInput(),this._setSelectedStates())};!this.el.classList.contains("browser-default")&&(this.el.Expressive_FormSelect=this,this.options={...d.defaults,...e},this.isMultiple=this.el.multiple,this.nativeTabIndex=this.el.tabIndex??-1,this.el.tabIndex=-1,this._values=[],this._createdWrapper=!1,this._setupMenu(),this._setupEventHandlers())}static get defaults(){return ce}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_FormSelect}destroy(){this._removeEventHandlers(),this._clearValidationError(),this.menu?.destroy(),this._removeMenu(),this.el.tabIndex=this.nativeTabIndex,this.el.Expressive_FormSelect=void 0}refresh(){if(!this.menuEl)return;this._bindForm();let t=this.menuEl.getRootNode(),e=this._values.find(i=>i.optionEl.contains(t.activeElement))?.el;this.input.disabled=this.el.matches(":disabled"),this.wrapper.classList.toggle("disabled",this.input.disabled),this.input.disabled?this.menu?.close():this.menu||this._initMenu(),this.input.removeAttribute("aria-activedescendant"),this._rebuildOptions(),this._handleSelectChange(),this.menu&&(this.menu.focusedIndex=-1),this.menu?.isOpen&&(this.menu.recalculateDimensions(),e&&(this._values.find(i=>i.el===e)?.optionEl??this.input).focus())}_setupEventHandlers(){this._setupOptionHandlers(),this.el.addEventListener("change",this._handleSelectChange),this.el.addEventListener("invalid",this._handleInvalid),this.el.addEventListener("focus",this._handleNativeFocus),this.input.addEventListener("click",this._handleInputClick),this.menuEl.addEventListener("focusin",this._handleOptionFocus),this._bindForm()}_bindForm(){this._form?.removeEventListener("reset",this._handleReset),this._form=this.el.form,this._form?.addEventListener("reset",this._handleReset)}_removeEventHandlers(){this._removeOptionHandlers(),this.el.removeEventListener("change",this._handleSelectChange),this.el.removeEventListener("invalid",this._handleInvalid),this.el.removeEventListener("focus",this._handleNativeFocus),this.input?.removeEventListener("click",this._handleInputClick),this.menuEl?.removeEventListener("focusin",this._handleOptionFocus),this._form?.removeEventListener("reset",this._handleReset),clearTimeout(this._resetTimer)}_setupOptionHandlers(){this.menuEl.querySelectorAll("li:not(.optgroup)").forEach(t=>{t.addEventListener("click",this._handleOptionClick),t.addEventListener("keydown",this._handleOptionKeydown)})}_removeOptionHandlers(){this.menuEl?.querySelectorAll("li:not(.optgroup)").forEach(t=>{t.removeEventListener("click",this._handleOptionClick),t.removeEventListener("keydown",this._handleOptionKeydown)})}_syncValidationError(){this._validationMessage&&(this.el.willValidate&&!this.el.validity.valid?this._validationMessage.textContent=this.el.validationMessage:this._clearValidationError())}_clearValidationError(){if(!this._validationMessage)return;let t=this.input.getAttribute("aria-describedby")?.split(/\s+/).filter(e=>e!==this._validationMessage.id).join(" ");t?this.input.setAttribute("aria-describedby",t):this.input.removeAttribute("aria-describedby"),this.input.ariaInvalid=this.el.ariaInvalid,this._validationMessage.remove(),this._validationMessage=null}_arraysEqual(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}_selectOptionElement(t){if(!this.el.matches(":disabled")){if(!t.classList.contains("disabled")&&!t.classList.contains("optgroup")){let e=this._values.find(a=>a.optionEl===t);if(!e||e.el.matches(":disabled"))return;let i=this.getSelectedValues();this.isMultiple?this._toggleEntryFromArray(e):(this._deselectAll(),this._selectValue(e)),this._handleSelectChange();let s=this.getSelectedValues();!this._arraysEqual(i,s)&&this.el.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))}this.isMultiple||this.menu?.close()}}_setupMenu(){this.labelEl=this.el.labels?.[0]??null,Array.from(this.el.labels??[]).forEach(t=>{this._originalLabels.set(t,{for:t.getAttribute("for"),id:t.getAttribute("id")})}),this.labelEl&&!this.el.closest("label")&&(this._labelPlaceholder=document.createComment(""),this.labelEl.before(this._labelPlaceholder)),this._setupWrapper(),this._hideNativeSelect(),this.el.matches(":disabled")&&this.wrapper.classList.add("disabled"),this.menuEl=document.createElement("menu"),this.menuEl.id=`select-options-${u.guid()}`,this.menuEl.setAttribute("popover","auto"),this.menuEl.setAttribute("role","listbox"),this.menuEl.ariaMultiSelectable=this.isMultiple.toString(),this.isMultiple&&this.menuEl.classList.add("multiple-select-menu"),this._buildOptions(),this.wrapper.append(this.menuEl),this._buildInput(),this._buildCaret(),this._initMenu(),this._setSelectedStates(),this._labelPlaceholder&&this.input.after(this.labelEl)}_setupWrapper(){let t=this.el.parentElement;t&&t.matches(".field")&&!t.querySelector(":scope > .hide-select")&&!t.querySelector(":scope > input, :scope > textarea")?(this.wrapper=t,this._createdWrapper=!1):(this.wrapper=document.createElement("div"),this.wrapper.classList.add("field"),this._createdWrapper=!0,this.el.before(this.wrapper)),this.options.classes.length>0&&this.wrapper.classList.add(...this.options.classes.split(" ").filter(Boolean))}_hideNativeSelect(){let t=document.createElement("div");t.classList.add("hide-select"),t.ariaHidden="true",this.el.before(t),t.appendChild(this.el),this._createdWrapper&&this.wrapper.append(t)}_buildInput(){this.input=document.createElement("input"),this.input.id="select-input-"+u.guid(),this.input.classList.add("menu-trigger","no-autoinit"),this.input.type="text",this.input.readOnly=!0,this.input.setAttribute("data-target",this.menuEl.id),this.input.ariaReadOnly="true",this.input.ariaRequired=this.el.hasAttribute("required").toString(),this.input.disabled=this.el.matches(":disabled"),this.input.setAttribute("tabindex",this.nativeTabIndex.toString());let t=this.el.attributes;for(let e=0;e<t.length;++e){let i=t[e];i.name.startsWith("aria-")&&this.input.setAttribute(i.name,i.value)}this.input.setAttribute("role","combobox"),this.input.setAttribute("aria-haspopup","listbox"),this.input.ariaExpanded="false",this.input.setAttribute("aria-controls",this.menuEl.id),this.input.placeholder=" ",this._originalLabels.forEach((e,i)=>{i.htmlFor=this.input.id}),this._labelPlaceholder&&this._originalLabels.size>1&&!this.input.getAttribute("aria-label")&&!this.input.getAttribute("aria-labelledby")&&this.input.setAttribute("aria-labelledby",Array.from(this._originalLabels.keys(),(e,i)=>(e.id||(e.id=`${this.input.id}-label-${i}`),e.id)).join(" ")),this.wrapper.prepend(this.input),this._setValueToInput()}_buildCaret(){let t=document.createElement("span");t.classList.add("caret"),t.setAttribute("aria-hidden","true"),this.wrapper.prepend(t)}_initMenu(){if(this.el.matches(":disabled"))return;let t={...this.options.menuOptions};t.coverTrigger=!1;let e=t.onOpenEnd,i=t.onCloseEnd;t.onOpenEnd=()=>{let s=this.menuEl.querySelector(".selected");if(s){if(this.menu.focusedIndex=[...s.parentNode.children].indexOf(s),this.menu._focusFocusedItem(),this.menu.isScrollable){let n=s.getBoundingClientRect().top-this.menuEl.getBoundingClientRect().top;n-=this.menuEl.clientHeight/2,this.menuEl.scrollTop=n}s.id&&this.input.setAttribute("aria-activedescendant",s.id)}this.input.ariaExpanded="true",e&&typeof e=="function"&&e.call(this.menu,this.el)},t.onCloseEnd=()=>{this.input.ariaExpanded="false",this.input.removeAttribute("aria-activedescendant"),i&&typeof i=="function"&&i.call(this.menu,this.el)},t.closeOnClick=!1,this.menu=H.init(this.input,t)}_nativeOptions(){return Array.from(this.el.children).filter(t=>["OPTION","OPTGROUP"].includes(t.tagName))}_buildOptions(){this.selectOptions=this._nativeOptions(),this._values=[],this.selectOptions.forEach(t=>{if(t.tagName==="OPTION"){let e=this._createAndAppendOptionWithIcon(t,this.isMultiple?"multiple":void 0);this._addOptionToValues(t,e)}else if(t.tagName==="OPTGROUP"){let e="opt-group-"+u.guid(),i=document.createElement("li");i.classList.add("optgroup"),i.tabIndex=-1,i.setAttribute("role","group"),i.setAttribute("aria-labelledby",e);let s=document.createElement("span");s.id=e,s.setAttribute("role","presentation"),s.textContent=t.getAttribute("label")??"",i.replaceChildren(s),this.menuEl.append(i);let n=[];Array.from(t.children).filter(h=>h.tagName==="OPTION").forEach(h=>{let c=this._createAndAppendOptionWithIcon(h,"optgroup-option");n.push(c.id),this._addOptionToValues(h,c)}),i.setAttribute("aria-owns",n.join(" "))}})}_rebuildOptions(){this._removeOptionHandlers(),this.menuEl.replaceChildren(),this._buildOptions(),this._setupOptionHandlers(),this.menu?._makeMenuFocusable()}_addOptionToValues(t,e){this._values.push({el:t,optionEl:e})}_removeMenu(){this.wrapper?.querySelector(":scope > .caret")?.remove(),this.input?.remove(),this.menuEl?.remove();let t=this.el.parentElement;t?.classList.contains("hide-select")&&t.replaceWith(this.el),this._originalLabels.forEach((e,i)=>{for(let s of["for","id"])e[s]===null?i.removeAttribute(s):i.setAttribute(s,e[s])}),this._labelPlaceholder?.replaceWith(this.labelEl),this.wrapper&&(this._createdWrapper?this.wrapper.replaceWith(this.el):(this.wrapper.classList.remove("disabled"),this.options.classes.length>0&&this.wrapper.classList.remove(...this.options.classes.split(" ").filter(Boolean))))}_createAndAppendOptionWithIcon(t,e){let i=document.createElement("li");i.id="select-option-"+u.guid(),i.setAttribute("role","option"),i.tabIndex=0;let s=this.el.matches(":disabled")||t.matches(":disabled");s&&(i.classList.add("disabled"),i.ariaDisabled="true",i.tabIndex=-1),e==="optgroup-option"&&i.classList.add(e);let n=t.textContent,a=document.createElement("span");if(this.isMultiple&&!s){let r=document.createElement("label"),p=document.createElement("input");p.type="checkbox",p.tabIndex=-1;let m=document.createElement("span");m.textContent=n,r.append(p,m),a.appendChild(r)}else a.textContent=n;i.appendChild(a);let h=t.getAttribute("data-icon"),c;if(h)try{let r=new URL(h,this.el.ownerDocument.baseURI);(["http:","https:","blob:"].includes(r.protocol)||/^data:image\/(?:avif|bmp|gif|jpeg|png|svg\+xml|webp|x-icon)(?:;|,)/i.test(r.href))&&(c=r)}catch{}let l=t.getAttribute("class")?.split(" ").filter(Boolean);if(c){let r=document.createElement("img");l?.length&&r.classList.add(...l),r.src=c.href,r.ariaHidden="true",i.prepend(r)}return this.menuEl.append(i),i}_selectValue(t){t.el.selected=!0,t.optionEl.classList.add("selected"),t.optionEl.ariaSelected="true";let e=t.optionEl.querySelector('input[type="checkbox"]');e&&(e.checked=!0)}_deselectValue(t){t.el.selected=!1,t.optionEl.classList.remove("selected"),t.optionEl.ariaSelected="false";let e=t.optionEl.querySelector('input[type="checkbox"]');e&&(e.checked=!1)}_deselectAll(){this._values.forEach(t=>this._deselectValue(t))}_isValueSelected(t){return t.el.selected}_toggleEntryFromArray(t){this._isValueSelected(t)?this._deselectValue(t):this._selectValue(t)}_getSelectedOptions(){return Array.prototype.filter.call(this.el.selectedOptions,t=>t)}_setValueToInput(){this.input.value=this._getSelectedOptions().map(t=>t.textContent.trim()).join(", ")}_setSelectedStates(){this._values.forEach(t=>{let e=t.el.selected,i=t.optionEl.querySelector('input[type="checkbox"]');i&&(i.checked=e),e?this._activateOption(this.menuEl,t.optionEl):(t.optionEl.classList.remove("selected"),t.optionEl.ariaSelected="false")})}_activateOption(t,e){e&&(this.isMultiple||t.querySelectorAll("li.selected").forEach(i=>i.classList.remove("selected")),e.classList.add("selected"),e.ariaSelected="true")}getSelectedValues(){return this._getSelectedOptions().map(t=>t.value)}};var de={margin:5,transition:10,duration:250,align:"left"},X=class d{constructor(o,t,e){this._handleDocumentClick=o=>{this.visible&&!o.composedPath().includes(this.el)&&!o.composedPath().includes(this.container)&&this.hide()};this.destroy=()=>{document.removeEventListener("click",this._handleDocumentClick),this.container.remove()};this.show=()=>{if(this.visible)return;this.visible=!0;let o=u._setAbsolutePosition(this.el,this.container,"bottom",this.options.margin,this.options.transition,this.options.align);this.container.style.visibility="visible",this.container.style.transition=`
|
|
6
6
|
transform ${this.options.duration}ms ease-out,
|
|
7
7
|
opacity ${this.options.duration}ms ease-out`,setTimeout(()=>{this.container.style.transform=`translateX(${o.x}px) translateY(${o.y}px)`,this.container.style.opacity="1"},1)};this.hide=()=>{this.visible&&(this.visible=!1,this.container.removeAttribute("style"),this.container.style.transition=`
|
|
8
8
|
transform ${this.options.duration}ms ease-out,
|
|
9
|
-
opacity ${this.options.duration}ms ease-out`,setTimeout(()=>{this.container.style.transform="translateX(0px) translateY(0px)",this.container.style.opacity="0"},1))};this.el=o,this.options={...he,...e},this.container=document.createElement("div"),this.container.classList.add("display-docked"),this.container.append(t),o.parentElement.append(this.container),document.addEventListener("click",this._handleDocumentClick)}static init(o,t,e){return new d(o,t,e)}};var ce={format:"mmm dd, yyyy",parse:null,isDateRange:!1,dateRangeEndEl:null,isMultipleSelection:!1,defaultDate:null,defaultEndDate:null,setDefaultDate:!1,setDefaultEndDate:!1,disableWeekends:!1,disableDayFn:null,firstDay:0,minDate:null,maxDate:null,yearRange:10,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearRangeReverse:!1,showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,openByDefault:!1,container:null,showClearBtn:!1,autoSubmit:!0,i18n:{cancel:"Cancel",clear:"Clear",done:"Ok",previousMonth:"\u2039",nextMonth:"\u203A",months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysAbbrev:["S","M","T","W","T","F","S"]},events:[],onSelect:null,onDraw:null,onInputInteraction:null,displayPlugin:null,displayPluginOptions:null,onConfirm:null,onCancel:null},f=class f extends _{constructor(t,e){super(t,e,f);this.multiple=!1;this._drawDepth=0;this._drawDirty=!1;this._controlsKey=null;this._randId=null;this._focusedDate=null;this._handleInputClick=t=>{t.type=="date"&&t.preventDefault(),this._batchDraws(()=>{this.setDateFromInput(t.target),this.draw(),this.gotoDate(t.target===this.el?this.date:this.endDate)}),this.displayPlugin&&this.displayPlugin.show(),this.options.onInputInteraction&&this.options.onInputInteraction.call(this)};this._handleInputKeydown=t=>{t.key===u.keys.ENTER&&(t.preventDefault(),this._batchDraws(()=>{this.setDateFromInput(t.target),this._focusedDate=t.target===this.endDateEl?this.endDate:this.date,this.draw()}),this.displayPlugin&&this.displayPlugin.show(),this._syncCalendarFocus(!0),this.options.onInputInteraction&&this.options.onInputInteraction.call(this))};this._handleCalendarFocus=t=>{let e=t.target;e.matches(".datepicker-day-button")&&(this._focusedDate=this._dayDate(e),this._syncCalendarFocus())};this._handleCalendarKeydown=t=>{let e=t.target;if(!e.matches(".datepicker-day-button")||t.altKey||t.ctrlKey||t.metaKey)return;let i=this._dayDate(e),s=(i.getDay()-this.options.firstDay+7)%7,n={ArrowLeft:this.options.isRTL?1:-1,ArrowRight:this.options.isRTL?-1:1,ArrowUp:-7,ArrowDown:7,Home:-s,End:6-s};if(Object.hasOwn(n,t.key))i.setDate(i.getDate()+n[t.key]);else if(t.key==="PageUp"||t.key==="PageDown"){let p=i.getDate();i.setDate(1),i.setMonth(i.getMonth()+(t.key==="PageUp"?-1:1)*(t.shiftKey?12:1));let v=new Date(i.getTime());v.setMonth(v.getMonth()+1,0),i.setDate(Math.min(p,v.getDate()))}else return;t.preventDefault();let{minDate:a,maxDate:c,minYear:h,maxYear:l,minMonth:r,maxMonth:m}=this.options;a&&i<a&&i.setTime(a.getTime()),c&&i>c&&i.setTime(c.getTime()),!(i.getFullYear()<h||i.getFullYear()>l||i.getFullYear()===h&&i.getMonth()<(r??0)||i.getFullYear()===l&&i.getMonth()>(m??11))&&(this._focusedDate=i,this.gotoDate(i))};this._handleCalendarClick=t=>{let e=t.target;e.classList.contains("is-disabled")||this._batchDraws(()=>{if(e.classList.contains("datepicker-day-button")&&!e.classList.contains("is-empty")&&!e.parentElement.classList.contains("is-disabled")&&!e.parentElement.classList.contains("is-selection-disabled")){let i=new Date(t.target.getAttribute("data-year"),t.target.getAttribute("data-month"),t.target.getAttribute("data-day"));(!this.multiple||this.multiple&&this.options.isMultipleSelection)&&this.setDate(i),this.options.isDateRange&&this._handleDateRangeCalendarClick(i),this.options.autoSubmit&&this._finishSelection()}else e.closest(".month-prev")?this.prevMonth():e.closest(".month-next")&&this.nextMonth()})};this._handleDateRangeCalendarClick=t=>{if(this.endDate==null||!f._compareDates(t,this.endDate)){if(f._isDate(this.date)&&f._comparePastDate(t,this.date))return;this.setDate(t,!1,f._isDate(this.date));return}this._clearDates(),this.draw()};this._handleClearClick=()=>{this._clearDates(),this.setInputValues()};this._clearDates=()=>{this.date=null,this.endDate=null,this.dates?.splice(0),this.draw()};this._handleMonthChange=t=>{this.gotoMonth(t.target.value)};this._handleYearChange=t=>{this.gotoYear(t.target.value)};this._handleInputChange=t=>{let e,i=t.target;if(t.detail?.firedBy!==this&&!(i==this.endDateEl&&!this.date)&&(this.options.parse?e=this.options.parse(t.target.value,typeof this.options.format=="function"?this.options.format(new Date(this.el.value)):this.options.format):e=f._parseDate(t.target.value),f._isDate(e))){if(i==this.endDateEl&&e<this.date)return this.setInputValue(i,this.endDate);this.setDate(e,!1,i==this.endDateEl,!0),t.type=="date"&&(this.setDataDate(t,e),this.setInputValues())}};this._finishSelection=()=>{this.setInputValues()};this._confirm=()=>{this._finishSelection(),typeof this.options.onConfirm=="function"&&this.options.onConfirm.call(this)};this._cancel=()=>{typeof this.options.onCancel=="function"&&this.options.onCancel.call(this)};this.el.Expressive_Datepicker=this,this.options={...f.defaults,...e},e&&e.hasOwnProperty("i18n")&&typeof e.i18n=="object"&&(this.options.i18n={...f.defaults.i18n,...e.i18n}),this.options.minDate&&this.options.minDate.setHours(0,0,0,0),this.options.maxDate&&this.options.maxDate.setHours(0,0,0,0),this.id=u.guid(),this.options.isMultipleSelection&&(this.multiple=!0,this.dates=[],this.dateEls=[t]),this._setupVariables(),this._insertHTMLIntoDOM(),this._setupEventHandlers(),this.options.defaultDate||(this.options.defaultDate=f._parseDate(this.el.value));let i=this.options.defaultDate;if(f._isDate(i)?this.options.setDefaultDate?(this.setDate(i,!0),this.setInputValue(this.el,i)):this.gotoDate(i):this.gotoDate(new Date),this.options.isDateRange){this.multiple=!0;let s=this.options.defaultEndDate;f._isDate(s)&&this.options.setDefaultEndDate&&(this.setDate(s,!0,!0),this.setInputValue(this.endDateEl,s))}this.options.displayPlugin&&this.options.displayPlugin==="docked"&&(this.displayPlugin=j.init(this.el,this.containerEl,this.options.displayPluginOptions))}static get defaults(){return ce}static init(t,e={}){return super.init(t,e,f)}static _escape(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}static _isDate(t){return/Date/.test(Object.prototype.toString.call(t))&&!isNaN(t.getTime())}static _parseDate(t){if(t=t.trim(),!/^\d{4}-\d{2}-\d{2}$/.test(t))return new Date(Date.parse(t));let e=new Date(t+"T00:00:00");return e.getDate()===Number(t.slice(-2))?e:new Date(NaN)}static _isWeekend(t){let e=t.getDay();return e===0||e===6}static _setToStartOfDay(t){f._isDate(t)&&t.setHours(0,0,0,0)}static _getDaysInMonth(t,e){return[31,f._isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]}static _isLeapYear(t){return t%4===0&&t%100!==0||t%400===0}static _compareDates(t,e){return t.getTime()===e.getTime()}static _compareWithinRange(t,e,i){return t.getTime()>e.getTime()&&t.getTime()<i.getTime()}static _comparePastDate(t,e){return t.getTime()<e.getTime()}static getInstance(t){return t.Expressive_Datepicker}destroy(){this._removeEventHandlers(),this.dateEls?.slice(1).forEach(t=>this._removeDateInput(t)),!this.options.dateRangeEndEl&&this.endDateEl&&this._removeDateInput(this.endDateEl),this.displayPlugin?.destroy(),this.containerEl.remove(),this.destroySelects(),this.el.Expressive_Datepicker=void 0}destroySelects(){let t=this.calendarEl.querySelector(".orig-select-year");t&&k.getInstance(t).destroy();let e=this.calendarEl.querySelector(".orig-select-month");e&&k.getInstance(e).destroy()}_insertHTMLIntoDOM(){if(this.el.type=="date"&&this.el.classList.add("datepicker-date-input"),this._renderDateInputFormat(this.el),this.options.isDateRange&&(this.containerEl.classList.add("daterange"),this.options.dateRangeEndEl?(this.endDateEl=document.querySelector(this.options.dateRangeEndEl),this.endDateEl?this._renderDateInputFormat(this.endDateEl):console.warn("Specified date range end input element in dateRangeEndEl not found")):(this.endDateEl=this.createDateInput(),this.endDateEl.classList.add("datepicker-end-date"))),u.createButton(this.footer,this.options.i18n.clear,["datepicker-clear"],this.options.showClearBtn,this._handleClearClick),this.options.autoSubmit||u.createConfirmationContainer(this.footer,this.options.i18n.done,this.options.i18n.cancel,this._confirm,this._cancel),this.options.container){let t=this.options.container;this.options.container=t instanceof HTMLElement?t:document.querySelector(t),this.options.container.append(this.containerEl)}else{let t=this.endDateEl?this.endDateEl:this.el;this.options.openByDefault||this.containerEl.setAttribute("style","display: none; visibility: hidden;"),t.parentElement.after(this.containerEl)}}_renderDateInputFormat(t){let e=t.parentElement?.querySelector(".datepicker-format");e&&(e.textContent=typeof this.options.format=="function"?"":String(this.options.format))}toString(t=this.date,e=null){return e=e||this.options.format,typeof e=="function"?e(t):f._isDate(t)?this.formatDate(t,e):""}formatDate(t,e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g).map(s=>this.formats[s]?this.formats[s](t):s).join("")}setDateFromInput(t){let e=f._parseDate(t.value);this.setDate(e,!1,t==this.endDateEl,!0)}setDate(t=null,e=!1,i=!1,s=!1){let n=this.validateDate(t);n&&(f._setToStartOfDay(n),this.options.isMultipleSelection?s||this.setMultiDate(n):this.setSingleDate(n,i),this.gotoDate(n),!e&&typeof this.options.onSelect=="function"&&this.options.onSelect.call(this,n))}validateDate(t){if(!t)return this._renderDateDisplay(t),this.draw();if(typeof t=="string"&&(t=f._parseDate(t)),!f._isDate(t))return;let e=this.options.minDate,i=this.options.maxDate;return f._isDate(e)&&t<e?t=e:f._isDate(i)&&t>i&&(t=i),new Date(t.getTime())}setSingleDate(t,e){e?e&&(this.endDate=t):this.date=t}setMultiDate(t){let e=this.dates?.find(i=>i.getTime()===t.getTime()?i:!1);e?this.dates.splice(this.dates.indexOf(e),1):this.dates.push(t),this.dates.sort((i,s)=>i.getTime()<s.getTime()?-1:0)}setDataDate(t,e){t.setAttribute("data-date",this.toString(e))}setInputValues(){if(!this.options?.isMultipleSelection){this.setInputValue(this.el,this.date),this.options?.isDateRange&&this.setInputValue(this.endDateEl,this.endDate);return}this.setMultipleSelectionInputValues()}setMultipleSelectionInputValues(){let t=Math.max(1,this.dates.length);for(let e of this.dateEls.splice(t))this._removeDateInput(e);for(;this.dateEls.length<t;)this.dateEls.push(this.createDateInput());this.dateEls.forEach((e,i)=>this.setInputValue(e,this.dates[i]??null))}setInputValue(t,e){t&&(f._isDate(e)?t.type=="date"?(this.setDataDate(t,e),t.value=this.formatDate(e,"yyyy-mm-dd")):t.value=this.toString(e):(t.value="",t.type==="date"&&t.setAttribute("data-date","")),this.el.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,composed:!0,detail:{firedBy:this}})))}_renderDateDisplay(t,e=null){let i=f._isDate(t)?t:new Date;if(!this.options.isDateRange)this.dateTextEl.textContent=this.formatDate(i,"ddd, mmm d");else{let s=f._isDate(e)?e:new Date;this.dateTextEl.textContent=`${this.formatDate(i,"mmm d")} - ${this.formatDate(s,"mmm d")}`}}gotoDate(t){let e=!0;if(f._isDate(t)){if(this.calendars){let i=new Date(this.calendars[0].year,this.calendars[0].month,1),s=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),n=t.getTime();s.setMonth(s.getMonth()+1),s.setDate(s.getDate()-1),e=n<i.getTime()||s.getTime()<n}e&&(this.calendars=[{month:t.getMonth(),year:t.getFullYear()}]),this.adjustCalendars()}}adjustCalendars(){this.calendars[0]=this.adjustCalendar(this.calendars[0]),this.draw()}adjustCalendar(t){return t.month<0&&(t.year-=Math.ceil(Math.abs(t.month)/12),t.month+=12),t.month>11&&(t.year+=Math.floor(Math.abs(t.month)/12),t.month-=12),t}nextMonth(){this.calendars[0].month++,this.adjustCalendars()}prevMonth(){this.calendars[0].month--,this.adjustCalendars()}render(t,e,i){let s=new Date,n=f._getDaysInMonth(t,e),a=[],c=new Date(t,e,1).getDay(),h=[];f._setToStartOfDay(s),this.options.firstDay>0&&(c-=this.options.firstDay,c<0&&(c+=7));let l=e===0?11:e-1,r=e===11?0:e+1,m=e===0?t-1:t,p=e===11?t+1:t,v=f._getDaysInMonth(m,l),E=n+c,b=E;for(;b>7;)b-=7;E+=7-b;let w=!1;for(let D=0,F=0;D<E;D++){let M=new Date(t,e,1+(D-c)),It=f._compareDates(M,s),Dt=this.options.events.indexOf(M.toDateString())!==-1,gt=D<c||D>=n+c,kt=this.options.startRange&&f._compareDates(this.options.startRange,M),At=this.options.endRange&&f._compareDates(this.options.endRange,M),St=this.options.startRange&&this.options.endRange&&this.options.startRange<M&&M<this.options.endRange,Ot=this.options.minDate&&M<this.options.minDate||this.options.maxDate&&M>this.options.maxDate||this.options.disableWeekends&&f._isWeekend(M)||this.options.disableDayFn&&this.options.disableDayFn(M),Ht=this.options.isDateRange&&this.date&&this.endDate&&f._compareDates(this.date,M),Rt=this.options.isDateRange&&this.endDate&&f._compareDates(this.endDate,M),Pt=this.options.isDateRange&&f._isDate(this.endDate)&&f._compareWithinRange(M,this.date,this.endDate),nt=1+(D-c),ht=e,ct=t,ot=!1;f._isDate(this.date)&&(ot=f._compareDates(M,this.date)),!ot&&f._isDate(this.endDate)&&(ot=f._compareDates(M,this.endDate)),this.options.isMultipleSelection&&this.dates?.some(Nt=>Nt.getTime()===M.getTime())&&(ot=!0),gt&&(D<c?(nt=v+nt,ht=l,ct=m):(nt=nt-n,ht=r,ct=p));let Bt={day:nt,month:ht,year:ct,hasEvent:Dt,isSelected:ot,isToday:It,isDisabled:Ot,isEmpty:gt,isStartRange:kt,isEndRange:At,isInRange:St,showDaysInNextAndPreviousMonths:this.options.showDaysInNextAndPreviousMonths,isDateRangeStart:Ht,isDateRangeEnd:Rt,isDateRange:Pt};h.push(this.renderDay(Bt)),++F===7&&(a.push(this.renderRow(h,this.options.isRTL,w)),h=[],F=0,w=!1)}return this.renderTable(this.options,a,i)}renderDay(t){let e={isDisabled:"is-disabled",isToday:"is-today",isSelected:"is-selected",hasEvent:"has-event",isInRange:"is-inrange",isStartRange:"is-startrange",isEndRange:"is-endrange",isDateRangeStart:"is-daterange-start",isDateRangeEnd:"is-daterange-end",isDateRange:"is-daterange"},i=["isSelected","isDateRange"].filter(h=>!!(t.hasOwnProperty(h)&&t[h]===!0)).length!==0,s=["datepicker-day"];if(t.isEmpty)if(t.showDaysInNextAndPreviousMonths)s.push("is-outside-current-month"),s.push("is-selection-disabled");else return'<td class="is-empty"></td>';for(let[h,l]of Object.entries(e))t.hasOwnProperty(h)&&t[h]&&s.push(l);let n=f._escape(t.day),a=f._escape(t.month),c=f._escape(t.year);return`<td data-day="${n}" class="${s.join(" ")}" aria-selected="${i}"><button class="datepicker-day-button" type="button" data-year="${c}" data-month="${a}" data-day="${n}">${n}</button></td>`}renderRow(t,e,i){return'<tr class="datepicker-row'+(i?" is-selected":"")+'">'+f._calendarMarkup((e?t.reverse():t).join(""),"tr")+"</tr>"}renderTable(t,e,i){return'<div class="datepicker-table-wrapper"><table cellpadding="0" cellspacing="0" class="datepicker-table" role="grid" aria-labelledby="'+f._escape(i)+'">'+this.renderHead(t)+this.renderBody(e)+"</table></div>"}renderHead(t){let e=[],i;for(i=0;i<7;i++){let s=f._escape(this.renderDayName(t,i)),n=f._escape(this.renderDayName(t,i,!0));e.push(`<th scope="col"><abbr title="${s}">${n}</abbr></th>`)}return"<thead><tr>"+(t.isRTL?e.reverse():e).join("")+"</tr></thead>"}renderBody(t){return"<tbody>"+f._calendarMarkup(t.join(""),"tbody")+"</tbody>"}static _calendarMarkup(t,e){let i=document.createElement("template");i.innerHTML=t;let s={tr:["class"],td:["class","data-day","aria-selected"],button:["class","type","data-year","data-month","data-day","aria-label","disabled","tabindex"]},n=(a,c)=>{if(a.nodeType===Node.TEXT_NODE){if((c==="tbody"||c==="tr")&&a.textContent.trim())throw new TypeError("Unsupported calendar row content");return f._escape(a.textContent)}if(!(a instanceof HTMLElement))throw new TypeError("Unsupported calendar row content");let h=a.localName==="tr"?"tr":a.localName==="td"?"td":a.localName==="button"?"button":null;if(!h||!(c==="tbody"&&h==="tr"||c==="tr"&&h==="td"||c==="td"&&h==="button"))throw new TypeError("Unsupported calendar row element");if([...a.attributes].some(r=>!s[h].includes(r.name)))throw new TypeError("Unsupported calendar row attribute");if(h==="button"&&a.getAttribute("type")!=="button")throw new TypeError('Calendar day buttons require type="button"');let l=s[h].filter(r=>a.hasAttribute(r)).map(r=>` ${r}="${f._escape(a.getAttribute(r))}"`).join("");return`<${h}${l}>${[...a.childNodes].map(r=>n(r,h)).join("")}</${h}>`};return[...i.content.childNodes].map(a=>n(a,e)).join("")}_arrowState(t,e){let i=this.options,s=t===i.minYear,n=t===i.maxYear;return{prev:!(s&&(e===0||i.minMonth>=e)),next:!(n&&(e===11||i.maxMonth<=e))}}_controlsCacheKey(t){let e=this.options;return[t,e.minYear,e.maxYear,e.minMonth,e.maxMonth,Array.isArray(e.yearRange)?e.yearRange.join("-"):e.yearRange,e.yearRangeReverse,e.showMonthAfterYear].join("|")}renderTitle(t,e,i,s,n,a){let c=this.options,h=i===c.minYear,l=i===c.maxYear,r,m,p=[],v='<div id="'+f._escape(a)+'" class="datepicker-controls" role="heading" aria-live="assertive">',{prev:E,next:b}=this._arrowState(i,s);for(r=0;r<12;r++)p.push('<option value="'+(i===n?r-e:12+r-e)+'"'+(r===s?' selected="selected"':"")+(h&&r<c.minMonth||l&&r>c.maxMonth?'disabled="disabled"':"")+">"+f._escape(c.i18n.months[r])+"</option>");let w='<select class="datepicker-select orig-select-month" tabindex="-1">'+p.join("")+"</select>";for(Array.isArray(c.yearRange)?(r=c.yearRange[0],m=c.yearRange[1]+1):(r=i-c.yearRange,m=1+i+c.yearRange),p=[];r<m&&r<=c.maxYear;r++)r>=c.minYear&&p.push(`<option value="${r}" ${r===i?'selected="selected"':""}>${r}</option>`);c.yearRangeReverse&&p.reverse();let D=`<select class="datepicker-select orig-select-year" tabindex="-1">${p.join("")}</select>`;return v+=`<button class="month-prev${E?"":" is-disabled"}" type="button"><svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg></button>`,v+='<div class="selects-container">',c.showMonthAfterYear?v+=D+w:v+=w+D,v+="</div>",v+=`<button class="month-next${b?"":" is-disabled"}" type="button"><svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg></button>`,v+="</div>"}_batchDraws(t){this._drawDepth++;try{t()}finally{this._drawDepth--,this._drawDepth===0&&this._drawDirty&&(this._drawDirty=!1,this.draw())}}draw(){if(this._drawDepth>0){this._drawDirty=!0;return}let t=this.calendarEl.getRootNode().activeElement,e=t?.matches(".datepicker-day-button")&&this.calendarEl.contains(t),i=this.calendarEl.contains(t)&&t?.matches(".month-prev, .month-next")?t.classList.contains("month-prev")?".month-prev":".month-next":null,s=this.options,n=s.minYear,a=s.maxYear,c=s.minMonth,h=s.maxMonth;this._y<=n&&(this._y=n,!isNaN(c)&&this._m<c&&(this._m=c)),this._y>=a&&(this._y=a,!isNaN(h)&&this._m>h&&(this._m=h));let l=this.calendars[0].year,r=this.calendars[0].month;this.options.isDateRange?this._renderDateDisplay(this.date,this.endDate):this._renderDateDisplay(this.date);let m=this._controlsCacheKey(l);m===this._controlsKey&&this.calendarEl.querySelector(".datepicker-controls")?this._reuseControls(l,r):(this._controlsKey=m,this._randId="datepicker-title-"+u.guid(),this._rebuildControls(l,r)),this._renderCalendarTable(l,r),this._syncCalendarFocus(!!e),i&&this.calendarEl.querySelector(i)?.focus(),typeof this.options.onDraw=="function"&&this.options.onDraw.call(this)}_rebuildControls(t,e){this.destroySelects(),this.calendarEl.innerHTML=this.renderTitle(this,0,t,e,t,this._randId);let i=this.calendarEl.querySelector(".orig-select-year"),s=this.calendarEl.querySelector(".orig-select-month");k.init(i,{classes:"select-year",menuOptions:{container:u.portalRoot(this.el),constrainWidth:!1}}),k.init(s,{classes:"select-month",menuOptions:{container:u.portalRoot(this.el),constrainWidth:!1}}),i.addEventListener("change",this._handleYearChange),s.addEventListener("change",this._handleMonthChange)}_reuseControls(t,e){let i=this.calendarEl.querySelector(".orig-select-month");i&&i.value!==e.toString()&&(i.value=e.toString(),k.getInstance(i)?.refresh());let{prev:s,next:n}=this._arrowState(t,e);this.calendarEl.querySelector(".month-prev")?.classList.toggle("is-disabled",!s),this.calendarEl.querySelector(".month-next")?.classList.toggle("is-disabled",!n)}_renderCalendarTable(t,e){let i=this.render(t,e,this._randId),s=this.calendarEl.querySelector(".datepicker-table-wrapper");s?s.outerHTML=i:this.calendarEl.insertAdjacentHTML("beforeend",i)}_setupEventHandlers(){this.el.addEventListener("click",this._handleInputClick),this.el.addEventListener("keydown",this._handleInputKeydown),this.el.addEventListener("change",this._handleInputChange),this.endDateEl?.addEventListener("click",this._handleInputClick),this.endDateEl?.addEventListener("keydown",this._handleInputKeydown),this.endDateEl?.addEventListener("change",this._handleInputChange),this.calendarEl.addEventListener("click",this._handleCalendarClick),this.calendarEl.addEventListener("keydown",this._handleCalendarKeydown),this.calendarEl.addEventListener("focusin",this._handleCalendarFocus)}_setupVariables(){let t=document.createElement("template");t.innerHTML=f._template.trim(),this.containerEl=t.content.firstChild,this.calendarEl=this.containerEl.querySelector(".datepicker-calendar"),this.yearTextEl=this.containerEl.querySelector(".year-text"),this.dateTextEl=this.containerEl.querySelector(".date-text"),this.footer=this.containerEl.querySelector(".datepicker-footer"),this.formats={d:e=>e.getDate(),dd:e=>{let i=e.getDate();return(i<10?"0":"")+i},ddd:e=>this.options.i18n.weekdaysShort[e.getDay()],dddd:e=>this.options.i18n.weekdays[e.getDay()],m:e=>e.getMonth()+1,mm:e=>{let i=e.getMonth()+1;return(i<10?"0":"")+i},mmm:e=>this.options.i18n.monthsShort[e.getMonth()],mmmm:e=>this.options.i18n.months[e.getMonth()],yy:e=>(""+e.getFullYear()).slice(2),yyyy:e=>e.getFullYear()}}_removeEventHandlers(){for(let t of this.dateEls??[this.el])this._removeInputEventHandlers(t);this.calendarEl.removeEventListener("click",this._handleCalendarClick),this.calendarEl.removeEventListener("keydown",this._handleCalendarKeydown),this.calendarEl.removeEventListener("focusin",this._handleCalendarFocus),this.options.isDateRange&&this.endDateEl&&this._removeInputEventHandlers(this.endDateEl)}_removeInputEventHandlers(t){t.removeEventListener("click",this._handleInputClick),t.removeEventListener("keydown",this._handleInputKeydown),t.removeEventListener("change",this._handleInputChange)}_removeDateInput(t){let e=t.getRootNode().activeElement===t;this._removeInputEventHandlers(t),t.remove(),e&&document.activeElement===document.body&&this.el.focus()}_dayDate(t){let e=new Date(0);return e.setFullYear(Number(t.dataset.year),Number(t.dataset.month),Number(t.dataset.day)),f._setToStartOfDay(e),e}_syncCalendarFocus(t=!1){let e=[...this.calendarEl.querySelectorAll(".datepicker-day-button")],i=e.filter(a=>!a.parentElement.classList.contains("is-selection-disabled")),s=this._focusedDate||this.date||new Date,n=i.find(a=>f._compareDates(this._dayDate(a),s))||i.find(a=>a.parentElement.classList.contains("is-selected"))||i.find(a=>!a.parentElement.classList.contains("is-disabled"))||i[0];for(let a of e)a.tabIndex=a===n?0:-1,a.setAttribute("aria-disabled",String(a.parentElement.matches(".is-disabled, .is-selection-disabled")));n&&(this._focusedDate=this._dayDate(n),t&&n.focus())}gotoMonth(t){isNaN(t)||(this.calendars[0].month=parseInt(t,10),this.adjustCalendars())}gotoYear(t){isNaN(t)||(this.calendars[0].year=parseInt(t,10),this.adjustCalendars())}renderDayName(t,e,i=!1){for(e+=t.firstDay;e>=7;)e-=7;return i?t.i18n.weekdaysAbbrev[e]:t.i18n.weekdays[e]}createDateInput(){let t=this.el.cloneNode(!0);return t.removeAttribute("id"),t.addEventListener("click",this._handleInputClick),t.addEventListener("keydown",this._handleInputKeydown),t.addEventListener("change",this._handleInputChange),this.el.parentElement.appendChild(t),t}};f._template=`
|
|
9
|
+
opacity ${this.options.duration}ms ease-out`,setTimeout(()=>{this.container.style.transform="translateX(0px) translateY(0px)",this.container.style.opacity="0"},1))};this.el=o,this.options={...de,...e},this.container=document.createElement("div"),this.container.classList.add("display-docked"),this.container.append(t),o.parentElement.append(this.container),document.addEventListener("click",this._handleDocumentClick)}static init(o,t,e){return new d(o,t,e)}};var ue={format:"mmm dd, yyyy",parse:null,isDateRange:!1,dateRangeEndEl:null,isMultipleSelection:!1,defaultDate:null,defaultEndDate:null,setDefaultDate:!1,setDefaultEndDate:!1,disableWeekends:!1,disableDayFn:null,firstDay:0,minDate:null,maxDate:null,yearRange:10,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearRangeReverse:!1,showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,openByDefault:!1,container:null,showClearBtn:!1,autoSubmit:!0,i18n:{cancel:"Cancel",clear:"Clear",done:"Ok",previousMonth:"\u2039",nextMonth:"\u203A",months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysAbbrev:["S","M","T","W","T","F","S"]},events:[],onSelect:null,onDraw:null,onInputInteraction:null,displayPlugin:null,displayPluginOptions:null,onConfirm:null,onCancel:null},f=class f extends _{constructor(t,e){super(t,e,f);this.multiple=!1;this._drawDepth=0;this._drawDirty=!1;this._controlsKey=null;this._randId=null;this._focusedDate=null;this._handleInputClick=t=>{t.target.type=="date"&&(this.options.openByDefault||this.options.container)&&t.preventDefault(),this._batchDraws(()=>{this.setDateFromInput(t.target),this.draw(),this.gotoDate(t.target===this.el?this.date:this.endDate)}),this.displayPlugin&&this.displayPlugin.show(),this.options.onInputInteraction&&this.options.onInputInteraction.call(this)};this._handleInputKeydown=t=>{t.key===u.keys.ENTER&&(t.preventDefault(),this._batchDraws(()=>{this.setDateFromInput(t.target),this._focusedDate=t.target===this.endDateEl?this.endDate:this.date,this.draw()}),this.displayPlugin&&this.displayPlugin.show(),this._syncCalendarFocus(!0),this.options.onInputInteraction&&this.options.onInputInteraction.call(this))};this._handleCalendarFocus=t=>{let e=t.target;e.matches(".datepicker-day-button")&&(this._focusedDate=this._dayDate(e),this._syncCalendarFocus())};this._handleCalendarKeydown=t=>{let e=t.target;if(!e.matches(".datepicker-day-button")||t.altKey||t.ctrlKey||t.metaKey)return;let i=this._dayDate(e),s=(i.getDay()-this.options.firstDay+7)%7,n={ArrowLeft:this.options.isRTL?1:-1,ArrowRight:this.options.isRTL?-1:1,ArrowUp:-7,ArrowDown:7,Home:-s,End:6-s};if(Object.hasOwn(n,t.key))i.setDate(i.getDate()+n[t.key]);else if(t.key==="PageUp"||t.key==="PageDown"){let m=i.getDate();i.setDate(1),i.setMonth(i.getMonth()+(t.key==="PageUp"?-1:1)*(t.shiftKey?12:1));let v=new Date(i.getTime());v.setMonth(v.getMonth()+1,0),i.setDate(Math.min(m,v.getDate()))}else return;t.preventDefault();let{minDate:a,maxDate:h,minYear:c,maxYear:l,minMonth:r,maxMonth:p}=this.options;a&&i<a&&i.setTime(a.getTime()),h&&i>h&&i.setTime(h.getTime()),!(i.getFullYear()<c||i.getFullYear()>l||i.getFullYear()===c&&i.getMonth()<(r??0)||i.getFullYear()===l&&i.getMonth()>(p??11))&&(this._focusedDate=i,this.gotoDate(i))};this._handleCalendarClick=t=>{let e=t.target;e.classList.contains("is-disabled")||this._batchDraws(()=>{if(e.classList.contains("datepicker-day-button")&&!e.classList.contains("is-empty")&&!e.parentElement.classList.contains("is-disabled")&&!e.parentElement.classList.contains("is-selection-disabled")){let i=new Date(t.target.getAttribute("data-year"),t.target.getAttribute("data-month"),t.target.getAttribute("data-day"));(!this.multiple||this.multiple&&this.options.isMultipleSelection)&&this.setDate(i),this.options.isDateRange&&this._handleDateRangeCalendarClick(i),this.options.autoSubmit&&this._finishSelection()}else e.closest(".month-prev")?this.prevMonth():e.closest(".month-next")&&this.nextMonth()})};this._handleDateRangeCalendarClick=t=>{if(this.endDate==null||!f._compareDates(t,this.endDate)){if(f._isDate(this.date)&&f._comparePastDate(t,this.date))return;this.setDate(t,!1,f._isDate(this.date));return}this._clearDates(),this.draw()};this._handleClearClick=()=>{this._clearDates(),this.setInputValues()};this._clearDates=()=>{this.date=null,this.endDate=null,this.dates?.splice(0),this.draw()};this._handleMonthChange=t=>{this.gotoMonth(t.target.value)};this._handleYearChange=t=>{this.gotoYear(t.target.value)};this._handleInputChange=t=>{t.detail?.firedBy!==this&&this.setDateFromInput(t.target)};this._finishSelection=()=>{this.setInputValues()};this._confirm=()=>{this._finishSelection(),typeof this.options.onConfirm=="function"&&this.options.onConfirm.call(this)};this._cancel=()=>{typeof this.options.onCancel=="function"&&this.options.onCancel.call(this)};this.el.Expressive_Datepicker=this,this.options={...f.defaults,...e},e&&e.hasOwnProperty("i18n")&&typeof e.i18n=="object"&&(this.options.i18n={...f.defaults.i18n,...e.i18n}),this.options.minDate&&this.options.minDate.setHours(0,0,0,0),this.options.maxDate&&this.options.maxDate.setHours(0,0,0,0),this.id=u.guid(),this.options.isMultipleSelection&&(this.multiple=!0,this.dates=[],this.dateEls=[t]),this._setupVariables(),this._insertHTMLIntoDOM(),this._setupEventHandlers(),this.options.defaultDate||(this.options.defaultDate=this._parseInput(this.el.value));let i=this.options.defaultDate;if(f._isDate(i)?this.options.setDefaultDate?(this.setDate(i,!0),this.setInputValue(this.el,i)):this.gotoDate(i):this.gotoDate(new Date),this.options.isDateRange){this.multiple=!0;let s=this.options.defaultEndDate;f._isDate(s)&&this.options.setDefaultEndDate&&(this.setDate(s,!0,!0),this.setInputValue(this.endDateEl,s))}this.options.displayPlugin&&this.options.displayPlugin==="docked"&&(this.displayPlugin=X.init(this.el,this.containerEl,this.options.displayPluginOptions))}static get defaults(){return ue}static init(t,e={}){return super.init(t,e,f)}static _escape(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}static _isDate(t){return/Date/.test(Object.prototype.toString.call(t))&&!isNaN(t.getTime())}static _parseDate(t){if(t=t.trim(),!/^\d{4}-\d{2}-\d{2}$/.test(t))return new Date(Date.parse(t));let e=new Date(t+"T00:00:00");return e.getDate()===Number(t.slice(-2))?e:new Date(NaN)}_parseInput(t){return!t.trim()||!this.options.parse?f._parseDate(t):this.options.parse(t,typeof this.options.format=="string"?this.options.format:"")}static _isWeekend(t){let e=t.getDay();return e===0||e===6}static _setToStartOfDay(t){f._isDate(t)&&t.setHours(0,0,0,0)}static _getDaysInMonth(t,e){return[31,f._isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]}static _isLeapYear(t){return t%4===0&&t%100!==0||t%400===0}static _compareDates(t,e){return t.getTime()===e.getTime()}static _compareWithinRange(t,e,i){return t.getTime()>e.getTime()&&t.getTime()<i.getTime()}static _comparePastDate(t,e){return t.getTime()<e.getTime()}static getInstance(t){return t.Expressive_Datepicker}destroy(){this._removeEventHandlers(),this.dateEls?.slice(1).forEach(t=>this._removeDateInput(t)),!this.options.dateRangeEndEl&&this.endDateEl&&this._removeDateInput(this.endDateEl),this.displayPlugin?.destroy(),this.containerEl.remove(),this.destroySelects(),this.el.Expressive_Datepicker=void 0}destroySelects(){let t=this.calendarEl.querySelector(".orig-select-year");t&&k.getInstance(t).destroy();let e=this.calendarEl.querySelector(".orig-select-month");e&&k.getInstance(e).destroy()}_insertHTMLIntoDOM(){if(this.el.type=="date"&&this.el.classList.add("datepicker-date-input"),this._renderDateInputFormat(this.el),this.options.isDateRange&&(this.containerEl.classList.add("daterange"),this.options.dateRangeEndEl?(this.endDateEl=document.querySelector(this.options.dateRangeEndEl),this.endDateEl?this._renderDateInputFormat(this.endDateEl):console.warn("Specified date range end input element in dateRangeEndEl not found")):(this.endDateEl=this.createDateInput(),this.endDateEl.classList.add("datepicker-end-date"))),u.createButton(this.footer,this.options.i18n.clear,["datepicker-clear"],this.options.showClearBtn,this._handleClearClick),this.options.autoSubmit||u.createConfirmationContainer(this.footer,this.options.i18n.done,this.options.i18n.cancel,this._confirm,this._cancel),this.options.container){let t=this.options.container;this.options.container=t instanceof HTMLElement?t:document.querySelector(t),this.options.container.append(this.containerEl)}else{let t=this.endDateEl?this.endDateEl:this.el;this.options.openByDefault||this.containerEl.setAttribute("style","display: none; visibility: hidden;"),t.parentElement.after(this.containerEl)}}_renderDateInputFormat(t){let e=t.parentElement?.querySelector(".datepicker-format");e&&(e.textContent=typeof this.options.format=="function"?"":String(this.options.format))}toString(t=this.date,e=null){return e=e||this.options.format,typeof e=="function"?e(t):f._isDate(t)?this.formatDate(t,e):""}formatDate(t,e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g).map(s=>this.formats[s]?this.formats[s](t):s).join("")}setDateFromInput(t){if(t.type==="date"&&this.setDataDate(t,f._parseDate(t.value)),(this.options.isDateRange||!this.options.isMultipleSelection)&&!t.value.trim()){this.setSingleDate(null,t===this.endDateEl),this.draw();return}let e=this._parseInput(t.value);if(!f._isDate(e))return;let i=new Date(e.getTime());f._setToStartOfDay(i);let s=t===this.endDateEl;if(this.options.isDateRange&&(s?this.date&&i<this.date:this.endDate&&i>this.endDate)){this.setInputValue(t,s?this.endDate:this.date);return}this.setDate(i,!1,s,!0)}setDate(t=null,e=!1,i=!1,s=!1){let n=this.validateDate(t);n&&(f._setToStartOfDay(n),this.options.isMultipleSelection?s||this.setMultiDate(n):this.setSingleDate(n,i),this.gotoDate(n),!e&&typeof this.options.onSelect=="function"&&this.options.onSelect.call(this,n))}validateDate(t){if(!t)return this._renderDateDisplay(t),this.draw();if(typeof t=="string"&&(t=f._parseDate(t)),!f._isDate(t))return;let e=this.options.minDate,i=this.options.maxDate;return f._isDate(e)&&t<e?t=e:f._isDate(i)&&t>i&&(t=i),new Date(t.getTime())}setSingleDate(t,e){e?e&&(this.endDate=t):this.date=t}setMultiDate(t){let e=this.dates?.find(i=>i.getTime()===t.getTime()?i:!1);e?this.dates.splice(this.dates.indexOf(e),1):this.dates.push(t),this.dates.sort((i,s)=>i.getTime()<s.getTime()?-1:0)}setDataDate(t,e){t.setAttribute("data-date",f._isDate(e)?this.toString(e):"")}setInputValues(){if(!this.options?.isMultipleSelection){this.setInputValue(this.el,this.date),this.options?.isDateRange&&this.setInputValue(this.endDateEl,this.endDate);return}this.setMultipleSelectionInputValues()}setMultipleSelectionInputValues(){let t=Math.max(1,this.dates.length);for(let e of this.dateEls.splice(t))this._removeDateInput(e);for(;this.dateEls.length<t;)this.dateEls.push(this.createDateInput());this.dateEls.forEach((e,i)=>this.setInputValue(e,this.dates[i]??null))}setInputValue(t,e){t&&(t.type=="date"&&this.setDataDate(t,e),f._isDate(e)?t.type=="date"?t.value=this.formatDate(e,"yyyy-mm-dd"):t.value=this.toString(e):t.value="",t.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,composed:!0,detail:{firedBy:this}})))}_renderDateDisplay(t,e=null){let i=f._isDate(t)?t:new Date;if(!this.options.isDateRange)this.dateTextEl.textContent=this.formatDate(i,"ddd, mmm d");else{let s=f._isDate(e)?e:new Date;this.dateTextEl.textContent=`${this.formatDate(i,"mmm d")} - ${this.formatDate(s,"mmm d")}`}}gotoDate(t){let e=!0;if(f._isDate(t)){if(this.calendars){let i=new Date(this.calendars[0].year,this.calendars[0].month,1),s=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),n=t.getTime();s.setMonth(s.getMonth()+1),s.setDate(s.getDate()-1),e=n<i.getTime()||s.getTime()<n}e&&(this.calendars=[{month:t.getMonth(),year:t.getFullYear()}]),this.adjustCalendars()}}adjustCalendars(){this.calendars[0]=this.adjustCalendar(this.calendars[0]),this.draw()}adjustCalendar(t){return t.month<0&&(t.year-=Math.ceil(Math.abs(t.month)/12),t.month+=12),t.month>11&&(t.year+=Math.floor(Math.abs(t.month)/12),t.month-=12),t}nextMonth(){this.calendars[0].month++,this.adjustCalendars()}prevMonth(){this.calendars[0].month--,this.adjustCalendars()}render(t,e,i){let s=new Date,n=f._getDaysInMonth(t,e),a=[],h=new Date(t,e,1).getDay(),c=[];f._setToStartOfDay(s),this.options.firstDay>0&&(h-=this.options.firstDay,h<0&&(h+=7));let l=e===0?11:e-1,r=e===11?0:e+1,p=e===0?t-1:t,m=e===11?t+1:t,v=f._getDaysInMonth(p,l),E=n+h,b=E;for(;b>7;)b-=7;E+=7-b;let y=!1;for(let I=0,A=0;I<E;I++){let M=new Date(t,e,1+(I-h)),Dt=f._compareDates(M,s),kt=this.options.events.indexOf(M.toDateString())!==-1,_t=I<h||I>=n+h,At=this.options.startRange&&f._compareDates(this.options.startRange,M),St=this.options.endRange&&f._compareDates(this.options.endRange,M),Ot=this.options.startRange&&this.options.endRange&&this.options.startRange<M&&M<this.options.endRange,Ht=this.options.minDate&&M<this.options.minDate||this.options.maxDate&&M>this.options.maxDate||this.options.disableWeekends&&f._isWeekend(M)||this.options.disableDayFn&&this.options.disableDayFn(M),Rt=this.options.isDateRange&&this.date&&this.endDate&&f._compareDates(this.date,M),Pt=this.options.isDateRange&&this.endDate&&f._compareDates(this.endDate,M),Bt=this.options.isDateRange&&f._isDate(this.date)&&f._isDate(this.endDate)&&f._compareWithinRange(M,this.date,this.endDate),nt=1+(I-h),ct=e,dt=t,ot=!1;f._isDate(this.date)&&(ot=f._compareDates(M,this.date)),!ot&&f._isDate(this.endDate)&&(ot=f._compareDates(M,this.endDate)),this.options.isMultipleSelection&&this.dates?.some(Wt=>Wt.getTime()===M.getTime())&&(ot=!0),_t&&(I<h?(nt=v+nt,ct=l,dt=p):(nt=nt-n,ct=r,dt=m));let Nt={day:nt,month:ct,year:dt,hasEvent:kt,isSelected:ot,isToday:Dt,isDisabled:Ht,isEmpty:_t,isStartRange:At,isEndRange:St,isInRange:Ot,showDaysInNextAndPreviousMonths:this.options.showDaysInNextAndPreviousMonths,isDateRangeStart:Rt,isDateRangeEnd:Pt,isDateRange:Bt};c.push(this.renderDay(Nt)),++A===7&&(a.push(this.renderRow(c,this.options.isRTL,y)),c=[],A=0,y=!1)}return this.renderTable(this.options,a,i)}renderDay(t){let e={isDisabled:"is-disabled",isToday:"is-today",isSelected:"is-selected",hasEvent:"has-event",isInRange:"is-inrange",isStartRange:"is-startrange",isEndRange:"is-endrange",isDateRangeStart:"is-daterange-start",isDateRangeEnd:"is-daterange-end",isDateRange:"is-daterange"},i=["isSelected","isDateRange"].filter(c=>!!(t.hasOwnProperty(c)&&t[c]===!0)).length!==0,s=["datepicker-day"];if(t.isEmpty)if(t.showDaysInNextAndPreviousMonths)s.push("is-outside-current-month"),s.push("is-selection-disabled");else return'<td class="is-empty"></td>';for(let[c,l]of Object.entries(e))t.hasOwnProperty(c)&&t[c]&&s.push(l);let n=f._escape(t.day),a=f._escape(t.month),h=f._escape(t.year);return`<td data-day="${n}" class="${s.join(" ")}" aria-selected="${i}"><button class="datepicker-day-button" type="button" data-year="${h}" data-month="${a}" data-day="${n}">${n}</button></td>`}renderRow(t,e,i){return'<tr class="datepicker-row'+(i?" is-selected":"")+'">'+f._calendarMarkup((e?t.reverse():t).join(""),"tr")+"</tr>"}renderTable(t,e,i){return'<div class="datepicker-table-wrapper"><table cellpadding="0" cellspacing="0" class="datepicker-table" role="grid" aria-labelledby="'+f._escape(i)+'">'+this.renderHead(t)+this.renderBody(e)+"</table></div>"}renderHead(t){let e=[],i;for(i=0;i<7;i++){let s=f._escape(this.renderDayName(t,i)),n=f._escape(this.renderDayName(t,i,!0));e.push(`<th scope="col"><abbr title="${s}">${n}</abbr></th>`)}return"<thead><tr>"+(t.isRTL?e.reverse():e).join("")+"</tr></thead>"}renderBody(t){return"<tbody>"+f._calendarMarkup(t.join(""),"tbody")+"</tbody>"}static _calendarMarkup(t,e){let i=document.createElement("template");i.innerHTML=t;let s={tr:["class"],td:["class","data-day","aria-selected"],button:["class","type","data-year","data-month","data-day","aria-label","disabled","tabindex"]},n=(a,h)=>{if(a.nodeType===Node.TEXT_NODE){if((h==="tbody"||h==="tr")&&a.textContent.trim())throw new TypeError("Unsupported calendar row content");return f._escape(a.textContent)}if(!(a instanceof HTMLElement))throw new TypeError("Unsupported calendar row content");let c=a.localName==="tr"?"tr":a.localName==="td"?"td":a.localName==="button"?"button":null;if(!c||!(h==="tbody"&&c==="tr"||h==="tr"&&c==="td"||h==="td"&&c==="button"))throw new TypeError("Unsupported calendar row element");if([...a.attributes].some(r=>!s[c].includes(r.name)))throw new TypeError("Unsupported calendar row attribute");if(c==="button"&&a.getAttribute("type")!=="button")throw new TypeError('Calendar day buttons require type="button"');let l=s[c].filter(r=>a.hasAttribute(r)).map(r=>` ${r}="${f._escape(a.getAttribute(r))}"`).join("");return`<${c}${l}>${[...a.childNodes].map(r=>n(r,c)).join("")}</${c}>`};return[...i.content.childNodes].map(a=>n(a,e)).join("")}_arrowState(t,e){let i=this.options,s=t===i.minYear,n=t===i.maxYear;return{prev:!(s&&(e===0||i.minMonth>=e)),next:!(n&&(e===11||i.maxMonth<=e))}}_controlsCacheKey(t){let e=this.options;return[t,e.minYear,e.maxYear,e.minMonth,e.maxMonth,Array.isArray(e.yearRange)?e.yearRange.join("-"):e.yearRange,e.yearRangeReverse,e.showMonthAfterYear].join("|")}renderTitle(t,e,i,s,n,a){let h=this.options,c=i===h.minYear,l=i===h.maxYear,r,p,m=[],v='<div id="'+f._escape(a)+'" class="datepicker-controls" role="heading" aria-live="assertive">',{prev:E,next:b}=this._arrowState(i,s);for(r=0;r<12;r++)m.push('<option value="'+(i===n?r-e:12+r-e)+'"'+(r===s?' selected="selected"':"")+(c&&r<h.minMonth||l&&r>h.maxMonth?'disabled="disabled"':"")+">"+f._escape(h.i18n.months[r])+"</option>");let y='<select class="datepicker-select orig-select-month" tabindex="-1">'+m.join("")+"</select>";for(Array.isArray(h.yearRange)?(r=h.yearRange[0],p=h.yearRange[1]+1):(r=i-h.yearRange,p=1+i+h.yearRange),m=[];r<p&&r<=h.maxYear;r++)r>=h.minYear&&m.push(`<option value="${r}" ${r===i?'selected="selected"':""}>${r}</option>`);h.yearRangeReverse&&m.reverse();let I=`<select class="datepicker-select orig-select-year" tabindex="-1">${m.join("")}</select>`;return v+=`<button class="month-prev${E?"":" is-disabled"}" type="button"><svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg></button>`,v+='<div class="selects-container">',h.showMonthAfterYear?v+=I+y:v+=y+I,v+="</div>",v+=`<button class="month-next${b?"":" is-disabled"}" type="button"><svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg></button>`,v+="</div>"}_batchDraws(t){this._drawDepth++;try{t()}finally{this._drawDepth--,this._drawDepth===0&&this._drawDirty&&(this._drawDirty=!1,this.draw())}}draw(){if(this._drawDepth>0){this._drawDirty=!0;return}let t=this.calendarEl.getRootNode().activeElement,e=t?.matches(".datepicker-day-button")&&this.calendarEl.contains(t),i=this.calendarEl.contains(t)&&t?.matches(".month-prev, .month-next")?t.classList.contains("month-prev")?".month-prev":".month-next":null,s=this.options,n=s.minYear,a=s.maxYear,h=s.minMonth,c=s.maxMonth;this._y<=n&&(this._y=n,!isNaN(h)&&this._m<h&&(this._m=h)),this._y>=a&&(this._y=a,!isNaN(c)&&this._m>c&&(this._m=c));let l=this.calendars[0].year,r=this.calendars[0].month;this.options.isDateRange?this._renderDateDisplay(this.date,this.endDate):this._renderDateDisplay(this.date);let p=this._controlsCacheKey(l);p===this._controlsKey&&this.calendarEl.querySelector(".datepicker-controls")?this._reuseControls(l,r):(this._controlsKey=p,this._randId="datepicker-title-"+u.guid(),this._rebuildControls(l,r)),this._renderCalendarTable(l,r),this._syncCalendarFocus(!!e),i&&this.calendarEl.querySelector(i)?.focus(),typeof this.options.onDraw=="function"&&this.options.onDraw.call(this)}_rebuildControls(t,e){this.destroySelects(),this.calendarEl.innerHTML=this.renderTitle(this,0,t,e,t,this._randId);let i=this.calendarEl.querySelector(".orig-select-year"),s=this.calendarEl.querySelector(".orig-select-month");k.init(i,{classes:"select-year",menuOptions:{container:u.portalRoot(this.el),constrainWidth:!1}}),k.init(s,{classes:"select-month",menuOptions:{container:u.portalRoot(this.el),constrainWidth:!1}}),i.addEventListener("change",this._handleYearChange),s.addEventListener("change",this._handleMonthChange)}_reuseControls(t,e){let i=this.calendarEl.querySelector(".orig-select-month");i&&i.value!==e.toString()&&(i.value=e.toString(),k.getInstance(i)?.refresh());let{prev:s,next:n}=this._arrowState(t,e);this.calendarEl.querySelector(".month-prev")?.classList.toggle("is-disabled",!s),this.calendarEl.querySelector(".month-next")?.classList.toggle("is-disabled",!n)}_renderCalendarTable(t,e){let i=this.render(t,e,this._randId),s=this.calendarEl.querySelector(".datepicker-table-wrapper");s?s.outerHTML=i:this.calendarEl.insertAdjacentHTML("beforeend",i)}_setupEventHandlers(){this.el.addEventListener("click",this._handleInputClick),this.el.addEventListener("keydown",this._handleInputKeydown),this.el.addEventListener("change",this._handleInputChange),this.endDateEl?.addEventListener("click",this._handleInputClick),this.endDateEl?.addEventListener("keydown",this._handleInputKeydown),this.endDateEl?.addEventListener("change",this._handleInputChange),this.calendarEl.addEventListener("click",this._handleCalendarClick),this.calendarEl.addEventListener("keydown",this._handleCalendarKeydown),this.calendarEl.addEventListener("focusin",this._handleCalendarFocus)}_setupVariables(){let t=document.createElement("template");t.innerHTML=f._template.trim(),this.containerEl=t.content.firstChild,this.calendarEl=this.containerEl.querySelector(".datepicker-calendar"),this.yearTextEl=this.containerEl.querySelector(".year-text"),this.dateTextEl=this.containerEl.querySelector(".date-text"),this.footer=this.containerEl.querySelector(".datepicker-footer"),this.formats={d:e=>e.getDate(),dd:e=>{let i=e.getDate();return(i<10?"0":"")+i},ddd:e=>this.options.i18n.weekdaysShort[e.getDay()],dddd:e=>this.options.i18n.weekdays[e.getDay()],m:e=>e.getMonth()+1,mm:e=>{let i=e.getMonth()+1;return(i<10?"0":"")+i},mmm:e=>this.options.i18n.monthsShort[e.getMonth()],mmmm:e=>this.options.i18n.months[e.getMonth()],yy:e=>(""+e.getFullYear()).slice(2),yyyy:e=>e.getFullYear()}}_removeEventHandlers(){for(let t of this.dateEls??[this.el])this._removeInputEventHandlers(t);this.calendarEl.removeEventListener("click",this._handleCalendarClick),this.calendarEl.removeEventListener("keydown",this._handleCalendarKeydown),this.calendarEl.removeEventListener("focusin",this._handleCalendarFocus),this.options.isDateRange&&this.endDateEl&&this._removeInputEventHandlers(this.endDateEl)}_removeInputEventHandlers(t){t.removeEventListener("click",this._handleInputClick),t.removeEventListener("keydown",this._handleInputKeydown),t.removeEventListener("change",this._handleInputChange)}_removeDateInput(t){let e=t.getRootNode().activeElement===t;this._removeInputEventHandlers(t),t.remove(),e&&document.activeElement===document.body&&this.el.focus()}_dayDate(t){let e=new Date(0);return e.setFullYear(Number(t.dataset.year),Number(t.dataset.month),Number(t.dataset.day)),f._setToStartOfDay(e),e}_syncCalendarFocus(t=!1){let e=[...this.calendarEl.querySelectorAll(".datepicker-day-button")],i=e.filter(a=>!a.parentElement.classList.contains("is-selection-disabled")),s=this._focusedDate||this.date||new Date,n=i.find(a=>f._compareDates(this._dayDate(a),s))||i.find(a=>a.parentElement.classList.contains("is-selected"))||i.find(a=>!a.parentElement.classList.contains("is-disabled"))||i[0];for(let a of e)a.tabIndex=a===n?0:-1,a.setAttribute("aria-disabled",String(a.parentElement.matches(".is-disabled, .is-selection-disabled")));n&&(this._focusedDate=this._dayDate(n),t&&n.focus())}gotoMonth(t){isNaN(t)||(this.calendars[0].month=parseInt(t,10),this.adjustCalendars())}gotoYear(t){isNaN(t)||(this.calendars[0].year=parseInt(t,10),this.adjustCalendars())}renderDayName(t,e,i=!1){for(e+=t.firstDay;e>=7;)e-=7;return i?t.i18n.weekdaysAbbrev[e]:t.i18n.weekdays[e]}createDateInput(){let t=this.el.cloneNode(!0);return t.removeAttribute("id"),t.classList.add("no-autoinit"),t.addEventListener("click",this._handleInputClick),t.addEventListener("keydown",this._handleInputKeydown),t.addEventListener("change",this._handleInputChange),this.el.parentElement.appendChild(t),t}};f._template=`
|
|
10
10
|
<div class="datepicker-container">
|
|
11
11
|
<div class="datepicker-date-display">
|
|
12
12
|
<span class="year-text"></span>
|
|
@@ -16,7 +16,7 @@ var Expressive=(()=>{var dt=Object.defineProperty;var Wt=Object.getOwnPropertyDe
|
|
|
16
16
|
<div class="datepicker-calendar"></div>
|
|
17
17
|
<div class="datepicker-footer"></div>
|
|
18
18
|
</div>
|
|
19
|
-
</div>`;var Z=f;var
|
|
19
|
+
</div>`;var Z=f;var pe={inDuration:275,outDuration:200,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null},O=class O extends _{constructor(t,e){super(t,e,O);this._changedAncestorList=[];this._timers=new Map;this._motion=window.matchMedia("(prefers-reduced-motion: reduce)");this._isOpen=!1;this._destroyed=!1;this._revision=0;this._handleMotionChange=()=>{if(!this._motion.matches)return;let t=[...this._timers.values()],e=this._cancel();for(let i of t){if(e!==this._revision)break;i()}if(this.overlayActive)for(let i of[this.el,this._overlay,this._photoCaption])i&&(i.style.transition="none")};this._handleLightboxClick=()=>{this._handleLightboxToggle()};this._handleLightboxKeypress=t=>{this._trigger===this.el&&(t.key===u.keys.ENTER||t.key===" ")&&(t.preventDefault(),this._handleLightboxToggle())};this._handleLightboxToggle=()=>{this._isOpen?this.close():this.open()};this._handleWindowScroll=()=>{this.overlayActive&&this.close()};this._handleWindowResize=()=>{this.overlayActive&&this.close()};this._handleWindowEscape=t=>{t.key===u.keys.ESC&&this.close()};this.open=()=>{if(this._destroyed||this._isOpen)return;let t=this._cancel();this.overlayActive&&this._reset(),this._isOpen=!0,this._updateVars();let e=this.el.getBoundingClientRect(),i=this.placeholder.getBoundingClientRect();if(this.originalWidth=e.width,this.originalHeight=e.height,this.doneAnimating=!1,this.el.classList.add("active"),this.overlayActive=!0,typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),t!==this._revision)return;this.placeholder.style.width=i.width+"px",this.placeholder.style.height=i.height+"px",this.placeholder.style.position="relative",this.placeholder.style.top="0",this.placeholder.style.left="0",this._makeAncestorsOverflowVisible(),this.el.style.position="absolute",this.el.style.zIndex="1000",this.el.style.willChange="left, top, width, height",this.attrWidth=this.el.getAttribute("width"),this.attrHeight=this.el.getAttribute("height"),this.attrWidth&&(this.el.style.width=this.attrWidth+"px",this.el.removeAttribute("width")),this.attrHeight&&(this.el.style.height=this.attrHeight+"px",this.el.removeAttribute("height")),this._addOverlay(),this.caption!==""&&this._addCaption();let s=this.originalWidth/this.windowWidth,n=this.originalHeight/this.windowHeight;if(this.newWidth=0,this.newHeight=0,s>n){let a=this.originalHeight/this.originalWidth;this.newWidth=this.windowWidth*.9,this.newHeight=this.windowWidth*.9*a}else{let a=this.originalWidth/this.originalHeight;this.newWidth=this.windowHeight*.9*a,this.newHeight=this.windowHeight*.9}window.addEventListener("scroll",this._handleWindowScroll,{passive:!0}),window.addEventListener("resize",this._handleWindowResize,{passive:!0}),window.addEventListener("keyup",this._handleWindowEscape),this._animateImageIn()};this.close=()=>{if(this._destroyed||!this._isOpen)return;let t=this._cancel();this._isOpen=!1,this.doneAnimating=!1,typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),t===this._revision&&(window.removeEventListener("scroll",this._handleWindowScroll),window.removeEventListener("resize",this._handleWindowResize),window.removeEventListener("keyup",this._handleWindowEscape),this._overlay&&this._removeOverlay(),this._photoCaption&&this._removeCaption(),this._animateImageOut())};this.el.Expressive_Lightbox=this,this.options={...O.defaults,...e},this.overlayActive=!1,this.doneAnimating=!0,this.placeholder=document.createElement("div"),this.placeholder.classList.add("material-placeholder"),this.originalWidth=0,this.originalHeight=0,this.originInlineStyles=this.el.getAttribute("style"),this.caption=this.el.getAttribute("data-caption")||"",this._tabindex=this.el.getAttribute("tabindex"),this._trigger=this.el.closest("button")??this.el,this.el.tabIndex=this._trigger===this.el?0:-1,this.el.before(this.placeholder),this.placeholder.append(this.el),this._setupEventHandlers()}static get defaults(){return pe}static init(t,e={}){return super.init(t,e,O)}static getInstance(t){return t.Expressive_Lightbox}destroy(){if(this._destroyed)return;this._destroyed=!0;let t=this.el.getRootNode(),e=t.activeElement===this.el;this._removeEventHandlers(),this._cancel(),this._reset(),this.placeholder.replaceWith(this.el);let i=document.activeElement;for(;i?.shadowRoot?.activeElement;)i=i.shadowRoot.activeElement;e&&(i===document.body||i===t.host)&&this._trigger.focus(),this._tabindex===null?this.el.removeAttribute("tabindex"):this.el.setAttribute("tabindex",this._tabindex),this.el.Expressive_Lightbox=void 0}_reset(){window.removeEventListener("scroll",this._handleWindowScroll),window.removeEventListener("resize",this._handleWindowResize),window.removeEventListener("keyup",this._handleWindowEscape),this._overlay?.remove(),this._photoCaption?.remove();for(let t of this._changedAncestorList){let e=O._overflow.get(t);--e.count===0&&(t.style.setProperty("overflow",e.value,e.priority),O._overflow.delete(t))}this._changedAncestorList=[],this.attrWidth!==null&&this.attrWidth!==void 0&&this.el.setAttribute("width",this.attrWidth),this.attrHeight!==null&&this.attrHeight!==void 0&&this.el.setAttribute("height",this.attrHeight),this.el.classList.remove("active"),this.placeholder.removeAttribute("style"),this.originInlineStyles===null?this.el.removeAttribute("style"):this.el.setAttribute("style",this.originInlineStyles),this.overlayActive=!1,this._isOpen=!1,this.doneAnimating=!0}_cancel(){for(let t of this._timers.keys())clearTimeout(t);return this._timers.clear(),++this._revision}_schedule(t,e){if(this._motion.matches){t();return}let i=setTimeout(()=>{this._timers.delete(i),t()},e);this._timers.set(i,t)}_setupEventHandlers(){this._motion.addEventListener("change",this._handleMotionChange),this._trigger.addEventListener("click",this._handleLightboxClick),this.el.addEventListener("keydown",this._handleLightboxKeypress)}_removeEventHandlers(){this._motion.removeEventListener("change",this._handleMotionChange),this._trigger.removeEventListener("click",this._handleLightboxClick),this.el.removeEventListener("keydown",this._handleLightboxKeypress)}_makeAncestorsOverflowVisible(){this._changedAncestorList=[];let t=this.placeholder.parentNode;for(;t!=null&&t!==document;){let e=t;if(e.style&&(e.style.overflow!=="visible"||O._overflow.has(e))){let i=O._overflow.get(e)??{count:0,value:e.style.overflow,priority:e.style.getPropertyPriority("overflow")};i.count++,O._overflow.set(e,i),this._changedAncestorList.push(e),e.style.overflow="visible"}t=t.parentNode??t.host}}_offset(t){let e=t.getBoundingClientRect(),i=document.documentElement;return{top:e.top+window.scrollY-i.clientTop,left:e.left+window.scrollX-i.clientLeft}}_updateVars(){this.windowWidth=window.innerWidth,this.windowHeight=window.innerHeight,this.caption=this.el.getAttribute("data-caption")||""}_animateImageIn(){this.el.style.maxHeight=this.newHeight.toString()+"px",this.el.style.maxWidth=this.newWidth.toString()+"px";let t=this._motion.matches?0:this.options.inDuration;this.el.style.transition="none",this.el.style.height=this.originalHeight+"px",this.el.style.width=this.originalWidth+"px",this._schedule(()=>{let e=this._offset(this.placeholder);this.el.style.transition=`height ${t}ms ease,
|
|
20
20
|
width ${t}ms ease,
|
|
21
21
|
left ${t}ms ease,
|
|
22
22
|
top ${t}ms ease
|
|
@@ -24,9 +24,9 @@ var Expressive=(()=>{var dt=Object.defineProperty;var Wt=Object.getOwnPropertyDe
|
|
|
24
24
|
width ${t}ms ease,
|
|
25
25
|
left ${t}ms ease,
|
|
26
26
|
top ${t}ms ease
|
|
27
|
-
`,this.el.style.height=this.originalHeight+"px",this.el.style.width=this.originalWidth+"px",this.el.style.left="0",this.el.style.top="0",this._schedule(()=>{this._reset(),typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,this.el)},t)}_addCaption(){this._photoCaption=document.createElement("div"),this._photoCaption.classList.add("lightbox-caption"),this._photoCaption.innerText=this.caption,u.portalRoot(this.el).append(this._photoCaption),this._photoCaption.style.display="inline",this._photoCaption.style.transition="none",this._photoCaption.style.opacity="0";let t=this._motion.matches?0:this.options.inDuration;this._schedule(()=>{this._photoCaption.style.transition=`opacity ${t}ms ease`,this._photoCaption.style.opacity="1"},1)}_removeCaption(){let t=this._motion.matches?0:this.options.outDuration;this._photoCaption.style.transition=`opacity ${t}ms ease`,this._photoCaption.style.opacity="0"}_addOverlay(){this._overlay=document.createElement("div"),this._overlay.id="lightbox-overlay",this._overlay.addEventListener("click",i=>{i.stopPropagation(),this.close()},{once:!0}),this.el.before(this._overlay);let t=this._overlay.getBoundingClientRect();this._overlay.style.width=this.windowWidth+"px",this._overlay.style.height=this.windowHeight+"px",this._overlay.style.left=-1*t.left+"px",this._overlay.style.top=-1*t.top+"px",this._overlay.style.transition="none",this._overlay.style.opacity="0";let e=this._motion.matches?0:this.options.inDuration;this._schedule(()=>{this._overlay.style.transition=`opacity ${e}ms ease`,this._overlay.style.opacity="1"},1)}_removeOverlay(){let t=this._motion.matches?0:this.options.outDuration;this._overlay.style.transition=`opacity ${t}ms ease`,this._overlay.style.opacity="0"}};A._overflow=new WeakMap;var Q=A;var xt=d=>`a[href="#${d}"]`,ue={scrollOffset:200,activeClass:"active",getActiveElement:xt,keepTopElementActive:!1},y=class y extends _{constructor(t,e){super(t,e,y);this._ratio=0;this._link=null;this.el.Expressive_ScrollSpy=this,this.options={...y.defaults,...e},this._offset=this.el.style.getPropertyValue("--md-comp-scrollspy-offset"),this._offsetPriority=this.el.style.getPropertyPriority("--md-comp-scrollspy-offset"),this.el.style.setProperty("--md-comp-scrollspy-offset",`${this.options.scrollOffset}px`),y._elements.push(this),typeof IntersectionObserver<"u"&&(this._observer=new IntersectionObserver(i=>{if(y.getInstance(this.el)===this){for(let s of i)this._ratio=s.isIntersecting?s.intersectionRatio:0;y._syncActive(this.options.getActiveElement)}},{rootMargin:`-${this.options.scrollOffset}px 0px -45% 0px`,threshold:[0,.1,.25,.5,.75,1]}),this._observer.observe(this.el))}static get defaults(){return ue}static init(t,e={}){return super.init(t,e,y)}static getInstance(t){return t.Expressive_ScrollSpy}destroy(){let t=y._elements.indexOf(this);if(t<0)return;y._elements.splice(t,1),this._observer?.disconnect();let e=this.options.getActiveElement;y._active.get(e)===this&&y._clearActive(e),this.el.style.setProperty("--md-comp-scrollspy-offset",this._offset,this._offsetPriority),this.el.Expressive_ScrollSpy=void 0,y._syncActive(e)}static _syncActive(t){let e=y._elements.filter(c=>c.options.getActiveElement===t),i=null,s=0;for(let c of e){let h=c._ratio;h>s&&(s=h,i=c)}if(!i){let c=e.filter(h=>h.options.keepTopElementActive);i=y._nearestAbove(c)??c[0]}let n=i?y._linkFor(i.el.id,i.options):null,a=y._active.get(t);a===i&&a?._link===n||(y._clearActive(t),n&&(n.classList.add(i.options.activeClass),n.setAttribute("aria-current","true"),i._link=n,y._active.set(t,i)))}static _nearestAbove(t){let e=null,i=-1/0;for(let s of t){let n=s.el.getBoundingClientRect().top;n<=0&&n>=i&&(i=n,e=s)}return e}static _clearActive(t){let e=y._active.get(t);e&&(e._link?.classList.remove(e.options.activeClass),e._link?.removeAttribute("aria-current"),e._link=null,y._active.delete(t))}static _linkFor(t,e){if(!t)return null;if(e.getActiveElement!==xt)try{return document.querySelector(e.getActiveElement(t))}catch{return null}let i=`#${t}`,s=document.querySelectorAll('a[href^="#"]');for(let n=0;n<s.length;n++)if(s[n].getAttribute("href")===i)return s[n];return null}};y._elements=[],y._active=new Map;var J=y;var pe={onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null},me="(width < 600px)",tt=class d extends _{constructor(t,e){super(t,e,d);this.expand=()=>{this.isExpanded||(typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),this.isExpanded=!0,this.el.classList.add("expanded"),this._sync(),typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,this.el))};this.collapse=()=>{this.isExpanded&&(typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),this.isExpanded=!1,this.el.classList.remove("expanded"),this._sync(),typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,this.el))};this.toggle=()=>{this.isExpanded?this.collapse():this.expand()};this._onClick=t=>{let e=t.target;if(e instanceof Node){if(this._toggle&&(e===this._toggle||this._toggle.contains(e))){this.toggle(),t.preventDefault();return}e===this.el&&this.isExpanded&&this._isModal()&&this.collapse()}};this._onKeyDown=t=>{t.key==="Escape"&&this.isExpanded&&this._isModal()&&this.collapse()};this.el.Expressive_NavigationRail=this,this.options={...d.defaults,...e},this._toggle=this._findToggle(),this._mql=window.matchMedia(me),this.isExpanded=this.el.classList.contains("expanded"),this._sync(),this.el.addEventListener("click",this._onClick),document.addEventListener("keydown",this._onKeyDown)}static get defaults(){return pe}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_NavigationRail}destroy(){this.el.removeEventListener("click",this._onClick),document.removeEventListener("keydown",this._onKeyDown),this.el.Expressive_NavigationRail=void 0}_findToggle(){let t=this.el.querySelector(":scope > button:not(.button)");return t instanceof HTMLButtonElement?t:null}_isCompact(){return this._mql.matches}_isModal(){return this.el.classList.contains("modal")||this._isCompact()}_sync(){this.el.setAttribute("aria-expanded",this.isExpanded?"true":"false"),this._toggle?.setAttribute("aria-expanded",this.isExpanded?"true":"false")}};var fe={duration:300,onShow:null,swipeable:!1,responsiveThreshold:1/0},et=class d extends _{constructor(t,e){var i;super(t,e,d);this._originalPanels=new Map;this._originalLinks=new Map;this._handleWindowResize=()=>{this._setTabsAndTabWidth(),this._tabWidth!==0&&this._tabsWidth!==0&&(this._indicator.style.left=this._calcLeftPos(this._activeTabLink)+"px",this._indicator.style.right=this._calcRightPos(this._activeTabLink)+"px")};this._handleTabClick=t=>{let e=t.target;if(!e)return;let i=e.closest("a");if(!i||!Array.from(this._tabLinks).includes(i))return;let s=i.parentElement;if(i.classList.contains("disabled")||i.getAttribute("aria-disabled")==="true"||s?.classList.contains("disabled")){t.preventDefault();return}if(i.hasAttribute("target"))return;if(this.options.swipeable){let h=i.hash&&document.getElementById(i.hash.slice(1)),l=this._tabsCarousel.images.indexOf(h);l>=0&&this._tabsCarousel.set(l),t.preventDefault();return}let a=this._content;this._tabLinks=this._queryTabLinks();let c=this._index;this._setActiveTabLink(i),this._content&&(this._content.style.display="block",this._content.classList.add("active"),typeof this.options.onShow=="function"&&this.options.onShow.call(this,this._content),a&&a!==this._content&&(a.style.display="none",a.classList.remove("active"))),this._setTabsAndTabWidth(),this._animateIndicator(c),t.preventDefault()};this.el.Expressive_Tabs=this,this.options={...d.defaults,...e},this._tabLinks=this._queryTabLinks(),this._tabLinks.forEach(s=>{if(this._originalLinks.set(s,{active:s.classList.contains("active"),current:s.getAttribute("aria-current")}),s.hasAttribute("target"))return;let n=s.hash&&document.getElementById(s.hash.slice(1));n&&this._originalPanels.set(n,{display:n.style.display,priority:n.style.getPropertyPriority("display"),active:n.classList.contains("active"),carousel:n.classList.contains("carousel-item")})}),(i=this.options).swipeable&&(i.swipeable=window.innerWidth<=this.options.responsiveThreshold),this._index=0,this._setupActiveTabLink(),this.options.swipeable?this._setupSwipeableTabs():this._setupNormalTabs(),this._setTabsAndTabWidth(),this._createIndicator(),this._setupEventHandlers()}static get defaults(){return fe}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_Tabs}destroy(){this._removeEventHandlers(),this._indicator.remove(),this.options.swipeable&&this._teardownSwipeableTabs(),this._originalPanels.forEach((t,e)=>{e.style.setProperty("display",t.display,t.priority),e.classList.toggle("active",t.active),e.classList.toggle("carousel-item",t.carousel),e.className||e.removeAttribute("class")}),this._originalLinks.forEach((t,e)=>{e.classList.toggle("active",t.active),t.current===null?e.removeAttribute("aria-current"):e.setAttribute("aria-current",t.current)}),this.el.Expressive_Tabs=void 0}get index(){return this._index}_setupEventHandlers(){window.addEventListener("resize",this._handleWindowResize),this.el.addEventListener("click",this._handleTabClick)}_removeEventHandlers(){window.removeEventListener("resize",this._handleWindowResize),this.el.removeEventListener("click",this._handleTabClick)}_queryTabLinks(){return this.el.querySelectorAll(":scope > a, :scope > .tab > a")}_createIndicator(){let t=this.el.tagName==="UL"||this.el.tagName==="OL"?"li":"span",e=document.createElement(t);e.classList.add("indicator"),this.el.appendChild(e),this._indicator=e,this._indicator.style.left=this._calcLeftPos(this._activeTabLink)+"px",this._indicator.style.right=this._calcRightPos(this._activeTabLink)+"px"}_setActiveTabLink(t){Array.from(this._tabLinks).forEach(e=>{e.classList.remove("active"),e.removeAttribute("aria-current")}),this._activeTabLink=t,t.classList.add("active"),t.setAttribute("aria-current","page"),this._index=Array.from(this._tabLinks).indexOf(t),this._content=t.hasAttribute("target")?null:document.getElementById(t.hash.slice(1))}_setupActiveTabLink(){if(this._activeTabLink=Array.from(this._tabLinks).find(t=>t.getAttribute("href")===location.hash),!this._activeTabLink){let t=this.el.querySelector("a.active");t||(t=this._tabLinks[0]),this._activeTabLink=t}this._setActiveTabLink(this._activeTabLink),this._originalPanels.forEach((t,e)=>e.classList.toggle("active",e===this._content))}_setupSwipeableTabs(){let t=[];this._tabLinks.forEach(i=>{if(i.hash&&!i.hasAttribute("target")){let s=document.getElementById(i.hash.slice(1));if(!s)return;s.classList.add("carousel-item"),t.push(s)}});let e=document.createElement("div");e.classList.add("tabs-content","carousel","flat"),t[0].parentElement.insertBefore(e,t[0]),t.forEach(i=>{let s=document.createComment("");i.before(s),this._originalPanels.get(i).marker=s,e.appendChild(i),i.style.display=""}),this._tabsCarousel=W.init(e,{fullWidth:!0,noWrap:!0,duration:this.options.duration,onCycleTo:i=>{let s=this._index;this._setActiveTabLink(Array.from(this._tabLinks).find(n=>!n.hasAttribute("target")&&n.hash==="#"+i.id)),this._setTabsAndTabWidth(),this._animateIndicator(s),typeof this.options.onShow=="function"&&this.options.onShow.call(this,this._content)}})}_teardownSwipeableTabs(){let t=this._tabsCarousel.el;this._tabsCarousel.destroy(),this._originalPanels.forEach((e,i)=>e.marker?.replaceWith(i)),t.remove()}_setupNormalTabs(){Array.from(this._tabLinks).forEach(t=>{if(!(t===this._activeTabLink||t.hasAttribute("target"))&&t.hash){let e=document.getElementById(t.hash.slice(1));e&&(e.style.display="none")}})}_setTabsAndTabWidth(){this._tabsWidth=this.el.getBoundingClientRect().width,this._tabWidth=Math.max(this._tabsWidth,this.el.scrollWidth)/this._tabLinks.length}_calcRightPos(t){return Math.ceil(this._tabsWidth-t.offsetLeft-t.getBoundingClientRect().width)}_calcLeftPos(t){return Math.floor(t.offsetLeft)}updateTabIndicator(){this._setTabsAndTabWidth(),this._animateIndicator(this._index)}_animateIndicator(t){let e=0,i=0;this._index-t>=0?e=90:i=90,this._indicator.style.transition=`
|
|
27
|
+
`,this.el.style.height=this.originalHeight+"px",this.el.style.width=this.originalWidth+"px",this.el.style.left="0",this.el.style.top="0",this._schedule(()=>{this._reset(),typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,this.el)},t)}_addCaption(){this._photoCaption=document.createElement("div"),this._photoCaption.classList.add("lightbox-caption"),this._photoCaption.innerText=this.caption,u.portalRoot(this.el).append(this._photoCaption),this._photoCaption.style.display="inline",this._photoCaption.style.transition="none",this._photoCaption.style.opacity="0";let t=this._motion.matches?0:this.options.inDuration;this._schedule(()=>{this._photoCaption.style.transition=`opacity ${t}ms ease`,this._photoCaption.style.opacity="1"},1)}_removeCaption(){let t=this._motion.matches?0:this.options.outDuration;this._photoCaption.style.transition=`opacity ${t}ms ease`,this._photoCaption.style.opacity="0"}_addOverlay(){this._overlay=document.createElement("div"),this._overlay.id="lightbox-overlay",this._overlay.addEventListener("click",i=>{i.stopPropagation(),this.close()},{once:!0}),this.el.before(this._overlay);let t=this._overlay.getBoundingClientRect();this._overlay.style.width=this.windowWidth+"px",this._overlay.style.height=this.windowHeight+"px",this._overlay.style.left=-1*t.left+"px",this._overlay.style.top=-1*t.top+"px",this._overlay.style.transition="none",this._overlay.style.opacity="0";let e=this._motion.matches?0:this.options.inDuration;this._schedule(()=>{this._overlay.style.transition=`opacity ${e}ms ease`,this._overlay.style.opacity="1"},1)}_removeOverlay(){let t=this._motion.matches?0:this.options.outDuration;this._overlay.style.transition=`opacity ${t}ms ease`,this._overlay.style.opacity="0"}};O._overflow=new WeakMap;var Q=O;var xt=d=>`a[href="#${d}"]`,me={scrollOffset:200,activeClass:"active",getActiveElement:xt,keepTopElementActive:!1},L=class L extends _{constructor(t,e){super(t,e,L);this._ratio=0;this._link=null;this.el.Expressive_ScrollSpy=this,this.options={...L.defaults,...e},this._offset=this.el.style.getPropertyValue("--md-comp-scrollspy-offset"),this._offsetPriority=this.el.style.getPropertyPriority("--md-comp-scrollspy-offset"),this.el.style.setProperty("--md-comp-scrollspy-offset",`${this.options.scrollOffset}px`),L._elements.push(this),typeof IntersectionObserver<"u"&&(this._observer=new IntersectionObserver(i=>{if(L.getInstance(this.el)===this){for(let s of i)this._ratio=s.isIntersecting?s.intersectionRatio:0;L._syncActive(this.options.getActiveElement)}},{rootMargin:`-${this.options.scrollOffset}px 0px -45% 0px`,threshold:[0,.1,.25,.5,.75,1]}),this._observer.observe(this.el))}static get defaults(){return me}static init(t,e={}){return super.init(t,e,L)}static getInstance(t){return t.Expressive_ScrollSpy}destroy(){let t=L._elements.indexOf(this);if(t<0)return;L._elements.splice(t,1),this._observer?.disconnect();let e=this.options.getActiveElement;L._active.get(e)===this&&L._clearActive(e),this.el.style.setProperty("--md-comp-scrollspy-offset",this._offset,this._offsetPriority),this.el.Expressive_ScrollSpy=void 0,L._syncActive(e)}static _syncActive(t){let e=L._elements.filter(h=>h.options.getActiveElement===t),i=null,s=0;for(let h of e){let c=h._ratio;c>s&&(s=c,i=h)}if(!i){let h=e.filter(c=>c.options.keepTopElementActive);i=L._nearestAbove(h)??h[0]}let n=i?L._linkFor(i.el.id,i.options):null,a=L._active.get(t);a===i&&a?._link===n||(L._clearActive(t),n&&(n.classList.add(i.options.activeClass),n.setAttribute("aria-current","true"),i._link=n,L._active.set(t,i)))}static _nearestAbove(t){let e=null,i=-1/0;for(let s of t){let n=s.el.getBoundingClientRect().top;n<=0&&n>=i&&(i=n,e=s)}return e}static _clearActive(t){let e=L._active.get(t);e&&(e._link?.classList.remove(e.options.activeClass),e._link?.removeAttribute("aria-current"),e._link=null,L._active.delete(t))}static _linkFor(t,e){if(!t)return null;if(e.getActiveElement!==xt)try{return document.querySelector(e.getActiveElement(t))}catch{return null}let i=`#${t}`,s=document.querySelectorAll('a[href^="#"]');for(let n=0;n<s.length;n++)if(s[n].getAttribute("href")===i)return s[n];return null}};L._elements=[],L._active=new Map;var J=L;var fe={onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null},ve="(width < 600px)",tt=class d extends _{constructor(t,e){super(t,e,d);this.expand=()=>{this.isExpanded||(typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),this.isExpanded=!0,this.el.classList.add("expanded"),this._sync(),typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,this.el))};this.collapse=()=>{this.isExpanded&&(typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),this.isExpanded=!1,this.el.classList.remove("expanded"),this._sync(),typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,this.el))};this.toggle=()=>{this.isExpanded?this.collapse():this.expand()};this._onClick=t=>{let e=t.target;if(e instanceof Node){if(this._toggle&&(e===this._toggle||this._toggle.contains(e))){this.toggle(),t.preventDefault();return}e===this.el&&this.isExpanded&&this._isModal()&&this.collapse()}};this._onKeyDown=t=>{if(!(t.key!=="Escape"||t.defaultPrevented)&&this.isExpanded&&this._isModal()){let e=this.el.getRootNode(),i=this.el.contains(e.activeElement),s=e.activeElement;for(;s?.shadowRoot?.activeElement;)s=s.shadowRoot.activeElement;this.collapse();let n=e.activeElement;for(;n?.shadowRoot?.activeElement;)n=n.shadowRoot.activeElement;!this.isExpanded&&i&&n===s&&this._toggle?.focus()}};this.el.Expressive_NavigationRail=this,this.options={...d.defaults,...e},this._toggle=this._findToggle(),this._mql=window.matchMedia(ve),this.isExpanded=this.el.classList.contains("expanded"),this._sync(),this.el.addEventListener("click",this._onClick),document.addEventListener("keydown",this._onKeyDown)}static get defaults(){return fe}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_NavigationRail}destroy(){this.el.removeEventListener("click",this._onClick),document.removeEventListener("keydown",this._onKeyDown),this.el.Expressive_NavigationRail=void 0}_findToggle(){let t=this.el.querySelector(":scope > button:not(.button)");return t instanceof HTMLButtonElement?t:null}_isCompact(){return this._mql.matches}_isModal(){return this.el.classList.contains("modal")||this._isCompact()}_sync(){this.el.setAttribute("aria-expanded",this.isExpanded?"true":"false"),this._toggle?.setAttribute("aria-expanded",this.isExpanded?"true":"false")}};var ge={duration:300,onShow:null,swipeable:!1,responsiveThreshold:1/0},et=class d extends _{constructor(t,e){var i;super(t,e,d);this._originalPanels=new Map;this._originalLinks=new Map;this._handleWindowResize=()=>{this._setTabsAndTabWidth(),this._tabWidth!==0&&this._tabsWidth!==0&&(this._indicator.style.left=this._calcLeftPos(this._activeTabLink)+"px",this._indicator.style.right=this._calcRightPos(this._activeTabLink)+"px")};this._handleTabClick=t=>{let e=t.target;if(!e)return;let i=e.closest("a");if(!i||!Array.from(this._tabLinks).includes(i))return;let s=i.parentElement;if(i.classList.contains("disabled")||i.getAttribute("aria-disabled")==="true"||s?.classList.contains("disabled")){t.preventDefault();return}if(i.hasAttribute("target"))return;if(this.options.swipeable){let c=i.hash&&document.getElementById(i.hash.slice(1)),l=this._tabsCarousel.images.indexOf(c);l>=0&&this._tabsCarousel.set(l),t.preventDefault();return}let a=this._content;this._tabLinks=this._queryTabLinks();let h=this._index;this._setActiveTabLink(i),this._content&&(this._content.style.display="block",this._content.classList.add("active"),typeof this.options.onShow=="function"&&this.options.onShow.call(this,this._content),a&&a!==this._content&&(a.style.display="none",a.classList.remove("active"))),this._setTabsAndTabWidth(),this._animateIndicator(h),t.preventDefault()};this.el.Expressive_Tabs=this,this.options={...d.defaults,...e},this._tabLinks=this._queryTabLinks(),this._tabLinks.forEach(s=>{if(this._originalLinks.set(s,{active:s.classList.contains("active"),current:s.getAttribute("aria-current")}),s.hasAttribute("target"))return;let n=s.hash&&document.getElementById(s.hash.slice(1));n&&this._originalPanels.set(n,{display:n.style.display,priority:n.style.getPropertyPriority("display"),active:n.classList.contains("active"),carousel:n.classList.contains("carousel-item")})}),(i=this.options).swipeable&&(i.swipeable=window.innerWidth<=this.options.responsiveThreshold),this._index=0,this._setupActiveTabLink(),this.options.swipeable?this._setupSwipeableTabs():this._setupNormalTabs(),this._setTabsAndTabWidth(),this._createIndicator(),this._setupEventHandlers()}static get defaults(){return ge}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_Tabs}destroy(){this._removeEventHandlers(),this._indicator.remove(),this.options.swipeable&&this._teardownSwipeableTabs(),this._originalPanels.forEach((t,e)=>{e.style.setProperty("display",t.display,t.priority),e.classList.toggle("active",t.active),e.classList.toggle("carousel-item",t.carousel),e.className||e.removeAttribute("class")}),this._originalLinks.forEach((t,e)=>{e.classList.toggle("active",t.active),t.current===null?e.removeAttribute("aria-current"):e.setAttribute("aria-current",t.current)}),this.el.Expressive_Tabs=void 0}get index(){return this._index}_setupEventHandlers(){window.addEventListener("resize",this._handleWindowResize),this.el.addEventListener("click",this._handleTabClick)}_removeEventHandlers(){window.removeEventListener("resize",this._handleWindowResize),this.el.removeEventListener("click",this._handleTabClick)}_queryTabLinks(){return this.el.querySelectorAll(":scope > a, :scope > .tab > a")}_createIndicator(){let t=this.el.tagName==="UL"||this.el.tagName==="OL"?"li":"span",e=document.createElement(t);e.classList.add("indicator"),this.el.appendChild(e),this._indicator=e,this._indicator.style.left=this._calcLeftPos(this._activeTabLink)+"px",this._indicator.style.right=this._calcRightPos(this._activeTabLink)+"px"}_setActiveTabLink(t){Array.from(this._tabLinks).forEach(e=>{e.classList.remove("active"),e.removeAttribute("aria-current")}),this._activeTabLink=t,t.classList.add("active"),t.setAttribute("aria-current","page"),this._index=Array.from(this._tabLinks).indexOf(t),this._content=t.hasAttribute("target")?null:document.getElementById(t.hash.slice(1))}_setupActiveTabLink(){if(this._activeTabLink=Array.from(this._tabLinks).find(t=>t.getAttribute("href")===location.hash),!this._activeTabLink){let t=this.el.querySelector("a.active");t||(t=this._tabLinks[0]),this._activeTabLink=t}this._setActiveTabLink(this._activeTabLink),this._originalPanels.forEach((t,e)=>e.classList.toggle("active",e===this._content))}_setupSwipeableTabs(){let t=[];this._tabLinks.forEach(i=>{if(i.hash&&!i.hasAttribute("target")){let s=document.getElementById(i.hash.slice(1));if(!s)return;s.classList.add("carousel-item"),t.push(s)}});let e=document.createElement("div");e.classList.add("tabs-content","carousel","flat"),t[0].parentElement.insertBefore(e,t[0]),t.forEach(i=>{let s=document.createComment("");i.before(s),this._originalPanels.get(i).marker=s,e.appendChild(i),i.style.display=""}),this._tabsCarousel=F.init(e,{fullWidth:!0,noWrap:!0,duration:this.options.duration,onCycleTo:i=>{let s=this._index;this._setActiveTabLink(Array.from(this._tabLinks).find(n=>!n.hasAttribute("target")&&n.hash==="#"+i.id)),this._setTabsAndTabWidth(),this._animateIndicator(s),typeof this.options.onShow=="function"&&this.options.onShow.call(this,this._content)}})}_teardownSwipeableTabs(){let t=this._tabsCarousel.el;this._tabsCarousel.destroy(),this._originalPanels.forEach((e,i)=>e.marker?.replaceWith(i)),t.remove()}_setupNormalTabs(){Array.from(this._tabLinks).forEach(t=>{if(!(t===this._activeTabLink||t.hasAttribute("target"))&&t.hash){let e=document.getElementById(t.hash.slice(1));e&&(e.style.display="none")}})}_setTabsAndTabWidth(){this._tabsWidth=this.el.getBoundingClientRect().width,this._tabWidth=Math.max(this._tabsWidth,this.el.scrollWidth)/this._tabLinks.length}_calcRightPos(t){return Math.ceil(this._tabsWidth-t.offsetLeft-t.getBoundingClientRect().width)}_calcLeftPos(t){return Math.floor(t.offsetLeft)}updateTabIndicator(){this._setTabsAndTabWidth(),this._animateIndicator(this._index)}_animateIndicator(t){let e=0,i=0;this._index-t>=0?e=90:i=90,this._indicator.style.transition=`
|
|
28
28
|
left ${this.options.duration}ms ease-out ${e}ms,
|
|
29
|
-
right ${this.options.duration}ms ease-out ${i}ms`,this._indicator.style.left=this._calcLeftPos(this._activeTabLink)+"px",this._indicator.style.right=this._calcRightPos(this._activeTabLink)+"px"}select(t){let e=Array.from(this._tabLinks).find(i=>i.getAttribute("href")==="#"+t);e&&e.click()}};var ve={dialRadius:135,outerRadius:105,innerRadius:70,tickRadius:20,duration:350,container:null,defaultTime:"now",fromNow:0,showClearBtn:!1,autoSubmit:!0,i18n:{cancel:"Cancel",clear:"Clear",done:"Ok",hours:"Hours",minutes:"Minutes"},twelveHour:!0,vibrate:!0,onSelect:null,onInputInteraction:null,onDone:null,onCancel:null,displayPlugin:null,displayPluginOptions:null},L=class L extends _{constructor(t,e){super(t,e,L);this._dragPointerId=null;this._clockBuilt=!1;this._handleInputClick=()=>{this._ensureClockBuilt(),this.displayPlugin&&this.displayPlugin.show(),this.inputHours.focus(),typeof this.options.onInputInteraction=="function"&&this.options.onInputInteraction.call(this)};this._handleInputKeydown=t=>{t.key===u.keys.ENTER&&(t.preventDefault(),this._ensureClockBuilt(),this.displayPlugin&&this.displayPlugin.show(),this.inputHours.focus(),typeof this.options.onInputInteraction=="function"&&this.options.onInputInteraction.call(this))};this._handleClockClickStart=t=>{if(!t.isPrimary||t.pointerType==="mouse"&&t.button!==0)return;t.preventDefault(),this._ensureClockBuilt();let e=this.plate.getBoundingClientRect(),i={x:e.left,y:e.top};this.x0=i.x+this.options.dialRadius,this.y0=i.y+this.options.dialRadius,this.moved=!1,this._dragPointerId=t.pointerId,this.dx=t.clientX-this.x0,this.dy=t.clientY-this.y0,this.setHand(this.dx,this.dy,!1),document.addEventListener("pointermove",this._handleDocumentClickMove),document.addEventListener("pointerup",this._handleDocumentClickEnd),document.addEventListener("pointercancel",this._handleDocumentClickCancel)};this._handleDocumentClickMove=t=>{if(t.pointerId!==this._dragPointerId)return;t.preventDefault();let e=t.clientX-this.x0,i=t.clientY-this.y0;this.moved=!0,this.setHand(e,i,!1)};this._handleDocumentClickEnd=t=>{if(t.pointerId!==this._dragPointerId)return;this._dragPointerId=null,t.preventDefault(),document.removeEventListener("pointerup",this._handleDocumentClickEnd),document.removeEventListener("pointercancel",this._handleDocumentClickCancel);let e=t.clientX-this.x0,i=t.clientY-this.y0;this.moved&&e===this.dx&&i===this.dy&&this.setHand(e,i),this.currentView==="hours"?(this.inputMinutes.focus(),this.showView("minutes",this.options.duration/2)):setTimeout(()=>{this.options.autoSubmit&&this.done()},this.options.duration/2),typeof this.options.onSelect=="function"&&this.options.onSelect.call(this,this.hours,this.minutes),document.removeEventListener("pointermove",this._handleDocumentClickMove)};this._handleDocumentClickCancel=t=>{t.pointerId===this._dragPointerId&&(this._dragPointerId=null,this.moved=!1,document.removeEventListener("pointermove",this._handleDocumentClickMove),document.removeEventListener("pointerup",this._handleDocumentClickEnd),document.removeEventListener("pointercancel",this._handleDocumentClickCancel))};this._handleAmPmClick=t=>{this._handleAmPmInteraction(t.target)};this._handleAmPmInteraction=t=>{this.amOrPm=t.classList.contains("am-btn")?"AM":"PM",this._updateAmPmView()};this.showView=(t,e=null)=>{this._ensureClockBuilt();let i=t==="hours",s=i?this.hoursView:this.minutesView,n=i?this.minutesView:this.hoursView;this.currentView=t,n.classList.add("timepicker-dial-out"),s.style.visibility="visible",s.classList.remove("timepicker-dial-out"),this.resetClock(e),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(()=>{n.style.visibility="hidden"},this.options.duration)};this._inputFromTextField=t=>{let e=t.target,i=e===this.inputHours;if(!i&&e!==this.inputMinutes)return;let s=Number(e.value),n=i&&this.options.twelveHour?1:0,a=i?this.options.twelveHour?12:23:59;!e.value.trim()||!Number.isInteger(s)||s<n||s>a||(this[i?"hours":"minutes"]=s,this.drawClockFromTimeInput(s,i))};this.done=(t=null)=>{let e=this.el.value,i=t?"":L._addLeadingZero(this.hours)+":"+L._addLeadingZero(this.minutes);this.time=i,!t&&this.options.twelveHour&&(i=`${i} ${this.amOrPm}`),this.el.value=i,i!==e&&this.el.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))};this.confirm=()=>{this.done(),typeof this.options.onDone=="function"&&this.options.onDone.call(this)};this.cancel=()=>{typeof this.options.onCancel=="function"&&this.options.onCancel.call(this)};this.clear=()=>{this.done(!0)};this.el.Expressive_Timepicker=this,this.options={...L.defaults,...e,i18n:{...L.defaults.i18n,...e?.i18n}},this.id=u.guid(),this._insertHTMLIntoDOM(),this._setupVariables(),this._setupEventHandlers(),this._pickerSetup(),this.options.displayPlugin&&this.options.displayPlugin==="docked"&&(this.displayPlugin=j.init(this.el,this.containerEl,this.options.displayPluginOptions))}static get defaults(){return ve}static init(t,e={}){return super.init(t,e,L)}static _addLeadingZero(t){return(t<10?"0":"")+t}static _createSVGEl(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}static getInstance(t){return t.Expressive_Timepicker}destroy(){this._removeEventHandlers(),this.displayPlugin?.destroy(),this.containerEl.remove(),this.el.Expressive_Timepicker=void 0}_setupEventHandlers(){this.el.addEventListener("click",this._handleInputClick),this.el.addEventListener("keydown",this._handleInputKeydown),this.plate.addEventListener("pointerdown",this._handleClockClickStart),this.digitalClock.addEventListener("input",this._inputFromTextField),this.inputHours.addEventListener("focus",()=>this.showView("hours")),this.inputHours.addEventListener("focusout",()=>this.formatHours()),this.inputMinutes.addEventListener("focus",()=>this.showView("minutes")),this.inputMinutes.addEventListener("focusout",()=>this.formatMinutes())}_removeEventHandlers(){this.digitalClock.removeEventListener("input",this._inputFromTextField),this.el.removeEventListener("click",this._handleInputClick),this.el.removeEventListener("keydown",this._handleInputKeydown),document.removeEventListener("pointermove",this._handleDocumentClickMove),document.removeEventListener("pointerup",this._handleDocumentClickEnd),document.removeEventListener("pointercancel",this._handleDocumentClickCancel)}_insertHTMLIntoDOM(){let t=document.createElement("template");t.innerHTML=L._template.trim(),this.containerEl=t.content.firstChild,this.containerEl.id="container-"+this.id;let e=this.options.container,i=e instanceof HTMLElement?e:document.querySelector(e);this.options.container&&i?i.append(this.containerEl):this.el.parentElement.appendChild(this.containerEl)}_setupVariables(){this.currentView="hours",this.canVibrate=typeof navigator.vibrate=="function",this._canvas=this.containerEl.querySelector(".timepicker-canvas"),this.plate=this.containerEl.querySelector(".timepicker-plate"),this.digitalClock=this.containerEl.querySelector(".timepicker-display-column"),this.hoursView=this.containerEl.querySelector(".timepicker-hours"),this.minutesView=this.containerEl.querySelector(".timepicker-minutes"),this.inputHours=this.containerEl.querySelector(".timepicker-input-hours"),this.inputMinutes=this.containerEl.querySelector(".timepicker-input-minutes"),this.inputHours.setAttribute("aria-label",this.options.i18n.hours),this.inputMinutes.setAttribute("aria-label",this.options.i18n.minutes),this.spanAmPm=this.containerEl.querySelector(".timepicker-span-am-pm"),this.footer=this.containerEl.querySelector(".timepicker-footer"),this.amOrPm="PM"}_pickerSetup(){u.createButton(this.footer,this.options.i18n.clear,["timepicker-clear"],this.options.showClearBtn,this.clear),this.options.autoSubmit||u.createConfirmationContainer(this.footer,this.options.i18n.done,this.options.i18n.cancel,this.confirm,this.cancel),this._updateTimeFromInput(),this.options.displayPlugin||this.showView("hours")}_ensureClockBuilt(){this._clockBuilt||(this._clockBuilt=!0,this._clockSetup(),this._updateAmPmView())}_clockSetup(){this.options.twelveHour&&(this._amBtn=document.createElement("button"),this._amBtn.type="button",this._amBtn.classList.add("am-btn"),this._amBtn.innerText="AM",this._amBtn.addEventListener("click",this._handleAmPmClick),this.spanAmPm.appendChild(this._amBtn),this._pmBtn=document.createElement("button"),this._pmBtn.type="button",this._pmBtn.classList.add("pm-btn"),this._pmBtn.innerText="PM",this._pmBtn.addEventListener("click",this._handleAmPmClick),this.spanAmPm.appendChild(this._pmBtn)),this._buildHoursView(),this._buildMinutesView(),this._buildSVGClock()}_buildSVGClock(){let t=this.options.dialRadius,e=this.options.tickRadius,i=t*2,s=L._createSVGEl("svg");s.setAttribute("class","timepicker-svg"),s.setAttribute("width",i.toString()),s.setAttribute("height",i.toString());let n=L._createSVGEl("g");n.setAttribute("transform","translate("+t+","+t+")");let a=L._createSVGEl("circle");a.setAttribute("class","timepicker-canvas-bearing"),a.setAttribute("cx","0"),a.setAttribute("cy","0"),a.setAttribute("r","4");let c=L._createSVGEl("line");c.setAttribute("x1","0"),c.setAttribute("y1","0");let h=L._createSVGEl("circle");h.setAttribute("class","timepicker-canvas-bg"),h.setAttribute("r",e.toString()),n.appendChild(c),n.appendChild(h),n.appendChild(a),s.appendChild(n),this._canvas.appendChild(s),this.hand=c,this.bg=h,this.bearing=a,this.g=n}_buildHoursView(){if(this.options.twelveHour)for(let t=1;t<13;t+=1){let e=t/6*Math.PI,i=this.options.outerRadius;this._buildHoursTick(t,e,i)}else for(let t=0;t<24;t+=1){let e=t/6*Math.PI,s=t>0&&t<13?this.options.innerRadius:this.options.outerRadius;this._buildHoursTick(t,e,s)}}_buildHoursTick(t,e,i){let s=document.createElement("div");s.classList.add("timepicker-tick"),s.style.left=this.options.dialRadius+Math.sin(e)*i-this.options.tickRadius+"px",s.style.top=this.options.dialRadius-Math.cos(e)*i-this.options.tickRadius+"px",s.textContent=t===0?"00":t.toString(),this.hoursView.appendChild(s)}_buildMinutesView(){let t=document.createElement("div");t.classList.add("timepicker-tick");for(let e=0;e<60;e+=5){let i=t.cloneNode(!0),s=e/30*Math.PI;i.style.left=this.options.dialRadius+Math.sin(s)*this.options.outerRadius-this.options.tickRadius+"px",i.style.top=this.options.dialRadius-Math.cos(s)*this.options.outerRadius-this.options.tickRadius+"px",i.textContent=L._addLeadingZero(e),this.minutesView.appendChild(i)}}_updateAmPmView(){!this._amBtn||!this._pmBtn||(this._amBtn.setAttribute("aria-pressed",String(this.amOrPm==="AM")),this._pmBtn.setAttribute("aria-pressed",String(this.amOrPm==="PM")),this._amBtn.classList.toggle("outlined",this.amOrPm!=="AM"),this._pmBtn.classList.toggle("outlined",this.amOrPm!=="PM"),this.options.twelveHour&&(this.amOrPm==="PM"?(this._amBtn.classList.remove("filled"),this._pmBtn.classList.add("filled")):this.amOrPm==="AM"&&(this._amBtn.classList.add("filled"),this._pmBtn.classList.remove("filled"))))}_updateTimeFromInput(){let t=((this.el.value||this.options.defaultTime||"")+"").trim().toUpperCase().split(":"),e=t[1]?.match(/AM|PM/)?.[0];if(t[1]=t[1]?.replace(/AM|PM/,""),t[0]==="NOW"){let i=new Date(+new Date+this.options.fromNow);t=[i.getHours().toString(),i.getMinutes().toString()]}this.hours=+t[0]||0,this.minutes=+t[1]||0,this.options.twelveHour&&(this.amOrPm=e==="AM"||e==="PM"?e:this.hours>=12?"PM":"AM",this.hours=this.hours%12||12),this.inputHours.value=L._addLeadingZero(this.hours),this.inputMinutes.value=L._addLeadingZero(this.minutes),this._updateAmPmView()}resetClock(t){let e=this.currentView,i=this[e],s=e==="hours",n=Math.PI/(s?6:30),a=i*n,c=s&&i>0&&i<13?this.options.innerRadius:this.options.outerRadius,h=Math.sin(a)*c,l=-Math.cos(a)*c;t?(this._canvas?.classList.add("timepicker-canvas-out"),setTimeout(()=>{this._canvas?.classList.remove("timepicker-canvas-out"),this.setHand(h,l)},t)):this.setHand(h,l)}drawClockFromTimeInput(t,e){let i=Math.PI/(e?6:30),s=t*i,n;this.options.twelveHour?n=this.options.outerRadius:n=e&&t>0&&t<13?this.options.innerRadius:this.options.outerRadius,this.setClockAttributes(s,n)}setHand(t,e,i=!1){let s=this.currentView==="hours",n=Math.PI/(s||i?6:30),a=Math.sqrt(t*t+e*e),c=s&&a<(this.options.outerRadius+this.options.innerRadius)/2,h=Math.atan2(t,-e),l=c?this.options.innerRadius:this.options.outerRadius;this.options.twelveHour&&(l=this.options.outerRadius),h<0&&(h=Math.PI*2+h);let r=Math.round(h/n);h=r*n,this.options.twelveHour?s?r===0&&(r=12):(i&&(r*=5),r===60&&(r=0)):s?(r===12&&(r=0),r=c?r===0?12:r:r===0?0:r+12):(i&&(r*=5),r===60&&(r=0)),this[this.currentView]!==r&&this.canVibrate&&this.options.vibrate&&(this.vibrateTimer||(navigator.vibrate(10),this.vibrateTimer=setTimeout(()=>{this.vibrateTimer=null},100))),this[this.currentView]=r,s?this.inputHours.value=L._addLeadingZero(r):this.inputMinutes.value=L._addLeadingZero(r),this.setClockAttributes(h,l)}setClockAttributes(t,e){if(!this.hand||!this.bg)return;let i=Math.sin(t)*(e-this.options.tickRadius),s=-Math.cos(t)*(e-this.options.tickRadius),n=Math.sin(t)*e,a=-Math.cos(t)*e;this.hand.setAttribute("x2",i.toString()),this.hand.setAttribute("y2",s.toString()),this.bg.setAttribute("cx",n.toString()),this.bg.setAttribute("cy",a.toString())}formatHours(){this.inputHours.value==""&&this.setHoursDefault(),this.inputHours.value=L._addLeadingZero(this.hours)}formatMinutes(){this.inputMinutes.value==""&&(this.minutes=new Date().getMinutes()),this.inputMinutes.value=L._addLeadingZero(this.minutes)}setHoursDefault(){this.hours=new Date().getHours(),this.options.twelveHour&&(this.hours=this.hours%12||12),this.inputHours.value=this.hours.toString()}};L._template=`<div class="timepicker-container">
|
|
29
|
+
right ${this.options.duration}ms ease-out ${i}ms`,this._indicator.style.left=this._calcLeftPos(this._activeTabLink)+"px",this._indicator.style.right=this._calcRightPos(this._activeTabLink)+"px"}select(t){let e=Array.from(this._tabLinks).find(i=>i.getAttribute("href")==="#"+t);e&&e.click()}};var _e={dialRadius:135,outerRadius:105,innerRadius:70,tickRadius:20,duration:350,container:null,defaultTime:"now",fromNow:0,showClearBtn:!1,autoSubmit:!0,i18n:{cancel:"Cancel",clear:"Clear",done:"Ok",hours:"Hours",minutes:"Minutes"},twelveHour:!0,vibrate:!0,onSelect:null,onInputInteraction:null,onDone:null,onCancel:null,displayPlugin:null,displayPluginOptions:null},T=class T extends _{constructor(t,e){super(t,e,T);this._dragPointerId=null;this._clockBuilt=!1;this._handleInputClick=()=>{this._updateTimeFromInput(),this._ensureClockBuilt(),this.displayPlugin&&this.displayPlugin.show(),this.inputHours.focus(),typeof this.options.onInputInteraction=="function"&&this.options.onInputInteraction.call(this)};this._handleInputKeydown=t=>{t.key===u.keys.ENTER&&(t.preventDefault(),this._handleInputClick())};this._handleClockClickStart=t=>{if(!t.isPrimary||t.pointerType==="mouse"&&t.button!==0)return;t.preventDefault(),this._ensureClockBuilt();let e=this.plate.getBoundingClientRect(),i={x:e.left,y:e.top};this.x0=i.x+this.options.dialRadius,this.y0=i.y+this.options.dialRadius,this.moved=!1,this._dragPointerId=t.pointerId,this.dx=t.clientX-this.x0,this.dy=t.clientY-this.y0,this.setHand(this.dx,this.dy,!1),document.addEventListener("pointermove",this._handleDocumentClickMove),document.addEventListener("pointerup",this._handleDocumentClickEnd),document.addEventListener("pointercancel",this._handleDocumentClickCancel)};this._handleDocumentClickMove=t=>{if(t.pointerId!==this._dragPointerId)return;t.preventDefault();let e=t.clientX-this.x0,i=t.clientY-this.y0;this.moved=!0,this.setHand(e,i,!1)};this._handleDocumentClickEnd=t=>{if(t.pointerId!==this._dragPointerId)return;this._dragPointerId=null,t.preventDefault(),document.removeEventListener("pointerup",this._handleDocumentClickEnd),document.removeEventListener("pointercancel",this._handleDocumentClickCancel);let e=t.clientX-this.x0,i=t.clientY-this.y0;this.moved&&e===this.dx&&i===this.dy&&this.setHand(e,i),this.currentView==="hours"?(this.inputMinutes.focus(),this.showView("minutes",this.options.duration/2)):(clearTimeout(this._autoSubmitTimer),this._autoSubmitTimer=setTimeout(()=>{this._autoSubmitTimer=null,this.options.autoSubmit&&this.done()},this.options.duration/2)),typeof this.options.onSelect=="function"&&this.options.onSelect.call(this,this.hours,this.minutes),document.removeEventListener("pointermove",this._handleDocumentClickMove)};this._handleDocumentClickCancel=t=>{t.pointerId===this._dragPointerId&&(this._dragPointerId=null,this.moved=!1,document.removeEventListener("pointermove",this._handleDocumentClickMove),document.removeEventListener("pointerup",this._handleDocumentClickEnd),document.removeEventListener("pointercancel",this._handleDocumentClickCancel))};this._handleAmPmClick=t=>{this._handleAmPmInteraction(t.target)};this._handleAmPmInteraction=t=>{this.amOrPm=t.classList.contains("am-btn")?"AM":"PM",this._updateAmPmView()};this.showView=(t,e=null)=>{this._ensureClockBuilt();let i=t==="hours",s=i?this.hoursView:this.minutesView,n=i?this.minutesView:this.hoursView;this.currentView=t,n.classList.add("timepicker-dial-out"),s.style.visibility="visible",s.classList.remove("timepicker-dial-out"),this.resetClock(e),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(()=>{n.style.visibility="hidden"},this.options.duration)};this._inputFromTextField=t=>{let e=t.target,i=e===this.inputHours;if(!i&&e!==this.inputMinutes)return;this._cancelClockReset();let s=Number(e.value),n=i&&this.options.twelveHour?1:0,a=i?this.options.twelveHour?12:23:59;!e.value.trim()||!Number.isInteger(s)||s<n||s>a||(this[i?"hours":"minutes"]=s,this.drawClockFromTimeInput(s,i))};this.done=(t=null)=>{let e=this.el.value,i=t?"":T._addLeadingZero(this.hours)+":"+T._addLeadingZero(this.minutes);this.time=i,!t&&this.options.twelveHour&&(i=`${i} ${this.amOrPm}`),this.el.value=i,i!==e&&this.el.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))};this.confirm=()=>{this.done(),typeof this.options.onDone=="function"&&this.options.onDone.call(this)};this.cancel=()=>{typeof this.options.onCancel=="function"&&this.options.onCancel.call(this)};this.clear=()=>{this.done(!0)};this.el.Expressive_Timepicker=this,this.options={...T.defaults,...e,i18n:{...T.defaults.i18n,...e?.i18n}},this.id=u.guid(),this._insertHTMLIntoDOM(),this._setupVariables(),this._setupEventHandlers(),this._pickerSetup(),this.options.displayPlugin&&this.options.displayPlugin==="docked"&&(this.displayPlugin=X.init(this.el,this.containerEl,this.options.displayPluginOptions))}static get defaults(){return _e}static init(t,e={}){return super.init(t,e,T)}static _addLeadingZero(t){return(t<10?"0":"")+t}static _createSVGEl(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}static getInstance(t){return t.Expressive_Timepicker}destroy(){clearTimeout(this._autoSubmitTimer),clearTimeout(this.toggleViewTimer),clearTimeout(this.vibrateTimer),this._cancelClockReset(),this._removeEventHandlers(),this.displayPlugin?.destroy(),this.containerEl.remove(),this.el.Expressive_Timepicker=void 0}_setupEventHandlers(){this.el.addEventListener("click",this._handleInputClick),this.el.addEventListener("keydown",this._handleInputKeydown),this.plate.addEventListener("pointerdown",this._handleClockClickStart),this.digitalClock.addEventListener("input",this._inputFromTextField),this.inputHours.addEventListener("focus",()=>this.showView("hours")),this.inputHours.addEventListener("focusout",()=>this.formatHours()),this.inputMinutes.addEventListener("focus",()=>this.showView("minutes")),this.inputMinutes.addEventListener("focusout",()=>this.formatMinutes())}_removeEventHandlers(){this.digitalClock.removeEventListener("input",this._inputFromTextField),this.el.removeEventListener("click",this._handleInputClick),this.el.removeEventListener("keydown",this._handleInputKeydown),document.removeEventListener("pointermove",this._handleDocumentClickMove),document.removeEventListener("pointerup",this._handleDocumentClickEnd),document.removeEventListener("pointercancel",this._handleDocumentClickCancel)}_insertHTMLIntoDOM(){let t=document.createElement("template");t.innerHTML=T._template.trim(),this.containerEl=t.content.firstChild,this.containerEl.id="container-"+this.id;let e=this.options.container,i=e instanceof HTMLElement?e:document.querySelector(e);this.options.container&&i?i.append(this.containerEl):this.el.parentElement.appendChild(this.containerEl)}_setupVariables(){this.currentView="hours",this.canVibrate=typeof navigator.vibrate=="function",this._canvas=this.containerEl.querySelector(".timepicker-canvas"),this.plate=this.containerEl.querySelector(".timepicker-plate"),this.digitalClock=this.containerEl.querySelector(".timepicker-display-column"),this.hoursView=this.containerEl.querySelector(".timepicker-hours"),this.minutesView=this.containerEl.querySelector(".timepicker-minutes"),this.inputHours=this.containerEl.querySelector(".timepicker-input-hours"),this.inputMinutes=this.containerEl.querySelector(".timepicker-input-minutes"),this.inputHours.setAttribute("aria-label",this.options.i18n.hours),this.inputMinutes.setAttribute("aria-label",this.options.i18n.minutes),this.spanAmPm=this.containerEl.querySelector(".timepicker-span-am-pm"),this.footer=this.containerEl.querySelector(".timepicker-footer"),this.amOrPm="PM"}_pickerSetup(){u.createButton(this.footer,this.options.i18n.clear,["timepicker-clear"],this.options.showClearBtn,this.clear),this.options.autoSubmit||u.createConfirmationContainer(this.footer,this.options.i18n.done,this.options.i18n.cancel,this.confirm,this.cancel),this._updateTimeFromInput(),this.options.displayPlugin||this.showView("hours")}_ensureClockBuilt(){this._clockBuilt||(this._clockBuilt=!0,this._clockSetup(),this._updateAmPmView())}_clockSetup(){this.options.twelveHour&&(this._amBtn=document.createElement("button"),this._amBtn.type="button",this._amBtn.classList.add("am-btn"),this._amBtn.innerText="AM",this._amBtn.addEventListener("click",this._handleAmPmClick),this.spanAmPm.appendChild(this._amBtn),this._pmBtn=document.createElement("button"),this._pmBtn.type="button",this._pmBtn.classList.add("pm-btn"),this._pmBtn.innerText="PM",this._pmBtn.addEventListener("click",this._handleAmPmClick),this.spanAmPm.appendChild(this._pmBtn)),this._buildHoursView(),this._buildMinutesView(),this._buildSVGClock()}_buildSVGClock(){let t=this.options.dialRadius,e=this.options.tickRadius,i=t*2,s=T._createSVGEl("svg");s.setAttribute("class","timepicker-svg"),s.setAttribute("width",i.toString()),s.setAttribute("height",i.toString());let n=T._createSVGEl("g");n.setAttribute("transform","translate("+t+","+t+")");let a=T._createSVGEl("circle");a.setAttribute("class","timepicker-canvas-bearing"),a.setAttribute("cx","0"),a.setAttribute("cy","0"),a.setAttribute("r","4");let h=T._createSVGEl("line");h.setAttribute("x1","0"),h.setAttribute("y1","0");let c=T._createSVGEl("circle");c.setAttribute("class","timepicker-canvas-bg"),c.setAttribute("r",e.toString()),n.appendChild(h),n.appendChild(c),n.appendChild(a),s.appendChild(n),this._canvas.appendChild(s),this.hand=h,this.bg=c,this.bearing=a,this.g=n}_buildHoursView(){if(this.options.twelveHour)for(let t=1;t<13;t+=1){let e=t/6*Math.PI,i=this.options.outerRadius;this._buildHoursTick(t,e,i)}else for(let t=0;t<24;t+=1){let e=t/6*Math.PI,s=t>0&&t<13?this.options.innerRadius:this.options.outerRadius;this._buildHoursTick(t,e,s)}}_buildHoursTick(t,e,i){let s=document.createElement("div");s.classList.add("timepicker-tick"),s.style.left=this.options.dialRadius+Math.sin(e)*i-this.options.tickRadius+"px",s.style.top=this.options.dialRadius-Math.cos(e)*i-this.options.tickRadius+"px",s.textContent=t===0?"00":t.toString(),this.hoursView.appendChild(s)}_buildMinutesView(){let t=document.createElement("div");t.classList.add("timepicker-tick");for(let e=0;e<60;e+=5){let i=t.cloneNode(!0),s=e/30*Math.PI;i.style.left=this.options.dialRadius+Math.sin(s)*this.options.outerRadius-this.options.tickRadius+"px",i.style.top=this.options.dialRadius-Math.cos(s)*this.options.outerRadius-this.options.tickRadius+"px",i.textContent=T._addLeadingZero(e),this.minutesView.appendChild(i)}}_updateAmPmView(){!this._amBtn||!this._pmBtn||(this._amBtn.setAttribute("aria-pressed",String(this.amOrPm==="AM")),this._pmBtn.setAttribute("aria-pressed",String(this.amOrPm==="PM")),this._amBtn.classList.toggle("outlined",this.amOrPm!=="AM"),this._pmBtn.classList.toggle("outlined",this.amOrPm!=="PM"),this.options.twelveHour&&(this.amOrPm==="PM"?(this._amBtn.classList.remove("filled"),this._pmBtn.classList.add("filled")):this.amOrPm==="AM"&&(this._amBtn.classList.add("filled"),this._pmBtn.classList.remove("filled"))))}_updateTimeFromInput(){this._cancelClockReset();let t=((this.el.value||this.options.defaultTime||"")+"").trim().toUpperCase().split(":"),e=t[1]?.match(/AM|PM/)?.[0];if(t[1]=t[1]?.replace(/AM|PM/,""),t[0]==="NOW"){let i=new Date(+new Date+this.options.fromNow);t=[i.getHours().toString(),i.getMinutes().toString()]}this.hours=+t[0]||0,this.minutes=+t[1]||0,this.options.twelveHour&&(this.amOrPm=e==="AM"||e==="PM"?e:this.hours>=12?"PM":"AM",this.hours=this.hours%12||12),this.inputHours.value=T._addLeadingZero(this.hours),this.inputMinutes.value=T._addLeadingZero(this.minutes),this._updateAmPmView()}_cancelClockReset(){clearTimeout(this._clockResetTimer),this._clockResetTimer=null,this._canvas?.classList.remove("timepicker-canvas-out")}resetClock(t){this._cancelClockReset();let e=this.currentView,i=this[e],s=e==="hours",n=Math.PI/(s?6:30),a=i*n,h=s&&i>0&&i<13?this.options.innerRadius:this.options.outerRadius,c=Math.sin(a)*h,l=-Math.cos(a)*h;t?(this._canvas?.classList.add("timepicker-canvas-out"),this._clockResetTimer=setTimeout(()=>{this.setHand(c,l)},t)):this.setHand(c,l)}drawClockFromTimeInput(t,e){let i=Math.PI/(e?6:30),s=t*i,n;this.options.twelveHour?n=this.options.outerRadius:n=e&&t>0&&t<13?this.options.innerRadius:this.options.outerRadius,this.setClockAttributes(s,n)}setHand(t,e,i=!1){this._cancelClockReset();let s=this.currentView==="hours",n=Math.PI/(s||i?6:30),a=Math.sqrt(t*t+e*e),h=s&&a<(this.options.outerRadius+this.options.innerRadius)/2,c=Math.atan2(t,-e),l=h?this.options.innerRadius:this.options.outerRadius;this.options.twelveHour&&(l=this.options.outerRadius),c<0&&(c=Math.PI*2+c);let r=Math.round(c/n);c=r*n,this.options.twelveHour?s?r===0&&(r=12):(i&&(r*=5),r===60&&(r=0)):s?(r===12&&(r=0),r=h?r===0?12:r:r===0?0:r+12):(i&&(r*=5),r===60&&(r=0)),this[this.currentView]!==r&&this.canVibrate&&this.options.vibrate&&(this.vibrateTimer||(navigator.vibrate(10),this.vibrateTimer=setTimeout(()=>{this.vibrateTimer=null},100))),this[this.currentView]=r,s?this.inputHours.value=T._addLeadingZero(r):this.inputMinutes.value=T._addLeadingZero(r),this.setClockAttributes(c,l)}setClockAttributes(t,e){if(!this.hand||!this.bg)return;let i=Math.sin(t)*(e-this.options.tickRadius),s=-Math.cos(t)*(e-this.options.tickRadius),n=Math.sin(t)*e,a=-Math.cos(t)*e;this.hand.setAttribute("x2",i.toString()),this.hand.setAttribute("y2",s.toString()),this.bg.setAttribute("cx",n.toString()),this.bg.setAttribute("cy",a.toString())}formatHours(){this.inputHours.value==""&&this.setHoursDefault(),this.inputHours.value=T._addLeadingZero(this.hours)}formatMinutes(){this.inputMinutes.value==""&&(this.minutes=new Date().getMinutes()),this.inputMinutes.value=T._addLeadingZero(this.minutes)}setHoursDefault(){this.hours=new Date().getHours(),this.options.twelveHour&&(this.hours=this.hours%12||12),this.inputHours.value=this.hours.toString()}};T._template=`<div class="timepicker-container">
|
|
30
30
|
<div class="timepicker-digital-display">
|
|
31
31
|
<div class="timepicker-text-container">
|
|
32
32
|
<div class="timepicker-display-column timepicker-display-digital-clock">
|
|
@@ -53,10 +53,10 @@ var Expressive=(()=>{var dt=Object.defineProperty;var Wt=Object.getOwnPropertyDe
|
|
|
53
53
|
</div>
|
|
54
54
|
<div class="timepicker-footer"></div>
|
|
55
55
|
</div>
|
|
56
|
-
</div>`;var it=
|
|
56
|
+
</div>`;var it=T;var Ee={text:"",action:"",onAction:null,dismissible:!1,displayLength:4e3,inDuration:300,outDuration:375,classes:"",completeCallback:null,activationPercent:.8,root:null},g=class g{constructor(o={}){this._dismissed=!1;this._returnFocus=null;this._restoreElement=null;for(this.options={...g.defaults,...o},o.displayLength===void 0&&this.options.action&&(this.options.displayLength=1/0),o.dismissible===void 0&&this.options.action&&(this.options.dismissible=!0),this.message=this.options.text,this.panning=!1,this.timeRemaining=this.options.displayLength;g._snackbars.length>0;){let i=g._snackbars.shift();i._dismissed=!0,i._restoreFocus(!0)}let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;this._returnFocus=t instanceof HTMLElement?t:null,this.el=this._createSnackbar();let e=u.portalRoot(this.options.root??document.body);(!g._container||!g._container.isConnected||g._container.parentNode!==e)&&(g._container&&g._removeContainer(),g._createContainer(e)),g._container.appendChild(this.el),this.el.Expressive_Snackbar=this,g._snackbars.push(this),this._animateIn(),this._setTimer()}static get defaults(){return Ee}static getInstance(o){return o.Expressive_Snackbar}static _createContainer(o=document.body){let t=document.createElement("div");t.setAttribute("id","snackbar-container"),t.addEventListener("pointerdown",g._onDragStart),document.addEventListener("pointermove",g._onDragMove),document.addEventListener("pointerup",g._onDragEnd),document.addEventListener("pointercancel",g._onDragCancel),o.appendChild(t),g._container=t}static _removeContainer(){document.removeEventListener("pointermove",g._onDragMove),document.removeEventListener("pointerup",g._onDragEnd),document.removeEventListener("pointercancel",g._onDragCancel),g._container.remove(),g._container=null}static _onDragStart(o){if(!o.isPrimary||o.pointerType==="mouse"&&o.button!==0)return;let t=o.target;if(t&&!t.closest("button, a")&&t.closest(".snackbar")){let i=t.closest(".snackbar").Expressive_Snackbar;if(!i)return;i.panning=!0,i._pauseTimer(),g._draggedSnackbar=i,i.el.classList.add("panning"),i.el.style.transition="",g._dragPointerId=o.pointerId,i.startingXPos=o.clientX,i.velocityX=0,i.time=Date.now(),i.xPos=o.clientX}}static _onDragMove(o){if(g._dragPointerId===o.pointerId&&g._draggedSnackbar){o.preventDefault();let t=g._draggedSnackbar;t.deltaX=Math.abs(t.xPos-o.clientX),t.xPos=o.clientX,t.velocityX=t.deltaX/(Date.now()-t.time),t.time=Date.now();let e=t.xPos-t.startingXPos,i=t.el.offsetWidth*t.options.activationPercent;t.el.style.transform=`translateX(${e}px)`,t.el.style.opacity=(1-Math.abs(e/i)).toString()}}static _onDragEnd(o){if(g._dragPointerId===o.pointerId&&(g._dragPointerId=null,g._draggedSnackbar)){let t=g._draggedSnackbar;t.panning=!1,t.el.classList.remove("panning");let e=t.xPos-t.startingXPos,i=t.el.offsetWidth*t.options.activationPercent,s=Date.now()-t.time<100?t.velocityX:0;Math.abs(e)>i||s>1?(t.wasSwiped=!0,t.dismiss()):(t.el.style.transition="transform .2s, opacity .2s",t.el.style.transform="",t.el.style.opacity="",t._resumeTimer()),g._draggedSnackbar=null}}static _onDragCancel(o){if(g._dragPointerId!==o.pointerId)return;g._dragPointerId=null;let t=g._draggedSnackbar;t&&(t.panning=!1,t.el.classList.remove("panning"),t.el.style.transition="transform .2s, opacity .2s",t.el.style.transform="",t.el.style.opacity="",t._resumeTimer(),g._draggedSnackbar=null)}static dismissAll(){for(let o of[...g._snackbars])o.dismiss()}_createSnackbar(){let o=this.options.snackbarId?u.getElementById(this.options.root??document.body,this.options.snackbarId):document.createElement("div");if(o instanceof HTMLTemplateElement)o=o.content.cloneNode(!0).firstElementChild;else if(o&&this.options.snackbarId){let e=document.createComment("");o.before(e);let i=[...o.childNodes],s=["class","style","role","aria-live","aria-atomic","inert"].map(n=>[n,o.getAttribute(n)]);this._restoreElement=()=>{o.replaceChildren(...i);for(let[n,a]of s)a===null?o.removeAttribute(n):o.setAttribute(n,a);e.replaceWith(o)}}if(!o)throw new Error("Snackbar body not found");this._events=new(o.ownerDocument.defaultView??window).AbortController;let t={signal:this._events.signal};if(o.classList.add("snackbar"),o.setAttribute("role","status"),o.setAttribute("aria-live","polite"),o.setAttribute("aria-atomic","true"),o.inert=!1,o.addEventListener("focusin",e=>{e.relatedTarget instanceof HTMLElement&&!o.contains(e.relatedTarget)&&(this._returnFocus=e.relatedTarget),this._pauseTimer()},t),o.addEventListener("keydown",e=>{e.key!=="Escape"||e.defaultPrevented||this._dismissed||(e.preventDefault(),e.stopPropagation(),this.dismiss())},t),o.addEventListener("focusout",()=>{clearTimeout(this._focusTimer),this._focusTimer=setTimeout(()=>this._resumeTimer(),0)},t),o.addEventListener("pointerenter",()=>this._pauseTimer(),t),o.addEventListener("pointerleave",()=>this._resumeTimer(),t),this.options.classes.length>0&&o.classList.add(...this.options.classes.split(" ").filter(Boolean)),this.message){let e=document.createElement("p");e.textContent=this.message,o.replaceChildren(e)}if(this.options.action){let e=document.createElement("button");e.type="button",e.textContent=this.options.action,e.addEventListener("click",i=>{if(i.stopPropagation(),!this._dismissed)try{typeof this.options.onAction=="function"&&this.options.onAction()}finally{this.dismiss()}},t),o.appendChild(e)}if(this.options.dismissible){let e=document.createElement("button");e.type="button",e.className="circle",e.setAttribute("aria-label","Dismiss");let i=document.createElement("i");i.className="material-symbols",i.setAttribute("aria-hidden","true"),i.textContent="close",e.appendChild(i),e.addEventListener("click",s=>{s.stopPropagation(),this.dismiss()},t),o.appendChild(e)}return o}_remove(){if(this._events.signal.aborted)return;this._events.abort(),clearTimeout(this.counterTimeout),clearTimeout(this._transitionTimer),clearTimeout(this._dismissTimer),clearTimeout(this._focusTimer),this.counterTimeout=null,g._draggedSnackbar===this&&(g._draggedSnackbar=null,g._dragPointerId=null),this.el.Expressive_Snackbar=void 0,this._restoreElement?this._restoreElement():this.el.remove();let o=g._snackbars.indexOf(this);o>=0&&g._snackbars.splice(o,1),!g._snackbars.length&&g._container?.childElementCount===0&&g._removeContainer()}_animateIn(){this.el.style.display="",this.el.style.opacity="0",this.el.style.transform="translateY(24px)",this.el.style.transition=`
|
|
57
57
|
transform ${this.options.inDuration}ms ease,
|
|
58
58
|
opacity ${this.options.inDuration}ms ease
|
|
59
|
-
`,setTimeout(()=>{this.el.style.transform="",this.el.style.opacity="1"},1)}_setTimer(){this.timeRemaining!==1/0&&(this._deadline=Date.now()+this.timeRemaining,this.counterTimeout=setTimeout(()=>this.dismiss(),this.timeRemaining))}_pauseTimer(){this.counterTimeout!=null&&(clearTimeout(this.counterTimeout),this.counterTimeout=null,this.timeRemaining=Math.max(0,this._deadline-Date.now()))}_resumeTimer(){this._dismissed||this.panning||this.el.matches(":hover, :focus-within")||this.counterTimeout!=null||this._setTimer()}_restoreFocus(){let
|
|
59
|
+
`,this._transitionTimer=setTimeout(()=>{this.el.style.transform="",this.el.style.opacity="1"},1)}_setTimer(){this.timeRemaining!==1/0&&(this._deadline=Date.now()+this.timeRemaining,this.counterTimeout=setTimeout(()=>this.dismiss(),this.timeRemaining))}_pauseTimer(){this.counterTimeout!=null&&(clearTimeout(this.counterTimeout),this.counterTimeout=null,this.timeRemaining=Math.max(0,this._deadline-Date.now()))}_resumeTimer(){this._dismissed||this.panning||this.el.matches(":hover, :focus-within")||this.counterTimeout!=null||this._setTimer()}_restoreFocus(o=!1){let t=this.el.getRootNode().activeElement,e=t&&this.el.contains(t)?this._returnFocus:null;this.el.inert=!0,o&&this._remove(),e?.isConnected&&e.focus({preventScroll:!0})}dismiss(){if(this._dismissed||(this._dismissed=!0,clearTimeout(this.counterTimeout),this.counterTimeout=null,this._restoreFocus(),this._events.signal.aborted))return;let o=this.el.offsetWidth*this.options.activationPercent;this.wasSwiped&&(this.el.style.transition="transform .05s, opacity .05s",this.el.style.transform=`translateX(${o}px)`,this.el.style.opacity="0"),this.el.style.transition=`
|
|
60
60
|
margin ${this.options.outDuration}ms ease,
|
|
61
|
-
opacity ${this.options.outDuration}ms ease`,setTimeout(()=>{this.el.style.opacity="0",this.el.style.marginTop="-40px"},1),setTimeout(()=>{
|
|
61
|
+
opacity ${this.options.outDuration}ms ease`,clearTimeout(this._transitionTimer),this._transitionTimer=setTimeout(()=>{this.el.style.opacity="0",this.el.style.marginTop="-40px"},1),this._dismissTimer=setTimeout(()=>{this._remove(),typeof this.options.completeCallback=="function"&&this.options.completeCallback()},this.options.outDuration)}};g._dragPointerId=null,g._snackbars=[],g._container=null,g._draggedSnackbar=null;var ht=g;var ye={exitDelay:200,enterDelay:0,text:"",margin:4,inDuration:250,outDuration:200,position:"bottom",transitionMovement:10,opacity:1},st=class d extends _{constructor(t,e){super(t,e,d);this.open=(t=!0)=>{this.isOpen||(clearTimeout(this._exitDelayTimeout),clearTimeout(this._animationTimeout),this.isOpen=!0,this.options={...this.options,...this._getAttributeOptions()},this._updateTooltipContent(),this._setEnterDelayTimeout(t))};this.close=()=>{this.isOpen&&(this.isHovered=!1,this.isFocused=!1,this.isOpen=!1,clearTimeout(this._enterDelayTimeout),this._setExitDelayTimeout())};this._handleMouseEnter=()=>{this.isHovered=!0,this.open(!1)};this._handleMouseLeave=t=>{let e=t.relatedTarget;e&&(this.el.contains(e)||this.tooltipEl.contains(e))||(this.isHovered=!1,this.isFocused||this.close())};this._handleKeydown=t=>{t.key!=="Escape"||!this.isOpen||(t.preventDefault(),t.stopPropagation(),this.close(),clearTimeout(this._exitDelayTimeout),this._animateOut())};this._handleFocus=t=>{t.target.matches(":focus-visible")&&(this.isFocused=!0,this.open(!1))};this._handleBlur=t=>{let e=t.relatedTarget;e&&(this.el.contains(e)||this.tooltipEl.contains(e))||(this.isFocused=!1,this.isHovered||this.close())};this.el.Expressive_Tooltip=this,this.options={...d.defaults,...this._getAttributeOptions(),...e},this.isOpen=!1,this.isHovered=!1,this.isFocused=!1,this._appendTooltipEl(),this._setupEventHandlers()}static get defaults(){return ye}static init(t,e={}){return super.init(t,e,d)}static getInstance(t){return t.Expressive_Tooltip}destroy(){clearTimeout(this._enterDelayTimeout),clearTimeout(this._exitDelayTimeout),clearTimeout(this._animationTimeout),this.isOpen=!1,this.isHovered=!1,this.isFocused=!1;let t=this.el.getAttribute("aria-describedby")?.split(/\s+/);if(t?.includes(this.tooltipEl.id)){let e=t.filter(i=>i&&i!==this.tooltipEl.id).join(" ");e?this.el.setAttribute("aria-describedby",e):this.el.removeAttribute("aria-describedby")}if(this._originalContent){let{el:e,marker:i,display:s,priority:n,hidden:a,contentClass:h}=this._originalContent;e.style.setProperty("display",s,n),a===null?e.removeAttribute("hidden"):e.setAttribute("hidden",a),e.classList.toggle("tooltip-content",h),e.className||e.removeAttribute("class"),i.replaceWith(e),this._originalContent=null}this.tooltipEl.remove(),this._removeEventHandlers(),this.el.Expressive_Tooltip=void 0}_appendTooltipEl(){this.tooltipEl=document.createElement("div"),this.tooltipEl.classList.add("tooltip"),this.tooltipEl.id=`tooltip-${u.guid()}`,this.tooltipEl.setAttribute("role","tooltip"),this.el.setAttribute("aria-describedby",[this.el.getAttribute("aria-describedby"),this.tooltipEl.id].filter(Boolean).join(" "));let t=this.options.tooltipId?u.getElementById(this.el,this.options.tooltipId):document.createElement("div");if(this.options.tooltipId){this.tooltipEl.classList.add("rich");let e=document.createComment("");t.before(e),this._originalContent={el:t,marker:e,display:t.style.display,priority:t.style.getPropertyPriority("display"),hidden:t.getAttribute("hidden"),contentClass:t.classList.contains("tooltip-content")},t.removeAttribute("hidden")}t.style.display="",t.classList.add("tooltip-content"),this._setTooltipContent(t),this.tooltipEl.appendChild(t),u.portalRoot(this.el).appendChild(this.tooltipEl)}_setTooltipContent(t){this.options.tooltipId||(t.innerText=this.options.text)}_updateTooltipContent(){this._setTooltipContent(this.tooltipEl.querySelector(".tooltip-content"))}_setupEventHandlers(){for(let t of[this.el,this.tooltipEl])t.addEventListener("mouseenter",this._handleMouseEnter),t.addEventListener("mouseleave",this._handleMouseLeave),t.addEventListener("focus",this._handleFocus,!0),t.addEventListener("blur",this._handleBlur,!0);this.el.ownerDocument.addEventListener("keydown",this._handleKeydown,!0)}_removeEventHandlers(){for(let t of[this.el,this.tooltipEl])t.removeEventListener("mouseenter",this._handleMouseEnter),t.removeEventListener("mouseleave",this._handleMouseLeave),t.removeEventListener("focus",this._handleFocus,!0),t.removeEventListener("blur",this._handleBlur,!0);this.el.ownerDocument.removeEventListener("keydown",this._handleKeydown,!0)}_setExitDelayTimeout(){clearTimeout(this._exitDelayTimeout),this._exitDelayTimeout=setTimeout(()=>{this.isHovered||this.isFocused||this._animateOut()},this.options.exitDelay)}_setEnterDelayTimeout(t){clearTimeout(this._enterDelayTimeout),this._enterDelayTimeout=setTimeout(()=>{!this.isHovered&&!this.isFocused&&!t||this._animateIn()},this.options.enterDelay)}_positionTooltip(){let t=this.tooltipEl,e=this.el,i=e.offsetHeight,s=e.offsetWidth,n=t.offsetHeight,a=t.offsetWidth,h=this.options.margin;this.xMovement=0,this.yMovement=0;let c=e.getBoundingClientRect(),l=c.top+u.getDocumentScrollTop(),r=c.left+u.getDocumentScrollLeft();this.options.position==="top"?(l+=-n-h,r+=s/2-a/2,this.yMovement=-this.options.transitionMovement):this.options.position==="right"?(l+=i/2-n/2,r+=s+h,this.xMovement=this.options.transitionMovement):this.options.position==="left"?(l+=i/2-n/2,r+=-a-h,this.xMovement=-this.options.transitionMovement):(l+=i+h,r+=s/2-a/2,this.yMovement=this.options.transitionMovement);let p=this._repositionWithinScreen(r,l,a,n);t.style.setProperty("--md-comp-tooltip-anchor-gap",`${Math.max(0,h)+Math.abs(this.options.transitionMovement)}px`),t.style.top=p.y+"px",t.style.left=p.x+"px"}_repositionWithinScreen(t,e,i,s){return u._repositionWithinScreen(t,e,i,s,this.options.margin,this.options.transitionMovement,"center")}_animateIn(){this._animate(!0)}_animateOut(){this._animate(!1)}_animate(t){let e=this.tooltipEl.style,i=this.el.ownerDocument.defaultView.matchMedia("(prefers-reduced-motion: reduce)").matches,s=i?0:t?this.options.inDuration:this.options.outDuration;t&&(this._positionTooltip(),e.visibility="visible",e.overflow="visible"),e.transition=`transform ${s}ms ease-out, opacity ${s}ms ease-out`,clearTimeout(this._animationTimeout),this._animationTimeout=setTimeout(()=>{e.transform=t&&!i?`translateX(${this.xMovement}px) translateY(${this.yMovement}px)`:"none",e.opacity=t?(this.options.opacity||1).toString():"0",t||(this._animationTimeout=setTimeout(()=>{e.visibility="hidden",e.overflow=""},s))},1)}_getAttributeOptions(){let t={},e=this.el.getAttribute("data-tooltip"),i=this.el.getAttribute("data-tooltip-id"),s=this.el.getAttribute("data-position");return e&&(t.text=e),s&&(t.position=s),i&&(t.tooltipId=i),t}};var wt={AppBar:{component:Y,selector:"header.medium, header.large, header:has(> :is(nav:not(.tabs, .navigation-bar, .navigation-rail), .bar) > :is(.search-bar, .searchbar))"},Autocomplete:{component:P,selector:".autocomplete"},ButtonGroup:{component:j,selector:".button-group"},Cards:{component:B,selector:mt,filter:ft},ExpandingCard:{component:N,selector:vt},Carousel:{component:F,selector:".carousel"},Chips:{component:W,selector:".chips"},Datepicker:{component:Z,selector:".datepicker, .date-picker"},Menu:{component:H,selector:".menu-trigger"},Lightbox:{component:Q,selector:".lightboxed"},ScrollSpy:{component:J,selector:".scrollspy"},FormSelect:{component:k,selector:"select"},NavigationRail:{component:tt,selector:".navigation-rail"},Tabs:{component:et,selector:".tabs"},Timepicker:{component:it,selector:".timepicker, .time-picker"},Tooltip:{component:st,selector:".tooltipped"},FloatingActionButton:{component:G,selector:".fab-menu"}};function It(d=document.body,o){for(let t of Object.keys(wt)){let{component:e,selector:i,filter:s}=wt[t],n=d.querySelectorAll(`:is(${i}):not(.no-autoinit)`);s?n.forEach(a=>{s(a)&&e.init(a,o?.[t]??{})}):e.init(n,o?.[t]??{})}}var Le="0.12.0";U.Init();W.Init();V.Init();B.Init();N.Init();$.Init();K.Init();z.Init();return zt(Te);})();
|
|
62
62
|
//# sourceMappingURL=expressive.min.js.map
|