@expressivecss/expressive 0.1.0 → 0.3.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/README.md +8 -8
- package/dist/css/expressive.css +1088 -356
- 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/expressive.cjs +778 -746
- package/dist/js/expressive.cjs.map +4 -4
- package/dist/js/expressive.js +778 -746
- package/dist/js/expressive.js.map +4 -4
- package/dist/js/expressive.min.js +10 -10
- package/dist/js/expressive.min.js.map +4 -4
- package/dist/js/expressive.mjs +778 -746
- package/dist/js/expressive.mjs.map +4 -4
- package/dist/types/behaviors/dialogs.d.ts +25 -0
- package/dist/types/components/buttons.d.ts +17 -41
- package/dist/types/components/carousel.d.ts +40 -46
- package/dist/types/components/chips.d.ts +2 -2
- package/dist/types/components/collapsible.d.ts +35 -13
- package/dist/types/components/parallax.d.ts +7 -31
- package/dist/types/components/tapTarget.d.ts +23 -24
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/sass/README.md +4 -3
- package/src/sass/components/_badges.scss +5 -4
- package/src/sass/components/_breadcrumb.scss +93 -16
- package/src/sass/components/_buttons.scss +195 -96
- package/src/sass/components/_carousel.scss +130 -63
- package/src/sass/components/_chips.scss +1 -1
- package/src/sass/components/_collapsible.scss +160 -60
- package/src/sass/components/_collection.scss +161 -77
- package/src/sass/components/_icons-material-design.scss +77 -4
- package/src/sass/components/_lightbox.scss +4 -0
- package/src/sass/components/_modal.scss +67 -3
- package/src/sass/components/_navbar.scss +15 -0
- package/src/sass/components/_pagination.scss +131 -25
- package/src/sass/components/_parallax.scss +116 -20
- package/src/sass/components/_sidenav.scss +10 -5
- package/src/sass/components/_slider.scss +8 -0
- package/src/sass/components/_tapTarget.scss +134 -47
- package/src/sass/utilities/_helpers.scss +10 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var Expressive=(()=>{var Ct=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var Pt=Object.prototype.hasOwnProperty;var Dt=u=>{throw TypeError(u)};var Bt=(u,n)=>{for(var t in n)Ct(u,t,{get:n[t],enumerable:!0})},Wt=(u,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Rt(n))!Pt.call(u,i)&&i!==t&&Ct(u,i,{get:()=>n[i],enumerable:!(e=At(n,i))||e.enumerable});return u};var Ft=u=>Wt(Ct({},"__esModule",{value:!0}),u);var Vt=(u,n,t)=>n.has(u)||Dt("Cannot "+t);var Ot=(u,n,t)=>n.has(u)?Dt("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(u):n.set(u,t);var Ht=(u,n,t)=>(Vt(u,n,"access private method"),t);var me={};Bt(me,{AutoInit:()=>St,Autocomplete:()=>F,Cards:()=>W,Carousel:()=>N,CharacterCounter:()=>mt,Chips:()=>V,Collapsible:()=>j,Datepicker:()=>Z,Dropdown:()=>A,FloatingActionButton:()=>U,FormSelect:()=>I,Forms:()=>Y,Lightbox:()=>Q,Modal:()=>tt,Parallax:()=>et,Pushpin:()=>it,Range:()=>X,ScrollSpy:()=>st,Sidenav:()=>nt,Slider:()=>ft,Tabs:()=>ot,TapTarget:()=>at,Timepicker:()=>lt,Toast:()=>vt,Tooltip:()=>rt,Waves:()=>z,version:()=>ue});var w=class w{static docHandleKeydown(n){w.keyDown=!0,w._navigationKeys.has(n.key)&&(w.tabPressed=!0)}static docHandleKeyup(n){w.keyDown=!1,w._navigationKeys.has(n.key)&&(w.tabPressed=!1)}static docHandleFocus(n){w.keyDown&&document.body.classList.add("keyboard-focused")}static docHandleBlur(n){document.body.classList.remove("keyboard-focused")}static onDocumentReady(n){typeof document>"u"||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n,{once:!0}):n())}static guid(){let n=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}static checkWithinContainer(n,t,e){let i={top:!1,right:!1,bottom:!1,left:!1},s=n.getBoundingClientRect(),o=n===document.body?Math.max(s.bottom,window.innerHeight):s.bottom,a=n.scrollLeft,l=n.scrollTop,h=t.left-a,c=t.top-l;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),(c<s.top+e||c<e)&&(i.top=!0),(c+t.height>o-e||c+t.height>window.innerHeight-e)&&(i.bottom=!0),i}static checkPossibleAlignments(n,t,e,i){let s={top:!0,right:!0,bottom:!0,left:!0,spaceOnTop:null,spaceOnRight:null,spaceOnBottom:null,spaceOnLeft:null},o=getComputedStyle(t).overflow==="visible",a=t.getBoundingClientRect(),l=Math.min(a.height,window.innerHeight),h=Math.min(a.width,window.innerWidth),c=n.getBoundingClientRect(),d=t.scrollLeft,m=t.scrollTop,y=e.left-d,g=e.top-m,L=e.top+c.height-m;return s.spaceOnRight=o?window.innerWidth-(c.left+e.width):h-(y+e.width),s.spaceOnRight<0&&(s.left=!1),s.spaceOnLeft=o?c.right-e.width:y-e.width+c.width,s.spaceOnLeft<0&&(s.right=!1),s.spaceOnBottom=o?window.innerHeight-(c.top+e.height+i):l-(g+e.height+i),s.spaceOnBottom<0&&(s.top=!1),s.spaceOnTop=o?c.bottom-(e.height+i):L-(e.height-i),s.spaceOnTop<0&&(s.bottom=!1),s}static getIdFromTrigger(n){let t=n.dataset.target;return t||(t=n.getAttribute("href"),t?t.slice(1):"")}static getDocumentScrollTop(){return window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0}static getDocumentScrollLeft(){return window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft||0}static throttle(n,t,e={}){let i=null,s,o=null,a=0,l=()=>{a=e?.leading===!1?0:Date.now(),o=null,s=n(...i??[]),i=null};return(...h)=>{let c=Date.now();!a&&e?.leading===!1&&(a=c);let d=t-(c-a);return i=h,d<=0?(clearTimeout(o),o=null,a=c,i=null,s=n(...h)):!o&&e?.trailing!==!1&&(o=setTimeout(l,d)),s}}static createConfirmationContainer(n,t,e,i,s){let o=document.createElement("div");o.classList.add("confirmation-btns"),n.append(o),this.createButton(o,e,["btn-cancel"],!0,s),this.createButton(o,t,["btn-confirm"],!0,i)}static createButton(n,t,e=[],i=!0,s=null){e=e.concat(["btn","waves-effect","text"]);let o=document.createElement("button");o.className=e.join(" "),o.style.visibility=i?"visible":"hidden",o.type="button",o.tabIndex=i?0:-1,o.innerText=t,typeof s=="function"&&(o.addEventListener("click",s),o.addEventListener("keypress",a=>{w.keys.ENTER.includes(a.key)&&s(a)})),n.append(o)}static _setAbsolutePosition(n,t,e,i,s,o="center"){let a=n.offsetHeight,l=n.offsetWidth,h=t.offsetHeight,c=t.offsetWidth,d=n.getBoundingClientRect(),m=0,y=0,g=d.top+w.getDocumentScrollTop(),L=d.left+w.getDocumentScrollLeft();e==="top"?(g+=-h-i,o==="center"&&(L+=l/2-c/2),y=-s):e==="right"?(g+=a/2-h/2,L=l+i,m=s):e==="left"?(g+=a/2-h/2,L=-c-i,m=-s):(g+=a+i,o==="center"&&(L+=l/2-c/2),y=s),o==="right"&&(L+=l-c-i);let b=w._repositionWithinScreen(L,g,c,h,i,s,o);return t.style.top=b.y+"px",t.style.left=b.x+"px",{x:m,y}}static _repositionWithinScreen(n,t,e,i,s,o,a){let l=w.getDocumentScrollLeft(),h=w.getDocumentScrollTop(),c=n-l,d=t-h,m={left:c,top:d,width:e,height:i},y;a==="left"||a=="center"?y=s+o:a==="right"&&(y=s-o);let g=w.checkWithinContainer(document.body,m,y);return g.left?c=y:g.right&&(c-=c+e-window.innerWidth),g.top?d=y:g.bottom&&(d-=d+i-window.innerHeight),{x:c+l,y:d+h}}};w.tabPressed=!1,w.keyDown=!1,w.keys={TAB:["Tab"],ENTER:["Enter"],ESC:["Escape","Esc"],BACKSPACE:["Backspace"],ARROW_UP:["ArrowUp","Up"],ARROW_DOWN:["ArrowDown","Down"],ARROW_LEFT:["ArrowLeft","Left"],ARROW_RIGHT:["ArrowRight","Right"],DELETE:["Delete","Del"]},w._navigationKeys=new Set([...w.keys.TAB,...w.keys.ARROW_DOWN,...w.keys.ARROW_UP]);var r=w;var f=class{constructor(n,t,e){n instanceof HTMLElement||console.error(Error(n+" is not an HTML Element"));let i=e.getInstance(n);i&&i.destroy(),this.el=n}static init(n,t,e){let i=null;if(n instanceof Element)i=new e(n,t);else if(n&&n.length){i=[];for(let s=0;s<n.length;s++)i.push(new e(n[s],t))}return i}static get defaults(){return{}}static getInstance(n){throw new Error("This method must be implemented.")}destroy(){throw new Error("This method must be implemented.")}};var Nt={onOpen:null,onClose:null,inDuration:225,outDuration:300},Mt=".card, article:has(> aside), article:has(.card-reveal)",W=class u extends f{constructor(t,e){super(t,e,u);this.isOpen=!1;this._setupEventHandlers=()=>{this._activators.forEach(t=>{t.addEventListener("click",this._handleClickInteraction),t.addEventListener("keypress",this._handleKeypressEvent)})};this._removeEventHandlers=()=>{this._activators.forEach(t=>{t.removeEventListener("click",this._handleClickInteraction),t.removeEventListener("keypress",this._handleKeypressEvent)})};this._handleClickInteraction=()=>{this._handleRevealEvent()};this._handleKeypressEvent=t=>{r.keys.ENTER.includes(t.key)&&this._handleRevealEvent()};this._handleRevealEvent=()=>{this._activators.forEach(t=>t.tabIndex=-1),this.open()};this._setupRevealCloseEventHandlers=()=>{this.cardRevealClose.addEventListener("click",this.close),this.cardRevealClose.addEventListener("keypress",this._handleKeypressCloseEvent)};this._removeRevealCloseEventHandlers=()=>{this.cardRevealClose.removeEventListener("click",this.close),this.cardRevealClose.removeEventListener("keypress",this._handleKeypressCloseEvent)};this._handleKeypressCloseEvent=t=>{r.keys.ENTER.includes(t.key)&&this.close()};this.open=()=>{this.isOpen||(this.isOpen=!0,this.el.style.overflow="hidden",this.cardReveal.style.display="block",this.cardReveal.ariaExpanded="true",this.cardRevealClose&&(this.cardRevealClose.tabIndex=0),setTimeout(()=>{this.cardReveal.style.transition=`transform ${this.options.outDuration}ms ease`,this.cardReveal.style.transform="translateY(-100%)"},1),typeof this.options.onOpen=="function"&&this.options.onOpen.call(this),this.cardRevealClose&&this._setupRevealCloseEventHandlers())};this.close=()=>{this.isOpen&&(this.isOpen=!1,this.cardReveal.style.transition=`transform ${this.options.inDuration}ms ease`,this.cardReveal.style.transform="translateY(0)",setTimeout(()=>{this.cardReveal.style.display="none",this.cardReveal.ariaExpanded="false",this._activators.forEach(t=>t.tabIndex=0),this.cardRevealClose&&(this.cardRevealClose.tabIndex=-1),this.el.style.overflow=this.initialOverflow},this.options.inDuration),typeof this.options.onClose=="function"&&this.options.onClose.call(this),this.cardRevealClose&&this._removeRevealCloseEventHandlers())};this.el.Expressive_Cards=this,this.options={...u.defaults,...e},this._activators=[],this.cardReveal=this.el.querySelector(":scope > aside, .card-reveal"),this.cardReveal&&(this.initialOverflow=getComputedStyle(this.el).overflow,this._activators=Array.from(this.el.querySelectorAll(".activator")),this._activators.forEach(i=>{i&&(i.tabIndex=0)}),this.cardRevealClose=this.cardReveal.querySelector(".card-title, :scope > :is(h1, h2, h3, h4, h5, h6)"),this.cardRevealClose&&(this.cardRevealClose.tabIndex=-1),this.cardReveal.ariaExpanded="false",this._setupEventHandlers())}static get defaults(){return Nt}static init(t,e){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Cards}destroy(){this._removeEventHandlers(),this.cardRevealClose&&this._removeRevealCloseEventHandlers(),this._activators=[],this.el.Expressive_Cards=void 0}static Init(){r.onDocumentReady(()=>{document.querySelectorAll(Mt).forEach(e=>{e&&e.Expressive_Cards==null&&this.init(e)})})}};var $t={alignment:"left",autoFocus:!0,constrainWidth:!0,container:null,coverTrigger:!0,closeOnClick:!0,hover:!1,inDuration:150,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,onItemClick:null},P=class P extends f{constructor(t,e){super(t,e,P);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=!!e.closest(".dropdown-content, menu"),s=!1,o=e.closest(".dropdown-trigger");o&&o.Expressive_Dropdown&&o.Expressive_Dropdown.isOpen&&(s=!0),!s&&!i&&this.close()};this._handleDocumentClick=t=>{let e=t.target;this.options.closeOnClick&&e.closest(".dropdown-content, menu")&&!this.isTouchMoving?this.close():e.closest(".dropdown-content, menu")||setTimeout(()=>{this.isOpen&&this.close()},0),this.isTouchMoving=!1};this._handleTriggerKeydown=t=>{(r.keys.ARROW_DOWN.includes(t.key)||r.keys.ENTER.includes(t.key))&&!this.isOpen&&(t.preventDefault(),this.open())};this._handleDocumentTouchmove=t=>{t.target.closest(".dropdown-content, menu")&&(this.isTouchMoving=!0)};this._handleDropdownClick=t=>{if(typeof this.options.onItemClick=="function"){let e=t.target.closest("li");this.options.onItemClick.call(this,e)}};this._handleDropdownKeydown=t=>{let e=r.keys.ARROW_DOWN.includes(t.key)||r.keys.ARROW_UP.includes(t.key);if(r.keys.TAB.includes(t.key))t.preventDefault(),this.close();else if(e&&this.isOpen){t.preventDefault();let a=r.keys.ARROW_DOWN.includes(t.key)?1:-1,l=this.focusedIndex,h=!1;do if(l=l+a,this.dropdownEl.children[l]&&this.dropdownEl.children[l].tabIndex!==-1){h=!0;break}while(l<this.dropdownEl.children.length&&l>=0);h&&(this.focusedIndex>=0&&this.dropdownEl.children[this.focusedIndex].classList.remove("active"),this.focusedIndex=l,this._focusFocusedItem())}else if(r.keys.ENTER.includes(t.key)&&this.isOpen){let a=this.dropdownEl.children[this.focusedIndex],l=a?.querySelector("a, button");l?l.click():a&&a instanceof HTMLElement&&a.click()}else r.keys.ESC.includes(t.key)&&this.isOpen&&(t.preventDefault(),this.close());let i=t.key.toLowerCase(),s=/[a-zA-Z0-9-_]/.test(i),o=[...r.keys.ARROW_DOWN,...r.keys.ARROW_UP,...r.keys.ENTER,...r.keys.ESC,...r.keys.TAB];if(s&&!o.includes(t.key)){this.filterQuery.push(i);let a=this.filterQuery.join(""),l=Array.from(this.dropdownEl.querySelectorAll("li")).find(h=>h.textContent.trim().toLowerCase().indexOf(a)===0);l&&(this.focusedIndex=[...l.parentNode.children].indexOf(l),this._focusFocusedItem())}clearTimeout(this.filterTimeout),this.filterTimeout=setTimeout(this._resetFilterQuery,1e3)};this._handleWindowResize=()=>{this.el.offsetParent&&this.recalculateDimensions()};this._resetFilterQuery=()=>{this.filterQuery=[]};this.open=()=>{this.isOpen||(this.isOpen=!0,typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),this._resetDropdownStyles(),this.dropdownEl.style.display="block",this._placeDropdown(),this._animateIn(),setTimeout(()=>this._setupTemporaryEventHandlers(),0),this.el.ariaExpanded="true")};this.close=()=>{this.isOpen&&(this.isOpen=!1,this.focusedIndex=-1,typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),this._animateOut(),this._removeTemporaryEventHandlers(),this.options.autoFocus&&this.el.focus(),this.el.ariaExpanded="false")};this.recalculateDimensions=()=>{this.isOpen&&(this._resetDropdownPositioningStyles(),this._placeDropdown())};this.el.Expressive_Dropdown=this,P._dropdowns.push(this),this.id=r.getIdFromTrigger(t),this.dropdownEl=document.getElementById(this.id),this.dropdownEl?.classList.add("dropdown-content"),this.options={...P.defaults,...e},this.isOpen=!1,this.isScrollable=!1,this.isTouchMoving=!1,this.focusedIndex=-1,this.filterQuery=[],this.el.ariaExpanded="false",this._moveDropdownToElement(),this._makeDropdownFocusable(),this._setupEventHandlers()}static get defaults(){return $t}static init(t,e={}){return super.init(t,e,P)}static getInstance(t){return t.Expressive_Dropdown}destroy(){clearTimeout(this.filterTimeout),this._resetDropdownStyles(),this._removeEventHandlers(),this._removeTemporaryEventHandlers();let t=P._dropdowns.indexOf(this);t>=0&&P._dropdowns.splice(t,1),this.el.Expressive_Dropdown=void 0}_setupEventHandlers(){this.el.addEventListener("keydown",this._handleTriggerKeydown),this.dropdownEl?.addEventListener("click",this._handleDropdownClick),this.options.hover?(this.el.addEventListener("mouseenter",this._handleMouseEnter),this.el.addEventListener("mouseleave",this._handleMouseLeave),this.dropdownEl.addEventListener("mouseleave",this._handleMouseLeave)):this.el.addEventListener("click",this._handleClick)}_removeEventHandlers(){this.el.removeEventListener("keydown",this._handleTriggerKeydown),this.dropdownEl?.removeEventListener("click",this._handleDropdownClick),this.options.hover?(this.el.removeEventListener("mouseenter",this._handleMouseEnter),this.el.removeEventListener("mouseleave",this._handleMouseLeave),this.dropdownEl?.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.dropdownEl?.addEventListener("keydown",this._handleDropdownKeydown),window.addEventListener("resize",this._handleWindowResize)}_removeTemporaryEventHandlers(){document.body.removeEventListener("click",this._handleDocumentClick),document.body.removeEventListener("touchmove",this._handleDocumentTouchmove),this.dropdownEl?.removeEventListener("keydown",this._handleDropdownKeydown),window.removeEventListener("resize",this._handleWindowResize)}_resetDropdownStyles(){this.dropdownEl.style.display="",this._resetDropdownPositioningStyles(),this.dropdownEl.style.transform="",this.dropdownEl.style.opacity=""}_resetDropdownPositioningStyles(){this.dropdownEl.style.width="",this.dropdownEl.style.height="",this.dropdownEl.style.left="",this.dropdownEl.style.top="",this.dropdownEl.style.transformOrigin=""}_moveDropdownToElement(t=null){if(this.options.container){this.options.container.append(this.dropdownEl);return}if(t){t.contains(this.dropdownEl)||t.append(this.dropdownEl);return}this.el.after(this.dropdownEl)}_makeDropdownFocusable(){this.dropdownEl&&(this.dropdownEl.popover="",this.dropdownEl.tabIndex=0,Array.from(this.dropdownEl.children).forEach(t=>{if(t instanceof HTMLHRElement||t.classList.contains("divider")){t.setAttribute("tabindex","-1");return}t.getAttribute("tabindex")||t.setAttribute("tabindex","0")}))}_focusFocusedItem(){this.focusedIndex>=0&&this.focusedIndex<this.dropdownEl.children.length&&this.options.autoFocus&&(this.dropdownEl.children[this.focusedIndex].focus({preventScroll:!0}),this.dropdownEl.children[this.focusedIndex].scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}))}_getDropdownPosition(t){let e=this.el.getBoundingClientRect(),i=this.dropdownEl.getBoundingClientRect(),s=i.height,o=i.width,a=e.left-i.left,l=e.top-i.top,h={left:a,top:l,height:s,width:o},c=r.checkPossibleAlignments(this.el,t,h,this.options.coverTrigger?0:e.height),d="top",m=this.options.alignment;if(l+=this.options.coverTrigger?0:e.height,this.isScrollable=!1,c.top||(c.bottom?(d="bottom",this.options.coverTrigger||(l-=e.height)):(this.isScrollable=!0,s-=20,c.spaceOnTop>c.spaceOnBottom?(d="bottom",s+=c.spaceOnTop,l-=this.options.coverTrigger?c.spaceOnTop-20:c.spaceOnTop-20+e.height):s+=c.spaceOnBottom)),!c[m]){let y=m==="left"?"right":"left";c[y]?m=y:c.spaceOnLeft>c.spaceOnRight?(m="right",o+=c.spaceOnLeft,a-=c.spaceOnLeft):(m="left",o+=c.spaceOnRight)}return d==="bottom"&&(l=l-i.height+(this.options.coverTrigger?e.height:0)),m==="right"&&(a=a-i.width+e.width),{x:a,y:l,verticalAlignment:d,horizontalAlignment:m,height:s,width:o}}_animateIn(){let t=this.options.inDuration;this.dropdownEl.style.transition="none",this.dropdownEl.style.opacity="0",this.dropdownEl.style.transform="scale(0.3, 0.3)",setTimeout(()=>{this.dropdownEl.style.transition=`opacity ${t}ms ease, transform ${t}ms ease`,this.dropdownEl.style.opacity="1",this.dropdownEl.style.transform="scale(1, 1)"},1),setTimeout(()=>{this.options.autoFocus&&this.dropdownEl.focus(),typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,this.el)},t)}_animateOut(){let t=this.options.outDuration;this.dropdownEl.style.transition=`opacity ${t}ms ease, transform ${t}ms ease`,this.dropdownEl.style.opacity="0",this.dropdownEl.style.transform="scale(0.3, 0.3)",setTimeout(()=>{this._resetDropdownStyles(),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(e(i))return i;i=i.parentElement}return null}_placeDropdown(){let t=this._getClosestAncestor(this.dropdownEl,s=>!["HTML","BODY"].includes(s.tagName)&&getComputedStyle(s).overflow!=="visible");t||(t=this.dropdownEl.offsetParent?this.dropdownEl.offsetParent:this.dropdownEl.parentNode),getComputedStyle(t).position==="static"&&(t.style.position="relative");let e=this.options.constrainWidth?this.el.getBoundingClientRect().width:this.dropdownEl.getBoundingClientRect().width;this.dropdownEl.style.width=e+"px";let i=this._getDropdownPosition(t);this.dropdownEl.style.left=i.x+"px",this.dropdownEl.style.top=i.y+"px",this.dropdownEl.style.height=i.height+"px",this.dropdownEl.style.width=i.width+"px",this.dropdownEl.style.transformOrigin=`${i.horizontalAlignment==="left"?"0":"100%"} ${i.verticalAlignment==="top"?"0":"100%"}`}};P._dropdowns=[];var A=P;var qt={data:[],onAutocomplete:null,dropdownOptions:{autoFocus:!1,closeOnClick:!1,coverTrigger:!1},minLength:1,isMultiSelect:!1,onSearch:(u,n)=>{let t=u.toLocaleLowerCase();n.setMenuItems(n.options.data.filter(e=>e.id.toString().toLocaleLowerCase().includes(t)||e.text?.toLocaleLowerCase().includes(t)))},maxDropDownHeight:"300px",allowUnsafeHTML:!1,selected:[]},H=class H extends f{constructor(t,e){super(t,e,H);this._handleInputBlur=()=>{this._mousedown||(this.close(),this._resetAutocomplete())};this._handleInputKeyup=t=>{t.type==="keyup"&&(H._keydown=!1),this.count=0;let e=this.el.value.toLocaleLowerCase();r.keys.ENTER.includes(t.key)||r.keys.ARROW_UP.includes(t.key)||r.keys.ARROW_DOWN.includes(t.key)||(this.oldVal!==e&&r.tabPressed&&this.open(),this._inputChangeDetection(e))};this._handleInputFocus=()=>{this.count=0;let t=this.el.value.toLocaleLowerCase();this._inputChangeDetection(t)};this._inputChangeDetection=t=>{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=>{H._keydown=!0;let e=this.container.querySelectorAll("li").length;if(r.keys.ENTER.includes(t.key)&&this.activeIndex>=0){let i=this.container.querySelectorAll("li")[this.activeIndex];i&&(this.selectOption(i.getAttribute("data-id")),t.preventDefault());return}(r.keys.ARROW_UP.includes(t.key)||r.keys.ARROW_DOWN.includes(t.key))&&(t.preventDefault(),r.keys.ARROW_UP.includes(t.key)&&this.activeIndex>0&&this.activeIndex--,r.keys.ARROW_DOWN.includes(t.key)&&this.activeIndex<e-1&&this.activeIndex++,this.$active?.classList.remove("active"),this.activeIndex>=0&&(this.$active=this.container.querySelectorAll("li")[this.activeIndex],this.$active?.classList.add("active"),this.container.children[this.activeIndex].scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})))};this._handleInputClick=()=>{this.open()};this._handleContainerMousedownAndTouchstart=()=>{this._mousedown=!0};this._handleContainerMouseupAndTouchend=()=>{this._mousedown=!1};this.open=()=>{let t=this.el.value.toLocaleLowerCase();this._resetAutocomplete(),t.length>=this.options.minLength&&(this.isOpen=!0,this._renderDropdown()),this.dropdown.isOpen?this.dropdown.recalculateDimensions():setTimeout(()=>{this.dropdown.open()},0)};this.close=()=>{this.dropdown.close()};this.el.Expressive_Autocomplete=this,this.options={...H.defaults,...e},this.isOpen=!1,this.count=0,this.activeIndex=-1,this.oldVal="",this.selectedValues=this.selectedValues||this.options.selected.map(i=>({id:i}))||[],this.menuItems=this.options.data||[],this.$active=null,this._mousedown=!1,this._setupDropdown(),this._setupEventHandlers()}static get defaults(){return qt}static init(t,e={}){return super.init(t,e,H)}static getInstance(t){return t.Expressive_Autocomplete}static _loadingIndicator(){if(!H._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 ft=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var Et=u=>{throw TypeError(u)};var Wt=(u,n)=>{for(var t in n)ft(u,t,{get:n[t],enumerable:!0})},Ft=(u,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Rt(n))!Bt.call(u,i)&&i!==t&&ft(u,i,{get:()=>n[i],enumerable:!(e=Pt(n,i))||e.enumerable});return u};var Vt=u=>Ft(ft({},"__esModule",{value:!0}),u);var Nt=(u,n,t)=>n.has(u)||Et("Cannot "+t);var _t=(u,n,t)=>n.has(u)?Et("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(u):n.set(u,t);var yt=(u,n,t)=>(Nt(u,n,"access private method"),t);var fe={};Wt(fe,{AutoInit:()=>Lt,Autocomplete:()=>B,Cards:()=>R,Carousel:()=>F,CharacterCounter:()=>ct,Chips:()=>W,Collapsible:()=>Y,Datepicker:()=>U,Dialogs:()=>$,Dropdown:()=>S,FloatingActionButton:()=>X,FormSelect:()=>H,Forms:()=>q,Lightbox:()=>j,Modal:()=>Z,Parallax:()=>Q,Pushpin:()=>J,Range:()=>N,ScrollSpy:()=>tt,Sidenav:()=>et,Slider:()=>dt,Tabs:()=>it,TapTarget:()=>st,Timepicker:()=>nt,Toast:()=>pt,Tooltip:()=>ot,Waves:()=>K,version:()=>me});var b=class b{static docHandleKeydown(n){b.keyDown=!0,b._navigationKeys.has(n.key)&&(b.tabPressed=!0)}static docHandleKeyup(n){b.keyDown=!1,b._navigationKeys.has(n.key)&&(b.tabPressed=!1)}static docHandleFocus(n){b.keyDown&&document.body.classList.add("keyboard-focused")}static docHandleBlur(n){document.body.classList.remove("keyboard-focused")}static onDocumentReady(n){typeof document>"u"||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n,{once:!0}):n())}static guid(){let n=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}static checkWithinContainer(n,t,e){let i={top:!1,right:!1,bottom:!1,left:!1},s=n.getBoundingClientRect(),o=n===document.body?Math.max(s.bottom,window.innerHeight):s.bottom,a=n.scrollLeft,l=n.scrollTop,h=t.left-a,d=t.top-l;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),(d<s.top+e||d<e)&&(i.top=!0),(d+t.height>o-e||d+t.height>window.innerHeight-e)&&(i.bottom=!0),i}static checkPossibleAlignments(n,t,e,i){let s={top:!0,right:!0,bottom:!0,left:!0,spaceOnTop:null,spaceOnRight:null,spaceOnBottom:null,spaceOnLeft:null},o=getComputedStyle(t).overflow==="visible",a=t.getBoundingClientRect(),l=Math.min(a.height,window.innerHeight),h=Math.min(a.width,window.innerWidth),d=n.getBoundingClientRect(),c=t.scrollLeft,m=t.scrollTop,g=e.left-c,E=e.top-m,T=e.top+d.height-m;return s.spaceOnRight=o?window.innerWidth-(d.left+e.width):h-(g+e.width),s.spaceOnRight<0&&(s.left=!1),s.spaceOnLeft=o?d.right-e.width:g-e.width+d.width,s.spaceOnLeft<0&&(s.right=!1),s.spaceOnBottom=o?window.innerHeight-(d.top+e.height+i):l-(E+e.height+i),s.spaceOnBottom<0&&(s.top=!1),s.spaceOnTop=o?d.bottom-(e.height+i):T-(e.height-i),s.spaceOnTop<0&&(s.bottom=!1),s}static getIdFromTrigger(n){let t=n.dataset.target;return t||(t=n.getAttribute("href"),t?t.slice(1):"")}static getDocumentScrollTop(){return window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0}static getDocumentScrollLeft(){return window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft||0}static throttle(n,t,e={}){let i=null,s,o=null,a=0,l=()=>{a=e?.leading===!1?0:Date.now(),o=null,s=n(...i??[]),i=null};return(...h)=>{let d=Date.now();!a&&e?.leading===!1&&(a=d);let c=t-(d-a);return i=h,c<=0?(clearTimeout(o),o=null,a=d,i=null,s=n(...h)):!o&&e?.trailing!==!1&&(o=setTimeout(l,c)),s}}static createConfirmationContainer(n,t,e,i,s){let o=document.createElement("div");o.classList.add("confirmation-btns"),n.append(o),this.createButton(o,e,["btn-cancel"],!0,s),this.createButton(o,t,["btn-confirm"],!0,i)}static createButton(n,t,e=[],i=!0,s=null){e=e.concat(["btn","waves-effect","text"]);let o=document.createElement("button");o.className=e.join(" "),o.style.visibility=i?"visible":"hidden",o.type="button",o.tabIndex=i?0:-1,o.innerText=t,typeof s=="function"&&(o.addEventListener("click",s),o.addEventListener("keypress",a=>{b.keys.ENTER.includes(a.key)&&s(a)})),n.append(o)}static _setAbsolutePosition(n,t,e,i,s,o="center"){let a=n.offsetHeight,l=n.offsetWidth,h=t.offsetHeight,d=t.offsetWidth,c=n.getBoundingClientRect(),m=0,g=0,E=c.top+b.getDocumentScrollTop(),T=c.left+b.getDocumentScrollLeft();e==="top"?(E+=-h-i,o==="center"&&(T+=l/2-d/2),g=-s):e==="right"?(E+=a/2-h/2,T=l+i,m=s):e==="left"?(E+=a/2-h/2,T=-d-i,m=-s):(E+=a+i,o==="center"&&(T+=l/2-d/2),g=s),o==="right"&&(T+=l-d-i);let x=b._repositionWithinScreen(T,E,d,h,i,s,o);return t.style.top=x.y+"px",t.style.left=x.x+"px",{x:m,y:g}}static _repositionWithinScreen(n,t,e,i,s,o,a){let l=b.getDocumentScrollLeft(),h=b.getDocumentScrollTop(),d=n-l,c=t-h,m={left:d,top:c,width:e,height:i},g;a==="left"||a=="center"?g=s+o:a==="right"&&(g=s-o);let E=b.checkWithinContainer(document.body,m,g);return E.left?d=g:E.right&&(d-=d+e-window.innerWidth),E.top?c=g:E.bottom&&(c-=c+i-window.innerHeight),{x:d+l,y:c+h}}};b.tabPressed=!1,b.keyDown=!1,b.keys={TAB:["Tab"],ENTER:["Enter"],ESC:["Escape","Esc"],BACKSPACE:["Backspace"],ARROW_UP:["ArrowUp","Up"],ARROW_DOWN:["ArrowDown","Down"],ARROW_LEFT:["ArrowLeft","Left"],ARROW_RIGHT:["ArrowRight","Right"],DELETE:["Delete","Del"]},b._navigationKeys=new Set([...b.keys.TAB,...b.keys.ARROW_DOWN,...b.keys.ARROW_UP]);var r=b;var f=class{constructor(n,t,e){n instanceof HTMLElement||console.error(Error(n+" is not an HTML Element"));let i=e.getInstance(n);i&&i.destroy(),this.el=n}static init(n,t,e){let i=null;if(n instanceof Element)i=new e(n,t);else if(n&&n.length){i=[];for(let s=0;s<n.length;s++)i.push(new e(n[s],t))}return i}static get defaults(){return{}}static getInstance(n){throw new Error("This method must be implemented.")}destroy(){throw new Error("This method must be implemented.")}};var $t={onOpen:null,onClose:null,inDuration:225,outDuration:300},vt=".card, article:has(> aside), article:has(.card-reveal)",R=class u extends f{constructor(t,e){super(t,e,u);this.isOpen=!1;this._setupEventHandlers=()=>{this._activators.forEach(t=>{t.addEventListener("click",this._handleClickInteraction),t.addEventListener("keypress",this._handleKeypressEvent)})};this._removeEventHandlers=()=>{this._activators.forEach(t=>{t.removeEventListener("click",this._handleClickInteraction),t.removeEventListener("keypress",this._handleKeypressEvent)})};this._handleClickInteraction=()=>{this._handleRevealEvent()};this._handleKeypressEvent=t=>{r.keys.ENTER.includes(t.key)&&this._handleRevealEvent()};this._handleRevealEvent=()=>{this._activators.forEach(t=>t.tabIndex=-1),this.open()};this._setupRevealCloseEventHandlers=()=>{this.cardRevealClose.addEventListener("click",this.close),this.cardRevealClose.addEventListener("keypress",this._handleKeypressCloseEvent)};this._removeRevealCloseEventHandlers=()=>{this.cardRevealClose.removeEventListener("click",this.close),this.cardRevealClose.removeEventListener("keypress",this._handleKeypressCloseEvent)};this._handleKeypressCloseEvent=t=>{r.keys.ENTER.includes(t.key)&&this.close()};this.open=()=>{this.isOpen||(this.isOpen=!0,this.el.style.overflow="hidden",this.cardReveal.style.display="block",this.cardReveal.ariaExpanded="true",this.cardRevealClose&&(this.cardRevealClose.tabIndex=0),setTimeout(()=>{this.cardReveal.style.transition=`transform ${this.options.outDuration}ms ease`,this.cardReveal.style.transform="translateY(-100%)"},1),typeof this.options.onOpen=="function"&&this.options.onOpen.call(this),this.cardRevealClose&&this._setupRevealCloseEventHandlers())};this.close=()=>{this.isOpen&&(this.isOpen=!1,this.cardReveal.style.transition=`transform ${this.options.inDuration}ms ease`,this.cardReveal.style.transform="translateY(0)",setTimeout(()=>{this.cardReveal.style.display="none",this.cardReveal.ariaExpanded="false",this._activators.forEach(t=>t.tabIndex=0),this.cardRevealClose&&(this.cardRevealClose.tabIndex=-1),this.el.style.overflow=this.initialOverflow},this.options.inDuration),typeof this.options.onClose=="function"&&this.options.onClose.call(this),this.cardRevealClose&&this._removeRevealCloseEventHandlers())};this.el.Expressive_Cards=this,this.options={...u.defaults,...e},this._activators=[],this.cardReveal=this.el.querySelector(":scope > aside, .card-reveal"),this.cardReveal&&(this.initialOverflow=getComputedStyle(this.el).overflow,this._activators=Array.from(this.el.querySelectorAll(".activator")),this._activators.forEach(i=>{i&&(i.tabIndex=0)}),this.cardRevealClose=this.cardReveal.querySelector(".card-title, :scope > :is(h1, h2, h3, h4, h5, h6)"),this.cardRevealClose&&(this.cardRevealClose.tabIndex=-1),this.cardReveal.ariaExpanded="false",this._setupEventHandlers())}static get defaults(){return $t}static init(t,e){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Cards}destroy(){this._removeEventHandlers(),this.cardRevealClose&&this._removeRevealCloseEventHandlers(),this._activators=[],this.el.Expressive_Cards=void 0}static Init(){r.onDocumentReady(()=>{document.querySelectorAll(vt).forEach(e=>{e&&e.Expressive_Cards==null&&this.init(e)})})}};var qt={alignment:"left",autoFocus:!0,constrainWidth:!0,container:null,coverTrigger:!0,closeOnClick:!0,hover:!1,inDuration:150,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,onItemClick:null},P=class P extends f{constructor(t,e){super(t,e,P);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=!!e.closest(".dropdown-content, menu"),s=!1,o=e.closest(".dropdown-trigger");o&&o.Expressive_Dropdown&&o.Expressive_Dropdown.isOpen&&(s=!0),!s&&!i&&this.close()};this._handleDocumentClick=t=>{let e=t.target;this.options.closeOnClick&&e.closest(".dropdown-content, menu")&&!this.isTouchMoving?this.close():e.closest(".dropdown-content, menu")||setTimeout(()=>{this.isOpen&&this.close()},0),this.isTouchMoving=!1};this._handleTriggerKeydown=t=>{(r.keys.ARROW_DOWN.includes(t.key)||r.keys.ENTER.includes(t.key))&&!this.isOpen&&(t.preventDefault(),this.open())};this._handleDocumentTouchmove=t=>{t.target.closest(".dropdown-content, menu")&&(this.isTouchMoving=!0)};this._handleDropdownClick=t=>{if(typeof this.options.onItemClick=="function"){let e=t.target.closest("li");this.options.onItemClick.call(this,e)}};this._handleDropdownKeydown=t=>{let e=r.keys.ARROW_DOWN.includes(t.key)||r.keys.ARROW_UP.includes(t.key);if(r.keys.TAB.includes(t.key))t.preventDefault(),this.close();else if(e&&this.isOpen){t.preventDefault();let a=r.keys.ARROW_DOWN.includes(t.key)?1:-1,l=this.focusedIndex,h=!1;do if(l=l+a,this.dropdownEl.children[l]&&this.dropdownEl.children[l].tabIndex!==-1){h=!0;break}while(l<this.dropdownEl.children.length&&l>=0);h&&(this.focusedIndex>=0&&this.dropdownEl.children[this.focusedIndex].classList.remove("active"),this.focusedIndex=l,this._focusFocusedItem())}else if(r.keys.ENTER.includes(t.key)&&this.isOpen){let a=this.dropdownEl.children[this.focusedIndex],l=a?.querySelector("a, button");l?l.click():a&&a instanceof HTMLElement&&a.click()}else r.keys.ESC.includes(t.key)&&this.isOpen&&(t.preventDefault(),this.close());let i=t.key.toLowerCase(),s=/[a-zA-Z0-9-_]/.test(i),o=[...r.keys.ARROW_DOWN,...r.keys.ARROW_UP,...r.keys.ENTER,...r.keys.ESC,...r.keys.TAB];if(s&&!o.includes(t.key)){this.filterQuery.push(i);let a=this.filterQuery.join(""),l=Array.from(this.dropdownEl.querySelectorAll("li")).find(h=>h.textContent.trim().toLowerCase().indexOf(a)===0);l&&(this.focusedIndex=[...l.parentNode.children].indexOf(l),this._focusFocusedItem())}clearTimeout(this.filterTimeout),this.filterTimeout=setTimeout(this._resetFilterQuery,1e3)};this._handleWindowResize=()=>{this.el.offsetParent&&this.recalculateDimensions()};this._resetFilterQuery=()=>{this.filterQuery=[]};this.open=()=>{this.isOpen||(this.isOpen=!0,typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),this._resetDropdownStyles(),this.dropdownEl.style.display="block",this._placeDropdown(),this._animateIn(),setTimeout(()=>this._setupTemporaryEventHandlers(),0),this.el.ariaExpanded="true")};this.close=()=>{this.isOpen&&(this.isOpen=!1,this.focusedIndex=-1,typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),this._animateOut(),this._removeTemporaryEventHandlers(),this.options.autoFocus&&this.el.focus(),this.el.ariaExpanded="false")};this.recalculateDimensions=()=>{this.isOpen&&(this._resetDropdownPositioningStyles(),this._placeDropdown())};this.el.Expressive_Dropdown=this,P._dropdowns.push(this),this.id=r.getIdFromTrigger(t),this.dropdownEl=document.getElementById(this.id),this.dropdownEl?.classList.add("dropdown-content"),this.options={...P.defaults,...e},this.isOpen=!1,this.isScrollable=!1,this.isTouchMoving=!1,this.focusedIndex=-1,this.filterQuery=[],this.el.ariaExpanded="false",this._moveDropdownToElement(),this._makeDropdownFocusable(),this._setupEventHandlers()}static get defaults(){return qt}static init(t,e={}){return super.init(t,e,P)}static getInstance(t){return t.Expressive_Dropdown}destroy(){clearTimeout(this.filterTimeout),this._resetDropdownStyles(),this._removeEventHandlers(),this._removeTemporaryEventHandlers();let t=P._dropdowns.indexOf(this);t>=0&&P._dropdowns.splice(t,1),this.el.Expressive_Dropdown=void 0}_setupEventHandlers(){this.el.addEventListener("keydown",this._handleTriggerKeydown),this.dropdownEl?.addEventListener("click",this._handleDropdownClick),this.options.hover?(this.el.addEventListener("mouseenter",this._handleMouseEnter),this.el.addEventListener("mouseleave",this._handleMouseLeave),this.dropdownEl.addEventListener("mouseleave",this._handleMouseLeave)):this.el.addEventListener("click",this._handleClick)}_removeEventHandlers(){this.el.removeEventListener("keydown",this._handleTriggerKeydown),this.dropdownEl?.removeEventListener("click",this._handleDropdownClick),this.options.hover?(this.el.removeEventListener("mouseenter",this._handleMouseEnter),this.el.removeEventListener("mouseleave",this._handleMouseLeave),this.dropdownEl?.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.dropdownEl?.addEventListener("keydown",this._handleDropdownKeydown),window.addEventListener("resize",this._handleWindowResize)}_removeTemporaryEventHandlers(){document.body.removeEventListener("click",this._handleDocumentClick),document.body.removeEventListener("touchmove",this._handleDocumentTouchmove),this.dropdownEl?.removeEventListener("keydown",this._handleDropdownKeydown),window.removeEventListener("resize",this._handleWindowResize)}_resetDropdownStyles(){this.dropdownEl.style.display="",this._resetDropdownPositioningStyles(),this.dropdownEl.style.transform="",this.dropdownEl.style.opacity=""}_resetDropdownPositioningStyles(){this.dropdownEl.style.width="",this.dropdownEl.style.height="",this.dropdownEl.style.left="",this.dropdownEl.style.top="",this.dropdownEl.style.transformOrigin=""}_moveDropdownToElement(t=null){if(this.options.container){this.options.container.append(this.dropdownEl);return}if(t){t.contains(this.dropdownEl)||t.append(this.dropdownEl);return}this.el.after(this.dropdownEl)}_makeDropdownFocusable(){this.dropdownEl&&(this.dropdownEl.popover="",this.dropdownEl.tabIndex=0,Array.from(this.dropdownEl.children).forEach(t=>{if(t instanceof HTMLHRElement||t.classList.contains("divider")){t.setAttribute("tabindex","-1");return}t.getAttribute("tabindex")||t.setAttribute("tabindex","0")}))}_focusFocusedItem(){this.focusedIndex>=0&&this.focusedIndex<this.dropdownEl.children.length&&this.options.autoFocus&&(this.dropdownEl.children[this.focusedIndex].focus({preventScroll:!0}),this.dropdownEl.children[this.focusedIndex].scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}))}_getDropdownPosition(t){let e=this.el.getBoundingClientRect(),i=this.dropdownEl.getBoundingClientRect(),s=i.height,o=i.width,a=e.left-i.left,l=e.top-i.top,h={left:a,top:l,height:s,width:o},d=r.checkPossibleAlignments(this.el,t,h,this.options.coverTrigger?0:e.height),c="top",m=this.options.alignment;if(l+=this.options.coverTrigger?0:e.height,this.isScrollable=!1,d.top||(d.bottom?(c="bottom",this.options.coverTrigger||(l-=e.height)):(this.isScrollable=!0,s-=20,d.spaceOnTop>d.spaceOnBottom?(c="bottom",s+=d.spaceOnTop,l-=this.options.coverTrigger?d.spaceOnTop-20:d.spaceOnTop-20+e.height):s+=d.spaceOnBottom)),!d[m]){let g=m==="left"?"right":"left";d[g]?m=g:d.spaceOnLeft>d.spaceOnRight?(m="right",o+=d.spaceOnLeft,a-=d.spaceOnLeft):(m="left",o+=d.spaceOnRight)}return c==="bottom"&&(l=l-i.height+(this.options.coverTrigger?e.height:0)),m==="right"&&(a=a-i.width+e.width),{x:a,y:l,verticalAlignment:c,horizontalAlignment:m,height:s,width:o}}_animateIn(){let t=this.options.inDuration;this.dropdownEl.style.transition="none",this.dropdownEl.style.opacity="0",this.dropdownEl.style.transform="scale(0.3, 0.3)",setTimeout(()=>{this.dropdownEl.style.transition=`opacity ${t}ms ease, transform ${t}ms ease`,this.dropdownEl.style.opacity="1",this.dropdownEl.style.transform="scale(1, 1)"},1),setTimeout(()=>{this.options.autoFocus&&this.dropdownEl.focus(),typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,this.el)},t)}_animateOut(){let t=this.options.outDuration;this.dropdownEl.style.transition=`opacity ${t}ms ease, transform ${t}ms ease`,this.dropdownEl.style.opacity="0",this.dropdownEl.style.transform="scale(0.3, 0.3)",setTimeout(()=>{this._resetDropdownStyles(),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(e(i))return i;i=i.parentElement}return null}_placeDropdown(){let t=this._getClosestAncestor(this.dropdownEl,s=>!["HTML","BODY"].includes(s.tagName)&&getComputedStyle(s).overflow!=="visible");t||(t=this.dropdownEl.offsetParent?this.dropdownEl.offsetParent:this.dropdownEl.parentNode),getComputedStyle(t).position==="static"&&(t.style.position="relative");let e=this.options.constrainWidth?this.el.getBoundingClientRect().width:this.dropdownEl.getBoundingClientRect().width;this.dropdownEl.style.width=e+"px";let i=this._getDropdownPosition(t);this.dropdownEl.style.left=i.x+"px",this.dropdownEl.style.top=i.y+"px",this.dropdownEl.style.height=i.height+"px",this.dropdownEl.style.width=i.width+"px",this.dropdownEl.style.transformOrigin=`${i.horizontalAlignment==="left"?"0":"100%"} ${i.verticalAlignment==="top"?"0":"100%"}`}};P._dropdowns=[];var S=P;var Kt={data:[],onAutocomplete:null,dropdownOptions:{autoFocus:!1,closeOnClick:!1,coverTrigger:!1},minLength:1,isMultiSelect:!1,onSearch:(u,n)=>{let t=u.toLocaleLowerCase();n.setMenuItems(n.options.data.filter(e=>e.id.toString().toLocaleLowerCase().includes(t)||e.text?.toLocaleLowerCase().includes(t)))},maxDropDownHeight:"300px",allowUnsafeHTML:!1,selected:[]},O=class O extends f{constructor(t,e){super(t,e,O);this._handleInputBlur=()=>{this._mousedown||(this.close(),this._resetAutocomplete())};this._handleInputKeyup=t=>{t.type==="keyup"&&(O._keydown=!1),this.count=0;let e=this.el.value.toLocaleLowerCase();r.keys.ENTER.includes(t.key)||r.keys.ARROW_UP.includes(t.key)||r.keys.ARROW_DOWN.includes(t.key)||(this.oldVal!==e&&r.tabPressed&&this.open(),this._inputChangeDetection(e))};this._handleInputFocus=()=>{this.count=0;let t=this.el.value.toLocaleLowerCase();this._inputChangeDetection(t)};this._inputChangeDetection=t=>{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=>{O._keydown=!0;let e=this.container.querySelectorAll("li").length;if(r.keys.ENTER.includes(t.key)&&this.activeIndex>=0){let i=this.container.querySelectorAll("li")[this.activeIndex];i&&(this.selectOption(i.getAttribute("data-id")),t.preventDefault());return}(r.keys.ARROW_UP.includes(t.key)||r.keys.ARROW_DOWN.includes(t.key))&&(t.preventDefault(),r.keys.ARROW_UP.includes(t.key)&&this.activeIndex>0&&this.activeIndex--,r.keys.ARROW_DOWN.includes(t.key)&&this.activeIndex<e-1&&this.activeIndex++,this.$active?.classList.remove("active"),this.activeIndex>=0&&(this.$active=this.container.querySelectorAll("li")[this.activeIndex],this.$active?.classList.add("active"),this.container.children[this.activeIndex].scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})))};this._handleInputClick=()=>{this.open()};this._handleContainerMousedownAndTouchstart=()=>{this._mousedown=!0};this._handleContainerMouseupAndTouchend=()=>{this._mousedown=!1};this.open=()=>{let t=this.el.value.toLocaleLowerCase();this._resetAutocomplete(),t.length>=this.options.minLength&&(this.isOpen=!0,this._renderDropdown()),this.dropdown.isOpen?this.dropdown.recalculateDimensions():setTimeout(()=>{this.dropdown.open()},0)};this.close=()=>{this.dropdown.close()};this.el.Expressive_Autocomplete=this,this.options={...O.defaults,...e},this.isOpen=!1,this.count=0,this.activeIndex=-1,this.oldVal="",this.selectedValues=this.selectedValues||this.options.selected.map(i=>({id:i}))||[],this.menuItems=this.options.data||[],this.$active=null,this._mousedown=!1,this._setupDropdown(),this._setupEventHandlers()}static get defaults(){return Kt}static init(t,e={}){return super.init(t,e,O)}static getInstance(t){return t.Expressive_Autocomplete}static _loadingIndicator(){if(!O._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>`,H._loadingTemplate=t.content.firstElementChild}return H._loadingTemplate.cloneNode(!0)}destroy(){this._removeEventHandlers(),this._removeDropdown(),this.el.Expressive_Autocomplete=void 0}_setupEventHandlers(){this.el.addEventListener("blur",this._handleInputBlur),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("mousedown",this._handleContainerMousedownAndTouchstart),this.container.addEventListener("mouseup",this._handleContainerMouseupAndTouchend),typeof window.ontouchstart<"u"&&(this.container.addEventListener("touchstart",this._handleContainerMousedownAndTouchstart),this.container.addEventListener("touchend",this._handleContainerMouseupAndTouchend))}_removeEventHandlers(){this.el.removeEventListener("blur",this._handleInputBlur),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("mousedown",this._handleContainerMousedownAndTouchstart),this.container.removeEventListener("mouseup",this._handleContainerMouseupAndTouchend),typeof window.ontouchstart<"u"&&(this.container.removeEventListener("touchstart",this._handleContainerMousedownAndTouchstart),this.container.removeEventListener("touchend",this._handleContainerMouseupAndTouchend))}_setupDropdown(){this.container=document.createElement("ul"),this.container.style.maxHeight=this.options.maxDropDownHeight,this.container.id=`autocomplete-options-${r.guid()}`,this.container.classList.add("autocomplete-content","dropdown-content"),this.container.ariaExpanded="true",this.el.setAttribute("data-target",this.container.id),this.menuItems.forEach(o=>{let a=this._createDropdownItem(o);this.container.append(a)}),this.el.parentElement.appendChild(this.container);let t={...H.defaults.dropdownOptions,...this.options.dropdownOptions},e=t.onItemClick;t.onItemClick=o=>{if(!o)return;let a=o.getAttribute("data-id");this.selectOption(a),e&&typeof e=="function"&&e.call(this.dropdown,this.el)},this.dropdown=A.init(this.el,t);let i=this.el.parentElement.querySelector("label");if(i&&this.el.after(i),this.el.removeEventListener("click",this.dropdown._handleClick),!this.options.isMultiSelect&&this.options.selected.length!==0){let o=this.menuItems.filter(a=>a.id===this.selectedValues[0].id);this.el.value=o[0].text}this.el.value&&this.selectOption(this.el.value);let s=document.createElement("div");s.classList.add("status-info"),s.setAttribute("style","position: absolute;right:0;top:0;"),this.el.parentElement.appendChild(s),this._updateSelectedInfo()}_removeDropdown(){this.container.ariaExpanded="false",this.container.parentNode.removeChild(this.container)}_resetCurrentElementPosition(){this.activeIndex=-1,this.$active?.classList.remove("active")}_resetAutocomplete(){this.container.replaceChildren(),this._resetCurrentElementPosition(),this.oldVal=null,this.isOpen=!1,this._mousedown=!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)]}_createDropdownItem(t){let e=document.createElement("li");if(e.setAttribute("data-id",t.id),e.setAttribute("style","display:grid; grid-auto-flow: column; user-select: none; align-items: center;"),e.tabIndex=0,this.options.isMultiSelect){let h=document.createElement("div");h.classList.add("item-selection"),h.style.textAlign="center";let c=document.createElement("input");c.type="checkbox",c.checked=this.selectedValues.some(m=>m.id===t.id);let d=document.createElement("span");d.style.paddingLeft="21px",h.append(c,d),e.appendChild(h)}if(t.image){let h=document.createElement("img");h.classList.add("circle"),h.src=t.image,e.appendChild(h)}let i=this.el.value.toLocaleLowerCase(),s=this._highlightPartialText(i,(t.text||t.id).toString()),o=document.createElement("div");if(o.setAttribute("style","line-height:1.2;font-weight:500;"),this.options.allowUnsafeHTML)o.innerHTML=s[0]+'<span class="highlight">'+s[1]+"</span>"+s[2];else if(o.appendChild(document.createTextNode(s[0])),s[1]){let h=document.createElement("span");h.textContent=s[1],h.classList.add("highlight"),o.appendChild(h),o.appendChild(document.createTextNode(s[2]))}let a=document.createElement("div");if(a.classList.add("item-text"),a.setAttribute("style","padding:5px;overflow:hidden;"),e.appendChild(a),e.querySelector(".item-text").appendChild(o),typeof t.description=="string"||typeof t.description=="number"&&!isNaN(t.description)){let h=document.createElement("small");h.setAttribute("style","line-height:1.3;color:grey;white-space:nowrap;text-overflow:ellipsis;display:block;width:90%;overflow:hidden;"),h.innerText=t.description,e.querySelector(".item-text").appendChild(h)}let l=()=>this.options.isMultiSelect?t.image?"40px min-content auto":"40px auto":t.image?"min-content auto":"auto";return e.style.gridTemplateColumns=l(),e}_renderDropdown(){this._resetAutocomplete(),this.menuItems.length===0&&(this.menuItems=this.selectedValues);for(let t=0;t<this.menuItems.length;t++){let e=this._createDropdownItem(this.menuItems[t]);this.container.append(e)}}_setStatusLoading(){let t=this.el.parentElement.querySelector(".status-info");t&&t.replaceChildren(H._loadingIndicator())}_updateSelectedInfo(){let t=this.el.parentElement.querySelector(".status-info");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){this.menuItems=t,this.options.data=t,e&&(this.selectedValues=this.menuItems.filter(s=>e.indexOf(s.id)!==-1)),this.options.isMultiSelect?this._renderDropdown():this._refreshInputText(),i&&this.open(),this._updateSelectedInfo(),this._triggerChanged()}setValues(t){this.selectedValues=t,this._updateSelectedInfo(),this.options.isMultiSelect||this._refreshInputText(),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._renderDropdown(),this.el.focus()):(this.selectedValues=[e],this._refreshInputText(),this._resetAutocomplete(),this.close()),this._updateSelectedInfo(),this._triggerChanged())}selectOptions(t){let e=this.menuItems.filter(i=>t.indexOf(i.id)!==-1);e&&(this.selectedValues=e,this._renderDropdown())}};H._loadingTemplate=null;var F=H;var Kt={data:[],placeholder:"",secondaryPlaceholder:"",closeIconClass:"material-icons",autocompleteOptions:{},autocompleteOnly:!1,limit:1/0,allowUserInput:!1,onChipAdd:null,onChipSelect:null,onChipDelete:null},M=class M extends f{constructor(t,e){super(t,e,M);this._handleChipClick=t=>{let e=t.target.closest(".chip"),i=t.target.classList.contains("close");if(e){let s=this._chips.indexOf(e);if(s<0)return;i?(this.deleteChip(s),this._input.focus()):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(M._keydown=!0,r.keys.ENTER.includes(t.key)){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(r.keys.BACKSPACE.includes(t.key)||r.keys.ARROW_LEFT.includes(t.key))&&this._input.value===""&&this.chipsData.length&&(t.preventDefault(),this.selectChip(this.chipsData.length-1))};this.el.Expressive_Chips=this,this.options={...M.defaults,...e},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("input-field"),this._setupInput(),this._setupEventHandlers(),this.el.append(this._input)),this._setupLabel()}static get defaults(){return Kt}static init(t,e={}){return super.init(t,e,M)}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),document.addEventListener("keydown",M._handleChipsKeydown),document.addEventListener("keyup",M._handleChipsKeyup),this.el.addEventListener("blur",M._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),document.removeEventListener("keydown",M._handleChipsKeydown),document.removeEventListener("keyup",M._handleChipsKeyup),this.el.removeEventListener("blur",M._handleChipsBlur,!0),this._input.removeEventListener("focus",this._handleInputFocus),this._input.removeEventListener("blur",this._handleInputBlur),this._input.removeEventListener("keydown",this._handleInputKeydown)}static _handleChipsKeydown(t){M._keydown=!0;let e=t.target.closest(".chips"),i=t.target&&e,s=t.target.tagName;if(s==="INPUT"||s==="TEXTAREA"||!i)return;let o=e.Expressive_Chips;if(o){if(r.keys.BACKSPACE.includes(t.key)||r.keys.DELETE.includes(t.key)){t.preventDefault();let a=o.chipsData.length;if(o._selectedChip){let l=o._chips.indexOf(o._selectedChip);o.deleteChip(l),o._selectedChip=null,a=Math.max(l-1,0)}o.chipsData.length?o.selectChip(a):o._input.focus()}else if(r.keys.ARROW_LEFT.includes(t.key)){if(o._selectedChip){let a=o._chips.indexOf(o._selectedChip)-1;if(a<0)return;o.selectChip(a)}}else if(r.keys.ARROW_RIGHT.includes(t.key)&&o._selectedChip){let a=o._chips.indexOf(o._selectedChip)+1;a>=o.chipsData.length?o._input.focus():o.selectChip(a)}}}static _handleChipsKeyup(){M._keydown=!1}static _handleChipsBlur(t){if(!M._keydown&&document.hidden){let i=t.target.closest(".chips")?.Expressive_Chips;i&&(i._selectedChip=null)}}_renderChip(t){if(!t.id)return;let e=document.createElement("div");if(e.classList.add("chip"),e.innerText=t.text||t.id,t.image){let i=document.createElement("img");i.setAttribute("src",t.image),e.insertBefore(i,e.firstChild)}if(this.options.allowUserInput){e.setAttribute("tabindex","0");let i=document.createElement("i");i.classList.add(this.options.closeIconClass,"close"),i.innerText="close",e.appendChild(i)}return e}_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=F.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",r.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._chips[t];e&&(e.remove(),this._chips.splice(t,1),this.chipsData.splice(t,1),this._setPlaceholder(),typeof this.options.onChipDelete=="function"&&this.options.onChipDelete(this.el,e))}selectChip(t){let e=this._chips[t];e&&(this._selectedChip=e,e.focus(),typeof this.options.onChipSelect=="function"&&this.options.onChipSelect(this.el,e))}static Init(){r.onDocumentReady(()=>{document.querySelectorAll(".chips").forEach(e=>{e.addEventListener("click",i=>{if(!e.Expressive_Chips&&i.target.classList.contains("close")){let s=i.target.closest(".chip");s&&s.remove()}})})})}};M._keydown=!1;var V=M;var Xt={},X=class u extends f{constructor(t,e){super(t,e,u);this._handleRangeChange=()=>{this._sync(),this.thumb.classList.add("active")};this._handleRangeMousedownTouchstart=t=>{this._mousedown=!0,this.el.classList.add("active"),this._sync(),t.type!=="input"&&this.thumb.classList.add("active")};this._handleRangeInputMousemoveTouchmove=()=>{this._mousedown&&(this._sync(),this.thumb.classList.add("active"))};this._handleRangeMouseupTouchend=()=>{this._mousedown=!1,this.el.classList.remove("active")};this._handleRangeBlurMouseoutTouchleave=()=>{this._mousedown||this.thumb.classList.remove("active")};this.el.Expressive_Range=this,this.options={...u.defaults,...e},this._mousedown=!1,this._setupThumb(),this._sync(),this._setupEventHandlers()}static get defaults(){return Xt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Range}destroy(){this._removeEventHandlers(),this._removeThumb(),this.el.Expressive_Range=void 0}_setupEventHandlers(){this.el.addEventListener("change",this._handleRangeChange),this.el.addEventListener("mousedown",this._handleRangeMousedownTouchstart),this.el.addEventListener("touchstart",this._handleRangeMousedownTouchstart),this.el.addEventListener("input",this._handleRangeInputMousemoveTouchmove),this.el.addEventListener("mousemove",this._handleRangeInputMousemoveTouchmove),this.el.addEventListener("touchmove",this._handleRangeInputMousemoveTouchmove,{passive:!0}),this.el.addEventListener("mouseup",this._handleRangeMouseupTouchend),this.el.addEventListener("touchend",this._handleRangeMouseupTouchend),this.el.addEventListener("blur",this._handleRangeBlurMouseoutTouchleave),this.el.addEventListener("mouseout",this._handleRangeBlurMouseoutTouchleave),this.el.addEventListener("touchleave",this._handleRangeBlurMouseoutTouchleave)}_removeEventHandlers(){this.el.removeEventListener("change",this._handleRangeChange),this.el.removeEventListener("mousedown",this._handleRangeMousedownTouchstart),this.el.removeEventListener("touchstart",this._handleRangeMousedownTouchstart),this.el.removeEventListener("input",this._handleRangeInputMousemoveTouchmove),this.el.removeEventListener("mousemove",this._handleRangeInputMousemoveTouchmove),this.el.removeEventListener("touchmove",this._handleRangeInputMousemoveTouchmove),this.el.removeEventListener("mouseup",this._handleRangeMouseupTouchend),this.el.removeEventListener("touchend",this._handleRangeMouseupTouchend),this.el.removeEventListener("blur",this._handleRangeBlurMouseoutTouchleave),this.el.removeEventListener("mouseout",this._handleRangeBlurMouseoutTouchleave),this.el.removeEventListener("touchleave",this._handleRangeBlurMouseoutTouchleave)}_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")}_sync(){let t=parseFloat(this.el.getAttribute("max"))||100,e=parseFloat(this.el.getAttribute("min"))||0,i=parseFloat(this.el.value)||0,s=t===e?0:(i-e)/(t-e),o=this.el.offsetLeft,a=this.el.offsetTop,l=this.el.offsetWidth,h=this.el.offsetHeight;this.el.style.setProperty("--md-comp-slider-active-fraction",`${s*100}%`),this.value.textContent=this.el.value,this._isVertical()?(this.thumb.style.left=`${o+l/2}px`,this.thumb.style.top=`${a+(1-s)*h}px`):(this.thumb.style.left=`${o+s*l}px`,this.thumb.style.top=`${a}px`)}static Init(){r.onDocumentReady(()=>{u.init(document.querySelectorAll("input[type=range]"),{})})}};var Y=class u{static validateField(n){if(!n){console.error("No text field element found");return}let t=n.getAttribute("data-length")!==null,e=parseInt(n.getAttribute("data-length")),i=n.value.length;i===0&&n.validity.badInput===!1&&!n.required&&n.classList.contains("validate")?n.classList.remove("invalid"):n.classList.contains("validate")&&(n.validity.valid&&t&&i<=e||n.validity.valid&&!t?n.classList.remove("invalid"):n.classList.add("invalid"))}static textareaAutoResize(n){let t=n;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(){r.onDocumentReady(()=>{document.addEventListener("change",n=>{let t=n.target;t instanceof HTMLInputElement&&u.validateField(t)}),document.addEventListener("keyup",n=>{let t=n.target;t instanceof HTMLInputElement&&["radio","checkbox"].includes(t.type)&&r.keys.TAB.includes(n.key)&&(t.classList.add("tabbed"),t.addEventListener("blur",()=>t.classList.remove("tabbed"),{once:!0}))}),document.querySelectorAll(".expressive-textarea").forEach(n=>{u.InitTextarea(n)}),document.querySelectorAll('.file-field input[type="file"]').forEach(n=>{u.InitFileInputPath(n)})})}static InitTextarea(n){n.setAttribute("original-height",n.getBoundingClientRect().height.toString()),u.textareaAutoResize(n),n.addEventListener("input",t=>u.textareaAutoResize(t.target))}static InitFileInputPath(n){n.addEventListener("change",()=>{let e=n.closest(".file-field").querySelector("input.file-path"),i=n.files,s=[];for(let o=0;o<i.length;o++)s.push(i[o].name);e.value=s.join(", "),e.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))})}};var z=class u{static _offset(n){let t=n.getBoundingClientRect(),e=document.documentElement;return{top:t.top+window.pageYOffset-e.clientTop,left:t.left+window.pageXOffset-e.clientLeft}}static renderWaveEffect(n,t=null,e=null){let i=t===null,s=500,o,a,l=function(h){a||(a=h);let c=h-a;if(c<s){let d=c/s*(2-c/s),m=i?"circle at 50% 50%":`circle at ${t.x}px ${t.y}px`,y=`rgba(${e?.r||0}, ${e?.g||0}, ${e?.b||0}, ${.3*(1-d)})`,g=90*d+"%";n.style.backgroundImage="radial-gradient("+m+", "+y+" "+g+", transparent "+g+")",o=window.requestAnimationFrame(l)}else n.style.backgroundImage="none",window.cancelAnimationFrame(o)};o=window.requestAnimationFrame(l)}static Init(){r.onDocumentReady(()=>{document.body.addEventListener("click",n=>{let t=n.target,e=t.closest(".waves-effect");if(e&&e.contains(t)){let i=e.classList.contains("waves-circle"),s=u._offset(e),o=n.pageX-s.left,a=n.pageY-s.top,l=null;e.classList.contains("waves-light")&&(l={r:255,g:255,b:255}),u.renderWaveEffect(e,i?null:{x:o,y:a},l)}})})}};var Yt={direction:"top",hoverEnabled:!0,toolbarEnabled:!1},U=class u extends f{constructor(t,e){super(t,e,u);this._backdrop=null;this._handleFABClick=()=>{this._handleFABToggle()};this._handleFABKeyPress=t=>{r.keys.ENTER.includes(t.key)&&this._handleFABToggle()};this._handleFABToggle=()=>{this.isOpen?this.close():this.open()};this._handleDocumentClick=t=>{t.target!==this._menu&&this.close()};this.open=()=>{this.isOpen||(this.options.toolbarEnabled?this._animateInToolbar():this._animateInFAB(),this.isOpen=!0)};this.close=()=>{this.isOpen&&(this.options.toolbarEnabled?(window.removeEventListener("scroll",this.close,!0),document.body.removeEventListener("click",this._handleDocumentClick,!0),this._animateOutToolbar()):this._animateOutFAB(),this.isOpen=!1)};this.el.Expressive_FloatingActionButton=this,this.options={...u.defaults,...e},this.isOpen=!1,this._anchor=this.el.querySelector("a, button"),this._menu=this.el.querySelector("ul"),this._floatingBtns=Array.from(this.el.querySelectorAll("ul .btn-floating")),this._floatingBtnsReverse=this._floatingBtns.reverse(),this.offsetY=0,this.offsetX=0,this.el.classList.add(`direction-${this.options.direction}`),this._anchor&&(this._anchor.tabIndex=0),this._menu&&(this._menu.ariaExpanded="false"),this.options.direction==="top"?this.offsetY=40:this.options.direction==="right"?this.offsetX=-40:this.options.direction==="bottom"?this.offsetY=-40:this.offsetX=40,this._setupEventHandlers()}static get defaults(){return Yt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_FloatingActionButton}destroy(){this._removeEventHandlers(),this.close(),this.el.Expressive_FloatingActionButton=void 0}_setupEventHandlers(){this.options.hoverEnabled&&!this.options.toolbarEnabled?(this.el.addEventListener("mouseenter",this.open),this.el.addEventListener("mouseleave",this.close)):this.el.addEventListener("click",this._handleFABClick),this.el.addEventListener("keypress",this._handleFABKeyPress)}_removeEventHandlers(){this.options.hoverEnabled&&!this.options.toolbarEnabled?(this.el.removeEventListener("mouseenter",this.open),this.el.removeEventListener("mouseleave",this.close)):this.el.removeEventListener("click",this._handleFABClick),this.el.removeEventListener("keypress",this._handleFABKeyPress)}_animateInFAB(){this.el.classList.add("active"),this._menu&&(this._menu.ariaExpanded="true");let t=40,e=275;this._floatingBtnsReverse.forEach((i,s)=>{let o=t*s;i.style.transition="none",i.style.opacity="0",i.style.transform=`translate(${this.offsetX}px, ${this.offsetY}px) scale(0.4)`,setTimeout(()=>{i.style.opacity="0.4",setTimeout(()=>{i.style.transition=`opacity ${e}ms ease, transform ${e}ms ease`,i.style.opacity="1",i.style.transform="translate(0, 0) scale(1)",i.tabIndex=0},1)},o)})}_animateOutFAB(){setTimeout(()=>{this.el.classList.remove("active"),this._menu&&(this._menu.ariaExpanded="false")},175),this._floatingBtnsReverse.forEach(e=>{e.style.transition="opacity 175ms ease, transform 175ms ease",e.style.opacity="0",e.style.transform=`translate(${this.offsetX}px, ${this.offsetY}px) scale(0.4)`,e.tabIndex=-1})}_animateInToolbar(){let t=window.innerWidth,e=window.innerHeight,i=this.el.getBoundingClientRect(),s=getComputedStyle(this._anchor).backgroundColor,o=document.createElement("div");o.classList.add("fab-backdrop"),o.style.backgroundColor=s,this._anchor.append(o),this._backdrop=o;let a=o.clientWidth,l=a>0?t/a:1;this.offsetX=i.left-t/2+i.width/2,this.offsetY=e-i.bottom,this.btnBottom=i.bottom,this.btnLeft=i.left,this.btnWidth=i.width,this.el.classList.add("active"),this.el.style.textAlign="center",this.el.style.width="100%",this.el.style.bottom="0",this.el.style.left="0",this.el.style.transform="translateX("+this.offsetX+"px)",this.el.style.transition="none",this._menu&&(this._menu.ariaExpanded="true"),this._anchor.style.transform=`translateY(${this.offsetY}px)`,this._anchor.style.transition="none",setTimeout(()=>{this.el.style.transform="",this.el.style.transition="transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s",this._anchor.style.overflow="visible",this._anchor.style.transform="",this._anchor.style.transition="transform .2s",setTimeout(()=>{this.el.style.overflow="hidden",this.el.style.backgroundColor=s,o.style.transform="scale("+l+")",o.style.transition="transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)",this._menu.querySelectorAll("li > a").forEach(h=>{h.style.opacity="1",h.tabIndex=0}),window.addEventListener("scroll",this.close,!0),document.body.addEventListener("click",this._handleDocumentClick,!0)},100)},0)}_animateOutToolbar(){let t=this._backdrop;this._backdrop=null,this._menu?.querySelectorAll("li > a").forEach(e=>{e.style.opacity="",e.tabIndex=-1}),t&&(t.style.transition="transform .2s",t.style.transform="scale(0)"),this.el.style.overflow="",this.el.style.backgroundColor="",this.el.style.transition="transform .2s",this.el.style.transform=`translateX(${this.offsetX}px)`,this._anchor.style.transition="transform .2s",this._anchor.style.transform=`translateY(${this.offsetY}px)`,setTimeout(()=>{t?.remove(),this.el.classList.remove("active"),this._menu&&(this._menu.ariaExpanded="false"),this.el.style.textAlign="",this.el.style.width="",this.el.style.bottom="",this.el.style.left="",this.el.style.transform="",this.el.style.transition="",this._anchor.style.overflow="",this._anchor.style.transform="",this._anchor.style.transition=""},200)}};var zt={duration:200,dist:-100,shift:0,padding:0,numVisible:5,fullWidth:!1,indicators:!1,noWrap:!1,onCycleTo:null},N=class u extends f{constructor(t,e){super(t,e,u);this.center=0;this._handleThrottledResize=r.throttle(()=>this._handleResize(),200);this._handleCarouselTap=t=>{t.type==="mousedown"&&t.target.tagName==="IMG"&&t.preventDefault(),this.pressed=!0,this.dragged=!1,this.verticalDragged=!1,this.reference=this._xpos(t),this.referenceY=this._ypos(t),this.velocity=this.amplitude=0,this.frame=this.offset,this.timestamp=Date.now(),clearInterval(this.ticker),this.ticker=setInterval(this._track,100)};this._handleCarouselDrag=t=>{let e,i,s,o;if(this.pressed)if(e=this._xpos(t),i=this._ypos(t),s=this.reference-e,o=Math.abs(this.referenceY-i),o<30&&!this.verticalDragged)(s>2||s<-2)&&(this.dragged=!0,this.reference=e,this._scroll(this.offset+s));else{if(this.dragged)return t.preventDefault(),t.stopPropagation(),!1;this.verticalDragged=!0}if(this.dragged)return t.preventDefault(),t.stopPropagation(),!1};this._handleCarouselRelease=t=>{if(this.pressed)this.pressed=!1;else return;return clearInterval(this.ticker),this.target=this.offset,(this.velocity>10||this.velocity<-10)&&(this.amplitude=.9*this.velocity,this.target=this.offset+this.amplitude),this.target=Math.round(this.target/this.dim)*this.dim,this.noWrap&&(this.target>=this.dim*(this.count-1)?this.target=this.dim*(this.count-1):this.target<0&&(this.target=0)),this.amplitude=this.target-this.offset,this.timestamp=Date.now(),requestAnimationFrame(this._autoScroll),this.dragged&&(t.preventDefault(),t.stopPropagation()),!1};this._handleCarouselClick=t=>{if(this.dragged)return t.preventDefault(),t.stopPropagation(),!1;if(!this.options.fullWidth){let e=t.target.closest(".carousel-item");if(!e)return;let i=[...e.parentNode.children].indexOf(e);this._wrap(this.center)-i!==0&&(t.preventDefault(),t.stopPropagation()),i<0?t.clientX-t.target.getBoundingClientRect().left>this.el.clientWidth/2?this.next():this.prev():this._cycleTo(i)}};this._handleIndicatorClick=t=>{t.stopPropagation(),this._handleIndicatorInteraction(t)};this._handleIndicatorKeyPress=t=>{t.stopPropagation(),r.keys.ENTER.includes(t.key)&&this._handleIndicatorInteraction(t)};this._handleIndicatorInteraction=t=>{let e=t.target.closest(".indicator-item");if(e){let i=[...e.parentNode.children].indexOf(e);this._cycleTo(i)}};this._handleResize=()=>{if(this.options.fullWidth){let t=this.el.querySelector(".carousel-item"),e=this.el.querySelector(".carousel-item.active");if(!t||!e)return;this.itemWidth=t.clientWidth,this.imageHeight=e.clientHeight,this.dim=this.itemWidth*2+this.options.padding,this.offset=this.center*2*this.itemWidth,this.target=this.offset,this._setCarouselHeight(!0)}else this._scroll()};this._track=()=>{let t=Date.now(),e=t-this.timestamp,i=this.offset-this.frame,s=1e3*i/(1+e);this.timestamp=t,this.frame=this.offset,this.velocity=.8*s+.2*this.velocity};this._autoScroll=()=>{let t,e;this.amplitude&&(t=Date.now()-this.timestamp,e=this.amplitude*Math.exp(-t/this.options.duration),e>2||e<-2?(this._scroll(this.target-e),requestAnimationFrame(this._autoScroll)):this._scroll(this.target))};this.el.Expressive_Carousel=this,this.options={...u.defaults,...e},this.hasMultipleSlides=this.el.querySelectorAll(".carousel-item").length>1,this.showIndicators=this.options.indicators&&this.hasMultipleSlides,this.noWrap=this.options.noWrap||!this.hasMultipleSlides,this.pressed=!1,this.dragged=!1,this.offset=this.target=0,this.images=[];let i=this.el.querySelector(".carousel-item");if(!i){console.error("Carousel: no .carousel-item elements to show");return}this.itemWidth=i.clientWidth,this.itemHeight=i.clientHeight,this.dim=this.itemWidth*2+this.options.padding||1,this.options.fullWidth&&(this.options.dist=0,this._setCarouselHeight(),this.showIndicators&&this.el.querySelector(".carousel-fixed-item")?.classList.add("with-indicators")),this._indicators=document.createElement("ul"),this._indicators.classList.add("indicators"),this.el.querySelectorAll(".carousel-item").forEach((s,o)=>{if(this.images.push(s),this.showIndicators){let a=document.createElement("li");a.classList.add("indicator-item"),a.tabIndex=0,o===0&&a.classList.add("active"),this._indicators.appendChild(a)}}),this.showIndicators&&this.el.appendChild(this._indicators),this.count=this.images.length,this.options.numVisible=Math.min(this.count,this.options.numVisible),this._setupEventHandlers(),this._scroll(this.offset)}static get defaults(){return zt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Carousel}destroy(){this._removeEventHandlers(),this.el.Expressive_Carousel=void 0}_setupEventHandlers(){typeof window.ontouchstart<"u"&&(this.el.addEventListener("touchstart",this._handleCarouselTap),this.el.addEventListener("touchmove",this._handleCarouselDrag),this.el.addEventListener("touchend",this._handleCarouselRelease)),this.el.addEventListener("mousedown",this._handleCarouselTap),this.el.addEventListener("mousemove",this._handleCarouselDrag),this.el.addEventListener("mouseup",this._handleCarouselRelease),this.el.addEventListener("mouseleave",this._handleCarouselRelease),this.el.addEventListener("click",this._handleCarouselClick),this.showIndicators&&this._indicators&&this._indicators.querySelectorAll(".indicator-item").forEach(t=>{t.addEventListener("click",this._handleIndicatorClick),t.addEventListener("keypress",this._handleIndicatorKeyPress)}),window.addEventListener("resize",this._handleThrottledResize)}_removeEventHandlers(){typeof window.ontouchstart<"u"&&(this.el.removeEventListener("touchstart",this._handleCarouselTap),this.el.removeEventListener("touchmove",this._handleCarouselDrag),this.el.removeEventListener("touchend",this._handleCarouselRelease)),this.el.removeEventListener("mousedown",this._handleCarouselTap),this.el.removeEventListener("mousemove",this._handleCarouselDrag),this.el.removeEventListener("mouseup",this._handleCarouselRelease),this.el.removeEventListener("mouseleave",this._handleCarouselRelease),this.el.removeEventListener("click",this._handleCarouselClick),this.showIndicators&&this._indicators&&this._indicators.querySelectorAll(".indicator-item").forEach(t=>{t.removeEventListener("click",this._handleIndicatorClick)}),window.removeEventListener("resize",this._handleThrottledResize)}_setCarouselHeight(t=!1){let e=this.el.querySelector(".carousel-item.active")?this.el.querySelector(".carousel-item.active"):this.el.querySelector(".carousel-item"),i=e.querySelector("img");if(i)if(i.complete){let s=i.clientHeight;if(s>0)this.el.style.height=s+"px";else{let o=i.naturalWidth,a=i.naturalHeight,l=this.el.clientWidth/o*a;this.el.style.height=l+"px"}}else i.addEventListener("load",()=>{this.el.style.height=i.offsetHeight+"px"});else if(!t){let s=e.clientHeight;this.el.style.height=s+"px"}}_xpos(t){return t.type.startsWith("touch")&&t.targetTouches.length>=1?t.targetTouches[0].clientX:t.clientX}_ypos(t){return t.type.startsWith("touch")&&t.targetTouches.length>=1?t.targetTouches[0].clientY:t.clientY}_wrap(t){return t>=this.count?t%this.count:t<0?this._wrap(this.count+t%this.count):t}_scroll(t=0){this.el.classList.contains("scrolling")||this.el.classList.add("scrolling"),this.scrollingTimeout!=null&&clearTimeout(this.scrollingTimeout),this.scrollingTimeout=setTimeout(()=>{this.el.classList.remove("scrolling")},this.options.duration),this.offset=typeof t=="number"?t:this.offset,this.center=Math.floor((this.offset+this.dim/2)/this.dim);let e=this.count>>1,i=this.offset-this.center*this.dim,s=i<0?1:-1,o=-s*i*2/this.dim,a,l,h,c,d,m,y=this.center,g=1/this.options.numVisible;if(this.options.fullWidth?(h="translateX(0)",m=1):(h="translateX("+(this.el.clientWidth-this.itemWidth)/2+"px) ",h+="translateY("+(this.el.clientHeight-this.itemHeight)/2+"px)",m=1-g*o),this.showIndicators){let b=this.center%this.count,D=this._indicators.querySelector(".indicator-item.active");if([...D.parentNode.children].indexOf(D)!==b){D.classList.remove("active");let k=b<0?this.count+b:b;this._indicators.querySelectorAll(".indicator-item")[k].classList.add("active")}}for((!this.noWrap||this.center>=0&&this.center<this.count)&&(l=this.images[this._wrap(this.center)],l.classList.contains("active")||(this.el.querySelector(".carousel-item.active")?.classList.remove("active"),l.classList.add("active"))),a=1;a<=e;++a){if(this.options.fullWidth?(c=this.options.dist,d=a===e&&i<0?1-o:1):(c=this.options.dist*(a*2+o*s),d=1-g*(a*2+o*s)),!this.noWrap||this.center+a<this.count){l=this.images[this._wrap(this.center+a)];let b=`${h} translateX(${this.options.shift+(this.dim*a-i)/2}px) translateZ(${c}px)`;this._updateItemStyle(l,d,-a,b)}if(this.options.fullWidth?(c=this.options.dist,d=a===e&&i>0?1-o:1):(c=this.options.dist*(a*2-o*s),d=1-g*(a*2-o*s)),!this.noWrap||this.center-a>=0){l=this.images[this._wrap(this.center-a)];let b=`${h} translateX(${-this.options.shift+(-this.dim*a-i)/2}px) translateZ(${c}px)`;this._updateItemStyle(l,d,-a,b)}}if(!this.noWrap||this.center>=0&&this.center<this.count){l=this.images[this._wrap(this.center)];let b=`${h} translateX(${-i/2}px) translateX(${s*this.options.shift*o}px) translateZ(${this.options.dist*o}px)`;this._updateItemStyle(l,m,0,b)}let L=this.el.querySelectorAll(".carousel-item")[this._wrap(this.center)];y!==this.center&&typeof this.options.onCycleTo=="function"&&this.options.onCycleTo.call(this,L,this.dragged),typeof this.oneTimeCallback=="function"&&(this.oneTimeCallback.call(this,L,this.dragged),this.oneTimeCallback=null)}_updateItemStyle(t,e,i,s){t.style.transform=s,t.style.zIndex=i.toString(),t.style.opacity=e.toString(),t.style.visibility="visible"}_cycleTo(t,e=null){let i=this.center%this.count-t;this.noWrap||(i<0?Math.abs(i+this.count)<Math.abs(i)&&(i+=this.count):i>0&&Math.abs(i-this.count)<i&&(i-=this.count)),this.target=this.dim*Math.round(this.offset/this.dim),i<0?this.target+=this.dim*Math.abs(i):i>0&&(this.target-=this.dim*i),typeof e=="function"&&(this.oneTimeCallback=e),this.offset!==this.target&&(this.amplitude=this.target-this.offset,this.timestamp=Date.now(),requestAnimationFrame(this._autoScroll))}next(t=1){(t===void 0||isNaN(t))&&(t=1);let e=this.center+t;if(e>=this.count||e<0){if(this.noWrap)return;e=this._wrap(e)}this._cycleTo(e)}prev(t=1){(t===void 0||isNaN(t))&&(t=1);let e=this.center-t;if(e>=this.count||e<0){if(this.noWrap)return;e=this._wrap(e)}this._cycleTo(e)}set(t,e){if((t===void 0||isNaN(t))&&(t=0),t>this.count||t<0){if(this.noWrap)return;t=this._wrap(t)}this._cycleTo(t,e)}};var Ut=Object.freeze({}),mt=class u extends f{constructor(t,e){super(t,{},u);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={...u.defaults,...e},this.isInvalid=!1,this.isValidLength=!1,this._setupCounter(),this._setupEventHandlers()}static get defaults(){return Ut}static init(t,e={}){return super.init(t,e,u)}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.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 jt={accordion:!0,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,inDuration:300,outDuration:300},j=class u extends f{constructor(t,e){super(t,e,u);this._handleCollapsibleClick=t=>{let e=t.target.closest(".collapsible-header");if(t.target&&e){if(e.closest(".collapsible")!==this.el)return;let s=e.closest("li"),o=s.classList.contains("active"),a=[...s.parentNode.children].indexOf(s);o?this.close(a):this.open(a)}};this._handleCollapsibleKeydown=t=>{r.keys.ENTER.includes(t.key)&&this._handleCollapsibleClick(t)};this.open=t=>{let e=Array.from(this.el.children).filter(s=>s.tagName==="LI"),i=e[t];i&&!i.classList.contains("active")&&(typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,i),this.options.accordion&&e.filter(o=>o.classList.contains("active")).forEach(o=>{let a=e.indexOf(o);this.close(a)}),i.classList.add("active"),this._animateIn(t))};this.close=t=>{let e=Array.from(this.el.children).filter(i=>i.tagName==="LI")[t];e&&e.classList.contains("active")&&(typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,e),e.classList.remove("active"),this._animateOut(t))};this.el.Expressive_Collapsible=this,this.options={...u.defaults,...e},this._headers=Array.from(this.el.querySelectorAll("li > .collapsible-header")),this._headers.forEach(s=>s.tabIndex=0),this._setupEventHandlers();let i=Array.from(this.el.querySelectorAll("li.active > .collapsible-body"));this.options.accordion?i.length>0&&this._setExpanded(i[0]):i.forEach(s=>this._setExpanded(s))}static get defaults(){return jt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Collapsible}destroy(){this._removeEventHandlers(),this.el.Expressive_Collapsible=void 0}_setupEventHandlers(){this.el.addEventListener("click",this._handleCollapsibleClick),this._headers.forEach(t=>t.addEventListener("keydown",this._handleCollapsibleKeydown))}_removeEventHandlers(){this.el.removeEventListener("click",this._handleCollapsibleClick),this._headers.forEach(t=>t.removeEventListener("keydown",this._handleCollapsibleKeydown))}_setExpanded(t){t.style.maxHeight=t.scrollHeight+"px"}_animateIn(t){let e=this.el.children[t];if(!e)return;let i=e.querySelector(".collapsible-body"),s=this.options.inDuration;i.style.transition=`max-height ${s}ms ease-out`,this._setExpanded(i),setTimeout(()=>{typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,e)},s)}_animateOut(t){let e=this.el.children[t];if(!e)return;let i=e.querySelector(".collapsible-body"),s=this.options.outDuration;i.style.transition=`max-height ${s}ms ease-out`,i.style.maxHeight="0",setTimeout(()=>{typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,e)},s)}};var Gt={classes:"",dropdownOptions:{}},I=class u extends f{constructor(t,e){super(t,e,u);this._handleSelectChange=()=>{this._setValueToInput()};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._handleInputClick=()=>{this.dropdown&&this.dropdown.isOpen&&(this._setValueToInput(),this._setSelectedStates())};!this.el.classList.contains("browser-default")&&(this.el.Expressive_FormSelect=this,this.options={...u.defaults,...e},this.isMultiple=this.el.multiple,this.nativeTabIndex=this.el.tabIndex??-1,this.el.tabIndex=-1,this._values=[],this._setupDropdown(),this._setupEventHandlers())}static get defaults(){return Gt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_FormSelect}destroy(){this._removeEventHandlers(),this.dropdown?.destroy(),this._removeDropdown(),this.el.Expressive_FormSelect=void 0}refresh(){this._setValueToInput(),this._setSelectedStates()}_setupEventHandlers(){this.dropdownOptions.querySelectorAll("li:not(.optgroup)").forEach(t=>{t.addEventListener("click",this._handleOptionClick),t.addEventListener("keydown",this._handleOptionKeydown)}),this.el.addEventListener("change",this._handleSelectChange),this.input.addEventListener("click",this._handleInputClick)}_removeEventHandlers(){this.dropdownOptions.querySelectorAll("li:not(.optgroup)").forEach(t=>{t.removeEventListener("click",this._handleOptionClick),t.removeEventListener("keydown",this._handleOptionKeydown)}),this.el.removeEventListener("change",this._handleSelectChange),this.input.removeEventListener("click",this._handleInputClick)}_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(!t.classList.contains("disabled")&&!t.classList.contains("optgroup")){let e=this._values.find(a=>a.optionEl===t),i=this.getSelectedValues();this.isMultiple?this._toggleEntryFromArray(e):(this._deselectAll(),this._selectValue(e)),this._setValueToInput();let s=this.getSelectedValues();!this._arraysEqual(i,s)&&this.el.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))}this.isMultiple||this.dropdown.close()}_setupDropdown(){this.labelEl=this.el.labels?.[0]??null,this.wrapper=document.createElement("div"),this.wrapper.classList.add("select-wrapper","input-field"),this.options.classes.length>0&&this.wrapper.classList.add(...this.options.classes.split(" ").filter(Boolean)),this.el.before(this.wrapper);let t=document.createElement("div");t.classList.add("hide-select"),this.wrapper.append(t),t.appendChild(this.el),this.el.disabled&&this.wrapper.classList.add("disabled"),this.selectOptions=Array.from(this.el.children).filter(s=>["OPTION","OPTGROUP"].includes(s.tagName)),this.dropdownOptions=document.createElement("ul"),this.dropdownOptions.id=`select-options-${r.guid()}`,this.dropdownOptions.setAttribute("popover","auto"),this.dropdownOptions.classList.add("dropdown-content","select-dropdown"),this.dropdownOptions.setAttribute("role","listbox"),this.dropdownOptions.ariaMultiSelectable=this.isMultiple.toString(),this.isMultiple&&this.dropdownOptions.classList.add("multiple-select-dropdown"),this.selectOptions.length>0&&this.selectOptions.forEach(s=>{if(s.tagName==="OPTION"){let o=this._createAndAppendOptionWithIcon(s,this.isMultiple?"multiple":void 0);this._addOptionToValues(s,o)}else if(s.tagName==="OPTGROUP"){let o="opt-group-"+r.guid(),a=document.createElement("li");a.classList.add("optgroup"),a.tabIndex=-1,a.setAttribute("role","group"),a.setAttribute("aria-labelledby",o);let l=document.createElement("span");l.id=o,l.setAttribute("role","presentation"),l.textContent=s.getAttribute("label")??"",a.replaceChildren(l),this.dropdownOptions.append(a);let h=[];Array.from(s.children).filter(d=>d.tagName==="OPTION").forEach(d=>{let m=this._createAndAppendOptionWithIcon(d,"optgroup-option"),y="opt-child-"+r.guid();m.id=y,h.push(y),this._addOptionToValues(d,m)}),a.setAttribute("aria-owns",h.join(" "))}}),this.wrapper.append(this.dropdownOptions),this.input=document.createElement("input"),this.input.id="m_select-input-"+r.guid(),this.input.classList.add("select-dropdown","dropdown-trigger"),this.input.type="text",this.input.readOnly=!0,this.input.setAttribute("data-target",this.dropdownOptions.id),this.input.ariaReadOnly="true",this.input.ariaRequired=this.el.hasAttribute("required").toString(),this.el.disabled&&(this.input.disabled=!0),this.input.setAttribute("tabindex",this.nativeTabIndex.toString());let e=this.el.attributes;for(let s=0;s<e.length;++s){let o=e[s];o.name.startsWith("aria-")&&this.input.setAttribute(o.name,o.value)}this.input.setAttribute("role","combobox"),this.input.ariaExpanded="false",this.input.setAttribute("aria-owns",this.dropdownOptions.id),this.input.setAttribute("aria-controls",this.dropdownOptions.id),this.input.placeholder=" ",this.wrapper.prepend(this.input),this._setValueToInput();let i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i.classList.add("caret"),i.setAttribute("height","24"),i.setAttribute("width","24"),i.setAttribute("viewBox","0 0 24 24"),i.ariaHidden="true",i.innerHTML='<path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/>',this.wrapper.prepend(i),!this.el.disabled){let s={...this.options.dropdownOptions};s.coverTrigger=!1;let o=s.onOpenEnd,a=s.onCloseEnd;s.onOpenEnd=()=>{let l=this.dropdownOptions.querySelector(".selected");if(l&&(r.keyDown=!0,this.dropdown.focusedIndex=[...l.parentNode.children].indexOf(l),this.dropdown._focusFocusedItem(),r.keyDown=!1,this.dropdown.isScrollable)){let h=l.getBoundingClientRect().top-this.dropdownOptions.getBoundingClientRect().top;h-=this.dropdownOptions.clientHeight/2,this.dropdownOptions.scrollTop=h}this.input.ariaExpanded="true",o&&typeof o=="function"&&o.call(this.dropdown,this.el)},s.onCloseEnd=()=>{this.input.ariaExpanded="false",a&&typeof a=="function"&&a.call(this.dropdown,this.el)},s.closeOnClick=!1,this.dropdown=A.init(this.input,s)}this._setSelectedStates(),this.labelEl&&this.input.after(this.labelEl)}_addOptionToValues(t,e){this._values.push({el:t,optionEl:e})}_removeDropdown(){this.wrapper.querySelector(".caret").remove(),this.input.remove(),this.dropdownOptions.remove(),this.wrapper.before(this.el),this.wrapper.remove()}_createAndAppendOptionWithIcon(t,e){let i=document.createElement("li");i.setAttribute("role","option"),t.disabled&&(i.classList.add("disabled"),i.ariaDisabled="true"),e==="optgroup-option"&&i.classList.add(e);let s=t.textContent,o=document.createElement("span");if(this.isMultiple&&!t.disabled){let h=document.createElement("label"),c=document.createElement("input");c.type="checkbox";let d=document.createElement("span");d.textContent=s,h.append(c,d),o.appendChild(h)}else o.textContent=s;i.appendChild(o);let a=t.getAttribute("data-icon"),l=t.getAttribute("class")?.split(" ").filter(Boolean);if(a){let h=document.createElement("img");l?.length&&h.classList.add(...l),h.src=a,h.ariaHidden="true",i.prepend(h)}return this.dropdownOptions.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(){let t=this._getSelectedOptions(),s=this._values.filter(o=>t.indexOf(o.el)>=0).filter(o=>!o.el.disabled).map(o=>o.optionEl.querySelector("span").textContent.trim());if(s.length===0){let o=this.el.querySelector("option:disabled");if(o&&o.value===""){this.input.value=o.innerText;return}}this.input.value=s.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.dropdownOptions,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 Zt={margin:5,transition:10,duration:250,align:"left"},G=class u{constructor(n,t,e){this._handleDocumentClick=n=>{this.visible&&this.el!==n.target&&!n.target.closest(".display-docked")&&this.hide()};this.destroy=()=>{document.removeEventListener("click",this._handleDocumentClick),this.container.remove()};this.show=()=>{if(this.visible)return;this.visible=!0;let n=r._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>`,O._loadingTemplate=t.content.firstElementChild}return O._loadingTemplate.cloneNode(!0)}destroy(){this._removeEventHandlers(),this._removeDropdown(),this.el.Expressive_Autocomplete=void 0}_setupEventHandlers(){this.el.addEventListener("blur",this._handleInputBlur),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("mousedown",this._handleContainerMousedownAndTouchstart),this.container.addEventListener("mouseup",this._handleContainerMouseupAndTouchend),typeof window.ontouchstart<"u"&&(this.container.addEventListener("touchstart",this._handleContainerMousedownAndTouchstart),this.container.addEventListener("touchend",this._handleContainerMouseupAndTouchend))}_removeEventHandlers(){this.el.removeEventListener("blur",this._handleInputBlur),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("mousedown",this._handleContainerMousedownAndTouchstart),this.container.removeEventListener("mouseup",this._handleContainerMouseupAndTouchend),typeof window.ontouchstart<"u"&&(this.container.removeEventListener("touchstart",this._handleContainerMousedownAndTouchstart),this.container.removeEventListener("touchend",this._handleContainerMouseupAndTouchend))}_setupDropdown(){this.container=document.createElement("ul"),this.container.style.maxHeight=this.options.maxDropDownHeight,this.container.id=`autocomplete-options-${r.guid()}`,this.container.classList.add("autocomplete-content","dropdown-content"),this.container.ariaExpanded="true",this.el.setAttribute("data-target",this.container.id),this.menuItems.forEach(o=>{let a=this._createDropdownItem(o);this.container.append(a)}),this.el.parentElement.appendChild(this.container);let t={...O.defaults.dropdownOptions,...this.options.dropdownOptions},e=t.onItemClick;t.onItemClick=o=>{if(!o)return;let a=o.getAttribute("data-id");this.selectOption(a),e&&typeof e=="function"&&e.call(this.dropdown,this.el)},this.dropdown=S.init(this.el,t);let i=this.el.parentElement.querySelector("label");if(i&&this.el.after(i),this.el.removeEventListener("click",this.dropdown._handleClick),!this.options.isMultiSelect&&this.options.selected.length!==0){let o=this.menuItems.filter(a=>a.id===this.selectedValues[0].id);this.el.value=o[0].text}this.el.value&&this.selectOption(this.el.value);let s=document.createElement("div");s.classList.add("status-info"),s.setAttribute("style","position: absolute;right:0;top:0;"),this.el.parentElement.appendChild(s),this._updateSelectedInfo()}_removeDropdown(){this.container.ariaExpanded="false",this.container.parentNode.removeChild(this.container)}_resetCurrentElementPosition(){this.activeIndex=-1,this.$active?.classList.remove("active")}_resetAutocomplete(){this.container.replaceChildren(),this._resetCurrentElementPosition(),this.oldVal=null,this.isOpen=!1,this._mousedown=!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)]}_createDropdownItem(t){let e=document.createElement("li");if(e.setAttribute("data-id",t.id),e.setAttribute("style","display:grid; grid-auto-flow: column; user-select: none; align-items: center;"),e.tabIndex=0,this.options.isMultiSelect){let h=document.createElement("div");h.classList.add("item-selection"),h.style.textAlign="center";let d=document.createElement("input");d.type="checkbox",d.checked=this.selectedValues.some(m=>m.id===t.id);let c=document.createElement("span");c.style.paddingLeft="21px",h.append(d,c),e.appendChild(h)}if(t.image){let h=document.createElement("img");h.classList.add("circle"),h.src=t.image,e.appendChild(h)}let i=this.el.value.toLocaleLowerCase(),s=this._highlightPartialText(i,(t.text||t.id).toString()),o=document.createElement("div");if(o.setAttribute("style","line-height:1.2;font-weight:500;"),this.options.allowUnsafeHTML)o.innerHTML=s[0]+'<span class="highlight">'+s[1]+"</span>"+s[2];else if(o.appendChild(document.createTextNode(s[0])),s[1]){let h=document.createElement("span");h.textContent=s[1],h.classList.add("highlight"),o.appendChild(h),o.appendChild(document.createTextNode(s[2]))}let a=document.createElement("div");if(a.classList.add("item-text"),a.setAttribute("style","padding:5px;overflow:hidden;"),e.appendChild(a),e.querySelector(".item-text").appendChild(o),typeof t.description=="string"||typeof t.description=="number"&&!isNaN(t.description)){let h=document.createElement("small");h.setAttribute("style","line-height:1.3;color:grey;white-space:nowrap;text-overflow:ellipsis;display:block;width:90%;overflow:hidden;"),h.innerText=t.description,e.querySelector(".item-text").appendChild(h)}let l=()=>this.options.isMultiSelect?t.image?"40px min-content auto":"40px auto":t.image?"min-content auto":"auto";return e.style.gridTemplateColumns=l(),e}_renderDropdown(){this._resetAutocomplete(),this.menuItems.length===0&&(this.menuItems=this.selectedValues);for(let t=0;t<this.menuItems.length;t++){let e=this._createDropdownItem(this.menuItems[t]);this.container.append(e)}}_setStatusLoading(){let t=this.el.parentElement.querySelector(".status-info");t&&t.replaceChildren(O._loadingIndicator())}_updateSelectedInfo(){let t=this.el.parentElement.querySelector(".status-info");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){this.menuItems=t,this.options.data=t,e&&(this.selectedValues=this.menuItems.filter(s=>e.indexOf(s.id)!==-1)),this.options.isMultiSelect?this._renderDropdown():this._refreshInputText(),i&&this.open(),this._updateSelectedInfo(),this._triggerChanged()}setValues(t){this.selectedValues=t,this._updateSelectedInfo(),this.options.isMultiSelect||this._refreshInputText(),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._renderDropdown(),this.el.focus()):(this.selectedValues=[e],this._refreshInputText(),this._resetAutocomplete(),this.close()),this._updateSelectedInfo(),this._triggerChanged())}selectOptions(t){let e=this.menuItems.filter(i=>t.indexOf(i.id)!==-1);e&&(this.selectedValues=e,this._renderDropdown())}};O._loadingTemplate=null;var B=O;var Xt={data:[],placeholder:"",secondaryPlaceholder:"",closeIconClass:"material-symbols",autocompleteOptions:{},autocompleteOnly:!1,limit:1/0,allowUserInput:!1,onChipAdd:null,onChipSelect:null,onChipDelete:null},M=class M extends f{constructor(t,e){super(t,e,M);this._handleChipClick=t=>{let e=t.target.closest(".chip"),i=t.target.classList.contains("close");if(e){let s=this._chips.indexOf(e);if(s<0)return;i?(this.deleteChip(s),this._input.focus()):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(M._keydown=!0,r.keys.ENTER.includes(t.key)){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(r.keys.BACKSPACE.includes(t.key)||r.keys.ARROW_LEFT.includes(t.key))&&this._input.value===""&&this.chipsData.length&&(t.preventDefault(),this.selectChip(this.chipsData.length-1))};this.el.Expressive_Chips=this,this.options={...M.defaults,...e},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("input-field"),this._setupInput(),this._setupEventHandlers(),this.el.append(this._input)),this._setupLabel()}static get defaults(){return Xt}static init(t,e={}){return super.init(t,e,M)}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),document.addEventListener("keydown",M._handleChipsKeydown),document.addEventListener("keyup",M._handleChipsKeyup),this.el.addEventListener("blur",M._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),document.removeEventListener("keydown",M._handleChipsKeydown),document.removeEventListener("keyup",M._handleChipsKeyup),this.el.removeEventListener("blur",M._handleChipsBlur,!0),this._input.removeEventListener("focus",this._handleInputFocus),this._input.removeEventListener("blur",this._handleInputBlur),this._input.removeEventListener("keydown",this._handleInputKeydown)}static _handleChipsKeydown(t){M._keydown=!0;let e=t.target.closest(".chips"),i=t.target&&e,s=t.target.tagName;if(s==="INPUT"||s==="TEXTAREA"||!i)return;let o=e.Expressive_Chips;if(o){if(r.keys.BACKSPACE.includes(t.key)||r.keys.DELETE.includes(t.key)){t.preventDefault();let a=o.chipsData.length;if(o._selectedChip){let l=o._chips.indexOf(o._selectedChip);o.deleteChip(l),o._selectedChip=null,a=Math.max(l-1,0)}o.chipsData.length?o.selectChip(a):o._input.focus()}else if(r.keys.ARROW_LEFT.includes(t.key)){if(o._selectedChip){let a=o._chips.indexOf(o._selectedChip)-1;if(a<0)return;o.selectChip(a)}}else if(r.keys.ARROW_RIGHT.includes(t.key)&&o._selectedChip){let a=o._chips.indexOf(o._selectedChip)+1;a>=o.chipsData.length?o._input.focus():o.selectChip(a)}}}static _handleChipsKeyup(){M._keydown=!1}static _handleChipsBlur(t){if(!M._keydown&&document.hidden){let i=t.target.closest(".chips")?.Expressive_Chips;i&&(i._selectedChip=null)}}_renderChip(t){if(!t.id)return;let e=document.createElement("div");if(e.classList.add("chip"),e.innerText=t.text||t.id,t.image){let i=document.createElement("img");i.setAttribute("src",t.image),e.insertBefore(i,e.firstChild)}if(this.options.allowUserInput){e.setAttribute("tabindex","0");let i=document.createElement("i");i.classList.add(this.options.closeIconClass,"close"),i.innerText="close",e.appendChild(i)}return e}_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",r.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._chips[t];e&&(e.remove(),this._chips.splice(t,1),this.chipsData.splice(t,1),this._setPlaceholder(),typeof this.options.onChipDelete=="function"&&this.options.onChipDelete(this.el,e))}selectChip(t){let e=this._chips[t];e&&(this._selectedChip=e,e.focus(),typeof this.options.onChipSelect=="function"&&this.options.onChipSelect(this.el,e))}static Init(){r.onDocumentReady(()=>{document.querySelectorAll(".chips").forEach(e=>{e.addEventListener("click",i=>{if(!e.Expressive_Chips&&i.target.classList.contains("close")){let s=i.target.closest(".chip");s&&s.remove()}})})})}};M._keydown=!1;var W=M;var Yt={},N=class u extends f{constructor(t,e){super(t,e,u);this._handleRangeChange=()=>{this._sync(),this.thumb.classList.add("active")};this._handleRangeMousedownTouchstart=t=>{this._mousedown=!0,this.el.classList.add("active"),this._sync(),t.type!=="input"&&this.thumb.classList.add("active")};this._handleRangeInputMousemoveTouchmove=()=>{this._mousedown&&(this._sync(),this.thumb.classList.add("active"))};this._handleRangeMouseupTouchend=()=>{this._mousedown=!1,this.el.classList.remove("active")};this._handleRangeBlurMouseoutTouchleave=()=>{this._mousedown||this.thumb.classList.remove("active")};this.el.Expressive_Range=this,this.options={...u.defaults,...e},this._mousedown=!1,this._setupThumb(),this._sync(),this._setupEventHandlers()}static get defaults(){return Yt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Range}destroy(){this._removeEventHandlers(),this._removeThumb(),this.el.Expressive_Range=void 0}_setupEventHandlers(){this.el.addEventListener("change",this._handleRangeChange),this.el.addEventListener("mousedown",this._handleRangeMousedownTouchstart),this.el.addEventListener("touchstart",this._handleRangeMousedownTouchstart),this.el.addEventListener("input",this._handleRangeInputMousemoveTouchmove),this.el.addEventListener("mousemove",this._handleRangeInputMousemoveTouchmove),this.el.addEventListener("touchmove",this._handleRangeInputMousemoveTouchmove,{passive:!0}),this.el.addEventListener("mouseup",this._handleRangeMouseupTouchend),this.el.addEventListener("touchend",this._handleRangeMouseupTouchend),this.el.addEventListener("blur",this._handleRangeBlurMouseoutTouchleave),this.el.addEventListener("mouseout",this._handleRangeBlurMouseoutTouchleave),this.el.addEventListener("touchleave",this._handleRangeBlurMouseoutTouchleave)}_removeEventHandlers(){this.el.removeEventListener("change",this._handleRangeChange),this.el.removeEventListener("mousedown",this._handleRangeMousedownTouchstart),this.el.removeEventListener("touchstart",this._handleRangeMousedownTouchstart),this.el.removeEventListener("input",this._handleRangeInputMousemoveTouchmove),this.el.removeEventListener("mousemove",this._handleRangeInputMousemoveTouchmove),this.el.removeEventListener("touchmove",this._handleRangeInputMousemoveTouchmove),this.el.removeEventListener("mouseup",this._handleRangeMouseupTouchend),this.el.removeEventListener("touchend",this._handleRangeMouseupTouchend),this.el.removeEventListener("blur",this._handleRangeBlurMouseoutTouchleave),this.el.removeEventListener("mouseout",this._handleRangeBlurMouseoutTouchleave),this.el.removeEventListener("touchleave",this._handleRangeBlurMouseoutTouchleave)}_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")}_sync(){let t=parseFloat(this.el.getAttribute("max"))||100,e=parseFloat(this.el.getAttribute("min"))||0,i=parseFloat(this.el.value)||0,s=t===e?0:(i-e)/(t-e),o=this.el.offsetLeft,a=this.el.offsetTop,l=this.el.offsetWidth,h=this.el.offsetHeight;this.el.style.setProperty("--md-comp-slider-active-fraction",`${s*100}%`),this.value.textContent=this.el.value,this._isVertical()?(this.thumb.style.left=`${o+l/2}px`,this.thumb.style.top=`${a+(1-s)*h}px`):(this.thumb.style.left=`${o+s*l}px`,this.thumb.style.top=`${a}px`)}static Init(){r.onDocumentReady(()=>{u.init(document.querySelectorAll("input[type=range]"),{})})}};var L=class L{static Init(){r.onDocumentReady(()=>{document.addEventListener("pointerdown",L._onPointerDown,{passive:!0}),document.addEventListener("pointerup",L._onPointerUp,{passive:!0}),document.addEventListener("pointercancel",L._onPointerCancel,{passive:!0})})}static _onPointerDown(n){if(!L._isPrimaryPress(n)){L._down=null;return}let t=L._backdropDialog(n);if(!t||!L._lightDismissible(t)||!L._outside(n,t)){L._down=null;return}L._down={dialog:t,pointerId:n.pointerId}}static _onPointerUp(n){let t=L._down;L._down=null,!(!t||t.pointerId!==n.pointerId)&&n.isPrimary&&(!t.dialog.isConnected||!t.dialog.open||L._lightDismissible(t.dialog)&&L._backdropDialog(n)===t.dialog&&L._outside(n,t.dialog)&&t.dialog.close())}static _onPointerCancel(){L._down=null}static _backdropDialog(n){let t=n.target;return!(t instanceof HTMLDialogElement)||!t.open?null:t}static _outside(n,t){let e=t.getBoundingClientRect();return n.clientX<e.left||n.clientX>e.right||n.clientY<e.top||n.clientY>e.bottom}static _isPrimaryPress(n){return n.isPrimary?n.pointerType!=="mouse"||n.button===0:!1}static _lightDismissible(n){let t=L._closedBy(n);return!(t==="none"||t==="closerequest"||t==="any"&&"closedBy"in HTMLDialogElement.prototype)}static _closedBy(n){let t=n.getAttribute("closedby");return t==="any"||t==="closerequest"||t==="none"?t:null}};L._down=null;var $=L;var q=class u{static validateField(n){if(!n){console.error("No text field element found");return}let t=n.getAttribute("data-length")!==null,e=parseInt(n.getAttribute("data-length")),i=n.value.length;i===0&&n.validity.badInput===!1&&!n.required&&n.classList.contains("validate")?n.classList.remove("invalid"):n.classList.contains("validate")&&(n.validity.valid&&t&&i<=e||n.validity.valid&&!t?n.classList.remove("invalid"):n.classList.add("invalid"))}static textareaAutoResize(n){let t=n;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(){r.onDocumentReady(()=>{document.addEventListener("change",n=>{let t=n.target;t instanceof HTMLInputElement&&u.validateField(t)}),document.addEventListener("keyup",n=>{let t=n.target;t instanceof HTMLInputElement&&["radio","checkbox"].includes(t.type)&&r.keys.TAB.includes(n.key)&&(t.classList.add("tabbed"),t.addEventListener("blur",()=>t.classList.remove("tabbed"),{once:!0}))}),document.querySelectorAll(".expressive-textarea").forEach(n=>{u.InitTextarea(n)}),document.querySelectorAll('.file-field input[type="file"]').forEach(n=>{u.InitFileInputPath(n)})})}static InitTextarea(n){n.setAttribute("original-height",n.getBoundingClientRect().height.toString()),u.textareaAutoResize(n),n.addEventListener("input",t=>u.textareaAutoResize(t.target))}static InitFileInputPath(n){n.addEventListener("change",()=>{let e=n.closest(".file-field").querySelector("input.file-path"),i=n.files,s=[];for(let o=0;o<i.length;o++)s.push(i[o].name);e.value=s.join(", "),e.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))})}};var K=class u{static _offset(n){let t=n.getBoundingClientRect(),e=document.documentElement;return{top:t.top+window.pageYOffset-e.clientTop,left:t.left+window.pageXOffset-e.clientLeft}}static renderWaveEffect(n,t=null,e=null){let i=t===null,s=500,o,a,l=function(h){a||(a=h);let d=h-a;if(d<s){let c=d/s*(2-d/s),m=i?"circle at 50% 50%":`circle at ${t.x}px ${t.y}px`,g=`rgba(${e?.r||0}, ${e?.g||0}, ${e?.b||0}, ${.3*(1-c)})`,E=90*c+"%";n.style.backgroundImage="radial-gradient("+m+", "+g+" "+E+", transparent "+E+")",o=window.requestAnimationFrame(l)}else n.style.backgroundImage="none",window.cancelAnimationFrame(o)};o=window.requestAnimationFrame(l)}static Init(){r.onDocumentReady(()=>{document.body.addEventListener("click",n=>{let t=n.target,e=t.closest(".waves-effect");if(e&&e.contains(t)){let i=e.classList.contains("waves-circle"),s=u._offset(e),o=n.pageX-s.left,a=n.pageY-s.top,l=null;e.classList.contains("waves-light")&&(l={r:255,g:255,b:255}),u.renderWaveEffect(e,i?null:{x:o,y:a},l)}})})}};var zt={direction:"top",hoverEnabled:!0,toolbarEnabled:!1},X=class u extends f{constructor(t,e){super(t,e,u);this.open=()=>{this.isOpen||(this.isOpen=!0,this.el.classList.add("active"),this._anchor?.setAttribute("aria-expanded","true"),document.addEventListener("click",this._handleDocumentClick),document.addEventListener("keydown",this._handleDocumentKeydown))};this.close=()=>{this.isOpen&&(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=>{t.stopPropagation(),this._toggle()};this._handleAnchorKeydown=t=>{(r.keys.ENTER.includes(t.key)||t.key===" ")&&(t.preventDefault(),this._toggle())};this._handleDocumentKeydown=t=>{r.keys.ESC.includes(t.key)&&this.close()};this._handleDocumentClick=t=>{let e=t.target;!(e instanceof Node)||this.el.contains(e)||this.close()};this.el.Expressive_FloatingActionButton=this;let i=this._directionFromClass(),s=t.classList.contains("toolbar")||e.toolbarEnabled===!0,o=t.classList.contains("click-to-toggle")||e.hoverEnabled===!1;this.options={...u.defaults,...e,direction:e.direction??i??u.defaults.direction,hoverEnabled:!o,toolbarEnabled:s},this.isOpen=!1,this._anchor=this.el.querySelector(":scope > a, :scope > button"),this._menu=this.el.querySelector("ul, menu"),this.el.classList.add(`direction-${this.options.direction}`),o&&this.el.classList.add("click-to-toggle"),s&&this.el.classList.add("toolbar"),this._anchor&&(this._anchor.setAttribute("aria-haspopup","menu"),this._anchor.setAttribute("aria-expanded","false"),this._anchor instanceof HTMLAnchorElement&&!this._anchor.hasAttribute("href")&&this._anchor.tabIndex<0&&(this._anchor.tabIndex=0)),this._menu&&this._menu.setAttribute("role","menu"),this._setupEventHandlers()}static get defaults(){return zt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_FloatingActionButton}destroy(){this.close(),this._removeEventHandlers(),this.el.Expressive_FloatingActionButton=void 0}_directionFromClass(){let e=[...this.el.classList].find(i=>i.startsWith("direction-"))?.slice(10);return e==="top"||e==="right"||e==="bottom"||e==="left"?e:null}_setupEventHandlers(){this.el.addEventListener("click",this._handleFABClick),this._anchor instanceof HTMLAnchorElement&&!this._anchor.hasAttribute("href")&&this._anchor.addEventListener("keydown",this._handleAnchorKeydown)}_removeEventHandlers(){this.el.removeEventListener("click",this._handleFABClick),this._anchor?.removeEventListener("keydown",this._handleAnchorKeydown)}_toggle(){this.isOpen?this.close():this.open()}};var Ut={duration:200,dist:-100,shift:0,padding:0,numVisible:5,fullWidth:!1,indicators:!1,noWrap:!1,onCycleTo:null},w=class w extends f{constructor(t,e){super(t,e,w);this.center=0;this._ownIndicators=!1;this._trackEl=null;this._ignoreScroll=!1;this._trackRaf=null;this._started=!1;this._handleThrottledResize=r.throttle(()=>this._handleResize(),200);this._handleCarouselTap=t=>{if(t.pointerType==="mouse"&&t.button!==0)return;t.target instanceof HTMLElement&&t.target.tagName==="IMG"&&t.preventDefault(),this.pressed=!0,this.dragged=!1,this.verticalDragged=!1,this.reference=t.clientX,this.referenceY=t.clientY,this.velocity=this.amplitude=0,this.frame=this.offset,this.timestamp=Date.now();try{this.el.setPointerCapture(t.pointerId)}catch{}this._trackRaf!==null&&cancelAnimationFrame(this._trackRaf);let e=()=>{this._track(),this.pressed?this._trackRaf=requestAnimationFrame(e):this._trackRaf=null};this._trackRaf=requestAnimationFrame(e)};this._handleCarouselDrag=t=>{if(!this.pressed)return;let e=this.reference-t.clientX;Math.abs(this.referenceY-t.clientY)<30&&!this.verticalDragged?(e>2||e<-2)&&(this.dragged=!0,this.reference=t.clientX,this._scroll(this.offset+e)):this.dragged?t.preventDefault():this.verticalDragged=!0,this.dragged&&t.preventDefault()};this._handleCarouselRelease=t=>{if(this.pressed){this.pressed=!1,this._trackRaf!==null&&(cancelAnimationFrame(this._trackRaf),this._trackRaf=null);try{this.el.releasePointerCapture(t.pointerId)}catch{}this.target=this.offset,(this.velocity>10||this.velocity<-10)&&(this.amplitude=.9*this.velocity,this.target=this.offset+this.amplitude),this.target=Math.round(this.target/this.dim)*this.dim,this.noWrap&&(this.target>=this.dim*(this.count-1)?this.target=this.dim*(this.count-1):this.target<0&&(this.target=0)),this.amplitude=this.target-this.offset,this.timestamp=Date.now(),requestAnimationFrame(this._autoScroll),this.dragged&&t.preventDefault()}};this._handleCarouselClick=t=>{if(this.dragged){t.preventDefault(),t.stopPropagation();return}let e=t.target.closest(".carousel-item");if(!e||!this.el.contains(e))return;let i=this.images.indexOf(e);this._wrap(this.center)-i!==0&&(t.preventDefault(),t.stopPropagation()),i<0?t.clientX-t.target.getBoundingClientRect().left>this.el.clientWidth/2?this.next():this.prev():this._cycleTo(i)};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=>{t.target.closest('input, textarea, select, [contenteditable="true"]')||(r.keys.ARROW_RIGHT.includes(t.key)?(t.preventDefault(),this.next()):r.keys.ARROW_LEFT.includes(t.key)&&(t.preventDefault(),this.prev()))};this._handleFlatScroll=()=>{if(this._ignoreScroll)return;let t=this._nearestIndex();t!==this.center&&this._syncActive(t,this.dragged)};this._handleResize=()=>{if(this.images.length){if(this._flat){this._scrollToIndex(this.center,!1);return}if(this.options.fullWidth){let t=this.images[0];if(!t)return;this.itemWidth=t.clientWidth,this.dim=this.itemWidth*2+this.options.padding,this.offset=this.center*2*this.itemWidth,this.target=this.offset}else this._scroll()}};this._track=()=>{let t=Date.now(),e=t-this.timestamp,s=1e3*(this.offset-this.frame)/(1+e);this.timestamp=t,this.frame=this.offset,this.velocity=.8*s+.2*this.velocity};this._autoScroll=()=>{if(!this.amplitude)return;let t=Date.now()-this.timestamp,e=this.amplitude*Math.exp(-t/this.options.duration);e>2||e<-2?(this._scroll(this.target-e),requestAnimationFrame(this._autoScroll)):this._scroll(this.target)};if(this.el.Expressive_Carousel=this,this.options={...w.defaults,...e},this._flat=this.options.fullWidth||this.el.classList.contains("flat")||this.el.classList.contains("carousel-slider"),this._flat&&(this.el.classList.add("flat"),this.options.fullWidth=!0,this.options.dist=0),window.matchMedia("(prefers-reduced-motion: reduce)").matches&&(this.options.duration=1,this._flat||(this.options.dist=0)),this.pressed=!1,this.dragged=!1,this.offset=this.target=0,this.images=this._collectItems(),!this.images.length){console.error("Carousel: no .carousel-item elements to show");return}this.hasMultipleSlides=this.images.length>1,this.showIndicators=this.options.indicators&&this.hasMultipleSlides,this.noWrap=this.options.noWrap||!this.hasMultipleSlides||this._flat,this.count=this.images.length,this.options.numVisible=Math.min(this.count,this.options.numVisible),this.images.forEach(s=>s.classList.add("carousel-item")),this._flat&&this._wrapTrack();let i=this.images[0];if(this.itemWidth=i.clientWidth||this.el.clientWidth||1,this.itemHeight=i.clientHeight||this.el.clientHeight||1,this.dim=this.itemWidth*2+this.options.padding||1,this.showIndicators&&this._setupIndicators(),this.el.tabIndex=this.el.tabIndex>=0?this.el.tabIndex:0,this.el.setAttribute("aria-roledescription","carousel"),this._setupEventHandlers(),this._started=!0,this._flat){let s=Math.max(0,this.images.findIndex(o=>o.classList.contains("active")));this.center=s,this._syncActive(s,!1),this._scrollToIndex(s,!1)}else this._scroll(this.offset)}get _scroller(){return this._trackEl??this.el}static get defaults(){return Ut}static init(t,e={}){return super.init(t,e,w)}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")}_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","Slides"),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",`Slide ${i+1}`),this._indicators.appendChild(s)}),this._ownIndicators&&this.el.appendChild(this._indicators),this._flat&&this.el.querySelector(".carousel-fixed-item")?.classList.add("with-indicators")}_setupEventHandlers(){if(this.el.addEventListener("keydown",this._handleKeydown),this.showIndicators&&this._indicators&&this._indicators.addEventListener("click",this._handleIndicatorClick),w._live.add(this),w._resizeListening||(window.addEventListener("resize",w._onResize,{passive:!0}),w._resizeListening=!0),this._flat){this._scroller.addEventListener("scroll",this._handleFlatScroll,{passive:!0});return}this.el.addEventListener("pointerdown",this._handleCarouselTap),this.el.addEventListener("pointermove",this._handleCarouselDrag),this.el.addEventListener("pointerup",this._handleCarouselRelease),this.el.addEventListener("pointercancel",this._handleCarouselRelease),this.el.addEventListener("click",this._handleCarouselClick)}_removeEventHandlers(){this.el.removeEventListener("keydown",this._handleKeydown),this._indicators&&this._indicators.removeEventListener("click",this._handleIndicatorClick),this._scroller.removeEventListener("scroll",this._handleFlatScroll),this.el.removeEventListener("pointerdown",this._handleCarouselTap),this.el.removeEventListener("pointermove",this._handleCarouselDrag),this.el.removeEventListener("pointerup",this._handleCarouselRelease),this.el.removeEventListener("pointercancel",this._handleCarouselRelease),this.el.removeEventListener("click",this._handleCarouselClick),w._live.delete(this),w._live.size===0&&w._resizeListening&&(window.removeEventListener("resize",w._onResize),w._resizeListening=!1)}_teardown(){this._removeEventHandlers(),this._trackRaf!==null&&cancelAnimationFrame(this._trackRaf),window.clearTimeout(this.scrollingTimeout),this._ownIndicators&&this._indicators?.remove(),this._unwrapTrack(),this.images.forEach(t=>{t.style.transform="",t.style.zIndex="",t.style.opacity="",t.style.visibility=""})}_xpos(t){return"clientX"in t?t.clientX:0}_ypos(t){return"clientY"in t?t.clientY:0}_wrap(t){return t>=this.count?t%this.count:t<0?this._wrap(this.count+t%this.count):t}_scroll(t=0){this.el.classList.contains("scrolling")||this.el.classList.add("scrolling"),window.clearTimeout(this.scrollingTimeout),this.scrollingTimeout=setTimeout(()=>{this.el.classList.remove("scrolling")},this.options.duration),this.offset=typeof t=="number"?t:this.offset,this.center=Math.floor((this.offset+this.dim/2)/this.dim);let e=this.count>>1,i=this.offset-this.center*this.dim,s=i<0?1:-1,o=-s*i*2/this.dim,a=this.center,l=1/this.options.numVisible,h,d;if(this.options.fullWidth?(h="translateX(0)",d=1):(h="translateX("+(this.el.clientWidth-this.itemWidth)/2+"px) ",h+="translateY("+(this.el.clientHeight-this.itemHeight)/2+"px)",d=1-l*o),this._paintIndicators(this.center),!this.noWrap||this.center>=0&&this.center<this.count){let m=this.images[this._wrap(this.center)];m&&!m.classList.contains("active")&&(this.el.querySelector(".carousel-item.active")?.classList.remove("active"),m.classList.add("active"))}for(let m=1;m<=e;++m){let g,E;if(this.options.fullWidth?(g=this.options.dist,E=m===e&&i<0?1-o:1):(g=this.options.dist*(m*2+o*s),E=1-l*(m*2+o*s)),!this.noWrap||this.center+m<this.count){let T=this.images[this._wrap(this.center+m)],x=`${h} translateX(${this.options.shift+(this.dim*m-i)/2}px) translateZ(${g}px)`;this._updateItemStyle(T,E,-m,x)}if(this.options.fullWidth?(g=this.options.dist,E=m===e&&i>0?1-o:1):(g=this.options.dist*(m*2-o*s),E=1-l*(m*2-o*s)),!this.noWrap||this.center-m>=0){let T=this.images[this._wrap(this.center-m)],x=`${h} translateX(${-this.options.shift+(-this.dim*m-i)/2}px) translateZ(${g}px)`;this._updateItemStyle(T,E,-m,x)}}if(!this.noWrap||this.center>=0&&this.center<this.count){let m=this.images[this._wrap(this.center)],g=`${h} translateX(${-i/2}px) translateX(${s*this.options.shift*o}px) translateZ(${this.options.dist*o}px)`;this._updateItemStyle(m,d,0,g)}let c=this.images[this._wrap(this.center)];this._syncA11y(this._wrap(this.center)),a!==this.center&&typeof this.options.onCycleTo=="function"&&this.options.onCycleTo.call(this,c,this.dragged),typeof this.oneTimeCallback=="function"&&(this.oneTimeCallback.call(this,c,this.dragged),this.oneTimeCallback=null)}_updateItemStyle(t,e,i,s){t&&(t.style.transform=s,t.style.zIndex=i.toString(),t.style.opacity=e.toString(),t.style.visibility="visible")}_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 o=s===e;i.classList.toggle("active",o),o?i.setAttribute("aria-current","true"):i.removeAttribute("aria-current")})}_syncA11y(t){this.images.forEach((e,i)=>{i===t?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")})}_syncActive(t,e){let i=this.center;this.center=t,this.images.forEach((o,a)=>o.classList.toggle("active",a===t)),this._paintIndicators(t),this._syncA11y(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)}_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._scroller.scrollLeft,e=0,i=1/0;return this.images.forEach((s,o)=>{let a=Math.abs(s.offsetLeft-t);a<i&&(i=a,e=o)}),e}_scrollToIndex(t,e=!0){let i=this.images[t];if(!i)return;let s=i.offsetLeft;if(Math.abs(this._scroller.scrollLeft-s)<1){this._syncActive(t,!1);return}this._ignoreScroll=!0,this._scroller.scrollTo({left:s,behavior:e?"smooth":"auto"});let o=()=>{this._ignoreScroll=!1};this._scroller.addEventListener("scrollend",o,{once:!0}),window.setTimeout(o,this.options.duration+350)}_cycleTo(t,e=null){if(this._flat){typeof e=="function"&&(this.oneTimeCallback=e),this._syncActive(t,!1),this._scrollToIndex(t);return}let i=this.center%this.count-t;this.noWrap||(i<0?Math.abs(i+this.count)<Math.abs(i)&&(i+=this.count):i>0&&Math.abs(i-this.count)<i&&(i-=this.count)),this.target=this.dim*Math.round(this.offset/this.dim),i<0?this.target+=this.dim*Math.abs(i):i>0&&(this.target-=this.dim*i),typeof e=="function"&&(this.oneTimeCallback=e),this.offset!==this.target&&(this.amplitude=this.target-this.offset,this.timestamp=Date.now(),requestAnimationFrame(this._autoScroll))}next(t=1){(t===void 0||isNaN(t))&&(t=1);let e=this.center+t;if(e>=this.count||e<0){if(this.noWrap)return;e=this._wrap(e)}this._cycleTo(e)}prev(t=1){(t===void 0||isNaN(t))&&(t=1);let e=this.center-t;if(e>=this.count||e<0){if(this.noWrap)return;e=this._wrap(e)}this._cycleTo(e)}set(t,e){if((t===void 0||isNaN(t))&&(t=0),t>this.count||t<0){if(this.noWrap)return;t=this._wrap(t)}this._cycleTo(t,e)}};w._live=new Set,w._resizeListening=!1,w._onResize=r.throttle(()=>{w._live.forEach(t=>t._handleResize())},200);var F=w;var jt=Object.freeze({}),ct=class u extends f{constructor(t,e){super(t,{},u);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={...u.defaults,...e},this.isInvalid=!1,this.isValidLength=!1,this._setupCounter(),this._setupEventHandlers()}static get defaults(){return jt}static init(t,e={}){return super.init(t,e,u)}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.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 Gt={accordion:!0,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,inDuration:300,outDuration:300},Y=class u extends f{constructor(t,e){super(t,e,u);this._items=[];this._endTimers=[];this._wrappedBodies=[];this.open=t=>{let e=this._items[t];!e||this._isOpen(e)||(this.options.accordion&&this._items.forEach((i,s)=>{s!==t&&this._isOpen(i)&&this.close(s)}),this._setOpen(e,!0))};this.close=t=>{let e=this._items[t];!e||!this._isOpen(e)||this._setOpen(e,!1)};this._handleClick=t=>{let e=t.target.closest(".collapsible-header");if(!e||e.closest(".collapsible")!==this.el||e.closest("details"))return;let i=e.closest("li");if(!i)return;let s=this._items.indexOf(i);s<0||(this._isOpen(i)?this.close(s):this.open(s))};this._handleKeydown=t=>{if(!r.keys.ENTER.includes(t.key)&&t.key!==" ")return;let e=t.target.closest(".collapsible-header");if(!e||e.closest(".collapsible")!==this.el||e.closest("details")||e.matches("a, button"))return;t.preventDefault();let i=e.closest("li");if(!i)return;let s=this._items.indexOf(i);s<0||(this._isOpen(i)?this.close(s):this.open(s))};this._handleToggle=t=>{let e=t.target;e instanceof HTMLDetailsElement&&this._items.includes(e)&&this._notify(e,e.open)};this.el.Expressive_Collapsible=this;let i=e.accordion!==void 0?e.accordion:!t.classList.contains("expandable");this.options={...u.defaults,...e,accordion:i},this._groupName=t.id?`collapsible-${t.id}`:`collapsible-${r.guid()}`,this._items=this._collectItems(),this._wrapDetailsBodies(),this._setupItems(),this._setupEventHandlers()}static get defaults(){return Gt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Collapsible}destroy(){this._removeEventHandlers(),this._endTimers.forEach(t=>clearTimeout(t)),this._endTimers=[],this._unwrapDetailsBodies(),this.el.Expressive_Collapsible=void 0}_collectItems(){let t=Array.from(this.el.querySelectorAll(":scope > details"));return t.length?t:Array.from(this.el.children).filter(e=>e.tagName==="LI")}_setupItems(){this.options.accordion&&this._items.forEach(e=>{e instanceof HTMLDetailsElement&&!e.getAttribute("name")&&e.setAttribute("name",this._groupName)});let t=this._items.filter(e=>this._isOpen(e));this.options.accordion&&t.length>1&&t.slice(1).forEach(e=>{e instanceof HTMLDetailsElement?e.open=!1:e.classList.remove("active")}),this._items.forEach(e=>this._syncAria(e))}_isOpen(t){return t instanceof HTMLDetailsElement?t.open:t.classList.contains("active")}_setOpen(t,e){if(t instanceof HTMLDetailsElement){t.open=e;return}t.classList.toggle("active",e),this._syncAria(t),this._notify(t,e)}_headerOf(t){return t instanceof HTMLDetailsElement?t.querySelector(":scope > summary"):t.querySelector(":scope > .collapsible-header")}_wrapDetailsBodies(){this._items.forEach(t=>{if(!(t instanceof HTMLDetailsElement)||t.querySelector(":scope > .collapsible-body"))return;let e=document.createElement("div");e.className="collapsible-body",Array.from(t.childNodes).forEach(i=>{i instanceof HTMLElement&&i.tagName==="SUMMARY"||e.appendChild(i)}),t.appendChild(e),this._wrappedBodies.push(e)})}_unwrapDetailsBodies(){this._wrappedBodies.forEach(t=>{let e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);t.remove()}}),this._wrappedBodies=[]}_bodyOf(t){return t.querySelector(":scope > .collapsible-body")}_syncAria(t){if(t instanceof HTMLDetailsElement)return;let e=this._headerOf(t),i=this._bodyOf(t);e&&(e.setAttribute("aria-expanded",String(this._isOpen(t))),i&&(i.id||(i.id=`collapsible-body-${r.guid()}`),e.setAttribute("aria-controls",i.id)),e.matches("a, button, summary")||(e.setAttribute("role","button"),e.tabIndex<0&&(e.tabIndex=0)))}_setupEventHandlers(){this.el.addEventListener("click",this._handleClick),this.el.addEventListener("keydown",this._handleKeydown),this.el.addEventListener("toggle",this._handleToggle,!0)}_removeEventHandlers(){this.el.removeEventListener("click",this._handleClick),this.el.removeEventListener("keydown",this._handleKeydown),this.el.removeEventListener("toggle",this._handleToggle,!0)}_notify(t,e){let i=e?this.options.onOpenStart:this.options.onCloseStart;typeof i=="function"&&i.call(this,t);let s=e?this.options.onOpenEnd:this.options.onCloseEnd;if(typeof s!="function")return;let o=this._bodyOf(t)??t,a=!1,l=()=>{a||(a=!0,o.removeEventListener("transitionend",h),s.call(this,t))},h=d=>{d.target===o&&l()};o.addEventListener("transitionend",h),this._endTimers.push(window.setTimeout(l,this._durationMs()+50))}_durationMs(){let t=getComputedStyle(this.el).getPropertyValue("--md-comp-collapsible-duration").trim();if(!t)return 500;if(t.endsWith("ms"))return parseFloat(t);if(t.endsWith("s"))return parseFloat(t)*1e3;let e=parseFloat(t);return Number.isFinite(e)?e:500}};var Zt={classes:"",dropdownOptions:{}},H=class u extends f{constructor(t,e){super(t,e,u);this._handleSelectChange=()=>{this._setValueToInput()};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._handleInputClick=()=>{this.dropdown&&this.dropdown.isOpen&&(this._setValueToInput(),this._setSelectedStates())};!this.el.classList.contains("browser-default")&&(this.el.Expressive_FormSelect=this,this.options={...u.defaults,...e},this.isMultiple=this.el.multiple,this.nativeTabIndex=this.el.tabIndex??-1,this.el.tabIndex=-1,this._values=[],this._setupDropdown(),this._setupEventHandlers())}static get defaults(){return Zt}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_FormSelect}destroy(){this._removeEventHandlers(),this.dropdown?.destroy(),this._removeDropdown(),this.el.Expressive_FormSelect=void 0}refresh(){this._setValueToInput(),this._setSelectedStates()}_setupEventHandlers(){this.dropdownOptions.querySelectorAll("li:not(.optgroup)").forEach(t=>{t.addEventListener("click",this._handleOptionClick),t.addEventListener("keydown",this._handleOptionKeydown)}),this.el.addEventListener("change",this._handleSelectChange),this.input.addEventListener("click",this._handleInputClick)}_removeEventHandlers(){this.dropdownOptions.querySelectorAll("li:not(.optgroup)").forEach(t=>{t.removeEventListener("click",this._handleOptionClick),t.removeEventListener("keydown",this._handleOptionKeydown)}),this.el.removeEventListener("change",this._handleSelectChange),this.input.removeEventListener("click",this._handleInputClick)}_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(!t.classList.contains("disabled")&&!t.classList.contains("optgroup")){let e=this._values.find(a=>a.optionEl===t),i=this.getSelectedValues();this.isMultiple?this._toggleEntryFromArray(e):(this._deselectAll(),this._selectValue(e)),this._setValueToInput();let s=this.getSelectedValues();!this._arraysEqual(i,s)&&this.el.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0,composed:!0}))}this.isMultiple||this.dropdown.close()}_setupDropdown(){this.labelEl=this.el.labels?.[0]??null,this.wrapper=document.createElement("div"),this.wrapper.classList.add("select-wrapper","input-field"),this.options.classes.length>0&&this.wrapper.classList.add(...this.options.classes.split(" ").filter(Boolean)),this.el.before(this.wrapper);let t=document.createElement("div");t.classList.add("hide-select"),this.wrapper.append(t),t.appendChild(this.el),this.el.disabled&&this.wrapper.classList.add("disabled"),this.selectOptions=Array.from(this.el.children).filter(s=>["OPTION","OPTGROUP"].includes(s.tagName)),this.dropdownOptions=document.createElement("ul"),this.dropdownOptions.id=`select-options-${r.guid()}`,this.dropdownOptions.setAttribute("popover","auto"),this.dropdownOptions.classList.add("dropdown-content","select-dropdown"),this.dropdownOptions.setAttribute("role","listbox"),this.dropdownOptions.ariaMultiSelectable=this.isMultiple.toString(),this.isMultiple&&this.dropdownOptions.classList.add("multiple-select-dropdown"),this.selectOptions.length>0&&this.selectOptions.forEach(s=>{if(s.tagName==="OPTION"){let o=this._createAndAppendOptionWithIcon(s,this.isMultiple?"multiple":void 0);this._addOptionToValues(s,o)}else if(s.tagName==="OPTGROUP"){let o="opt-group-"+r.guid(),a=document.createElement("li");a.classList.add("optgroup"),a.tabIndex=-1,a.setAttribute("role","group"),a.setAttribute("aria-labelledby",o);let l=document.createElement("span");l.id=o,l.setAttribute("role","presentation"),l.textContent=s.getAttribute("label")??"",a.replaceChildren(l),this.dropdownOptions.append(a);let h=[];Array.from(s.children).filter(c=>c.tagName==="OPTION").forEach(c=>{let m=this._createAndAppendOptionWithIcon(c,"optgroup-option"),g="opt-child-"+r.guid();m.id=g,h.push(g),this._addOptionToValues(c,m)}),a.setAttribute("aria-owns",h.join(" "))}}),this.wrapper.append(this.dropdownOptions),this.input=document.createElement("input"),this.input.id="m_select-input-"+r.guid(),this.input.classList.add("select-dropdown","dropdown-trigger"),this.input.type="text",this.input.readOnly=!0,this.input.setAttribute("data-target",this.dropdownOptions.id),this.input.ariaReadOnly="true",this.input.ariaRequired=this.el.hasAttribute("required").toString(),this.el.disabled&&(this.input.disabled=!0),this.input.setAttribute("tabindex",this.nativeTabIndex.toString());let e=this.el.attributes;for(let s=0;s<e.length;++s){let o=e[s];o.name.startsWith("aria-")&&this.input.setAttribute(o.name,o.value)}this.input.setAttribute("role","combobox"),this.input.ariaExpanded="false",this.input.setAttribute("aria-owns",this.dropdownOptions.id),this.input.setAttribute("aria-controls",this.dropdownOptions.id),this.input.placeholder=" ",this.wrapper.prepend(this.input),this._setValueToInput();let i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i.classList.add("caret"),i.setAttribute("height","24"),i.setAttribute("width","24"),i.setAttribute("viewBox","0 0 24 24"),i.ariaHidden="true",i.innerHTML='<path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/>',this.wrapper.prepend(i),!this.el.disabled){let s={...this.options.dropdownOptions};s.coverTrigger=!1;let o=s.onOpenEnd,a=s.onCloseEnd;s.onOpenEnd=()=>{let l=this.dropdownOptions.querySelector(".selected");if(l&&(r.keyDown=!0,this.dropdown.focusedIndex=[...l.parentNode.children].indexOf(l),this.dropdown._focusFocusedItem(),r.keyDown=!1,this.dropdown.isScrollable)){let h=l.getBoundingClientRect().top-this.dropdownOptions.getBoundingClientRect().top;h-=this.dropdownOptions.clientHeight/2,this.dropdownOptions.scrollTop=h}this.input.ariaExpanded="true",o&&typeof o=="function"&&o.call(this.dropdown,this.el)},s.onCloseEnd=()=>{this.input.ariaExpanded="false",a&&typeof a=="function"&&a.call(this.dropdown,this.el)},s.closeOnClick=!1,this.dropdown=S.init(this.input,s)}this._setSelectedStates(),this.labelEl&&this.input.after(this.labelEl)}_addOptionToValues(t,e){this._values.push({el:t,optionEl:e})}_removeDropdown(){this.wrapper.querySelector(".caret").remove(),this.input.remove(),this.dropdownOptions.remove(),this.wrapper.before(this.el),this.wrapper.remove()}_createAndAppendOptionWithIcon(t,e){let i=document.createElement("li");i.setAttribute("role","option"),t.disabled&&(i.classList.add("disabled"),i.ariaDisabled="true"),e==="optgroup-option"&&i.classList.add(e);let s=t.textContent,o=document.createElement("span");if(this.isMultiple&&!t.disabled){let h=document.createElement("label"),d=document.createElement("input");d.type="checkbox";let c=document.createElement("span");c.textContent=s,h.append(d,c),o.appendChild(h)}else o.textContent=s;i.appendChild(o);let a=t.getAttribute("data-icon"),l=t.getAttribute("class")?.split(" ").filter(Boolean);if(a){let h=document.createElement("img");l?.length&&h.classList.add(...l),h.src=a,h.ariaHidden="true",i.prepend(h)}return this.dropdownOptions.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(){let t=this._getSelectedOptions(),s=this._values.filter(o=>t.indexOf(o.el)>=0).filter(o=>!o.el.disabled).map(o=>o.optionEl.querySelector("span").textContent.trim());if(s.length===0){let o=this.el.querySelector("option:disabled");if(o&&o.value===""){this.input.value=o.innerText;return}}this.input.value=s.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.dropdownOptions,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 Qt={margin:5,transition:10,duration:250,align:"left"},z=class u{constructor(n,t,e){this._handleDocumentClick=n=>{this.visible&&this.el!==n.target&&!n.target.closest(".display-docked")&&this.hide()};this.destroy=()=>{document.removeEventListener("click",this._handleDocumentClick),this.container.remove()};this.show=()=>{if(this.visible)return;this.visible=!0;let n=r._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(${n.x}px) translateY(${n.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=n,this.options={...Zt,...e},this.container=document.createElement("div"),this.container.classList.add("display-docked"),this.container.append(t),n.parentElement.append(this.container),document.addEventListener("click",this._handleDocumentClick)}static init(n,t,e){return new u(n,t,e)}};var Qt={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},v=class v extends f{constructor(t,e){super(t,e,v);this.multiple=!1;this._drawDepth=0;this._drawDirty=!1;this._controlsKey=null;this._randId=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=>{r.keys.ENTER.includes(t.key)&&(t.preventDefault(),this._batchDraws(()=>{this.setDateFromInput(t.target),this.draw()}),this.displayPlugin&&this.displayPlugin.show(),this.options.onInputInteraction&&this.options.onInputInteraction.call(this))};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")){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||!v._compareDates(t,this.endDate)){if(v._isDate(this.date)&&v._comparePastDate(t,this.date))return;this.setDate(t,!1,v._isDate(this.date));return}this._clearDates(),this.draw()};this._handleClearClick=()=>{this._clearDates(),this.setInputValues()};this._clearDates=()=>{this.date=null,this.endDate=null,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;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=new Date(Date.parse(t.target.value)),v._isDate(e)&&(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={...v.defaults,...e},e&&e.hasOwnProperty("i18n")&&typeof e.i18n=="object"&&(this.options.i18n={...v.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=r.guid(),this._setupVariables(),this._insertHTMLIntoDOM(),this._setupEventHandlers(),this.options.defaultDate||(this.options.defaultDate=new Date(Date.parse(this.el.value)));let i=this.options.defaultDate;if(v._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;v._isDate(s)&&this.options.setDefaultEndDate&&(this.setDate(s,!0,!0),this.setInputValue(this.endDateEl,s))}this.options.isMultipleSelection&&(this.multiple=!0,this.dates=[],this.dateEls=[],this.dateEls.push(t)),this.options.displayPlugin&&this.options.displayPlugin==="docked"&&(this.displayPlugin=G.init(this.el,this.containerEl,this.options.displayPluginOptions))}static get defaults(){return Qt}static init(t,e={}){return super.init(t,e,v)}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 _isWeekend(t){let e=t.getDay();return e===0||e===6}static _setToStartOfDay(t){v._isDate(t)&&t.setHours(0,0,0,0)}static _getDaysInMonth(t,e){return[31,v._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.displayPlugin?.destroy(),this.containerEl.remove(),this.destroySelects(),this.el.Expressive_Datepicker=void 0}destroySelects(){let t=this.calendarEl.querySelector(".orig-select-year");t&&I.getInstance(t).destroy();let e=this.calendarEl.querySelector(".orig-select-month");e&&I.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"))),r.createButton(this.footer,this.options.i18n.clear,["datepicker-clear"],this.options.showClearBtn,this._handleClearClick),this.options.autoSubmit||r.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):v._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=new Date(Date.parse(t.value));this.setDate(e,!1,t==this.endDateEl,!0)}setDate(t=null,e=!1,i=!1,s=!1){let o=this.validateDate(t);o&&(this.options.isMultipleSelection?s||this.setMultiDate(o):this.setSingleDate(o,i),v._setToStartOfDay(o),this.gotoDate(o),!e&&typeof this.options.onSelect=="function"&&this.options.onSelect.call(this,o))}validateDate(t){if(!t)return this._renderDateDisplay(t),this.draw();if(typeof t=="string"&&(t=new Date(Date.parse(t))),!v._isDate(t))return;let e=this.options.minDate,i=this.options.maxDate;return v._isDate(e)&&t<e?t=e:v._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(){Array.from(this.dateEls).filter((e,i)=>{if(i>this.dates.length-1)return e}).forEach(e=>{e.remove()}),this.dates.forEach((e,i)=>{if(Array.from(this.dateEls)[i]){this.setInputValue(this.dateEls[i],e);return}let s=this.createDateInput();this.setInputValue(s,e),this.dateEls.push(s)})}setInputValue(t,e){t.type=="date"?(this.setDataDate(t,e),t.value=this.formatDate(e,"yyyy-mm-dd")):t.value=this.toString(e),this.el.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,composed:!0,detail:{firedBy:this}}))}_renderDateDisplay(t,e=null){let i=v._isDate(t)?t:new Date;if(!this.options.isDateRange)this.dateTextEl.textContent=this.formatDate(i,"ddd, mmm d");else{let s=v._isDate(e)?e:new Date;this.dateTextEl.textContent=`${this.formatDate(i,"mmm d")} - ${this.formatDate(s,"mmm d")}`}}gotoDate(t){let e=!0;if(v._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),o=t.getTime();s.setMonth(s.getMonth()+1),s.setDate(s.getDate()-1),e=o<i.getTime()||s.getTime()<o}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,o=v._getDaysInMonth(t,e),a=[],l=new Date(t,e,1).getDay(),h=[];v._setToStartOfDay(s),this.options.firstDay>0&&(l-=this.options.firstDay,l<0&&(l+=7));let c=e===0?11:e-1,d=e===11?0:e+1,m=e===0?t-1:t,y=e===11?t+1:t,g=v._getDaysInMonth(m,c),L=o+l,b=L;for(;b>7;)b-=7;L+=7-b;let D=!1;for(let x=0,k=0;x<L;x++){let C=new Date(t,e,1+(x-l)),pt=v._compareDates(C,s),gt=this.options.events.indexOf(C.toDateString())!==-1,ut=x<l||x>=o+l,Et=this.options.startRange&&v._compareDates(this.options.startRange,C),yt=this.options.endRange&&v._compareDates(this.options.endRange,C),_t=this.options.startRange&&this.options.endRange&&this.options.startRange<C&&C<this.options.endRange,bt=this.options.minDate&&C<this.options.minDate||this.options.maxDate&&C>this.options.maxDate||this.options.disableWeekends&&v._isWeekend(C)||this.options.disableDayFn&&this.options.disableDayFn(C),Tt=this.options.isDateRange&&this.date&&this.endDate&&v._compareDates(this.date,C),Lt=this.options.isDateRange&&this.endDate&&v._compareDates(this.endDate,C),wt=this.options.isDateRange&&v._isDate(this.endDate)&&v._compareWithinRange(C,this.date,this.endDate),R=1+(x-l),q=e,ht=t,$=!1;v._isDate(this.date)&&($=v._compareDates(C,this.date)),!$&&v._isDate(this.endDate)&&($=v._compareDates(C,this.endDate)),this.options.isMultipleSelection&&this.dates?.some(dt=>dt.getTime()===C.getTime())&&($=!0),ut&&(x<l?(R=g+R,q=c,ht=m):(R=R-o,q=d,ht=y));let K={day:R,month:q,year:ht,hasEvent:gt,isSelected:$,isToday:pt,isDisabled:bt,isEmpty:ut,isStartRange:Et,isEndRange:yt,isInRange:_t,showDaysInNextAndPreviousMonths:this.options.showDaysInNextAndPreviousMonths,isDateRangeStart:Tt,isDateRangeEnd:Lt,isDateRange:wt};h.push(this.renderDay(K)),++k===7&&(a.push(this.renderRow(h,this.options.isRTL,D)),h=[],k=0,D=!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(o=>!!(t.hasOwnProperty(o)&&t[o]===!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[o,a]of Object.entries(e))t.hasOwnProperty(o)&&t[o]&&s.push(a);return`<td data-day="${t.day}" class="${s.join(" ")}" aria-selected="${i}"><button class="datepicker-day-button" type="button" data-year="${t.year}" data-month="${t.month}" data-day="${t.day}">${t.day}</button></td>`}renderRow(t,e,i){return'<tr class="datepicker-row'+(i?" is-selected":"")+'">'+(e?t.reverse():t).join("")+"</tr>"}renderTable(t,e,i){return'<div class="datepicker-table-wrapper"><table cellpadding="0" cellspacing="0" class="datepicker-table" role="grid" aria-labelledby="'+i+'">'+this.renderHead(t)+this.renderBody(e)+"</table></div>"}renderHead(t){let e=[],i;for(i=0;i<7;i++){let s=v._escape(this.renderDayName(t,i)),o=v._escape(this.renderDayName(t,i,!0));e.push(`<th scope="col"><abbr title="${s}">${o}</abbr></th>`)}return"<thead><tr>"+(t.isRTL?e.reverse():e).join("")+"</tr></thead>"}renderBody(t){return"<tbody>"+t.join("")+"</tbody>"}_arrowState(t,e){let i=this.options,s=t===i.minYear,o=t===i.maxYear;return{prev:!(s&&(e===0||i.minMonth>=e)),next:!(o&&(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,o,a){let l=this.options,h=i===l.minYear,c=i===l.maxYear,d,m,y=[],g='<div id="'+a+'" class="datepicker-controls" role="heading" aria-live="assertive">',{prev:L,next:b}=this._arrowState(i,s);for(d=0;d<12;d++)y.push('<option value="'+(i===o?d-e:12+d-e)+'"'+(d===s?' selected="selected"':"")+(h&&d<l.minMonth||c&&d>l.maxMonth?'disabled="disabled"':"")+">"+v._escape(l.i18n.months[d])+"</option>");let D='<select class="datepicker-select orig-select-month" tabindex="-1">'+y.join("")+"</select>";for(Array.isArray(l.yearRange)?(d=l.yearRange[0],m=l.yearRange[1]+1):(d=i-l.yearRange,m=1+i+l.yearRange),y=[];d<m&&d<=l.maxYear;d++)d>=l.minYear&&y.push(`<option value="${d}" ${d===i?'selected="selected"':""}>${d}</option>`);l.yearRangeReverse&&y.reverse();let x=`<select class="datepicker-select orig-select-year" tabindex="-1">${y.join("")}</select>`;return g+=`<button class="month-prev${L?"":" is-disabled"} btn" 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>`,g+='<div class="selects-container">',l.showMonthAfterYear?g+=x+D:g+=D+x,g+="</div>",g+=`<button class="month-next${b?"":" is-disabled"} btn" 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>`,g+="</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.options,e=t.minYear,i=t.maxYear,s=t.minMonth,o=t.maxMonth;this._y<=e&&(this._y=e,!isNaN(s)&&this._m<s&&(this._m=s)),this._y>=i&&(this._y=i,!isNaN(o)&&this._m>o&&(this._m=o));let a=this.calendars[0].year,l=this.calendars[0].month;this.options.isDateRange?this._renderDateDisplay(this.date,this.endDate):this._renderDateDisplay(this.date);let h=this._controlsCacheKey(a);h===this._controlsKey&&this.calendarEl.querySelector(".datepicker-controls")?this._reuseControls(a,l):(this._controlsKey=h,this._randId="datepicker-title-"+r.guid(),this._rebuildControls(a,l)),this._renderCalendarTable(a,l),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");I.init(i,{classes:"select-year",dropdownOptions:{container:document.body,constrainWidth:!1}}),I.init(s,{classes:"select-month",dropdownOptions:{container:document.body,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(),I.getInstance(i)?.refresh());let{prev:s,next:o}=this._arrowState(t,e);this.calendarEl.querySelector(".month-prev")?.classList.toggle("is-disabled",!s),this.calendarEl.querySelector(".month-next")?.classList.toggle("is-disabled",!o)}_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.calendarEl.addEventListener("click",this._handleCalendarClick)}_setupVariables(){let t=document.createElement("template");t.innerHTML=v._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(){this.el.removeEventListener("click",this._handleInputClick),this.el.removeEventListener("keydown",this._handleInputKeydown),this.el.removeEventListener("change",this._handleInputChange),this.calendarEl.removeEventListener("click",this._handleCalendarClick),this.options.isDateRange&&this.endDateEl&&(this.endDateEl.removeEventListener("click",this._handleInputClick),this.endDateEl.removeEventListener("keypress",this._handleInputKeydown),this.endDateEl.removeEventListener("change",this._handleInputChange))}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("keypress",this._handleInputKeydown),t.addEventListener("change",this._handleInputChange),this.el.parentElement.appendChild(t),t}open(){return console.warn("Datepicker.open() is deprecated. Remove this method and wrap in modal yourself."),this}close(){return console.warn("Datepicker.close() is deprecated. Remove this method and wrap in modal yourself."),this}};v._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=n,this.options={...Qt,...e},this.container=document.createElement("div"),this.container.classList.add("display-docked"),this.container.append(t),n.parentElement.append(this.container),document.addEventListener("click",this._handleDocumentClick)}static init(n,t,e){return new u(n,t,e)}};var Jt={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},v=class v extends f{constructor(t,e){super(t,e,v);this.multiple=!1;this._drawDepth=0;this._drawDirty=!1;this._controlsKey=null;this._randId=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=>{r.keys.ENTER.includes(t.key)&&(t.preventDefault(),this._batchDraws(()=>{this.setDateFromInput(t.target),this.draw()}),this.displayPlugin&&this.displayPlugin.show(),this.options.onInputInteraction&&this.options.onInputInteraction.call(this))};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")){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||!v._compareDates(t,this.endDate)){if(v._isDate(this.date)&&v._comparePastDate(t,this.date))return;this.setDate(t,!1,v._isDate(this.date));return}this._clearDates(),this.draw()};this._handleClearClick=()=>{this._clearDates(),this.setInputValues()};this._clearDates=()=>{this.date=null,this.endDate=null,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;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=new Date(Date.parse(t.target.value)),v._isDate(e)&&(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={...v.defaults,...e},e&&e.hasOwnProperty("i18n")&&typeof e.i18n=="object"&&(this.options.i18n={...v.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=r.guid(),this._setupVariables(),this._insertHTMLIntoDOM(),this._setupEventHandlers(),this.options.defaultDate||(this.options.defaultDate=new Date(Date.parse(this.el.value)));let i=this.options.defaultDate;if(v._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;v._isDate(s)&&this.options.setDefaultEndDate&&(this.setDate(s,!0,!0),this.setInputValue(this.endDateEl,s))}this.options.isMultipleSelection&&(this.multiple=!0,this.dates=[],this.dateEls=[],this.dateEls.push(t)),this.options.displayPlugin&&this.options.displayPlugin==="docked"&&(this.displayPlugin=z.init(this.el,this.containerEl,this.options.displayPluginOptions))}static get defaults(){return Jt}static init(t,e={}){return super.init(t,e,v)}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 _isWeekend(t){let e=t.getDay();return e===0||e===6}static _setToStartOfDay(t){v._isDate(t)&&t.setHours(0,0,0,0)}static _getDaysInMonth(t,e){return[31,v._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.displayPlugin?.destroy(),this.containerEl.remove(),this.destroySelects(),this.el.Expressive_Datepicker=void 0}destroySelects(){let t=this.calendarEl.querySelector(".orig-select-year");t&&H.getInstance(t).destroy();let e=this.calendarEl.querySelector(".orig-select-month");e&&H.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"))),r.createButton(this.footer,this.options.i18n.clear,["datepicker-clear"],this.options.showClearBtn,this._handleClearClick),this.options.autoSubmit||r.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):v._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=new Date(Date.parse(t.value));this.setDate(e,!1,t==this.endDateEl,!0)}setDate(t=null,e=!1,i=!1,s=!1){let o=this.validateDate(t);o&&(this.options.isMultipleSelection?s||this.setMultiDate(o):this.setSingleDate(o,i),v._setToStartOfDay(o),this.gotoDate(o),!e&&typeof this.options.onSelect=="function"&&this.options.onSelect.call(this,o))}validateDate(t){if(!t)return this._renderDateDisplay(t),this.draw();if(typeof t=="string"&&(t=new Date(Date.parse(t))),!v._isDate(t))return;let e=this.options.minDate,i=this.options.maxDate;return v._isDate(e)&&t<e?t=e:v._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(){Array.from(this.dateEls).filter((e,i)=>{if(i>this.dates.length-1)return e}).forEach(e=>{e.remove()}),this.dates.forEach((e,i)=>{if(Array.from(this.dateEls)[i]){this.setInputValue(this.dateEls[i],e);return}let s=this.createDateInput();this.setInputValue(s,e),this.dateEls.push(s)})}setInputValue(t,e){t.type=="date"?(this.setDataDate(t,e),t.value=this.formatDate(e,"yyyy-mm-dd")):t.value=this.toString(e),this.el.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,composed:!0,detail:{firedBy:this}}))}_renderDateDisplay(t,e=null){let i=v._isDate(t)?t:new Date;if(!this.options.isDateRange)this.dateTextEl.textContent=this.formatDate(i,"ddd, mmm d");else{let s=v._isDate(e)?e:new Date;this.dateTextEl.textContent=`${this.formatDate(i,"mmm d")} - ${this.formatDate(s,"mmm d")}`}}gotoDate(t){let e=!0;if(v._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),o=t.getTime();s.setMonth(s.getMonth()+1),s.setDate(s.getDate()-1),e=o<i.getTime()||s.getTime()<o}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,o=v._getDaysInMonth(t,e),a=[],l=new Date(t,e,1).getDay(),h=[];v._setToStartOfDay(s),this.options.firstDay>0&&(l-=this.options.firstDay,l<0&&(l+=7));let d=e===0?11:e-1,c=e===11?0:e+1,m=e===0?t-1:t,g=e===11?t+1:t,E=v._getDaysInMonth(m,d),T=o+l,x=T;for(;x>7;)x-=7;T+=7-x;let V=!1;for(let k=0,ht=0;k<T;k++){let C=new Date(t,e,1+(k-l)),wt=v._compareDates(C,s),Ct=this.options.events.indexOf(C.toDateString())!==-1,gt=k<l||k>=o+l,Mt=this.options.startRange&&v._compareDates(this.options.startRange,C),xt=this.options.endRange&&v._compareDates(this.options.endRange,C),Dt=this.options.startRange&&this.options.endRange&&this.options.startRange<C&&C<this.options.endRange,Ot=this.options.minDate&&C<this.options.minDate||this.options.maxDate&&C>this.options.maxDate||this.options.disableWeekends&&v._isWeekend(C)||this.options.disableDayFn&&this.options.disableDayFn(C),kt=this.options.isDateRange&&this.date&&this.endDate&&v._compareDates(this.date,C),Ht=this.options.isDateRange&&this.endDate&&v._compareDates(this.endDate,C),It=this.options.isDateRange&&v._isDate(this.endDate)&&v._compareWithinRange(C,this.date,this.endDate),at=1+(k-l),ut=e,mt=t,lt=!1;v._isDate(this.date)&&(lt=v._compareDates(C,this.date)),!lt&&v._isDate(this.endDate)&&(lt=v._compareDates(C,this.endDate)),this.options.isMultipleSelection&&this.dates?.some(At=>At.getTime()===C.getTime())&&(lt=!0),gt&&(k<l?(at=E+at,ut=d,mt=m):(at=at-o,ut=c,mt=g));let St={day:at,month:ut,year:mt,hasEvent:Ct,isSelected:lt,isToday:wt,isDisabled:Ot,isEmpty:gt,isStartRange:Mt,isEndRange:xt,isInRange:Dt,showDaysInNextAndPreviousMonths:this.options.showDaysInNextAndPreviousMonths,isDateRangeStart:kt,isDateRangeEnd:Ht,isDateRange:It};h.push(this.renderDay(St)),++ht===7&&(a.push(this.renderRow(h,this.options.isRTL,V)),h=[],ht=0,V=!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(o=>!!(t.hasOwnProperty(o)&&t[o]===!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[o,a]of Object.entries(e))t.hasOwnProperty(o)&&t[o]&&s.push(a);return`<td data-day="${t.day}" class="${s.join(" ")}" aria-selected="${i}"><button class="datepicker-day-button" type="button" data-year="${t.year}" data-month="${t.month}" data-day="${t.day}">${t.day}</button></td>`}renderRow(t,e,i){return'<tr class="datepicker-row'+(i?" is-selected":"")+'">'+(e?t.reverse():t).join("")+"</tr>"}renderTable(t,e,i){return'<div class="datepicker-table-wrapper"><table cellpadding="0" cellspacing="0" class="datepicker-table" role="grid" aria-labelledby="'+i+'">'+this.renderHead(t)+this.renderBody(e)+"</table></div>"}renderHead(t){let e=[],i;for(i=0;i<7;i++){let s=v._escape(this.renderDayName(t,i)),o=v._escape(this.renderDayName(t,i,!0));e.push(`<th scope="col"><abbr title="${s}">${o}</abbr></th>`)}return"<thead><tr>"+(t.isRTL?e.reverse():e).join("")+"</tr></thead>"}renderBody(t){return"<tbody>"+t.join("")+"</tbody>"}_arrowState(t,e){let i=this.options,s=t===i.minYear,o=t===i.maxYear;return{prev:!(s&&(e===0||i.minMonth>=e)),next:!(o&&(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,o,a){let l=this.options,h=i===l.minYear,d=i===l.maxYear,c,m,g=[],E='<div id="'+a+'" class="datepicker-controls" role="heading" aria-live="assertive">',{prev:T,next:x}=this._arrowState(i,s);for(c=0;c<12;c++)g.push('<option value="'+(i===o?c-e:12+c-e)+'"'+(c===s?' selected="selected"':"")+(h&&c<l.minMonth||d&&c>l.maxMonth?'disabled="disabled"':"")+">"+v._escape(l.i18n.months[c])+"</option>");let V='<select class="datepicker-select orig-select-month" tabindex="-1">'+g.join("")+"</select>";for(Array.isArray(l.yearRange)?(c=l.yearRange[0],m=l.yearRange[1]+1):(c=i-l.yearRange,m=1+i+l.yearRange),g=[];c<m&&c<=l.maxYear;c++)c>=l.minYear&&g.push(`<option value="${c}" ${c===i?'selected="selected"':""}>${c}</option>`);l.yearRangeReverse&&g.reverse();let k=`<select class="datepicker-select orig-select-year" tabindex="-1">${g.join("")}</select>`;return E+=`<button class="month-prev${T?"":" is-disabled"} btn" 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>`,E+='<div class="selects-container">',l.showMonthAfterYear?E+=k+V:E+=V+k,E+="</div>",E+=`<button class="month-next${x?"":" is-disabled"} btn" 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>`,E+="</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.options,e=t.minYear,i=t.maxYear,s=t.minMonth,o=t.maxMonth;this._y<=e&&(this._y=e,!isNaN(s)&&this._m<s&&(this._m=s)),this._y>=i&&(this._y=i,!isNaN(o)&&this._m>o&&(this._m=o));let a=this.calendars[0].year,l=this.calendars[0].month;this.options.isDateRange?this._renderDateDisplay(this.date,this.endDate):this._renderDateDisplay(this.date);let h=this._controlsCacheKey(a);h===this._controlsKey&&this.calendarEl.querySelector(".datepicker-controls")?this._reuseControls(a,l):(this._controlsKey=h,this._randId="datepicker-title-"+r.guid(),this._rebuildControls(a,l)),this._renderCalendarTable(a,l),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");H.init(i,{classes:"select-year",dropdownOptions:{container:document.body,constrainWidth:!1}}),H.init(s,{classes:"select-month",dropdownOptions:{container:document.body,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(),H.getInstance(i)?.refresh());let{prev:s,next:o}=this._arrowState(t,e);this.calendarEl.querySelector(".month-prev")?.classList.toggle("is-disabled",!s),this.calendarEl.querySelector(".month-next")?.classList.toggle("is-disabled",!o)}_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.calendarEl.addEventListener("click",this._handleCalendarClick)}_setupVariables(){let t=document.createElement("template");t.innerHTML=v._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(){this.el.removeEventListener("click",this._handleInputClick),this.el.removeEventListener("keydown",this._handleInputKeydown),this.el.removeEventListener("change",this._handleInputChange),this.calendarEl.removeEventListener("click",this._handleCalendarClick),this.options.isDateRange&&this.endDateEl&&(this.endDateEl.removeEventListener("click",this._handleInputClick),this.endDateEl.removeEventListener("keypress",this._handleInputKeydown),this.endDateEl.removeEventListener("change",this._handleInputChange))}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("keypress",this._handleInputKeydown),t.addEventListener("change",this._handleInputChange),this.el.parentElement.appendChild(t),t}open(){return console.warn("Datepicker.open() is deprecated. Remove this method and wrap in modal yourself."),this}close(){return console.warn("Datepicker.close() is deprecated. Remove this method and wrap in modal yourself."),this}};v._template=`
|
|
10
10
|
<div class="datepicker-container">
|
|
11
11
|
<div class="datepicker-date-display">
|
|
12
12
|
<span class="year-text"></span>
|
|
@@ -22,7 +22,7 @@ var Expressive=(()=>{var Ct=Object.defineProperty;var At=Object.getOwnPropertyDe
|
|
|
22
22
|
</div>-->
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
|
-
</div>`;var
|
|
25
|
+
</div>`;var U=v;var te={inDuration:275,outDuration:200,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null},j=class u extends f{constructor(t,e){super(t,e,u);this._handleLightboxClick=()=>{this._handleLightboxToggle()};this._handleLightboxKeypress=t=>{r.keys.ENTER.includes(t.key)&&this._handleLightboxToggle()};this._handleLightboxToggle=()=>{this.doneAnimating===!1||this.overlayActive&&this.doneAnimating?this.close():this.open()};this._handleWindowScroll=()=>{this.overlayActive&&this.close()};this._handleWindowResize=()=>{this.overlayActive&&this.close()};this._handleWindowEscape=t=>{r.keys.ESC.includes(t.key)&&this.doneAnimating&&this.overlayActive&&this.close()};this.open=()=>{this._updateVars();let t=this.el.getBoundingClientRect(),e=this.placeholder.getBoundingClientRect();this.originalWidth=t.width,this.originalHeight=t.height,this.doneAnimating=!1,this.el.classList.add("active"),this.overlayActive=!0,typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),this.placeholder.style.width=e.width+"px",this.placeholder.style.height=e.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 i=this.originalWidth/this.windowWidth,s=this.originalHeight/this.windowHeight;if(this.newWidth=0,this.newHeight=0,i>s){let o=this.originalHeight/this.originalWidth;this.newWidth=this.windowWidth*.9,this.newHeight=this.windowWidth*.9*o}else{let o=this.originalWidth/this.originalHeight;this.newWidth=this.windowHeight*.9*o,this.newHeight=this.windowHeight*.9}this._animateImageIn(),window.addEventListener("scroll",this._handleWindowScroll,{passive:!0}),window.addEventListener("resize",this._handleWindowResize,{passive:!0}),window.addEventListener("keyup",this._handleWindowEscape)};this.close=()=>{this._updateVars(),this.doneAnimating=!1,typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),window.removeEventListener("scroll",this._handleWindowScroll),window.removeEventListener("resize",this._handleWindowResize),window.removeEventListener("keyup",this._handleWindowEscape),this._removeOverlay(),this._animateImageOut(),this.caption!==""&&this._removeCaption()};this.el.Expressive_Lightbox=this,this.options={...u.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.el.tabIndex=0,this.el.before(this.placeholder),this.placeholder.append(this.el),this._setupEventHandlers()}static get defaults(){return te}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Lightbox}destroy(){this._removeEventHandlers(),this.el.Expressive_Lightbox=void 0,this.placeholder.remove(),this.el.removeAttribute("style")}_setupEventHandlers(){this.el.addEventListener("click",this._handleLightboxClick),this.el.addEventListener("keypress",this._handleLightboxKeypress)}_removeEventHandlers(){this.el.removeEventListener("click",this._handleLightboxClick),this.el.removeEventListener("keypress",this._handleLightboxKeypress)}_makeAncestorsOverflowVisible(){this._changedAncestorList=[];let t=this.placeholder.parentNode;for(;t!==null&&t!==document;){let e=t;e.style.overflow!=="visible"&&(e.style.overflow="visible",this._changedAncestorList.push(e)),t=t.parentNode}}_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.options.inDuration;this.el.style.transition="none",this.el.style.height=this.originalHeight+"px",this.el.style.width=this.originalWidth+"px",setTimeout(()=>{let e=this._offset(this.placeholder);this.el.style.transition=`height ${t}ms ease,
|
|
26
26
|
width ${t}ms ease,
|
|
27
27
|
left ${t}ms ease,
|
|
28
28
|
top ${t}ms ease
|
|
@@ -30,13 +30,13 @@ var Expressive=(()=>{var Ct=Object.defineProperty;var At=Object.getOwnPropertyDe
|
|
|
30
30
|
width ${t}ms ease,
|
|
31
31
|
left ${t}ms ease,
|
|
32
32
|
top ${t}ms ease
|
|
33
|
-
`,this.el.style.height=this.originalHeight+"px",this.el.style.width=this.originalWidth+"px",this.el.style.left="0",this.el.style.top="0",setTimeout(()=>{this.placeholder.style.height="",this.placeholder.style.width="",this.placeholder.style.position="",this.placeholder.style.top="",this.placeholder.style.left="",this.attrWidth&&this.el.setAttribute("width",this.attrWidth.toString()),this.attrHeight&&this.el.setAttribute("height",this.attrHeight.toString()),this.el.removeAttribute("style"),this.originInlineStyles&&this.el.setAttribute("style",this.originInlineStyles),this.el.classList.remove("active"),this.doneAnimating=!0,this._changedAncestorList.forEach(e=>e.style.overflow=""),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,document.body.append(this._photoCaption),this._photoCaption.style.display="inline",this._photoCaption.style.transition="none",this._photoCaption.style.opacity="0";let t=this.options.inDuration;setTimeout(()=>{this._photoCaption.style.transition=`opacity ${t}ms ease`,this._photoCaption.style.opacity="1"},1)}_removeCaption(){let t=this.options.outDuration;this._photoCaption.style.transition=`opacity ${t}ms ease`,this._photoCaption.style.opacity="0",setTimeout(()=>{this._photoCaption.remove()},t)}_addOverlay(){this._overlay=document.createElement("div"),this._overlay.id="lightbox-overlay",this._overlay.addEventListener("click",()=>{this.doneAnimating&&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.options.inDuration;setTimeout(()=>{this._overlay.style.transition=`opacity ${e}ms ease`,this._overlay.style.opacity="1"},1)}_removeOverlay(){let t=this.options.outDuration;this._overlay.style.transition=`opacity ${t}ms ease`,this._overlay.style.opacity="0",setTimeout(()=>{this.overlayActive=!1,this._overlay.remove()},t)}};var
|
|
33
|
+
`,this.el.style.height=this.originalHeight+"px",this.el.style.width=this.originalWidth+"px",this.el.style.left="0",this.el.style.top="0",setTimeout(()=>{this.placeholder.style.height="",this.placeholder.style.width="",this.placeholder.style.position="",this.placeholder.style.top="",this.placeholder.style.left="",this.attrWidth&&this.el.setAttribute("width",this.attrWidth.toString()),this.attrHeight&&this.el.setAttribute("height",this.attrHeight.toString()),this.el.removeAttribute("style"),this.originInlineStyles&&this.el.setAttribute("style",this.originInlineStyles),this.el.classList.remove("active"),this.doneAnimating=!0,this._changedAncestorList.forEach(e=>e.style.overflow=""),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,document.body.append(this._photoCaption),this._photoCaption.style.display="inline",this._photoCaption.style.transition="none",this._photoCaption.style.opacity="0";let t=this.options.inDuration;setTimeout(()=>{this._photoCaption.style.transition=`opacity ${t}ms ease`,this._photoCaption.style.opacity="1"},1)}_removeCaption(){let t=this.options.outDuration;this._photoCaption.style.transition=`opacity ${t}ms ease`,this._photoCaption.style.opacity="0",setTimeout(()=>{this._photoCaption.remove()},t)}_addOverlay(){this._overlay=document.createElement("div"),this._overlay.id="lightbox-overlay",this._overlay.addEventListener("click",()=>{this.doneAnimating&&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.options.inDuration;setTimeout(()=>{this._overlay.style.transition=`opacity ${e}ms ease`,this._overlay.style.opacity="1"},1)}_removeOverlay(){let t=this.options.outDuration;this._overlay.style.transition=`opacity ${t}ms ease`,this._overlay.style.opacity="0",setTimeout(()=>{this.overlayActive=!1,this._overlay.remove()},t)}};var ee={opacity:.5,inDuration:250,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,preventScrolling:!0,dismissible:!0,startingTop:"4%",endingTop:"10%"},rt,ie,bt,G=class G extends f{constructor(n,t){super(n,t,G),this.el.Expressive_Modal=this,this.options={...G.defaults,...t},this.el.tabIndex=0,this._setupEventHandlers()}static get defaults(){return ee}static init(n,t={}){return super.init(n,t,G)}static getInstance(n){return n.Expressive_Modal}destroy(){}_setupEventHandlers(){}_removeEventHandlers(){}_handleTriggerClick(){}_handleOverlayClick(){}_handleModalCloseClick(){}_handleKeydown(){}_handleFocus(){}open(){return this}close(){return this}static create(n){return yt(this,rt,bt).call(this,n)}};rt=new WeakSet,ie=function(n){let t=n.header?`<h2>${typeof n.header=="string"?n.header:""}</h2>`:"",e=n.footer?`<form method="dialog">${typeof n.footer=="string"?n.footer:""}</form>`:"";return`<dialog id="${n.id}">
|
|
34
34
|
${t}
|
|
35
35
|
<div>${typeof n.content=="string"?n.content:""}</div>
|
|
36
36
|
${e}
|
|
37
|
-
</dialog>`},kt=function(n){let t=document.createElement("dialog");return t.id=n.id,t},Ot(J,ct);var tt=J;var ie={responsiveThreshold:0},_=class _ extends f{constructor(t,e){super(t,e,_);this._handleImageLoad=()=>{this._updateParallax()};if(this.el.Expressive_Parallax=this,this.options={..._.defaults,...e},this._enabled=window.innerWidth>this.options.responsiveThreshold,this._img=this.el.querySelector("img"),!this._img){console.error("Parallax: no <img> to move inside the .parallax element");return}this._updateParallax(),this._setupEventHandlers(),this._setupStyles(),_._parallaxes.push(this)}static get defaults(){return ie}static init(t,e={}){return super.init(t,e,_)}static getInstance(t){return t.Expressive_Parallax}destroy(){let t=_._parallaxes.indexOf(this);t>=0&&_._parallaxes.splice(t,1),this._img&&(this._img.style.transform=""),this._removeEventHandlers(),this.el.Expressive_Parallax=void 0}static _handleScroll(){for(let t=0;t<_._parallaxes.length;t++){let e=_._parallaxes[t];e._updateParallax.call(e)}}static _handleWindowResize(){for(let t=0;t<_._parallaxes.length;t++){let e=_._parallaxes[t];e._enabled=window.innerWidth>e.options.responsiveThreshold}}_setupEventHandlers(){this._img?.addEventListener("load",this._handleImageLoad),_._parallaxes.length===0&&(_._handleWindowResizeThrottled||(_._handleWindowResizeThrottled=r.throttle(_._handleWindowResize,100)),window.addEventListener("scroll",_._requestScrollUpdate,{passive:!0}),window.addEventListener("resize",_._handleWindowResizeThrottled,{passive:!0}))}_removeEventHandlers(){this._img?.removeEventListener("load",this._handleImageLoad),_._parallaxes.length===0&&(window.removeEventListener("scroll",_._requestScrollUpdate),window.removeEventListener("resize",_._handleWindowResizeThrottled),_._scrollFrame!==null&&(cancelAnimationFrame(_._scrollFrame),_._scrollFrame=null))}_setupStyles(){this._img&&(this._img.style.opacity="1")}_updateParallax(){let t=this.el.getBoundingClientRect(),e=t.height>0?this.el.parentElement.offsetHeight:500,s=this._img.offsetHeight-e,o=t.top+window.scrollY-document.documentElement.clientTop,a=o+e,l=r.getDocumentScrollTop(),h=window.innerHeight,d=(l+h-o)/(e+h),m=s*d;this._enabled?a>l&&o<l+h&&(this._img.style.transform=`translate3D(-50%, ${m}px, 0)`):this._img.style.transform=""}};_._parallaxes=[],_._scrollFrame=null,_._requestScrollUpdate=()=>{_._scrollFrame===null&&(_._scrollFrame=requestAnimationFrame(()=>{_._scrollFrame=null,_._handleScroll()}))};var et=_;var se={top:0,bottom:1/0,offset:0,onPositionChange:null},O=class O extends f{constructor(n,t){super(n,t,O),this.el.Expressive_Pushpin=this,this.options={...O.defaults,...t},this.originalOffset=this.el.offsetTop,O._pushpins.push(this),this._setupEventHandlers(),this._updatePosition()}static get defaults(){return se}static init(n,t={}){return super.init(n,t,O)}static getInstance(n){return n.Expressive_Pushpin}destroy(){this.el.style.top=null,this._removePinClasses();let n=O._pushpins.indexOf(this);O._pushpins.splice(n,1),O._pushpins.length===0&&this._removeEventHandlers(),this.el.Expressive_Pushpin=void 0}static _updateElements(){for(let n=0;n<O._pushpins.length;n++)O._pushpins[n]._updatePosition()}_setupEventHandlers(){document.addEventListener("scroll",O._updateElements,{passive:!0})}_removeEventHandlers(){document.removeEventListener("scroll",O._updateElements)}_updatePosition(){let n=r.getDocumentScrollTop()+this.options.offset;this.options.top<=n&&this.options.bottom>=n&&!this.el.classList.contains("pinned")&&(this._removePinClasses(),this.el.style.top=`${this.options.offset}px`,this.el.classList.add("pinned"),typeof this.options.onPositionChange=="function"&&this.options.onPositionChange.call(this,"pinned")),n<this.options.top&&!this.el.classList.contains("pin-top")&&(this._removePinClasses(),this.el.style.top="0",this.el.classList.add("pin-top"),typeof this.options.onPositionChange=="function"&&this.options.onPositionChange.call(this,"pin-top")),n>this.options.bottom&&!this.el.classList.contains("pin-bottom")&&(this._removePinClasses(),this.el.classList.add("pin-bottom"),this.el.style.top=`${this.options.bottom-this.originalOffset}px`,typeof this.options.onPositionChange=="function"&&this.options.onPositionChange.call(this,"pin-bottom"))}_removePinClasses(){this.el.classList.remove("pin-top","pinned","pin-bottom")}};O._pushpins=[];var it=O;var ne={throttle:100,scrollOffset:200,activeClass:"active",getActiveElement:u=>'a[href="#'+u+'"]',keepTopElementActive:!1,animationDuration:null},p=class p extends f{constructor(n,t){super(n,t,p),this.el.Expressive_ScrollSpy=this,this.options={...p.defaults,...t},p._elements.push(this),p._count++,p._increment++,this.tickId=-1,this.id=p._increment.toString(),this._setupEventHandlers(),p._handleWindowScroll()}static get defaults(){return ne}static init(n,t={}){return super.init(n,t,p)}static getInstance(n){return n.Expressive_ScrollSpy}destroy(){let n=p._elements.indexOf(this);n>=0&&p._elements.splice(n,1);let t=p._elementsInView.indexOf(this);t>=0&&p._elementsInView.splice(t,1);let e=p._visibleElements.indexOf(this.el);e>=0&&p._visibleElements.splice(e,1),p._count--,this._removeEventHandlers(),document.querySelector(this.options.getActiveElement(this.el.id))?.classList.remove(this.options.activeClass),this.el.Expressive_ScrollSpy=void 0}_setupEventHandlers(){p._count===1&&(p._throttledScroll=r.throttle(p._handleWindowScroll,this.options.throttle),p._throttledResize=r.throttle(p._handleWindowScroll,200),window.addEventListener("scroll",p._throttledScroll,{passive:!0}),window.addEventListener("resize",p._throttledResize,{passive:!0}),document.body.addEventListener("click",p._handleTriggerClick))}_removeEventHandlers(){p._count===0&&(window.removeEventListener("scroll",p._throttledScroll),window.removeEventListener("resize",p._throttledResize),document.body.removeEventListener("click",p._handleTriggerClick),p._throttledScroll=null,p._throttledResize=null)}static _findElements(n,t,e,i){let s=[],o=document.documentElement,a=o.clientTop,l=o.clientLeft,h=window.scrollY,c=window.scrollX;for(let d=0;d<p._elements.length;d++){let m=p._elements[d],y=n+m.options.scrollOffset||200,g=m.el.getBoundingClientRect();if(g.height>0){let L=g.top+h-a,b=g.left+c-l,D=b+g.width,x=L+g.height;!(b>t||D<i||L>e||x<y)&&s.push(m)}}return s}_enter(){p._visibleElements=p._visibleElements.filter(t=>t.getBoundingClientRect().height!==0),p._visibleElements[0]?(document.querySelector(this.options.getActiveElement(p._visibleElements[0].id))?.classList.remove(this.options.activeClass),p._visibleElements[0].Expressive_ScrollSpy&&this.id<p._visibleElements[0].Expressive_ScrollSpy.id?p._visibleElements.unshift(this.el):p._visibleElements.push(this.el)):p._visibleElements.push(this.el),p._resetKeptTopActiveElement(this.options.activeClass);let n=this.options.getActiveElement(p._visibleElements[0].id);document.querySelector(n)?.classList.add(this.options.activeClass)}_exit(){if(p._visibleElements=p._visibleElements.filter(n=>n.getBoundingClientRect().height!==0),p._visibleElements[0]&&(document.querySelector(this.options.getActiveElement(p._visibleElements[0].id))?.classList.remove(this.options.activeClass),p._visibleElements=p._visibleElements.filter(t=>t.id!=this.el.id),p._visibleElements[0])){let t=this.options.getActiveElement(p._visibleElements[0].id);document.querySelector(t)?.classList.add(this.options.activeClass),p._resetKeptTopActiveElement(this.options.activeClass)}}static _resetKeptTopActiveElement(n){p._keptTopActiveElement&&(p._keptTopActiveElement.classList.remove(n),p._keptTopActiveElement=null)}static _getDistanceToViewport(n){return n.getBoundingClientRect().top}static _smoothScrollIntoView(n,t=300){let e=n.getBoundingClientRect().top+(window.scrollY||window.pageYOffset),i=window.scrollY||window.pageYOffset,s=e-i,o=performance.now();function a(l){let h=l-o,c=Math.min(h/t,1),d=i+s*c;c<1?(window.scrollTo(0,d),requestAnimationFrame(a)):window.scrollTo(0,e)}requestAnimationFrame(a)}};p._keptTopActiveElement=null,p._throttledScroll=null,p._throttledResize=null,p._handleTriggerClick=n=>{let t=n.target;for(let e=p._elements.length-1;e>=0;e--){let i=p._elements[e],s=document.querySelector('a[href="#'+i.el.id+'"]');if(t===s){n.preventDefault(),i.el.Expressive_ScrollSpy.options.animationDuration?p._smoothScrollIntoView(i.el,i.el.Expressive_ScrollSpy.options.animationDuration):i.el.scrollIntoView({behavior:"smooth"});break}}},p._handleWindowScroll=()=>{p._ticks++;let n=r.getDocumentScrollTop(),t=r.getDocumentScrollLeft(),e=t+window.innerWidth,i=n+window.innerHeight,s=p._findElements(n,e,i,t);for(let o=0;o<s.length;o++){let a=s[o];a.tickId<0&&a._enter(),a.tickId=p._ticks}for(let o=0;o<p._elementsInView.length;o++){let a=p._elementsInView[o],l=a.tickId;l>=0&&l!==p._ticks&&(a._exit(),a.tickId=-1)}if(p._elementsInView=s,p._elements.length){let o=p._elements[0].el.Expressive_ScrollSpy.options;if(o.keepTopElementActive&&p._visibleElements.length===0){p._resetKeptTopActiveElement(o.activeClass);let a=p._elements.map(c=>({value:c,distance:p._getDistanceToViewport(c.el)})).filter(c=>c.distance<=0).sort((c,d)=>c.distance-d.distance).map(c=>c.value),l=a.length?a[a.length-1]:p._elements[0],h=document.querySelector(o.getActiveElement(l.el.id));h?.classList.add(o.activeClass),p._keptTopActiveElement=h}}},p._elements=[],p._elementsInView=[],p._visibleElements=[],p._count=0,p._increment=0,p._ticks=0;var st=p;var oe={edge:"left",draggable:!0,dragTargetWidth:"10px",inDuration:250,outDuration:200,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,preventScrolling:!0},S=class S extends f{constructor(t,e){super(t,e,S);this._handleDragTargetDrag=t=>{if(!this._isDraggable())return;let e=this._calculateDelta(t),i=e>0?"right":"left";e=Math.min(this._width,Math.abs(e)),this.options.edge===i&&(e=0);let s=e,o="translateX(-100%)";this.options.edge==="right"&&(o="translateX(100%)",s=-s),this.percentOpen=Math.min(1,e/this._width),this.el.style.transform=`${o} translateX(${s}px)`,this._overlay.style.opacity=this.percentOpen.toString()};this._handleDragTargetRelease=()=>{this.isDragged&&(this.percentOpen>.2?this.open():this._animateOut(),this.isDragged=!1,this._verticallyScrolling=!1)};this._handleCloseDrag=t=>{if(!this.isOpen||!this._isDraggable())return;let e=this._calculateDelta(t),i=e>0?"right":"left";e=Math.min(this._width,Math.abs(e)),this.options.edge!==i&&(e=0);let s=-e;this.options.edge==="right"&&(s=-s),this.percentOpen=Math.min(1,1-e/this._width),this.el.style.transform=`translateX(${s}px)`,this._overlay.style.opacity=this.percentOpen.toString()};this._calculateDelta=t=>(this.isDragged||this._startDrag(t),this._dragMoveUpdate(t),this._xPos-this._startingXpos);this._handleCloseRelease=()=>{this.isOpen&&this.isDragged&&(this.percentOpen>.8?this._animateIn():this.close(),this.isDragged=!1,this._verticallyScrolling=!1)};this._handleCloseTriggerClick=t=>{t.target.closest(".sidenav-close")&&!this._isCurrentlyFixed()&&this.close()};this._handleWindowResize=()=>{this.lastWindowWidth!==window.innerWidth&&(window.innerWidth>992?this.open():this.close()),this.lastWindowWidth=window.innerWidth,this.lastWindowHeight=window.innerHeight};this.open=()=>{this.isOpen!==!0&&(this.isOpen=!0,typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),this._isCurrentlyFixed()?(this.el.style.transform="translateX(0)",this._enableBodyScrolling(),this._overlay.style.display="none"):(this.options.preventScrolling&&this._preventBodyScrolling(),(!this.isDragged||this.percentOpen!=1)&&this._animateIn(),this._setAriaHidden(),this._setTabIndex()))};this.close=()=>{if(this.isOpen!==!1)if(this.isOpen=!1,typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),this._isCurrentlyFixed()){let t=this.options.edge==="left"?"-105%":"105%";this.el.style.transform=`translateX(${t})`}else this._enableBodyScrolling(),!this.isDragged||this.percentOpen!=0?this._animateOut():this._overlay.style.display="none",this._setAriaHidden(),this._setTabIndex()};this._setAriaHidden=()=>{this.el.ariaHidden=this.isOpen?"false":"true";let t=document.querySelector(".nav-wrapper ul");t&&(t.ariaHidden=this.isOpen.toString())};this._setTabIndex=()=>{let t=document.querySelectorAll(".nav-wrapper ul li a"),e=document.querySelectorAll(".sidenav li a");t&&t.forEach(i=>{i.tabIndex=this.isOpen?-1:0}),e&&e.forEach(i=>{i.tabIndex=this.isOpen?0:-1})};this.el.Expressive_Sidenav=this,this.options={...S.defaults,...e},this.id=this.el.id,this.isOpen=!1,this.isFixed=this.el.classList.contains("sidenav-fixed"),this.isDragged=!1,this.lastWindowWidth=window.innerWidth,this.lastWindowHeight=window.innerHeight,this._createOverlay(),this._createDragTarget(),this._setupEventHandlers(),this._setupClasses(),this._setupFixed(),S._sidenavs.push(this)}static get defaults(){return oe}static init(t,e={}){return super.init(t,e,S)}static getInstance(t){return t.Expressive_Sidenav}destroy(){this._removeEventHandlers(),this._enableBodyScrolling(),this._overlay.parentNode.removeChild(this._overlay),this.dragTarget.parentNode.removeChild(this.dragTarget),this.el.Expressive_Sidenav=void 0,this.el.style.transform="";let t=S._sidenavs.indexOf(this);t>=0&&S._sidenavs.splice(t,1)}_createOverlay(){this._overlay=document.createElement("div"),this._overlay.classList.add("sidenav-overlay"),this._overlay.addEventListener("click",this.close),document.body.appendChild(this._overlay)}_setupEventHandlers(){S._sidenavs.length===0&&document.body.addEventListener("click",this._handleTriggerClick);let t={passive:!0};this.dragTarget.addEventListener("touchmove",this._handleDragTargetDrag,t),this.dragTarget.addEventListener("touchend",this._handleDragTargetRelease),this._overlay.addEventListener("touchmove",this._handleCloseDrag,t),this._overlay.addEventListener("touchend",this._handleCloseRelease),this.el.addEventListener("touchmove",this._handleCloseDrag,t),this.el.addEventListener("touchend",this._handleCloseRelease),this.el.addEventListener("click",this._handleCloseTriggerClick),this.isFixed&&window.addEventListener("resize",this._handleWindowResize,t),this._setAriaHidden(),this._setTabIndex()}_removeEventHandlers(){S._sidenavs.length===1&&document.body.removeEventListener("click",this._handleTriggerClick),this.dragTarget.removeEventListener("touchmove",this._handleDragTargetDrag),this.dragTarget.removeEventListener("touchend",this._handleDragTargetRelease),this._overlay.removeEventListener("touchmove",this._handleCloseDrag),this._overlay.removeEventListener("touchend",this._handleCloseRelease),this.el.removeEventListener("touchmove",this._handleCloseDrag),this.el.removeEventListener("touchend",this._handleCloseRelease),this.el.removeEventListener("click",this._handleCloseTriggerClick),this.isFixed&&window.removeEventListener("resize",this._handleWindowResize)}_handleTriggerClick(t){let e=t.target.closest(".sidenav-trigger");if(t.target&&e){let i=r.getIdFromTrigger(e),s=document.getElementById(i)?.Expressive_Sidenav;s&&s.open(),t.preventDefault()}}_startDrag(t){let e=t.targetTouches[0].clientX;this.isDragged=!0,this._startingXpos=e,this._xPos=this._startingXpos,this._time=Date.now(),this._width=this.el.getBoundingClientRect().width,this._overlay.style.display="block",this._initialScrollTop=this.isOpen?this.el.scrollTop:r.getDocumentScrollTop(),this._verticallyScrolling=!1}_dragMoveUpdate(t){let e=t.targetTouches[0].clientX,i=this.isOpen?this.el.scrollTop:r.getDocumentScrollTop();this.deltaX=Math.abs(this._xPos-e),this._xPos=e,this.velocityX=this.deltaX/(Date.now()-this._time),this._time=Date.now(),this._initialScrollTop!==i&&(this._verticallyScrolling=!0)}_setupClasses(){this.options.edge==="right"&&(this.el.classList.add("right-aligned"),this.dragTarget.classList.add("right-aligned"))}_removeClasses(){this.el.classList.remove("right-aligned"),this.dragTarget.classList.remove("right-aligned")}_setupFixed(){this._isCurrentlyFixed()&&this.open()}_isDraggable(){return this.options.draggable&&!this._isCurrentlyFixed()&&!this._verticallyScrolling}_isCurrentlyFixed(){return this.isFixed&&window.innerWidth>992}_createDragTarget(){let t=document.createElement("div");t.classList.add("drag-target"),t.style.width=this.options.dragTargetWidth,document.body.appendChild(t),this.dragTarget=t}_preventBodyScrolling(){document.body.style.overflow="hidden"}_enableBodyScrolling(){document.body.style.overflow=""}_animateIn(){this._animateSidenavIn(),this._animateOverlayIn()}_animateOut(){this._animateSidenavOut(),this._animateOverlayOut()}_animateSidenavIn(){let t=this.options.edge==="left"?-1:1;this.isDragged&&(t=this.options.edge==="left"?t+this.percentOpen:t-this.percentOpen);let e=this.options.inDuration;this.el.style.transition="none",this.el.style.transform="translateX("+t*100+"%)",setTimeout(()=>{this.el.style.transition=`transform ${e}ms ease`,this.el.style.transform="translateX(0)"},1),setTimeout(()=>{typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,this.el)},e)}_animateSidenavOut(){let t=this.options.edge==="left"?-1:1,e=this.options.outDuration;this.el.style.transition=`transform ${e}ms ease`,this.el.style.transform="translateX("+t*100+"%)",setTimeout(()=>{typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,this.el)},e)}_animateOverlayIn(){let t=0;this.isDragged?t=this.percentOpen:this._overlay.style.display="block";let e=this.options.inDuration;this._overlay.style.transition="none",this._overlay.style.opacity=t.toString(),setTimeout(()=>{this._overlay.style.transition=`opacity ${e}ms ease`,this._overlay.style.opacity="1"},1)}_animateOverlayOut(){let t=this.options.outDuration;this._overlay.style.transition=`opacity ${t}ms ease`,this._overlay.style.opacity="0",setTimeout(()=>{this._overlay.style.display="none"},t)}};S._sidenavs=[];var nt=S;var ae={indicators:!0,height:400,duration:500,interval:6e3,pauseOnFocus:!0,pauseOnHover:!0,indicatorLabelFunc:null},ft=class u extends f{constructor(t,e){super(t,e,u);this._handleVisibilityChange=()=>{document.hidden?this.interval!=null&&this._pause(!0):this.eventPause&&!(this.options.pauseOnHover&&this._hovered)&&!(this.options.pauseOnFocus&&this._focused)&&this.start()};this._handleIndicatorClick=t=>{let e=t.target.parentElement,i=[...e.parentNode.children].indexOf(e);this._focusCurrent=!0,this.set(i)};this._handleAutoPauseHover=()=>{this._hovered=!0,this.interval!=null&&this._pause(!0)};this._handleAutoPauseFocus=()=>{this._focused=!0,this.interval!=null&&this._pause(!0)};this._handleAutoStartHover=()=>{this._hovered=!1,!(this.options.pauseOnFocus&&this._focused)&&this.eventPause&&this.start()};this._handleAutoStartFocus=()=>{this._focused=!1,!(this.options.pauseOnHover&&this._hovered)&&this.eventPause&&this.start()};this._handleInterval=()=>{let t=this._slider.querySelector(".active"),e=[...t.parentNode.children].indexOf(t);this._slides.length===e+1?e=0:e+=1,this.set(e)};this.pause=()=>{this._pause(!1)};this.start=()=>{clearInterval(this.interval),this.interval=setInterval(this._handleInterval,this.options.duration+this.options.interval),this.eventPause=!1};this.next=()=>{let t=this.activeIndex+1;t>=this._slides.length?t=0:t<0&&(t=this._slides.length-1),this.set(t)};this.prev=()=>{let t=this.activeIndex-1;t>=this._slides.length?t=0:t<0&&(t=this._slides.length-1),this.set(t)};this.el.Expressive_Slider=this,this.options={...u.defaults,...e},this.interval=null,this.eventPause=!1,this._hovered=!1,this._focused=!1,this._focusCurrent=!1,this._slider=this.el.querySelector(".slides"),this._slides=Array.from(this._slider.querySelectorAll("li")),this.activeIndex=this._slides.findIndex(s=>s.classList.contains("active")),this.activeIndex!==-1&&(this._activeSlide=this._slides[this.activeIndex]),this._setSliderHeight(),this._slider.hasAttribute("id")?this._sliderId=this._slider.getAttribute("id"):(this._sliderId="slider-"+r.guid(),this._slider.setAttribute("id",this._sliderId));let i="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";this._slides.forEach(s=>{let o=s.querySelector("img");o&&o.src!==i&&(o.style.backgroundImage="url("+o.src+")",o.src=i),s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1"),s.style.visibility="hidden"}),this._setupIndicators(),this._activeSlide?(this._activeSlide.style.display="block",this._activeSlide.style.visibility="visible"):(this.activeIndex=0,this._slides[0].classList.add("active"),this._slides[0].style.visibility="visible",this._activeSlide=this._slides[0],this._animateSlide(this._slides[0],!0),this.options.indicators&&this._indicators[this.activeIndex].children[0].classList.add("active")),this._setupEventHandlers(),this.start()}static get defaults(){return ae}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Slider}destroy(){this.pause(),this._removeIndicators(),this._removeEventHandlers(),this.el.Expressive_Slider=void 0}_setupEventHandlers(){this.options.pauseOnFocus&&(this.el.addEventListener("focusin",this._handleAutoPauseFocus),this.el.addEventListener("focusout",this._handleAutoStartFocus)),this.options.pauseOnHover&&(this.el.addEventListener("mouseenter",this._handleAutoPauseHover),this.el.addEventListener("mouseleave",this._handleAutoStartHover)),this.options.indicators&&this._indicators.forEach(t=>{t.addEventListener("click",this._handleIndicatorClick)}),document.addEventListener("visibilitychange",this._handleVisibilityChange)}_removeEventHandlers(){this.options.pauseOnFocus&&(this.el.removeEventListener("focusin",this._handleAutoPauseFocus),this.el.removeEventListener("focusout",this._handleAutoStartFocus)),this.options.pauseOnHover&&(this.el.removeEventListener("mouseenter",this._handleAutoPauseHover),this.el.removeEventListener("mouseleave",this._handleAutoStartHover)),this.options.indicators&&this._indicators.forEach(t=>{t.removeEventListener("click",this._handleIndicatorClick)}),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_animateSlide(t,e){let i=0,s=0;t.style.opacity=e?"0":"1",setTimeout(()=>{t.style.transition=`opacity ${this.options.duration}ms ease`,t.style.opacity=e?"1":"0"},1);let o=t.querySelector(".caption");o&&(o.classList.contains("center-align")?s=-100:o.classList.contains("right-align")?i=100:o.classList.contains("left-align")&&(i=-100),o.style.opacity=e?"0":"1",o.style.transform=e?`translate(${i}px, ${s}px)`:"translate(0, 0)",setTimeout(()=>{o.style.transition=`opacity ${this.options.duration}ms ease, transform ${this.options.duration}ms ease`,o.style.opacity=e?"1":"0",o.style.transform=e?"translate(0, 0)":`translate(${i}px, ${s}px)`},this.options.duration))}_setSliderHeight(){this.el.classList.contains("fullscreen")||(this.options.indicators?this.el.style.height=this.options.height+40+"px":this.el.style.height=this.options.height+"px",this._slider.style.height=this.options.height+"px")}_setupIndicators(){if(this.options.indicators){let t=document.createElement("ul");t.classList.add("indicators");let e=[];this._slides.forEach((i,s)=>{let o=this.options.indicatorLabelFunc?this.options.indicatorLabelFunc.call(this,s+1,s===0):`${s+1}`,a=document.createElement("li");a.classList.add("indicator-item");let l=document.createElement("button");l.type="button",l.classList.add("indicator-item-btn"),l.setAttribute("aria-label",o),l.setAttribute("aria-controls",this._sliderId),a.appendChild(l),e.push(a),t.append(a)}),this.el.append(t),this._indicators=e}}_removeIndicators(){this.el.querySelector("ul.indicators").remove()}set(t){if(t>=this._slides.length?t=0:t<0&&(t=this._slides.length-1),this.activeIndex===t)return;this._activeSlide=this._slides[this.activeIndex];let e=this._activeSlide.querySelector(".caption");if(this._activeSlide.classList.remove("active"),this._slides.forEach(i=>i.style.visibility="visible"),this._activeSlide.style.opacity="0",setTimeout(()=>{this._slides.forEach(i=>{i.classList.contains("active")||(i.style.opacity="0",i.style.transform="translate(0, 0)",i.style.visibility="hidden")})},this.options.duration),e&&(e.style.opacity="0"),this.options.indicators){let i=this._indicators[this.activeIndex].children[0],s=this._indicators[t].children[0];i.classList.remove("active"),s.classList.add("active"),typeof this.options.indicatorLabelFunc=="function"&&(i.ariaLabel=this.options.indicatorLabelFunc.call(this,this.activeIndex,!1),s.ariaLabel=this.options.indicatorLabelFunc.call(this,t,!0))}this._animateSlide(this._slides[t],!0),this._slides[t].classList.add("active"),this.activeIndex=t,this.interval!=null&&this.start()}_pause(t){clearInterval(this.interval),this.eventPause=t,this.interval=null}};var le={duration:300,onShow:null,swipeable:!1,responsiveThreshold:1/0},ot=class u extends f{constructor(t,e){super(t,e,u);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;this._activeTabLink.classList.remove("active");let a=this._content;this._activeTabLink=i,i.hash&&(this._content=document.querySelector(i.hash)),this._tabLinks=this._queryTabLinks(),this._activeTabLink.classList.add("active");let l=this._index;this._index=Math.max(Array.from(this._tabLinks).indexOf(i),0),this.options.swipeable?this._tabsCarousel&&this._tabsCarousel.set(this._index,()=>{typeof this.options.onShow=="function"&&this.options.onShow.call(this,this._content)}):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(l),t.preventDefault()};this.el.Expressive_Tabs=this,this.options={...u.defaults,...e},this._tabLinks=this._queryTabLinks(),this._index=0,this._setupActiveTabLink(),this.options.swipeable?this._setupSwipeableTabs():this._setupNormalTabs(),this._setTabsAndTabWidth(),this._createIndicator(),this._setupEventHandlers()}static get defaults(){return le}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Tabs}destroy(){this._removeEventHandlers(),this._indicator.parentNode.removeChild(this._indicator),this.options.swipeable?this._teardownSwipeableTabs():this._teardownNormalTabs(),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, :scope > li.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"}_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}Array.from(this._tabLinks).forEach(t=>t.classList.remove("active")),this._activeTabLink.classList.add("active"),this._index=Math.max(Array.from(this._tabLinks).indexOf(this._activeTabLink),0),this._activeTabLink&&this._activeTabLink.hash&&(this._content=document.querySelector(this._activeTabLink.hash),this._content&&this._content.classList.add("active"))}_setupSwipeableTabs(){window.innerWidth>this.options.responsiveThreshold&&(this.options.swipeable=!1);let t=[];this._tabLinks.forEach(i=>{if(i.hash){let s=document.querySelector(i.hash);s.classList.add("carousel-item"),t.push(s)}});let e=document.createElement("div");e.classList.add("tabs-content","carousel","carousel-slider"),t[0].parentElement.insertBefore(e,t[0]),t.forEach(i=>{e.appendChild(i),i.style.display=""}),this._tabsCarousel=N.init(e,{fullWidth:!0,noWrap:!0,onCycleTo:i=>{let s=this._index;this._index=Array.from(i.parentNode.children).indexOf(i),this._activeTabLink.classList.remove("active"),this._activeTabLink=Array.from(this._tabLinks)[this._index],this._activeTabLink.classList.add("active"),this._animateIndicator(s),typeof this.options.onShow=="function"&&this.options.onShow.call(this,this._content)}}),this._tabsCarousel.set(this._index)}_teardownSwipeableTabs(){let t=this._tabsCarousel.el;this._tabsCarousel.destroy(),t.append(t.parentElement),t.remove()}_setupNormalTabs(){Array.from(this._tabLinks).forEach(t=>{if(t!==this._activeTabLink&&t.hash){let e=document.querySelector(t.hash);e&&(e.style.display="none")}})}_teardownNormalTabs(){this._tabLinks.forEach(t=>{if(t.hash){let e=document.querySelector(t.hash);e&&(e.style.display="")}})}_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=`
|
|
37
|
+
</dialog>`},bt=function(n){let t=document.createElement("dialog");return t.id=n.id,t},_t(G,rt);var Z=G;var se={responsiveThreshold:0},Q=class u extends f{constructor(n,t){super(n,t,u),this.el.Expressive_Parallax=this,this.options={...u.defaults,...t},this.el.querySelector("img, video")||console.error("Parallax: no <img> or <video> to move inside the .parallax element")}static get defaults(){return se}static init(n,t={}){return super.init(n,t,u)}static getInstance(n){return n.Expressive_Parallax}destroy(){this.el.Expressive_Parallax=void 0}};var ne={top:0,bottom:1/0,offset:0,onPositionChange:null},D=class D extends f{constructor(n,t){super(n,t,D),this.el.Expressive_Pushpin=this,this.options={...D.defaults,...t},this.originalOffset=this.el.offsetTop,D._pushpins.push(this),this._setupEventHandlers(),this._updatePosition()}static get defaults(){return ne}static init(n,t={}){return super.init(n,t,D)}static getInstance(n){return n.Expressive_Pushpin}destroy(){this.el.style.top=null,this._removePinClasses();let n=D._pushpins.indexOf(this);D._pushpins.splice(n,1),D._pushpins.length===0&&this._removeEventHandlers(),this.el.Expressive_Pushpin=void 0}static _updateElements(){for(let n=0;n<D._pushpins.length;n++)D._pushpins[n]._updatePosition()}_setupEventHandlers(){document.addEventListener("scroll",D._updateElements,{passive:!0})}_removeEventHandlers(){document.removeEventListener("scroll",D._updateElements)}_updatePosition(){let n=r.getDocumentScrollTop()+this.options.offset;this.options.top<=n&&this.options.bottom>=n&&!this.el.classList.contains("pinned")&&(this._removePinClasses(),this.el.style.top=`${this.options.offset}px`,this.el.classList.add("pinned"),typeof this.options.onPositionChange=="function"&&this.options.onPositionChange.call(this,"pinned")),n<this.options.top&&!this.el.classList.contains("pin-top")&&(this._removePinClasses(),this.el.style.top="0",this.el.classList.add("pin-top"),typeof this.options.onPositionChange=="function"&&this.options.onPositionChange.call(this,"pin-top")),n>this.options.bottom&&!this.el.classList.contains("pin-bottom")&&(this._removePinClasses(),this.el.classList.add("pin-bottom"),this.el.style.top=`${this.options.bottom-this.originalOffset}px`,typeof this.options.onPositionChange=="function"&&this.options.onPositionChange.call(this,"pin-bottom"))}_removePinClasses(){this.el.classList.remove("pin-top","pinned","pin-bottom")}};D._pushpins=[];var J=D;var oe={throttle:100,scrollOffset:200,activeClass:"active",getActiveElement:u=>'a[href="#'+u+'"]',keepTopElementActive:!1,animationDuration:null},p=class p extends f{constructor(n,t){super(n,t,p),this.el.Expressive_ScrollSpy=this,this.options={...p.defaults,...t},p._elements.push(this),p._count++,p._increment++,this.tickId=-1,this.id=p._increment.toString(),this._setupEventHandlers(),p._handleWindowScroll()}static get defaults(){return oe}static init(n,t={}){return super.init(n,t,p)}static getInstance(n){return n.Expressive_ScrollSpy}destroy(){let n=p._elements.indexOf(this);n>=0&&p._elements.splice(n,1);let t=p._elementsInView.indexOf(this);t>=0&&p._elementsInView.splice(t,1);let e=p._visibleElements.indexOf(this.el);e>=0&&p._visibleElements.splice(e,1),p._count--,this._removeEventHandlers(),document.querySelector(this.options.getActiveElement(this.el.id))?.classList.remove(this.options.activeClass),this.el.Expressive_ScrollSpy=void 0}_setupEventHandlers(){p._count===1&&(p._throttledScroll=r.throttle(p._handleWindowScroll,this.options.throttle),p._throttledResize=r.throttle(p._handleWindowScroll,200),window.addEventListener("scroll",p._throttledScroll,{passive:!0}),window.addEventListener("resize",p._throttledResize,{passive:!0}),document.body.addEventListener("click",p._handleTriggerClick))}_removeEventHandlers(){p._count===0&&(window.removeEventListener("scroll",p._throttledScroll),window.removeEventListener("resize",p._throttledResize),document.body.removeEventListener("click",p._handleTriggerClick),p._throttledScroll=null,p._throttledResize=null)}static _findElements(n,t,e,i){let s=[],o=document.documentElement,a=o.clientTop,l=o.clientLeft,h=window.scrollY,d=window.scrollX;for(let c=0;c<p._elements.length;c++){let m=p._elements[c],g=n+m.options.scrollOffset||200,E=m.el.getBoundingClientRect();if(E.height>0){let T=E.top+h-a,x=E.left+d-l,V=x+E.width,k=T+E.height;!(x>t||V<i||T>e||k<g)&&s.push(m)}}return s}_enter(){p._visibleElements=p._visibleElements.filter(t=>t.getBoundingClientRect().height!==0),p._visibleElements[0]?(document.querySelector(this.options.getActiveElement(p._visibleElements[0].id))?.classList.remove(this.options.activeClass),p._visibleElements[0].Expressive_ScrollSpy&&this.id<p._visibleElements[0].Expressive_ScrollSpy.id?p._visibleElements.unshift(this.el):p._visibleElements.push(this.el)):p._visibleElements.push(this.el),p._resetKeptTopActiveElement(this.options.activeClass);let n=this.options.getActiveElement(p._visibleElements[0].id);document.querySelector(n)?.classList.add(this.options.activeClass)}_exit(){if(p._visibleElements=p._visibleElements.filter(n=>n.getBoundingClientRect().height!==0),p._visibleElements[0]&&(document.querySelector(this.options.getActiveElement(p._visibleElements[0].id))?.classList.remove(this.options.activeClass),p._visibleElements=p._visibleElements.filter(t=>t.id!=this.el.id),p._visibleElements[0])){let t=this.options.getActiveElement(p._visibleElements[0].id);document.querySelector(t)?.classList.add(this.options.activeClass),p._resetKeptTopActiveElement(this.options.activeClass)}}static _resetKeptTopActiveElement(n){p._keptTopActiveElement&&(p._keptTopActiveElement.classList.remove(n),p._keptTopActiveElement=null)}static _getDistanceToViewport(n){return n.getBoundingClientRect().top}static _smoothScrollIntoView(n,t=300){let e=n.getBoundingClientRect().top+(window.scrollY||window.pageYOffset),i=window.scrollY||window.pageYOffset,s=e-i,o=performance.now();function a(l){let h=l-o,d=Math.min(h/t,1),c=i+s*d;d<1?(window.scrollTo(0,c),requestAnimationFrame(a)):window.scrollTo(0,e)}requestAnimationFrame(a)}};p._keptTopActiveElement=null,p._throttledScroll=null,p._throttledResize=null,p._handleTriggerClick=n=>{let t=n.target;for(let e=p._elements.length-1;e>=0;e--){let i=p._elements[e],s=document.querySelector('a[href="#'+i.el.id+'"]');if(t===s){n.preventDefault(),i.el.Expressive_ScrollSpy.options.animationDuration?p._smoothScrollIntoView(i.el,i.el.Expressive_ScrollSpy.options.animationDuration):i.el.scrollIntoView({behavior:"smooth"});break}}},p._handleWindowScroll=()=>{p._ticks++;let n=r.getDocumentScrollTop(),t=r.getDocumentScrollLeft(),e=t+window.innerWidth,i=n+window.innerHeight,s=p._findElements(n,e,i,t);for(let o=0;o<s.length;o++){let a=s[o];a.tickId<0&&a._enter(),a.tickId=p._ticks}for(let o=0;o<p._elementsInView.length;o++){let a=p._elementsInView[o],l=a.tickId;l>=0&&l!==p._ticks&&(a._exit(),a.tickId=-1)}if(p._elementsInView=s,p._elements.length){let o=p._elements[0].el.Expressive_ScrollSpy.options;if(o.keepTopElementActive&&p._visibleElements.length===0){p._resetKeptTopActiveElement(o.activeClass);let a=p._elements.map(d=>({value:d,distance:p._getDistanceToViewport(d.el)})).filter(d=>d.distance<=0).sort((d,c)=>d.distance-c.distance).map(d=>d.value),l=a.length?a[a.length-1]:p._elements[0],h=document.querySelector(o.getActiveElement(l.el.id));h?.classList.add(o.activeClass),p._keptTopActiveElement=h}}},p._elements=[],p._elementsInView=[],p._visibleElements=[],p._count=0,p._increment=0,p._ticks=0;var tt=p;var ae={edge:"left",draggable:!0,dragTargetWidth:"10px",inDuration:250,outDuration:200,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,preventScrolling:!0},I=class I extends f{constructor(t,e){super(t,e,I);this._handleDragTargetDrag=t=>{if(!this._isDraggable())return;let e=this._calculateDelta(t),i=e>0?"right":"left";e=Math.min(this._width,Math.abs(e)),this.options.edge===i&&(e=0);let s=e,o="translateX(-100%)";this.options.edge==="right"&&(o="translateX(100%)",s=-s),this.percentOpen=Math.min(1,e/this._width),this.el.style.transform=`${o} translateX(${s}px)`,this._overlay.style.opacity=this.percentOpen.toString()};this._handleDragTargetRelease=()=>{this.isDragged&&(this.percentOpen>.2?this.open():this._animateOut(),this.isDragged=!1,this._verticallyScrolling=!1)};this._handleCloseDrag=t=>{if(!this.isOpen||!this._isDraggable())return;let e=this._calculateDelta(t),i=e>0?"right":"left";e=Math.min(this._width,Math.abs(e)),this.options.edge!==i&&(e=0);let s=-e;this.options.edge==="right"&&(s=-s),this.percentOpen=Math.min(1,1-e/this._width),this.el.style.transform=`translateX(${s}px)`,this._overlay.style.opacity=this.percentOpen.toString()};this._calculateDelta=t=>(this.isDragged||this._startDrag(t),this._dragMoveUpdate(t),this._xPos-this._startingXpos);this._handleCloseRelease=()=>{this.isOpen&&this.isDragged&&(this.percentOpen>.8?this._animateIn():this.close(),this.isDragged=!1,this._verticallyScrolling=!1)};this._handleCloseTriggerClick=t=>{t.target.closest(".sidenav-close")&&!this._isCurrentlyFixed()&&this.close()};this._handleWindowResize=()=>{this.lastWindowWidth!==window.innerWidth&&(window.innerWidth>992?this.open():this.close()),this.lastWindowWidth=window.innerWidth,this.lastWindowHeight=window.innerHeight};this.open=()=>{this.isOpen!==!0&&(this.isOpen=!0,typeof this.options.onOpenStart=="function"&&this.options.onOpenStart.call(this,this.el),this._isCurrentlyFixed()?(this.el.style.transform="translateX(0)",this._enableBodyScrolling(),this._overlay.style.display="none"):(this.options.preventScrolling&&this._preventBodyScrolling(),(!this.isDragged||this.percentOpen!=1)&&this._animateIn(),this._setAriaHidden(),this._setTabIndex()))};this.close=()=>{if(this.isOpen!==!1)if(this.isOpen=!1,typeof this.options.onCloseStart=="function"&&this.options.onCloseStart.call(this,this.el),this._isCurrentlyFixed()){let t=this.options.edge==="left"?"-105%":"105%";this.el.style.transform=`translateX(${t})`}else this._enableBodyScrolling(),!this.isDragged||this.percentOpen!=0?this._animateOut():this._overlay.style.display="none",this._setAriaHidden(),this._setTabIndex()};this._setAriaHidden=()=>{this.el.ariaHidden=this.isOpen?"false":"true";let t=document.querySelector(".nav-wrapper ul");t&&(t.ariaHidden=this.isOpen.toString())};this._setTabIndex=()=>{let t=document.querySelectorAll(".nav-wrapper ul li a"),e=document.querySelectorAll(".sidenav li a");t&&t.forEach(i=>{i.tabIndex=this.isOpen?-1:0}),e&&e.forEach(i=>{i.tabIndex=this.isOpen?0:-1})};this.el.Expressive_Sidenav=this,this.options={...I.defaults,...e},this.id=this.el.id,this.isOpen=!1,this.isFixed=this.el.classList.contains("sidenav-fixed"),this.isDragged=!1,this.lastWindowWidth=window.innerWidth,this.lastWindowHeight=window.innerHeight,this._createOverlay(),this._createDragTarget(),this._setupEventHandlers(),this._setupClasses(),this._setupFixed(),I._sidenavs.push(this)}static get defaults(){return ae}static init(t,e={}){return super.init(t,e,I)}static getInstance(t){return t.Expressive_Sidenav}destroy(){this._removeEventHandlers(),this._enableBodyScrolling(),this._overlay.parentNode.removeChild(this._overlay),this.dragTarget.parentNode.removeChild(this.dragTarget),this.el.Expressive_Sidenav=void 0,this.el.style.transform="";let t=I._sidenavs.indexOf(this);t>=0&&I._sidenavs.splice(t,1)}_createOverlay(){this._overlay=document.createElement("div"),this._overlay.classList.add("sidenav-overlay"),this._overlay.addEventListener("click",this.close),document.body.appendChild(this._overlay)}_setupEventHandlers(){I._sidenavs.length===0&&document.body.addEventListener("click",this._handleTriggerClick);let t={passive:!0};this.dragTarget.addEventListener("touchmove",this._handleDragTargetDrag,t),this.dragTarget.addEventListener("touchend",this._handleDragTargetRelease),this._overlay.addEventListener("touchmove",this._handleCloseDrag,t),this._overlay.addEventListener("touchend",this._handleCloseRelease),this.el.addEventListener("touchmove",this._handleCloseDrag,t),this.el.addEventListener("touchend",this._handleCloseRelease),this.el.addEventListener("click",this._handleCloseTriggerClick),this.isFixed&&window.addEventListener("resize",this._handleWindowResize,t),this._setAriaHidden(),this._setTabIndex()}_removeEventHandlers(){I._sidenavs.length===1&&document.body.removeEventListener("click",this._handleTriggerClick),this.dragTarget.removeEventListener("touchmove",this._handleDragTargetDrag),this.dragTarget.removeEventListener("touchend",this._handleDragTargetRelease),this._overlay.removeEventListener("touchmove",this._handleCloseDrag),this._overlay.removeEventListener("touchend",this._handleCloseRelease),this.el.removeEventListener("touchmove",this._handleCloseDrag),this.el.removeEventListener("touchend",this._handleCloseRelease),this.el.removeEventListener("click",this._handleCloseTriggerClick),this.isFixed&&window.removeEventListener("resize",this._handleWindowResize)}_handleTriggerClick(t){let e=t.target.closest(".sidenav-trigger");if(t.target&&e){let i=r.getIdFromTrigger(e),s=document.getElementById(i)?.Expressive_Sidenav;s&&s.open(),t.preventDefault()}}_startDrag(t){let e=t.targetTouches[0].clientX;this.isDragged=!0,this._startingXpos=e,this._xPos=this._startingXpos,this._time=Date.now(),this._width=this.el.getBoundingClientRect().width,this._overlay.style.display="block",this._initialScrollTop=this.isOpen?this.el.scrollTop:r.getDocumentScrollTop(),this._verticallyScrolling=!1}_dragMoveUpdate(t){let e=t.targetTouches[0].clientX,i=this.isOpen?this.el.scrollTop:r.getDocumentScrollTop();this.deltaX=Math.abs(this._xPos-e),this._xPos=e,this.velocityX=this.deltaX/(Date.now()-this._time),this._time=Date.now(),this._initialScrollTop!==i&&(this._verticallyScrolling=!0)}_setupClasses(){this.options.edge==="right"&&(this.el.classList.add("right-aligned"),this.dragTarget.classList.add("right-aligned"))}_removeClasses(){this.el.classList.remove("right-aligned"),this.dragTarget.classList.remove("right-aligned")}_setupFixed(){this._isCurrentlyFixed()&&this.open()}_isDraggable(){return this.options.draggable&&!this._isCurrentlyFixed()&&!this._verticallyScrolling}_isCurrentlyFixed(){return this.isFixed&&window.innerWidth>992}_createDragTarget(){let t=document.createElement("div");t.classList.add("drag-target"),t.style.width=this.options.dragTargetWidth,document.body.appendChild(t),this.dragTarget=t}_preventBodyScrolling(){document.body.style.overflow="hidden"}_enableBodyScrolling(){document.body.style.overflow=""}_animateIn(){this._animateSidenavIn(),this._animateOverlayIn()}_animateOut(){this._animateSidenavOut(),this._animateOverlayOut()}_animateSidenavIn(){let t=this.options.edge==="left"?-1:1;this.isDragged&&(t=this.options.edge==="left"?t+this.percentOpen:t-this.percentOpen);let e=this.options.inDuration;this.el.style.transition="none",this.el.style.transform="translateX("+t*100+"%)",setTimeout(()=>{this.el.style.transition=`transform ${e}ms ease`,this.el.style.transform="translateX(0)"},1),setTimeout(()=>{typeof this.options.onOpenEnd=="function"&&this.options.onOpenEnd.call(this,this.el)},e)}_animateSidenavOut(){let t=this.options.edge==="left"?-1:1,e=this.options.outDuration;this.el.style.transition=`transform ${e}ms ease`,this.el.style.transform="translateX("+t*100+"%)",setTimeout(()=>{typeof this.options.onCloseEnd=="function"&&this.options.onCloseEnd.call(this,this.el)},e)}_animateOverlayIn(){let t=0;this.isDragged?t=this.percentOpen:this._overlay.style.display="block";let e=this.options.inDuration;this._overlay.style.transition="none",this._overlay.style.opacity=t.toString(),setTimeout(()=>{this._overlay.style.transition=`opacity ${e}ms ease`,this._overlay.style.opacity="1"},1)}_animateOverlayOut(){let t=this.options.outDuration;this._overlay.style.transition=`opacity ${t}ms ease`,this._overlay.style.opacity="0",setTimeout(()=>{this._overlay.style.display="none"},t)}};I._sidenavs=[];var et=I;var le={indicators:!0,height:400,duration:500,interval:6e3,pauseOnFocus:!0,pauseOnHover:!0,indicatorLabelFunc:null},dt=class u extends f{constructor(t,e){super(t,e,u);this._handleVisibilityChange=()=>{document.hidden?this.interval!=null&&this._pause(!0):this.eventPause&&!(this.options.pauseOnHover&&this._hovered)&&!(this.options.pauseOnFocus&&this._focused)&&this.start()};this._handleIndicatorClick=t=>{let e=t.target.parentElement,i=[...e.parentNode.children].indexOf(e);this._focusCurrent=!0,this.set(i)};this._handleAutoPauseHover=()=>{this._hovered=!0,this.interval!=null&&this._pause(!0)};this._handleAutoPauseFocus=()=>{this._focused=!0,this.interval!=null&&this._pause(!0)};this._handleAutoStartHover=()=>{this._hovered=!1,!(this.options.pauseOnFocus&&this._focused)&&this.eventPause&&this.start()};this._handleAutoStartFocus=()=>{this._focused=!1,!(this.options.pauseOnHover&&this._hovered)&&this.eventPause&&this.start()};this._handleInterval=()=>{let t=this._slider.querySelector(".active"),e=[...t.parentNode.children].indexOf(t);this._slides.length===e+1?e=0:e+=1,this.set(e)};this.pause=()=>{this._pause(!1)};this.start=()=>{clearInterval(this.interval),this.interval=setInterval(this._handleInterval,this.options.duration+this.options.interval),this.eventPause=!1};this.next=()=>{let t=this.activeIndex+1;t>=this._slides.length?t=0:t<0&&(t=this._slides.length-1),this.set(t)};this.prev=()=>{let t=this.activeIndex-1;t>=this._slides.length?t=0:t<0&&(t=this._slides.length-1),this.set(t)};this.el.Expressive_Slider=this,this.options={...u.defaults,...e},this.interval=null,this.eventPause=!1,this._hovered=!1,this._focused=!1,this._focusCurrent=!1,this._slider=this.el.querySelector(".slides"),this._slides=Array.from(this._slider.querySelectorAll("li")),this.activeIndex=this._slides.findIndex(s=>s.classList.contains("active")),this.activeIndex!==-1&&(this._activeSlide=this._slides[this.activeIndex]),this._setSliderHeight(),this._slider.hasAttribute("id")?this._sliderId=this._slider.getAttribute("id"):(this._sliderId="slider-"+r.guid(),this._slider.setAttribute("id",this._sliderId));let i="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";this._slides.forEach(s=>{let o=s.querySelector("img");o&&o.src!==i&&(o.style.backgroundImage="url("+o.src+")",o.src=i),s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1"),s.style.visibility="hidden"}),this._setupIndicators(),this._activeSlide?(this._activeSlide.style.display="block",this._activeSlide.style.visibility="visible"):(this.activeIndex=0,this._slides[0].classList.add("active"),this._slides[0].style.visibility="visible",this._activeSlide=this._slides[0],this._animateSlide(this._slides[0],!0),this.options.indicators&&this._indicators[this.activeIndex].children[0].classList.add("active")),this._setupEventHandlers(),this.start()}static get defaults(){return le}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Slider}destroy(){this.pause(),this._removeIndicators(),this._removeEventHandlers(),this.el.Expressive_Slider=void 0}_setupEventHandlers(){this.options.pauseOnFocus&&(this.el.addEventListener("focusin",this._handleAutoPauseFocus),this.el.addEventListener("focusout",this._handleAutoStartFocus)),this.options.pauseOnHover&&(this.el.addEventListener("mouseenter",this._handleAutoPauseHover),this.el.addEventListener("mouseleave",this._handleAutoStartHover)),this.options.indicators&&this._indicators.forEach(t=>{t.addEventListener("click",this._handleIndicatorClick)}),document.addEventListener("visibilitychange",this._handleVisibilityChange)}_removeEventHandlers(){this.options.pauseOnFocus&&(this.el.removeEventListener("focusin",this._handleAutoPauseFocus),this.el.removeEventListener("focusout",this._handleAutoStartFocus)),this.options.pauseOnHover&&(this.el.removeEventListener("mouseenter",this._handleAutoPauseHover),this.el.removeEventListener("mouseleave",this._handleAutoStartHover)),this.options.indicators&&this._indicators.forEach(t=>{t.removeEventListener("click",this._handleIndicatorClick)}),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_animateSlide(t,e){let i=0,s=0;t.style.opacity=e?"0":"1",setTimeout(()=>{t.style.transition=`opacity ${this.options.duration}ms ease`,t.style.opacity=e?"1":"0"},1);let o=t.querySelector(".caption");o&&(o.classList.contains("center-align")?s=-100:o.classList.contains("right-align")?i=100:o.classList.contains("left-align")&&(i=-100),o.style.opacity=e?"0":"1",o.style.transform=e?`translate(${i}px, ${s}px)`:"translate(0, 0)",setTimeout(()=>{o.style.transition=`opacity ${this.options.duration}ms ease, transform ${this.options.duration}ms ease`,o.style.opacity=e?"1":"0",o.style.transform=e?"translate(0, 0)":`translate(${i}px, ${s}px)`},this.options.duration))}_setSliderHeight(){this.el.classList.contains("fullscreen")||(this.options.indicators?this.el.style.height=this.options.height+40+"px":this.el.style.height=this.options.height+"px",this._slider.style.height=this.options.height+"px")}_setupIndicators(){if(this.options.indicators){let t=document.createElement("ul");t.classList.add("indicators");let e=[];this._slides.forEach((i,s)=>{let o=this.options.indicatorLabelFunc?this.options.indicatorLabelFunc.call(this,s+1,s===0):`${s+1}`,a=document.createElement("li");a.classList.add("indicator-item");let l=document.createElement("button");l.type="button",l.classList.add("indicator-item-btn"),l.setAttribute("aria-label",o),l.setAttribute("aria-controls",this._sliderId),a.appendChild(l),e.push(a),t.append(a)}),this.el.append(t),this._indicators=e}}_removeIndicators(){this.el.querySelector("ul.indicators").remove()}set(t){if(t>=this._slides.length?t=0:t<0&&(t=this._slides.length-1),this.activeIndex===t)return;this._activeSlide=this._slides[this.activeIndex];let e=this._activeSlide.querySelector(".caption");if(this._activeSlide.classList.remove("active"),this._slides.forEach(i=>i.style.visibility="visible"),this._activeSlide.style.opacity="0",setTimeout(()=>{this._slides.forEach(i=>{i.classList.contains("active")||(i.style.opacity="0",i.style.transform="translate(0, 0)",i.style.visibility="hidden")})},this.options.duration),e&&(e.style.opacity="0"),this.options.indicators){let i=this._indicators[this.activeIndex].children[0],s=this._indicators[t].children[0];i.classList.remove("active"),s.classList.add("active"),typeof this.options.indicatorLabelFunc=="function"&&(i.ariaLabel=this.options.indicatorLabelFunc.call(this,this.activeIndex,!1),s.ariaLabel=this.options.indicatorLabelFunc.call(this,t,!0))}this._animateSlide(this._slides[t],!0),this._slides[t].classList.add("active"),this.activeIndex=t,this.interval!=null&&this.start()}_pause(t){clearInterval(this.interval),this.eventPause=t,this.interval=null}};var re={duration:300,onShow:null,swipeable:!1,responsiveThreshold:1/0},it=class u extends f{constructor(t,e){super(t,e,u);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;this._activeTabLink.classList.remove("active");let a=this._content;this._activeTabLink=i,i.hash&&(this._content=document.querySelector(i.hash)),this._tabLinks=this._queryTabLinks(),this._activeTabLink.classList.add("active");let l=this._index;this._index=Math.max(Array.from(this._tabLinks).indexOf(i),0),this.options.swipeable?this._tabsCarousel&&this._tabsCarousel.set(this._index,()=>{typeof this.options.onShow=="function"&&this.options.onShow.call(this,this._content)}):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(l),t.preventDefault()};this.el.Expressive_Tabs=this,this.options={...u.defaults,...e},this._tabLinks=this._queryTabLinks(),this._index=0,this._setupActiveTabLink(),this.options.swipeable?this._setupSwipeableTabs():this._setupNormalTabs(),this._setTabsAndTabWidth(),this._createIndicator(),this._setupEventHandlers()}static get defaults(){return re}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Tabs}destroy(){this._removeEventHandlers(),this._indicator.parentNode.removeChild(this._indicator),this.options.swipeable?this._teardownSwipeableTabs():this._teardownNormalTabs(),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, :scope > li.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"}_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}Array.from(this._tabLinks).forEach(t=>t.classList.remove("active")),this._activeTabLink.classList.add("active"),this._index=Math.max(Array.from(this._tabLinks).indexOf(this._activeTabLink),0),this._activeTabLink&&this._activeTabLink.hash&&(this._content=document.querySelector(this._activeTabLink.hash),this._content&&this._content.classList.add("active"))}_setupSwipeableTabs(){window.innerWidth>this.options.responsiveThreshold&&(this.options.swipeable=!1);let t=[];this._tabLinks.forEach(i=>{if(i.hash){let s=document.querySelector(i.hash);s.classList.add("carousel-item"),t.push(s)}});let e=document.createElement("div");e.classList.add("tabs-content","carousel","carousel-slider"),t[0].parentElement.insertBefore(e,t[0]),t.forEach(i=>{e.appendChild(i),i.style.display=""}),this._tabsCarousel=F.init(e,{fullWidth:!0,noWrap:!0,onCycleTo:i=>{let s=this._index;this._index=Array.from(i.parentNode.children).indexOf(i),this._activeTabLink.classList.remove("active"),this._activeTabLink=Array.from(this._tabLinks)[this._index],this._activeTabLink.classList.add("active"),this._animateIndicator(s),typeof this.options.onShow=="function"&&this.options.onShow.call(this,this._content)}}),this._tabsCarousel.set(this._index)}_teardownSwipeableTabs(){let t=this._tabsCarousel.el;this._tabsCarousel.destroy(),t.append(t.parentElement),t.remove()}_setupNormalTabs(){Array.from(this._tabLinks).forEach(t=>{if(t!==this._activeTabLink&&t.hash){let e=document.querySelector(t.hash);e&&(e.style.display="none")}})}_teardownNormalTabs(){this._tabLinks.forEach(t=>{if(t.hash){let e=document.querySelector(t.hash);e&&(e.style.display="")}})}_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=`
|
|
38
38
|
left ${this.options.duration}ms ease-out ${e}ms,
|
|
39
|
-
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 re={onOpen:null,onClose:null},B=class B extends f{constructor(t,e){super(t,e,B);this._handleThrottledResize=r.throttle(()=>this._handleResize(),200);this._handleKeyboardInteraction=t=>{r.keys.ENTER.includes(t.key)&&this._handleTargetToggle()};this._handleTargetToggle=()=>{this.isOpen?this.close():this.open()};this._handleResize=()=>{this._calculatePositioning()};this._handleDocumentClick=t=>{let e=t.target;e instanceof Element&&!this.originEl.contains(e)&&!e.closest(".tap-target-wrapper")&&this.close()};this.open=()=>{this.isOpen||(typeof this.options.onOpen=="function"&&this.options.onOpen.call(this,this.originEl),this.isOpen=!0,this.wrapper.classList.add("open"),this.wrapper.ariaExpanded="true",document.body.addEventListener("click",this._handleDocumentClick,!0),document.body.addEventListener("keypress",this._handleDocumentClick,!0),document.body.addEventListener("touchend",this._handleDocumentClick))};this.close=()=>{this.isOpen&&(typeof this.options.onClose=="function"&&this.options.onClose.call(this,this.originEl),this.isOpen=!1,this.wrapper.classList.remove("open"),this.wrapper.ariaExpanded="false",document.body.removeEventListener("click",this._handleDocumentClick,!0),document.body.removeEventListener("keypress",this._handleDocumentClick,!0),document.body.removeEventListener("touchend",this._handleDocumentClick))};if(this.el.Expressive_TapTarget=this,this.options={...B.defaults,...e},this.isOpen=!1,this.originEl=t.dataset.target?document.getElementById(t.dataset.target):null,!this.originEl){console.error(`TapTarget: no element with id "${t.dataset.target??""}" to attach to`);return}this.originEl.tabIndex=0,this._setup(),this._calculatePositioning(),this._setupEventHandlers(),B._taptargets.push(this)}static get defaults(){return re}static init(t,e={}){return super.init(t,e,B)}static getInstance(t){return t.Expressive_TapTarget}destroy(){this.close(),this._removeEventHandlers(),this.el.Expressive_TapTarget=void 0;let t=B._taptargets.indexOf(this);t>=0&&B._taptargets.splice(t,1)}_setupEventHandlers(){this.originEl&&(this.originEl.addEventListener("click",this._handleTargetToggle),this.originEl.addEventListener("keypress",this._handleKeyboardInteraction,!0),window.addEventListener("resize",this._handleThrottledResize))}_removeEventHandlers(){this.originEl&&(this.originEl.removeEventListener("click",this._handleTargetToggle),this.originEl.removeEventListener("keypress",this._handleKeyboardInteraction,!0),window.removeEventListener("resize",this._handleThrottledResize))}_setup(){this.wrapper=this.el.parentElement,this.waveEl=this.wrapper.querySelector(".tap-target-wave"),this.el.parentElement.ariaExpanded="false",this.originEl.style.zIndex="1002",this.contentEl=this.el.querySelector(".tap-target-content"),this.wrapper.classList.contains(".tap-target-wrapper")||(this.wrapper=document.createElement("div"),this.wrapper.classList.add("tap-target-wrapper"),this.el.before(this.wrapper),this.wrapper.append(this.el)),this.contentEl||(this.contentEl=document.createElement("div"),this.contentEl.classList.add("tap-target-content"),this.el.append(this.contentEl)),this.waveEl||(this.waveEl=document.createElement("div"),this.waveEl.classList.add("tap-target-wave"),this.wrapper.append(this.waveEl))}_offset(t){let e=t.getBoundingClientRect(),i=document.documentElement;return{top:e.top+window.pageYOffset-i.clientTop,left:e.left+window.pageXOffset-i.clientLeft}}_calculatePositioning(){let t=getComputedStyle(this.originEl).position==="fixed";if(!t){let K=this.originEl,dt=[];for(;(K=K.parentNode)&&K!==document;)dt.push(K);for(let xt=0;xt<dt.length&&(t=getComputedStyle(dt[xt]).position==="fixed",!t);xt++);}let e=this.originEl.offsetWidth,i=this.originEl.offsetHeight,s=this._offset(this.originEl),o=t?s.top-r.getDocumentScrollTop():s.top,a=t?s.left-r.getDocumentScrollLeft():s.left,l=window.innerWidth,h=window.innerHeight,c=l-document.documentElement.clientWidth,d=l/2,m=h/2,y=a<=d,g=a>d,L=o<=m,b=o>m,D=a>=l*.25&&a<=l*.75,x=this.el.offsetWidth,k=this.el.offsetHeight,C=o+i/2-k/2,pt=a+e/2-x/2,gt=t?"fixed":"absolute",ut=D?x:x/2+e,Et=k/2,yt=L?k/2:0,_t=0,bt=y&&!D?x/2-e:0,Tt=0,Lt=e,wt=b?"bottom":"top",R=(e>i,e*2),q=R,ht=k/2-q/2,$=x/2-R/2;this.wrapper.style.top=L?C+"px":"",this.wrapper.style.right=g?l-pt-x-c+"px":"",this.wrapper.style.bottom=b?h-C-k+"px":"",this.wrapper.style.left=y?pt+"px":"",this.wrapper.style.position=gt,this.contentEl.style.width=ut+"px",this.contentEl.style.height=Et+"px",this.contentEl.style.top=yt+"px",this.contentEl.style.right=Tt+"px",this.contentEl.style.bottom=_t+"px",this.contentEl.style.left=bt+"px",this.contentEl.style.padding=Lt+"px",this.contentEl.style.verticalAlign=wt,this.waveEl.style.top=ht+"px",this.waveEl.style.left=$+"px",this.waveEl.style.width=R+"px",this.waveEl.style.height=q+"px"}};B._taptargets=[];var at=B;var he={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"},twelveHour:!0,vibrate:!0,onSelect:null,onInputInteraction:null,onDone:null,onCancel:null,displayPlugin:null,displayPluginOptions:null},T=class T extends f{constructor(t,e){super(t,e,T);this._clockBuilt=!1;this._handleInputClick=()=>{this._ensureClockBuilt(),this.inputHours.focus(),typeof this.options.onInputInteraction=="function"&&this.options.onInputInteraction.call(this),this.displayPlugin&&this.displayPlugin.show()};this._handleInputKeydown=t=>{r.keys.ENTER.includes(t.key)&&(t.preventDefault(),this._ensureClockBuilt(),this.inputHours.focus(),typeof this.options.onInputInteraction=="function"&&this.options.onInputInteraction.call(this),this.displayPlugin&&this.displayPlugin.show())};this._handleTimeInputEnterKey=t=>{r.keys.ENTER.includes(t.key)&&(t.preventDefault(),this._inputFromTextField())};this._handleClockClickStart=t=>{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;let s=T._Pos(t);this.dx=s.x-this.x0,this.dy=s.y-this.y0,this.setHand(this.dx,this.dy,!1),document.addEventListener("mousemove",this._handleDocumentClickMove),document.addEventListener("touchmove",this._handleDocumentClickMove),document.addEventListener("mouseup",this._handleDocumentClickEnd),document.addEventListener("touchend",this._handleDocumentClickEnd)};this._handleDocumentClickMove=t=>{t.preventDefault();let e=T._Pos(t),i=e.x-this.x0,s=e.y-this.y0;this.moved=!0,this.setHand(i,s,!1)};this._handleDocumentClickEnd=t=>{t.preventDefault(),document.removeEventListener("mouseup",this._handleDocumentClickEnd),document.removeEventListener("touchend",this._handleDocumentClickEnd);let e=T._Pos(t),i=e.x-this.x0,s=e.y-this.y0;this.moved&&i===this.dx&&s===this.dy&&this.setHand(i,s),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("mousemove",this._handleDocumentClickMove),document.removeEventListener("touchmove",this._handleDocumentClickMove)};this._handleAmPmClick=t=>{this._handleAmPmInteraction(t.target)};this._handleAmPmKeypress=t=>{r.keys.ENTER.includes(t.key)&&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(),t==="minutes"&&getComputedStyle(this.hoursView).visibility;let i=t==="hours",s=i?this.hoursView:this.minutesView,o=i?this.minutesView:this.hoursView;this.currentView=t,o.classList.add("timepicker-dial-out"),s.style.visibility="visible",s.classList.remove("timepicker-dial-out"),this.resetClock(e),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(()=>{o.style.visibility="hidden"},this.options.duration)};this._inputFromTextField=()=>{let t=this.currentView==="hours";if(t&&this.inputHours.value!==""){let e=parseInt(this.inputHours.value);e>0&&e<(this.options.twelveHour?13:24)?this.hours=e:this.setHoursDefault(),this.drawClockFromTimeInput(this.hours,t)}else if(!t&&this.inputMinutes.value!==""){let e=parseInt(this.inputMinutes.value);e>=0&&e<60?this.minutes=e:(this.minutes=new Date().getMinutes(),this.inputMinutes.value=this.minutes.toString()),this.drawClockFromTimeInput(this.minutes,t)}};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},this.id=r.guid(),this._insertHTMLIntoDOM(),this._setupVariables(),this._setupEventHandlers(),this._pickerSetup(),this.options.displayPlugin&&this.options.displayPlugin==="docked"&&(this.displayPlugin=G.init(this.el,this.containerEl,this.options.displayPluginOptions))}static get defaults(){return he}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 _Pos(t){return t.type.startsWith("touch")&&t.targetTouches.length>=1?{x:t.targetTouches[0].clientX,y:t.targetTouches[0].clientY}:{x:t.clientX,y:t.clientY}}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("mousedown",this._handleClockClickStart),this.plate.addEventListener("touchstart",this._handleClockClickStart),this.digitalClock.addEventListener("keyup",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.el.removeEventListener("click",this._handleInputClick),this.el.removeEventListener("keydown",this._handleInputKeydown),document.removeEventListener("mousemove",this._handleDocumentClickMove),document.removeEventListener("touchmove",this._handleDocumentClickMove),document.removeEventListener("mouseup",this._handleDocumentClickEnd),document.removeEventListener("touchend",this._handleDocumentClickEnd)}_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.spanAmPm=this.containerEl.querySelector(".timepicker-span-am-pm"),this.footer=this.containerEl.querySelector(".timepicker-footer"),this.amOrPm="PM"}_pickerSetup(){r.createButton(this.footer,this.options.i18n.clear,["timepicker-clear"],this.options.showClearBtn,this.clear),this.options.autoSubmit||r.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("div"),this._amBtn.classList.add("am-btn","btn"),this._amBtn.innerText="AM",this._amBtn.tabIndex=0,this._amBtn.addEventListener("click",this._handleAmPmClick),this._amBtn.addEventListener("keypress",this._handleAmPmKeypress),this.spanAmPm.appendChild(this._amBtn),this._pmBtn=document.createElement("div"),this._pmBtn.classList.add("pm-btn","btn"),this._pmBtn.innerText="PM",this._pmBtn.tabIndex=0,this._pmBtn.addEventListener("click",this._handleAmPmClick),this._pmBtn.addEventListener("keypress",this._handleAmPmKeypress),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 o=T._createSVGEl("g");o.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 l=T._createSVGEl("line");l.setAttribute("x1","0"),l.setAttribute("y1","0");let h=T._createSVGEl("circle");h.setAttribute("class","timepicker-canvas-bg"),h.setAttribute("r",e.toString()),o.appendChild(l),o.appendChild(h),o.appendChild(a),s.appendChild(o),this._canvas.appendChild(s),this.hand=l,this.bg=h,this.bearing=a,this.g=o}_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.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||"")+"").split(":");if(this.options.twelveHour&&!(typeof t[1]>"u")&&(t[1].toUpperCase().indexOf("AM")>0?this.amOrPm="AM":this.amOrPm="PM",t[1]=t[1].replace("AM","").replace("PM","")),t[0]==="now"){let e=new Date(+new Date+this.options.fromNow);t=[e.getHours().toString(),e.getMinutes().toString()],this.options.twelveHour&&(this.amOrPm=parseInt(t[0])>=12&&parseInt(t[0])<24?"PM":"AM")}this.hours=+t[0]||0,this.minutes=+t[1]||0,this.inputHours.value=T._addLeadingZero(this.hours),this.inputMinutes.value=T._addLeadingZero(this.minutes),this._updateAmPmView()}resetClock(t){let e=this.currentView,i=this[e],s=e==="hours",o=Math.PI/(s?6:30),a=i*o,l=s&&i>0&&i<13?this.options.innerRadius:this.options.outerRadius,h=Math.sin(a)*l,c=-Math.cos(a)*l;t?(this._canvas?.classList.add("timepicker-canvas-out"),setTimeout(()=>{this._canvas?.classList.remove("timepicker-canvas-out"),this.setHand(h,c)},t)):this.setHand(h,c)}drawClockFromTimeInput(t,e){let i=Math.PI/(e?6:30),s=t*i,o;this.options.twelveHour?o=this.options.outerRadius:o=e&&t>0&&t<13?this.options.innerRadius:this.options.outerRadius,this.setClockAttributes(s,o)}setHand(t,e,i=!1){let s=this.currentView==="hours",o=Math.PI/(s||i?6:30),a=Math.sqrt(t*t+e*e),l=s&&a<(this.options.outerRadius+this.options.innerRadius)/2,h=Math.atan2(t,-e),c=l?this.options.innerRadius:this.options.outerRadius;this.options.twelveHour&&(c=this.options.outerRadius),h<0&&(h=Math.PI*2+h);let d=Math.round(h/o);h=d*o,this.options.twelveHour?s?d===0&&(d=12):(i&&(d*=5),d===60&&(d=0)):s?(d===12&&(d=0),d=l?d===0?12:d:d===0?0:d+12):(i&&(d*=5),d===60&&(d=0)),this[this.currentView]!==d&&this.canVibrate&&this.options.vibrate&&(this.vibrateTimer||(navigator.vibrate(10),this.vibrateTimer=setTimeout(()=>{this.vibrateTimer=null},100))),this[this.currentView]=d,s?this.inputHours.value=T._addLeadingZero(d):this.inputMinutes.value=T._addLeadingZero(d),this.setClockAttributes(h,c)}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),o=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",o.toString()),this.bg.setAttribute("cy",a.toString())}formatHours(){this.inputHours.value==""&&this.setHoursDefault(),this.inputHours.value=T._addLeadingZero(Number(this.inputHours.value))}formatMinutes(){this.inputMinutes.value==""&&(this.minutes=new Date().getMinutes()),this.inputMinutes.value=T._addLeadingZero(Number(this.inputMinutes.value))}setHoursDefault(){this.hours=new Date().getHours(),this.inputHours.value=(this.hours%(this.options.twelveHour?12:24)).toString()}open(){return console.warn("Timepicker.close() is deprecated. Remove this method and wrap in modal yourself."),this}close(){return console.warn("Timepicker.close() is deprecated. Remove this method and wrap in modal yourself."),this}};T._template=`<div class="timepicker-container">
|
|
39
|
+
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 he={onOpen:null,onClose:null},A=class A extends f{constructor(t,e){super(t,e,A);this.wrapper=null;this.waveEl=null;this.contentEl=null;this._createdWrapper=!1;this._createdWave=!1;this._usePopover=!1;this._liftedStatic=!1;this._opening=!1;this.open=()=>{if(!(this.isOpen||!this.originEl||!this.wrapper)&&(A._taptargets.forEach(t=>{t!==this&&t.close()}),this._calculatePositioning(),typeof this.options.onOpen=="function"&&this.options.onOpen.call(this,this.originEl),this.isOpen=!0,this.wrapper.classList.add("open"),this.originEl.setAttribute("aria-expanded","true"),this._usePopover||(this.originEl.classList.add("tap-target-origin"),getComputedStyle(this.originEl).position==="static"&&(this.originEl.style.position="relative",this._liftedStatic=!0)),this._usePopover)){this._opening=!0;try{this.wrapper.showPopover()}catch{}requestAnimationFrame(()=>{this._opening=!1})}};this.close=()=>{if(this.isOpen&&(typeof this.options.onClose=="function"&&this.originEl&&this.options.onClose.call(this,this.originEl),this.isOpen=!1,this.wrapper?.classList.remove("open"),this.originEl?.setAttribute("aria-expanded","false"),this.originEl?.classList.remove("tap-target-origin"),this._liftedStatic&&this.originEl&&(this.originEl.style.position="",this._liftedStatic=!1),this._usePopover&&this.wrapper))try{this.wrapper.hidePopover()}catch{}};this._handleThrottledResize=r.throttle(()=>this._handleResize(),200);this._handleOriginKeydown=t=>{(r.keys.ENTER.includes(t.key)||t.key===" ")&&(t.preventDefault(),this._handleTargetToggle())};this._handleTargetToggle=()=>{this.isOpen?this.close():this.open()};this._handleResize=()=>{this.isOpen&&this._calculatePositioning()};this._handlePopoverToggle=t=>{if(("newState"in t?String(t.newState):"")!=="open"){if(this._opening){try{this.wrapper?.showPopover()}catch{}return}this.isOpen&&this.close()}};if(this.el.Expressive_TapTarget=this,this.options={...A.defaults,...e},this.isOpen=!1,this.originEl=t.dataset.target?document.getElementById(t.dataset.target):null,!this.originEl){console.error(`TapTarget: no element with id "${t.dataset.target??""}" to attach to`);return}this._setup(),this._calculatePositioning(),this._setupEventHandlers(),A._taptargets.push(this)}static get defaults(){return he}static init(t,e={}){return super.init(t,e,A)}static getInstance(t){return t.Expressive_TapTarget}destroy(){this.close(),this._removeEventHandlers(),this._teardownDom(),this.el.Expressive_TapTarget=void 0;let t=A._taptargets.indexOf(this);t>=0&&A._taptargets.splice(t,1)}_setup(){let t=this.el.parentElement;if(t?.classList.contains("tap-target-wrapper")?this.wrapper=t:(this.wrapper=document.createElement("div"),this.wrapper.classList.add("tap-target-wrapper"),this.el.before(this.wrapper),this.wrapper.append(this.el),this._createdWrapper=!0),this.contentEl=this.el.querySelector(".tap-target-content"),!this.contentEl){for(this.contentEl=document.createElement("div"),this.contentEl.className="tap-target-content";this.el.firstChild;)this.contentEl.append(this.el.firstChild);this.el.append(this.contentEl)}this.waveEl=this.el.querySelector(".tap-target-wave")??this.wrapper.querySelector(".tap-target-wave"),this.waveEl||(this.waveEl=document.createElement("div"),this.waveEl.className="tap-target-wave",this._createdWave=!0),this.el.prepend(this.waveEl),this.el.setAttribute("role","dialog"),this._labelFromHeading();let e=this.originEl;e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",this.el.id||this._ensureId()),this._usePopover=typeof this.wrapper.showPopover=="function",this._usePopover&&this.wrapper.setAttribute("popover","auto")}_ensureId(){return this.el.id||(this.el.id=`tap-target-${r.guid()}`),this.el.id}_labelFromHeading(){let t=this.contentEl?.querySelector("h1, h2, h3, h4, h5, h6");t&&(t.id||(t.id=`tap-target-title-${r.guid()}`),this.el.setAttribute("aria-labelledby",t.id))}_teardownDom(){this._createdWave&&this.waveEl?.remove(),this._createdWrapper&&this.wrapper&&(this.wrapper.before(this.el),this.wrapper.remove()),this.wrapper=null,this.waveEl=null}_setupEventHandlers(){this.originEl&&(this.originEl.addEventListener("click",this._handleTargetToggle),this.originEl.matches('button, a, [tabindex], .btn, [role="button"]')||(this.originEl.tabIndex=0,this.originEl.addEventListener("keydown",this._handleOriginKeydown)),this.wrapper?.addEventListener("toggle",this._handlePopoverToggle),window.addEventListener("resize",this._handleThrottledResize,{passive:!0}))}_removeEventHandlers(){this.originEl&&(this.originEl.removeEventListener("click",this._handleTargetToggle),this.originEl.removeEventListener("keydown",this._handleOriginKeydown),this.wrapper?.removeEventListener("toggle",this._handlePopoverToggle),window.removeEventListener("resize",this._handleThrottledResize))}_calculatePositioning(){if(!this.originEl||!this.wrapper)return;let t=this.originEl.getBoundingClientRect(),e=t.left+t.width/2,i=t.top+t.height/2,s=Math.max(t.width,t.height,1);this.wrapper.style.setProperty("--md-comp-tap-target-x",`${e}px`),this.wrapper.style.setProperty("--md-comp-tap-target-y",`${i}px`),this.wrapper.style.setProperty("--md-comp-tap-target-origin-size",`${s}px`);let o=i<=window.innerHeight/2?"top":"bottom",l=e>=window.innerWidth*.25&&e<=window.innerWidth*.75?"center":e<=window.innerWidth/2?"left":"right";this.wrapper.dataset.edge=`${o}-${l}`}};A._taptargets=[];var st=A;var ce={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"},twelveHour:!0,vibrate:!0,onSelect:null,onInputInteraction:null,onDone:null,onCancel:null,displayPlugin:null,displayPluginOptions:null},y=class y extends f{constructor(t,e){super(t,e,y);this._clockBuilt=!1;this._handleInputClick=()=>{this._ensureClockBuilt(),this.inputHours.focus(),typeof this.options.onInputInteraction=="function"&&this.options.onInputInteraction.call(this),this.displayPlugin&&this.displayPlugin.show()};this._handleInputKeydown=t=>{r.keys.ENTER.includes(t.key)&&(t.preventDefault(),this._ensureClockBuilt(),this.inputHours.focus(),typeof this.options.onInputInteraction=="function"&&this.options.onInputInteraction.call(this),this.displayPlugin&&this.displayPlugin.show())};this._handleTimeInputEnterKey=t=>{r.keys.ENTER.includes(t.key)&&(t.preventDefault(),this._inputFromTextField())};this._handleClockClickStart=t=>{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;let s=y._Pos(t);this.dx=s.x-this.x0,this.dy=s.y-this.y0,this.setHand(this.dx,this.dy,!1),document.addEventListener("mousemove",this._handleDocumentClickMove),document.addEventListener("touchmove",this._handleDocumentClickMove),document.addEventListener("mouseup",this._handleDocumentClickEnd),document.addEventListener("touchend",this._handleDocumentClickEnd)};this._handleDocumentClickMove=t=>{t.preventDefault();let e=y._Pos(t),i=e.x-this.x0,s=e.y-this.y0;this.moved=!0,this.setHand(i,s,!1)};this._handleDocumentClickEnd=t=>{t.preventDefault(),document.removeEventListener("mouseup",this._handleDocumentClickEnd),document.removeEventListener("touchend",this._handleDocumentClickEnd);let e=y._Pos(t),i=e.x-this.x0,s=e.y-this.y0;this.moved&&i===this.dx&&s===this.dy&&this.setHand(i,s),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("mousemove",this._handleDocumentClickMove),document.removeEventListener("touchmove",this._handleDocumentClickMove)};this._handleAmPmClick=t=>{this._handleAmPmInteraction(t.target)};this._handleAmPmKeypress=t=>{r.keys.ENTER.includes(t.key)&&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(),t==="minutes"&&getComputedStyle(this.hoursView).visibility;let i=t==="hours",s=i?this.hoursView:this.minutesView,o=i?this.minutesView:this.hoursView;this.currentView=t,o.classList.add("timepicker-dial-out"),s.style.visibility="visible",s.classList.remove("timepicker-dial-out"),this.resetClock(e),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(()=>{o.style.visibility="hidden"},this.options.duration)};this._inputFromTextField=()=>{let t=this.currentView==="hours";if(t&&this.inputHours.value!==""){let e=parseInt(this.inputHours.value);e>0&&e<(this.options.twelveHour?13:24)?this.hours=e:this.setHoursDefault(),this.drawClockFromTimeInput(this.hours,t)}else if(!t&&this.inputMinutes.value!==""){let e=parseInt(this.inputMinutes.value);e>=0&&e<60?this.minutes=e:(this.minutes=new Date().getMinutes(),this.inputMinutes.value=this.minutes.toString()),this.drawClockFromTimeInput(this.minutes,t)}};this.done=(t=null)=>{let e=this.el.value,i=t?"":y._addLeadingZero(this.hours)+":"+y._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={...y.defaults,...e},this.id=r.guid(),this._insertHTMLIntoDOM(),this._setupVariables(),this._setupEventHandlers(),this._pickerSetup(),this.options.displayPlugin&&this.options.displayPlugin==="docked"&&(this.displayPlugin=z.init(this.el,this.containerEl,this.options.displayPluginOptions))}static get defaults(){return ce}static init(t,e={}){return super.init(t,e,y)}static _addLeadingZero(t){return(t<10?"0":"")+t}static _createSVGEl(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}static _Pos(t){return t.type.startsWith("touch")&&t.targetTouches.length>=1?{x:t.targetTouches[0].clientX,y:t.targetTouches[0].clientY}:{x:t.clientX,y:t.clientY}}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("mousedown",this._handleClockClickStart),this.plate.addEventListener("touchstart",this._handleClockClickStart),this.digitalClock.addEventListener("keyup",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.el.removeEventListener("click",this._handleInputClick),this.el.removeEventListener("keydown",this._handleInputKeydown),document.removeEventListener("mousemove",this._handleDocumentClickMove),document.removeEventListener("touchmove",this._handleDocumentClickMove),document.removeEventListener("mouseup",this._handleDocumentClickEnd),document.removeEventListener("touchend",this._handleDocumentClickEnd)}_insertHTMLIntoDOM(){let t=document.createElement("template");t.innerHTML=y._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.spanAmPm=this.containerEl.querySelector(".timepicker-span-am-pm"),this.footer=this.containerEl.querySelector(".timepicker-footer"),this.amOrPm="PM"}_pickerSetup(){r.createButton(this.footer,this.options.i18n.clear,["timepicker-clear"],this.options.showClearBtn,this.clear),this.options.autoSubmit||r.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("div"),this._amBtn.classList.add("am-btn","btn"),this._amBtn.innerText="AM",this._amBtn.tabIndex=0,this._amBtn.addEventListener("click",this._handleAmPmClick),this._amBtn.addEventListener("keypress",this._handleAmPmKeypress),this.spanAmPm.appendChild(this._amBtn),this._pmBtn=document.createElement("div"),this._pmBtn.classList.add("pm-btn","btn"),this._pmBtn.innerText="PM",this._pmBtn.tabIndex=0,this._pmBtn.addEventListener("click",this._handleAmPmClick),this._pmBtn.addEventListener("keypress",this._handleAmPmKeypress),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=y._createSVGEl("svg");s.setAttribute("class","timepicker-svg"),s.setAttribute("width",i.toString()),s.setAttribute("height",i.toString());let o=y._createSVGEl("g");o.setAttribute("transform","translate("+t+","+t+")");let a=y._createSVGEl("circle");a.setAttribute("class","timepicker-canvas-bearing"),a.setAttribute("cx","0"),a.setAttribute("cy","0"),a.setAttribute("r","4");let l=y._createSVGEl("line");l.setAttribute("x1","0"),l.setAttribute("y1","0");let h=y._createSVGEl("circle");h.setAttribute("class","timepicker-canvas-bg"),h.setAttribute("r",e.toString()),o.appendChild(l),o.appendChild(h),o.appendChild(a),s.appendChild(o),this._canvas.appendChild(s),this.hand=l,this.bg=h,this.bearing=a,this.g=o}_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=y._addLeadingZero(e),this.minutesView.appendChild(i)}}_updateAmPmView(){!this._amBtn||!this._pmBtn||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||"")+"").split(":");if(this.options.twelveHour&&!(typeof t[1]>"u")&&(t[1].toUpperCase().indexOf("AM")>0?this.amOrPm="AM":this.amOrPm="PM",t[1]=t[1].replace("AM","").replace("PM","")),t[0]==="now"){let e=new Date(+new Date+this.options.fromNow);t=[e.getHours().toString(),e.getMinutes().toString()],this.options.twelveHour&&(this.amOrPm=parseInt(t[0])>=12&&parseInt(t[0])<24?"PM":"AM")}this.hours=+t[0]||0,this.minutes=+t[1]||0,this.inputHours.value=y._addLeadingZero(this.hours),this.inputMinutes.value=y._addLeadingZero(this.minutes),this._updateAmPmView()}resetClock(t){let e=this.currentView,i=this[e],s=e==="hours",o=Math.PI/(s?6:30),a=i*o,l=s&&i>0&&i<13?this.options.innerRadius:this.options.outerRadius,h=Math.sin(a)*l,d=-Math.cos(a)*l;t?(this._canvas?.classList.add("timepicker-canvas-out"),setTimeout(()=>{this._canvas?.classList.remove("timepicker-canvas-out"),this.setHand(h,d)},t)):this.setHand(h,d)}drawClockFromTimeInput(t,e){let i=Math.PI/(e?6:30),s=t*i,o;this.options.twelveHour?o=this.options.outerRadius:o=e&&t>0&&t<13?this.options.innerRadius:this.options.outerRadius,this.setClockAttributes(s,o)}setHand(t,e,i=!1){let s=this.currentView==="hours",o=Math.PI/(s||i?6:30),a=Math.sqrt(t*t+e*e),l=s&&a<(this.options.outerRadius+this.options.innerRadius)/2,h=Math.atan2(t,-e),d=l?this.options.innerRadius:this.options.outerRadius;this.options.twelveHour&&(d=this.options.outerRadius),h<0&&(h=Math.PI*2+h);let c=Math.round(h/o);h=c*o,this.options.twelveHour?s?c===0&&(c=12):(i&&(c*=5),c===60&&(c=0)):s?(c===12&&(c=0),c=l?c===0?12:c:c===0?0:c+12):(i&&(c*=5),c===60&&(c=0)),this[this.currentView]!==c&&this.canVibrate&&this.options.vibrate&&(this.vibrateTimer||(navigator.vibrate(10),this.vibrateTimer=setTimeout(()=>{this.vibrateTimer=null},100))),this[this.currentView]=c,s?this.inputHours.value=y._addLeadingZero(c):this.inputMinutes.value=y._addLeadingZero(c),this.setClockAttributes(h,d)}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),o=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",o.toString()),this.bg.setAttribute("cy",a.toString())}formatHours(){this.inputHours.value==""&&this.setHoursDefault(),this.inputHours.value=y._addLeadingZero(Number(this.inputHours.value))}formatMinutes(){this.inputMinutes.value==""&&(this.minutes=new Date().getMinutes()),this.inputMinutes.value=y._addLeadingZero(Number(this.inputMinutes.value))}setHoursDefault(){this.hours=new Date().getHours(),this.inputHours.value=(this.hours%(this.options.twelveHour?12:24)).toString()}open(){return console.warn("Timepicker.close() is deprecated. Remove this method and wrap in modal yourself."),this}close(){return console.warn("Timepicker.close() is deprecated. Remove this method and wrap in modal yourself."),this}};y._template=`<div class="timepicker-container">
|
|
40
40
|
<div class="timepicker-digital-display">
|
|
41
41
|
<div class="timepicker-text-container">
|
|
42
42
|
<div class="timepicker-display-column timepicker-display-digital-clock">
|
|
@@ -63,14 +63,14 @@ var Expressive=(()=>{var Ct=Object.defineProperty;var At=Object.getOwnPropertyDe
|
|
|
63
63
|
</div>
|
|
64
64
|
<div class="timepicker-footer"></div>
|
|
65
65
|
</div>
|
|
66
|
-
</div>`;var
|
|
66
|
+
</div>`;var nt=y;var de={text:"",action:"",onAction:null,dismissible:!1,displayLength:4e3,inDuration:300,outDuration:375,classes:"",completeCallback:null,activationPercent:.8},_=class _{constructor(n){this.options={..._.defaults,...n},this.message=this.options.text,this.panning=!1,this.timeRemaining=this.options.displayLength,_._toasts.length===0&&_._createContainer(),_._toasts.push(this);let t=this._createToast();t.Expressive_Toast=this,this.el=t,this._animateIn(),this._setTimer()}static get defaults(){return de}static getInstance(n){return n.Expressive_Toast}static _createContainer(){let n=document.createElement("div");n.setAttribute("id","toast-container"),n.addEventListener("touchstart",_._onDragStart),n.addEventListener("touchmove",_._onDragMove),n.addEventListener("touchend",_._onDragEnd),n.addEventListener("mousedown",_._onDragStart),document.addEventListener("mousemove",_._onDragMove),document.addEventListener("mouseup",_._onDragEnd),document.body.appendChild(n),_._container=n}static _removeContainer(){document.removeEventListener("mousemove",_._onDragMove),document.removeEventListener("mouseup",_._onDragEnd),_._container.remove(),_._container=null}static _onDragStart(n){let t=n.target;if(t&&!t.closest("button, a")&&t.closest(".toast, .snackbar")){let i=t.closest(".toast, .snackbar").Expressive_Toast;if(!i)return;i.panning=!0,i._pauseTimer(),_._draggedToast=i,i.el.classList.add("panning"),i.el.style.transition="",i.startingXPos=_._xPos(n),i.time=Date.now(),i.xPos=_._xPos(n)}}static _onDragMove(n){if(_._draggedToast){n.preventDefault();let t=_._draggedToast;t.deltaX=Math.abs(t.xPos-_._xPos(n)),t.xPos=_._xPos(n),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(){if(_._draggedToast){let n=_._draggedToast;n.panning=!1,n.el.classList.remove("panning");let t=n.xPos-n.startingXPos,e=n.el.offsetWidth*n.options.activationPercent;Math.abs(t)>e||n.velocityX>1?(n.wasSwiped=!0,n.dismiss()):(n.el.style.transition="transform .2s, opacity .2s",n.el.style.transform="",n.el.style.opacity="",n._resumeTimer()),_._draggedToast=null}}static _xPos(n){return n.type.startsWith("touch")&&n.targetTouches.length>=1?n.targetTouches[0].clientX:n.clientX}static dismissAll(){for(let n of[..._._toasts])n.dismiss()}_createToast(){let n=this.options.toastId?document.getElementById(this.options.toastId):document.createElement("div");if(n instanceof HTMLTemplateElement&&(n=n.content.cloneNode(!0).firstElementChild),n.classList.add("toast","snackbar"),n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),this.options.classes.length>0&&n.classList.add(...this.options.classes.split(" ").filter(Boolean)),this.message){let t=document.createElement("p");t.textContent=this.message,n.replaceChildren(t)}if(this.options.action){let t=document.createElement("button");t.type="button",t.textContent=this.options.action,t.addEventListener("click",e=>{e.stopPropagation(),typeof this.options.onAction=="function"&&this.options.onAction(),this.dismiss()}),n.appendChild(t)}if(this.options.dismissible){let t=document.createElement("button");t.type="button",t.className="circle",t.setAttribute("aria-label","Dismiss");let e=document.createElement("i");e.className="material-symbols",e.setAttribute("aria-hidden","true"),e.textContent="close",t.appendChild(e),t.addEventListener("click",i=>{i.stopPropagation(),this.dismiss()}),n.appendChild(t)}return _._container.appendChild(n),n}_animateIn(){this.el.style.display="",this.el.style.opacity="0",this.el.style.transition=`
|
|
67
67
|
top ${this.options.inDuration}ms ease,
|
|
68
68
|
opacity ${this.options.inDuration}ms ease
|
|
69
69
|
`,setTimeout(()=>{this.el.style.top="0",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.counterTimeout==null&&this._setTimer()}dismiss(){clearTimeout(this.counterTimeout),this.counterTimeout=null;let n=this.el.offsetWidth*this.options.activationPercent;this.wasSwiped&&(this.el.style.transition="transform .05s, opacity .05s",this.el.style.transform=`translateX(${n}px)`,this.el.style.opacity="0"),this.el.style.transition=`
|
|
70
70
|
margin ${this.options.outDuration}ms ease,
|
|
71
|
-
opacity ${this.options.outDuration}ms ease`,setTimeout(()=>{this.el.style.opacity="0",this.el.style.marginTop="-40px"},1),setTimeout(()=>{if(typeof this.options.completeCallback=="function"&&this.options.completeCallback(),this.el.id!=this.options.toastId){this.el.remove();let t=
|
|
71
|
+
opacity ${this.options.outDuration}ms ease`,setTimeout(()=>{this.el.style.opacity="0",this.el.style.marginTop="-40px"},1),setTimeout(()=>{if(typeof this.options.completeCallback=="function"&&this.options.completeCallback(),this.el.id!=this.options.toastId){this.el.remove();let t=_._toasts.indexOf(this);t>=0&&_._toasts.splice(t,1),_._toasts.length===0&&_._container&&_._removeContainer()}},this.options.outDuration)}};_._toasts=[],_._container=null,_._draggedToast=null;var pt=_;var pe={exitDelay:200,enterDelay:0,text:"",margin:4,inDuration:250,outDuration:200,position:"bottom",transitionMovement:10,opacity:1},ot=class u extends f{constructor(t,e){super(t,e,u);this.open=t=>{this.isOpen||(t=t===void 0?!0:void 0,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,this._setExitDelayTimeout())};this._handleMouseEnter=()=>{this.isHovered=!0,this.isFocused=!1,this.open(!1)};this._handleMouseLeave=()=>{this.isHovered=!1,this.isFocused=!1,this.close()};this._handleFocus=()=>{r.tabPressed&&(this.isFocused=!0,this.open(!1))};this._handleBlur=()=>{this.isFocused=!1,this.close()};this.el.Expressive_Tooltip=this,this.options={...u.defaults,...this._getAttributeOptions(),...e},this.isOpen=!1,this.isHovered=!1,this.isFocused=!1,this._appendTooltipEl(),this._setupEventHandlers()}static get defaults(){return pe}static init(t,e={}){return super.init(t,e,u)}static getInstance(t){return t.Expressive_Tooltip}destroy(){this.el.getAttribute("aria-describedby")===this.tooltipEl.id&&this.el.removeAttribute("aria-describedby"),this.tooltipEl.remove(),this._removeEventHandlers(),this.el.Expressive_Tooltip=void 0}_appendTooltipEl(){this.tooltipEl=document.createElement("div"),this.tooltipEl.classList.add("tooltip","material-tooltip"),this.tooltipEl.id=`tooltip-${r.guid()}`,this.tooltipEl.setAttribute("role","tooltip"),this.el.setAttribute("aria-describedby",this.tooltipEl.id);let t=this.options.tooltipId?document.getElementById(this.options.tooltipId):document.createElement("div");this.options.tooltipId&&this.tooltipEl.classList.add("rich"),t.style.display="",t.classList.add("tooltip-content"),this._setTooltipContent(t),this.tooltipEl.appendChild(t),document.body.appendChild(this.tooltipEl)}_setTooltipContent(t){this.options.tooltipId||(t.innerText=this.options.text)}_updateTooltipContent(){this._setTooltipContent(this.tooltipEl.querySelector(".tooltip-content"))}_setupEventHandlers(){this.el.addEventListener("mouseenter",this._handleMouseEnter),this.el.addEventListener("mouseleave",this._handleMouseLeave),this.el.addEventListener("focus",this._handleFocus,!0),this.el.addEventListener("blur",this._handleBlur,!0)}_removeEventHandlers(){this.el.removeEventListener("mouseenter",this._handleMouseEnter),this.el.removeEventListener("mouseleave",this._handleMouseLeave),this.el.removeEventListener("focus",this._handleFocus,!0),this.el.removeEventListener("blur",this._handleBlur,!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,o=t.offsetHeight,a=t.offsetWidth,l=this.options.margin;this.xMovement=0,this.yMovement=0;let h=e.getBoundingClientRect(),d=h.top+r.getDocumentScrollTop(),c=h.left+r.getDocumentScrollLeft();this.options.position==="top"?(d+=-o-l,c+=s/2-a/2,this.yMovement=-this.options.transitionMovement):this.options.position==="right"?(d+=i/2-o/2,c+=s+l,this.xMovement=this.options.transitionMovement):this.options.position==="left"?(d+=i/2-o/2,c+=-a-l,this.xMovement=-this.options.transitionMovement):(d+=i+l,c+=s/2-a/2,this.yMovement=this.options.transitionMovement);let m=this._repositionWithinScreen(c,d,a,o);t.style.top=m.y+"px",t.style.left=m.x+"px"}_repositionWithinScreen(t,e,i,s){let o=r.getDocumentScrollLeft(),a=r.getDocumentScrollTop(),l=t-o,h=e-a,d={left:l,top:h,width:i,height:s},c=this.options.margin+this.options.transitionMovement,m=r.checkWithinContainer(document.body,d,c);return m.left?l=c:m.right&&(l-=l+i-window.innerWidth),m.top?h=c:m.bottom&&(h-=h+s-window.innerHeight),{x:l+o,y:h+a}}_animateIn(){this._positionTooltip(),this.tooltipEl.style.visibility="visible";let t=this.options.inDuration;this.tooltipEl.style.transition=`
|
|
72
72
|
transform ${t}ms ease-out,
|
|
73
73
|
opacity ${t}ms ease-out`,setTimeout(()=>{this.tooltipEl.style.transform=`translateX(${this.xMovement}px) translateY(${this.yMovement}px)`,this.tooltipEl.style.opacity=(this.options.opacity||1).toString()},1)}_animateOut(){let t=this.options.outDuration;this.tooltipEl.style.transition=`
|
|
74
74
|
transform ${t}ms ease-out,
|
|
75
|
-
opacity ${t}ms ease-out`,setTimeout(()=>{this.tooltipEl.style.transform="translateX(0px) translateY(0px)",this.tooltipEl.style.opacity="0"},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
|
|
75
|
+
opacity ${t}ms ease-out`,setTimeout(()=>{this.tooltipEl.style.transform="translateX(0px) translateY(0px)",this.tooltipEl.style.opacity="0"},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 Tt={Autocomplete:{component:B,selector:".autocomplete"},Cards:{component:R,selector:vt},Carousel:{component:F,selector:".carousel"},Chips:{component:W,selector:".chips"},Collapsible:{component:Y,selector:".collapsible"},Datepicker:{component:U,selector:".datepicker"},Dropdown:{component:S,selector:".dropdown-trigger"},Lightbox:{component:j,selector:".lightboxed"},Modal:{component:Z,selector:".modal"},Parallax:{component:Q,selector:".parallax"},Pushpin:{component:J,selector:".pushpin"},ScrollSpy:{component:tt,selector:".scrollspy"},FormSelect:{component:H,selector:"select"},Sidenav:{component:et,selector:".sidenav"},Tabs:{component:it,selector:".tabs"},TapTarget:{component:st,selector:".tap-target"},Timepicker:{component:nt,selector:".timepicker"},Tooltip:{component:ot,selector:".tooltipped"},FloatingActionButton:{component:X,selector:".fixed-action-btn"}};function Lt(u=document.body,n){for(let t of Object.keys(Tt)){let{component:e,selector:i}=Tt[t],s=u.querySelectorAll(`:is(${i}):not(.no-autoinit)`);e.init(s,n?.[t]??{})}}var me="0.3.0";typeof document<"u"&&(document.addEventListener("keydown",r.docHandleKeydown,!0),document.addEventListener("keyup",r.docHandleKeyup,!0),document.addEventListener("focus",r.docHandleFocus,!0),document.addEventListener("blur",r.docHandleBlur,!0));q.Init();W.Init();K.Init();N.Init();R.Init();$.Init();return Vt(fe);})();
|
|
76
76
|
//# sourceMappingURL=expressive.min.js.map
|